--- a/mobile/android/chrome/content/aboutAddons.js
+++ b/mobile/android/chrome/content/aboutAddons.js
@@ -419,22 +419,16 @@ var Addons = {
case AddonManager.OPTIONS_TYPE_TAB:
// Keep the usual layout for any options related the legacy (or system) add-ons
// when the options are opened in a new tab from a single button in the addon
// details page.
optionsBox.classList.add("inner");
this.createOptionsInTabButton(optionsBox, addon, addonItem);
break;
- case AddonManager.OPTIONS_TYPE_INLINE:
- // Keep the usual layout for any options related the legacy (or system) add-ons.
- optionsBox.classList.add("inner");
-
- this.createInlineOptions(optionsBox, optionsURL, aListItem);
- break;
}
showAddonOptions();
},
createOptionsInTabButton: function(destination, addon, detailItem) {
let frame = destination.querySelector("iframe#addon-options");
let button = destination.querySelector("button#open-addon-options");
@@ -515,72 +509,16 @@ var Addons = {
// button from applying to the iframe.
frame.contentWindow.location.replace(optionsURL);
// Ensure that the Addon Options are visible (the options box will be hidden if the optionsURL
// attribute is an empty string, which happens when a WebExtensions is still loading).
detailItem.removeAttribute("optionsURL");
},
- createInlineOptions(destination, optionsURL, aListItem) {
- // This function removes and returns the text content of aNode without
- // removing any child elements. Removing the text nodes ensures any XBL
- // bindings apply properly.
- function stripTextNodes(aNode) {
- var text = "";
- for (var i = 0; i < aNode.childNodes.length; i++) {
- if (aNode.childNodes[i].nodeType != document.ELEMENT_NODE) {
- text += aNode.childNodes[i].textContent;
- aNode.removeChild(aNode.childNodes[i--]);
- } else {
- text += stripTextNodes(aNode.childNodes[i]);
- }
- }
- return text;
- }
-
- try {
- let xhr = new XMLHttpRequest();
- xhr.open("GET", optionsURL, true);
- xhr.onload = function(e) {
- if (xhr.responseXML) {
- // Only allow <setting> for now
- let settings = xhr.responseXML.querySelectorAll(":root > setting");
- if (settings.length > 0) {
- for (let i = 0; i < settings.length; i++) {
- var setting = settings[i];
- var desc = stripTextNodes(setting).trim();
- if (!setting.hasAttribute("desc")) {
- setting.setAttribute("desc", desc);
- }
- destination.appendChild(setting);
- }
- // Send an event so add-ons can prepopulate any non-preference based
- // settings
- let event = document.createEvent("Events");
- event.initEvent("AddonOptionsLoad", true, false);
- window.dispatchEvent(event);
- } else {
- // Reset the options URL to hide the options header if there are no
- // valid settings to show.
- let detailItem = document.querySelector("#addons-details > .addon-item");
- detailItem.setAttribute("optionsURL", "");
- }
-
- // Also send a notification to match the behavior of desktop Firefox
- let id = aListItem.getAttribute("addonID");
- Services.obs.notifyObservers(document, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, id);
- }
- };
- xhr.send(null);
- } catch (e) {
- Cu.reportError(e);
- }
- },
-
setEnabled: function setEnabled(aValue, aAddon) {
let detailItem = document.querySelector("#addons-details > .addon-item");
let addon = aAddon || detailItem.addon;
if (!addon)
return;
let listItem = this._getElementForAddon(addon.id);
deleted file mode 100644
--- a/mobile/android/chrome/content/bindings/checkbox.xml
+++ /dev/null
@@ -1,28 +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/. -->
-
-<bindings
- xmlns="http://www.mozilla.org/xbl"
- xmlns:xbl="http://www.mozilla.org/xbl"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <binding id="checkbox-with-spacing"
- extends="chrome://global/content/bindings/checkbox.xml#checkbox">
-
- <content>
- <xul:hbox class="checkbox-spacer-box">
- <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
- </xul:hbox>
- <xul:hbox class="checkbox-label-center-box" flex="1">
- <xul:hbox class="checkbox-label-box" flex="1">
- <xul:image class="checkbox-icon" xbl:inherits="src"/>
- <xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/>
- </xul:hbox>
- </xul:hbox>
- </content>
- </binding>
-
-</bindings>
deleted file mode 100644
--- a/mobile/android/chrome/content/bindings/settings.xml
+++ /dev/null
@@ -1,66 +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/. -->
-
-
-<bindings
- xmlns="http://www.mozilla.org/xbl"
- xmlns:xbl="http://www.mozilla.org/xbl"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <binding id="setting-fulltoggle-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-bool">
- <handlers>
- <handler event="command" button="0" phase="capturing">
- <![CDATA[
- event.stopPropagation();
- ]]>
- </handler>
- <handler event="click" button="0" phase="capturing">
- <![CDATA[
- event.stopPropagation();
- this.input.checked = !this.input.checked;
- this.inputChanged();
- this.fireEvent("oncommand");
- ]]>
- </handler>
- </handlers>
- </binding>
-
- <binding id="setting-fulltoggle-boolint" extends="chrome://mozapps/content/extensions/setting.xml#setting-boolint">
- <handlers>
- <handler event="command" button="0" phase="capturing">
- <![CDATA[
- event.stopPropagation();
- ]]>
- </handler>
- <handler event="click" button="0" phase="capturing">
- <![CDATA[
- event.stopPropagation();
- this.input.checked = !this.input.checked;
- this.inputChanged();
- this.fireEvent("oncommand");
- ]]>
- </handler>
- </handlers>
- </binding>
-
- <binding id="setting-fulltoggle-localized-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-localized-bool">
- <handlers>
- <handler event="command" button="0" phase="capturing">
- <![CDATA[
- event.stopPropagation();
- ]]>
- </handler>
- <handler event="click" button="0" phase="capturing">
- <![CDATA[
- event.stopPropagation();
- this.input.checked = !this.input.checked;
- this.inputChanged();
- this.fireEvent("oncommand");
- ]]>
- </handler>
- </handlers>
- </binding>
-</bindings>
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -23,18 +23,16 @@ chrome.jar:
content/aboutRights.xhtml (content/aboutRights.xhtml)
content/blockedSite.xhtml (content/blockedSite.xhtml)
content/languages.properties (content/languages.properties)
content/browser.xul (content/browser.xul)
content/browser.css (content/browser.css)
content/browser.js (content/browser.js)
content/PresentationView.xul (content/PresentationView.xul)
content/PresentationView.js (content/PresentationView.js)
- content/bindings/checkbox.xml (content/bindings/checkbox.xml)
- content/bindings/settings.xml (content/bindings/settings.xml)
content/netError.xhtml (content/netError.xhtml)
content/EmbedRT.js (content/EmbedRT.js)
content/MemoryObserver.js (content/MemoryObserver.js)
content/ConsoleAPI.js (content/ConsoleAPI.js)
content/PluginHelper.js (content/PluginHelper.js)
content/PrintHelper.js (content/PrintHelper.js)
content/OfflineApps.js (content/OfflineApps.js)
content/MasterPassword.js (content/MasterPassword.js)
--- a/mobile/android/themes/core/aboutAddons.css
+++ b/mobile/android/themes/core/aboutAddons.css
@@ -146,190 +146,16 @@ button:not(#update-btn) {
.buttons > button[hidden="true"] {
display: none;
}
.buttons:first-child {
border-inline-start-color: transparent;
}
-/* Settings */
-
-setting {
- padding-bottom: 1em;
- -moz-box-align: center;
- box-sizing: border-box;
- width: 100%;
-}
-
-setting[type="integer"],
-setting[type="string"],
-setting[type="menulist"],
-setting[type="control"] {
- -moz-box-orient: vertical;
- -moz-box-align: start;
-}
-
-setting > vbox {
- -moz-box-flex: 1;
-}
-
-.preferences-description {
- margin-top: 4px;
- color: #666;
-}
-
-.preferences-description:empty {
- display: none;
-}
-
-/* Checkbox */
-
-checkbox {
- -moz-binding: url("chrome://browser/content/bindings/checkbox.xml#checkbox-with-spacing") !important;
- margin: 0;
-}
-
-checkbox[label=""] > .checkbox-label-box,
-checkbox:not([label]) > .checkbox-label-box {
- display: none;
-}
-
-.checkbox-check {
- background-color: transparent;
- background-image: url("chrome://browser/skin/images/checkbox_unchecked.png");
- border: none;
- height: 48px;
- width: 48px;
-}
-
-setting:active checkbox > .checkbox-spacer-box > .checkbox-check {
- background-image: url("chrome://browser/skin/images/checkbox_unchecked_pressed.png");
-}
-
-checkbox[disabled="true"] > .checkbox-spacer-box > .checkbox-check {
- background-image: url("chrome://browser/skin/images/checkbox_unchecked_disabled.png");
-}
-
-checkbox[checked="true"] > .checkbox-spacer-box > .checkbox-check {
- background-image: url("chrome://browser/skin/images/checkbox_checked.png");
-}
-
-setting:active checkbox[checked="true"] > .checkbox-spacer-box > .checkbox-check {
- background-image: url("chrome://browser/skin/images/checkbox_checked_pressed.png");
-}
-
-checkbox[checked="true"][disabled="true"] > .checkbox-spacer-box > .checkbox-check {
- background-image: url("chrome://browser/skin/images/checkbox_checked_disabled.png");
-}
-
-/* Textbox */
-
-textbox[type="number"] > spinbuttons {
- visibility: collapse;
-}
-
-textbox {
- min-width: 200px;
- margin: 2px 0;
- padding: 0.5em !important;
- background: #fff;
- border: 1px solid #ccc;
- border-radius: 4px;
- color: #333;
-}
-
-/* Button */
-
-setting button {
- margin: 2px 0;
- background: #fff;
- border: 1px solid #ccc;
- padding: 0.5em;
-}
-
-/* Menulist */
-
-menulist {
- -moz-appearance: none !important;
- -moz-user-focus: ignore;
- min-width: 200px;
- margin: 2px 0;
- background: #fff;
- border: 1px solid #ccc;
- border-radius: 4px;
- padding: 0.5em;
-}
-
-menulist > dropmarker {
- height: 1.8em;
- width: 1.8em;
- margin-left: var(--margin_snormal);
- background-color: transparent;
- border: none;
- -moz-box-align: center;
- -moz-box-pack: center;
- list-style-image: url("chrome://geckoview/skin/images/dropmarker.svg") !important;
- -moz-image-region: auto;
- display: block;
-}
-
-/* Select */
-
-select {
- min-width: 200px;
- margin: 2px 0;
- background: #fff;
- border: 1px solid #ccc;
- border-radius: 4px;
- padding: 1em;
-}
-
-/* XBL bindings */
-
-setting {
- display: none;
-}
-
-setting[type="bool"] {
- display: -moz-box;
- -moz-binding: url("chrome://browser/content/bindings/settings.xml#setting-fulltoggle-bool");
-}
-
-setting[type="bool"][localized="true"] {
- display: -moz-box;
- -moz-binding: url("chrome://browser/content/bindings/settings.xml#setting-fulltoggle-localized-bool");
-}
-
-setting[type="boolint"] {
- display: -moz-box;
- -moz-binding: url("chrome://browser/content/bindings/settings.xml#setting-fulltoggle-boolint");
-}
-
-setting[type="integer"] {
- display: -moz-box;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-integer");
-}
-
-setting[type="control"] {
- display: -moz-box;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-control");
-}
-
-setting[type="string"] {
- display: -moz-box;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-string");
-}
-
-setting[type="radio"],
-setting[type="menulist"] {
- display: -moz-box;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-multi");
-}
-
.hide-on-enable,
.show-on-error,
.show-on-uninstall,
.show-on-install,
.show-on-restart,
div[isDisabled="true"] .hide-on-disable {
display: none;
}
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -3447,25 +3447,18 @@ this.AddonManager = {
AUTOUPDATE_DISABLE: 0,
// Indicates that the Addon should update automatically only if
// that's the global default.
AUTOUPDATE_DEFAULT: 1,
// Indicates that the Addon should update automatically.
AUTOUPDATE_ENABLE: 2,
// Constants for how Addon options should be shown.
- // Options will be opened in a new window
- OPTIONS_TYPE_DIALOG: 1,
- // Options will be displayed within the AM detail view
- OPTIONS_TYPE_INLINE: 2,
// Options will be displayed in a new tab, if possible
OPTIONS_TYPE_TAB: 3,
- // Same as OPTIONS_TYPE_INLINE, but no Preferences button will be shown.
- // Used to indicate that only non-interactive information will be shown.
- OPTIONS_TYPE_INLINE_INFO: 4,
// Similar to OPTIONS_TYPE_INLINE, but rather than generating inline
// options from a specially-formatted XUL file, the contents of the
// file are simply displayed in an inline <browser> element.
OPTIONS_TYPE_INLINE_BROWSER: 5,
// Constants for displayed or hidden options notifications
// Options notification will be displayed
OPTIONS_NOTIFICATION_DISPLAYED: "addon-options-displayed",
--- a/toolkit/mozapps/extensions/content/extensions.css
+++ b/toolkit/mozapps/extensions/content/extensions.css
@@ -55,76 +55,20 @@ xhtml|link {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#detail-row");
}
.text-list {
white-space: pre-line;
-moz-user-select: element;
}
-setting, row[unsupported="true"] {
+row[unsupported="true"] {
display: none;
}
-setting[type="bool"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-bool");
-}
-
-setting[type="bool"][localized="true"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-localized-bool");
-}
-
-setting[type="bool"]:not([learnmore]) .preferences-learnmore,
-setting[type="boolint"]:not([learnmore]) .preferences-learnmore {
- visibility: collapse;
-}
-
-setting[type="boolint"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-boolint");
-}
-
-setting[type="integer"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-integer");
-}
-
-setting[type="integer"]:not([size]) textbox {
- -moz-box-flex: 1;
-}
-
-setting[type="control"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-control");
-}
-
-setting[type="string"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-string");
-}
-
-setting[type="color"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-color");
-}
-
-setting[type="file"],
-setting[type="directory"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-path");
-}
-
-setting[type="radio"],
-setting[type="menulist"] {
- display: -moz-grid-line;
- -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-multi");
-}
-
#addonitem-popup > menuitem[disabled="true"] {
display: none;
}
#addonitem-popup[addontype="theme"] > #menuitem_enableItem,
#addonitem-popup[addontype="theme"] > #menuitem_disableItem,
#addonitem-popup:not([addontype="theme"]) > #menuitem_enableTheme,
#addonitem-popup:not([addontype="theme"]) > #menuitem_disableTheme {
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1180,59 +1180,30 @@ var gViewController = {
};
gEventManager.delegateAddonEvent("onCheckingUpdate", [aAddon]);
aAddon.findUpdates(listener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
}
},
cmd_showItemPreferences: {
isEnabled(aAddon) {
- if (!aAddon ||
- (!aAddon.isActive && aAddon.type !== "plugin") ||
- !aAddon.optionsURL) {
+ if (!aAddon || (!aAddon.isActive && aAddon.type !== "plugin")) {
return false;
}
- if (gViewController.currentViewObj == gDetailView &&
- (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE ||
- aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER)) {
- return false;
+ if (gViewController.currentViewObj == gDetailView) {
+ return aAddon.optionsType && !hasInlineOptions(aAddon);
}
- if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_INFO)
- return false;
- return true;
+ return aAddon.type == "plugin" || aAddon.optionsType;
},
doCommand(aAddon) {
if (hasInlineOptions(aAddon)) {
gViewController.commands.cmd_showItemDetails.doCommand(aAddon, true);
- return;
- }
- var optionsURL = aAddon.optionsURL;
- if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_TAB &&
- openOptionsInTab(optionsURL)) {
- return;
+ } else if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_TAB) {
+ openOptionsInTab(aAddon.optionsURL);
}
- var windows = Services.wm.getEnumerator(null);
- while (windows.hasMoreElements()) {
- var win = windows.getNext();
- if (win.closed) {
- continue;
- }
- if (win.document.documentURI == optionsURL) {
- win.focus();
- return;
- }
- }
- var features = "chrome,titlebar,toolbar,centerscreen";
- try {
- var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
- features += instantApply ? ",dialog=no" : ",modal";
- } catch (e) {
- features += ",modal";
- }
- openDialog(optionsURL, "", features);
}
},
cmd_showItemAbout: {
isEnabled(aAddon) {
// XXXunf This may be applicable to install items too. See bug 561260
return !!aAddon;
},
@@ -1574,19 +1545,18 @@ var gViewController = {
return;
cmd.doCommand(aAddon);
},
onEvent() {}
};
function hasInlineOptions(aAddon) {
- return (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE ||
- aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER ||
- aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_INFO);
+ return aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER ||
+ aAddon.type == "plugin";
}
function openOptionsInTab(optionsURL) {
let mainWindow = getMainWindow();
if ("switchToTabHavingURI" in mainWindow) {
mainWindow.switchToTabHavingURI(optionsURL, true, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
@@ -3624,104 +3594,36 @@ var gDetailView = {
Services.obs.notifyObservers(document,
AddonManager.OPTIONS_NOTIFICATION_DISPLAYED,
this._addon.id);
if (aScrollToPreferences)
gDetailView.scrollToPreferencesRows();
});
};
- // This function removes and returns the text content of aNode without
- // removing any child elements. Removing the text nodes ensures any XBL
- // bindings apply properly.
- function stripTextNodes(aNode) {
- var text = "";
- for (var i = 0; i < aNode.childNodes.length; i++) {
- if (aNode.childNodes[i].nodeType != document.ELEMENT_NODE) {
- text += aNode.childNodes[i].textContent;
- aNode.removeChild(aNode.childNodes[i--]);
- } else {
- text += stripTextNodes(aNode.childNodes[i]);
- }
- }
- return text;
+ var rows = document.getElementById("detail-downloads").parentNode;
+
+ if (this._addon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER) {
+ whenViewLoaded(async () => {
+ await this._addon.startupPromise;
+
+ const browserContainer = await this.createOptionsBrowser(rows);
+
+ // Make sure the browser is unloaded as soon as we change views,
+ // rather than waiting for the next detail view to load.
+ document.addEventListener("ViewChanged", function() {
+ browserContainer.remove();
+ }, {once: true});
+
+ finish(browserContainer);
+ });
}
- var rows = document.getElementById("detail-downloads").parentNode;
-
- try {
- if (this._addon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER) {
- whenViewLoaded(async () => {
- await this._addon.startupPromise;
-
- const browserContainer = await this.createOptionsBrowser(rows);
-
- // Make sure the browser is unloaded as soon as we change views,
- // rather than waiting for the next detail view to load.
- document.addEventListener("ViewChanged", function() {
- browserContainer.remove();
- }, {once: true});
-
- finish(browserContainer);
- });
-
- if (aCallback)
- aCallback();
- } else {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", this._addon.optionsURL, true);
- xhr.responseType = "xml";
- xhr.onload = (function() {
- var xml = xhr.responseXML;
- var settings = xml.querySelectorAll(":root > setting");
-
- var firstSetting = null;
- for (var setting of settings) {
-
- var desc = stripTextNodes(setting).trim();
- if (!setting.hasAttribute("desc"))
- setting.setAttribute("desc", desc);
-
- var type = setting.getAttribute("type");
- if (type == "file" || type == "directory")
- setting.setAttribute("fullpath", "true");
-
- setting = document.importNode(setting, true);
- var style = setting.getAttribute("style");
- if (style) {
- setting.removeAttribute("style");
- setting.setAttribute("style", style);
- }
-
- rows.appendChild(setting);
- var visible = window.getComputedStyle(setting).getPropertyValue("display") != "none";
- if (!firstSetting && visible) {
- setting.setAttribute("first-row", true);
- firstSetting = setting;
- }
- }
-
- finish(firstSetting);
-
- if (aCallback)
- aCallback();
- });
- xhr.onerror = function(aEvent) {
- Cu.reportError("Error " + aEvent.target.status +
- " occurred while receiving " + this._addon.optionsURL);
- if (aCallback)
- aCallback();
- };
- xhr.send();
- }
- } catch (e) {
- Cu.reportError(e);
- if (aCallback)
- aCallback();
- }
+ if (aCallback)
+ aCallback();
},
scrollToPreferencesRows() {
// We find this row, rather than remembering it from above,
// in case it has been changed by the observers.
let firstRow = gDetailView.node.querySelector('setting[first-row="true"]');
if (firstRow) {
let top = firstRow.boxObject.y;
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -1365,18 +1365,17 @@
this._warning.textContent =
gStrings.ext.formatStringFromName("notification.gmpPending",
[this.mAddon.name], 1);
} else {
this.removeAttribute("notification");
}
}
- this._preferencesBtn.hidden = (!this.mAddon.optionsURL) ||
- this.mAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_INFO;
+ this._preferencesBtn.hidden = !this.mAddon.optionsType && this.mAddon.type != "plugin";
if (this.typeHasFlag("SUPPORTS_ASK_TO_ACTIVATE")) {
this._enableBtn.disabled = true;
this._disableBtn.disabled = true;
this._askToActivateMenuitem.disabled = !this.hasPermission("ask_to_activate");
this._alwaysActivateMenuitem.disabled = !this.hasPermission("enable");
this._neverActivateMenuitem.disabled = !this.hasPermission("disable");
if (!this.mAddon.isActive) {
deleted file mode 100644
--- a/toolkit/mozapps/extensions/content/gmpPrefs.xul
+++ /dev/null
@@ -1,8 +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/. -->
-
-<!-- This is intentionally empty and a dummy to let the GMPProvider
- have a preferences button in the list view. -->
deleted file mode 100644
--- a/toolkit/mozapps/extensions/content/setting.xml
+++ /dev/null
@@ -1,487 +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/. -->
-
-<!DOCTYPE page [
-<!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd">
-%extensionsDTD;
-]>
-
-<!-- import-globals-from extensions.js -->
-
-<bindings xmlns="http://www.mozilla.org/xbl"
- xmlns:xbl="http://www.mozilla.org/xbl"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <binding id="setting-base">
- <implementation>
- <constructor><![CDATA[
- this.preferenceChanged();
-
- this.addEventListener("keypress", function(event) {
- event.stopPropagation();
- });
-
- if (this.usePref)
- Services.prefs.addObserver(this.pref, this._observer, true);
- ]]></constructor>
-
- <field name="_observer"><![CDATA[({
- _self: this,
-
- QueryInterface(aIID) {
- const Ci = Components.interfaces;
- if (aIID.equals(Ci.nsIObserver) ||
- aIID.equals(Ci.nsISupportsWeakReference) ||
- aIID.equals(Ci.nsISupports))
- return this;
-
- throw Components.Exception("No interface", Components.results.NS_ERROR_NO_INTERFACE);
- },
-
- observe(aSubject, aTopic, aPrefName) {
- if (aTopic != "nsPref:changed")
- return;
-
- if (this._self.pref == aPrefName)
- this._self.preferenceChanged();
- }
- })]]>
- </field>
-
- <method name="fireEvent">
- <parameter name="eventName"/>
- <parameter name="funcStr"/>
- <body>
- <![CDATA[
- let body = funcStr || this.getAttribute(eventName);
- if (!body)
- return;
-
- try {
- let event = document.createEvent("Events");
- event.initEvent(eventName, true, true);
- let f = new Function("event", body);
- f.call(this, event);
- } catch (e) {
- Cu.reportError(e);
- }
- ]]>
- </body>
- </method>
-
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- // Should be code to set the from the preference input.value
- throw Components.Exception("No valueFromPreference implementation",
- Components.results.NS_ERROR_NOT_IMPLEMENTED);
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- // Should be code to set the input.value from the preference
- throw Components.Exception("No valueToPreference implementation",
- Components.results.NS_ERROR_NOT_IMPLEMENTED);
- ]]>
- </body>
- </method>
-
- <method name="inputChanged">
- <body>
- <![CDATA[
- if (this.usePref && !this._updatingInput) {
- this.valueToPreference();
- this.fireEvent("oninputchanged");
- }
- ]]>
- </body>
- </method>
-
- <method name="preferenceChanged">
- <body>
- <![CDATA[
- if (this.usePref) {
- this._updatingInput = true;
- try {
- this.valueFromPreference();
- this.fireEvent("onpreferencechanged");
- } catch (e) {}
- this._updatingInput = false;
- }
- ]]>
- </body>
- </method>
-
- <property name="usePref" readonly="true" onget="return this.hasAttribute('pref');"/>
- <property name="pref" readonly="true" onget="return this.getAttribute('pref');"/>
- <property name="type" readonly="true" onget="return this.getAttribute('type');"/>
- <property name="value" onget="return this.input.value;" onset="return this.input.value = val;"/>
-
- <field name="_updatingInput">false</field>
- <field name="input">document.getAnonymousElementByAttribute(this, "anonid", "input");</field>
- <field name="settings">
- this.parentNode.localName == "settings" ? this.parentNode : null;
- </field>
- </implementation>
- </binding>
-
- <binding id="setting-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- <xul:label class="preferences-learnmore text-link"
- onclick="document.getBindingParent(this).openLearnMore()">&setting.learnmore;</xul:label>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:checkbox anonid="input" xbl:inherits="disabled,onlabel,offlabel,label=checkboxlabel" oncommand="inputChanged();"/>
- </xul:hbox>
- </content>
-
- <implementation>
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- let val = Services.prefs.getBoolPref(this.pref);
- this.value = this.inverted ? !val : val;
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- let val = this.value;
- Services.prefs.setBoolPref(this.pref, this.inverted ? !val : val);
- ]]>
- </body>
- </method>
-
- <property name="value" onget="return this.input.checked;" onset="return this.input.setChecked(val);"/>
- <property name="inverted" readonly="true" onget="return this.getAttribute('inverted');"/>
-
- <method name="openLearnMore">
- <body>
- <![CDATA[
- window.open(this.getAttribute("learnmore"), "_blank");
- ]]>
- </body>
- </method>
- </implementation>
- </binding>
-
- <binding id="setting-boolint" extends="chrome://mozapps/content/extensions/setting.xml#setting-bool">
- <implementation>
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- let val = Services.prefs.getIntPref(this.pref);
- this.value = (val == this.getAttribute("on"));
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- Services.prefs.setIntPref(this.pref, this.getAttribute(this.value ? "on" : "off"));
- ]]>
- </body>
- </method>
- </implementation>
- </binding>
-
- <binding id="setting-localized-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-bool">
- <implementation>
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- let val = Services.prefs.getComplexValue(this.pref, Components.interfaces.nsIPrefLocalizedString).data;
- if (this.inverted) val = !val;
- this.value = (val == "true");
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- let val = this.value;
- if (this.inverted) val = !val;
- let pref = Components.classes["@mozilla.org/pref-localizedstring;1"].createInstance(Components.interfaces.nsIPrefLocalizedString);
- pref.data = this.inverted ? (!val).toString() : val.toString();
- Services.prefs.setComplexValue(this.pref, Components.interfaces.nsIPrefLocalizedString, pref);
- ]]>
- </body>
- </method>
- </implementation>
- </binding>
-
- <binding id="setting-integer" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:textbox type="number" anonid="input" oninput="inputChanged();" onchange="inputChanged();"
- xbl:inherits="disabled,emptytext,min,max,increment,hidespinbuttons,wraparound,size"/>
- </xul:hbox>
- </content>
-
- <implementation>
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- let val = Services.prefs.getIntPref(this.pref);
- this.value = val;
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- Services.prefs.setIntPref(this.pref, this.value);
- ]]>
- </body>
- </method>
- </implementation>
- </binding>
-
- <binding id="setting-control" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <children/>
- </xul:hbox>
- </content>
- </binding>
-
- <binding id="setting-string" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:textbox anonid="input" flex="1" oninput="inputChanged();"
- xbl:inherits="disabled,emptytext,type=inputtype,min,max,increment,hidespinbuttons,decimalplaces,wraparound"/>
- </xul:hbox>
- </content>
-
- <implementation>
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- this.value = Preferences.get(this.pref, "");
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- Preferences.set(this.pref, this.value);
- ]]>
- </body>
- </method>
- </implementation>
- </binding>
-
- <binding id="setting-color" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:colorpicker type="button" anonid="input" xbl:inherits="disabled" onchange="document.getBindingParent(this).inputChanged();"/>
- </xul:hbox>
- </content>
-
- <implementation>
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- // We must wait for the colorpicker's binding to be applied before setting the value
- if (!this.input.color)
- this.input.initialize();
- this.value = Services.prefs.getCharPref(this.pref);
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- Services.prefs.setCharPref(this.pref, this.value);
- ]]>
- </body>
- </method>
-
- <property name="value" onget="return this.input.color;" onset="return this.input.color = val;"/>
- </implementation>
- </binding>
-
- <binding id="setting-path" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:button type="button" anonid="button" label="&settings.path.button.label;" xbl:inherits="disabled" oncommand="showPicker();"/>
- <xul:label anonid="input" flex="1" crop="center" xbl:inherits="disabled"/>
- </xul:hbox>
- </content>
-
- <implementation>
- <method name="showPicker">
- <body>
- <![CDATA[
- var filePicker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
- filePicker.init(window, this.getAttribute("title"),
- this.type == "file" ? Ci.nsIFilePicker.modeOpen : Ci.nsIFilePicker.modeGetFolder);
- if (this.value) {
- try {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
- file.initWithPath(this.value);
- filePicker.displayDirectory = this.type == "file" ? file.parent : file;
- if (this.type == "file") {
- filePicker.defaultString = file.leafName;
- }
- } catch (e) {}
- }
- filePicker.open(rv => {
- if (rv != Ci.nsIFilePicker.returnCancel && filePicker.file) {
- this.value = filePicker.file.path;
- this.inputChanged();
- }
- });
- ]]>
- </body>
- </method>
-
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- this.value = Preferences.get(this.pref, "");
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- Preferences.set(this.pref, this.value);
- ]]>
- </body>
- </method>
-
- <field name="_value"></field>
-
- <property name="value">
- <getter>
- <![CDATA[
- return this._value;
- ]]>
- </getter>
- <setter>
- <![CDATA[
- this._value = val;
- let label = "";
- if (val) {
- try {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
- file.initWithPath(val);
- label = this.hasAttribute("fullpath") ? file.path : file.leafName;
- } catch (e) {}
- }
- this.input.tooltipText = val;
- return this.input.value = label;
- ]]>
- </setter>
- </property>
- </implementation>
- </binding>
-
- <binding id="setting-multi" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <children includes="radiogroup|menulist"/>
- </xul:hbox>
- </content>
-
- <implementation>
- <constructor>
- <![CDATA[
- this.control.addEventListener("command", this.inputChanged.bind(this));
- ]]>
- </constructor>
-
- <method name="valueFromPreference">
- <body>
- <![CDATA[
- let val = Preferences.get(this.pref, "").toString();
-
- if ("itemCount" in this.control) {
- for (let i = 0; i < this.control.itemCount; i++) {
- if (this.control.getItemAtIndex(i).value == val) {
- this.control.selectedIndex = i;
- break;
- }
- }
- } else {
- this.control.setAttribute("value", val);
- }
- ]]>
- </body>
- </method>
-
- <method name="valueToPreference">
- <body>
- <![CDATA[
- // We might not have a pref already set, so we guess the type from the value attribute
- let val = this.control.selectedItem.value;
- if (val == "true" || val == "false") {
- val = val == "true";
- } else if (/^-?\d+$/.test(val)) {
- val = parseInt(val, 10);
- }
- Preferences.set(this.pref, val);
- ]]>
- </body>
- </method>
-
- <field name="control">this.getElementsByTagName(this.getAttribute("type") == "radio" ? "radiogroup" : "menulist")[0];</field>
- </implementation>
- </binding>
-</bindings>
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -46,26 +46,24 @@ const GMP_PLUGINS = [
id: OPEN_H264_ID,
name: "openH264_name",
description: "openH264_description2",
// The following licenseURL is part of an awful hack to include the OpenH264
// license without having bug 624602 fixed yet, and intentionally ignores
// localisation.
licenseURL: "chrome://mozapps/content/extensions/OpenH264-license.txt",
homepageURL: "http://www.openh264.org/",
- optionsURL: "chrome://mozapps/content/extensions/gmpPrefs.xul",
},
{
id: WIDEVINE_ID,
name: "widevine_description",
// Describe the purpose of both CDMs in the same way.
description: "cdm_description",
licenseURL: "https://www.google.com/policies/privacy/",
homepageURL: "https://www.widevine.com/",
- optionsURL: "chrome://mozapps/content/extensions/gmpPrefs.xul",
isEME: true
}];
XPCOMUtils.defineConstant(this, "GMP_PLUGINS", GMP_PLUGINS);
XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
() => Services.strings.createBundle("chrome://global/locale/plugins.properties"));
XPCOMUtils.defineLazyGetter(this, "gmpService",
() => Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(Ci.mozIGeckoMediaPluginChromeService));
@@ -122,19 +120,16 @@ function GMPWrapper(aPluginInfo) {
GMPWrapper.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// An active task that checks for plugin updates and installs them.
_updateTask: null,
_gmpPath: null,
_isUpdateCheckPending: false,
- optionsType: AddonManager.OPTIONS_TYPE_INLINE,
- get optionsURL() { return this._plugin.optionsURL; },
-
set gmpPath(aPath) { this._gmpPath = aPath; },
get gmpPath() {
if (!this._gmpPath && this.isInstalled) {
this._gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
this._plugin.id,
GMPPrefs.getString(GMPPrefs.KEY_PLUGIN_VERSION,
null, this._plugin.id));
}
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -585,21 +585,19 @@ async function loadManifestFromRDF(aUri,
let mpcValue = getRDFProperty(ds, root, "multiprocessCompatible");
addon.multiprocessCompatible = mpcValue == "true";
addon.mpcOptedOut = mpcValue == "false";
addon.hasEmbeddedWebExtension = getRDFProperty(ds, root, "hasEmbeddedWebExtension") == "true";
if (addon.optionsType &&
- addon.optionsType != AddonManager.OPTIONS_TYPE_DIALOG &&
- addon.optionsType != AddonManager.OPTIONS_TYPE_INLINE &&
- addon.optionsType != AddonManager.OPTIONS_TYPE_TAB &&
- addon.optionsType != AddonManager.OPTIONS_TYPE_INLINE_INFO) {
- throw new Error("Install manifest specifies unknown type: " + addon.optionsType);
+ addon.optionsType != AddonManager.OPTIONS_INLINE_BROWSER &&
+ addon.optionsType != AddonManager.OPTIONS_TYPE_TAB) {
+ throw new Error("Install manifest specifies unknown optionsType: " + addon.optionsType);
}
if (addon.hasEmbeddedWebExtension) {
let uri = Services.io.newURI("webextension/manifest.json", null, aUri);
let embeddedAddon = await loadManifestFromWebManifest(uri);
if (embeddedAddon.optionsURL) {
if (addon.optionsType || addon.optionsURL)
logger.warn(`Addon ${addon.id} specifies optionsType or optionsURL ` +
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -5283,49 +5283,35 @@ AddonWrapper.prototype = {
return null;
}
let base = policy.getURL();
return new URL(addon.optionsURL, base).href;
}
return addon.optionsURL;
}
- if (this.hasResource("options.xul"))
- return this.getResourceURI("options.xul").spec;
-
return null;
},
get optionsType() {
if (!this.isActive)
return null;
let addon = addonFor(this);
- let hasOptionsXUL = this.hasResource("options.xul");
let hasOptionsURL = !!this.optionsURL;
if (addon.optionsType) {
switch (parseInt(addon.optionsType, 10)) {
- case AddonManager.OPTIONS_TYPE_DIALOG:
case AddonManager.OPTIONS_TYPE_TAB:
+ case AddonManager.OPTIONS_TYPE_INLINE_BROWSER:
return hasOptionsURL ? addon.optionsType : null;
- case AddonManager.OPTIONS_TYPE_INLINE:
- case AddonManager.OPTIONS_TYPE_INLINE_INFO:
- case AddonManager.OPTIONS_TYPE_INLINE_BROWSER:
- return (hasOptionsXUL || hasOptionsURL) ? addon.optionsType : null;
}
return null;
}
- if (hasOptionsXUL)
- return AddonManager.OPTIONS_TYPE_INLINE;
-
- if (hasOptionsURL)
- return AddonManager.OPTIONS_TYPE_DIALOG;
-
return null;
},
get optionsBrowserStyle() {
let addon = addonFor(this);
return addon.optionsBrowserStyle;
},
--- a/toolkit/mozapps/extensions/jar.mn
+++ b/toolkit/mozapps/extensions/jar.mn
@@ -20,16 +20,14 @@ toolkit.jar:
content/mozapps/extensions/update.js (content/update.js)
content/mozapps/extensions/update.css (content/update.css)
content/mozapps/extensions/eula.xul (content/eula.xul)
content/mozapps/extensions/eula.js (content/eula.js)
content/mozapps/extensions/newaddon.xul (content/newaddon.xul)
content/mozapps/extensions/newaddon.js (content/newaddon.js)
content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul)
content/mozapps/extensions/pluginPrefs.js (content/pluginPrefs.js)
- content/mozapps/extensions/gmpPrefs.xul (content/gmpPrefs.xul)
content/mozapps/extensions/OpenH264-license.txt (content/OpenH264-license.txt)
#endif
- content/mozapps/extensions/setting.xml (content/setting.xml)
content/mozapps/xpinstall/xpinstallConfirm.xul (content/xpinstallConfirm.xul)
content/mozapps/xpinstall/xpinstallConfirm.js (content/xpinstallConfirm.js)
content/mozapps/xpinstall/xpinstallConfirm.css (content/xpinstallConfirm.css)
content/mozapps/xpinstall/xpinstallItem.xml (content/xpinstallItem.xml)
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/bootstrap.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* exported startup, shutdown, install, uninstall */
-function install(params, aReason) {
-}
-function uninstall(params, aReason) {
-}
-function startup(params, aReason) {
-}
-function shutdown(params, aReason) {
-}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/chrome.manifest
+++ /dev/null
@@ -1,1 +0,0 @@
-locale inlinesettings en-US ./
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/install.rdf
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" ?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>inlinesettings1@tests.mozilla.org</em:id>
- <em:name>Inline Settings (Bootstrap)</em:name>
- <em:version>1</em:version>
- <em:bootstrap>true</em:bootstrap>
-
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>0.3</em:minVersion>
- <em:maxVersion>*</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <em:targetApplication>
- <Description>
- <em:id>toolkit@mozilla.org</em:id>
- <em:minVersion>0</em:minVersion>
- <em:maxVersion>*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-
-</RDF>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/options.xul
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-
-<!DOCTYPE vbox SYSTEM "chrome://inlinesettings/locale/settings.dtd">
-
-<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <setting pref="extensions.inlinesettings1.bool" type="bool" title="Bool" checkboxlabel="&checkbox;"/>
- <setting pref="extensions.inlinesettings1.boolint" type="boolint" on="1" off="2" title="BoolInt"/>
- <setting pref="extensions.inlinesettings1.integer" type="integer" title="Integer"/>
- <setting pref="extensions.inlinesettings1.string" type="string" title="String"/>
- <setting type="control" title="Menulist">
- <menulist sizetopopup="always" oncommand="window._testValue = this.value;">
- <menupopup>
- <menuitem label="Alpha" value="1" />
- <menuitem label="Bravo" value="2" />
- <menuitem label="Charlie" value="3" />
- </menupopup>
- </menulist>
- </setting>
- <setting pref="extensions.inlinesettings1.color" type="color" title="Color"/>
- <setting pref="extensions.inlinesettings1.file" type="file" title="File"/>
- <setting pref="extensions.inlinesettings1.directory" type="directory" title="Directory"/>
- <setting pref="extensions.inlinesettings1.integer-size" type="integer" title="Integer with size" size="1" />
-</vbox>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/settings.dtd
+++ /dev/null
@@ -1,1 +0,0 @@
-<!ENTITY checkbox "Check box label">
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/binding.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<bindings xmlns="http://www.mozilla.org/xbl"
- xmlns:xbl="http://www.mozilla.org/xbl"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <binding id="custom"
- extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
- <content>
- <xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label anonid="label" class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
- </xul:hbox>
- <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
- </xul:vbox>
- <xul:hbox class="preferences-alignment">
- <xul:label anonid="input" value="Woah!"/>
- </xul:hbox>
- </content>
- </binding>
-</bindings>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/bootstrap.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* exported startup, shutdown, install, uninstall */
-function install(params, aReason) {
-}
-function uninstall(params, aReason) {
-}
-function startup(params, aReason) {
-}
-function shutdown(params, aReason) {
-}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/chrome.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-content inlinesettings ./ contentaccessible=yes
-locale inlinesettings en-US ./
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/install.rdf
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" ?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>inlinesettings1@tests.mozilla.org</em:id>
- <em:name>Inline Settings (Bootstrap)</em:name>
- <em:version>2</em:version>
- <em:bootstrap>true</em:bootstrap>
-
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>0.3</em:minVersion>
- <em:maxVersion>*</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <em:targetApplication>
- <Description>
- <em:id>toolkit@mozilla.org</em:id>
- <em:minVersion>0</em:minVersion>
- <em:maxVersion>*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-
-</RDF>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/options.xul
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE vbox SYSTEM "chrome://inlinesettings/locale/string.dtd">
-<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <setting type="custom" title="&custom.title;" style="background-color: blue; display: -moz-grid-line; -moz-binding: url('chrome://inlinesettings/content/binding.xml#custom');"/>
-</vbox>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/string.dtd
+++ /dev/null
@@ -1,1 +0,0 @@
-<!ENTITY custom.title "Custom">
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_info/bootstrap.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* exported startup, shutdown, install, uninstall */
-function install(params, aReason) {
-}
-function uninstall(params, aReason) {
-}
-function startup(params, aReason) {
-}
-function shutdown(params, aReason) {
-}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_info/install.rdf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" ?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>inlinesettings1@tests.mozilla.org</em:id>
- <em:name>Inline Settings (Bootstrap)</em:name>
- <em:version>3</em:version>
- <em:bootstrap>true</em:bootstrap>
- <em:optionsType>4</em:optionsType>
-
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>0.3</em:minVersion>
- <em:maxVersion>*</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <em:targetApplication>
- <Description>
- <em:id>toolkit@mozilla.org</em:id>
- <em:minVersion>0</em:minVersion>
- <em:maxVersion>*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-
-</RDF>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_info/options.xul
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" ?>
-<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <setting pref="extensions.inlinesettings1.bool" type="bool" title="Bool" checkboxlabel="Check box label"/>
- <setting pref="extensions.inlinesettings1.boolint" type="boolint" on="1" off="2" title="BoolInt"/>
- <setting pref="extensions.inlinesettings1.integer" type="integer" title="Integer"/>
- <setting pref="extensions.inlinesettings1.string" type="string" title="String"/>
- <setting type="control" title="Menulist">
- <menulist sizetopopup="always" oncommand="window._testValue = this.value;">
- <menupopup>
- <menuitem label="Alpha" value="1" />
- <menuitem label="Bravo" value="2" />
- <menuitem label="Charlie" value="3" />
- </menupopup>
- </menulist>
- </setting>
- <setting pref="extensions.inlinesettings1.color" type="color" title="Color"/>
- <setting pref="extensions.inlinesettings1.file" type="file" title="File"/>
- <setting pref="extensions.inlinesettings1.directory" type="directory" title="Directory"/>
-</vbox>
--- a/toolkit/mozapps/extensions/test/browser/browser-common.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser-common.ini
@@ -24,17 +24,16 @@ skip-if = os == "linux" && !debug # Bug
[browser_bug591663.js]
[browser_bug593535.js]
skip-if = true # Bug 1093190 - Disabled due to leak
[browser_bug596336.js]
[browser_bug608316.js]
[browser_bug610764.js]
[browser_bug618502.js]
[browser_bug679604.js]
-[browser_bug714593.js]
[browser_bug590347.js]
[browser_details.js]
[browser_discovery.js]
[browser_dragdrop.js]
skip-if = buildapp == 'mulet'
[browser_dragdrop_incompat.js]
[browser_experiments.js]
[browser_list.js]
@@ -42,24 +41,18 @@ skip-if = buildapp == 'mulet'
[browser_sorting_plugins.js]
[browser_plugin_enabled_state_locked.js]
[browser_uninstalling.js]
[browser_recentupdates.js]
[browser_manualupdates.js]
[browser_globalwarnings.js]
[browser_updateid.js]
[browser_purchase.js]
-[browser_openDialog.js]
-tags = openwindow
-skip-if = os == 'win' # Disabled on Windows due to intermittent failures (bug 1135866)
[browser_types.js]
-[browser_inlinesettings.js]
[browser_inlinesettings_browser.js]
-[browser_inlinesettings_custom.js]
-[browser_inlinesettings_info.js]
[browser_tabsettings.js]
[browser_pluginprefs.js]
[browser_pluginprefs_is_not_disabled.js]
skip-if = buildapp == 'mulet'
[browser_CTP_plugins.js]
tags = blocklist
skip-if = buildapp == 'mulet'
[browser_webext_options.js]
--- a/toolkit/mozapps/extensions/test/browser/browser_bug562890.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug562890.js
@@ -41,38 +41,13 @@ function test() {
for (addonItem of addonList.childNodes) {
if (addonItem.hasAttribute("name") &&
addonItem.getAttribute("name") == "Test add-on 2")
break;
}
prefsBtn = aManager.document.getAnonymousElementByAttribute(addonItem,
"anonid",
"preferences-btn");
- is(prefsBtn.hidden, false, "Prefs button should be shown for addon with a optionsURL set");
+ is(prefsBtn.hidden, true, "Prefs button should not be shown for addon with just an optionsURL set");
- Services.ww.registerNotification(function TEST_ww_observer(aSubject, aTopic, aData) {
- if (aTopic == "domwindowclosed") {
- Services.ww.unregisterNotification(TEST_ww_observer);
- // Give the preference window a chance to finish closing before closing
- // the add-ons manager.
- executeSoon(function() {
- close_manager(aManager, finish);
- });
- } else if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
- win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
- win.addEventListener("load", function TEST_ww_onLoad() {
- if (win.location != addonPrefsURI)
- return;
-
- win.removeEventListener("load", TEST_ww_onLoad);
- is(win.location, addonPrefsURI,
- "The correct addon pref window should have opened");
- win.close();
- });
- }
- });
-
- addonList.ensureElementIsVisible(addonItem);
- EventUtils.synthesizeMouseAtCenter(prefsBtn, { }, aManager);
+ close_manager(aManager, finish);
});
-
}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_bug714593.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that installed addons in the search view load inline prefs properly
-
-const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
-const NO_MATCH_URL = TESTROOT + "browser_searching_empty.xml";
-
-var gManagerWindow;
-var gCategoryUtilities;
-var gProvider;
-
-function test() {
- // Turn on searching for this test
- Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
-
- waitForExplicitFinish();
-
- gProvider = new MockProvider();
-
- gProvider.createAddons([{
- id: "inlinesettings2@tests.mozilla.org",
- name: "Inline Settings (Regular)",
- version: "1",
- optionsURL: CHROMEROOT + "options.xul",
- optionsType: AddonManager.OPTIONS_TYPE_INLINE
- }]);
-
- open_manager("addons://list/extension", function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
- run_next_test();
- });
-}
-
-function end_test() {
- close_manager(gManagerWindow, finish);
-}
-
-/*
- * Checks whether or not the Add-ons Manager is currently searching
- *
- * @param aExpectedSearching
- * The expected isSearching state
- */
-function check_is_searching(aExpectedSearching) {
- var loading = gManagerWindow.document.getElementById("search-loading");
- is(!is_hidden(loading), aExpectedSearching,
- "Search throbber should be showing iff currently searching");
-}
-
-/*
- * Completes a search
- *
- * @param aQuery
- * The query to search for
- * @param aFinishImmediately
- * Boolean representing whether or not the search is expected to
- * finish immediately
- * @param aCallback
- * The callback to call when the search is done
- * @param aCategoryType
- * The expected selected category after the search is done.
- * Optional and defaults to "search"
- */
-function search(aQuery, aFinishImmediately, aCallback, aCategoryType) {
- // Point search to the correct xml test file
- Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, NO_MATCH_URL);
-
- aCategoryType = aCategoryType ? aCategoryType : "search";
-
- var searchBox = gManagerWindow.document.getElementById("header-search");
- searchBox.value = aQuery;
-
- EventUtils.synthesizeMouseAtCenter(searchBox, { }, gManagerWindow);
- EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
-
- var finishImmediately = true;
- wait_for_view_load(gManagerWindow, function() {
- is(gCategoryUtilities.selectedCategory, aCategoryType, "Expected category view should be selected");
- is(gCategoryUtilities.isTypeVisible("search"), aCategoryType == "search",
- "Search category should only be visible if it is the current view");
- is(finishImmediately, aFinishImmediately, "Search should finish immediately only if expected");
-
- aCallback();
- });
-
- finishImmediately = false;
- if (!aFinishImmediately)
- check_is_searching(true);
-}
-
-/*
- * Get item for a specific add-on by name
- *
- * @param aName
- * The name of the add-on to search for
- * @return Row of add-on if found, null otherwise
- */
-function get_addon_item(aName) {
- var id = aName + "@tests.mozilla.org";
- var list = gManagerWindow.document.getElementById("search-list");
- var rows = list.getElementsByTagName("richlistitem");
- for (let row of rows) {
- if (row.mAddon && row.mAddon.id == id)
- return row;
- }
-
- return null;
-}
-
-add_test(function() {
- search("settings", false, function() {
- var localFilter = gManagerWindow.document.getElementById("search-filter-local");
- EventUtils.synthesizeMouseAtCenter(localFilter, { }, gManagerWindow);
-
- var item = get_addon_item("inlinesettings2");
- // Force the XBL binding to apply.
- item.clientTop;
- var button = gManagerWindow.document.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- wait_for_view_load(gManagerWindow, function() {
- is(gManagerWindow.gViewController.currentViewObj, gManagerWindow.gDetailView, "View should have changed to detail");
-
- var searchCategory = gManagerWindow.document.getElementById("category-search");
- EventUtils.synthesizeMouseAtCenter(searchCategory, { }, gManagerWindow);
- wait_for_view_load(gManagerWindow, function() {
- is(gManagerWindow.gViewController.currentViewObj, gManagerWindow.gSearchView, "View should have changed back to search");
-
- // Reset filter to remote to avoid breaking later tests.
- var remoteFilter = gManagerWindow.document.getElementById("search-filter-remote");
- EventUtils.synthesizeMouseAtCenter(remoteFilter, { }, gManagerWindow);
- run_next_test();
- });
- });
- });
-});
--- a/toolkit/mozapps/extensions/test/browser/browser_details.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_details.js
@@ -1005,17 +1005,17 @@ add_test(function() {
is_element_hidden(get("detail-reviews"), "Reviews should be hidden");
is_element_hidden(get("detail-homepage-row"), "Homepage should be hidden");
is_element_hidden(get("detail-size"), "Size should be hidden");
is_element_hidden(get("detail-downloads"), "Downloads should be hidden");
- is_element_visible(get("detail-prefs-btn"), "Preferences button should be visible");
+ is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -41,25 +41,16 @@ MockGMPInstallManager.prototype = {
installAddon: addon => {
gInstalledAddonId = addon.id;
gInstallDeferred.resolve();
return Promise.resolve();
},
};
-var gOptionsObserver = {
- lastDisplayed: null,
- observe(aSubject, aTopic, aData) {
- if (aTopic == AddonManager.OPTIONS_NOTIFICATION_DISPLAYED) {
- this.lastDisplayed = aData;
- }
- }
-};
-
function openDetailsView(aId) {
let view = get_current_view(gManagerWindow);
Assert.equal(view.id, "list-view", "Should be in the list view to use this function");
let item = get_addon_element(gManagerWindow, aId);
Assert.ok(item, "Should have got add-on element.");
is_element_visible(item, "Add-on element should be visible.");
@@ -75,36 +66,32 @@ function openDetailsView(aId) {
add_task(async function initializeState() {
gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP, true);
gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL, 0);
gManagerWindow = await open_manager();
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
registerCleanupFunction(async function() {
- Services.obs.removeObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
-
for (let addon of gMockAddons) {
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VISIBLE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id));
}
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_UPDATE_LAST_CHECK);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_EME_ENABLED);
await GMPScope.GMPProvider.shutdown();
GMPScope.GMPProvider.startup();
});
- Services.obs.addObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
-
// Start out with plugins not being installed, disabled and automatic updates
// disabled.
gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
for (let addon of gMockAddons) {
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), false);
gPrefs.setIntPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id), 0);
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
gPrefs.setCharPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id), "");
@@ -296,22 +283,21 @@ add_task(async function testPreferencesB
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id),
preferences.enabled);
await gCategoryUtilities.openType("plugin");
let doc = gManagerWindow.document;
let item = get_addon_element(gManagerWindow, addon.id);
let button = doc.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
+ is_element_visible(button);
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
await new Promise(resolve => {
wait_for_view_load(gManagerWindow, resolve);
});
-
- is(gOptionsObserver.lastDisplayed, addon.id);
}
}
});
add_task(async function testUpdateButton() {
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_UPDATE_LAST_CHECK);
let originalInstallManager = GMPScope.GMPInstallManager;
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings.js
+++ /dev/null
@@ -1,697 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests various aspects of the details view
-
-var gManagerWindow;
-var gCategoryUtilities;
-var gProvider;
-
-const SETTINGS_ROWS = 9;
-
-var MockFilePicker = SpecialPowers.MockFilePicker;
-MockFilePicker.init(window);
-
-var observer = {
- lastDisplayed: null,
- callback: null,
- checkDisplayed(aExpected) {
- is(this.lastDisplayed, aExpected, "'addon-options-displayed' notification should have fired");
- this.lastDisplayed = null;
- },
- checkNotDisplayed() {
- is(this.lastDisplayed, null, "'addon-options-displayed' notification should not have fired");
- },
- lastHidden: null,
- checkHidden(aExpected) {
- is(this.lastHidden, aExpected, "'addon-options-hidden' notification should have fired");
- this.lastHidden = null;
- },
- checkNotHidden() {
- is(this.lastHidden, null, "'addon-options-hidden' notification should not have fired");
- },
- observe(aSubject, aTopic, aData) {
- if (aTopic == AddonManager.OPTIONS_NOTIFICATION_DISPLAYED) {
- this.lastDisplayed = aData;
- // Test if the binding has applied before the observers are notified. We test the second setting here,
- // because the code operates on the first setting and we want to check it applies to all.
- var setting = aSubject.querySelector("rows > setting[first-row] ~ setting");
- var input = gManagerWindow.document.getAnonymousElementByAttribute(setting, "class", "preferences-title");
- isnot(input, null, "XBL binding should be applied");
-
- // Add some extra height to the scrolling pane to ensure that it needs to scroll when appropriate.
- gManagerWindow.document.getElementById("detail-controls").style.marginBottom = "1000px";
-
- if (this.callback) {
- var tempCallback = this.callback;
- this.callback = null;
- tempCallback();
- }
- } else if (aTopic == AddonManager.OPTIONS_NOTIFICATION_HIDDEN) {
- this.lastHidden = aData;
- }
- }
-};
-
-function installAddon(aCallback) {
- AddonManager.getInstallForURL(TESTROOT + "addons/browser_inlinesettings1.xpi",
- function(aInstall) {
- aInstall.addListener({
- onInstallEnded() {
- executeSoon(aCallback);
- }
- });
- aInstall.install();
- }, "application/x-xpinstall");
-}
-
-function checkScrolling(aShouldHaveScrolled) {
- var detailView = gManagerWindow.document.getElementById("detail-view");
- var boxObject = detailView.boxObject;
- ok(detailView.scrollHeight > boxObject.height, "Page should require scrolling");
- if (aShouldHaveScrolled)
- isnot(detailView.scrollTop, 0, "Page should have scrolled");
- else
- is(detailView.scrollTop, 0, "Page should not have scrolled");
-}
-
-function test() {
- waitForExplicitFinish();
-
- gProvider = new MockProvider();
-
- gProvider.createAddons([{
- id: "inlinesettings2@tests.mozilla.org",
- name: "Inline Settings (Regular)",
- version: "1",
- optionsURL: CHROMEROOT + "options.xul",
- optionsType: AddonManager.OPTIONS_TYPE_INLINE,
- operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_DISABLE,
- }, {
- id: "inlinesettings3@tests.mozilla.org",
- name: "Inline Settings (More Options)",
- description: "Tests for option types introduced after Mozilla 7.0",
- version: "1",
- optionsURL: CHROMEROOT + "more_options.xul",
- optionsType: AddonManager.OPTIONS_TYPE_INLINE
- }, {
- id: "noninlinesettings@tests.mozilla.org",
- name: "Non-Inline Settings",
- version: "1",
- optionsURL: CHROMEROOT + "addon_prefs.xul"
- }]);
-
- installAddon(function() {
- open_manager("addons://list/extension", function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- Services.obs.addObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
- Services.obs.addObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_HIDDEN);
-
- run_next_test();
- });
- });
-}
-
-function end_test() {
- Services.obs.removeObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
-
- Services.prefs.clearUserPref("extensions.inlinesettings1.bool");
- Services.prefs.clearUserPref("extensions.inlinesettings1.boolint");
- Services.prefs.clearUserPref("extensions.inlinesettings1.integer");
- Services.prefs.clearUserPref("extensions.inlinesettings1.string");
- Services.prefs.clearUserPref("extensions.inlinesettings1.color");
- Services.prefs.clearUserPref("extensions.inlinesettings1.file");
- Services.prefs.clearUserPref("extensions.inlinesettings1.directory");
- Services.prefs.clearUserPref("extensions.inlinesettings3.radioBool");
- Services.prefs.clearUserPref("extensions.inlinesettings3.radioInt");
- Services.prefs.clearUserPref("extensions.inlinesettings3.radioString");
- Services.prefs.clearUserPref("extensions.inlinesettings3.menulist");
-
- MockFilePicker.cleanup();
-
- close_manager(gManagerWindow, function() {
- observer.checkHidden("inlinesettings3@tests.mozilla.org");
- Services.obs.removeObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_HIDDEN);
-
- AddonManager.getAddonByID("inlinesettings1@tests.mozilla.org", function(aAddon) {
- aAddon.uninstall();
- finish();
- });
- });
-}
-
-// Addon with options.xul
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE, "Options should be inline type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- run_next_test();
-});
-
-// Addon with inline preferences as optionsURL
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings2@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE, "Options should be inline type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- run_next_test();
-});
-
-// Addon with non-inline preferences as optionsURL
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "noninlinesettings@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_DIALOG, "Options should be dialog type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- run_next_test();
-});
-
-// Addon with options.xul, also a test for the setting.xml bindings
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
- is(gManagerWindow.gViewController.currentViewId,
- "addons://detail/inlinesettings1%40tests.mozilla.org/preferences",
- "Current view should scroll to preferences");
- checkScrolling(true);
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, SETTINGS_ROWS, "Grid should have settings children");
-
- ok(settings[0].hasAttribute("first-row"), "First visible row should have first-row attribute");
- Services.prefs.setBoolPref("extensions.inlinesettings1.bool", false);
- var input = gManagerWindow.document.getAnonymousElementByAttribute(settings[0], "anonid", "input");
- isnot(input.checked, true, "Checkbox should have initial value");
- is(input.label, "Check box label", "Checkbox should be labelled");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- is(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getBoolPref("extensions.inlinesettings1.bool"), true, "Bool pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- isnot(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getBoolPref("extensions.inlinesettings1.bool"), false, "Bool pref should have been updated");
-
- ok(!settings[1].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings1.boolint", 0);
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[1], "anonid", "input");
- isnot(input.checked, true, "Checkbox should have initial value");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- is(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.boolint"), 1, "BoolInt pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- isnot(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.boolint"), 2, "BoolInt pref should have been updated");
-
- ok(!settings[2].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings1.integer", 0);
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[2], "anonid", "input");
- is(input.value, "0", "Number box should have initial value");
- input.select();
- EventUtils.synthesizeKey("1", {}, gManagerWindow);
- EventUtils.synthesizeKey("3", {}, gManagerWindow);
- is(input.value, "13", "Number box should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.integer"), 13, "Integer pref should have been updated");
- EventUtils.synthesizeKey("VK_DOWN", {}, gManagerWindow);
- is(input.value, "12", "Number box should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.integer"), 12, "Integer pref should have been updated");
-
- ok(!settings[3].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setCharPref("extensions.inlinesettings1.string", "foo");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[3], "anonid", "input");
- is(input.value, "foo", "Text box should have initial value");
- input.select();
- EventUtils.synthesizeKey("b", {}, gManagerWindow);
- EventUtils.synthesizeKey("a", {}, gManagerWindow);
- EventUtils.synthesizeKey("r", {}, gManagerWindow);
- is(input.value, "bar", "Text box should have updated value");
- input.value += "\u03DE"; // Cheat to add this non-ASCII character without typing it.
- EventUtils.synthesizeKey("/", {}, gManagerWindow);
- is(input.value, "bar\u03DE/", "Text box should have updated value");
- is(gManagerWindow.document.getBindingParent(gManagerWindow.document.activeElement), input, "Search box should not have focus");
- is(Services.prefs.getStringPref("extensions.inlinesettings1.string", "wrong"), "bar\u03DE/", "String pref should have been updated");
-
- ok(!settings[4].hasAttribute("first-row"), "Not the first row");
- input = settings[4].firstElementChild;
- is(input.value, "1", "Menulist should have initial value");
- input.focus();
- EventUtils.synthesizeKey("b", {}, gManagerWindow);
- is(input.value, "2", "Menulist should have updated value");
- is(gManagerWindow._testValue, "2", "Menulist oncommand handler should've updated the test value");
- delete gManagerWindow._testValue;
-
- ok(!settings[5].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setCharPref("extensions.inlinesettings1.color", "#FF0000");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[5], "anonid", "input");
- is(input.color, "#FF0000", "Color picker should have initial value");
- input.focus();
- EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
- EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
- EventUtils.synthesizeKey("VK_RETURN", {}, gManagerWindow);
- input.hidePopup();
- is(input.color, "#FF9900", "Color picker should have updated value");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.color"), "#FF9900", "Color pref should have been updated");
-
- ok(!settings[6].hasAttribute("first-row"), "Not the first row");
- var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
- is(input.value, "", "Label value should be empty");
- is(input.tooltipText, "", "Label tooltip should be empty");
-
- var testFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
- testFile.append("\u2622");
- var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
-
- MockFilePicker.setFiles([testFile]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-
- let promise = new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
-
- promise.then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
- is(input.value, testFile.path, "Label value should match file chosen");
- is(input.tooltipText, testFile.path, "Label tooltip should match file chosen");
- is(Services.prefs.getStringPref("extensions.inlinesettings1.file", "wrong"), testFile.path, "File pref should match file chosen");
-
- MockFilePicker.setFiles([curProcD]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-
- return new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
- }).then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
- is(input.value, testFile.path, "Label value should not have changed");
- is(input.tooltipText, testFile.path, "Label tooltip should not have changed");
- is(Services.prefs.getStringPref("extensions.inlinesettings1.file", "wrong"), testFile.path, "File pref should not have changed");
-
- ok(!settings[7].hasAttribute("first-row"), "Not the first row");
- button = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "button");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input");
- is(input.value, "", "Label value should be empty");
- is(input.tooltipText, "", "Label tooltip should be empty");
-
- MockFilePicker.setFiles([testFile]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-
- return new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
- }).then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
- is(input.value, testFile.path, "Label value should match file chosen");
- is(input.tooltipText, testFile.path, "Label tooltip should match file chosen");
- is(Services.prefs.getStringPref("extensions.inlinesettings1.directory", "wrong"), testFile.path, "Directory pref should match file chosen");
-
- MockFilePicker.setFiles([curProcD]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-
- return new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
- }).then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
- is(input.value, testFile.path, "Label value should not have changed");
- is(input.tooltipText, testFile.path, "Label tooltip should not have changed");
- is(Services.prefs.getStringPref("extensions.inlinesettings1.directory", "wrong"), testFile.path, "Directory pref should not have changed");
-
- var unsizedInput = gManagerWindow.document.getAnonymousElementByAttribute(settings[2], "anonid", "input");
- var sizedInput = gManagerWindow.document.getAnonymousElementByAttribute(settings[8], "anonid", "input");
- is(unsizedInput.clientWidth > sizedInput.clientWidth, true, "Input with size attribute should be smaller than input without");
- }).then(() => {
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
- });
-});
-
-// Tests for the setting.xml bindings introduced after Mozilla 7
-add_test(function() {
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings3@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings3@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 4, "Grid should have settings children");
-
- ok(settings[0].hasAttribute("first-row"), "First visible row should have first-row attribute");
- Services.prefs.setBoolPref("extensions.inlinesettings3.radioBool", false);
- var radios = settings[0].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
- EventUtils.synthesizeMouseAtCenter(radios[0], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getBoolPref("extensions.inlinesettings3.radioBool"), true, "Radio pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(radios[1], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getBoolPref("extensions.inlinesettings3.radioBool"), false, "Radio pref should have been updated");
-
- ok(!settings[1].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings3.radioInt", 5);
- radios = settings[1].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
- isnot(radios[2].selected, true, "Correct radio button should be selected");
- EventUtils.synthesizeMouseAtCenter(radios[0], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getIntPref("extensions.inlinesettings3.radioInt"), 4, "Radio pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(radios[2], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getIntPref("extensions.inlinesettings3.radioInt"), 6, "Radio pref should have been updated");
-
- ok(!settings[2].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setCharPref("extensions.inlinesettings3.radioString", "juliet");
- radios = settings[2].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
- isnot(radios[2].selected, true, "Correct radio button should be selected");
- EventUtils.synthesizeMouseAtCenter(radios[0], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getStringPref("extensions.inlinesettings3.radioString", "wrong"), "india", "Radio pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(radios[2], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getStringPref("extensions.inlinesettings3.radioString", "wrong"), "kilo \u338F", "Radio pref should have been updated");
-
- ok(!settings[3].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings3.menulist", 8);
- var input = settings[3].firstElementChild;
- is(input.value, "8", "Menulist should have initial value");
- input.focus();
- EventUtils.synthesizeKey("n", {}, gManagerWindow);
- is(input.value, "9", "Menulist should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings3.menulist"), 9, "Menulist pref should have been updated");
-
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Addon with inline preferences as optionsURL
-add_test(function() {
- observer.checkHidden("inlinesettings3@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings2@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings2@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 5, "Grid should have settings children");
-
- var node = settings[0];
- node = settings[0];
- is_element_hidden(node, "Unsupported settings should not be visible");
- ok(!node.hasAttribute("first-row"), "Hidden row is not the first row");
-
- node = settings[1];
- is(node.nodeName, "setting", "Should be a setting node");
- ok(node.hasAttribute("first-row"), "First visible row should have first-row attribute");
- var description = gManagerWindow.document.getAnonymousElementByAttribute(node, "class", "preferences-description");
- is(description.textContent, "Description Attribute", "Description node should contain description");
-
- node = settings[2];
- is(node.nodeName, "setting", "Should be a setting node");
- ok(!node.hasAttribute("first-row"), "Not the first row");
- description = gManagerWindow.document.getAnonymousElementByAttribute(node, "class", "preferences-description");
- is(description.textContent, "Description Text Node", "Description node should contain description");
-
- node = settings[3];
- is(node.nodeName, "setting", "Should be a setting node");
- ok(!node.hasAttribute("first-row"), "Not the first row");
- description = gManagerWindow.document.getAnonymousElementByAttribute(node, "class", "preferences-description");
- is(description.textContent, "This is a test, all this text should be visible", "Description node should contain description");
- var button = node.firstElementChild;
- isnot(button, null, "There should be a button");
-
- node = settings[4];
- is_element_hidden(node, "Unsupported settings should not be visible");
- ok(!node.hasAttribute("first-row"), "Hidden row is not the first row");
-
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Addon with non-inline preferences as optionsURL
-add_test(function() {
- observer.checkHidden("inlinesettings2@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "noninlinesettings@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkNotDisplayed();
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 0, "Grid should not have settings children");
-
- var button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Addon with options.xul, disabling and enabling should hide and show settings UI
-add_test(function() {
- observer.checkNotHidden();
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
- is(gManagerWindow.gViewController.currentViewId,
- "addons://detail/inlinesettings1%40tests.mozilla.org",
- "Current view should not scroll to preferences");
- checkScrolling(false);
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, SETTINGS_ROWS, "Grid should have settings children");
-
- // disable
- var button = gManagerWindow.document.getElementById("detail-disable-btn");
- button.scrollIntoView();
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 0, "Grid should not have settings children");
-
- gCategoryUtilities.openType("extension", function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 0, "Grid should not have settings children");
-
- // enable
- var button = gManagerWindow.document.getElementById("detail-enable-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- observer.callback = function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
-
- settings = grid.querySelectorAll("rows > setting");
- is(settings.length, SETTINGS_ROWS, "Grid should have settings children");
-
- gCategoryUtilities.openType("extension", run_next_test);
- };
- });
- });
- });
-});
-
-
-// Addon with options.xul that requires a restart to disable,
-// disabling and enabling should not hide and show settings UI.
-add_test(function() {
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings2@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings2@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- ok(settings.length > 0, "Grid should have settings children");
-
- // disable
- var button = gManagerWindow.document.getElementById("detail-disable-btn");
- button.scrollIntoView();
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- observer.checkNotHidden();
-
- settings = grid.querySelectorAll("rows > setting");
- ok(settings.length > 0, "Grid should still have settings children");
-
- // cancel pending disable
- button = gManagerWindow.document.getElementById("detail-enable-btn");
- button.scrollIntoView();
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- observer.checkNotDisplayed();
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Tests bindings with existing prefs.
-add_test(function() {
- observer.checkHidden("inlinesettings2@tests.mozilla.org");
-
- // Ensure these prefs are set. They should be set above, but somebody might
- // change the tests above.
- var profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
- Services.prefs.setBoolPref("extensions.inlinesettings1.bool", false);
- Services.prefs.setIntPref("extensions.inlinesettings1.boolint", 1);
- Services.prefs.setIntPref("extensions.inlinesettings1.integer", 12);
- Services.prefs.setStringPref("extensions.inlinesettings1.string", "bar\u03DE/");
- Services.prefs.setCharPref("extensions.inlinesettings1.color", "#FF9900");
- Services.prefs.setCharPref("extensions.inlinesettings1.file", profD.path);
- Services.prefs.setCharPref("extensions.inlinesettings1.directory", profD.path);
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
-
- var input = gManagerWindow.document.getAnonymousElementByAttribute(settings[0], "anonid", "input");
- is(input.checked, false, "Checkbox should have initial value");
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[1], "anonid", "input");
- is(input.checked, true, "Checkbox should have initial value");
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[2], "anonid", "input");
- is(input.value, "12", "Number box should have initial value");
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[3], "anonid", "input");
- is(input.value, "bar\u03DE/", "Text box should have initial value");
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[5], "anonid", "input");
- is(input.color, "#FF9900", "Color picker should have initial value");
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
- is(input.value, profD.path, "Label should have initial value");
- is(input.tooltipText, profD.path, "Label tooltip should have initial value");
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input");
- is(input.value, profD.path, "Label value should have initial value");
- is(input.tooltipText, profD.path, "Label tooltip should have initial value");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Tests bindings with existing prefs.
-add_test(function() {
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- // Ensure these prefs are set. They should be set above, but somebody might
- // change the tests above.
- Services.prefs.setBoolPref("extensions.inlinesettings3.radioBool", false);
- Services.prefs.setIntPref("extensions.inlinesettings3.radioInt", 6);
- Services.prefs.setStringPref("extensions.inlinesettings3.radioString", "kilo \u338F");
- Services.prefs.setIntPref("extensions.inlinesettings3.menulist", 9);
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings3@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings3@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
-
- var radios = settings[0].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
-
- radios = settings[1].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- isnot(radios[1].selected, true, "Correct radio button should be selected");
- is(radios[2].selected, true, "Correct radio button should be selected");
-
- radios = settings[2].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- isnot(radios[1].selected, true, "Correct radio button should be selected");
- is(radios[2].selected, true, "Correct radio button should be selected");
-
- var input = settings[3].firstElementChild;
- is(input.value, "9", "Menulist should have initial value");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings_custom.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests various aspects of the details view
-
-var gManagerWindow;
-var gCategoryUtilities;
-
-function installAddon(aCallback) {
- AddonManager.getInstallForURL(TESTROOT + "addons/browser_inlinesettings1_custom.xpi",
- function(aInstall) {
- aInstall.addListener({
- onInstallEnded() {
- executeSoon(aCallback);
- }
- });
- aInstall.install();
- }, "application/x-xpinstall");
-}
-
-function test() {
- waitForExplicitFinish();
-
- installAddon(function() {
- open_manager("addons://list/extension", function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- run_next_test();
- });
- });
-}
-
-function end_test() {
- close_manager(gManagerWindow, function() {
- AddonManager.getAddonByID("inlinesettings1@tests.mozilla.org", function(aAddon) {
- aAddon.uninstall();
- finish();
- });
- });
-}
-
-// Addon with options.xul, with custom <setting> binding
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE, "Options should be inline type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- run_next_test();
-});
-
-// Addon with options.xul, also a test for the setting.xml bindings
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- is(gManagerWindow.gViewController.currentViewId,
- "addons://detail/inlinesettings1%40tests.mozilla.org/preferences",
- "Current view should scroll to preferences");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 1, "Grid should have settings children");
-
- ok(settings[0].hasAttribute("first-row"), "First visible row should have first-row attribute");
-
- var style = window.getComputedStyle(settings[0]);
- is(style.getPropertyValue("background-color"), "rgb(0, 0, 255)", "Background color should be set");
- is(style.getPropertyValue("display"), "-moz-grid-line", "Display should be set");
- is(style.getPropertyValue("-moz-binding"), 'url("chrome://inlinesettings/content/binding.xml#custom")', "Binding should be set");
-
- var label = gManagerWindow.document.getAnonymousElementByAttribute(settings[0], "anonid", "label");
- is(label.textContent, "Custom", "Localized string should be shown");
-
- var input = gManagerWindow.document.getAnonymousElementByAttribute(settings[0], "anonid", "input");
- isnot(input, null, "Binding should be applied");
- is(input.value, "Woah!", "Binding should be applied");
-
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings_info.js
+++ /dev/null
@@ -1,590 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests various aspects of the details view
-
-var gManagerWindow;
-var gCategoryUtilities;
-var gProvider;
-
-const SETTINGS_ROWS = 8;
-
-var MockFilePicker = SpecialPowers.MockFilePicker;
-MockFilePicker.init(window);
-
-var observer = {
- lastDisplayed: null,
- callback: null,
- checkDisplayed(aExpected) {
- is(this.lastDisplayed, aExpected, "'addon-options-displayed' notification should have fired");
- this.lastDisplayed = null;
- },
- checkNotDisplayed() {
- is(this.lastDisplayed, null, "'addon-options-displayed' notification should not have fired");
- },
- lastHidden: null,
- checkHidden(aExpected) {
- is(this.lastHidden, aExpected, "'addon-options-hidden' notification should have fired");
- this.lastHidden = null;
- },
- checkNotHidden() {
- is(this.lastHidden, null, "'addon-options-hidden' notification should not have fired");
- },
- observe(aSubject, aTopic, aData) {
- if (aTopic == AddonManager.OPTIONS_NOTIFICATION_DISPLAYED) {
- this.lastDisplayed = aData;
- // Test if the binding has applied before the observers are notified. We test the second setting here,
- // because the code operates on the first setting and we want to check it applies to all.
- var setting = aSubject.querySelector("rows > setting[first-row] ~ setting");
- var input = gManagerWindow.document.getAnonymousElementByAttribute(setting, "class", "preferences-title");
- isnot(input, null, "XBL binding should be applied");
-
- // Add some extra height to the scrolling pane to ensure that it needs to scroll when appropriate.
- gManagerWindow.document.getElementById("detail-controls").style.marginBottom = "1000px";
-
- if (this.callback) {
- var tempCallback = this.callback;
- this.callback = null;
- tempCallback();
- }
- } else if (aTopic == AddonManager.OPTIONS_NOTIFICATION_HIDDEN) {
- this.lastHidden = aData;
- }
- }
-};
-
-function installAddon(aCallback) {
- AddonManager.getInstallForURL(TESTROOT + "addons/browser_inlinesettings1_info.xpi",
- function(aInstall) {
- aInstall.addListener({
- onInstallEnded() {
- executeSoon(aCallback);
- }
- });
- aInstall.install();
- }, "application/x-xpinstall");
-}
-
-function checkScrolling(aShouldHaveScrolled) {
- var detailView = gManagerWindow.document.getElementById("detail-view");
- var boxObject = detailView.boxObject;
- ok(detailView.scrollHeight > boxObject.height, "Page should require scrolling");
- if (aShouldHaveScrolled)
- isnot(detailView.scrollTop, 0, "Page should have scrolled");
- else
- is(detailView.scrollTop, 0, "Page should not have scrolled");
-}
-
-function test() {
- waitForExplicitFinish();
-
- gProvider = new MockProvider();
-
- gProvider.createAddons([{
- id: "inlinesettings2@tests.mozilla.org",
- name: "Inline Settings (Regular)",
- version: "1",
- optionsURL: CHROMEROOT + "options.xul",
- optionsType: AddonManager.OPTIONS_TYPE_INLINE_INFO,
- operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_DISABLE,
- }, {
- id: "inlinesettings3@tests.mozilla.org",
- name: "Inline Settings (More Options)",
- description: "Tests for option types introduced after Mozilla 7.0",
- version: "1",
- optionsURL: CHROMEROOT + "more_options.xul",
- optionsType: AddonManager.OPTIONS_TYPE_INLINE_INFO
- }, {
- id: "noninlinesettings@tests.mozilla.org",
- name: "Non-Inline Settings",
- version: "1",
- optionsURL: CHROMEROOT + "addon_prefs.xul"
- }]);
-
- installAddon(function() {
- open_manager("addons://list/extension", function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- Services.obs.addObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
- Services.obs.addObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_HIDDEN);
-
- run_next_test();
- });
- });
-}
-
-function end_test() {
- Services.obs.removeObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
-
- Services.prefs.clearUserPref("extensions.inlinesettings1.bool");
- Services.prefs.clearUserPref("extensions.inlinesettings1.boolint");
- Services.prefs.clearUserPref("extensions.inlinesettings1.integer");
- Services.prefs.clearUserPref("extensions.inlinesettings1.string");
- Services.prefs.clearUserPref("extensions.inlinesettings1.color");
- Services.prefs.clearUserPref("extensions.inlinesettings1.file");
- Services.prefs.clearUserPref("extensions.inlinesettings1.directory");
- Services.prefs.clearUserPref("extensions.inlinesettings3.radioBool");
- Services.prefs.clearUserPref("extensions.inlinesettings3.radioInt");
- Services.prefs.clearUserPref("extensions.inlinesettings3.radioString");
- Services.prefs.clearUserPref("extensions.inlinesettings3.menulist");
-
- MockFilePicker.cleanup();
-
- close_manager(gManagerWindow, function() {
- observer.checkHidden("inlinesettings2@tests.mozilla.org");
- Services.obs.removeObserver(observer,
- AddonManager.OPTIONS_NOTIFICATION_HIDDEN);
-
- AddonManager.getAddonByID("inlinesettings1@tests.mozilla.org", function(aAddon) {
- aAddon.uninstall();
- finish();
- });
- });
-}
-
-// Addon with options.xul
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO, "Options should be inline info type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_hidden(button, "Preferences button should be hidden");
-
- run_next_test();
-});
-
-// Addon with inline preferences as optionsURL
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings2@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO, "Options should be inline info type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_hidden(button, "Preferences button should be hidden");
-
- run_next_test();
-});
-
-// Addon with non-inline preferences as optionsURL
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "noninlinesettings@tests.mozilla.org");
- is(addon.mAddon.optionsType, AddonManager.OPTIONS_TYPE_DIALOG, "Options should be dialog type");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- run_next_test();
-});
-
-// Addon with options.xul, also a test for the setting.xml bindings
-add_test(function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, SETTINGS_ROWS, "Grid should have settings children");
-
- ok(settings[0].hasAttribute("first-row"), "First visible row should have first-row attribute");
- Services.prefs.setBoolPref("extensions.inlinesettings1.bool", false);
- var input = gManagerWindow.document.getAnonymousElementByAttribute(settings[0], "anonid", "input");
- isnot(input.checked, true, "Checkbox should have initial value");
- is(input.label, "Check box label", "Checkbox should be labelled");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- is(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getBoolPref("extensions.inlinesettings1.bool"), true, "Bool pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- isnot(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getBoolPref("extensions.inlinesettings1.bool"), false, "Bool pref should have been updated");
-
- ok(!settings[1].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings1.boolint", 0);
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[1], "anonid", "input");
- isnot(input.checked, true, "Checkbox should have initial value");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- is(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.boolint"), 1, "BoolInt pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(input, { clickCount: 1 }, gManagerWindow);
- isnot(input.checked, true, "Checkbox should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.boolint"), 2, "BoolInt pref should have been updated");
-
- ok(!settings[2].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings1.integer", 0);
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[2], "anonid", "input");
- is(input.value, "0", "Number box should have initial value");
- input.select();
- EventUtils.synthesizeKey("1", {}, gManagerWindow);
- EventUtils.synthesizeKey("3", {}, gManagerWindow);
- is(input.value, "13", "Number box should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.integer"), 13, "Integer pref should have been updated");
- EventUtils.synthesizeKey("VK_DOWN", {}, gManagerWindow);
- is(input.value, "12", "Number box should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings1.integer"), 12, "Integer pref should have been updated");
-
- ok(!settings[3].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setCharPref("extensions.inlinesettings1.string", "foo");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[3], "anonid", "input");
- is(input.value, "foo", "Text box should have initial value");
- input.select();
- EventUtils.synthesizeKey("b", {}, gManagerWindow);
- EventUtils.synthesizeKey("a", {}, gManagerWindow);
- EventUtils.synthesizeKey("r", {}, gManagerWindow);
- is(input.value, "bar", "Text box should have updated value");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.string"), "bar", "String pref should have been updated");
-
- ok(!settings[4].hasAttribute("first-row"), "Not the first row");
- input = settings[4].firstElementChild;
- is(input.value, "1", "Menulist should have initial value");
- input.focus();
- EventUtils.synthesizeKey("b", {}, gManagerWindow);
- is(input.value, "2", "Menulist should have updated value");
- is(gManagerWindow._testValue, "2", "Menulist oncommand handler should've updated the test value");
- delete gManagerWindow._testValue;
-
- ok(!settings[5].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setCharPref("extensions.inlinesettings1.color", "#FF0000");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[5], "anonid", "input");
- is(input.color, "#FF0000", "Color picker should have initial value");
- input.focus();
- EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
- EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
- EventUtils.synthesizeKey("VK_RETURN", {}, gManagerWindow);
- input.hidePopup();
- is(input.color, "#FF9900", "Color picker should have updated value");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.color"), "#FF9900", "Color pref should have been updated");
-
- ok(!settings[6].hasAttribute("first-row"), "Not the first row");
- var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
-
- // Workaround for bug 1155324 - we need to ensure that the button is scrolled into view.
- button.scrollIntoView();
-
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
- is(input.value, "", "Label value should be empty");
- is(input.tooltipText, "", "Label tooltip should be empty");
-
- var profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
- var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
-
- MockFilePicker.setFiles([profD]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-
- let promise = new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
-
- promise.then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
- is(input.value, profD.path, "Label value should match file chosen");
- is(input.tooltipText, profD.path, "Label tooltip should match file chosen");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should match file chosen");
-
- MockFilePicker.setFiles([curProcD]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-
- return promise = new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
- }).then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
- is(input.value, profD.path, "Label value should not have changed");
- is(input.tooltipText, profD.path, "Label tooltip should not have changed");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should not have changed");
-
- ok(!settings[7].hasAttribute("first-row"), "Not the first row");
- button = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "button");
- input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input");
- is(input.value, "", "Label value should be empty");
- is(input.tooltipText, "", "Label tooltip should be empty");
-
- MockFilePicker.setFiles([profD]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-
- return new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
- }).then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
- is(input.value, profD.path, "Label value should match file chosen");
- is(input.tooltipText, profD.path, "Label tooltip should match file chosen");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should match file chosen");
-
- MockFilePicker.setFiles([curProcD]);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-
- return new Promise(resolve => {
- MockFilePicker.afterOpenCallback = resolve;
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- });
- }).then(() => {
- is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
- is(input.value, profD.path, "Label value should not have changed");
- is(input.tooltipText, profD.path, "Label tooltip should not have changed");
- is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should not have changed");
- }).then(() => {
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
- });
-});
-
-// Tests for the setting.xml bindings introduced after Mozilla 7
-add_test(function() {
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings3@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings3@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 4, "Grid should have settings children");
-
- ok(settings[0].hasAttribute("first-row"), "First visible row should have first-row attribute");
- Services.prefs.setBoolPref("extensions.inlinesettings3.radioBool", false);
- var radios = settings[0].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
- EventUtils.synthesizeMouseAtCenter(radios[0], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getBoolPref("extensions.inlinesettings3.radioBool"), true, "Radio pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(radios[1], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getBoolPref("extensions.inlinesettings3.radioBool"), false, "Radio pref should have been updated");
-
- ok(!settings[1].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings3.radioInt", 5);
- radios = settings[1].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
- isnot(radios[2].selected, true, "Correct radio button should be selected");
- EventUtils.synthesizeMouseAtCenter(radios[0], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getIntPref("extensions.inlinesettings3.radioInt"), 4, "Radio pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(radios[2], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getIntPref("extensions.inlinesettings3.radioInt"), 6, "Radio pref should have been updated");
-
- ok(!settings[2].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setCharPref("extensions.inlinesettings3.radioString", "juliet");
- radios = settings[2].getElementsByTagName("radio");
- isnot(radios[0].selected, true, "Correct radio button should be selected");
- is(radios[1].selected, true, "Correct radio button should be selected");
- isnot(radios[2].selected, true, "Correct radio button should be selected");
- EventUtils.synthesizeMouseAtCenter(radios[0], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getCharPref("extensions.inlinesettings3.radioString"), "india", "Radio pref should have been updated");
- EventUtils.synthesizeMouseAtCenter(radios[2], { clickCount: 1 }, gManagerWindow);
- is(Services.prefs.getStringPref("extensions.inlinesettings3.radioString", "wrong"), "kilo \u338F", "Radio pref should have been updated");
-
- ok(!settings[3].hasAttribute("first-row"), "Not the first row");
- Services.prefs.setIntPref("extensions.inlinesettings3.menulist", 8);
- var input = settings[3].firstElementChild;
- is(input.value, "8", "Menulist should have initial value");
- input.focus();
- EventUtils.synthesizeKey("n", {}, gManagerWindow);
- is(input.value, "9", "Menulist should have updated value");
- is(Services.prefs.getIntPref("extensions.inlinesettings3.menulist"), 9, "Menulist pref should have been updated");
-
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Addon with inline preferences as optionsURL
-add_test(function() {
- observer.checkHidden("inlinesettings3@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings2@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings2@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 5, "Grid should have settings children");
-
- var node = settings[0];
- node = settings[0];
- is_element_hidden(node, "Unsupported settings should not be visible");
- ok(!node.hasAttribute("first-row"), "Hidden row is not the first row");
-
- node = settings[1];
- is(node.nodeName, "setting", "Should be a setting node");
- ok(node.hasAttribute("first-row"), "First visible row should have first-row attribute");
- var description = gManagerWindow.document.getAnonymousElementByAttribute(node, "class", "preferences-description");
- is(description.textContent, "Description Attribute", "Description node should contain description");
-
- node = settings[2];
- is(node.nodeName, "setting", "Should be a setting node");
- ok(!node.hasAttribute("first-row"), "Not the first row");
- description = gManagerWindow.document.getAnonymousElementByAttribute(node, "class", "preferences-description");
- is(description.textContent, "Description Text Node", "Description node should contain description");
-
- node = settings[3];
- is(node.nodeName, "setting", "Should be a setting node");
- ok(!node.hasAttribute("first-row"), "Not the first row");
- description = gManagerWindow.document.getAnonymousElementByAttribute(node, "class", "preferences-description");
- is(description.textContent, "This is a test, all this text should be visible", "Description node should contain description");
- var button = node.firstElementChild;
- isnot(button, null, "There should be a button");
-
- node = settings[4];
- is_element_hidden(node, "Unsupported settings should not be visible");
- ok(!node.hasAttribute("first-row"), "Hidden row is not the first row");
-
- button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Addon with non-inline preferences as optionsURL
-add_test(function() {
- observer.checkHidden("inlinesettings2@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "noninlinesettings@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkNotDisplayed();
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 0, "Grid should not have settings children");
-
- var button = gManagerWindow.document.getElementById("detail-prefs-btn");
- is_element_visible(button, "Preferences button should be visible");
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
-
-// Addon with options.xul, disabling and enabling should hide and show settings UI
-add_test(function() {
- observer.checkNotHidden();
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
- is(gManagerWindow.gViewController.currentViewId,
- "addons://detail/inlinesettings1%40tests.mozilla.org",
- "Current view should not scroll to preferences");
- checkScrolling(false);
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, SETTINGS_ROWS, "Grid should have settings children");
-
- // disable
- var button = gManagerWindow.document.getElementById("detail-disable-btn");
- button.focus(); // make sure it's in view
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 0, "Grid should not have settings children");
-
- gCategoryUtilities.openType("extension", function() {
- var addon = get_addon_element(gManagerWindow, "inlinesettings1@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "preferences-btn");
- is_element_hidden(button, "Preferences button should not be visible");
-
- button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- is(settings.length, 0, "Grid should not have settings children");
-
- // enable
- var button = gManagerWindow.document.getElementById("detail-enable-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- observer.callback = function() {
- observer.checkDisplayed("inlinesettings1@tests.mozilla.org");
-
- settings = grid.querySelectorAll("rows > setting");
- is(settings.length, SETTINGS_ROWS, "Grid should have settings children");
-
- gCategoryUtilities.openType("extension", run_next_test);
- };
- });
- });
- });
-});
-
-
-// Addon with options.xul that requires a restart to disable,
-// disabling and enabling should not hide and show settings UI.
-add_test(function() {
- observer.checkHidden("inlinesettings1@tests.mozilla.org");
-
- var addon = get_addon_element(gManagerWindow, "inlinesettings2@tests.mozilla.org");
- addon.parentNode.ensureElementIsVisible(addon);
-
- var button = gManagerWindow.document.getAnonymousElementByAttribute(addon, "anonid", "details-btn");
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
-
- wait_for_view_load(gManagerWindow, function() {
- observer.checkDisplayed("inlinesettings2@tests.mozilla.org");
-
- var grid = gManagerWindow.document.getElementById("detail-grid");
- var settings = grid.querySelectorAll("rows > setting");
- ok(settings.length > 0, "Grid should have settings children");
-
- // disable
- var button = gManagerWindow.document.getElementById("detail-disable-btn");
- button.focus(); // make sure it's in view
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- observer.checkNotHidden();
-
- settings = grid.querySelectorAll("rows > setting");
- ok(settings.length > 0, "Grid should still have settings children");
-
- // cancel pending disable
- button = gManagerWindow.document.getElementById("detail-enable-btn");
- button.focus(); // make sure it's in view
- EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
- observer.checkNotDisplayed();
-
- gCategoryUtilities.openType("extension", run_next_test);
- });
-});
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_openDialog.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests the dialog open by the Options button for addons that provide a
-// custom chrome-like protocol for optionsURL.
-
-var CustomChromeProtocol = {
- scheme: "khrome",
- defaultPort: -1,
- protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
- Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
- Ci.nsIProtocolHandler.URI_NORELATIVE |
- Ci.nsIProtocolHandler.URI_NOAUTH,
-
- newURI: function CCP_newURI(aSpec, aOriginCharset, aBaseUri) {
- let uri = Cc["@mozilla.org/network/simple-uri;1"].
- createInstance(Ci.nsIURI);
- uri.spec = aSpec;
- return uri;
- },
-
- newChannel2: function CCP_newChannel2(aURI, aLoadInfo) {
- let url = Services.io.newURI("chrome:" + aURI.pathQueryRef);
- let ch = Services.io.newChannelFromURIWithLoadInfo(url, aLoadInfo);
- ch.originalURI = aURI;
- return ch;
- },
-
- newChannel: function CCP_newChannel(aURI) {
- return this.newChannel2(aURI, null);
- },
-
- allowPort: function CCP_allowPort(aPort, aScheme) {
- return false;
- },
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIProtocolHandler
- ]),
-
- classID: Components.ID("{399cb2d1-05dd-4363-896f-63b78e008cf8}"),
-
- factory: {
- registrar: Components.manager.QueryInterface(Ci.nsIComponentRegistrar),
-
- register: function CCP_register() {
- this.registrar.registerFactory(
- CustomChromeProtocol.classID,
- "CustomChromeProtocol",
- "@mozilla.org/network/protocol;1?name=khrome",
- this
- );
- },
-
- unregister: function CCP_register() {
- this.registrar.unregisterFactory(CustomChromeProtocol.classID, this);
- },
-
- // nsIFactory
- createInstance: function BNPH_createInstance(aOuter, aIID) {
- if (aOuter) {
- throw Components.Exception("Class does not allow aggregation",
- Components.results.NS_ERROR_NO_AGGREGATION);
- }
- return CustomChromeProtocol.QueryInterface(aIID);
- },
-
- lockFactory: function BNPH_lockFactory(aLock) {
- throw Components.Exception("Function lockFactory is not implemented",
- Components.results.NS_ERROR_NOT_IMPLEMENTED);
- },
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIFactory
- ])
- }
-};
-
-function test() {
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- info("Registering custom chrome-like protocol.");
- CustomChromeProtocol.factory.register();
- registerCleanupFunction(() => CustomChromeProtocol.factory.unregister());
-
- const ADDONS_LIST = [
- { id: "test1@tests.mozilla.org",
- name: "Test add-on 1",
- optionsURL: CHROMEROOT + "addon_prefs.xul" },
- { id: "test2@tests.mozilla.org",
- name: "Test add-on 2",
- optionsURL: (CHROMEROOT + "addon_prefs.xul").replace("chrome:", "khrome:") },
- ];
-
- var gProvider = new MockProvider();
- gProvider.createAddons(ADDONS_LIST);
-
- open_manager("addons://list/extension", function(aManager) {
- let addonList = aManager.document.getElementById("addon-list");
- let currentAddon;
- let instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
-
- function getAddonByName(aName) {
- for (let addonItem of addonList.childNodes) {
- if (addonItem.hasAttribute("name") &&
- addonItem.getAttribute("name") == aName)
- return addonItem;
- }
- return null;
- }
-
- function observer(aSubject, aTopic, aData) {
- switch (aTopic) {
- case "domwindowclosed":
- // Give the preference window a chance to finish closing before
- // closing the add-ons manager.
- waitForFocus(function() {
- test_next_addon();
- });
- break;
- case "domwindowopened":
- let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
- waitForFocus(function() {
- // If the openDialog privileges are wrong a new browser window
- // will open, let the test proceed (and fail) rather than timeout.
- if (win.location != currentAddon.optionsURL &&
- win.location != "chrome://browser/content/browser.xul")
- return;
-
- is(win.location, currentAddon.optionsURL,
- "The correct addon pref window should have opened");
-
- let chromeFlags = win.QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIWebNavigation).
- QueryInterface(Ci.nsIDocShellTreeItem).treeOwner.
- QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIXULWindow).chromeFlags;
- ok(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME &&
- (instantApply || chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG),
- "Window was open as a chrome dialog.");
-
- win.close();
- }, win);
- break;
- }
- }
-
- function test_next_addon() {
- currentAddon = ADDONS_LIST.shift();
- if (!currentAddon) {
- Services.ww.unregisterNotification(observer);
- close_manager(aManager, finish);
- return;
- }
-
- info("Testing " + currentAddon.name);
- let addonItem = getAddonByName(currentAddon.name, addonList);
- let optionsBtn =
- aManager.document.getAnonymousElementByAttribute(addonItem, "anonid",
- "preferences-btn");
- is(optionsBtn.hidden, false, "Prefs button should be visible.");
-
- addonList.ensureElementIsVisible(addonItem);
- EventUtils.synthesizeMouseAtCenter(optionsBtn, { }, aManager);
- }
-
- Services.ww.registerNotification(observer);
- test_next_addon();
- });
-
-}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_manifest.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_manifest.js
@@ -9,17 +9,16 @@
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
const profileDir = gProfD.clone();
profileDir.append("extensions");
writeInstallRDFForExtension({
id: "addon1@tests.mozilla.org",
version: "1.0",
- optionsURL: "chrome://test/content/options.xul",
aboutURL: "chrome://test/content/about.xul",
iconURL: "chrome://test/skin/icon.png",
icon64URL: "chrome://test/skin/icon64.png",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
@@ -255,17 +254,16 @@ function run_test() {
maxVersion: "1"
}],
name: "Test Addon 19"
}, profileDir);
writeInstallRDFForExtension({
id: "addon20@tests.mozilla.org",
version: "1.0",
- optionsType: "1",
optionsURL: "chrome://test/content/options.xul",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
name: "Test Addon 20"
}, profileDir);
@@ -373,18 +371,17 @@ function run_test() {
function([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20,
a21, a22, a23, a24, a25, a26]) {
do_check_neq(a1, null);
do_check_eq(a1.id, "addon1@tests.mozilla.org");
do_check_eq(a1.type, "extension");
do_check_eq(a1.version, "1.0");
- do_check_eq(a1.optionsURL, "chrome://test/content/options.xul");
- do_check_eq(a1.optionsType, AddonManager.OPTIONS_TYPE_DIALOG);
+ do_check_eq(a1.optionsType, null);
do_check_eq(a1.aboutURL, "chrome://test/content/about.xul");
do_check_eq(a1.iconURL, "chrome://test/skin/icon.png");
do_check_eq(a1.icon64URL, "chrome://test/skin/icon64.png");
do_check_eq(a1.icons[32], "chrome://test/skin/icon.png");
do_check_eq(a1.icons[64], "chrome://test/skin/icon64.png");
do_check_eq(a1.name, "Test Addon 1");
do_check_eq(a1.description, "Test Description");
do_check_eq(a1.creator, "Test Creator");
@@ -492,71 +489,58 @@ function run_test() {
do_check_neq(a16, null);
do_check_true(a16.isActive);
do_check_false(a16.userDisabled);
do_check_false(a16.appDisabled);
do_check_true(a16.isCompatible);
do_check_true(a16.providesUpdatesSecurely);
- do_check_neq(a17, null);
- do_check_true(a17.isActive);
- do_check_false(a17.userDisabled);
- do_check_false(a17.appDisabled);
- do_check_true(a17.isCompatible);
- do_check_eq(a17.optionsURL, "chrome://test/content/options.xul");
- do_check_eq(a17.optionsType, AddonManager.OPTIONS_TYPE_INLINE);
+ // An obsolete optionsType means the add-on isn't registered.
+ do_check_eq(a17, null);
do_check_neq(a18, null);
do_check_true(a18.isActive);
do_check_false(a18.userDisabled);
do_check_false(a18.appDisabled);
do_check_true(a18.isCompatible);
- if (Services.prefs.getBoolPref("extensions.alwaysUnpack")) {
- do_check_eq(a18.optionsURL, Services.io.newFileURI(profileDir).spec +
- "addon18@tests.mozilla.org/options.xul");
- } else {
- do_check_eq(a18.optionsURL, "jar:" + Services.io.newFileURI(profileDir).spec +
- "addon18@tests.mozilla.org.xpi!/options.xul");
- }
- do_check_eq(a18.optionsType, AddonManager.OPTIONS_TYPE_INLINE);
+ do_check_eq(a18.optionsURL, null);
+ do_check_eq(a18.optionsType, null);
do_check_eq(a19, null);
+ // Even with a defined optionsURL optionsType is null by default.
do_check_neq(a20, null);
do_check_true(a20.isActive);
do_check_false(a20.userDisabled);
do_check_false(a20.appDisabled);
do_check_true(a20.isCompatible);
do_check_eq(a20.optionsURL, "chrome://test/content/options.xul");
- do_check_eq(a20.optionsType, AddonManager.OPTIONS_TYPE_DIALOG);
+ do_check_eq(a20.optionsType, null);
do_check_neq(a21, null);
do_check_true(a21.isActive);
do_check_false(a21.userDisabled);
do_check_false(a21.appDisabled);
do_check_true(a21.isCompatible);
do_check_eq(a21.optionsURL, "chrome://test/content/options.xul");
do_check_eq(a21.optionsType, AddonManager.OPTIONS_TYPE_TAB);
- do_check_neq(a22, null);
- do_check_eq(a22.optionsType, null);
- do_check_eq(a22.optionsURL, null);
+ // An obsolete optionsType means the add-on isn't registered.
+ do_check_eq(a22, null);
- do_check_neq(a23, null);
- do_check_eq(a23.optionsType, AddonManager.OPTIONS_TYPE_INLINE);
- do_check_neq(a23.optionsURL, null);
+ // An obsolete optionsType means the add-on isn't registered.
+ do_check_eq(a23, null);
do_check_neq(a24, null);
- do_check_eq(a24.optionsType, AddonManager.OPTIONS_TYPE_INLINE);
- do_check_neq(a24.optionsURL, null);
+ do_check_eq(a24.optionsType, null);
+ do_check_eq(a24.optionsURL, null);
do_check_neq(a25, null);
do_check_eq(a25.optionsType, null);
do_check_eq(a25.optionsURL, null);
- do_check_neq(a26, null);
- do_check_eq(a26.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO);
- do_check_neq(a26.optionsURL, null);
+ // An obsolete optionsType means the add-on isn't registered.
+ do_check_eq(a26, null);
do_execute_soon(do_test_finished);
});
}
--- a/toolkit/themes/shared/extensions/extensions.inc.css
+++ b/toolkit/themes/shared/extensions/extensions.inc.css
@@ -813,44 +813,37 @@ button.warning {
}
#detail-grid > columns > column:first-child {
min-width: 15em;
max-width: 25em;
}
.detail-row[first-row="true"],
-.detail-row-complex[first-row="true"],
-setting[first-row="true"] {
+.detail-row-complex[first-row="true"] {
border-top: none;
}
.detail-row,
-.detail-row-complex,
-setting {
+.detail-row-complex {
border-top: 1px solid var(--in-content-box-border-color);
-moz-box-align: center;
min-height: 35px;
line-height: 20px;
text-shadow: 0 1px 1px #fefffe;
}
#detail-controls {
margin-bottom: 1em;
}
-.inline-options-browser,
-setting[first-row="true"] {
+.inline-options-browser {
margin-top: 2em;
}
-setting {
- -moz-box-align: start;
-}
-
.preferences-alignment {
min-height: 30px;
-moz-box-align: center;
}
.preferences-description {
font-size: 90.9%;
color: graytext;
@@ -858,20 +851,16 @@ setting {
margin-inline-start: 2em;
white-space: pre-wrap;
}
.preferences-description:empty {
display: none;
}
-setting[type="radio"] > radiogroup {
- -moz-box-orient: horizontal;
-}
-
/*** creator ***/
.creator > label {
margin-inline-start: 0;
margin-inline-end: 0;
}