mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to mozilla-inbound
This commit is contained in:
commit
9878eb5893
@ -80,6 +80,9 @@ const INSPECTOR_NOTIFICATIONS = {
|
||||
// Fires once the Inspector is closed.
|
||||
CLOSED: "inspector-closed",
|
||||
|
||||
// Fires once the Inspector is destroyed. Not fired on tab switch.
|
||||
DESTROYED: "inspector-destroyed",
|
||||
|
||||
// Fires when the Inspector is reopened after tab-switch.
|
||||
STATE_RESTORED: "inspector-state-restored",
|
||||
|
||||
@ -1046,6 +1049,8 @@ InspectorUI.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let winId = new String(this.winID); // retain this to notify observers.
|
||||
|
||||
this.closing = true;
|
||||
this.toolbar.hidden = true;
|
||||
|
||||
@ -1104,6 +1109,8 @@ InspectorUI.prototype = {
|
||||
delete this.stylePanel;
|
||||
delete this.toolbar;
|
||||
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.CLOSED, null);
|
||||
if (!aKeepStore)
|
||||
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.DESTROYED, winId);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,7 @@
|
||||
let doc;
|
||||
let salutation;
|
||||
let closing;
|
||||
let winId;
|
||||
|
||||
function createDocument()
|
||||
{
|
||||
@ -182,11 +183,12 @@ function inspectNodesFromContextTestWhileOpen()
|
||||
|
||||
function inspectNodesFromContextTestHighlight()
|
||||
{
|
||||
winId = InspectorUI.winID;
|
||||
Services.obs.removeObserver(inspectNodesFromContextTestHighlight, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
|
||||
Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
||||
Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.DESTROYED, false);
|
||||
is(InspectorUI.selection, closing, "InspectorUI.selection is header");
|
||||
executeSoon(function() {
|
||||
InspectorUI.closeInspectorUI(true);
|
||||
InspectorUI.closeInspectorUI();
|
||||
});
|
||||
}
|
||||
|
||||
@ -196,11 +198,12 @@ function inspectNodesFromContextTestTrap()
|
||||
ok(false, "Inspector UI has been opened again. We Should Not Be Here!");
|
||||
}
|
||||
|
||||
function finishInspectorTests()
|
||||
function finishInspectorTests(subject, topic, aWinIdString)
|
||||
{
|
||||
Services.obs.removeObserver(finishInspectorTests,
|
||||
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
|
||||
InspectorUI.INSPECTOR_NOTIFICATIONS.DESTROYED);
|
||||
|
||||
is(parseInt(aWinIdString), winId, "winId of destroyed Inspector matches");
|
||||
ok(!InspectorUI.highlighter, "Highlighter is gone");
|
||||
ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
|
||||
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
|
||||
@ -211,6 +214,7 @@ function finishInspectorTests()
|
||||
is(InspectorUI.sidebarDeck.children.length, 0, "No items in the Sidebar deck");
|
||||
ok(!InspectorUI.toolbar, "toolbar is hidden");
|
||||
|
||||
Services.obs.removeObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
@ -1837,11 +1837,14 @@ HUD_SERVICE.prototype =
|
||||
|
||||
// Remove the HUDBox and the consolePanel if the Web Console is inside a
|
||||
// floating panel.
|
||||
hud.HUDBox.parentNode.removeChild(hud.HUDBox);
|
||||
if (hud.consolePanel) {
|
||||
if (hud.consolePanel && hud.consolePanel.parentNode) {
|
||||
hud.consolePanel.parentNode.removeChild(hud.consolePanel);
|
||||
hud.consolePanel.removeAttribute("hudId");
|
||||
hud.consolePanel = null;
|
||||
}
|
||||
|
||||
hud.HUDBox.parentNode.removeChild(hud.HUDBox);
|
||||
|
||||
if (hud.splitter.parentNode) {
|
||||
hud.splitter.parentNode.removeChild(hud.splitter);
|
||||
}
|
||||
@ -3319,9 +3322,6 @@ HeadsUpDisplay.prototype = {
|
||||
}
|
||||
|
||||
panel.removeEventListener("popuphidden", onPopupHidden, false);
|
||||
if (panel.parentNode) {
|
||||
panel.parentNode.removeChild(panel);
|
||||
}
|
||||
|
||||
let width = 0;
|
||||
try {
|
||||
@ -3333,24 +3333,12 @@ HeadsUpDisplay.prototype = {
|
||||
Services.prefs.setIntPref("devtools.webconsole.width", panel.clientWidth);
|
||||
}
|
||||
|
||||
/*
|
||||
* Removed because of bug 674562
|
||||
* Services.prefs.setIntPref("devtools.webconsole.top", panel.panelBox.y);
|
||||
* Services.prefs.setIntPref("devtools.webconsole.left", panel.panelBox.x);
|
||||
*/
|
||||
|
||||
// Make sure we are not going to close again, drop the hudId reference of
|
||||
// the panel.
|
||||
panel.removeAttribute("hudId");
|
||||
|
||||
// Are we destroying the HUD or repositioning it?
|
||||
if (this.consoleWindowUnregisterOnHide) {
|
||||
HUDService.deactivateHUDForContext(this.tab, false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.consoleWindowUnregisterOnHide = true;
|
||||
}
|
||||
|
||||
this.consolePanel = null;
|
||||
}).bind(this);
|
||||
|
||||
panel.addEventListener("popuphidden", onPopupHidden, false);
|
||||
@ -3488,13 +3476,14 @@ HeadsUpDisplay.prototype = {
|
||||
|
||||
this.uiInOwnWindow = false;
|
||||
if (this.consolePanel) {
|
||||
this.HUDBox.removeAttribute("flex");
|
||||
this.HUDBox.removeAttribute("height");
|
||||
this.HUDBox.style.height = height + "px";
|
||||
|
||||
// must destroy the consolePanel
|
||||
this.consoleWindowUnregisterOnHide = false;
|
||||
this.consolePanel.hidePopup();
|
||||
this.consolePanel.parentNode.removeChild(this.consolePanel);
|
||||
this.consolePanel = null; // remove this as we're not in panel anymore
|
||||
this.HUDBox.removeAttribute("flex");
|
||||
this.HUDBox.removeAttribute("height");
|
||||
this.HUDBox.style.height = height + "px";
|
||||
}
|
||||
|
||||
if (this.jsterm) {
|
||||
@ -6204,7 +6193,7 @@ HeadsUpDisplayUICommands = {
|
||||
|
||||
if (hudRef && hud) {
|
||||
if (hudRef.consolePanel) {
|
||||
HUDService.deactivateHUDForContext(gBrowser.selectedTab, false);
|
||||
hudRef.consolePanel.hidePopup();
|
||||
}
|
||||
else {
|
||||
HUDService.storeHeight(hudId);
|
||||
|
@ -148,6 +148,7 @@ _BROWSER_TEST_FILES = \
|
||||
browser_gcli_web.js \
|
||||
browser_webconsole_bug_658368_time_methods.js \
|
||||
browser_webconsole_bug_622303_persistent_filters.js \
|
||||
browser_webconsole_window_zombie.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -61,7 +61,9 @@ function onLoad() {
|
||||
is(id, hudId, "below position is correct after reopen");
|
||||
|
||||
diffHeight = Math.abs(hudBox.clientHeight - boxHeight);
|
||||
ok(diffHeight < 3, "hudBox height is still correct");
|
||||
// dump("Diffheight: " + diffHeight + " clientHeight: " + hudBox.clientHeight + " boxHeight: " + boxHeight + "\n");
|
||||
// XXX TODO bug 702707
|
||||
todo(diffHeight < 3, "hudBox height is still correct");
|
||||
|
||||
is(Services.prefs.getCharPref(POSITION_PREF), "below", "pref is below");
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URI = "data:text/html,<p>test for bug 577721";
|
||||
|
||||
const POSITION_PREF = "devtools.webconsole.position";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("DOMContentLoaded", onLoad, false);
|
||||
registerCleanupFunction(testEnd);
|
||||
}
|
||||
|
||||
function testEnd() {
|
||||
Services.prefs.clearUserPref(POSITION_PREF);
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
browser.removeEventListener("DOMContentLoaded", onLoad, false);
|
||||
|
||||
openConsole();
|
||||
|
||||
let hudId = HUDService.getHudIdByWindow(content);
|
||||
let hudRef = HUDService.hudReferences[hudId];
|
||||
let hudBox = hudRef.HUDBox;
|
||||
|
||||
// listen for the panel popupshown event.
|
||||
document.addEventListener("popupshown", function popupShown() {
|
||||
document.removeEventListener("popupshown", popupShown, false);
|
||||
|
||||
ok(hudRef.consolePanel, "console is in a panel");
|
||||
|
||||
document.addEventListener("popuphidden", function popupHidden() {
|
||||
document.removeEventListener("popuphidden", popupHidden, false);
|
||||
finishTest();
|
||||
}, false);
|
||||
|
||||
// Close the window console via the menu item
|
||||
let menu = document.getElementById("webConsole");
|
||||
menu.click();
|
||||
}, false);
|
||||
|
||||
hudRef.positionConsole("window");
|
||||
}
|
@ -139,6 +139,7 @@ NS_CP_ContentTypeName(PRUint32 contentType)
|
||||
CASE_RETURN( TYPE_DTD );
|
||||
CASE_RETURN( TYPE_FONT );
|
||||
CASE_RETURN( TYPE_MEDIA );
|
||||
CASE_RETURN( TYPE_WEBSOCKET );
|
||||
default:
|
||||
return "<Unknown Type>";
|
||||
}
|
||||
|
@ -137,6 +137,11 @@ interface nsIContentPolicy : nsISupports
|
||||
*/
|
||||
const unsigned long TYPE_MEDIA = 15;
|
||||
|
||||
/**
|
||||
* Indicates a WebSocket load.
|
||||
*/
|
||||
const unsigned long TYPE_WEBSOCKET = 16;
|
||||
|
||||
/* Please update nsContentBlocker when adding new content types. */
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -102,6 +102,7 @@ function ContentSecurityPolicy() {
|
||||
csp._MAPPINGS[cp.TYPE_MEDIA] = cspr_sd.MEDIA_SRC;
|
||||
csp._MAPPINGS[cp.TYPE_FONT] = cspr_sd.FONT_SRC;
|
||||
csp._MAPPINGS[cp.TYPE_XMLHTTPREQUEST] = cspr_sd.XHR_SRC;
|
||||
csp._MAPPINGS[cp.TYPE_WEBSOCKET] = cspr_sd.XHR_SRC;
|
||||
|
||||
|
||||
/* These must go through the catch-all */
|
||||
|
@ -68,9 +68,12 @@ nsNoDataProtocolContentPolicy::ShouldLoad(PRUint32 aContentType,
|
||||
|
||||
// Don't block for TYPE_OBJECT since such URIs are sometimes loaded by the
|
||||
// plugin, so they don't necessarily open external apps
|
||||
// TYPE_WEBSOCKET loads can only go to ws:// or wss://, so we don't need to
|
||||
// concern ourselves with them.
|
||||
if (aContentType != TYPE_DOCUMENT &&
|
||||
aContentType != TYPE_SUBDOCUMENT &&
|
||||
aContentType != TYPE_OBJECT) {
|
||||
aContentType != TYPE_OBJECT &&
|
||||
aContentType != TYPE_WEBSOCKET) {
|
||||
|
||||
// The following are just quick-escapes for the most common cases
|
||||
// where we would allow the content to be loaded anyway.
|
||||
|
@ -76,6 +76,8 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsDOMLists.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsContentErrors.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -1273,6 +1275,9 @@ nsWebSocket::Init(nsIPrincipal* aPrincipal,
|
||||
rv = ParseURL(PromiseFlatString(aURL));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> originDoc =
|
||||
nsContentUtils::GetDocumentFromScriptContext(mScriptContext);
|
||||
|
||||
// Don't allow https:// to open ws://
|
||||
if (!mSecure &&
|
||||
!Preferences::GetBool("network.websocket.allowInsecureFromHTTPS",
|
||||
@ -1280,8 +1285,6 @@ nsWebSocket::Init(nsIPrincipal* aPrincipal,
|
||||
// Confirmed we are opening plain ws:// and want to prevent this from a
|
||||
// secure context (e.g. https). Check the security context of the document
|
||||
// associated with this script, which is the same as associated with mOwner.
|
||||
nsCOMPtr<nsIDocument> originDoc =
|
||||
nsContentUtils::GetDocumentFromScriptContext(mScriptContext);
|
||||
if (originDoc && originDoc->GetSecurityInfo())
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
@ -1299,6 +1302,23 @@ nsWebSocket::Init(nsIPrincipal* aPrincipal,
|
||||
AppendUTF16toUTF8(protocolArray[index], mRequestedProtocolList);
|
||||
}
|
||||
|
||||
// Check content policy.
|
||||
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_WEBSOCKET,
|
||||
mURI,
|
||||
mPrincipal,
|
||||
originDoc,
|
||||
EmptyCString(),
|
||||
nsnull,
|
||||
&shouldLoad,
|
||||
nsContentUtils::GetContentPolicy(),
|
||||
nsContentUtils::GetSecurityManager());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_CP_REJECTED(shouldLoad)) {
|
||||
// Disallowed by content policy.
|
||||
return NS_ERROR_CONTENT_BLOCKED;
|
||||
}
|
||||
|
||||
// the constructor should throw a SYNTAX_ERROR only if it fails to parse the
|
||||
// url parameter, so we don't care about the EstablishConnection result.
|
||||
EstablishConnection();
|
||||
|
@ -222,7 +222,8 @@ public:
|
||||
/**
|
||||
* Copies mItemFlags and mItemData to aVisitor and calls PostHandleEvent.
|
||||
*/
|
||||
nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor,
|
||||
nsCxPusher* aPusher);
|
||||
|
||||
static PRUint32 MaxEtciCount() { return sMaxEtciCount; }
|
||||
|
||||
@ -282,8 +283,10 @@ nsEventTargetChainItem::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor& aVisitor,
|
||||
nsCxPusher* aPusher)
|
||||
{
|
||||
aPusher->Pop();
|
||||
aVisitor.mItemFlags = mItemFlags;
|
||||
aVisitor.mItemData = mItemData;
|
||||
mTarget->PostHandleEvent(aVisitor);
|
||||
@ -344,7 +347,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
aPusher);
|
||||
}
|
||||
if (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) {
|
||||
item->PostHandleEvent(aVisitor);
|
||||
item->PostHandleEvent(aVisitor, aPusher);
|
||||
}
|
||||
|
||||
// Bubble
|
||||
@ -367,7 +370,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
aPusher);
|
||||
}
|
||||
if (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) {
|
||||
item->PostHandleEvent(aVisitor);
|
||||
item->PostHandleEvent(aVisitor, aPusher);
|
||||
}
|
||||
}
|
||||
item = item->mParent;
|
||||
@ -386,6 +389,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
// Special handling if PresShell (or some other caller)
|
||||
// used a callback object.
|
||||
if (aCallback) {
|
||||
aPusher->Pop();
|
||||
aCallback->HandleEvent(aVisitor);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,8 @@ static const char *kTypeString[] = {"other",
|
||||
"objectsubrequest",
|
||||
"dtd",
|
||||
"font",
|
||||
"media"};
|
||||
"media",
|
||||
"websocket"};
|
||||
|
||||
#define NUMBER_OF_TYPES NS_ARRAY_LENGTH(kTypeString)
|
||||
PRUint8 nsContentBlocker::mBehaviorPref[NUMBER_OF_TYPES];
|
||||
|
@ -1309,6 +1309,10 @@ var AddonManagerPrivate = {
|
||||
AddonManagerInternal.updateAddonAppDisabledStates();
|
||||
},
|
||||
|
||||
updateAddonRepositoryData: function AMP_updateAddonRepositoryData(aCallback) {
|
||||
AddonManagerInternal.updateAddonRepositoryData(aCallback);
|
||||
},
|
||||
|
||||
callInstallListeners: function AMP_callInstallListeners(aMethod) {
|
||||
return AddonManagerInternal.callInstallListeners.apply(AddonManagerInternal,
|
||||
arguments);
|
||||
|
@ -38,6 +38,7 @@
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Cc = Components.classes;
|
||||
@ -124,17 +125,25 @@ var gChecking = {
|
||||
self._progress.max = aAddons.length;
|
||||
self._progress.mode = "determined";
|
||||
|
||||
aAddons.forEach(function(aAddon) {
|
||||
// Ignore disabled themes
|
||||
if (aAddon.type != "theme" || !aAddon.userDisabled) {
|
||||
gAddons[aAddon.id] = {
|
||||
addon: aAddon,
|
||||
install: null,
|
||||
wasActive: aAddon.isActive
|
||||
}
|
||||
}
|
||||
// Ensure compatibility overrides are up to date before checking for
|
||||
// individual addon updates.
|
||||
let ids = [addon.id for each (addon in aAddons)];
|
||||
AddonRepository.repopulateCache(ids, function() {
|
||||
AddonManagerPrivate.updateAddonRepositoryData(function() {
|
||||
|
||||
aAddon.findUpdates(self, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
aAddons.forEach(function(aAddon) {
|
||||
// Ignore disabled themes
|
||||
if (aAddon.type != "theme" || !aAddon.userDisabled) {
|
||||
gAddons[aAddon.id] = {
|
||||
addon: aAddon,
|
||||
install: null,
|
||||
wasActive: aAddon.isActive
|
||||
}
|
||||
}
|
||||
|
||||
aAddon.findUpdates(self, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -45,6 +45,7 @@ const PREF_XPINSTALL_ENABLED = "xpinstall.enabled";
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
|
||||
|
||||
var gUpdateWizard = {
|
||||
// When synchronizing app compatibility info this contains all installed
|
||||
@ -166,9 +167,17 @@ var gVersionInfoPage = {
|
||||
|
||||
gVersionInfoPage._totalCount = gUpdateWizard.addons.length;
|
||||
|
||||
gUpdateWizard.addons.forEach(function(aAddon) {
|
||||
aAddon.findUpdates(gVersionInfoPage, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
}, this);
|
||||
// Ensure compatibility overrides are up to date before checking for
|
||||
// individual addon updates.
|
||||
let ids = [addon.id for each (addon in gUpdateWizard.addons)];
|
||||
AddonRepository.repopulateCache(ids, function() {
|
||||
AddonManagerPrivate.updateAddonRepositoryData(function() {
|
||||
|
||||
gUpdateWizard.addons.forEach(function(aAddon) {
|
||||
aAddon.findUpdates(gVersionInfoPage, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
|
||||
}, this);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -101,6 +101,7 @@ _TEST_FILES = \
|
||||
browser_installssl.js \
|
||||
browser_newaddon.js \
|
||||
browser_select_selection.js \
|
||||
browser_select_compatoverrides.js \
|
||||
browser_select_confirm.js \
|
||||
browser_select_update.js \
|
||||
$(NULL)
|
||||
@ -111,10 +112,12 @@ _TEST_RESOURCES = \
|
||||
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_select_compatoverrides.xml \
|
||||
browser_updatessl.rdf \
|
||||
browser_updatessl.rdf^headers^ \
|
||||
browser_install.rdf \
|
||||
|
@ -0,0 +1,23 @@
|
||||
<?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>addon10@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<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>
|
@ -0,0 +1,23 @@
|
||||
<?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>addon1@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>0</em:minVersion>
|
||||
<em:maxVersion>0.1</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Addon1</em:name>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
@ -7,6 +7,10 @@
|
||||
|
||||
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
|
||||
|
||||
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
|
||||
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
|
||||
|
||||
/**
|
||||
@ -31,6 +35,10 @@ function test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(PREF_GETADDONS_CACHE_ENABLED);
|
||||
});
|
||||
|
||||
function end_test() {
|
||||
// Test generates a lot of available installs so just cancel them all
|
||||
AddonManager.getAllInstalls(function(aInstalls) {
|
||||
@ -56,7 +64,8 @@ function install_test_addons(aCallback) {
|
||||
"browser_bug557956_6",
|
||||
"browser_bug557956_7",
|
||||
"browser_bug557956_8_1",
|
||||
"browser_bug557956_9_1"].forEach(function(aName) {
|
||||
"browser_bug557956_9_1",
|
||||
"browser_bug557956_10"].forEach(function(aName) {
|
||||
AddonManager.getInstallForURL(TESTROOT + "addons/" + aName + ".xpi", function(aInstall) {
|
||||
installs.push(aInstall);
|
||||
}, "application/x-xpinstall");
|
||||
@ -91,7 +100,8 @@ function uninstall_test_addons(aCallback) {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"],
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"],
|
||||
function(aAddons) {
|
||||
aAddons.forEach(function(aAddon) {
|
||||
if (aAddon)
|
||||
@ -172,7 +182,8 @@ add_test(function() {
|
||||
var inactiveAddonIds = [
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org"
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"
|
||||
];
|
||||
|
||||
// Check that compatibility updates were applied.
|
||||
@ -260,7 +271,8 @@ add_test(function() {
|
||||
var inactiveAddonIds = [
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org"
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"
|
||||
];
|
||||
|
||||
Services.prefs.setBoolPref("xpinstall.enabled", false);
|
||||
@ -343,7 +355,8 @@ add_test(function() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"],
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"],
|
||||
function(aAddons) {
|
||||
aAddons.forEach(function(aAddon) {
|
||||
aAddon.userDisabled = true;
|
||||
@ -359,7 +372,8 @@ add_test(function() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"
|
||||
];
|
||||
|
||||
open_compatibility_window(inactiveAddonIds, function(aWindow) {
|
||||
@ -377,7 +391,8 @@ add_test(function() {
|
||||
install_test_addons(function() {
|
||||
AddonManager.getAddonsByIDs(["addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org"],
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"],
|
||||
function(aAddons) {
|
||||
aAddons.forEach(function(aAddon) {
|
||||
aAddon.uninstall();
|
||||
@ -416,3 +431,63 @@ add_test(function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that compatibility overrides are retreived and affect addon
|
||||
// compatibility.
|
||||
add_test(function() {
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
|
||||
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(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"],
|
||||
function(aAddons) {
|
||||
aAddons.forEach(function(aAddon) {
|
||||
if (aAddon.id == "addon10@tests.mozilla.org")
|
||||
is(aAddon.isCompatible, true, "Addon10 should be compatible before compat overrides are refreshed");
|
||||
else
|
||||
aAddon.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);
|
||||
});
|
||||
|
||||
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1">
|
||||
<addon_compatibility hosted="false">
|
||||
<guid>addon10@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>
|
@ -0,0 +1,118 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that compatibility overrides are refreshed when showing the addon
|
||||
// selection UI.
|
||||
|
||||
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
|
||||
|
||||
var gTestAddon = null;
|
||||
|
||||
function waitForView(aView, aCallback) {
|
||||
var view = gWin.document.getElementById(aView);
|
||||
if (view.parentNode.selectedPanel == view) {
|
||||
aCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
view.addEventListener("ViewChanged", function() {
|
||||
view.removeEventListener("ViewChanged", arguments.callee, false);
|
||||
aCallback();
|
||||
}, false);
|
||||
}
|
||||
|
||||
function install_test_addon(aCallback) {
|
||||
AddonManager.getInstallForURL(TESTROOT + "addons/browser_select_compatoverrides_1.xpi", function(aInstall) {
|
||||
var listener = {
|
||||
onInstallEnded: function() {
|
||||
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
|
||||
gTestAddon = addon;
|
||||
aCallback();
|
||||
});
|
||||
}
|
||||
};
|
||||
aInstall.addListener(listener);
|
||||
aInstall.install();
|
||||
}, "application/x-xpinstall");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
if (gWin)
|
||||
gWin.close();
|
||||
if (gTestAddon)
|
||||
gTestAddon.uninstall();
|
||||
|
||||
Services.prefs.clearUserPref(PREF_GETADDONS_CACHE_ENABLED);
|
||||
Services.prefs.clearUserPref(PREF_GETADDONS_BYIDS);
|
||||
Services.prefs.clearUserPref(PREF_MIN_PLATFORM_COMPAT);
|
||||
});
|
||||
|
||||
function end_test() {
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
|
||||
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
|
||||
Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
|
||||
|
||||
install_test_addon(run_next_test);
|
||||
}
|
||||
|
||||
add_test(function() {
|
||||
gWin = Services.ww.openWindow(null,
|
||||
"chrome://mozapps/content/extensions/selectAddons.xul",
|
||||
"",
|
||||
"chrome,centerscreen,dialog,titlebar",
|
||||
null);
|
||||
waitForFocus(function() {
|
||||
waitForView("select", run_next_test);
|
||||
}, gWin);
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
for (var row = gWin.document.getElementById("select-rows").firstChild; row; row = row.nextSibling) {
|
||||
if (row.localName == "separator")
|
||||
continue;
|
||||
if (row.id.substr(-18) != "@tests.mozilla.org")
|
||||
continue;
|
||||
|
||||
is(row.id, "addon1@tests.mozilla.org", "Should get expected addon");
|
||||
isnot(row.action, "incompatible", "Addon should not be incompatible");
|
||||
|
||||
gWin.close();
|
||||
gWin = null;
|
||||
run_next_test();
|
||||
}
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, TESTROOT + "browser_select_compatoverrides.xml");
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
|
||||
gWin = Services.ww.openWindow(null,
|
||||
"chrome://mozapps/content/extensions/selectAddons.xul",
|
||||
"",
|
||||
"chrome,centerscreen,dialog,titlebar",
|
||||
null);
|
||||
waitForFocus(function() {
|
||||
waitForView("select", run_next_test);
|
||||
}, gWin);
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
for (var row = gWin.document.getElementById("select-rows").firstChild; row; row = row.nextSibling) {
|
||||
if (row.localName == "separator")
|
||||
continue;
|
||||
if (row.id.substr(-18) != "@tests.mozilla.org")
|
||||
continue;
|
||||
is(row.id, "addon1@tests.mozilla.org", "Should get expected addon");
|
||||
is(row.action, "incompatible", "Addon should be incompatible");
|
||||
run_next_test();
|
||||
}
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1">
|
||||
<addon_compatibility hosted="false">
|
||||
<guid>addon1@tests.mozilla.org</guid>
|
||||
<name>Addon1</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>
|
@ -9,6 +9,11 @@ var gWin;
|
||||
|
||||
function waitForView(aView, aCallback) {
|
||||
var view = gWin.document.getElementById(aView);
|
||||
if (view.parentNode.selectedPanel == view) {
|
||||
aCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
view.addEventListener("ViewChanged", function() {
|
||||
view.removeEventListener("ViewChanged", arguments.callee, false);
|
||||
try {
|
||||
|
@ -59,6 +59,11 @@ var ADDONS = [
|
||||
|
||||
function waitForView(aView, aCallback) {
|
||||
var view = gWin.document.getElementById(aView);
|
||||
if (view.parentNode.selectedPanel == view) {
|
||||
aCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
view.addEventListener("ViewChanged", function() {
|
||||
view.removeEventListener("ViewChanged", arguments.callee, false);
|
||||
aCallback();
|
||||
|
@ -9,6 +9,11 @@ var gWin;
|
||||
|
||||
function waitForView(aView, aCallback) {
|
||||
var view = gWin.document.getElementById(aView);
|
||||
if (view.parentNode.selectedPanel == view) {
|
||||
aCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
view.addEventListener("ViewChanged", function() {
|
||||
view.removeEventListener("ViewChanged", arguments.callee, false);
|
||||
aCallback();
|
||||
|
Loading…
Reference in New Issue
Block a user