deleted file mode 100644
--- a/browser/extensions/webcompat-reporter/content/TabListener.jsm
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-this.EXPORTED_SYMBOLS = ["TabListener"];
-
-let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
-
-const WIDGET_ID = "webcompat-reporter-button";
-
-// Class that watches for url/location/tab changes and enables or disables
-// the Report Site Issue button accordingly
-class TabListener {
- constructor(win) {
- this.win = win;
- this.browser = win.gBrowser;
- this.addListeners();
- }
-
- addListeners() {
- this.browser.addTabsProgressListener(this);
- this.browser.tabContainer.addEventListener("TabSelect", this);
- }
-
- removeListeners() {
- this.browser.removeTabsProgressListener(this);
- this.browser.tabContainer.removeEventListener("TabSelect", this);
- }
-
- handleEvent(e) {
- switch (e.type) {
- case "TabSelect":
- this.setButtonState(e.target.linkedBrowser.currentURI.scheme);
- break;
- }
- }
-
- onLocationChange(browser, webProgress, request, uri, flags) {
- this.setButtonState(uri.scheme);
- }
-
- static isReportableScheme(scheme) {
- return ["http", "https"].some((prefix) => scheme.startsWith(prefix));
- }
-
- setButtonState(scheme) {
- // Bail early if the button is in the palette.
- if (!CustomizableUI.getPlacementOfWidget(WIDGET_ID)) {
- return;
- }
-
- if (TabListener.isReportableScheme(scheme)) {
- CustomizableUI.getWidget(WIDGET_ID).forWindow(this.win).node.removeAttribute("disabled");
- } else {
- CustomizableUI.getWidget(WIDGET_ID).forWindow(this.win).node.setAttribute("disabled", true);
- }
- }
-}
--- a/browser/extensions/webcompat-reporter/content/WebCompatReporter.jsm
+++ b/browser/extensions/webcompat-reporter/content/WebCompatReporter.jsm
@@ -4,94 +4,54 @@
this.EXPORTED_SYMBOLS = ["WebCompatReporter"];
let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-const TABLISTENER_JSM = "chrome://webcompat-reporter/content/TabListener.jsm";
-const WIDGET_ID = "webcompat-reporter-button";
const PREF_STYLO_ENABLED = "layout.css.servo.enabled";
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
+ "resource:///modules/PageActions.jsm");
XPCOMUtils.defineLazyGetter(this, "wcStrings", function() {
return Services.strings.createBundle(
"chrome://webcompat-reporter/locale/webcompat.properties");
});
-XPCOMUtils.defineLazyGetter(this, "wcStyleURI", function() {
- return Services.io.newURI("chrome://webcompat-reporter/skin/lightbulb.css");
-});
-
let WebCompatReporter = {
get endpoint() {
return Services.urlFormatter.formatURLPref(
"extensions.webcompat-reporter.newIssueEndpoint");
},
init() {
- let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
- .getService(Ci.nsIStyleSheetService);
- this._sheetType = styleSheetService.AUTHOR_SHEET;
- this._cachedSheet = styleSheetService.preloadSheet(wcStyleURI,
- this._sheetType);
-
- XPCOMUtils.defineLazyModuleGetter(this, "TabListener", TABLISTENER_JSM);
-
- CustomizableUI.createWidget({
- id: WIDGET_ID,
- label: wcStrings.GetStringFromName("wc-reporter.label"),
- tooltiptext: wcStrings.GetStringFromName("wc-reporter.tooltip"),
- defaultArea: CustomizableUI.AREA_PANEL,
- disabled: true,
- onCommand: (e) => this.reportIssue(e.target.ownerDocument),
- });
-
- for (let win of CustomizableUI.windows) {
- this.onWindowOpened(win);
- }
-
- CustomizableUI.addListener(this);
- },
-
- onWindowOpened(win) {
- // Attach stylesheet for the button icon.
- win.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils)
- .addSheet(this._cachedSheet, this._sheetType);
- // Attach listeners to new window.
- win._webcompatReporterTabListener = new this.TabListener(win);
- },
-
- onWindowClosed(win) {
- if (win._webcompatReporterTabListener) {
- win._webcompatReporterTabListener.removeListeners();
- delete win._webcompatReporterTabListener;
- }
+ PageActions.addAction(new PageActions.Action({
+ id: "webcompat-reporter-button",
+ title: wcStrings.GetStringFromName("wc-reporter.label"),
+ iconURL: "chrome://webcompat-reporter/skin/lightbulb.svg",
+ onCommand: (e) => this.reportIssue(e.target.ownerGlobal),
+ onShowingInPanel: (buttonNode) => this.onShowingInPanel(buttonNode)
+ }));
},
uninit() {
- CustomizableUI.destroyWidget(WIDGET_ID);
-
- for (let win of CustomizableUI.windows) {
- this.onWindowClosed(win);
+ let action = PageActions.actionForID("webcompat-reporter-button");
+ action.remove();
+ },
- win.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils)
- .removeSheet(wcStyleURI, this._sheetType);
- }
-
- CustomizableUI.removeListener(this);
-
- if (Cu.isModuleLoaded(TABLISTENER_JSM)) {
- Cu.unload(TABLISTENER_JSM);
+ onShowingInPanel(buttonNode) {
+ let browser = buttonNode.ownerGlobal.gBrowser;
+ let scheme = browser.currentURI.scheme;
+ if (["http", "https"].includes(scheme)) {
+ buttonNode.removeAttribute("disabled");
+ } else {
+ buttonNode.setAttribute("disabled", "true");
}
},
// This method injects a framescript that should send back a screenshot blob
// of the top-level window of the currently selected tab, resolved as a
// Promise.
getScreenshot(gBrowser) {
const FRAMESCRIPT = "chrome://webcompat-reporter/content/tab-frame.js";
@@ -164,13 +124,13 @@ let WebCompatReporter = {
}
}
};
browser.addProgressListener(loadedListener);
}
},
- reportIssue(xulDoc) {
- this.getScreenshot(xulDoc.defaultView.gBrowser).then(this.openWebCompatTab)
- .catch(Cu.reportError);
+ reportIssue(global) {
+ this.getScreenshot(global.gBrowser).then(this.openWebCompatTab)
+ .catch(Cu.reportError);
}
};
--- a/browser/extensions/webcompat-reporter/jar.mn
+++ b/browser/extensions/webcompat-reporter/jar.mn
@@ -1,25 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
[features/webcompat-reporter@mozilla.org] chrome.jar:
% content webcompat-reporter %content/
content/ (content/*)
% skin webcompat-reporter classic/1.0 %skin/
-#ifdef XP_WIN
- skin/ (skin/windows/*)
-% override chrome://webcompat-reporter/skin/lightbulb.png chrome://webcompat-reporter/skin/lightbulb-win7.png osversion=6.1
-% override chrome://webcompat-reporter/skin/lightbulb@2x.png chrome://webcompat-reporter/skin/lightbulb-win7@2x.png osversion=6.1
-% override chrome://webcompat-reporter/skin/lightbulb.png chrome://webcompat-reporter/skin/lightbulb-win8.png osversion=6.2
-% override chrome://webcompat-reporter/skin/lightbulb@2x.png chrome://webcompat-reporter/skin/lightbulb-win8@2x.png osversion=6.2
-% override chrome://webcompat-reporter/skin/lightbulb.png chrome://webcompat-reporter/skin/lightbulb-win8.png osversion=6.3
-% override chrome://webcompat-reporter/skin/lightbulb@2x.png chrome://webcompat-reporter/skin/lightbulb-win8@2x.png osversion=6.3
-#elifdef XP_MACOSX
- skin/ (skin/osx/*)
-% override chrome://webcompat-reporter/skin/lightbulb.png chrome://webcompat-reporter/skin/lightbulb-yosemite.png osversion>=10.10
-% override chrome://webcompat-reporter/skin/lightbulb@2x.png chrome://webcompat-reporter/skin/lightbulb-yosemite@2x.png osversion>=10.10
-#else
- skin/ (skin/linux/*)
-#endif
- skin/lightbulb.css (skin/shared/lightbulb.css)
-* skin/lightbulb.svg (skin/shared/lightbulb.svg)
+ skin/ (skin/*)
new file mode 100644
--- /dev/null
+++ b/browser/extensions/webcompat-reporter/skin/lightbulb.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/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1,.9-.5l4.5,8.6A.5.5,0,0,1,22.3,20.6Z"/>
+</svg>
deleted file mode 100644
index 5d3cb8ee0e226444efbfc1f9f4d912de9895fb56..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d1c896a29277884d1f9ff8f3165bac47bf19868c..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 06825536dbaa39d94ae2b538ac859c8a212d31f5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 636e434ffd354e4f84a31ec0a8bc792fc7571f81..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index caa8d308e2e581336f24eee1a05e63ad63aa0636..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 6a9ae138176e3f738d1bd77cf11bfcfd5cc515ed..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b0bf2360bc5d0bd26a18793fa17f1580db6ee65e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 940e340f3f240f0c3df2a33c59e890ec132907f0..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index f82fb2d1de735c9e8d411d4ebc613d9b72c5bec1..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 3831e75c4bad6e7d01a21e25e2a7f24dfa183065..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/browser/extensions/webcompat-reporter/skin/shared/lightbulb.css
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#webcompat-reporter-button[cui-areatype="menu-panel"],
-toolbarpaletteitem[place="palette"] > #webcompat-reporter-button {
- list-style-image: url("chrome://webcompat-reporter/skin/lightbulb.svg");
-}
-
-#webcompat-reporter-button[cui-areatype="toolbar"] {
- list-style-image: url("chrome://webcompat-reporter/skin/lightbulb.png");
- -moz-image-region: rect(0, 18px, 18px, 0);
-}
-
-toolbar[brighttext] #webcompat-reporter-button {
- list-style-image: url("chrome://webcompat-reporter/skin/lightbulb-inverted.png");
-}
-
-@media (min-resolution: 1.1dppx) {
- #webcompat-reporter-button[cui-areatype="toolbar"] {
- list-style-image: url("chrome://webcompat-reporter/skin/lightbulb@2x.png");
- -moz-image-region: rect(0, 36px, 36px, 0px);
- }
-
- toolbar[brighttext] #webcompat-reporter-button {
- list-style-image: url("chrome://webcompat-reporter/skin/lightbulb-inverted@2x.png");
- }
-}
deleted file mode 100644
--- a/browser/extensions/webcompat-reporter/skin/shared/lightbulb.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<svg xmlns="http://www.w3.org/2000/svg"
- width="32" height="32" class="fieldtext">
-#include ../../../../../browser/themes/shared/icon-colors.inc.svg
-
- <path d="M11.5,8.3h.1l9-1a.8.8,0,0,0-.2-1.5l-9,1a.8.8,0,0,0,.1,1.5Zm2.4,13.5a.3.3,0,0,0,.1.2h.9a.3.3,0,0,0,.1-.2,1.8,1.8,0,0,0-.5-1.1A1.8,1.8,0,0,0,13.9,21.7ZM11.5,6.3h.1l8-1a.7.7,0,0,0,.7-.8.7.7,0,0,0-.3-.5A4.4,4.4,0,0,0,16,1c-3,0-4,3-4,3h5.5l-6,.8a.7.7,0,0,0,.1,1.5ZM17,21.8c0,.1,0,.3.5.3h.4a.4.4,0,0,0,.1-.3,1.8,1.8,0,0,0-.4-1A1.9,1.9,0,0,0,17,21.8Zm5.3-8.9-1.1-2.2a1,1,0,0,0-.9-.6H13.8l6.8-.8a.8.8,0,0,0-.2-1.5l-9,1a.8.8,0,0,0-.7.8.7.7,0,0,0,.4.6l-.4.5L9.7,12.8C8.5,15,6,17,6,21.5A9.6,9.6,0,0,0,16,31a9.6,9.6,0,0,0,10-9.5C26,17,23.5,15,22.3,12.8Zm0,7.7a.5.5,0,0,1-.6,0,3.8,3.8,0,0,0-2.2-.8l-1.1.3a2.7,2.7,0,0,1,.6,1.6,1.4,1.4,0,0,1-.4,1,1.6,1.6,0,0,1-1.1.4A1.3,1.3,0,0,1,16,21.8a2.8,2.8,0,0,1,.8-1.8,1.8,1.8,0,0,0-1.7,0,2.8,2.8,0,0,1,.7,1.7,1.3,1.3,0,0,1-.4.9,1.5,1.5,0,0,1-1,.4,1.8,1.8,0,0,1-1.2-.4,1.3,1.3,0,0,1-.4-1,2.7,2.7,0,0,1,.7-1.7,2.5,2.5,0,0,0-1.2-.3,3.8,3.8,0,0,0-2.1.7.5.5,0,0,1-.7-.6l4.6-8.5a.5.5,0,1,1,.9.5l-3.9,7.2,1.2-.2a3.6,3.6,0,0,1,2,.6,2.8,2.8,0,0,1,3.3,0,3.5,3.5,0,0,1,1.9-.5l1.3.2L17,11.8a.5.5,0,1,1,.9-.5l4.5,8.6A.5.5,0,0,1,22.3,20.6Z"/>
-</svg>
deleted file mode 100644
index 5d3cb8ee0e226444efbfc1f9f4d912de9895fb56..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d1c896a29277884d1f9ff8f3165bac47bf19868c..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 8efdc9366d0892c500e8d8df721303dd9c567138..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 2ecd5866c930286321e19dc83895570a2e8e247d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 932445d769fabe2c234d810970186a802a21324e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 5fd6b8a0bca78b2d641eb2590a644f57e055ad67..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 72415ae9ac8bec7a5aa8e5cb92db90839b3b1318..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d2dbc54d611e234da39c6ea515b4328689e5949f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001