# HG changeset patch # Parent 518f5bff0ae4fbf98899dc158961e89bd14fd797 # User SUN Haitao diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -7794,17 +7794,19 @@ nsGlobalWindow::PostMessageMoz(JSContext JSAutoStructuredCloneBuffer buffer; StructuredCloneInfo scInfo; scInfo.event = event; scInfo.window = this; nsIPrincipal* principal = GetPrincipal(); JS::Rooted message(aCx, aMessage); JS::Rooted transfer(aCx, aTransfer); - if (NS_FAILED(callerPrin->Subsumes(principal, &scInfo.subsumes)) || + bool isInBrowserElement; + nsresult rv = principal->GetIsInBrowserElement(&isInBrowserElement); + if ((!isInBrowserElement && NS_FAILED(callerPrin->Subsumes(principal, &scInfo.subsumes))) || !buffer.write(aCx, message, transfer, &kPostMessageCallbacks, &scInfo)) { aError.Throw(NS_ERROR_DOM_DATA_CLONE_ERR); return; } event->SetJSData(buffer); diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -31,8 +31,9 @@ support-files = [test_setting_opener.html] [test_url.html] [test_window_constructor.html] [test_window_enumeration.html] [test_window_extensible.html] [test_window_indexing.html] [test_writable-replaceable.html] [test_urlExceptions.html] +[test_bug927747.html] diff --git a/dom/base/test/test_bug927747.html b/dom/base/test/test_bug927747.html new file mode 100644 --- /dev/null +++ b/dom/base/test/test_bug927747.html @@ -0,0 +1,60 @@ + + + + + + Test for Bug 927747 - port cloning + + + + +Mozilla Bug 927747 +
+
+
+ + + +