Bug 1638373 - remove Cu.isCrossProcessWrapper now that CPOWs are dead, r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D76597
This commit is contained in:
Gijs Kruitbosch 2020-05-24 23:38:17 +00:00
parent a94d31585c
commit 2f983e6cfa
6 changed files with 12 additions and 67 deletions

View file

@ -50,22 +50,11 @@ add_task(async function test_tab_options_modals() {
aboutAddonsBrowser.addEventListener(
"DOMWillOpenModalDialog",
function onModalDialog(event) {
if (Cu.isCrossProcessWrapper(event.target)) {
// This event fires in both the content and chrome processes. We
// want to ignore the one in the content process.
return;
}
aboutAddonsBrowser.removeEventListener(
"DOMWillOpenModalDialog",
onModalDialog,
true
);
// Wait for the next event tick to make sure the remaining part of the
// testcase runs after the dialog gets opened.
SimpleTest.executeSoon(resolve);
},
true
{ once: true, capture: true }
);
});

View file

@ -438,11 +438,6 @@ interface nsIXPCComponents_Utils : nsISupports
*/
bool isRemoteProxy(in jsval val);
/**
* Determines whether this object is a cross-process wrapper.
*/
bool isCrossProcessWrapper(in jsval obj);
/*
* To be called from JS only. This is for Gecko internal use only, and may
* disappear at any moment.

View file

@ -22,7 +22,6 @@
#include "js/StructuredClone.h"
#include "mozilla/AppShutdown.h"
#include "mozilla/Attributes.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Preferences.h"
#include "nsJSEnvironment.h"
@ -1971,17 +1970,6 @@ nsXPCComponents_Utils::IsRemoteProxy(HandleValue val, bool* out) {
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::IsCrossProcessWrapper(HandleValue obj, bool* out) {
*out = false;
if (obj.isPrimitive()) {
return NS_ERROR_INVALID_ARG;
}
*out = jsipc::IsWrappedCPOW(&obj.toObject());
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::RecomputeWrappers(HandleValue vobj, JSContext* cx) {
// Determine the compartment of the given object, if any.

View file

@ -1006,14 +1006,11 @@ SimpleTest.waitForFocus = function(callback, targetWindow, expectBlankPage) {
// is whether the property is read-only or not. The real |Components|
// property is read-only.
var c = Object.getOwnPropertyDescriptor(window, "Components");
var Cu, Ci;
var Ci;
if (c && c.value && !c.writable) {
// eslint-disable-next-line mozilla/use-cc-etc
Cu = Components.utils;
// eslint-disable-next-line mozilla/use-cc-etc
Ci = Components.interfaces;
} else {
Cu = SpecialPowers.Cu;
Ci = SpecialPowers.Ci;
}
@ -1026,13 +1023,6 @@ SimpleTest.waitForFocus = function(callback, targetWindow, expectBlankPage) {
browser = targetWindow;
}
var isWrapper = Cu.isCrossProcessWrapper(targetWindow);
if (isWrapper) {
throw new Error(
"Can't pass CPOW to SimpleTest.focus as the content window."
);
}
if (browser && browser.isRemoteBrowser) {
browser.messageManager.addMessageListener(
"WaitForFocus:ChildFocused",

View file

@ -1035,22 +1035,17 @@ LoginManagerAuthPrompter.prototype = {
* Given a content DOM window, returns the chrome window and browser it's in.
*/
_getChromeWindow(aWindow) {
// Handle non-e10s toolkit consumers.
if (!Cu.isCrossProcessWrapper(aWindow)) {
let browser = aWindow.docShell.chromeEventHandler;
if (!browser) {
return null;
}
let chromeWin = browser.ownerGlobal;
if (!chromeWin) {
return null;
}
return { win: chromeWin, browser };
let browser = aWindow.docShell.chromeEventHandler;
if (!browser) {
return null;
}
return null;
let chromeWin = browser.ownerGlobal;
if (!chromeWin) {
return null;
}
return { win: chromeWin, browser };
},
_getNotifyWindow() {

View file

@ -13,18 +13,6 @@ function waitForOnBeforeUnloadDialog(browser, callback) {
browser.addEventListener(
"DOMWillOpenModalDialog",
function onModalDialog(event) {
if (Cu.isCrossProcessWrapper(event.target)) {
// This event fires in both the content and chrome processes. We
// want to ignore the one in the content process.
return;
}
browser.removeEventListener(
"DOMWillOpenModalDialog",
onModalDialog,
true
);
SimpleTest.waitForCondition(
() => Services.focus.activeWindow == browser.ownerGlobal,
function() {
@ -35,6 +23,6 @@ function waitForOnBeforeUnloadDialog(browser, callback) {
"Waited too long for window with dialog to focus"
);
},
true
{ capture: true, once: true }
);
}