From 9a84af4d5baffe87f7e42f41b992611c46681c3a Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 4 May 2022 22:00:02 +0000 Subject: Bug 1761981 --- dom/jsurl/nsJSProtocolHandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dom/jsurl/nsJSProtocolHandler.cpp b/dom/jsurl/nsJSProtocolHandler.cpp index 82d24d1334..b6584b8a58 100644 --- a/dom/jsurl/nsJSProtocolHandler.cpp +++ b/dom/jsurl/nsJSProtocolHandler.cpp @@ -202,7 +202,12 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel, // Sandboxed document check: javascript: URI's are disabled // in a sandboxed document unless 'allow-scripts' was specified. nsIDocument* doc = aOriginalInnerWindow->GetExtantDoc(); + if (doc && !doc->IsScriptEnabled()) { + // Scripts not allowed on the extant doc. + return NS_ERROR_DOM_RETVAL_UNDEFINED; + } if (doc && doc->HasScriptsBlockedBySandbox()) { + // Sandbox policy forbids scripting. return NS_ERROR_DOM_RETVAL_UNDEFINED; } -- cgit v1.2.3