Add tests for per-URL JavaScript settings
This commit is contained in:
parent
3956f81e73
commit
98b2b67b8b
16
tests/end2end/data/javascript/enabled.html
Normal file
16
tests/end2end/data/javascript/enabled.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
function check_enabled() {
|
||||
const elem = document.getElementById("status");
|
||||
elem.innerHTML = "enabled";
|
||||
console.log("JavaScript is enabled");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="check_enabled()">
|
||||
<p>JavaScript is <span id="status">disabled</span></p>
|
||||
<noscript>noscript tag</noscript>
|
||||
</body>
|
||||
</html>
|
@ -7,8 +7,10 @@
|
||||
try {
|
||||
localStorage.qute_test = "foo";
|
||||
elem.innerHTML = "working";
|
||||
console.log("local storage is working");
|
||||
} catch (e) {
|
||||
elem.innerHTML = "not working";
|
||||
console.log("local storage is not working");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -151,3 +151,19 @@ Feature: Javascript stuff
|
||||
And I run :greasemonkey-reload
|
||||
And I open data/hints/iframe.html
|
||||
Then the javascript message "Script is running on /data/hints/html/wrapped.html" should not be logged
|
||||
|
||||
Scenario: Per-URL localstorage setting
|
||||
When I set content.local_storage to false
|
||||
And I run :set -u http://localhost:*/data2/* content.local_storage true
|
||||
And I open data/javascript/localstorage.html
|
||||
And I wait for "[*] local storage is not working" in the log
|
||||
And I open data2/javascript/localstorage.html
|
||||
Then the javascript message "local storage is working" should be logged
|
||||
|
||||
Scenario: Per-URL JavaScript setting
|
||||
When I set content.javascript.enabled to false
|
||||
And I run :set -u http://localhost:*/data2/* content.javascript.enabled true
|
||||
And I open data2/javascript/enabled.html
|
||||
And I wait for "[*] JavaScript is enabled" in the log
|
||||
And I open data/javascript/enabled.html
|
||||
Then the page should contain the plaintext "JavaScript is disabled"
|
||||
|
@ -48,6 +48,7 @@ def root():
|
||||
|
||||
|
||||
@app.route('/data/<path:path>')
|
||||
@app.route('/data2/<path:path>') # for per-URL settings
|
||||
def send_data(path):
|
||||
"""Send a given data file to qutebrowser.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user