mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 1193837) because the web extension tests are failing CLOSED TREE
Backed out changeset ebe2433705a5 (bug 1193837) Backed out changeset c3307a5ac126 (bug 1193837)
This commit is contained in:
parent
cff1ea972a
commit
83ace83a6a
@ -477,32 +477,12 @@ extensions.registerAPI((extension, context) => {
|
||||
let tab = tabId ? TabManager.getTab(tabId) : TabManager.activeTab;
|
||||
let mm = tab.linkedBrowser.messageManager;
|
||||
|
||||
let options = {
|
||||
js: [],
|
||||
css: [],
|
||||
|
||||
// We need to send the inner window ID to make sure we only
|
||||
// execute the script if the window is currently navigated to
|
||||
// the document that we expect.
|
||||
//
|
||||
// TODO: When we add support for callbacks, non-matching
|
||||
// window IDs and insufficient permissions need to result in a
|
||||
// callback with |lastError| set.
|
||||
innerWindowID: tab.linkedBrowser.innerWindowID,
|
||||
|
||||
matchesHost: extension.whiteListedHosts.serialize(),
|
||||
};
|
||||
|
||||
let options = {js: [], css: []};
|
||||
if (details.code) {
|
||||
options[kind + 'Code'] = details.code;
|
||||
}
|
||||
if (details.file) {
|
||||
let url = context.uri.resolve(details.file);
|
||||
if (extension.isExtensionURL(url)) {
|
||||
// We should really set |lastError| here, and go straight to
|
||||
// the callback, but we don't have |lastError| yet.
|
||||
options[kind].push(url);
|
||||
}
|
||||
options[kind].push(extension.baseURI.resolve(details.file));
|
||||
}
|
||||
if (details.allFrames) {
|
||||
options.all_frames = details.allFrames;
|
||||
|
@ -3,7 +3,7 @@ add_task(function* () {
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["http://mochi.test/"]
|
||||
"permissions": ["tabs"]
|
||||
},
|
||||
|
||||
background: function() {
|
||||
|
@ -213,29 +213,6 @@ ExtensionPage.prototype = {
|
||||
return this.contentWindow;
|
||||
},
|
||||
|
||||
get principal() {
|
||||
return this.contentWindow.document.nodePrincipal;
|
||||
},
|
||||
|
||||
checkLoadURL(url, options = {}) {
|
||||
let ssm = Services.scriptSecurityManager;
|
||||
|
||||
let flags = ssm.STANDARD;
|
||||
if (!options.allowScript) {
|
||||
flags |= ssm.DISALLOW_SCRIPT;
|
||||
}
|
||||
if (!options.allowInheritsPrincipal) {
|
||||
flags |= ssm.DISALLOW_INHERIT_PRINCIPAL;
|
||||
}
|
||||
|
||||
try {
|
||||
ssm.checkLoadURIStrWithPrincipal(this.principal, url, flags);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
callOnClose(obj) {
|
||||
this.onClose.add(obj);
|
||||
},
|
||||
@ -883,10 +860,10 @@ Extension.prototype = extend(Object.create(ExtensionData.prototype), {
|
||||
|
||||
let whitelist = [];
|
||||
for (let perm of permissions) {
|
||||
if (/^\w+(\.\w+)*$/.test(perm)) {
|
||||
this.permissions.add(perm);
|
||||
} else {
|
||||
if (perm.match(/:\/\//)) {
|
||||
whitelist.push(perm);
|
||||
} else {
|
||||
this.permissions.add(perm);
|
||||
}
|
||||
}
|
||||
this.whiteListedHosts = new MatchPattern(whitelist);
|
||||
|
@ -112,9 +112,6 @@ function Script(options)
|
||||
|
||||
this.matches_ = new MatchPattern(this.options.matches);
|
||||
this.exclude_matches_ = new MatchPattern(this.options.exclude_matches || null);
|
||||
// TODO: MatchPattern should pre-mangle host-only patterns so that we
|
||||
// don't need to call a separate match function.
|
||||
this.matches_host_ = new MatchPattern(this.options.matchesHost || null);
|
||||
|
||||
// TODO: Support glob patterns.
|
||||
}
|
||||
@ -122,7 +119,7 @@ function Script(options)
|
||||
Script.prototype = {
|
||||
matches(window) {
|
||||
let uri = window.document.documentURIObject;
|
||||
if (!(this.matches_.matches(uri) || this.matches_host_.matchesIgnoringPath(uri))) {
|
||||
if (!this.matches_.matches(uri)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -134,16 +131,6 @@ Script.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ("innerWindowID" in this.options) {
|
||||
let innerWindowID = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.currentInnerWindowID;
|
||||
|
||||
if (innerWindowID !== this.options.innerWindowID) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: match_about_blank.
|
||||
|
||||
return true;
|
||||
@ -582,6 +569,7 @@ this.ExtensionContent = {
|
||||
receiveMessage({target, name, data}) {
|
||||
switch (name) {
|
||||
case "Extension:Execute":
|
||||
data.options.matches = "<all_urls>";
|
||||
let script = new Script(data.options);
|
||||
let {extensionId} = data;
|
||||
DocumentManager.executeScript(target, extensionId, script);
|
||||
|
@ -55,19 +55,14 @@ var WebProgressListener = {
|
||||
},
|
||||
|
||||
_setupJSON: function setupJSON(aWebProgress, aRequest) {
|
||||
let innerWindowID = null;
|
||||
if (aWebProgress) {
|
||||
let domWindowID = null;
|
||||
let domWindowID;
|
||||
try {
|
||||
let utils = aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
domWindowID = utils.outerWindowID;
|
||||
innerWindowID = utils.currentInnerWindowID;
|
||||
domWindowID = aWebProgress && aWebProgress.DOMWindowID;
|
||||
} catch (e) {
|
||||
// If nsDocShell::Destroy has already been called, then we'll
|
||||
// get NS_NOINTERFACE when trying to get the DOM window.
|
||||
// If there is no current inner window, we'll get
|
||||
// NS_ERROR_NOT_AVAILABLE.
|
||||
// get NS_NOINTERFACE when trying to get the DOM window ID.
|
||||
domWindowID = null;
|
||||
}
|
||||
|
||||
aWebProgress = {
|
||||
@ -82,8 +77,7 @@ var WebProgressListener = {
|
||||
webProgress: aWebProgress || null,
|
||||
requestURI: this._requestSpec(aRequest, "URI"),
|
||||
originalRequestURI: this._requestSpec(aRequest, "originalURI"),
|
||||
documentContentType: content.document && content.document.contentType,
|
||||
innerWindowID,
|
||||
documentContentType: content.document && content.document.contentType
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -420,22 +420,6 @@
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="innerWindowID" readonly="true">
|
||||
<getter><![CDATA[
|
||||
try {
|
||||
return this.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.currentInnerWindowID;
|
||||
} catch (e) {
|
||||
if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
|
||||
throw e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<field name="_lastSearchString">null</field>
|
||||
<field name="_lastSearchHighlight">false</field>
|
||||
|
||||
@ -1197,7 +1181,6 @@
|
||||
"_fullZoom",
|
||||
"_textZoom",
|
||||
"_isSyntheticDocument",
|
||||
"_innerWindowID",
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -212,13 +212,6 @@
|
||||
onget="return this._outerWindowID"
|
||||
readonly="true"/>
|
||||
|
||||
<field name="_innerWindowID">null</field>
|
||||
<property name="innerWindowID">
|
||||
<getter><![CDATA[
|
||||
return this._innerWindowID;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="autoCompletePopup"
|
||||
onget="return document.getElementById(this.getAttribute('autocompletepopup'))"
|
||||
readonly="true"/>
|
||||
|
@ -235,7 +235,6 @@ RemoteWebProgressManager.prototype = {
|
||||
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
|
||||
this._browser._contentPrincipal = json.principal;
|
||||
this._browser._isSyntheticDocument = json.synthetic;
|
||||
this._browser._innerWindowID = json.innerWindowID;
|
||||
}
|
||||
|
||||
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user