Bug 597178: Only show back/forward buttons when necessary. r=Unfocused, a=blocks-final

This commit is contained in:
Dave Townsend 2010-10-26 10:45:15 -07:00
Родитель dd7d9b892f
Коммит ef8b1b1848
6 изменённых файлов: 313 добавлений и 126 удалений

Просмотреть файл

@ -143,55 +143,123 @@ function loadView(aViewId) {
}
/**
* A wrapper around the HTML5 session history service that continues to work
* even if the window has session history disabled.
* Without session history it currently only tracks the previous state so
* the popState function works.
* A wrapper around the HTML5 session history service that allows the browser
* back/forward controls to work within the manager
*/
var gHistory = {
states: [],
var HTML5History = {
get canGoBack() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.canGoBack;
},
get canGoForward() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.canGoForward;
},
back: function() {
window.history.back();
gViewController.updateCommand("cmd_back");
gViewController.updateCommand("cmd_forward");
},
forward: function() {
window.history.forward();
gViewController.updateCommand("cmd_back");
gViewController.updateCommand("cmd_forward");
},
pushState: function(aState) {
try {
window.history.pushState(aState, document.title);
}
catch(e) {
while (this.states.length > 1)
this.states.shift();
this.states.push(aState);
}
window.history.pushState(aState, document.title);
},
replaceState: function(aState) {
try {
window.history.replaceState(aState, document.title);
}
catch (e) {
this.states.pop();
this.states.push(aState);
}
window.history.replaceState(aState, document.title);
},
popState: function() {
// If there are no cached states then the session history must be working
if (this.states.length == 0) {
window.addEventListener("popstate", function(event) {
window.removeEventListener("popstate", arguments.callee, true);
// TODO To ensure we can't go forward again we put an additional entry
// for the current state into the history. Ideally we would just strip
// the history but there doesn't seem to be a way to do that. Bug 590661
window.history.pushState(event.state, document.title);
}, true);
window.history.back();
} else {
if (this.states.length < 2)
throw new Error("Cannot popState from this view");
window.addEventListener("popstate", function(event) {
window.removeEventListener("popstate", arguments.callee, true);
// TODO To ensure we can't go forward again we put an additional entry
// for the current state into the history. Ideally we would just strip
// the history but there doesn't seem to be a way to do that. Bug 590661
window.history.pushState(event.state, document.title);
}, true);
window.history.back();
gViewController.updateCommand("cmd_back");
gViewController.updateCommand("cmd_forward");
}
};
this.states.pop();
let state = this.states[this.states.length - 1];
gViewController.statePopped({ state: state });
}
/**
* A wrapper around a fake history service
*/
var FakeHistory = {
pos: 0,
states: [null],
get canGoBack() {
return this.pos > 0;
},
get canGoForward() {
return (this.pos + 1) < this.states.length;
},
back: function() {
if (this.pos == 0)
throw new Error("Cannot go back from this point");
this.pos--;
gViewController.statePopped({ state: this.states[this.pos] });
gViewController.updateCommand("cmd_back");
gViewController.updateCommand("cmd_forward");
},
forward: function() {
if ((this.pos + 1) >= this.states.length)
throw new Error("Cannot go forward from this point");
this.pos++;
gViewController.statePopped({ state: this.states[this.pos] });
gViewController.updateCommand("cmd_back");
gViewController.updateCommand("cmd_forward");
},
pushState: function(aState) {
this.pos++;
this.states.splice(this.pos);
this.states.push(aState);
},
replaceState: function(aState) {
this.states[this.pos] = aState;
},
popState: function() {
if (this.pos == 0)
throw new Error("Cannot popState from this view");
this.states.splice(this.pos);
this.pos--;
gViewController.statePopped({ state: this.states[this.pos] });
gViewController.updateCommand("cmd_back");
gViewController.updateCommand("cmd_forward");
}
};
// If the window has a session history then use the HTML5 History wrapper
// otherwise use our fake history implementation
if (window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.sessionHistory) {
var gHistory = HTML5History;
}
else {
gHistory = FakeHistory;
}
var gEventManager = {
@ -545,23 +613,19 @@ var gViewController = {
commands: {
cmd_back: {
isEnabled: function() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.canGoBack;
return gHistory.canGoBack;
},
doCommand: function() {
window.history.back();
gHistory.back();
}
},
cmd_forward: {
isEnabled: function() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.canGoForward;
return gHistory.canGoForward;
},
doCommand: function() {
window.history.forward();
gHistory.forward();
}
},
@ -1296,6 +1360,42 @@ var gHeader = {
gViewController.loadView("addons://search/" + encodeURIComponent(query));
}, false);
if (this.shouldShowNavButtons) {
document.getElementById("back-btn").hidden = false;
document.getElementById("forward-btn").hidden = false;
}
},
get shouldShowNavButtons() {
var docshellItem = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem);
// If there is no outer frame then make the buttons visible
if (docshellItem.rootTreeItem == docshellItem)
return true;
var outerWin = docshellItem.rootTreeItem.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
var outerDoc = outerWin.document;
var node = outerDoc.getElementById("back-button");
// If the outer frame has no back-button then make the buttons visible
if (!node)
return true;
// If the back-button or any of its parents are hidden then make the buttons
// visible
while (node != outerDoc) {
var style = outerWin.getComputedStyle(node, "");
if (style.display == "none")
return true;
if (style.visibility != "visible")
return true;
node = node.parentNode;
}
return false;
},
get searchQuery() {

Просмотреть файл

@ -143,9 +143,9 @@
<!-- main header -->
<hbox id="header" align="center">
<button id="back-btn" class="nav-button" command="cmd_back"
tooltiptext="&cmd.back.tooltip;"/>
tooltiptext="&cmd.back.tooltip;" hidden="true" disabled="true"/>
<button id="forward-btn" class="nav-button" command="cmd_forward"
tooltiptext="&cmd.forward.tooltip;"/>
tooltiptext="&cmd.forward.tooltip;" hidden="true" disabled="true"/>
<spacer flex="1"/>
<hbox id="updates-container" align="center">
<image class="spinner"/>

Просмотреть файл

@ -45,13 +45,9 @@ TESTXPI = $(CURDIR)/$(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/
include $(DEPTH)/config/autoconf.mk
_TEST_FILES = \
_MAIN_TEST_FILES = \
head.js \
browser_bug557943.js \
browser_bug557956.js \
browser_bug557956.rdf \
browser_bug557956_8_2.xpi \
browser_bug557956_9_2.xpi \
browser_bug562797.js \
browser_bug562890.js \
browser_bug562899.js \
@ -63,28 +59,39 @@ _TEST_FILES = \
browser_bug581076.js \
browser_bug587970.js \
browser_bug591465.js \
browser_bug591465.xml \
browser_bug596336.js \
browser_details.js \
browser_discovery.js \
browser_dragdrop.js \
browser_list.js \
browser_searching.js \
browser_searching.xml \
browser_searching_empty.xml \
browser_sorting.js \
browser_uninstalling.js \
browser_updatessl.js \
browser_updatessl.rdf \
browser_install.js \
browser_install.rdf \
browser_install.xml \
browser_install1_3.xpi \
browser_installssl.js \
browser_recentupdates.js \
browser_manualupdates.js \
browser_globalwarnings.js \
browser_eula.js \
$(NULL)
_TEST_FILES = \
head.js \
browser_bug557956.js \
browser_updatessl.js \
browser_installssl.js \
$(NULL)
_TEST_RESOURCES = \
browser_bug557956.rdf \
browser_bug557956_8_2.xpi \
browser_bug557956_9_2.xpi \
browser_bug591465.xml \
browser_searching.xml \
browser_searching_empty.xml \
browser_updatessl.rdf \
browser_install.rdf \
browser_install.xml \
browser_install1_3.xpi \
browser_eula.xml \
redirect.sjs \
releaseNotes.xhtml \
@ -94,9 +101,16 @@ _TEST_FILES = \
include $(topsrcdir)/config/rules.mk
libs:: $(_MAIN_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)-window
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
libs:: $(_TEST_RESOURCES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
libs::
rm -rf $(TESTXPI)
$(NSINSTALL) -D $(TESTXPI)

Просмотреть файл

@ -3,17 +3,11 @@
*/
/**
* Tests that history navigation works for the add-ons manager. Only used if
* in-content UI is supported for this application.
* Tests that history navigation works for the add-ons manager.
*/
function test() {
// XXX
ok(true, "Test temporarily disabled due to timeouts\n");
return;
if (!gUseInContentUI)
return;
requestLongerTimeout(2);
waitForExplicitFinish();
@ -42,15 +36,45 @@ function end_test() {
finish();
}
function go_back(aManager) {
if (gUseInContentUI) {
gBrowser.goBack();
} else {
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("back-btn"),
{ }, aManager);
}
}
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(doc.getElementById("view-port").selectedPanel.id, "list-view", "Should be on the right view");
is(gBrowser.canGoBack, canGoBack, "canGoBack should be correct");
is(!doc.getElementById("back-btn").disabled, canGoBack, "Back button should have the right state");
is(gBrowser.canGoForward, canGoForward, "canGoForward should be correct");
is(!doc.getElementById("forward-btn").disabled, canGoForward, "Forward button should have the right state");
check_state(aManager, canGoBack, canGoForward);
}
function is_in_search(aManager, query, canGoBack, canGoForward) {
@ -59,10 +83,8 @@ function is_in_search(aManager, query, canGoBack, canGoForward) {
is(doc.getElementById("categories").selectedItem.value, "addons://search/", "Should be on the right category");
is(doc.getElementById("view-port").selectedPanel.id, "search-view", "Should be on the right view");
is(doc.getElementById("header-search").value, query, "Should have used the right query");
is(gBrowser.canGoBack, canGoBack, "canGoBack should be correct");
is(!doc.getElementById("back-btn").disabled, canGoBack, "Back button should have the right state");
is(gBrowser.canGoForward, canGoForward, "canGoForward should be correct");
is(!doc.getElementById("forward-btn").disabled, canGoForward, "Forward button should have the right state");
check_state(aManager, canGoBack, canGoForward);
}
function is_in_detail(aManager, view, canGoBack, canGoForward) {
@ -70,10 +92,8 @@ function is_in_detail(aManager, view, canGoBack, canGoForward) {
is(doc.getElementById("categories").selectedItem.value, view, "Should be on the right category");
is(doc.getElementById("view-port").selectedPanel.id, "detail-view", "Should be on the right view");
is(gBrowser.canGoBack, canGoBack, "canGoBack should be correct");
is(!doc.getElementById("back-btn").disabled, canGoBack, "Back button should have the right state");
is(gBrowser.canGoForward, canGoForward, "canGoForward should be correct");
is(!doc.getElementById("forward-btn").disabled, canGoForward, "Forward button should have the right state");
check_state(aManager, canGoBack, canGoForward);
}
// Tests simple forward and back navigation and that the right heading and
@ -89,19 +109,19 @@ add_test(function() {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/extension", false, true);
gBrowser.goForward();
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/plugin", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 5");
@ -114,7 +134,7 @@ add_test(function() {
info("Part 6");
is_in_detail(aManager, "addons://list/extension", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 7");
@ -131,7 +151,13 @@ add_test(function() {
});
// 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;
}
info("Part 1");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI("http://example.com/");
@ -156,7 +182,7 @@ add_test(function() {
info("Part 3");
is_in_list(aManager, "addons://list/extension", true, false);
gBrowser.goBack();
go_back(aManager);
gBrowser.addEventListener("pageshow", function() {
gBrowser.removeEventListener("pageshow", arguments.callee, false);
info("Part 4");
@ -164,7 +190,7 @@ add_test(function() {
ok(!gBrowser.canGoBack, "Should not be able to go back");
ok(gBrowser.canGoForward, "Should be able to go forward");
gBrowser.goForward();
go_forward(aManager);
gBrowser.addEventListener("pageshow", function() {
gBrowser.removeEventListener("pageshow", arguments.callee, false);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
@ -193,7 +219,7 @@ add_test(function() {
info("Part 2");
is_in_list(aManager, "addons://list/extension", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
@ -219,13 +245,13 @@ add_test(function() {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/extension", false, true);
gBrowser.goForward();
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
@ -240,7 +266,13 @@ add_test(function() {
// 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);
@ -256,7 +288,7 @@ add_test(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
gBrowser.goBack();
go_back(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
@ -267,7 +299,7 @@ add_test(function() {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", false, true);
gBrowser.goForward();
go_forward(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "http://example.com/")
return;
@ -278,7 +310,7 @@ add_test(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
gBrowser.goBack();
go_back(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
@ -309,7 +341,7 @@ add_test(function() {
var search = aManager.document.getElementById("header-search");
search.focus();
search.value = "bar";
EventUtils.synthesizeKey("VK_RETURN", {});
EventUtils.synthesizeKey("VK_RETURN", {}, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
@ -323,13 +355,13 @@ add_test(function() {
info("Part 3");
is_in_detail(aManager, "addons://search/", true, false);
gBrowser.goBack();
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"]);
gBrowser.goForward();
go_forward(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 5");
is_in_detail(aManager, "addons://search/", true, false);
@ -342,8 +374,15 @@ add_test(function() {
});
});
// Tests that going back to a detail view loaded from a search result works
// 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(null, function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
@ -376,7 +415,7 @@ add_test(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
gBrowser.goBack();
go_back(aManager);
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
return;
@ -386,7 +425,7 @@ add_test(function() {
info("Part 5");
is_in_detail(aManager, "addons://search/", true, true);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 6");
is_in_search(aManager, "bar", true, true);
@ -404,7 +443,13 @@ add_test(function() {
});
// 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(null, function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
@ -417,7 +462,7 @@ add_test(function() {
gBrowser.reload();
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
@ -425,7 +470,7 @@ add_test(function() {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/extension", false, true);
@ -439,7 +484,13 @@ add_test(function() {
});
// 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);
@ -453,7 +504,7 @@ add_test(function() {
gBrowser.reload();
gBrowser.addEventListener("pageshow", function(event) {
if (event.target.location != "about:addons")
if (event.target.location != "about:addons")
return;
gBrowser.removeEventListener("pageshow", arguments.callee, false);
@ -461,7 +512,7 @@ add_test(function() {
info("Part 3");
is_in_detail(aManager, "addons://list/extension", true, false);
gBrowser.goBack();
go_back(aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
is_in_list(aManager, "addons://list/extension", false, true);
@ -492,11 +543,33 @@ add_test(function() {
{ }, aManager);
wait_for_view_load(aManager, function() {
// TODO until bug 590661 is fixed the back button will be enabled
is_in_list(aManager, "addons://list/extension", true, false);
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) {
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);
});
});

Просмотреть файл

@ -438,7 +438,7 @@ add_test(function() {
var version = gManagerWindow.document.getElementById("detail-version").value;
is(version, item.mAddon.version, "Version in detail view should be correct");
EventUtils.synthesizeMouseAtCenter(gManagerWindow.document.getElementById("back-btn"),
EventUtils.synthesizeMouseAtCenter(gManagerWindow.document.getElementById("category-search"),
{ }, gManagerWindow);
wait_for_view_load(gManagerWindow, run_next_double_click_test);
});

Просмотреть файл

@ -6,29 +6,32 @@ Components.utils.import("resource://gre/modules/AddonManager.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const RELATIVE_DIR = "browser/toolkit/mozapps/extensions/test/browser/";
var pathParts = gTestPath.split("/");
// Drop the test filename
pathParts.splice(pathParts.length - 1);
var gTestInWindow = /-window$/.test(pathParts[pathParts.length - 1]);
// Drop the UI type
pathParts.splice(pathParts.length - 1);
pathParts.push("browser");
const RELATIVE_DIR = pathParts.slice(4).join("/") + "/";
const TESTROOT = "http://example.com/" + RELATIVE_DIR;
const TESTROOT2 = "http://example.org/" + RELATIVE_DIR;
const CHROMEROOT = pathParts.join("/") + "/";
const MANAGER_URI = "about:addons";
const INSTALL_URI = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
const PREF_SEARCH_MAXRESULTS = "extensions.getAddons.maxResults";
const CHROME_NAME = "mochikit";
function getChromeRoot(path) {
if (path === undefined) {
return "chrome://" + CHROME_NAME + "/content/" + RELATIVE_DIR;
}
return getRootDirectory(path);
}
var gPendingTests = [];
var gTestsRun = 0;
var gTestStart = null;
var gUseInContentUI = ("switchToTabHavingURI" in window);
var gUseInContentUI = !gTestInWindow && ("switchToTabHavingURI" in window);
// Turn logging on for all tests
Services.prefs.setBoolPref(PREF_LOGGING_ENABLED, true);
@ -80,20 +83,17 @@ function run_next_test() {
}
function get_addon_file_url(aFilename) {
var chromeroot = getChromeRoot(gTestPath);
try {
var cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
var fileurl = cr.convertChromeURL(makeURI(chromeroot + "addons/" + aFilename));
var fileurl = cr.convertChromeURL(makeURI(CHROMEROOT + "addons/" + aFilename));
return fileurl.QueryInterface(Ci.nsIFileURL);
} catch(ex) {
var jar = getJar(chromeroot + "addons/" + aFilename);
var jar = getJar(CHROMEROOT + "addons/" + aFilename);
var tmpDir = extractJarToTmp(jar);
tmpDir.append(aFilename);
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
return ios.newFileURI(tmpDir).QueryInterface(Ci.nsIFileURL);
return Services.io.newFileURI(tmpDir).QueryInterface(Ci.nsIFileURL);
}
}
@ -215,10 +215,10 @@ function open_manager(aView, aCallback, aLoadCallback) {
return;
}
openDialog(MANAGER_URI).addEventListener("load", function() {
this.removeEventListener("load", arguments.callee, false);
openDialog(MANAGER_URI).addEventListener("pageshow", function() {
this.removeEventListener("pageshow", arguments.callee, true);
setup_manager(this);
}, false);
}, true);
}
function close_manager(aManagerWindow, aCallback) {