mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #10946 - bd339:iss10940, r=nox
Disable scripting for documents created without a browsing context Goes towards closing #10940. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10946) <!-- Reviewable:end -->
This commit is contained in:
commit
a54dedac1f
3 changed files with 23 additions and 1 deletions
|
@ -1668,7 +1668,7 @@ impl Document {
|
||||||
deferred_scripts: DOMRefCell::new(vec![]),
|
deferred_scripts: DOMRefCell::new(vec![]),
|
||||||
asap_in_order_scripts_list: DOMRefCell::new(vec![]),
|
asap_in_order_scripts_list: DOMRefCell::new(vec![]),
|
||||||
asap_scripts_set: DOMRefCell::new(vec![]),
|
asap_scripts_set: DOMRefCell::new(vec![]),
|
||||||
scripting_enabled: Cell::new(true),
|
scripting_enabled: Cell::new(browsing_context.is_some()),
|
||||||
animation_frame_ident: Cell::new(0),
|
animation_frame_ident: Cell::new(0),
|
||||||
animation_frame_list: DOMRefCell::new(BTreeMap::new()),
|
animation_frame_list: DOMRefCell::new(BTreeMap::new()),
|
||||||
loader: DOMRefCell::new(doc_loader),
|
loader: DOMRefCell::new(doc_loader),
|
||||||
|
|
|
@ -35270,6 +35270,12 @@
|
||||||
"path": "html/semantics/forms/form-submission-0/submit-entity-body.html",
|
"path": "html/semantics/forms/form-submission-0/submit-entity-body.html",
|
||||||
"url": "/html/semantics/forms/form-submission-0/submit-entity-body.html"
|
"url": "/html/semantics/forms/form-submission-0/submit-entity-body.html"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"html/semantics/scripting-1/the-script-element/scripting-enabled.html": [
|
||||||
|
{
|
||||||
|
"path": "html/semantics/scripting-1/the-script-element/scripting-enabled.html",
|
||||||
|
"url": "/html/semantics/scripting-1/the-script-element/scripting-enabled.html"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>JS is disabled on documents created without a browsing context</title>
|
||||||
|
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-script">
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script>
|
||||||
|
test(function(t) {
|
||||||
|
var doc = document.implementation.createHTMLDocument();
|
||||||
|
window.fail_test = t.unreached_func('should not have been called');
|
||||||
|
|
||||||
|
var script = doc.createElement('script');
|
||||||
|
script.textContent = 'fail_test();';
|
||||||
|
doc.documentElement.appendChild(script);
|
||||||
|
}, 'script on document returned by createHTMLDocument should not execute');
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue