Backed out changeset 9999b6b8022b (bug 1280128) for ESLint failures
This commit is contained in:
@@ -4,15 +4,9 @@
|
|||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
||||||
"resource:///modules/CustomizableUI.jsm");
|
"resource:///modules/CustomizableUI.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
|
||||||
"resource://gre/modules/NetUtil.jsm");
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "styleSheetService",
|
|
||||||
"@mozilla.org/content/style-sheet-service;1",
|
|
||||||
"nsIStyleSheetService");
|
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
|
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
|
||||||
@@ -48,14 +42,18 @@ function promisePopupShown(popup) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "stylesheets", () => {
|
XPCOMUtils.defineLazyGetter(global, "stylesheets", () => {
|
||||||
let styleSheetURI = NetUtil.newURI("chrome://browser/content/extension.css");
|
let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIStyleSheetService);
|
||||||
|
let styleSheetURI = Services.io.newURI("chrome://browser/content/extension.css",
|
||||||
|
null, null);
|
||||||
let styleSheet = styleSheetService.preloadSheet(styleSheetURI,
|
let styleSheet = styleSheetService.preloadSheet(styleSheetURI,
|
||||||
styleSheetService.AGENT_SHEET);
|
styleSheetService.AGENT_SHEET);
|
||||||
let stylesheets = [styleSheet];
|
let stylesheets = [styleSheet];
|
||||||
|
|
||||||
if (AppConstants.platform === "macosx") {
|
if (AppConstants.platform === "macosx") {
|
||||||
styleSheetURI = NetUtil.newURI("chrome://browser/content/extension-mac.css");
|
styleSheetURI = Services.io.newURI("chrome://browser/content/extension-mac.css",
|
||||||
|
null, null);
|
||||||
let macStyleSheet = styleSheetService.preloadSheet(styleSheetURI,
|
let macStyleSheet = styleSheetService.preloadSheet(styleSheetURI,
|
||||||
styleSheetService.AGENT_SHEET);
|
styleSheetService.AGENT_SHEET);
|
||||||
stylesheets.push(macStyleSheet);
|
stylesheets.push(macStyleSheet);
|
||||||
@@ -63,24 +61,6 @@ XPCOMUtils.defineLazyGetter(this, "stylesheets", () => {
|
|||||||
return stylesheets;
|
return stylesheets;
|
||||||
});
|
});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "standaloneStylesheets", () => {
|
|
||||||
let stylesheets = [];
|
|
||||||
|
|
||||||
if (AppConstants.platform === "macosx") {
|
|
||||||
let styleSheetURI = NetUtil.newURI("chrome://browser/content/extension-mac-panel.css");
|
|
||||||
let macStyleSheet = styleSheetService.preloadSheet(styleSheetURI,
|
|
||||||
styleSheetService.AGENT_SHEET);
|
|
||||||
stylesheets.push(macStyleSheet);
|
|
||||||
}
|
|
||||||
if (AppConstants.platform === "win") {
|
|
||||||
let styleSheetURI = NetUtil.newURI("chrome://browser/content/extension-win-panel.css");
|
|
||||||
let winStyleSheet = styleSheetService.preloadSheet(styleSheetURI,
|
|
||||||
styleSheetService.AGENT_SHEET);
|
|
||||||
stylesheets.push(winStyleSheet);
|
|
||||||
}
|
|
||||||
return stylesheets;
|
|
||||||
});
|
|
||||||
|
|
||||||
class BasePopup {
|
class BasePopup {
|
||||||
constructor(extension, viewNode, popupURL, browserStyle) {
|
constructor(extension, viewNode, popupURL, browserStyle) {
|
||||||
let popupURI = Services.io.newURI(popupURL, null, extension.baseURI);
|
let popupURI = Services.io.newURI(popupURL, null, extension.baseURI);
|
||||||
@@ -143,20 +123,11 @@ class BasePopup {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "DOMWindowCreated":
|
case "DOMWindowCreated":
|
||||||
if (event.target === this.browser.contentDocument) {
|
if (this.browserStyle && event.target === this.browser.contentDocument) {
|
||||||
let winUtils = this.browser.contentWindow
|
let winUtils = this.browser.contentWindow
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
for (let stylesheet of global.stylesheets) {
|
||||||
|
winUtils.addSheet(stylesheet, winUtils.AGENT_SHEET);
|
||||||
if (this.browserStyle) {
|
|
||||||
for (let stylesheet of stylesheets) {
|
|
||||||
winUtils.addSheet(stylesheet, winUtils.AGENT_SHEET);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.fixedWidth) {
|
|
||||||
for (let stylesheet of standaloneStylesheets) {
|
|
||||||
winUtils.addSheet(stylesheet, winUtils.AGENT_SHEET);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -203,8 +174,6 @@ class BasePopup {
|
|||||||
this.browser = document.createElementNS(XUL_NS, "browser");
|
this.browser = document.createElementNS(XUL_NS, "browser");
|
||||||
this.browser.setAttribute("type", "content");
|
this.browser.setAttribute("type", "content");
|
||||||
this.browser.setAttribute("disableglobalhistory", "true");
|
this.browser.setAttribute("disableglobalhistory", "true");
|
||||||
this.browser.setAttribute("transparent", "true");
|
|
||||||
this.browser.setAttribute("class", "webextension-popup-browser");
|
|
||||||
this.browser.setAttribute("webextension-view-type", "popup");
|
this.browser.setAttribute("webextension-view-type", "popup");
|
||||||
|
|
||||||
// We only need flex sizing for the sake of the slide-in sub-views of the
|
// We only need flex sizing for the sake of the slide-in sub-views of the
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
body {
|
|
||||||
border-radius: 3.5px;
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
@media (-moz-os-version: windows-xp),
|
|
||||||
(-moz-os-version: windows-vista),
|
|
||||||
(-moz-os-version: windows-win7) {
|
|
||||||
body {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,7 @@ input {
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
background: transparent;
|
background-color: #fcfcfc;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
color: #222426;
|
color: #222426;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|||||||
@@ -4,13 +4,7 @@
|
|||||||
|
|
||||||
browser.jar:
|
browser.jar:
|
||||||
content/browser/extension.css
|
content/browser/extension.css
|
||||||
#ifdef XP_MACOSX
|
|
||||||
content/browser/extension-mac.css
|
content/browser/extension-mac.css
|
||||||
content/browser/extension-mac-panel.css
|
|
||||||
#endif
|
|
||||||
#ifdef XP_WIN
|
|
||||||
content/browser/extension-win-panel.css
|
|
||||||
#endif
|
|
||||||
content/browser/extension.svg
|
content/browser/extension.svg
|
||||||
content/browser/ext-bookmarks.js
|
content/browser/ext-bookmarks.js
|
||||||
content/browser/ext-browserAction.js
|
content/browser/ext-browserAction.js
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ support-files =
|
|||||||
[browser_ext_pageAction_popup_resize.js]
|
[browser_ext_pageAction_popup_resize.js]
|
||||||
[browser_ext_pageAction_simple.js]
|
[browser_ext_pageAction_simple.js]
|
||||||
[browser_ext_popup_api_injection.js]
|
[browser_ext_popup_api_injection.js]
|
||||||
[browser_ext_popup_corners.js]
|
|
||||||
[browser_ext_runtime_openOptionsPage.js]
|
[browser_ext_runtime_openOptionsPage.js]
|
||||||
[browser_ext_runtime_openOptionsPage_uninstall.js]
|
[browser_ext_runtime_openOptionsPage_uninstall.js]
|
||||||
[browser_ext_runtime_setUninstallURL.js]
|
[browser_ext_runtime_setUninstallURL.js]
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ function* testInArea(area) {
|
|||||||
"popup-a.html": scriptPage("popup-a.js"),
|
"popup-a.html": scriptPage("popup-a.js"),
|
||||||
"popup-a.js": function() {
|
"popup-a.js": function() {
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
let color = window.getComputedStyle(document.body).color;
|
let background = window.getComputedStyle(document.body).backgroundColor;
|
||||||
browser.test.assertEq("rgb(34, 36, 38)", color);
|
browser.test.assertEq("rgb(252, 252, 252)", background);
|
||||||
browser.runtime.sendMessage("from-popup-a");
|
browser.runtime.sendMessage("from-popup-a");
|
||||||
};
|
};
|
||||||
browser.runtime.onMessage.addListener(msg => {
|
browser.runtime.onMessage.addListener(msg => {
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
||||||
/* vim: set sts=2 sw=2 et tw=80: */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function* awaitPanel(extension, win = window) {
|
|
||||||
let {target} = yield BrowserTestUtils.waitForEvent(win.document, "load", true, (event) => {
|
|
||||||
return event.target.location && event.target.location.href.endsWith("popup.html");
|
|
||||||
});
|
|
||||||
|
|
||||||
return target.defaultView
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDocShell)
|
|
||||||
.chromeEventHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_task(function* testPopupBorderRadius() {
|
|
||||||
let extension = ExtensionTestUtils.loadExtension({
|
|
||||||
background() {
|
|
||||||
browser.tabs.query({active: true, currentWindow: true}, tabs => {
|
|
||||||
browser.pageAction.show(tabs[0].id);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
manifest: {
|
|
||||||
"browser_action": {
|
|
||||||
"default_popup": "popup.html",
|
|
||||||
"browser_style": false,
|
|
||||||
},
|
|
||||||
|
|
||||||
"page_action": {
|
|
||||||
"default_popup": "popup.html",
|
|
||||||
"browser_style": false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
files: {
|
|
||||||
"popup.html": `<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head><meta charset="utf-8"></head>
|
|
||||||
<body style="width: 100px; height: 100px;"></body>
|
|
||||||
</html>`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
yield extension.startup();
|
|
||||||
|
|
||||||
function* testPanel(browser, standAlone = true) {
|
|
||||||
let panel = getPanelForNode(browser);
|
|
||||||
let arrowContent = document.getAnonymousElementByAttribute(panel, "class", "panel-arrowcontent");
|
|
||||||
|
|
||||||
let panelStyle = getComputedStyle(arrowContent);
|
|
||||||
|
|
||||||
let viewNode = browser.parentNode === panel ? browser : browser.parentNode;
|
|
||||||
let viewStyle = getComputedStyle(viewNode);
|
|
||||||
|
|
||||||
let win = browser.contentWindow;
|
|
||||||
let bodyStyle = win.getComputedStyle(win.document.body);
|
|
||||||
|
|
||||||
for (let prop of ["borderTopLeftRadius", "borderTopRightRadius",
|
|
||||||
"borderBottomRightRadius", "borderBottomLeftRadius"]) {
|
|
||||||
if (standAlone) {
|
|
||||||
is(viewStyle[prop], panelStyle[prop], `Panel and view ${prop} should be the same`);
|
|
||||||
is(bodyStyle[prop], panelStyle[prop], `Panel and body ${prop} should be the same`);
|
|
||||||
} else {
|
|
||||||
is(viewStyle[prop], "0px", `View node ${prop} should be 0px`);
|
|
||||||
is(bodyStyle[prop], "0px", `Body node ${prop} should be 0px`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
info("Test stand-alone browserAction popup");
|
|
||||||
|
|
||||||
clickBrowserAction(extension);
|
|
||||||
let browser = yield awaitPanel(extension);
|
|
||||||
yield testPanel(browser);
|
|
||||||
yield closeBrowserAction(extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
info("Test menu panel browserAction popup");
|
|
||||||
|
|
||||||
let widget = getBrowserActionWidget(extension);
|
|
||||||
CustomizableUI.addWidgetToArea(widget.id, CustomizableUI.AREA_PANEL);
|
|
||||||
|
|
||||||
clickBrowserAction(extension);
|
|
||||||
let browser = yield awaitPanel(extension);
|
|
||||||
yield testPanel(browser, false);
|
|
||||||
yield closeBrowserAction(extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
info("Test pageAction popup");
|
|
||||||
|
|
||||||
clickPageAction(extension);
|
|
||||||
let browser = yield awaitPanel(extension);
|
|
||||||
yield testPanel(browser);
|
|
||||||
yield closePageAction(extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
yield extension.unload();
|
|
||||||
});
|
|
||||||
@@ -1950,15 +1950,6 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton:not(:h
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.webextension-popup-browser {
|
|
||||||
margin-right: -1px;
|
|
||||||
border-radius: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PanelUI-popup .webextension-popup-browser {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menuitem-iconic[usercontextid] > .menu-iconic-left > .menu-iconic-icon {
|
.menuitem-iconic[usercontextid] > .menu-iconic-left > .menu-iconic-icon {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3462,16 +3462,3 @@ menulist.translate-infobar-element > .menulist-dropmarker {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cui-widget-panelview[id^=PanelUI-webext-] {
|
|
||||||
border-radius: 3.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.webextension-popup-browser {
|
|
||||||
margin-right: -1px;
|
|
||||||
border-radius: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PanelUI-popup .webextension-popup-browser {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -273,6 +273,10 @@ panelmultiview[nosubviews=true] > .panel-viewcontainer > .panel-viewstack > .pan
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cui-widget-panelview[id^=PanelUI-webext-] {
|
||||||
|
border-radius: 3.5px;
|
||||||
|
}
|
||||||
|
|
||||||
panelview[id^=PanelUI-webext-] {
|
panelview[id^=PanelUI-webext-] {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2709,20 +2709,3 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (-moz-os-version: windows-xp),
|
|
||||||
(-moz-os-version: windows-vista),
|
|
||||||
(-moz-os-version: windows-win7) {
|
|
||||||
.cui-widget-panelview[id^=PanelUI-webext-] {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.webextension-popup-browser {
|
|
||||||
margin-right: -1px;
|
|
||||||
border-radius: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PanelUI-popup .webextension-popup-browser {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user