Bug 1250063 - Part 3 : docshell shouldn't load any document except for about:blank when set origin attibutes. r=sicking
authorYoshi Huang <allstars.chh@mozilla.com>
Wed, 11 May 2016 18:35:30 +0800
changeset 297648 ae939276dc4e4d0e261030b7d3ae9e9e642956a9
parent 297647 c98c66836c74b4afb687f1cea822e575d7a015b4
child 297649 abf706cbf6a2012e4133bf6ca5b89d6159d995e1
push id76843
push useryhuang@mozilla.com
push dateTue, 17 May 2016 11:49:34 +0000
treeherdermozilla-inbound@abf706cbf6a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1250063
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1250063 - Part 3 : docshell shouldn't load any document except for about:blank when set origin attibutes. r=sicking
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -14087,16 +14087,31 @@ nsDocShell::GetOriginAttributes(JSContex
   bool ok = ToJSValue(aCx, mOriginAttributes, aVal);
   NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
   return NS_OK;
 }
 
 void
 nsDocShell::SetOriginAttributes(const DocShellOriginAttributes& aAttrs)
 {
+  // TODO: Bug 1273058 - mContentViewer should be null when setting origin
+  // attributes.
+  if (mContentViewer) {
+    nsIDocument* doc = mContentViewer->GetDocument();
+    if (doc) {
+      nsIURI* uri = doc->GetDocumentURI();
+      MOZ_ASSERT(uri);
+      if (uri) {
+        nsAutoCString uriSpec;
+        uri->GetSpec(uriSpec);
+        MOZ_ASSERT(uriSpec.EqualsLiteral("about:blank"));
+      }
+    }
+  }
+
   mOriginAttributes = aAttrs;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
                                 JSContext* aCx)
 {
   DocShellOriginAttributes attrs;