mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1631358 - remove traces of CPOWs from browser/, testing/ and toolkit/, r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D71510
This commit is contained in:
parent
11836f7641
commit
1c0a1c9f3e
@ -3142,13 +3142,8 @@ function readFromClipboard() {
|
||||
/**
|
||||
* Open the View Source dialog.
|
||||
*
|
||||
* @param aArgsOrDocument
|
||||
* Either an object or a Document. Passing a Document is deprecated,
|
||||
* and is not supported with e10s. This function will throw if
|
||||
* aArgsOrDocument is a CPOW.
|
||||
*
|
||||
* If aArgsOrDocument is an object, that object can take the
|
||||
* following properties:
|
||||
* @param args
|
||||
* An object with the following properties:
|
||||
*
|
||||
* URL (required):
|
||||
* A string URL for the page we'd like to view the source of.
|
||||
@ -3163,27 +3158,7 @@ function readFromClipboard() {
|
||||
* lineNumber (optional):
|
||||
* The line number to focus on once the source is loaded.
|
||||
*/
|
||||
async function BrowserViewSourceOfDocument(aArgsOrDocument) {
|
||||
let args;
|
||||
|
||||
if (aArgsOrDocument instanceof Document) {
|
||||
let doc = aArgsOrDocument;
|
||||
// Deprecated API - callers should pass args object instead.
|
||||
if (Cu.isCrossProcessWrapper(doc)) {
|
||||
throw new Error(
|
||||
"BrowserViewSourceOfDocument cannot accept a CPOW as a document."
|
||||
);
|
||||
}
|
||||
|
||||
let win = doc.defaultView;
|
||||
let browser = win.docShell.chromeEventHandler;
|
||||
let outerWindowID = win.windowUtils.outerWindowID;
|
||||
let URL = browser.currentURI.spec;
|
||||
args = { browser, outerWindowID, URL };
|
||||
} else {
|
||||
args = aArgsOrDocument;
|
||||
}
|
||||
|
||||
async function BrowserViewSourceOfDocument(args) {
|
||||
// Check if external view source is enabled. If so, try it. If it fails,
|
||||
// fallback to internal view source.
|
||||
if (Services.prefs.getBoolPref("view_source.editor.external")) {
|
||||
|
@ -63,8 +63,8 @@ function openContextMenu(aMessage, aBrowser, aActor) {
|
||||
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
||||
let context = nsContextMenu.contentData.context;
|
||||
|
||||
// The event is a CPOW that can't be passed into the native openPopupAtScreen
|
||||
// function. Therefore we synthesize a new MouseEvent to propagate the
|
||||
// We don't have access to the original event here, as that happened in
|
||||
// another process. Therefore we synthesize a new MouseEvent to propagate the
|
||||
// inputSource to the subsequently triggered popupshowing event.
|
||||
var newEvent = document.createEvent("MouseEvent");
|
||||
newEvent.initNSMouseEvent(
|
||||
|
@ -43,7 +43,6 @@ add_task(async function() {
|
||||
"plugin should not have been found."
|
||||
);
|
||||
|
||||
// simple cpows
|
||||
await SpecialPowers.spawn(gTestBrowser, [], function() {
|
||||
let plugin = content.document.getElementById("plugin");
|
||||
ok(plugin, "plugin should be in the page");
|
||||
|
@ -389,8 +389,6 @@ function openLinkIn(url, where, params) {
|
||||
}
|
||||
|
||||
if (where == "save") {
|
||||
// TODO(1073187): propagate referrerPolicy.
|
||||
// ContentClick.jsm passes isContentWindowPrivate for saveURL instead of passing a CPOW initiatingDoc
|
||||
if ("isContentWindowPrivate" in params) {
|
||||
saveURL(
|
||||
url,
|
||||
|
@ -911,7 +911,7 @@ SimpleTest.waitForFocus = function(callback, targetWindow, expectBlankPage) {
|
||||
if (loaded && focused && !finished) {
|
||||
finished = true;
|
||||
if (isChildProcess) {
|
||||
sendAsyncMessage("WaitForFocus:ChildFocused", {}, null);
|
||||
sendAsyncMessage("WaitForFocus:ChildFocused", {});
|
||||
} else {
|
||||
SimpleTest._pendingWaitForFocusCount--;
|
||||
SimpleTest.executeSoon(function() {
|
||||
|
@ -97,7 +97,7 @@ class FindBarChild extends JSWindowActorChild {
|
||||
return FindBarContent.onKeypress(event);
|
||||
}
|
||||
|
||||
if (event.charCode && BrowserUtils.shouldFastFind(event.target)) {
|
||||
if (event.charCode && this.shouldFastFind(event.target)) {
|
||||
let key = String.fromCharCode(event.charCode);
|
||||
if ((key == "/" || key == "'") && FindBarChild.manualFAYT) {
|
||||
return FindBarContent.startQuickFind(event);
|
||||
@ -108,6 +108,42 @@ class FindBarChild extends JSWindowActorChild {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we should FAYT for this node:
|
||||
*
|
||||
* @param elt
|
||||
* The element that is focused
|
||||
*/
|
||||
shouldFastFind(elt) {
|
||||
if (elt) {
|
||||
let win = elt.ownerGlobal;
|
||||
if (elt instanceof win.HTMLInputElement && elt.mozIsTextField(false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (elt.isContentEditable || win.document.designMode == "on") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
elt instanceof win.HTMLTextAreaElement ||
|
||||
elt instanceof win.HTMLSelectElement ||
|
||||
elt instanceof win.HTMLObjectElement ||
|
||||
elt instanceof win.HTMLEmbedElement
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (elt instanceof win.HTMLIFrameElement && elt.mozbrowser) {
|
||||
// If we're targeting a mozbrowser iframe, it should be allowed to
|
||||
// handle FastFind itself.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
@ -111,9 +111,8 @@ var PageThumbUtils = {
|
||||
*/
|
||||
getContentSize(aWindow) {
|
||||
let utils = aWindow.windowUtils;
|
||||
// aWindow may be a cpow, add exposed props security values.
|
||||
let sbWidth = {},
|
||||
sbHeight = {};
|
||||
let sbWidth = {};
|
||||
let sbHeight = {};
|
||||
|
||||
try {
|
||||
utils.getScrollbarSize(false, sbWidth, sbHeight);
|
||||
@ -201,9 +200,6 @@ var PageThumbUtils = {
|
||||
* @return Canvas with a scaled thumbnail of the window.
|
||||
*/
|
||||
createSnapshotThumbnail(aWindow, aDestCanvas, aArgs) {
|
||||
if (Cu.isCrossProcessWrapper(aWindow)) {
|
||||
throw new Error("Do not pass cpows here.");
|
||||
}
|
||||
let fullScale = aArgs ? aArgs.fullScale : false;
|
||||
let [contentWidth, contentHeight] = this.getContentSize(aWindow);
|
||||
let [thumbnailWidth, thumbnailHeight] = aDestCanvas
|
||||
@ -300,13 +296,9 @@ var PageThumbUtils = {
|
||||
* @return An array containing width, height and scale.
|
||||
*/
|
||||
determineCropSize(aWindow, aCanvas) {
|
||||
if (Cu.isCrossProcessWrapper(aWindow)) {
|
||||
throw new Error("Do not pass cpows here.");
|
||||
}
|
||||
let utils = aWindow.windowUtils;
|
||||
// aWindow may be a cpow, add exposed props security values.
|
||||
let sbWidth = {},
|
||||
sbHeight = {};
|
||||
let sbWidth = {};
|
||||
let sbHeight = {};
|
||||
|
||||
try {
|
||||
utils.getScrollbarSize(false, sbWidth, sbHeight);
|
||||
|
@ -102,7 +102,8 @@ function check_submit_pending(tab, crashes) {
|
||||
}
|
||||
}
|
||||
|
||||
// NB: Despite appearances, this doesn't use a CPOW.
|
||||
// The pageshow event fortunately gets propagated to the containing
|
||||
// browser across process boundaries.
|
||||
BrowserTestUtils.waitForEvent(browser, "pageshow", true).then(
|
||||
csp_pageshow
|
||||
);
|
||||
|
@ -211,10 +211,6 @@ var BrowserUtils = {
|
||||
return Services.io.newFileURI(aFile);
|
||||
},
|
||||
|
||||
makeURIFromCPOW(aCPOWURI) {
|
||||
return Services.io.newURI(aCPOWURI.spec);
|
||||
},
|
||||
|
||||
/**
|
||||
* For a given DOM element, returns its position in "screen"
|
||||
* coordinates. In a content process, the coordinates returned will
|
||||
@ -356,42 +352,6 @@ var BrowserUtils = {
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return true if we should FAYT for this node + window (could be CPOW):
|
||||
*
|
||||
* @param elt
|
||||
* The element that is focused
|
||||
*/
|
||||
shouldFastFind(elt) {
|
||||
if (elt) {
|
||||
let win = elt.ownerGlobal;
|
||||
if (elt instanceof win.HTMLInputElement && elt.mozIsTextField(false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (elt.isContentEditable || win.document.designMode == "on") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
elt instanceof win.HTMLTextAreaElement ||
|
||||
elt instanceof win.HTMLSelectElement ||
|
||||
elt instanceof win.HTMLObjectElement ||
|
||||
elt instanceof win.HTMLEmbedElement
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (elt instanceof win.HTMLIFrameElement && elt.mozbrowser) {
|
||||
// If we're targeting a mozbrowser iframe, it should be allowed to
|
||||
// handle FastFind itself.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if we can show a find bar, including FAYT, for the specified
|
||||
* document location. The location must not be in a blacklist of specific
|
||||
|
Loading…
Reference in New Issue
Block a user