mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 887773 - Make plugin doorhanger work for data URLs & fixup permission usage. r=gavin
This commit is contained in:
parent
d86012c8df
commit
fa93068bcf
@ -345,8 +345,8 @@ var gPluginHandler = {
|
|||||||
|
|
||||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||||
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
|
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
|
||||||
let browser = gBrowser.getBrowserForDocument(objLoadingContent.ownerDocument.defaultView.top.document);
|
let principal = objLoadingContent.ownerDocument.defaultView.top.document.nodePrincipal;
|
||||||
let pluginPermission = Services.perms.testPermission(browser.currentURI, permissionString);
|
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
|
||||||
|
|
||||||
let isFallbackTypeValid =
|
let isFallbackTypeValid =
|
||||||
objLoadingContent.pluginFallbackType >= Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY &&
|
objLoadingContent.pluginFallbackType >= Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY &&
|
||||||
@ -511,7 +511,8 @@ var gPluginHandler = {
|
|||||||
if (!gPluginHandler.isKnownPlugin(objLoadingContent))
|
if (!gPluginHandler.isKnownPlugin(objLoadingContent))
|
||||||
return;
|
return;
|
||||||
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
|
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
|
||||||
let pluginPermission = Services.perms.testPermission(browser.currentURI, permissionString);
|
let principal = doc.defaultView.top.document.nodePrincipal;
|
||||||
|
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
|
||||||
|
|
||||||
let overlay = doc.getAnonymousElementByAttribute(aPlugin, "class", "mainBox");
|
let overlay = doc.getAnonymousElementByAttribute(aPlugin, "class", "mainBox");
|
||||||
|
|
||||||
@ -630,13 +631,28 @@ var gPluginHandler = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Match the behaviour of nsPermissionManager
|
||||||
|
_getHostFromPrincipal: function PH_getHostFromPrincipal(principal) {
|
||||||
|
if (!principal.URI || principal.URI.schemeIs("moz-nullprincipal")) {
|
||||||
|
return "(null)";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (principal.URI.host)
|
||||||
|
return principal.URI.host;
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
return principal.origin;
|
||||||
|
},
|
||||||
|
|
||||||
_makeCenterActions: function PH_makeCenterActions(notification) {
|
_makeCenterActions: function PH_makeCenterActions(notification) {
|
||||||
let browser = notification.browser;
|
let contentWindow = notification.browser.contentWindow;
|
||||||
let contentWindow = browser.contentWindow;
|
|
||||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
|
|
||||||
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(browser.currentURI);
|
let principal = contentWindow.document.nodePrincipal;
|
||||||
|
// This matches the behavior of nsPermssionManager, used for display purposes only
|
||||||
|
let principalHost = this._getHostFromPrincipal(principal);
|
||||||
|
|
||||||
let centerActions = [];
|
let centerActions = [];
|
||||||
let pluginsFound = new Set();
|
let pluginsFound = new Set();
|
||||||
@ -666,7 +682,7 @@ var gPluginHandler = {
|
|||||||
pluginInfo.pluginPermissionType = permissionObj.expireType;
|
pluginInfo.pluginPermissionType = permissionObj.expireType;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pluginInfo.pluginPermissionHost = browser.currentURI.host;
|
pluginInfo.pluginPermissionHost = principalHost;
|
||||||
pluginInfo.pluginPermissionType = undefined;
|
pluginInfo.pluginPermissionType = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,9 +745,11 @@ var gPluginHandler = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let browser = aNotification.browser;
|
let browser = aNotification.browser;
|
||||||
|
let contentWindow = browser.contentWindow;
|
||||||
if (aNewState != "continue") {
|
if (aNewState != "continue") {
|
||||||
Services.perms.add(browser.currentURI, aPluginInfo.permissionString,
|
let principal = contentWindow.document.nodePrincipal;
|
||||||
permission, expireType, expireTime);
|
Services.perms.addFromPrincipal(principal, aPluginInfo.permissionString,
|
||||||
|
permission, expireType, expireTime);
|
||||||
|
|
||||||
if (aNewState == "block") {
|
if (aNewState == "block") {
|
||||||
return;
|
return;
|
||||||
@ -740,7 +758,6 @@ var gPluginHandler = {
|
|||||||
|
|
||||||
// Manually activate the plugins that would have been automatically
|
// Manually activate the plugins that would have been automatically
|
||||||
// activated.
|
// activated.
|
||||||
let contentWindow = browser.contentWindow;
|
|
||||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
let plugins = cwu.plugins;
|
let plugins = cwu.plugins;
|
||||||
|
@ -1600,7 +1600,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setupDescription("pluginActivateMultiple.message");
|
let host = gPluginHandler._getHostFromPrincipal(this.notification.browser.contentWindow.document.nodePrincipal);
|
||||||
|
this._setupDescription("pluginActivateMultiple.message", null, host);
|
||||||
|
|
||||||
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
|
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
|
||||||
|
|
||||||
@ -1763,9 +1764,6 @@
|
|||||||
span.removeChild(span.lastChild);
|
span.removeChild(span.lastChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!host) {
|
|
||||||
host = this.notification.browser.currentURI.host;
|
|
||||||
}
|
|
||||||
var args = ["__host__", this._brandShortName];
|
var args = ["__host__", this._brandShortName];
|
||||||
if (pluginName) {
|
if (pluginName) {
|
||||||
args.unshift(pluginName);
|
args.unshift(pluginName);
|
||||||
|
Loading…
Reference in New Issue
Block a user