Bug 797410 - Use Components.results instead of hardcoding nsresult values. r=IanN
--- a/suite/browser/nsBrowserContentHandler.js
+++ b/suite/browser/nsBrowserContentHandler.js
@@ -22,17 +22,16 @@ const nsIPrefService = Componen
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString;
const nsISupportsString = Components.interfaces.nsISupportsString;
const nsIURIFixup = Components.interfaces.nsIURIFixup;
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
const nsIWebNavigationInfo = Components.interfaces.nsIWebNavigationInfo;
-const NS_BINDING_ABORTED = 0x804b0002;
const NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
const URI_INHERITS_SECURITY_CONTEXT = nsIHttpProtocolHandler
.URI_INHERITS_SECURITY_CONTEXT;
const NS_GENERAL_STARTUP_PREFIX = "@mozilla.org/commandlinehandler/general-startup;1?type=";
function shouldLoadURI(aURI)
@@ -607,17 +606,17 @@ var nsBrowserContentHandler = {
var webNavInfo = Components.classes["@mozilla.org/webnavigation-info;1"]
.getService(nsIWebNavigationInfo);
if (!webNavInfo.isTypeSupported(contentType, null))
throw NS_ERROR_WONT_HANDLE_CONTENT;
request.QueryInterface(nsIChannel);
handURIToExistingBrowser(request.URI,
nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW, "chrome,all,dialog=no");
- request.cancel(NS_BINDING_ABORTED);
+ request.cancel(Components.results.NS_BINDING_ABORTED);
},
/* nsIFactory */
createInstance: function createInstance(outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
--- a/suite/browser/nsBrowserStatusHandler.js
+++ b/suite/browser/nsBrowserStatusHandler.js
@@ -220,23 +220,21 @@ nsBrowserStatusHandler.prototype =
// request stop outside of loading the document, stop throbbers
// and progress bars and such
if (aRequest) {
var msg = "";
// Get the channel if the request is a channel
if (aRequest instanceof nsIChannel) {
var location = aRequest.URI.spec;
if (location != "about:blank") {
- const kErrorBindingAborted = 0x804B0002;
- const kErrorNetTimeout = 0x804B000E;
switch (aStatus) {
- case kErrorBindingAborted:
+ case Components.results.NS_BINDING_ABORTED:
msg = gNavigatorBundle.getString("nv_stopped");
break;
- case kErrorNetTimeout:
+ case Components.results.NS_ERROR_NET_TIMEOUT:
msg = gNavigatorBundle.getString("nv_timeout");
break;
}
}
}
// If msg is false then we did not have an error (channel may have
// been null, in the case of a stray image load).
if (!msg) {
--- a/suite/common/downloads/uploadProgress.js
+++ b/suite/common/downloads/uploadProgress.js
@@ -46,19 +46,18 @@ function onLoad()
gBundle.getFormattedString("fromSource", [gSource.file.leafName]);
gPersist.progressListener = gProgressListener;
gPersist.saveURI(gSource, null, null, null, null, gTarget, null);
document.documentElement.getButton("cancel").focus();
}
function onUnload()
{
- const NS_BINDING_ABORTED = 0x804b0002;
if (gPersist)
- gPersist.cancel(NS_BINDING_ABORTED);
+ gPersist.cancel(Components.results.NS_BINDING_ABORTED);
gPersist = null;
}
function setPercent(aPercent, aStatus)
{
gPercent = aPercent;
document.title = gBundle.getFormattedString("progressTitlePercent",
[aPercent, gFileName, aStatus]);
--- a/suite/common/sidebar/sidebarOverlay.js
+++ b/suite/common/sidebar/sidebarOverlay.js
@@ -813,33 +813,31 @@ function sidebar_open_default_panel(wait
function SidebarRebuild() {
sidebarObj.panels.initialized = false; // reset so panels are brought in view
var panels = document.getElementById("sidebar-panels");
panels.builder.rebuild();
sidebar_open_default_panel(100, 0);
}
-const NS_ERROR_FILE_NOT_FOUND = 0x80520012;
-
function check_for_missing_panels() {
var tabs = sidebarObj.panels.node.childNodes;
var currHeader;
var currTab;
for (var i = 2; i < tabs.length; i += 2) {
currHeader = tabs[i];
currTab = new sbPanel(currHeader.getAttribute("id"), currHeader, i);
if (!currTab.is_excluded()) {
if (currHeader.hasAttribute("prereq") && currHeader.getAttribute("prereq") != "") {
var prereq_file = currHeader.getAttribute("prereq");
var channel = Services.io.newChannel(prereq_file, null, null);
try {
channel.open();
}
- catch(ex if (ex.result == NS_ERROR_FILE_NOT_FOUND)) {
+ catch(ex if (ex.result == Components.results.NS_ERROR_FILE_NOT_FOUND)) {
sidebarObj.datasource.Assert(RDF.GetResource(currHeader.getAttribute("id")),
RDF.GetResource(NC + "exclude"),
RDF.GetLiteral(sidebarObj.component),
true);
currTab.exclude();
}
}
}