import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,7 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
]
};

View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="addon-test-about-window">
<label value="Oh hai!"/>
</window>

View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="addon-test-pref-window">
<label value="Oh hai!"/>
</window>

View file

@ -0,0 +1,31 @@
<?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>bug557956-1@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>Addon1</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-10@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon10</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-2@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon2</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-3@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon3</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-4@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon4</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-5@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon5</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-6@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon6</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-7@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon7</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-8@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon8</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug557956-9@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.3</em:minVersion>
<em:maxVersion>0.3</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Addon9</em:name>
<em:bootstrap>true</em:bootstrap>
</Description>
</RDF>

View file

@ -0,0 +1,30 @@
<?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>bug567127_1@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>browser_bug567127 #1</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,30 @@
<?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>bug567127_2@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>browser_bug567127 #2</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug596336-1@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bootstrap upgrade test</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,31 @@
<?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>bug596336-1@tests.mozilla.org</em:id>
<em:version>2.0</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>
<!-- Front End MetaData -->
<em:name>Bootstrap upgrade test</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,30 @@
<?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>dragdrop1@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>Drag Drop test 1</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,30 @@
<?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>dragdrop2@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>Drag Drop test 2</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,16 @@
<?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>test-experiment1@experiments.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:type>128</em:type>
<!-- Front End MetaData -->
<em:name>Test Experiment 1</em:name>
<em:description>Test Description</em:description>
</Description>
</RDF>

View file

@ -0,0 +1,8 @@
function install (params, aReason) {
}
function uninstall (params, aReason) {
}
function startup (params, aReason) {
}
function shutdown (params, aReason) {
}

View file

@ -0,0 +1 @@
locale inlinesettings en-US ./

View file

@ -0,0 +1,27 @@
<?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>

View file

@ -0,0 +1,23 @@
<?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>

View file

@ -0,0 +1 @@
<!ENTITY checkbox "Check box label">

View file

@ -0,0 +1,19 @@
<?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>

View file

@ -0,0 +1,8 @@
function install (params, aReason) {
}
function uninstall (params, aReason) {
}
function startup (params, aReason) {
}
function shutdown (params, aReason) {
}

View file

@ -0,0 +1,2 @@
content inlinesettings ./ contentaccessible=yes
locale inlinesettings en-US ./

View file

@ -0,0 +1,27 @@
<?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>

View file

@ -0,0 +1,5 @@
<?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>

View file

@ -0,0 +1 @@
<!ENTITY custom.title "Custom">

View file

@ -0,0 +1,8 @@
function install (params, aReason) {
}
function uninstall (params, aReason) {
}
function startup (params, aReason) {
}
function shutdown (params, aReason) {
}

View file

@ -0,0 +1,28 @@
<?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>

View file

@ -0,0 +1,19 @@
<?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>

View file

@ -0,0 +1,32 @@
<?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>install1@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:bootstrap>true</em:bootstrap>
<em:updateURL>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_install.rdf</em:updateURL>
<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>
<!-- Front End MetaData -->
<em:name>Install Tests</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,30 @@
<?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>install1@tests.mozilla.org</em:id>
<em:version>2.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>Install Tests</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,30 @@
<?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>sslinstall@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<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>
<!-- Front End MetaData -->
<em:name>SSL Install Tests</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function install(data, reason) {}
function startup(data, reason) {}
function shutdown(data, reason) {}
function uninstall(data, reason) {}

View file

@ -0,0 +1,25 @@
<?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>remote1@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:type>2</em:type>
<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>
<!-- Front End MetaData -->
<em:name>PASS - b - installed</em:name>
<em:description>Test sumary - SEARCH SEARCH</em:description>
</Description>
</RDF>

View file

@ -0,0 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function install(data, reason) {}
function startup(data, reason) {
Components.utils.import("resource://gre/modules/Services.jsm");
Services.ppmm.loadProcessScript(
"resource://my-addon/frame-script.js", false);
}
function shutdown(data, reason) {}
function uninstall(data, reason) {}

View file

@ -0,0 +1 @@
resource my-addon .

View file

@ -0,0 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
Components.utils.import("resource://gre/modules/Services.jsm");
Services.cpmm.sendAsyncMessage("my-addon-1");

View file

@ -0,0 +1,31 @@
<?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>update1@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Update Tests</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function install(data, reason) {}
function startup(data, reason) {
Components.utils.import("resource://gre/modules/Services.jsm");
Services.ppmm.loadProcessScript(
"resource://my-addon/frame-script.js", false);
}
function shutdown(data, reason) {}
function uninstall(data, reason) {}

View file

@ -0,0 +1 @@
resource my-addon .

View file

@ -0,0 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
Components.utils.import("resource://gre/modules/Services.jsm");
Services.cpmm.sendAsyncMessage("my-addon-2");

View file

@ -0,0 +1,31 @@
<?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>update1@tests.mozilla.org</em:id>
<em:version>2.0</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>
<!-- Front End MetaData -->
<em:name>Update Tests</em:name>
</Description>
</RDF>

View file

@ -0,0 +1,9 @@
Components.utils.import("resource://gre/modules/Services.jsm");
function startup(data, reason) {
Services.prefs.setIntPref("webapitest.active_version", 1);
}
function shutdown(data, reason) {
Services.prefs.setIntPref("webapitest.active_version", 0);
}

View file

@ -0,0 +1,29 @@
<?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>webapi_install@tests.mozilla.org</em:id>
<em:version>1.1</em:version>
<em:name>AddonManger web API test</em:name>
<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>

View file

@ -0,0 +1,11 @@
{
"manifest_version": 2,
"name": "Test options_ui",
"description": "Test add-ons manager handling options_ui with no id in manifest.json",
"version": "1.2",
"options_ui": {
"page": "options.html"
}
}

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="options-test-panel" />
</body>
</html>

View file

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310001">
<emItems>
</emItems>
<pluginItems>
</pluginItems>
</blocklist>

View file

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
<emItems>
</emItems>
<pluginItems>
<pluginItem blockID="p9999">
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
<versionRange severity="2"></versionRange>
</pluginItem>
</pluginItems>
</blocklist>

View file

@ -0,0 +1,67 @@
[browser_about.js]
skip-if = os == 'linux' || os == 'win' # bug 632290
[browser_bug523784.js]
[browser_bug557943.js]
[browser_bug562797.js]
[browser_bug562854.js]
[browser_bug562890.js]
skip-if = os == 'win' && !debug # Disabled on Windows opt/PGO builds due to intermittent failures (bug 1135866)
[browser_bug562899.js]
skip-if = buildapp == 'mulet'
[browser_bug562992.js]
[browser_bug567127.js]
[browser_bug567137.js]
[browser_bug570760.js]
[browser_bug572561.js]
[browser_bug573062.js]
[browser_bug577990.js]
[browser_bug580298.js]
[browser_bug581076.js]
[browser_bug586574.js]
[browser_bug587970.js]
[browser_bug591465.js]
[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_experiments.js]
[browser_list.js]
[browser_metadataTimeout.js]
[browser_searching.js]
[browser_sorting.js]
[browser_sorting_plugins.js]
[browser_plugin_enabled_state_locked.js]
[browser_uninstalling.js]
[browser_install.js]
[browser_recentupdates.js]
[browser_manualupdates.js]
[browser_globalwarnings.js]
[browser_eula.js]
skip-if = buildapp == 'mulet'
[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]
skip-if = buildapp == 'mulet'
[browser_CTP_plugins.js]
skip-if = buildapp == 'mulet'
[browser_webext_options.js]
tags = webextensions

View file

@ -0,0 +1,52 @@
[DEFAULT]
install-to-subdir = test-window
support-files =
addons/*
addon_about.xul
addon_prefs.xul
cancelCompatCheck.sjs
discovery.html
discovery_frame.html
discovery_install.html
head.js
signed_hotfix.rdf
signed_hotfix.xpi
unsigned_hotfix.rdf
unsigned_hotfix.xpi
more_options.xul
options.xul
plugin_test.html
redirect.sjs
releaseNotes.xhtml
blockNoPlugins.xml
blockPluginHard.xml
browser_bug557956.rdf
browser_bug557956_8_2.xpi
browser_bug557956_9_2.xpi
browser_bug557956.xml
browser_bug591465.xml
browser_bug593535.xml
browser_searching.xml
browser_searching_empty.xml
browser_updatessl.rdf
browser_updatessl.rdf^headers^
browser_install.rdf
browser_install.rdf^headers^
browser_install.xml
browser_install1_3.xpi
browser_eula.xml
browser_purchase.xml
webapi_addon_listener.html
webapi_checkavailable.html
webapi_checkchromeframe.xul
webapi_checkframed.html
webapi_checknavigatedwindow.html
!/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi
!/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi
!/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
!/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi
!/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
!/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
[include:browser-common.ini]

View file

@ -0,0 +1,75 @@
[DEFAULT]
tags = addons
support-files =
addons/*
addon_about.xul
addon_prefs.xul
cancelCompatCheck.sjs
discovery.html
discovery_frame.html
discovery_install.html
head.js
signed_hotfix.rdf
signed_hotfix.xpi
unsigned_hotfix.rdf
unsigned_hotfix.xpi
more_options.xul
options.xul
plugin_test.html
redirect.sjs
releaseNotes.xhtml
blockNoPlugins.xml
blockPluginHard.xml
browser_bug557956.rdf
browser_bug557956_8_2.xpi
browser_bug557956_9_2.xpi
browser_bug557956.xml
browser_bug591465.xml
browser_bug593535.xml
browser_searching.xml
browser_searching_empty.xml
browser_updatessl.rdf
browser_updatessl.rdf^headers^
browser_install.rdf
browser_install.rdf^headers^
browser_install.xml
browser_install1_3.xpi
browser_eula.xml
browser_purchase.xml
webapi_addon_listener.html
webapi_checkavailable.html
webapi_checkchromeframe.xul
webapi_checkframed.html
webapi_checknavigatedwindow.html
!/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi
!/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi
!/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
!/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi
!/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
!/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
[browser_addonrepository_performance.js]
[browser_bug557956.js]
[browser_bug616841.js]
[browser_cancelCompatCheck.js]
[browser_checkAddonCompatibility.js]
[browser_gmpProvider.js]
[browser_hotfix.js]
# Verifies the old style of signing hotfixes
skip-if = require_signing
[browser_installssl.js]
[browser_newaddon.js]
[browser_updatessl.js]
[browser_system_addons_are_e10s.js]
[browser_task_next_test.js]
[browser_discovery_install.js]
[browser_update.js]
[browser_webapi.js]
[browser_webapi_access.js]
[browser_webapi_addon_listener.js]
[browser_webapi_enable.js]
[browser_webapi_install.js]
[browser_webapi_uninstall.js]
[include:browser-common.ini]

View file

@ -0,0 +1,172 @@
const gHttpTestRoot = "http://127.0.0.1:8888/" + RELATIVE_DIR + "/";
function updateBlocklist(aCallback) {
var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
.getService(Ci.nsITimerCallback);
var observer = function() {
Services.obs.removeObserver(observer, "blocklist-updated");
SimpleTest.executeSoon(aCallback);
};
Services.obs.addObserver(observer, "blocklist-updated", false);
blocklistNotifier.notify(null);
}
var _originalBlocklistURL = null;
function setAndUpdateBlocklist(aURL, aCallback) {
if (!_originalBlocklistURL) {
_originalBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
}
Services.prefs.setCharPref("extensions.blocklist.url", aURL);
updateBlocklist(aCallback);
}
function resetBlocklist(aCallback) {
Services.prefs.setCharPref("extensions.blocklist.url", _originalBlocklistURL);
}
add_task(function*() {
SpecialPowers.pushPrefEnv({"set": [
["plugins.click_to_play", true],
["extensions.blocklist.suppressUI", true]
]});
registerCleanupFunction(function*() {
let pluginTag = getTestPluginTag();
pluginTag.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
yield new Promise(resolve => {
setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", resolve);
});
resetBlocklist();
});
let pluginTag = getTestPluginTag();
pluginTag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
let managerWindow = yield new Promise(resolve => open_manager("addons://list/plugin", resolve));
let plugins = yield new Promise(resolve => AddonManager.getAddonsByTypes(["plugin"], resolve));
let testPluginId;
for (let plugin of plugins) {
if (plugin.name == "Test Plug-in") {
testPluginId = plugin.id;
break;
}
}
ok(testPluginId, "part2: Test Plug-in should exist");
let testPlugin = yield new Promise(resolve => AddonManager.getAddonByID(testPluginId, resolve));
let pluginEl = get_addon_element(managerWindow, testPluginId);
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
let enableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "enable-btn");
is_element_hidden(enableButton, "part3: enable button should not be visible");
let disableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "enable-btn");
is_element_hidden(disableButton, "part3: disable button should not be visible");
let menu = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "state-menulist");
is_element_visible(menu, "part3: state menu should be visible");
let askToActivateItem = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "ask-to-activate-menuitem");
is(menu.selectedItem, askToActivateItem, "part3: state menu should have 'Ask To Activate' selected");
let pluginTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gHttpTestRoot + "plugin_test.html");
let pluginBrowser = pluginTab.linkedBrowser;
let condition = () => PopupNotifications.getNotification("click-to-play-plugins", pluginBrowser);
yield BrowserTestUtils.waitForCondition(condition, "part4: should have a click-to-play notification");
yield BrowserTestUtils.removeTab(pluginTab);
let alwaysActivateItem = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "always-activate-menuitem");
menu.selectedItem = alwaysActivateItem;
alwaysActivateItem.doCommand();
pluginTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gHttpTestRoot + "plugin_test.html");
yield ContentTask.spawn(pluginTab.linkedBrowser, null, function*() {
let testPlugin = content.document.getElementById("test");
ok(testPlugin, "part5: should have a plugin element in the page");
let objLoadingContent = testPlugin.QueryInterface(Ci.nsIObjectLoadingContent);
let condition = () => objLoadingContent.activated;
yield ContentTaskUtils.waitForCondition(condition, "part5: waited too long for plugin to activate");
ok(objLoadingContent.activated, "part6: plugin should be activated");
});
yield BrowserTestUtils.removeTab(pluginTab);
let neverActivateItem = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "never-activate-menuitem");
menu.selectedItem = neverActivateItem;
neverActivateItem.doCommand();
pluginTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gHttpTestRoot + "plugin_test.html");
pluginBrowser = pluginTab.linkedBrowser;
yield ContentTask.spawn(pluginTab.linkedBrowser, null, function*() {
let testPlugin = content.document.getElementById("test");
ok(testPlugin, "part7: should have a plugin element in the page");
let objLoadingContent = testPlugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "part7: plugin should not be activated");
});
yield BrowserTestUtils.removeTab(pluginTab);
let details = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
is_element_visible(details, "part7: details link should be visible");
EventUtils.synthesizeMouseAtCenter(details, {}, managerWindow);
yield BrowserTestUtils.waitForEvent(managerWindow.document, "ViewChanged");
is_element_hidden(enableButton, "part8: detail enable button should be hidden");
is_element_hidden(disableButton, "part8: detail disable button should be hidden");
is_element_visible(menu, "part8: detail state menu should be visible");
is(menu.selectedItem, neverActivateItem, "part8: state menu should have 'Never Activate' selected");
menu.selectedItem = alwaysActivateItem;
alwaysActivateItem.doCommand();
pluginTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gHttpTestRoot + "plugin_test.html");
pluginBrowser = pluginTab.linkedBrowser;
yield ContentTask.spawn(pluginTab.linkedBrowser, null, function*() {
let testPlugin = content.document.getElementById("test");
ok(testPlugin, "part9: should have a plugin element in the page");
let objLoadingContent = testPlugin.QueryInterface(Ci.nsIObjectLoadingContent);
let condition = () => objLoadingContent.activated;
yield ContentTaskUtils.waitForCondition(condition, "part9: waited too long for plugin to activate");
ok(objLoadingContent.activated, "part10: plugin should be activated");
});
yield BrowserTestUtils.removeTab(pluginTab);
menu.selectedItem = askToActivateItem;
askToActivateItem.doCommand();
pluginTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gHttpTestRoot + "plugin_test.html");
pluginBrowser = pluginTab.linkedBrowser;
condition = () => PopupNotifications.getNotification("click-to-play-plugins", pluginBrowser);
yield BrowserTestUtils.waitForCondition(condition, "part11: should have a click-to-play notification");
yield BrowserTestUtils.removeTab(pluginTab);
// causes appDisabled to be set
managerWindow = yield new Promise(resolve => {
setAndUpdateBlocklist(gHttpTestRoot + "blockPluginHard.xml",
() => {
close_manager(managerWindow, function() {
open_manager("addons://list/plugin", resolve);
});
}
);
});
pluginEl = get_addon_element(managerWindow, testPluginId);
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
menu = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "state-menulist");
is(menu.disabled, true, "part12: state menu should be disabled");
details = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
EventUtils.synthesizeMouseAtCenter(details, {}, managerWindow);
yield BrowserTestUtils.waitForEvent(managerWindow.document, "ViewChanged");
menu = managerWindow.document.getElementById("detail-state-menulist");
is(menu.disabled, true, "part13: detail state menu should be disabled");
managerWindow.close();
});

View file

@ -0,0 +1,84 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Tests the default and custom "about" dialogs of add-ons.
*
* Test for bug 610661 <https://bugzilla.mozilla.org/show_bug.cgi?id=610661>:
* Addon object not passed to custom about dialogs.
*/
var gManagerWindow;
const URI_ABOUT_DEFAULT = "chrome://mozapps/content/extensions/about.xul";
const URI_ABOUT_CUSTOM = CHROMEROOT + "addon_about.xul";
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
var gProvider = new MockProvider();
gProvider.createAddons([{
id: "test1@tests.mozilla.org",
name: "Test add-on 1",
description: "foo"
},
{
id: "test2@tests.mozilla.org",
name: "Test add-on 2",
description: "bar",
aboutURL: URI_ABOUT_CUSTOM
}]);
open_manager("addons://list/extension", function(aManager) {
gManagerWindow = aManager;
test_about_window("Test add-on 1", URI_ABOUT_DEFAULT, function() {
test_about_window("Test add-on 2", URI_ABOUT_CUSTOM, function() {
close_manager(gManagerWindow, finish);
});
});
});
}
function test_about_window(aAddonItemName, aExpectedAboutUri, aCallback) {
var addonList = gManagerWindow.document.getElementById("addon-list");
for (var addonItem of addonList.childNodes) {
if (addonItem.hasAttribute("name") &&
addonItem.getAttribute("name") === aAddonItemName)
break;
}
info("Waiting for about dialog");
Services.ww.registerNotification(function TEST_ww_observer(aSubject, aTopic,
aData) {
if (aTopic == "domwindowclosed") {
Services.ww.unregisterNotification(TEST_ww_observer);
info("About dialog closed, waiting for focus on browser window");
waitForFocus(() => executeSoon(aCallback));
} else if (aTopic == "domwindowopened") {
info("About dialog opened, waiting for focus");
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
waitForFocus(function() {
info("Saw about dialog");
is(win.location,
aExpectedAboutUri,
"The correct add-on about window should have opened");
is(win.arguments && win.arguments[0] && win.arguments[0].name,
aAddonItemName,
"window.arguments[0] should refer to the add-on object");
executeSoon(() => win.close());
}, win);
}
});
gManagerWindow.gViewController.doCommand("cmd_showItemAbout",
addonItem.mAddon);
}

View file

@ -0,0 +1,99 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that the metadata request includes startup time measurements
var tmp = {};
Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm", tmp);
var AddonRepository = tmp.AddonRepository;
var gTelemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
var gManagerWindow;
var gProvider;
function parseParams(aQuery) {
let params = {};
for (let param of aQuery.split("&")) {
let [key, value] = param.split("=");
params[key] = value;
}
return params;
}
function test() {
waitForExplicitFinish();
var gSeenRequest = false;
gProvider = new MockProvider();
gProvider.createAddons([{
id: "test1@tests.mozilla.org",
name: "Test add-on"
}]);
function observe(aSubject, aTopic, aData) {
aSubject.QueryInterface(Ci.nsIChannel);
let url = aSubject.URI.QueryInterface(Ci.nsIURL);
if (url.filePath != "/extensions-dummy/metadata") {
return;
}
info(url.query);
// Check if we encountered telemetry errors and turn the tests for which
// we don't have valid data into known failures.
let snapshot = gTelemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
.snapshot();
let tProcessValid = (snapshot.counts[0] == 0);
let tMainValid = tProcessValid && (snapshot.counts[2] == 0);
let tFirstPaintValid = tProcessValid && (snapshot.counts[5] == 0);
let tSessionRestoredValid = tProcessValid && (snapshot.counts[6] == 0);
let params = parseParams(url.query);
is(params.appOS, Services.appinfo.OS, "OS should be correct");
is(params.appVersion, Services.appinfo.version, "Version should be correct");
if (tMainValid) {
ok(params.tMain >= 0, "Should be a sensible tMain");
} else {
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
}
if (tFirstPaintValid) {
ok(params.tFirstPaint >= 0, "Should be a sensible tFirstPaint");
} else {
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
}
if (tSessionRestoredValid) {
ok(params.tSessionRestored >= 0, "Should be a sensible tSessionRestored");
} else {
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
}
gSeenRequest = true;
}
const PREF = "extensions.getAddons.getWithPerformance.url";
// Watch HTTP requests
Services.obs.addObserver(observe, "http-on-modify-request", false);
Services.prefs.setCharPref(PREF,
"http://127.0.0.1:8888/extensions-dummy/metadata?appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
registerCleanupFunction(function() {
Services.obs.removeObserver(observe, "http-on-modify-request");
});
AddonRepository._beginGetAddons(["test1@tests.mozilla.org"], {
searchFailed: function() {
ok(gSeenRequest, "Should have seen metadata request");
finish();
}
}, true);
}

View file

@ -0,0 +1,120 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const URI_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
// This tests that the blocklist dialog still affects soft-blocked add-ons
// if the user clicks the "Restart Later" button. It also ensures that the
// "Cancel" button is correctly renamed (to "Restart Later").
var args = {
restart: false,
list: [{
name: "Bug 523784 softblocked addon",
version: "1",
icon: "chrome://mozapps/skin/plugins/pluginGeneric.png",
disable: false,
blocked: false,
url: 'http://example.com/bug523784_1',
}],
};
function test() {
waitForExplicitFinish();
let windowObserver = function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
executeSoon(() => bug523784_test1(win));
}, false);
};
Services.ww.registerNotification(windowObserver);
args.wrappedJSObject = args;
Services.ww.openWindow(null, URI_BLOCKLIST_DIALOG, "",
"chrome,centerscreen,dialog,titlebar", args);
}
function bug523784_test1(win) {
let bundle = Services.strings.
createBundle("chrome://mozapps/locale/update/updates.properties");
let cancelButton = win.document.documentElement.getButton("cancel");
let moreInfoLink = win.document.getElementById("moreInfo");
is(cancelButton.getAttribute("label"),
bundle.GetStringFromName("restartLaterButton"),
"Text should be changed on Cancel button");
is(cancelButton.getAttribute("accesskey"),
bundle.GetStringFromName("restartLaterButton.accesskey"),
"Accesskey should also be changed on Cancel button");
is(moreInfoLink.getAttribute("href"),
'http://example.com/bug523784_1',
"More Info link should link to a detailed blocklist page.");
let windowObserver = function(aSubject, aTopic, aData) {
if (aTopic != "domwindowclosed")
return;
Services.ww.unregisterNotification(windowObserver);
ok(args.list[0].disable, "Should be blocking add-on");
ok(!args.restart, "Should not restart browser immediately");
executeSoon(bug523784_test2);
};
Services.ww.registerNotification(windowObserver);
cancelButton.doCommand();
}
function bug523784_test2(win) {
let windowObserver = function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
executeSoon(function() {
let moreInfoLink = win.document.getElementById("moreInfo");
let cancelButton = win.document.documentElement.getButton("cancel");
is(moreInfoLink.getAttribute("href"),
Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL"),
"More Info link should link to the general blocklist page.");
cancelButton.doCommand();
executeSoon(finish);
})
}, false);
};
Services.ww.registerNotification(windowObserver);
// Add 2 more addons to the blocked list to check that the more info link
// points to the general blocked list page.
args.list.push({
name: "Bug 523784 softblocked addon 2",
version: "2",
icon: "chrome://mozapps/skin/plugins/pluginGeneric.png",
disable: false,
blocked: false,
url: 'http://example.com/bug523784_2'
});
args.list.push({
name: "Bug 523784 softblocked addon 3",
version: "4",
icon: "chrome://mozapps/skin/plugins/pluginGeneric.png",
disable: false,
blocked: false,
url: 'http://example.com/bug523784_3'
});
args.wrappedJSObject = args;
Services.ww.openWindow(null, URI_BLOCKLIST_DIALOG, "",
"chrome,centerscreen,dialog,titlebar", args);
}

View file

@ -0,0 +1,80 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 557943 - Searching for addons can result in wrong results
var gManagerWindow;
var gProvider;
function test() {
waitForExplicitFinish();
gProvider = new MockProvider();
gProvider.createAddons([{
id: "addon1@tests.mozilla.org",
name: "Microsoft .NET Framework Assistant",
description: "",
version: "6.66"
}, {
id: "addon2@tests.mozilla.org",
name: "AwesomeNet Addon",
description: ""
}, {
id: "addon3@tests.mozilla.org",
name: "Dictionnaire MySpell en Francais (réforme 1990)",
description: ""
}]);
open_manager("addons://list/extension", function(aWindow) {
gManagerWindow = aWindow;
run_next_test();
});
}
function end_test() {
close_manager(gManagerWindow, function() {
finish();
});
}
function perform_search(aQuery, aCallback) {
waitForFocus(function() {
var searchBox = gManagerWindow.document.getElementById("header-search");
searchBox.value = aQuery;
EventUtils.synthesizeMouseAtCenter(searchBox, { }, gManagerWindow);
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
var list = gManagerWindow.document.getElementById("search-list");
var rows = list.getElementsByTagName("richlistitem");
aCallback(rows);
});
}, gManagerWindow);
}
add_test(function() {
perform_search(".net", function(aRows) {
is(aRows.length, 1, "Should only get one result");
is(aRows[0].mAddon.id, "addon1@tests.mozilla.org", "Should get expected addon as only result");
run_next_test();
});
});
add_test(function() {
perform_search("réf", function(aRows) {
is(aRows.length, 1, "Should only get one result");
is(aRows[0].mAddon.id, "addon3@tests.mozilla.org", "Should get expected addon as only result");
run_next_test();
});
});
add_test(function() {
perform_search("javascript:void()", function(aRows) {
is(aRows.length, 0, "Should not get any results");
run_next_test();
});
});

View file

@ -0,0 +1,524 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test the compatibility dialog that displays during startup when the browser
// version changes.
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
const PREF_MIN_APP_COMPAT = "extensions.minCompatibleAppVersion";
const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
// avoid the 'leaked window property' check
var scope = {};
Components.utils.import("resource://gre/modules/TelemetrySession.jsm", scope);
var TelemetrySession = scope.TelemetrySession;
/**
* Test add-ons:
*
* Addon minVersion maxVersion Notes
* addon1 0 *
* addon2 0 0
* addon3 0 0
* addon4 1 *
* addon5 0 0 Made compatible by update check
* addon6 0 0 Made compatible by update check
* addon7 0 0 Has a broken update available
* addon8 0 0 Has an update available
* addon9 0 0 Has an update available
*/
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
run_next_test();
}
function end_test() {
// Test generates a lot of available installs so just cancel them all
AddonManager.getAllInstalls(function(aInstalls) {
for (let install of aInstalls)
install.cancel();
Services.prefs.clearUserPref(PREF_MIN_APP_COMPAT);
Services.prefs.clearUserPref(PREF_MIN_PLATFORM_COMPAT);
finish();
});
}
function install_test_addons(aCallback) {
var installs = [];
// Use a blank update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
let names = ["browser_bug557956_1",
"browser_bug557956_2",
"browser_bug557956_3",
"browser_bug557956_4",
"browser_bug557956_5",
"browser_bug557956_6",
"browser_bug557956_7",
"browser_bug557956_8_1",
"browser_bug557956_9_1",
"browser_bug557956_10"];
for (let name of names) {
AddonManager.getInstallForURL(TESTROOT + "addons/" + name + ".xpi", function(aInstall) {
installs.push(aInstall);
}, "application/x-xpinstall");
}
var listener = {
installCount: 0,
onInstallEnded: function() {
this.installCount++;
if (this.installCount == installs.length) {
// Switch to the test update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "browser_bug557956.rdf");
executeSoon(aCallback);
}
}
};
for (let install of installs) {
install.addListener(listener);
install.install();
}
}
function uninstall_test_addons(aCallback) {
AddonManager.getAddonsByIDs(["bug557956-1@tests.mozilla.org",
"bug557956-2@tests.mozilla.org",
"bug557956-3@tests.mozilla.org",
"bug557956-4@tests.mozilla.org",
"bug557956-5@tests.mozilla.org",
"bug557956-6@tests.mozilla.org",
"bug557956-7@tests.mozilla.org",
"bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org",
"bug557956-10@tests.mozilla.org"],
function(aAddons) {
for (let addon of aAddons) {
if (addon)
addon.uninstall();
}
aCallback();
});
}
// Open the compatibility dialog, with the list of addon IDs
// that were disabled by this "update"
function open_compatibility_window(aDisabledAddons, aCallback) {
// This will reset the longer timeout multiplier to 2 which will give each
// test that calls open_compatibility_window a minimum of 60 seconds to
// complete.
requestLongerTimeout(2);
var variant = Cc["@mozilla.org/variant;1"].
createInstance(Ci.nsIWritableVariant);
variant.setFromVariant(aDisabledAddons);
// Cannot be modal as we want to interact with it, shouldn't cause problems
// with testing though.
var features = "chrome,centerscreen,dialog,titlebar";
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
var win = ww.openWindow(null, URI_EXTENSION_UPDATE_DIALOG, "", features, variant);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
info("Compatibility dialog opened");
function page_shown(aEvent) {
if (aEvent.target.pageid)
info("Page " + aEvent.target.pageid + " shown");
}
win.addEventListener("pageshow", page_shown, false);
win.addEventListener("unload", function() {
win.removeEventListener("unload", arguments.callee, false);
win.removeEventListener("pageshow", page_shown, false);
info("Compatibility dialog closed");
}, false);
aCallback(win);
}, false);
}
function wait_for_window_close(aWindow, aCallback) {
aWindow.addEventListener("unload", function() {
aWindow.removeEventListener("unload", arguments.callee, false);
aCallback();
}, false);
}
function wait_for_page(aWindow, aPageId, aCallback) {
var page = aWindow.document.getElementById(aPageId);
page.addEventListener("pageshow", function() {
page.removeEventListener("pageshow", arguments.callee, false);
executeSoon(function() {
aCallback(aWindow);
});
}, false);
}
function get_list_names(aList) {
var items = [];
for (let listItem of aList.childNodes)
items.push(listItem.label);
items.sort();
return items;
}
function check_telemetry({disabled, metaenabled, metadisabled, upgraded, failed, declined}) {
let ping = TelemetrySession.getPayload();
// info(JSON.stringify(ping));
let am = ping.simpleMeasurements.addonManager;
if (disabled !== undefined)
is(am.appUpdate_disabled, disabled, disabled + " add-ons disabled by version change");
if (metaenabled !== undefined)
is(am.appUpdate_metadata_enabled, metaenabled, metaenabled + " add-ons enabled by metadata");
if (metadisabled !== undefined)
is(am.appUpdate_metadata_disabled, metadisabled, metadisabled + " add-ons disabled by metadata");
if (upgraded !== undefined)
is(am.appUpdate_upgraded, upgraded, upgraded + " add-ons upgraded");
if (failed !== undefined)
is(am.appUpdate_upgradeFailed, failed, failed + " upgrades failed");
if (declined !== undefined)
is(am.appUpdate_upgradeDeclined, declined, declined + " upgrades declined");
}
add_test(function test_setup() {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
registerCleanupFunction(function () {
Services.telemetry.canRecordExtended = oldCanRecord;
});
run_next_test();
});
// Tests that the right add-ons show up in the mismatch dialog and updates can
// be installed
add_test(function basic_mismatch() {
install_test_addons(function() {
// These add-ons become disabled
var disabledAddonIds = [
"bug557956-3@tests.mozilla.org",
"bug557956-6@tests.mozilla.org",
"bug557956-7@tests.mozilla.org",
"bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org"
];
AddonManager.getAddonsByIDs(["bug557956-5@tests.mozilla.org",
"bug557956-6@tests.mozilla.org"],
function([a5, a6]) {
// Check starting (pre-update) conditions
ok(!a5.isCompatible, "bug557956-5 should not be compatible");
ok(!a6.isCompatible, "bug557956-6 should not be compatible");
open_compatibility_window(disabledAddonIds, function(aWindow) {
var doc = aWindow.document;
wait_for_page(aWindow, "mismatch", function(aWindow) {
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
// Check that compatibility updates from individual add-on update checks were applied.
is(items.length, 4, "Should have seen 4 still incompatible items");
is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
is(items[1], "Addon7 1.0", "Should have seen addon7 still incompatible");
is(items[2], "Addon8 1.0", "Should have seen addon8 still incompatible");
is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
// If it wasn't disabled by this run, we don't try to enable it
ok(!a5.isCompatible, "bug557956-5 should not be compatible");
ok(a6.isCompatible, "bug557956-6 should be compatible");
var button = doc.documentElement.getButton("next");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_page(aWindow, "found", function(aWindow) {
ok(doc.getElementById("xpinstallDisabledAlert").hidden,
"Install should be allowed");
var list = doc.getElementById("found.updates");
var items = get_list_names(list);
is(items.length, 3, "Should have seen 3 updates available");
is(items[0], "Addon7 2.0", "Should have seen update for addon7");
is(items[1], "Addon8 2.0", "Should have seen update for addon8");
is(items[2], "Addon9 2.0", "Should have seen update for addon9");
ok(!doc.documentElement.getButton("next").disabled,
"Next button should be enabled");
// Uncheck all
for (let listItem of list.childNodes)
EventUtils.synthesizeMouse(listItem, 2, 2, { }, aWindow);
ok(doc.documentElement.getButton("next").disabled,
"Next button should not be enabled");
// Check the ones we want to install
for (let listItem of list.childNodes) {
if (listItem.label != "Addon7 2.0")
EventUtils.synthesizeMouse(listItem, 2, 2, { }, aWindow);
}
var button = doc.documentElement.getButton("next");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_page(aWindow, "finished", function(aWindow) {
var button = doc.documentElement.getButton("finish");
ok(!button.hidden, "Finish button should not be hidden");
ok(!button.disabled, "Finish button should not be disabled");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_window_close(aWindow, function() {
AddonManager.getAddonsByIDs(["bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org"],
function([a8, a9]) {
is(a8.version, "2.0", "bug557956-8 should have updated");
is(a9.version, "2.0", "bug557956-9 should have updated");
check_telemetry({disabled: 5, metaenabled: 1, metadisabled: 0,
upgraded: 2, failed: 0, declined: 1});
uninstall_test_addons(run_next_test);
});
});
});
});
});
});
});
});
});
// Tests that the install failures show the install failed page and disabling
// xpinstall shows the right UI.
add_test(function failure_page() {
install_test_addons(function() {
// These add-ons become disabled
var disabledAddonIds = [
"bug557956-3@tests.mozilla.org",
"bug557956-6@tests.mozilla.org",
"bug557956-7@tests.mozilla.org",
"bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org"
];
Services.prefs.setBoolPref("xpinstall.enabled", false);
open_compatibility_window(disabledAddonIds, function(aWindow) {
var doc = aWindow.document;
wait_for_page(aWindow, "mismatch", function(aWindow) {
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
is(items.length, 4, "Should have seen 4 still incompatible items");
is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
is(items[1], "Addon7 1.0", "Should have seen addon7 still incompatible");
is(items[2], "Addon8 1.0", "Should have seen addon8 still incompatible");
is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
// Check that compatibility updates were applied.
AddonManager.getAddonsByIDs(["bug557956-5@tests.mozilla.org",
"bug557956-6@tests.mozilla.org"],
function([a5, a6]) {
ok(!a5.isCompatible, "bug557956-5 should not be compatible");
ok(a6.isCompatible, "bug557956-6 should be compatible");
var button = doc.documentElement.getButton("next");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_page(aWindow, "found", function(aWindow) {
ok(!doc.getElementById("xpinstallDisabledAlert").hidden,
"Install should not be allowed");
ok(doc.documentElement.getButton("next").disabled,
"Next button should be disabled");
var checkbox = doc.getElementById("enableXPInstall");
EventUtils.synthesizeMouse(checkbox, 2, 2, { }, aWindow);
ok(!doc.documentElement.getButton("next").disabled,
"Next button should be enabled");
var list = doc.getElementById("found.updates");
var items = get_list_names(list);
is(items.length, 3, "Should have seen 3 updates available");
is(items[0], "Addon7 2.0", "Should have seen update for addon7");
is(items[1], "Addon8 2.0", "Should have seen update for addon8");
is(items[2], "Addon9 2.0", "Should have seen update for addon9");
// Unheck the ones we don't want to install
for (let listItem of list.childNodes) {
if (listItem.label != "Addon7 2.0")
EventUtils.synthesizeMouse(listItem, 2, 2, { }, aWindow);
}
var button = doc.documentElement.getButton("next");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_page(aWindow, "installerrors", function(aWindow) {
var button = doc.documentElement.getButton("finish");
ok(!button.hidden, "Finish button should not be hidden");
ok(!button.disabled, "Finish button should not be disabled");
wait_for_window_close(aWindow, function() {
uninstall_test_addons(run_next_test);
});
check_telemetry({disabled: 5, metaenabled: 1, metadisabled: 0,
upgraded: 0, failed: 1, declined: 2});
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
});
});
});
});
});
});
});
// Tests that no add-ons show up in the mismatch dialog when they are all disabled
add_test(function all_disabled() {
install_test_addons(function() {
AddonManager.getAddonsByIDs(["bug557956-1@tests.mozilla.org",
"bug557956-2@tests.mozilla.org",
"bug557956-3@tests.mozilla.org",
"bug557956-4@tests.mozilla.org",
"bug557956-5@tests.mozilla.org",
"bug557956-6@tests.mozilla.org",
"bug557956-7@tests.mozilla.org",
"bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org",
"bug557956-10@tests.mozilla.org"],
function(aAddons) {
for (let addon of aAddons)
addon.userDisabled = true;
open_compatibility_window([], function(aWindow) {
// Should close immediately on its own
wait_for_window_close(aWindow, function() {
uninstall_test_addons(run_next_test);
});
});
});
});
});
// Tests that the right UI shows for when no updates are available
add_test(function no_updates() {
install_test_addons(function() {
AddonManager.getAddonsByIDs(["bug557956-7@tests.mozilla.org",
"bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org",
"bug557956-10@tests.mozilla.org"],
function(aAddons) {
for (let addon of aAddons)
addon.uninstall();
// These add-ons were disabled by the upgrade
var inactiveAddonIds = [
"bug557956-3@tests.mozilla.org",
"bug557956-5@tests.mozilla.org",
"bug557956-6@tests.mozilla.org"
];
open_compatibility_window(inactiveAddonIds, function(aWindow) {
var doc = aWindow.document;
wait_for_page(aWindow, "mismatch", function(aWindow) {
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
is(items.length, 1, "Should have seen 1 still incompatible items");
is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
var button = doc.documentElement.getButton("next");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_page(aWindow, "noupdates", function(aWindow) {
var button = doc.documentElement.getButton("finish");
ok(!button.hidden, "Finish button should not be hidden");
ok(!button.disabled, "Finish button should not be disabled");
wait_for_window_close(aWindow, function() {
uninstall_test_addons(run_next_test);
});
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
});
});
});
});
});
});
// Tests that compatibility overrides are retrieved and affect addon
// compatibility.
add_test(function overrides_retrieved() {
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
Services.prefs.setCharPref(PREF_MIN_APP_COMPAT, "0");
Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
is(AddonManager.strictCompatibility, false, "Strict compatibility should be disabled");
// Use a blank update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
install_test_addons(function() {
AddonManager.getAddonsByIDs(["bug557956-1@tests.mozilla.org",
"bug557956-2@tests.mozilla.org",
"bug557956-3@tests.mozilla.org",
"bug557956-4@tests.mozilla.org",
"bug557956-5@tests.mozilla.org",
"bug557956-6@tests.mozilla.org",
"bug557956-7@tests.mozilla.org",
"bug557956-8@tests.mozilla.org",
"bug557956-9@tests.mozilla.org",
"bug557956-10@tests.mozilla.org"],
function(aAddons) {
for (let addon of aAddons) {
if (addon.id == "bug557956-10@tests.mozilla.org")
is(addon.isCompatible, true, "Addon10 should be compatible before compat overrides are refreshed");
else
addon.uninstall();
}
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, TESTROOT + "browser_bug557956.xml");
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
open_compatibility_window([], function(aWindow) {
var doc = aWindow.document;
wait_for_page(aWindow, "mismatch", function(aWindow) {
var items = get_list_names(doc.getElementById("mismatch.incompatible"));
is(items.length, 1, "Should have seen 1 incompatible item");
is(items[0], "Addon10 1.0", "Should have seen addon10 as incompatible");
var button = doc.documentElement.getButton("next");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
wait_for_page(aWindow, "noupdates", function(aWindow) {
var button = doc.documentElement.getButton("finish");
ok(!button.hidden, "Finish button should not be hidden");
ok(!button.disabled, "Finish button should not be disabled");
wait_for_window_close(aWindow, function() {
uninstall_test_addons(run_next_test);
});
check_telemetry({disabled: 0, metaenabled: 0, metadisabled: 1,
upgraded: 0, failed: 0, declined: 0});
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
});
});
});
});
});
});

View file

@ -0,0 +1,310 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<RDF:Description about="urn:mozilla:extension:bug557956-1@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-2@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-3@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-4@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-5@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-6@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-7@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_bug557956_7_2.xpi</em:updateLink>
<em:updateHash>sha1:18674cf7ad76664e0ead6280a43cc0c681180505</em:updateHash>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_bug557956_7_2.xpi</em:updateLink>
<em:updateHash>sha1:18674cf7ad76664e0ead6280a43cc0c681180505</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-8@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_bug557956_8_2.xpi</em:updateLink>
<em:updateHash>sha1:5691c398e55ddf93aa1076b9820619d21d40acbc</em:updateHash>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_bug557956_8_2.xpi</em:updateLink>
<em:updateHash>sha1:5691c398e55ddf93aa1076b9820619d21d40acbc</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug557956-9@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>1.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>0</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_bug557956_9_2.xpi</em:updateLink>
<em:updateHash>sha1:1ae63bfc6f67a4503a1ff1bd02402c98fef19ae3</em:updateHash>
</RDF:Description>
</em:targetApplication>
<em:targetApplication>
<RDF:Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>http://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_bug557956_9_2.xpi</em:updateLink>
<em:updateHash>sha1:1ae63bfc6f67a4503a1ff1bd02402c98fef19ae3</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
</RDF:RDF>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<searchresults total_results="1">
<addon_compatibility hosted="false">
<guid>bug557956-10@tests.mozilla.org</guid>
<name>Addon10</name>
<version_ranges>
<version_range type="incompatible">
<min_version>1.0</min_version>
<max_version>2.0</max_version>
<compatible_applications>
<application>
<min_version>0.1</min_version>
<max_version>999.0</max_version>
<appID>toolkit@mozilla.org</appID>
</application>
</compatible_applications>
</version_range>
</version_ranges>
</addon_compatibility>
</searchresults>

View file

@ -0,0 +1,975 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Tests that history navigation works for the add-ons manager.
*/
const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
const SECOND_URL = "https://example.com/" + RELATIVE_DIR + "releaseNotes.xhtml";
var gLoadCompleteCallback = null;
var gProgressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
// Only care about the network stop status events
if (!(aStateFlags & (Ci.nsIWebProgressListener.STATE_IS_NETWORK)) ||
!(aStateFlags & (Ci.nsIWebProgressListener.STATE_STOP)))
return;
if (gLoadCompleteCallback)
executeSoon(gLoadCompleteCallback);
gLoadCompleteCallback = null;
},
onLocationChange: function() { },
onSecurityChange: function() { },
onProgressChange: function() { },
onStatusChange: function() { },
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference]),
};
function waitForLoad(aManager, aCallback) {
var browser = aManager.document.getElementById("discover-browser");
browser.addProgressListener(gProgressListener);
gLoadCompleteCallback = function() {
browser.removeProgressListener(gProgressListener);
aCallback();
};
}
function clickLink(aManager, aId, aCallback) {
waitForLoad(aManager, aCallback);
var browser = aManager.document.getElementById("discover-browser");
var link = browser.contentDocument.getElementById(aId);
EventUtils.sendMouseEvent({type: "click"}, link);
}
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
Services.prefs.setCharPref(PREF_DISCOVERURL, MAIN_URL);
SpecialPowers.pushPrefEnv({"set": [
["dom.ipc.processCount", 1],
]}, () => {
var gProvider = new MockProvider();
gProvider.createAddons([{
id: "test1@tests.mozilla.org",
name: "Test add-on 1",
description: "foo"
},
{
id: "test2@tests.mozilla.org",
name: "Test add-on 2",
description: "bar"
},
{
id: "test3@tests.mozilla.org",
name: "Test add-on 3",
type: "theme",
description: "bar"
}]);
});
run_next_test();
}
function end_test() {
finish();
}
function go_back(aManager) {
if (gUseInContentUI) {
gBrowser.goBack();
} else {
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("back-btn"),
{ }, aManager);
}
}
function go_back_backspace(aManager) {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
}
function go_forward_backspace(aManager) {
EventUtils.synthesizeKey("VK_BACK_SPACE", {shiftKey: true});
}
function go_forward(aManager) {
if (gUseInContentUI) {
gBrowser.goForward();
} else {
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("forward-btn"),
{ }, aManager);
}
}
function check_state(aManager, canGoBack, canGoForward) {
var doc = aManager.document;
if (gUseInContentUI) {
is(gBrowser.canGoBack, canGoBack, "canGoBack should be correct");
is(gBrowser.canGoForward, canGoForward, "canGoForward should be correct");
}
if (!is_hidden(doc.getElementById("back-btn"))) {
is(!doc.getElementById("back-btn").disabled, canGoBack, "Back button should have the right state");
is(!doc.getElementById("forward-btn").disabled, canGoForward, "Forward button should have the right state");
}
}
function is_in_list(aManager, view, canGoBack, canGoForward) {
var doc = aManager.document;
is(doc.getElementById("categories").selectedItem.value, view, "Should be on the right category");
is(get_current_view(aManager).id, "list-view", "Should be on the right view");
check_state(aManager, canGoBack, canGoForward);
}
function is_in_search(aManager, query, canGoBack, canGoForward) {
var doc = aManager.document;
is(doc.getElementById("categories").selectedItem.value, "addons://search/", "Should be on the right category");
is(get_current_view(aManager).id, "search-view", "Should be on the right view");
is(doc.getElementById("header-search").value, query, "Should have used the right query");
check_state(aManager, canGoBack, canGoForward);
}
function is_in_detail(aManager, view, canGoBack, canGoForward) {
var doc = aManager.document;
is(doc.getElementById("categories").selectedItem.value, view, "Should be on the right category");
is(get_current_view(aManager).id, "detail-view", "Should be on the right view");
check_state(aManager, canGoBack, canGoForward);
}
function is_in_discovery(aManager, url, canGoBack, canGoForward) {
var browser = aManager.document.getElementById("discover-browser");
is(aManager.document.getElementById("discover-view").selectedPanel, browser,
"Browser should be visible");
var spec = browser.currentURI.spec;
var pos = spec.indexOf("#");
if (pos != -1)
spec = spec.substring(0, pos);
is(spec, url, "Should have loaded the right url");
check_state(aManager, canGoBack, canGoForward);
}
function double_click_addon_element(aManager, aId) {
var addon = get_addon_element(aManager, aId);
addon.parentNode.ensureElementIsVisible(addon);
EventUtils.synthesizeMouseAtCenter(addon, { clickCount: 1 }, aManager);
EventUtils.synthesizeMouseAtCenter(addon, { clickCount: 2 }, aManager);
}
// Tests simple forward and back navigation and that the right heading and
// category is selected
add_test(function() {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/extension", false, true);
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 5");
is_in_list(aManager, "addons://list/extension", false, true);
double_click_addon_element(aManager, "test1@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 6");
is_in_detail(aManager, "addons://list/extension", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 7");
is_in_list(aManager, "addons://list/extension", false, true);
close_manager(aManager, run_next_test);
});
});
});
});
});
});
});
});
// Tests that browsing to the add-ons manager from a website and going back works
// Only relevant for in-content UI
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
function promiseViewLoad(manager) {
return new Promise(resolve => {
wait_for_view_load(manager, resolve);
});
}
function promiseManagerLoaded(manager) {
return new Promise(resolve => {
wait_for_manager_load(manager, resolve);
});
}
Task.spawn(function*() {
info("Part 1");
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/", true, true);
info("Part 2");
ok(!gBrowser.canGoBack, "Should not be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
yield BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:addons");
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
let manager = yield promiseManagerLoaded(gBrowser.contentWindow.wrappedJSObject);
info("Part 3");
is_in_list(manager, "addons://list/extension", true, false);
// XXX: This is less than ideal, as it's currently difficult to deal with
// the browser frame switching between remote/non-remote in e10s mode.
let promiseLoaded;
if (gMultiProcessBrowser) {
promiseLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
} else {
promiseLoaded = BrowserTestUtils.waitForEvent(gBrowser.selectedBrowser, "pageshow");
}
go_back(manager);
yield promiseLoaded;
info("Part 4");
is(gBrowser.currentURI.spec, "http://example.com/", "Should be showing the webpage");
ok(!gBrowser.canGoBack, "Should not be able to go back");
ok(gBrowser.canGoForward, "Should be able to go forward");
promiseLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
go_forward(manager);
yield promiseLoaded;
manager = yield promiseManagerLoaded(gBrowser.contentWindow.wrappedJSObject);
info("Part 5");
is_in_list(manager, "addons://list/extension", true, false);
close_manager(manager, run_next_test);
});
});
// Tests simple forward and back navigation and that the right heading and
// category is selected -- Keyboard navigation [Bug 565359]
// Only add the test if the backspace key navigates back and addon-manager
// loaded in a tab
add_test(function() {
if (!gUseInContentUI || (Services.prefs.getIntPref("browser.backspace_action") != 0)) {
run_next_test();
return;
}
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back_backspace(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/extension", false, true);
go_forward_backspace(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back_backspace(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 5");
is_in_list(aManager, "addons://list/extension", false, true);
double_click_addon_element(aManager, "test1@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 6");
is_in_detail(aManager, "addons://list/extension", true, false);
go_back_backspace(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 7");
is_in_list(aManager, "addons://list/extension", false, true);
close_manager(aManager, run_next_test);
});
});
});
});
});
});
});
});
// Tests that opening a custom first view only stores a single history entry
add_test(function() {
open_manager("addons://list/plugin", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/plugin", false, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-extension"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/extension", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", false, true);
close_manager(aManager, run_next_test);
});
});
});
});
// Tests that opening a view while the manager is already open adds a new
// history entry
add_test(function() {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
aManager.loadView("addons://list/plugin");
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/extension", false, true);
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/plugin", true, false);
close_manager(aManager, run_next_test);
});
});
});
});
});
// Tests than navigating to a website and then going back returns to the
// previous view
// Only relevant for in-content UI
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
open_manager("addons://list/plugin", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/plugin", false, false);
gBrowser.loadURI("http://example.com/");
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "http://example.com/")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
info("Part 2");
executeSoon(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
go_back(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", false, true);
executeSoon(() => go_forward(aManager));
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "http://example.com/")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
info("Part 4");
executeSoon(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
go_back(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 5");
is_in_list(aManager, "addons://list/plugin", false, true);
close_manager(aManager, run_next_test);
});
}, false);
});
}, false);
});
}, false);
});
}, false);
});
});
// Tests that going back to search results works
add_test(function() {
// Before we open the add-ons manager, we should make sure that no filter
// has been set. If one is set, we remove it.
// This is for the check below, from bug 611459.
let store = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
store.removeValue("about:addons", "search-filter-radiogroup", "value");
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
var search = aManager.document.getElementById("header-search");
search.focus();
search.value = "bar";
EventUtils.synthesizeKey("VK_RETURN", {}, aManager);
wait_for_view_load(aManager, function(aManager) {
// Remote search is meant to be checked by default (bug 611459), so we
// confirm that and then switch to a local search.
var localFilter = aManager.document.getElementById("search-filter-local");
var remoteFilter = aManager.document.getElementById("search-filter-remote");
is(remoteFilter.selected, true, "Remote filter should be set by default");
var list = aManager.document.getElementById("search-list");
list.ensureElementIsVisible(localFilter);
EventUtils.synthesizeMouseAtCenter(localFilter, { }, aManager);
is(localFilter.selected, true, "Should have changed to local filter");
// Now we continue with the normal test.
info("Part 2");
is_in_search(aManager, "bar", true, false);
check_all_in_list(aManager, ["test2@tests.mozilla.org", "test3@tests.mozilla.org"]);
double_click_addon_element(aManager, "test2@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_detail(aManager, "addons://search/", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_search(aManager, "bar", true, true);
check_all_in_list(aManager, ["test2@tests.mozilla.org", "test3@tests.mozilla.org"]);
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 5");
is_in_detail(aManager, "addons://search/", true, false);
close_manager(aManager, run_next_test);
});
});
});
});
});
});
// Tests that going back from a webpage to a detail view loaded from a search
// result works
// Only relevant for in-content UI
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
var search = aManager.document.getElementById("header-search");
search.focus();
search.value = "bar";
EventUtils.synthesizeKey("VK_RETURN", {});
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_search(aManager, "bar", true, false);
check_all_in_list(aManager, ["test2@tests.mozilla.org", "test3@tests.mozilla.org"]);
double_click_addon_element(aManager, "test2@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_detail(aManager, "addons://search/", true, false);
gBrowser.loadURI("http://example.com/");
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "http://example.com/")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
info("Part 4");
executeSoon(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
go_back(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 5");
is_in_detail(aManager, "addons://search/", true, true);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 6");
is_in_search(aManager, "bar", true, true);
check_all_in_list(aManager, ["test2@tests.mozilla.org", "test3@tests.mozilla.org"]);
close_manager(aManager, run_next_test);
});
});
}, false);
});
}, false);
});
});
});
});
// Tests that refreshing a list view does not affect the history
// Only relevant for in-content UI
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
gBrowser.reload();
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/extension", false, true);
close_manager(aManager, run_next_test);
});
});
}, false);
});
});
});
// Tests that refreshing a detail view does not affect the history
// Only relevant for in-content UI
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
open_manager(null, function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
double_click_addon_element(aManager, "test1@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_detail(aManager, "addons://list/extension", true, false);
gBrowser.reload();
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 3");
is_in_detail(aManager, "addons://list/extension", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/extension", false, true);
close_manager(aManager, run_next_test);
});
});
}, false);
});
});
});
// Tests that removing an extension from the detail view goes back and doesn't
// allow you to go forward again.
add_test(function() {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
double_click_addon_element(aManager, "test1@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_detail(aManager, "addons://list/extension", true, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("detail-uninstall-btn"),
{ }, aManager);
wait_for_view_load(aManager, function() {
if (gUseInContentUI) {
// TODO until bug 590661 is fixed the back button will be enabled
// when displaying in content
is_in_list(aManager, "addons://list/extension", true, false);
} else {
is_in_list(aManager, "addons://list/extension", false, false);
}
close_manager(aManager, run_next_test);
});
});
});
});
// Tests that the back and forward buttons only show up for windowed mode
add_test(function() {
open_manager(null, function(aManager) {
var doc = aManager.document;
if (gUseInContentUI) {
var btn = document.getElementById("back-button");
if (!btn || is_hidden(btn)) {
is_element_visible(doc.getElementById("back-btn"), "Back button should not be hidden");
is_element_visible(doc.getElementById("forward-btn"), "Forward button should not be hidden");
} else {
is_element_hidden(doc.getElementById("back-btn"), "Back button should be hidden");
is_element_hidden(doc.getElementById("forward-btn"), "Forward button should be hidden");
}
} else {
is_element_visible(doc.getElementById("back-btn"), "Back button should not be hidden");
is_element_visible(doc.getElementById("forward-btn"), "Forward button should not be hidden");
}
close_manager(aManager, run_next_test);
});
});
// Tests that opening the manager opens the last view
add_test(function() {
open_manager("addons://list/plugin", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/plugin", false, false);
close_manager(aManager, function() {
open_manager(null, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", false, false);
close_manager(aManager, run_next_test);
});
});
});
});
// Tests that navigating the discovery page works when that was the first view
add_test(function() {
open_manager("addons://discover/", function(aManager) {
info("1");
is_in_discovery(aManager, MAIN_URL, false, false);
clickLink(aManager, "link-good", function() {
info("2");
is_in_discovery(aManager, SECOND_URL, true, false);
waitForLoad(aManager, function() {
info("3");
is_in_discovery(aManager, MAIN_URL, false, true);
waitForLoad(aManager, function() {
is_in_discovery(aManager, SECOND_URL, true, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_list(aManager, "addons://list/plugin", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_discovery(aManager, SECOND_URL, true, true);
go_back(aManager);
waitForLoad(aManager, function() {
is_in_discovery(aManager, MAIN_URL, false, true);
close_manager(aManager, run_next_test);
});
});
});
});
go_forward(aManager);
});
go_back(aManager);
});
});
});
// Tests that navigating the discovery page works when that was the second view
add_test(function() {
open_manager("addons://list/plugin", function(aManager) {
is_in_list(aManager, "addons://list/plugin", false, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-discover"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_discovery(aManager, MAIN_URL, true, false);
clickLink(aManager, "link-good", function() {
is_in_discovery(aManager, SECOND_URL, true, false);
waitForLoad(aManager, function() {
is_in_discovery(aManager, MAIN_URL, true, true);
waitForLoad(aManager, function() {
is_in_discovery(aManager, SECOND_URL, true, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_list(aManager, "addons://list/plugin", true, false);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_discovery(aManager, SECOND_URL, true, true);
go_back(aManager);
waitForLoad(aManager, function() {
is_in_discovery(aManager, MAIN_URL, true, true);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_list(aManager, "addons://list/plugin", false, true);
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_discovery(aManager, MAIN_URL, true, true);
waitForLoad(aManager, function() {
is_in_discovery(aManager, SECOND_URL, true, true);
close_manager(aManager, run_next_test);
});
go_forward(aManager);
});
});
});
});
});
});
go_forward(aManager);
});
go_back(aManager);
});
});
});
});
// Tests that when displaying in-content and opened in the background the back
// and forward buttons still appear when switching tabs
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
var tab = gBrowser.addTab("about:addons");
var browser = gBrowser.getBrowserForTab(tab);
browser.addEventListener("pageshow", function(event) {
if (event.target.location.href != "about:addons")
return;
browser.removeEventListener("pageshow", arguments.callee, true);
wait_for_manager_load(browser.contentWindow.wrappedJSObject, function() {
wait_for_view_load(browser.contentWindow.wrappedJSObject, function(aManager) {
gBrowser.selectedTab = tab;
var doc = aManager.document;
var btn = document.getElementById("back-button");
if (!btn || is_hidden(btn)) {
is_element_visible(doc.getElementById("back-btn"), "Back button should not be hidden");
is_element_visible(doc.getElementById("forward-btn"), "Forward button should not be hidden");
} else {
is_element_hidden(doc.getElementById("back-btn"), "Back button should be hidden");
is_element_hidden(doc.getElementById("forward-btn"), "Forward button should be hidden");
}
close_manager(aManager, run_next_test);
});
});
}, true);
});
// Tests that refreshing the disicovery pane integrates properly with history
add_test(function() {
open_manager("addons://list/plugin", function(aManager) {
is_in_list(aManager, "addons://list/plugin", false, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-discover"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_discovery(aManager, MAIN_URL, true, false);
clickLink(aManager, "link-good", function() {
is_in_discovery(aManager, SECOND_URL, true, false);
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-discover"), { }, aManager);
waitForLoad(aManager, function() {
is_in_discovery(aManager, MAIN_URL, true, false);
go_back(aManager);
waitForLoad(aManager, function() {
is_in_discovery(aManager, SECOND_URL, true, true);
go_back(aManager);
waitForLoad(aManager, function() {
is_in_discovery(aManager, MAIN_URL, true, true);
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_list(aManager, "addons://list/plugin", false, true);
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
is_in_discovery(aManager, MAIN_URL, true, true);
waitForLoad(aManager, function() {
is_in_discovery(aManager, SECOND_URL, true, true);
waitForLoad(aManager, function() {
is_in_discovery(aManager, MAIN_URL, true, false);
close_manager(aManager, run_next_test);
});
go_forward(aManager);
});
go_forward(aManager);
});
});
});
});
});
});
});
});
});

View file

@ -0,0 +1,129 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Tests that double-click does not go to detail view if the target is a link or button.
*/
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
var gProvider = new MockProvider();
gProvider.createAddons([{
id: "test1@tests.mozilla.org",
name: "Test add-on 1",
description: "foo",
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
}]);
run_next_test();
}
function end_test() {
finish();
}
function is_in_list(aManager, view) {
var doc = aManager.document;
is(doc.getElementById("categories").selectedItem.value, view, "Should be on the right category");
is(get_current_view(aManager).id, "list-view", "Should be on the right view");
}
function is_in_detail(aManager, view) {
var doc = aManager.document;
is(doc.getElementById("categories").selectedItem.value, view, "Should be on the right category");
is(get_current_view(aManager).id, "detail-view", "Should be on the right view");
}
// Check that double-click does something.
add_test(function() {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension");
var addon = get_addon_element(aManager, "test1@tests.mozilla.org");
addon.parentNode.ensureElementIsVisible(addon);
EventUtils.synthesizeMouseAtCenter(addon, { clickCount: 1 }, aManager);
EventUtils.synthesizeMouseAtCenter(addon, { clickCount: 2 }, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_detail(aManager, "addons://list/extension");
close_manager(aManager, run_next_test);
});
});
});
// Check that double-click does nothing when over the disable button.
add_test(function() {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension");
var addon = get_addon_element(aManager, "test1@tests.mozilla.org");
addon.parentNode.ensureElementIsVisible(addon);
EventUtils.synthesizeMouseAtCenter(
aManager.document.getAnonymousElementByAttribute(addon, "anonid", "disable-btn"),
{ clickCount: 1 },
aManager
);
// The disable button is replaced by the enable button when clicked on.
EventUtils.synthesizeMouseAtCenter(
aManager.document.getAnonymousElementByAttribute(addon, "anonid", "enable-btn"),
{ clickCount: 2 },
aManager
);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/extension");
close_manager(aManager, run_next_test);
});
});
});
// Check that double-click does nothing when over the undo button.
add_test(function() {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension");
var addon = get_addon_element(aManager, "test1@tests.mozilla.org");
addon.parentNode.ensureElementIsVisible(addon);
EventUtils.synthesizeMouseAtCenter(
aManager.document.getAnonymousElementByAttribute(addon, "anonid", "remove-btn"),
{ clickCount: 1 },
aManager
);
// The undo button is removed when clicked on.
// We need to wait for the UI to catch up.
setTimeout(function() {
var target = aManager.document.getAnonymousElementByAttribute(addon, "anonid", "undo-btn");
var rect = target.getBoundingClientRect();
var addonRect = addon.getBoundingClientRect();
EventUtils.synthesizeMouse(target, rect.width / 2, rect.height / 2, { clickCount: 1 }, aManager);
EventUtils.synthesizeMouse(addon,
rect.left - addonRect.left + rect.width / 2,
rect.top - addonRect.top + rect.height / 2,
{ clickCount: 2 },
aManager
);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/extension");
close_manager(aManager, run_next_test);
});
}, 0);
});
});

View file

@ -0,0 +1,78 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Tests the Preferences button for addons in list view
*/
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
var addonPrefsURI = CHROMEROOT + "addon_prefs.xul";
var gProvider = new MockProvider();
gProvider.createAddons([{
id: "test1@tests.mozilla.org",
name: "Test add-on 1",
description: "foo"
},
{
id: "test2@tests.mozilla.org",
name: "Test add-on 2",
description: "bar",
optionsURL: addonPrefsURI
}]);
open_manager("addons://list/extension", function(aManager) {
var addonList = aManager.document.getElementById("addon-list");
for (var addonItem of addonList.childNodes) {
if (addonItem.hasAttribute("name") &&
addonItem.getAttribute("name") == "Test add-on 1")
break;
}
var prefsBtn = aManager.document.getAnonymousElementByAttribute(addonItem,
"anonid",
"preferences-btn");
is(prefsBtn.hidden, true, "Prefs button should be hidden for addon with no optionsURL set")
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")
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, false);
is(win.location, addonPrefsURI,
"The correct addon pref window should have opened");
win.close();
}, false);
}
});
addonList.ensureElementIsVisible(addonItem);
EventUtils.synthesizeMouseAtCenter(prefsBtn, { }, aManager);
});
}

View file

@ -0,0 +1,88 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Simulates quickly switching between different list views to verify that only
// the last selected is displayed
var tempScope = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", tempScope);
var LightweightThemeManager = tempScope.LightweightThemeManager;
const xpi = "browser/toolkit/mozapps/extensions/test/browser/browser_installssl.xpi";
var gManagerWindow;
var gCategoryUtilities;
function test() {
waitForExplicitFinish();
// Add a lightweight theme so at least one theme exists
LightweightThemeManager.currentTheme = {
id: "test",
name: "Test lightweight theme",
headerURL: "http://example.com/header.png"
};
open_manager(null, function(aWindow) {
gManagerWindow = aWindow;
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
run_next_test();
});
}
function end_test() {
close_manager(gManagerWindow, function() {
LightweightThemeManager.forgetUsedTheme("test");
finish();
});
}
// Tests that loading a second view before the first has not finished loading
// does not merge the results
add_test(function() {
var themeCount = null;
var pluginCount = null;
var themeItem = gCategoryUtilities.get("theme");
var pluginItem = gCategoryUtilities.get("plugin");
var list = gManagerWindow.document.getElementById("addon-list");
gCategoryUtilities.open(themeItem, function() {
themeCount = list.childNodes.length;
ok(themeCount > 0, "Test is useless if there are no themes");
gCategoryUtilities.open(pluginItem, function() {
pluginCount = list.childNodes.length;
ok(pluginCount > 0, "Test is useless if there are no plugins");
gCategoryUtilities.open(themeItem);
gCategoryUtilities.open(pluginItem, function() {
is(list.childNodes.length, pluginCount, "Should only see the plugins");
var item = list.firstChild;
while (item) {
is(item.getAttribute("type"), "plugin", "All items should be plugins");
item = item.nextSibling;
}
// Tests that switching to, from, to the same pane in quick succession
// still only shows the right number of results
gCategoryUtilities.open(themeItem);
gCategoryUtilities.open(pluginItem);
gCategoryUtilities.open(themeItem, function() {
is(list.childNodes.length, themeCount, "Should only see the theme");
var item = list.firstChild;
while (item) {
is(item.getAttribute("type"), "theme", "All items should be theme");
item = item.nextSibling;
}
run_next_test();
});
});
});
});
});

View file

@ -0,0 +1,70 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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 test ensures that when the extension manager UI is open and a
* restartless extension is installed from the web, its correct name appears
* when the download and installation complete. See bug 562992.
*/
var gManagerWindow;
var gProvider;
var gInstall;
const EXTENSION_NAME = "Wunderbar";
function test() {
waitForExplicitFinish();
gProvider = new MockProvider();
open_manager("addons://list/extension", function (aWindow) {
gManagerWindow = aWindow;
run_next_test();
});
}
function end_test() {
close_manager(gManagerWindow, function () {
finish();
});
}
// Create a MockInstall with a MockAddon payload and add it to the provider,
// causing the onNewInstall event to fire, which in turn will cause a new
// "installing" item to appear in the list of extensions.
add_test(function () {
let addon = new MockAddon(undefined, EXTENSION_NAME, "extension", true);
gInstall = new MockInstall(undefined, undefined, addon);
gInstall.addTestListener({
onNewInstall: run_next_test
});
gProvider.addInstall(gInstall);
});
// Finish the install, which will cause the "installing" item to be converted
// to an "installed" item, which should have the correct add-on name.
add_test(function () {
gInstall.addTestListener({
onInstallEnded: function () {
let list = gManagerWindow.document.getElementById("addon-list");
// To help prevent future breakage, don't assume the item is the only one
// in the list, or that it's first in the list. Find it by name.
for (let i = 0; i < list.itemCount; i++) {
let item = list.getItemAtIndex(i);
if (item.getAttribute("name") === EXTENSION_NAME) {
ok(true, "Item with correct name found");
run_next_test();
return;
}
}
ok(false, "Item with correct name was not found");
run_next_test();
}
});
gInstall.install();
});

View file

@ -0,0 +1,136 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests bug 567127 - Add install button to the add-ons manager
var MockFilePicker = SpecialPowers.MockFilePicker;
MockFilePicker.init(window);
var gManagerWindow;
var gSawInstallNotification = false;
// This listens for the next opened window and checks it is of the right url.
// opencallback is called when the new window is fully loaded
// closecallback is called when the window is closed
function WindowOpenListener(url, opencallback, closecallback) {
this.url = url;
this.opencallback = opencallback;
this.closecallback = closecallback;
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
wm.addListener(this);
}
WindowOpenListener.prototype = {
url: null,
opencallback: null,
closecallback: null,
window: null,
domwindow: null,
handleEvent: function(event) {
is(this.domwindow.document.location.href, this.url, "Should have opened the correct window");
this.domwindow.removeEventListener("load", this, false);
// Allow any other load handlers to execute
var self = this;
executeSoon(function() { self.opencallback(self.domwindow); } );
},
onWindowTitleChange: function(window, title) {
},
onOpenWindow: function(window) {
if (this.window)
return;
this.window = window;
this.domwindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
this.domwindow.addEventListener("load", this, false);
},
onCloseWindow: function(window) {
if (this.window != window)
return;
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
wm.removeListener(this);
this.opencallback = null;
this.window = null;
this.domwindow = null;
// Let the window close complete
executeSoon(this.closecallback);
this.closecallback = null;
}
};
var gInstallNotificationObserver = {
observe: function(aSubject, aTopic, aData) {
var installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
if (gTestInWindow)
is(installInfo.browser, null, "Notification should have a null browser");
else
isnot(installInfo.browser, null, "Notification should have non-null browser");
gSawInstallNotification = true;
Services.obs.removeObserver(this, "addon-install-started");
}
};
function test_confirmation(aWindow, aExpectedURLs) {
var list = aWindow.document.getElementById("itemList");
is(list.childNodes.length, aExpectedURLs.length, "Should be the right number of installs");
for (let url of aExpectedURLs) {
let found = false;
for (let node of list.children) {
if (node.url == url) {
found = true;
break;
}
}
ok(found, "Should have seen " + url + " in the list");
}
aWindow.document.documentElement.cancelDialog();
}
add_task(function* test_install_from_file() {
gManagerWindow = yield open_manager("addons://list/extension");
var filePaths = [
get_addon_file_url("browser_bug567127_1.xpi"),
get_addon_file_url("browser_bug567127_2.xpi")
];
MockFilePicker.returnFiles = filePaths.map(aPath => aPath.file);
Services.obs.addObserver(gInstallNotificationObserver,
"addon-install-started", false);
// Set handler that executes the core test after the window opens,
// and resolves the promise when the window closes
let pInstallURIClosed = new Promise((resolve, reject) => {
new WindowOpenListener(INSTALL_URI, function(aWindow) {
try {
test_confirmation(aWindow, filePaths.map(aPath => aPath.spec));
} catch (e) {
reject(e);
}
}, resolve);
});
gManagerWindow.gViewController.doCommand("cmd_installFromFile");
yield pInstallURIClosed;
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
MockFilePicker.cleanup();
yield close_manager(gManagerWindow);
});

Some files were not shown because too many files have changed in this diff Show more