mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1092447 - Ignore non top-level documents when enabling/disabling Report Site Menu. r=margaret
This commit is contained in:
parent
6d26261829
commit
bc63d7486c
@ -13,12 +13,15 @@ var WebcompatReporter = {
|
||||
menuItemEnabled: null,
|
||||
init: function() {
|
||||
Services.obs.addObserver(this, "DesktopMode:Change", false);
|
||||
Services.obs.addObserver(this, "content-page-shown", false);
|
||||
Services.obs.addObserver(this, "chrome-document-global-created", false);
|
||||
Services.obs.addObserver(this, "content-document-global-created", false);
|
||||
this.addMenuItem();
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
Services.obs.removeObserver(this, "DesktopMode:Change");
|
||||
Services.obs.removeObserver(this, "chrome-document-global-created");
|
||||
Services.obs.removeObserver(this, "content-document-global-created");
|
||||
|
||||
if (this.menuItem) {
|
||||
NativeWindow.menu.remove(this.menuItem);
|
||||
@ -27,8 +30,15 @@ var WebcompatReporter = {
|
||||
},
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
if (topic === "content-page-shown") {
|
||||
let currentURI = subject.documentURI;
|
||||
if (topic == "content-document-global-created" || topic == "chrome-document-global-created") {
|
||||
let win = subject;
|
||||
let currentURI = win.document.documentURI;
|
||||
|
||||
// Ignore non top-level documents
|
||||
if (currentURI !== win.top.location.href) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.menuItemEnabled && this.isReportableUrl(currentURI)) {
|
||||
NativeWindow.menu.update(this.menuItem, {enabled: true});
|
||||
this.menuItemEnabled = true;
|
||||
|
Loading…
Reference in New Issue
Block a user