Bug 1069075 - Send location along with CTP messages. r=gfritzsche.
Before, we were comparing Principals sent up from PluginContent against the Principal of the selected browser - this was in order to account for races (and intermittent oranges) where the browser has moved away from a page before a CTP message has been received by the parent. Comparing Principals works beautifully, except in the case of Data URIs, since Data URIs inherit the Principals of the page they were linked from. That means that if we're on a page with a link to a Data URI that embeds a plugin, if we quickly browse to that page and back before a CTP message reaches the parent, when the CTP message finally arrives, the Principals will match. We solve this by sending the location as well as the Principal, to do a final comparison if the Principals do match.
This commit is contained in:
@@ -44,14 +44,14 @@ var gPluginHandler = {
|
||||
switch (msg.name) {
|
||||
case "PluginContent:ShowClickToPlayNotification":
|
||||
this.showClickToPlayNotification(msg.target, msg.data.plugins, msg.data.showNow,
|
||||
msg.principal, msg.data.host);
|
||||
msg.principal, msg.data.host, msg.data.location);
|
||||
break;
|
||||
case "PluginContent:RemoveNotification":
|
||||
this.removeNotification(msg.target, msg.data.name);
|
||||
break;
|
||||
case "PluginContent:UpdateHiddenPluginUI":
|
||||
this.updateHiddenPluginUI(msg.target, msg.data.haveInsecure, msg.data.actions,
|
||||
msg.principal, msg.data.host);
|
||||
msg.principal, msg.data.host, msg.data.location);
|
||||
break;
|
||||
case "PluginContent:HideNotificationBar":
|
||||
this.hideNotificationBar(msg.target, msg.data.name);
|
||||
@@ -216,7 +216,8 @@ var gPluginHandler = {
|
||||
});
|
||||
},
|
||||
|
||||
showClickToPlayNotification: function (browser, plugins, showNow, principal, host) {
|
||||
showClickToPlayNotification: function (browser, plugins, showNow, principal,
|
||||
host, location) {
|
||||
// It is possible that we've received a message from the frame script to show
|
||||
// a click to play notification for a principal that no longer matches the one
|
||||
// that the browser's content now has assigned (ie, the browser has browsed away
|
||||
@@ -226,6 +227,15 @@ var gPluginHandler = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Data URIs, when linked to from some page, inherit the principal of that
|
||||
// page. That means that we also need to compare the actual locations to
|
||||
// ensure we aren't getting a message from a Data URI that we're no longer
|
||||
// looking at.
|
||||
let receivedURI = BrowserUtils.makeURI(location);
|
||||
if (!browser.documentURI.equalsExceptRef(receivedURI)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let notification = PopupNotifications.getNotification("click-to-play-plugins", browser);
|
||||
|
||||
// If this is a new notification, create a pluginData map, otherwise append
|
||||
@@ -300,7 +310,8 @@ var gPluginHandler = {
|
||||
notificationBox.removeNotification(notification, true);
|
||||
},
|
||||
|
||||
updateHiddenPluginUI: function (browser, haveInsecure, actions, principal, host) {
|
||||
updateHiddenPluginUI: function (browser, haveInsecure, actions, principal,
|
||||
host, location) {
|
||||
// It is possible that we've received a message from the frame script to show
|
||||
// the hidden plugin notification for a principal that no longer matches the one
|
||||
// that the browser's content now has assigned (ie, the browser has browsed away
|
||||
@@ -310,6 +321,15 @@ var gPluginHandler = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Data URIs, when linked to from some page, inherit the principal of that
|
||||
// page. That means that we also need to compare the actual locations to
|
||||
// ensure we aren't getting a message from a Data URI that we're no longer
|
||||
// looking at.
|
||||
let receivedURI = BrowserUtils.makeURI(location);
|
||||
if (!browser.documentURI.equalsExceptRef(receivedURI)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the icon
|
||||
document.getElementById("plugins-notification-icon").classList.
|
||||
toggle("plugin-blocked", haveInsecure);
|
||||
|
||||
Reference in New Issue
Block a user