-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the capability to ignore cert errors should be browser-wide (#2369)
- Loading branch information
1 parent
be5e61b
commit 6db665b
Showing
6 changed files
with
79 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright 2024 Google LLC. | ||
# Copyright (c) Microsoft Corporation. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import pytest | ||
from anys import ANY_STR | ||
from test_helpers import execute_command | ||
|
||
|
||
@pytest.mark.asyncio | ||
@pytest.mark.parametrize('capabilities', [{ | ||
'acceptInsecureCerts': True | ||
}], | ||
indirect=True) | ||
async def test_serviceWorker_acceptInsecureCertsCapability_respected( | ||
websocket, context_id, url_bad_ssl, local_server_bad_ssl): | ||
service_worker_script = local_server_bad_ssl.url_200( | ||
content='', content_type='text/javascript') | ||
service_worker_page = local_server_bad_ssl.url_200(content=f"""<script> | ||
window.registrationPromise = navigator.serviceWorker.register('{service_worker_script}'); | ||
</script>""") | ||
|
||
await execute_command( | ||
websocket, { | ||
'method': 'browsingContext.navigate', | ||
'params': { | ||
'url': service_worker_page, | ||
'wait': 'complete', | ||
'context': context_id | ||
} | ||
}) | ||
|
||
resp = await execute_command( | ||
websocket, { | ||
'method': 'script.evaluate', | ||
'params': { | ||
'expression': 'window.registrationPromise.then(r=>r.unregister())', | ||
'awaitPromise': True, | ||
'target': { | ||
'context': context_id | ||
} | ||
} | ||
}) | ||
assert resp == { | ||
'realm': ANY_STR, | ||
'result': { | ||
'type': 'boolean', | ||
'value': True, | ||
}, | ||
'type': 'success', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters