-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
381f152
commit 1ed5696
Showing
13 changed files
with
280 additions
and
58 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
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
41 changes: 41 additions & 0 deletions
41
integration-test/test-pages/webcompat/config/modify-localstorage.json
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,41 @@ | ||
{ | ||
"unprotectedTemporary": [], | ||
"features": { | ||
"webCompat": { | ||
"exceptions": [], | ||
"state": "enabled", | ||
"settings": { | ||
"windowSizing": "enabled", | ||
"navigatorCredentials": "enabled", | ||
"safariObject": "enabled", | ||
"modifyLocalStorage": { | ||
"state": "enabled", | ||
"changes": [] | ||
}, | ||
"domains": [ | ||
{ | ||
"domain": ["localhost", "privacy-test-pages.site"], | ||
"patchSettings": [ | ||
{ | ||
"op": "add", | ||
"path": "/modifyLocalStorage/changes/-", | ||
"value": { | ||
"key": "keyToBeDeleted", | ||
"action": "delete" | ||
} | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/modifyLocalStorage/changes/-", | ||
"value": { | ||
"key": "nonexistentKey", | ||
"action": "delete" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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
62 changes: 62 additions & 0 deletions
62
integration-test/test-pages/webcompat/pages/message-handlers.html
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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Webcompat</title> | ||
<link rel="stylesheet" href="../../shared/style.css"> | ||
</head> | ||
<body> | ||
<script src="../../shared/utils.js"></script> | ||
|
||
<p>Webcompat, Message Handlers</p> | ||
<script> | ||
test('webkit.messageHandlers - polyfill prevents throw', async () => { | ||
let notThrown = true; | ||
try { | ||
window.webkit.messageHandlers.anythingatall.postMessage({}) | ||
} catch (e) { | ||
notThrown = false | ||
} | ||
return [ | ||
{ name: 'Error not thrown polyfil', result: notThrown, expected: true }, | ||
] | ||
}) | ||
test('webkit.messageHandlers - undefined should throw', async () => { | ||
let thrown = false; | ||
try { | ||
window.webkit.messageHandlers.jsHandler.postMessage({}) | ||
} catch (e) { | ||
thrown = true | ||
} | ||
return [ | ||
{ name: 'undefined handler should throw', result: thrown, expected: true }, | ||
] | ||
}) | ||
test('webkit.messageHandlers - reflected message', async () => { | ||
window.webkit.messageHandlers.printHandler = { | ||
postMessage() { | ||
return { test: "test" } | ||
} | ||
} | ||
|
||
const value = window.webkit.messageHandlers.printHandler.postMessage({}); | ||
|
||
return [ | ||
{ name: 'reflected message should pass through', result: value.test, expected: 'test' }, | ||
] | ||
}) | ||
renderResults(); | ||
|
||
async function captureError(fn) { | ||
try { | ||
// ensure Promise.reject is captured | ||
return fn().catch(e => e) | ||
} catch (e) { | ||
return e | ||
} | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
37 changes: 37 additions & 0 deletions
37
integration-test/test-pages/webcompat/pages/modify-localstorage.html
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,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Modify localStorage</title> | ||
<link rel="stylesheet" href="../../shared/style.css"> | ||
<script> | ||
window.localStorage.setItem('keyToBeDeleted', 'valueToBeDeleted') | ||
window.localStorage.setItem('otherKey', 'valueToRemain') | ||
</script> | ||
</head> | ||
<body> | ||
<script src="../../shared/utils.js"></script> | ||
<p><a href="../index.html">[WebCompat]</a></p> | ||
|
||
<p>This page verifies that localStorage modifications work properly given the <a href="../config/modify-localstorage.json">config</a>. At this time, only deletion is supported.</p> | ||
|
||
<script> | ||
// eslint-disable-next-line no-undef | ||
test('Only specified localStorage entry should be removed', async () => { | ||
const specifiedKey = window.localStorage.getItem('keyToBeDeleted') | ||
const nonexistentKey = window.localStorage.getItem('nonexistentKey') | ||
const otherKey = window.localStorage.getItem('otherKey') | ||
|
||
return [ | ||
{ name: 'specified localStorage entry deleted', result: specifiedKey, expected: null }, | ||
{ name: 'specified localStorage entry that is not present on page load', result: nonexistentKey, expected: null }, | ||
{ name: 'other localStorage entry untouched', result: otherKey, expected: 'valueToRemain' } | ||
]; | ||
}); | ||
|
||
// eslint-disable-next-line no-undef | ||
renderResults(); | ||
</script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.