зеркало из https://github.com/mozilla/gecko-dev.git
Bug 829252 part 1. Change nsGlobalWindow to use nsIDOMEventTarget as the canonical isupports instead of nsIScriptGlobalObject. We'll need this to be able to cast to it properly in binding code. r=peterv
This commit is contained in:
Родитель
f16c3128f4
Коммит
94a48e89d4
|
@ -1152,7 +1152,7 @@ nsGlobalWindow::~nsGlobalWindow()
|
|||
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);
|
||||
|
@ -1322,7 +1322,7 @@ nsGlobalWindow::CleanUp(bool aIgnoreModalDialog)
|
|||
|
||||
DisableTimeChangeNotifications();
|
||||
#ifdef DEBUG
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this));
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(ToSupports(this));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ nsGlobalWindow::FreeInnerObjects()
|
|||
mAudioContexts.Clear();
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this));
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(ToSupports(this));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ 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)
|
||||
|
@ -1939,8 +1939,7 @@ nsGlobalWindow::CreateOuterObject(nsGlobalWindow* aNewInner)
|
|||
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);
|
||||
}
|
||||
|
@ -1987,7 +1986,7 @@ CreateNativeGlobalForInner(JSContext* aCx,
|
|||
|
||||
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);
|
||||
|
||||
|
@ -2258,8 +2257,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||
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);
|
||||
|
@ -2601,7 +2599,7 @@ nsGlobalWindow::DetachFromDocShell()
|
|||
|
||||
#ifdef DEBUG
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(mContext);
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this));
|
||||
nsCycleCollector_DEBUG_shouldBeFreed(ToSupports(this));
|
||||
#endif
|
||||
|
||||
mDocShell = nullptr; // Weak Reference
|
||||
|
@ -7223,7 +7221,7 @@ nsGlobalWindow::NotifyDOMWindowDestroyed(nsGlobalWindow* aWindow) {
|
|||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->
|
||||
NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow),
|
||||
NotifyObservers(ToSupports(aWindow),
|
||||
DOM_WINDOW_DESTROYED_TOPIC, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -7310,7 +7308,7 @@ nsGlobalWindow::NotifyDOMWindowFrozen(nsGlobalWindow* aWindow) {
|
|||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->
|
||||
NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow),
|
||||
NotifyObservers(ToSupports(aWindow),
|
||||
DOM_WINDOW_FROZEN_TOPIC, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -7324,7 +7322,7 @@ nsGlobalWindow::NotifyDOMWindowThawed(nsGlobalWindow* aWindow) {
|
|||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->
|
||||
NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow),
|
||||
NotifyObservers(ToSupports(aWindow),
|
||||
DOM_WINDOW_THAWED_TOPIC, nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -405,12 +405,12 @@ public:
|
|||
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)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ public:
|
|||
friend class WindowStateHolder;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
|
||||
nsIScriptGlobalObject)
|
||||
nsIDOMEventTarget)
|
||||
|
||||
virtual NS_HIDDEN_(JSObject*)
|
||||
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
|
||||
|
|
Загрузка…
Ссылка в новой задаче