mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 584693 Ensure get addons pane in addons tab shows proper webpage r=bmcbride a=blocking-final+
This commit is contained in:
parent
01805a3db8
commit
c9fd7cdf28
@ -1284,6 +1284,9 @@ var gHeader = {
|
||||
var gDiscoverView = {
|
||||
node: null,
|
||||
enabled: true,
|
||||
// Set to true after the view is first shown. If initialization completes
|
||||
// after this then it must also load the discover homepage
|
||||
loaded: false,
|
||||
_browser: null,
|
||||
|
||||
initialize: function() {
|
||||
@ -1314,19 +1317,36 @@ var gDiscoverView = {
|
||||
}
|
||||
});
|
||||
|
||||
gDiscoverView._browser.homePage = url + "#" + JSON.stringify(list);
|
||||
notifyInitialized();
|
||||
var browser = gDiscoverView._browser;
|
||||
browser.homePage = url + "#" + JSON.stringify(list);
|
||||
|
||||
if (gDiscoverView.loaded) {
|
||||
browser.addEventListener("load", function() {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
notifyInitialized();
|
||||
}, true);
|
||||
browser.goHome();
|
||||
} else {
|
||||
notifyInitialized();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
// load content only if we're not already showing something on AMO
|
||||
// XXXunf should only be comparing hostname. bug 557698
|
||||
if (this._browser.currentURI.spec.indexOf(this._browser.homePage) == -1)
|
||||
this._browser.goHome();
|
||||
if (!this.loaded) {
|
||||
this.loaded = true;
|
||||
|
||||
gViewController.updateCommands();
|
||||
gViewController.notifyViewChanged();
|
||||
var browser = gDiscoverView._browser;
|
||||
browser.addEventListener("load", function() {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
gViewController.updateCommands();
|
||||
gViewController.notifyViewChanged();
|
||||
}, true);
|
||||
browser.goHome();
|
||||
} else {
|
||||
gViewController.updateCommands();
|
||||
gViewController.notifyViewChanged();
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() { },
|
||||
|
@ -252,7 +252,7 @@
|
||||
<!-- discover view -->
|
||||
<vbox id="discover-view" flex="1" class="view-pane">
|
||||
<browser id="discover-browser" type="content" flex="1"
|
||||
disablehistory="true"/>
|
||||
disablehistory="true" homepage="about:blank"/>
|
||||
</vbox>
|
||||
|
||||
<!-- search view -->
|
||||
|
@ -65,6 +65,7 @@ _TEST_FILES = \
|
||||
browser_bug591465.js \
|
||||
browser_bug591465.xml \
|
||||
browser_details.js \
|
||||
browser_discovery.js \
|
||||
browser_dragdrop.js \
|
||||
browser_list.js \
|
||||
browser_searching.js \
|
||||
|
@ -9,7 +9,7 @@ var gManagerWindow;
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ function test() {
|
||||
description: ""
|
||||
}]);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ function test() {
|
||||
optionsURL: addonPrefsURI
|
||||
}]);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
var addonList = aWindow.document.getElementById("addon-list");
|
||||
for (var i = 0; i < addonList.childNodes.length; i++) {
|
||||
var addonItem = addonList.childNodes[i];
|
||||
|
@ -128,7 +128,7 @@ function test() {
|
||||
"@mozilla.org/filepicker;1",
|
||||
gMockFilePickerFactory);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -40,7 +40,7 @@ function test() {
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
|
@ -32,7 +32,7 @@ function test() {
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
|
||||
}]);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
let addonList = aWindow.document.getElementById("addon-list");
|
||||
let ed_r_Item, un_r_Item, no_r_Item;
|
||||
for (let i = 0; i < addonList.childNodes.length; i++) {
|
||||
|
@ -25,7 +25,7 @@ function test() {
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
|
@ -20,7 +20,7 @@ function test() {
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
|
84
toolkit/mozapps/extensions/test/browser/browser_discovery.js
Normal file
84
toolkit/mozapps/extensions/test/browser/browser_discovery.js
Normal file
@ -0,0 +1,84 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that the discovery view loads properly
|
||||
|
||||
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
|
||||
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
|
||||
function test() {
|
||||
// Switch to a known url
|
||||
Services.prefs.setCharPref(PREF_DISCOVERURL, TESTROOT + "releaseNotes.xhtml");
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
finish();
|
||||
}
|
||||
|
||||
function getURL(browser) {
|
||||
var url = browser.currentURI.spec;
|
||||
var pos = url.indexOf("#");
|
||||
if (pos != -1)
|
||||
return url.substring(0, pos);
|
||||
return url;
|
||||
}
|
||||
|
||||
// Tests that switching to the discovery view displays the right url
|
||||
add_test(function() {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
gCategoryUtilities.openType("discover", function() {
|
||||
var browser = gManagerWindow.document.getElementById("discover-browser");
|
||||
is(getURL(browser), TESTROOT + "releaseNotes.xhtml", "Should have loaded the right url");
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that loading the add-ons manager with the discovery view as the last
|
||||
// selected view displays the right url
|
||||
add_test(function() {
|
||||
open_manager(null, function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
is(gCategoryUtilities.selectedCategory, "discover", "Should have loaded the right view");
|
||||
|
||||
var browser = gManagerWindow.document.getElementById("discover-browser");
|
||||
is(getURL(browser), TESTROOT + "releaseNotes.xhtml", "Should have loaded the right url");
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that loading the add-ons manager with the discovery view as the initial
|
||||
// view displays the right url
|
||||
add_test(function() {
|
||||
open_manager(null, function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
gCategoryUtilities.openType("extension", function() {
|
||||
close_manager(gManagerWindow, function() {
|
||||
open_manager("addons://discover/", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
is(gCategoryUtilities.selectedCategory, "discover", "Should have loaded the right view");
|
||||
|
||||
var browser = gManagerWindow.document.getElementById("discover-browser");
|
||||
is(getURL(browser), TESTROOT + "releaseNotes.xhtml", "Should have loaded the right url");
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@ -72,7 +72,7 @@ WindowOpenListener.prototype = {
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ add_test(function() {
|
||||
info("Setting " + pref + " pref to false")
|
||||
Services.prefs.setBoolPref(pref, false);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
var label = aWindow.document.querySelector("#list-view label.global-warning-checkcompatibility");
|
||||
is_element_visible(label, "Check Compatibility warning label should be visible");
|
||||
var button = aWindow.document.querySelector("#list-view button.global-warning-checkcompatibility");
|
||||
|
@ -21,7 +21,7 @@ function test() {
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_ENABLE
|
||||
}]);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
|
@ -31,7 +31,7 @@ function test() {
|
||||
updateDate: new Date(Date.now() - (1000 * 60 * 60 * 25 * 30))
|
||||
}]);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
|
@ -61,7 +61,7 @@ function test() {
|
||||
|
||||
installs.forEach(function(aInstall) { aInstall.install(); });
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
|
@ -42,7 +42,7 @@ function test() {
|
||||
size: 5
|
||||
}]);
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user