Backed out changeset 9999b6b8022b (bug 1280128) for ESLint failures
This commit is contained in:
@@ -4,15 +4,9 @@
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
||||
"resource:///modules/CustomizableUI.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"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/AppConstants.jsm");
|
||||
|
||||
@@ -48,14 +42,18 @@ function promisePopupShown(popup) {
|
||||
});
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "stylesheets", () => {
|
||||
let styleSheetURI = NetUtil.newURI("chrome://browser/content/extension.css");
|
||||
XPCOMUtils.defineLazyGetter(global, "stylesheets", () => {
|
||||
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,
|
||||
styleSheetService.AGENT_SHEET);
|
||||
let stylesheets = [styleSheet];
|
||||
|
||||
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,
|
||||
styleSheetService.AGENT_SHEET);
|
||||
stylesheets.push(macStyleSheet);
|
||||
@@ -63,24 +61,6 @@ XPCOMUtils.defineLazyGetter(this, "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 {
|
||||
constructor(extension, viewNode, popupURL, browserStyle) {
|
||||
let popupURI = Services.io.newURI(popupURL, null, extension.baseURI);
|
||||
@@ -143,22 +123,13 @@ class BasePopup {
|
||||
break;
|
||||
|
||||
case "DOMWindowCreated":
|
||||
if (event.target === this.browser.contentDocument) {
|
||||
if (this.browserStyle && event.target === this.browser.contentDocument) {
|
||||
let winUtils = this.browser.contentWindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
if (this.browserStyle) {
|
||||
for (let stylesheet of stylesheets) {
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
for (let stylesheet of global.stylesheets) {
|
||||
winUtils.addSheet(stylesheet, winUtils.AGENT_SHEET);
|
||||
}
|
||||
}
|
||||
if (!this.fixedWidth) {
|
||||
for (let stylesheet of standaloneStylesheets) {
|
||||
winUtils.addSheet(stylesheet, winUtils.AGENT_SHEET);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "DOMWindowClose":
|
||||
@@ -203,8 +174,6 @@ class BasePopup {
|
||||
this.browser = document.createElementNS(XUL_NS, "browser");
|
||||
this.browser.setAttribute("type", "content");
|
||||
this.browser.setAttribute("disableglobalhistory", "true");
|
||||
this.browser.setAttribute("transparent", "true");
|
||||
this.browser.setAttribute("class", "webextension-popup-browser");
|
||||
this.browser.setAttribute("webextension-view-type", "popup");
|
||||
|
||||
// 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 */
|
||||
html,
|
||||
body {
|
||||
background: transparent;
|
||||
background-color: #fcfcfc;
|
||||
box-sizing: border-box;
|
||||
color: #222426;
|
||||
cursor: default;
|
||||
|
||||
@@ -4,13 +4,7 @@
|
||||
|
||||
browser.jar:
|
||||
content/browser/extension.css
|
||||
#ifdef XP_MACOSX
|
||||
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/ext-bookmarks.js
|
||||
content/browser/ext-browserAction.js
|
||||
|
||||
@@ -43,7 +43,6 @@ support-files =
|
||||
[browser_ext_pageAction_popup_resize.js]
|
||||
[browser_ext_pageAction_simple.js]
|
||||
[browser_ext_popup_api_injection.js]
|
||||
[browser_ext_popup_corners.js]
|
||||
[browser_ext_runtime_openOptionsPage.js]
|
||||
[browser_ext_runtime_openOptionsPage_uninstall.js]
|
||||
[browser_ext_runtime_setUninstallURL.js]
|
||||
|
||||
@@ -20,8 +20,8 @@ function* testInArea(area) {
|
||||
"popup-a.html": scriptPage("popup-a.js"),
|
||||
"popup-a.js": function() {
|
||||
window.onload = () => {
|
||||
let color = window.getComputedStyle(document.body).color;
|
||||
browser.test.assertEq("rgb(34, 36, 38)", color);
|
||||
let background = window.getComputedStyle(document.body).backgroundColor;
|
||||
browser.test.assertEq("rgb(252, 252, 252)", background);
|
||||
browser.runtime.sendMessage("from-popup-a");
|
||||
};
|
||||
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;
|
||||
}
|
||||
|
||||
.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 {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
@@ -3462,16 +3462,3 @@ menulist.translate-infobar-element > .menulist-dropmarker {
|
||||
padding: 0;
|
||||
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;
|
||||
}
|
||||
|
||||
.cui-widget-panelview[id^=PanelUI-webext-] {
|
||||
border-radius: 3.5px;
|
||||
}
|
||||
|
||||
panelview[id^=PanelUI-webext-] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -2709,20 +2709,3 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton {
|
||||
padding: 0;
|
||||
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