author | Ms2ger <ms2ger@gmail.com> |
Thu, 27 Mar 2014 21:05:14 +0100 | |
changeset 175684 | a54f5ae6956d9b7f0dec965fd558f92b3ce05bae |
parent 175683 | d947d662fc88b6cf88e82b437aeb078f7697a6cb |
child 175685 | 2124bd62783f4da2ad46edae0c5b3c3ba2816269 |
push id | 41591 |
push user | Ms2ger@gmail.com |
push date | Thu, 27 Mar 2014 20:06:44 +0000 |
treeherder | mozilla-inbound@be912f59c937 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bholley |
bugs | 973367 |
milestone | 31.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
|
dom/base/nsGlobalWindow.cpp | file | annotate | diff | comparison | revisions | |
dom/base/nsGlobalWindow.h | file | annotate | diff | comparison | revisions |
--- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -2130,37 +2130,16 @@ WindowStateHolder::~WindowStateHolder() // inner window if its outer has already had SetDocShell(null) // called. mInnerWindow->FreeInnerObjects(); } } NS_IMPL_ISUPPORTS1(WindowStateHolder, WindowStateHolder) -nsresult -nsGlobalWindow::CreateOuterObject(nsGlobalWindow* aNewInner) -{ - AutoPushJSContext cx(mContext->GetNativeContext()); - - JS::Rooted<JSObject*> global(cx, aNewInner->FastGetGlobalJSObject()); - JS::Rooted<JSObject*> outer(cx, NewOuterWindowProxy(cx, global, IsChromeWindow())); - if (!outer) { - return NS_ERROR_FAILURE; - } - - js::SetProxyExtra(outer, 0, js::PrivateValue(ToSupports(this))); - - JSAutoCompartment ac(cx, outer); - - // Inform the nsJSContext, which is the canonical holder of the outer. - MOZ_ASSERT(IsOuterWindow()); - mContext->SetWindowProxy(outer); - return NS_OK; -} - // We need certain special behavior for remote XUL whitelisted domains, but we // don't want that behavior to take effect in automation, because we whitelist // all the mochitest domains. So we need to check a pref here. static bool TreatAsRemoteXUL(nsIPrincipal* aPrincipal) { MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(aPrincipal)); return nsContentUtils::AllowXULXBLForPrincipal(aPrincipal) && @@ -2457,17 +2436,24 @@ nsGlobalWindow::SetNewDocument(nsIDocume if (!currentInner->IsFrozen()) { currentInner->FreeInnerObjects(); } } mInnerWindow = newInnerWindow; if (!mJSObject) { - CreateOuterObject(newInnerWindow); + JS::Rooted<JSObject*> global(cx, newInnerWindow->FastGetGlobalJSObject()); + JS::Rooted<JSObject*> outer(cx, NewOuterWindowProxy(cx, global, thisChrome)); + NS_ENSURE_TRUE(outer, NS_ERROR_FAILURE); + + js::SetProxyExtra(outer, 0, js::PrivateValue(ToSupports(this))); + + // Inform the nsJSContext, which is the canonical holder of the outer. + mContext->SetWindowProxy(outer); mContext->DidInitializeContext(); mJSObject = mContext->GetWindowProxy(); SetWrapper(mJSObject); } else { JS::ExposeObjectToActiveJS(newInnerWindow->mJSObject); JS::Rooted<JSObject*> global(cx, newInnerWindow->mJSObject); JS::Rooted<JSObject*> outerObject(cx,
--- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1296,18 +1296,16 @@ protected: virtual void UpdateParentTarget(); // Outer windows only. bool GetIsTabModalPromptAllowed(); inline int32_t DOMMinTimeoutValue() const; - nsresult CreateOuterObject(nsGlobalWindow* aNewInner); - nsresult SetOuterObject(JSContext* aCx, JS::Handle<JSObject*> aOuterObject); nsresult CloneStorageEvent(const nsAString& aType, nsCOMPtr<nsIDOMStorageEvent>& aEvent); // Outer windows only. nsDOMWindowList* GetWindowList(); // Helper for getComputedStyle and getDefaultComputedStyle already_AddRefed<nsICSSDeclaration>