mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Check CSP for javascript:
URLs (#36709)
Also update a WPT test to fail-fast if the iframe incorrectly evaluates the `eval`. Before, it would run into a timeout if the implementation is correct. Now we reject the promise when an exception is thrown. Requires servo/rust-content-security-policy#6 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
b8971e528f
commit
dd63325f50
16 changed files with 70 additions and 57 deletions
|
@ -162,8 +162,13 @@ impl HTMLIFrameElement {
|
|||
if load_data.url.scheme() == "javascript" {
|
||||
let window_proxy = self.GetContentWindow();
|
||||
if let Some(window_proxy) = window_proxy {
|
||||
if document
|
||||
.global()
|
||||
.should_navigation_request_be_blocked(&load_data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Important re security. See https://github.com/servo/servo/issues/23373
|
||||
// TODO: check according to https://w3c.github.io/webappsec-csp/#should-block-navigation-request
|
||||
if ScriptThread::check_load_origin(&load_data.load_origin, &document.url().origin())
|
||||
{
|
||||
ScriptThread::eval_js_url(&window_proxy.global(), &mut load_data, can_gc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue