diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index fdb6dc9d3a1..db355494bfb 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1915,6 +1915,19 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace) return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } + nsresult rv = NS_OK; + + nsPIDOMWindow *win = GetWindow(); + if (win) { + nsCOMPtr frameElement; + rv = win->GetFrameElement(getter_AddRefs(frameElement)); + NS_ENSURE_SUCCESS(rv, rv); + + if (frameElement && !nsContentUtils::CanCallerAccess(frameElement)) { + return NS_ERROR_DOM_SECURITY_ERR; + } + } + // If we already have a parser we ignore the document.open call. if (mParser) { @@ -1927,8 +1940,6 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace) return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } - nsresult rv = NS_OK; - // Note: We want to use GetDocumentFromContext here because this document // should inherit the security information of the document that's opening us, // (since if it's secure, then it's presumeably trusted). @@ -2008,7 +2019,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace) nsPIDOMWindow *window = GetInnerWindow(); if (window) { - // Rememer the old scope in case the call to SetNewDocument changes it. + // Remember the old scope in case the call to SetNewDocument changes it. nsCOMPtr oldScope(do_QueryReferent(mScopeObject)); rv = window->SetNewDocument(this, nsnull, PR_FALSE); diff --git a/mozilla/modules/libpref/src/init/all.js b/mozilla/modules/libpref/src/init/all.js index 83b3c941f90..7e30aacaa96 100644 --- a/mozilla/modules/libpref/src/init/all.js +++ b/mozilla/modules/libpref/src/init/all.js @@ -279,7 +279,6 @@ pref("capability.policy.default.History.next", "UniversalBrowserRead"); pref("capability.policy.default.History.previous", "UniversalBrowserRead"); pref("capability.policy.default.History.toString", "UniversalBrowserRead"); -pref("capability.policy.default.HTMLDocument.close.get", "allAccess"); pref("capability.policy.default.HTMLDocument.open.get", "allAccess"); pref("capability.policy.default.Location.hash.set", "allAccess");