author | Boris Zbarsky <bzbarsky@mit.edu> |
Tue, 29 Jan 2013 08:44:01 -0500 | |
changeset 120213 | 9f934db4606ab209ceaa702129f1318934cd8aba |
parent 120212 | ac96e7915fb41ec082f62e30c59e38fa05fbb334 |
child 120214 | 0b23beab803845fc77bbf66bf222ed0954357a1b |
push id | 24243 |
push user | ryanvm@gmail.com |
push date | Wed, 30 Jan 2013 00:49:21 +0000 |
treeherder | mozilla-central@5c248ef0fe62 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | peterv |
bugs | 829252 |
milestone | 21.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 @@ -1147,17 +1147,17 @@ nsGlobalWindow::~nsGlobalWindow() mDocument = nullptr; // Forces Release mDoc = nullptr; NS_ASSERTION(!mArguments, "mArguments wasn't cleaned up properly!"); CleanUp(true); #ifdef DEBUG - nsCycleCollector_DEBUG_wasFreed(static_cast<nsIScriptGlobalObject*>(this)); + nsCycleCollector_DEBUG_wasFreed(ToSupports(this)); #endif nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID); if (ac) ac->RemoveWindowAsListener(this); nsLayoutStatics::Release(); } @@ -1317,17 +1317,17 @@ nsGlobalWindow::CleanUp(bool aIgnoreModa if (mIdleTimer) { mIdleTimer->Cancel(); mIdleTimer = nullptr; } DisableTimeChangeNotifications(); #ifdef DEBUG - nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this)); + nsCycleCollector_DEBUG_shouldBeFreed(ToSupports(this)); #endif } void nsGlobalWindow::ClearControllers() { if (mControllers) { uint32_t count; @@ -1429,17 +1429,17 @@ nsGlobalWindow::FreeInnerObjects() CleanupCachedXBLHandlers(this); for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) { mAudioContexts[i]->Shutdown(); } mAudioContexts.Clear(); #ifdef DEBUG - nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this)); + nsCycleCollector_DEBUG_shouldBeFreed(ToSupports(this)); #endif } //***************************************************************************** // nsGlobalWindow::nsISupports //***************************************************************************** #define OUTER_WINDOW_ONLY \ @@ -1449,17 +1449,17 @@ nsGlobalWindow::FreeInnerObjects() foundInterface = 0; \ } else DOMCI_DATA(Window, nsGlobalWindow) // QueryInterface implementation for nsGlobalWindow NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow) // Make sure this matches the cast in nsGlobalWindow::FromWrapper() - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventTarget) NS_INTERFACE_MAP_ENTRY(nsIDOMWindow) #ifdef MOZ_B2G NS_INTERFACE_MAP_ENTRY(nsIDOMWindowB2G) #endif // MOZ_B2G NS_INTERFACE_MAP_ENTRY(nsIDOMJSWindow) if (aIID.Equals(NS_GET_IID(nsIDOMWindowInternal))) { foundInterface = static_cast<nsIDOMWindowInternal*>(this); if (!sWarnedAboutWindowInternal) { @@ -1934,18 +1934,17 @@ nsGlobalWindow::CreateOuterObject(nsGlob } JSObject* outer = NewOuterWindowProxy(cx, aNewInner->FastGetGlobalJSObject(), isChrome); if (!outer) { return NS_ERROR_FAILURE; } - js::SetProxyExtra(outer, 0, - js::PrivateValue(static_cast<nsIScriptGlobalObject*>(this))); + js::SetProxyExtra(outer, 0, js::PrivateValue(ToSupports(this))); return SetOuterObject(cx, outer); } nsresult nsGlobalWindow::SetOuterObject(JSContext* aCx, JSObject* aOuterObject) { // Force our context's global object to be the outer. @@ -1982,17 +1981,17 @@ CreateNativeGlobalForInner(JSContext* aC MOZ_ASSERT(aPrincipal); MOZ_ASSERT(aNativeGlobal); MOZ_ASSERT(aHolder); nsIXPConnect* xpc = nsContentUtils::XPConnect(); nsRefPtr<nsIXPConnectJSObjectHolder> jsholder; nsresult rv = xpc->InitClassesWithNewWrappedGlobal( - aCx, static_cast<nsIScriptGlobalObject*>(aNewInner), + aCx, ToSupports(aNewInner), aPrincipal, 0, getter_AddRefs(jsholder)); NS_ENSURE_SUCCESS(rv, rv); MOZ_ASSERT(jsholder); jsholder->GetJSObject(aNativeGlobal); jsholder.forget(aHolder); // Set the location information for the new global, so that tools like @@ -2253,18 +2252,17 @@ nsGlobalWindow::SetNewDocument(nsIDocume js::SetProxyExtra(mJSObject, 0, js::PrivateValue(NULL)); outerObject = xpc::TransplantObject(cx, mJSObject, outerObject); if (!outerObject) { NS_ERROR("unable to transplant wrappers, probably OOM"); return NS_ERROR_FAILURE; } - nsIScriptGlobalObject *global = static_cast<nsIScriptGlobalObject*>(this); - js::SetProxyExtra(outerObject, 0, js::PrivateValue(global)); + js::SetProxyExtra(outerObject, 0, js::PrivateValue(ToSupports(this))); mJSObject = outerObject; SetWrapper(mJSObject); { JSAutoCompartment ac(cx, mJSObject); JS_SetParent(cx, mJSObject, newInnerWindow->mJSObject); @@ -2596,17 +2594,17 @@ nsGlobalWindow::DetachFromDocShell() if (mContext) { mContext->GC(js::gcreason::SET_DOC_SHELL); mContext = nullptr; } #ifdef DEBUG nsCycleCollector_DEBUG_shouldBeFreed(mContext); - nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this)); + nsCycleCollector_DEBUG_shouldBeFreed(ToSupports(this)); #endif mDocShell = nullptr; // Weak Reference NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!"); if (mFrames) { mFrames->SetDocShell(nullptr); @@ -7218,17 +7216,17 @@ nsGlobalWindow::IsInModalState() // static void nsGlobalWindow::NotifyDOMWindowDestroyed(nsGlobalWindow* aWindow) { nsCOMPtr<nsIObserverService> observerService = services::GetObserverService(); if (observerService) { observerService-> - NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow), + NotifyObservers(ToSupports(aWindow), DOM_WINDOW_DESTROYED_TOPIC, nullptr); } } class WindowDestroyedEvent : public nsRunnable { public: WindowDestroyedEvent(nsPIDOMWindow* aWindow, uint64_t aID, @@ -7305,31 +7303,31 @@ nsGlobalWindow::NotifyWindowIDDestroyed( // static void nsGlobalWindow::NotifyDOMWindowFrozen(nsGlobalWindow* aWindow) { if (aWindow && aWindow->IsInnerWindow()) { nsCOMPtr<nsIObserverService> observerService = services::GetObserverService(); if (observerService) { observerService-> - NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow), + NotifyObservers(ToSupports(aWindow), DOM_WINDOW_FROZEN_TOPIC, nullptr); } } } // static void nsGlobalWindow::NotifyDOMWindowThawed(nsGlobalWindow* aWindow) { if (aWindow && aWindow->IsInnerWindow()) { nsCOMPtr<nsIObserverService> observerService = services::GetObserverService(); if (observerService) { observerService-> - NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow), + NotifyObservers(ToSupports(aWindow), DOM_WINDOW_THAWED_TOPIC, nullptr); } } } JSObject* nsGlobalWindow::GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) {
--- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -400,22 +400,22 @@ public: already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex, bool& aFound); // Object Management nsGlobalWindow(nsGlobalWindow *aOuterWindow); static nsGlobalWindow *FromSupports(nsISupports *supports) { // Make sure this matches the casts we do in QueryInterface(). - return (nsGlobalWindow *)(nsIScriptGlobalObject *)supports; + return (nsGlobalWindow *)(nsIDOMEventTarget *)supports; } static nsISupports *ToSupports(nsGlobalWindow *win) { // Make sure this matches the casts we do in QueryInterface(). - return (nsISupports *)(nsIScriptGlobalObject *)win; + return (nsISupports *)(nsIDOMEventTarget *)win; } static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper) { return FromSupports(wrapper->Native()); } /** * Wrap nsIDOMWindow::GetTop so we can overload the inline GetTop() @@ -524,17 +524,17 @@ public: static void CloseBlockScriptTerminationFunc(nsISupports *aRef); static void RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow, nsGlobalWindow *aWindow); friend class WindowStateHolder; NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow, - nsIScriptGlobalObject) + nsIDOMEventTarget) virtual NS_HIDDEN_(JSObject*) GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey); virtual NS_HIDDEN_(void) CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey, nsScriptObjectHolder<JSObject>& aHandler);