Bug 1536556 - Replace raw thrown Cr.ERRORs with Components.Exception. r=mossop,remote-protocol-reviewers,marionette-reviewers,whimboo,necko-reviewers,geckoview-reviewers,valentin,agi

Raw Cr.ERROR don't get stack information, same as throwing JS literals instead
of `new Error()`s.

This was done automatically with a new eslint rule that will be introduced in
the next commit.  One instance of a raw Cr.ERROR was not replaced since it is
used in a test that specifically checks the preservation of raw Cr values in
XPCJS.  The rule will be disabled for that instance.

Differential Revision: https://phabricator.services.mozilla.com/D28073
This commit is contained in:
Ian Moody 2020-05-05 17:41:36 +00:00
parent be41cb6dfb
commit 011b59d595
135 changed files with 285 additions and 285 deletions

View File

@ -6015,7 +6015,7 @@ nsBrowserAccess.prototype = {
openURI(aURI, aOpenWindowInfo, aWhere, aFlags, aTriggeringPrincipal, aCsp) {
if (!aURI) {
Cu.reportError("openURI should only be called with a valid URI");
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return this.getContentWindowOrOpenURI(
aURI,
@ -6045,7 +6045,7 @@ nsBrowserAccess.prototype = {
"nsBrowserAccess.openURI did not expect aOpenWindowInfo to be " +
"passed if the context is OPEN_EXTERNAL."
);
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
if (isExternal && aURI && aURI.schemeIs("chrome")) {

View File

@ -1515,7 +1515,7 @@ class nsContextMenu {
timer.cancel();
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};

View File

@ -5725,7 +5725,7 @@
!aBrowser.frameLoader ||
!aBrowser.frameLoader.remoteTab
) {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// Tell our caller to redirect the load into this newly created process.

View File

@ -18,7 +18,7 @@ const kPromptServiceFactory = Cm.getClassObject(
var fakePromptServiceFactory = {
createInstance(aOuter, aIid) {
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return promptService.QueryInterface(aIid);
},

View File

@ -38,7 +38,7 @@ function AboutModule() {}
AboutModule.prototype = {
newChannel(aURI, aLoadInfo) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
getURIFlags(aURI) {
@ -62,13 +62,13 @@ AboutModule.prototype = {
var AboutModuleFactory = {
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new AboutModule().QueryInterface(aIID);
},
lockFactory(aLock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),

View File

@ -419,7 +419,7 @@ nsBrowserContentHandler.prototype = {
// scripts or applications handle the situation as if Firefox was not
// already running.
if (cmdLine.handleFlag("remote", true)) {
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
var uriparam;
@ -878,7 +878,7 @@ nsBrowserContentHandler.prototype = {
cmdLine.length != urlFlagIdx + 2 ||
/firefoxurl(-[a-f0-9]+)?:/i.test(urlParam)
) {
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
var isDefault = false;
try {
@ -892,7 +892,7 @@ nsBrowserContentHandler.prototype = {
if (isDefault) {
// Firefox is already the default HTTP handler.
// We don't have to show the instruction page.
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
}
},

View File

@ -1078,7 +1078,7 @@ const DownloadsViewPrototype = {
* @note Subclasses should override this.
*/
onDownloadStateChanged(download) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
@ -1110,7 +1110,7 @@ const DownloadsViewPrototype = {
* @note Subclasses should override this.
*/
onDownloadRemoved(download) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
@ -1120,7 +1120,7 @@ const DownloadsViewPrototype = {
* @note Subclasses should override this.
*/
_refreshProperties() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
@ -1129,7 +1129,7 @@ const DownloadsViewPrototype = {
* @note Subclasses should override this.
*/
_updateView() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**

View File

@ -755,7 +755,7 @@ PlacesController.prototype = {
async newItem(aType) {
let ip = this._view.insertionPoint;
if (!ip) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
let bookmarkGuid = PlacesUIUtils.showBookmarkDialog(
@ -778,7 +778,7 @@ PlacesController.prototype = {
async newSeparator() {
var ip = this._view.insertionPoint;
if (!ip) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
let index = await ip.getIndex();
@ -1266,7 +1266,7 @@ PlacesController.prototype = {
// No reason to proceed if there isn't a valid insertion point.
let ip = this._view.insertionPoint;
if (!ip) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
let action = this.clipboardAction;

View File

@ -767,7 +767,7 @@ PlacesTreeView.prototype = {
// XXX bug 517701: We don't know what to do when the root node is removed.
if (aNode == this._rootNode) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
// Bail out for hidden separators.
@ -781,7 +781,7 @@ PlacesTreeView.prototype = {
: this._getRowForNode(aParentNode, true);
let oldRow = this._getRowForNode(aNode, true, parentRow, aOldIndex);
if (oldRow < 0) {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// If the node was exclusively selected, the node next to it will be
@ -847,7 +847,7 @@ PlacesTreeView.prototype = {
: this._getRowForNode(aOldParent, true);
let oldRow = this._getRowForNode(aNode, true, oldParentRow, aOldIndex);
if (oldRow < 0) {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// If this node is a container it could take up more than one row.
@ -1225,7 +1225,7 @@ PlacesTreeView.prototype = {
*/
nodeForTreeIndex(aIndex) {
if (aIndex > this._rows.length) {
throw Cr.NS_ERROR_INVALID_ARG;
throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
return this._getNodeForRow(aIndex);
@ -1394,7 +1394,7 @@ PlacesTreeView.prototype = {
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) {
if (!this._result) {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
if (this._controller.disableUserActions) {
@ -1634,7 +1634,7 @@ PlacesTreeView.prototype = {
toggleOpenState: function PTV_toggleOpenState(aRow) {
if (!this._result) {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let node = this._rows[aRow];
@ -1661,7 +1661,7 @@ PlacesTreeView.prototype = {
cycleHeader: function PTV_cycleHeader(aColumn) {
if (!this._result) {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// Sometimes you want a tri-state sorting, and sometimes you don't. This
@ -1764,7 +1764,7 @@ PlacesTreeView.prototype = {
break;
default:
throw Cr.NS_ERROR_INVALID_ARG;
throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._result.sortingMode = newSort;
},

View File

@ -3652,7 +3652,7 @@ class InternalHandlerInfoWrapper extends HandlerInfoWrapper {
}
get enabled() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
get description() {

View File

@ -20,7 +20,7 @@ const mockUpdateManager = {
createInstance(outer, iiD) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iiD);
},

View File

@ -31,7 +31,7 @@ let TestAboutPage = {
createInstance(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},

View File

@ -119,7 +119,7 @@ class BrowserDOMWindow {
console.error(
"createContentWindow should never be called from a remote browser"
);
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
/**
@ -135,7 +135,7 @@ class BrowserDOMWindow {
*/
openURI(uri, openWindowInfo, where, flags, triggeringPrincipal, csp) {
console.error("openURI should never be called from a remote browser");
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
/**

View File

@ -104,7 +104,7 @@ function constructOnePageCmdLine(aURL) {
if (aIndex == 0 && this._argCount) {
return this._arg;
}
throw Cr.NS_ERROR_INVALID_ARG;
throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
},
findFlag() {
@ -112,11 +112,11 @@ function constructOnePageCmdLine(aURL) {
},
removeArguments() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
handleFlag() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
handleFlagWithParam() {
@ -139,15 +139,15 @@ function constructOnePageCmdLine(aURL) {
preventDefault: false,
get workingDirectory() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
get windowContext() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
resolveFile() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
resolveURI() {

View File

@ -1001,7 +1001,7 @@ PdfStreamConverter.prototype = {
// nsIStreamConverter::convert
convert(aFromStream, aFromType, aToType, aCtxt) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
// nsIStreamConverter::asyncConvertData

View File

@ -28,7 +28,7 @@ function StreamConverterFactory() {
if (Services.cpmm.sharedData.get("pdfjs.enabled")) {
return new PdfStreamConverter();
}
throw Cr.NS_ERROR_FACTORY_NOT_REGISTERED;
throw Components.Exception("", Cr.NS_ERROR_FACTORY_NOT_REGISTERED);
}
var EXPORTED_SYMBOLS = ["StreamConverterFactory"];

View File

@ -330,7 +330,7 @@ class FaviconLoad {
if (iid.equals(Ci.nsIChannelEventSink)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
}

View File

@ -30,7 +30,7 @@ function run_test() {
contractID: XULAPPINFO_CONTRACTID,
createInstance(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return XULAppInfo.QueryInterface(iid);
},

View File

@ -18,7 +18,7 @@ ProtocolHandler.prototype = {
defaultPort: -1,
allowPort: () => false,
newChannel() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
};
@ -75,7 +75,7 @@ function run_test() {
contractID: "@mozilla.org/xre/app-info;1",
createInstance(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return XULAppInfo.QueryInterface(iid);
},
@ -94,7 +94,7 @@ function run_test() {
"@mozilla.org/network/protocol;1?name=" + testProtocols[i].scheme,
createInstance(aOuter, aIID) {
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
let handler = new ProtocolHandler(this.scheme, this.flags, this.CID);
return handler.QueryInterface(aIID);

View File

@ -106,7 +106,7 @@ JsonViewSniffer.prototype = {
const JsonSnifferFactory = {
createInstance: function(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new JsonViewSniffer().QueryInterface(iid);
},
@ -120,7 +120,7 @@ const JsonSnifferFactory = {
const JsonViewFactory = {
createInstance: function(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return JsonViewService.createInstance().QueryInterface(iid);
},

View File

@ -120,10 +120,10 @@ BrowserElementWebNavigation.prototype = {
// Bug 1233803 - accessing the sessionHistory of remote browsers should be
// done in content scripts.
get sessionHistory() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set sessionHistory(value) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
_sendMessage(message, data) {
@ -142,7 +142,7 @@ BrowserElementWebNavigation.prototype = {
},
swapBrowser(browser) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
copyStateFrom(otherWebNavigation) {

View File

@ -83,7 +83,7 @@ NetworkResponseListener.prototype = {
if (this._wrappedNotificationCallbacks) {
return this._wrappedNotificationCallbacks.getInterface(iid);
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
/**

View File

@ -50,7 +50,7 @@ WebProgressListener.prototype = {
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
},
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {

View File

@ -46,7 +46,7 @@ function test() {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
}

View File

@ -44,7 +44,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=789773
if (iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsIWebProgressListener))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
}

View File

@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1342989
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
}

View File

@ -82,7 +82,7 @@ DOMRequestIpcHelper.prototype = {
this._listeners[name].count++;
return;
} else {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
}
@ -279,7 +279,7 @@ DOMRequestIpcHelper.prototype = {
Cu.reportError(
"DOMRequestHelper trying to create a DOMRequest without a valid window, failing."
);
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return Services.DOMRequest.createRequest(this._window);
},
@ -295,7 +295,7 @@ DOMRequestIpcHelper.prototype = {
Cu.reportError(
"DOMRequestHelper trying to create a Promise without a valid window, failing."
);
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return new this._window.Promise(aPromiseInit);
},

View File

@ -164,7 +164,7 @@ add_task(async function block_pending_request_test() {
if (aIID.equals(Ci.imgIScriptedNotificationObserver)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};

View File

@ -82,13 +82,13 @@ CustomChannel.prototype = {
return false;
},
cancel() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
suspend() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
resume() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]),
};

View File

@ -41,7 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800386
forwardFailed = true;
}
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIInterfaceRequestor])

View File

@ -127,15 +127,15 @@ BrowserElementPrompt.prototype = {
checkMsg,
checkState
) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
promptPassword(title, text, password, checkMsg, checkState) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
select(title, text, aSelectList, aOutSelection) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
_buildConfirmExButtonProperties(
@ -237,7 +237,7 @@ BrowserElementAuthPrompt.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIAuthPrompt2]),
promptAuth: function promptAuth(channel, level, authInfo) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
asyncPromptAuth: function asyncPromptAuth(
@ -254,13 +254,13 @@ BrowserElementAuthPrompt.prototype = {
authInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY &&
authInfo.flags & Ci.nsIAuthInformation.ONLY_PASSWORD
) {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
let frame = this._getFrameFromChannel(channel);
if (!frame) {
debug("Cannot get frame, asyncPromptAuth fail");
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
let browserElementParent = BrowserElementPromptService.getBrowserElementParentForFrame(
@ -269,7 +269,7 @@ BrowserElementAuthPrompt.prototype = {
if (!browserElementParent) {
debug("Failed to load browser element parent.");
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
let consumer = {
@ -671,7 +671,7 @@ var BrowserElementPromptService = {
var newFactory = {
createInstance(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return newInstance.QueryInterface(iid);
},

View File

@ -221,7 +221,7 @@ setupPrototype(GlobalPCList, {
_xpcom_factory: {
createInstance(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return _globalPCList.QueryInterface(iid);
},

View File

@ -39,12 +39,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874090
aIID.equals(Ci.nsIAlertsService)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
createInstance: function(aOuter, aIID) {
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
}

View File

@ -57,7 +57,7 @@ var testObserver = {
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
};

View File

@ -60,7 +60,7 @@ var testObserver = {
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
};

View File

@ -104,7 +104,7 @@ var testObserver = {
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
};

View File

@ -109,7 +109,7 @@ var testObserver = {
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
};

View File

@ -39,7 +39,7 @@
if (iid.equals(nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
};
var loadCount = 0;

View File

@ -66,7 +66,7 @@ function do_get_profile_startup() {
if (prop == "ProfDS") {
return file.clone();
}
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
QueryInterface: ChromeUtils.generateQI(["nsIDirectoryServiceProvider"]),
};

View File

@ -62,12 +62,12 @@ PresentationTransportBuilder.prototype = {
buildDataChannelTransport(aRole, aWindow, aListener) {
if (!aRole || !aWindow || !aListener) {
log("buildDataChannelTransport with illegal parameters");
throw Cr.NS_ERROR_ILLEGAL_VALUE;
throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
if (this._window) {
log("buildDataChannelTransport has started.");
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
log("buildDataChannelTransport with role " + aRole);
@ -122,7 +122,7 @@ PresentationTransportBuilder.prototype = {
};
break;
default:
throw Cr.NS_ERROR_ILLEGAL_VALUE;
throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
// TODO bug 1228235 we should have a way to let device providers customize
@ -333,7 +333,7 @@ PresentationTransport.prototype = {
// nsIPresentationTransport
get selfAddress() {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
get callback() {
@ -373,7 +373,7 @@ PresentationTransport.prototype = {
}
if (!this._callback) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
this._enableDataNotification = true;
@ -402,7 +402,7 @@ PresentationTransport.prototype = {
_doNotifyData(aData) {
if (!this._callback) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
if (aData instanceof this._window.Blob) {

View File

@ -53,7 +53,7 @@ PresentationControlService.prototype = {
if (this._isServiceInit()) {
DEBUG &&
log("PresentationControlService - server socket has been initialized"); // jshint ignore:line
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
/**
@ -94,7 +94,7 @@ PresentationControlService.prototype = {
_serverSocketInit(aPort, aCert) {
if (!this._serverSocket) {
DEBUG && log("PresentationControlService - create server socket fail."); // jshint ignore:line
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
try {
@ -112,7 +112,7 @@ PresentationControlService.prototype = {
// NS_ERROR_SOCKET_ADDRESS_IN_USE
DEBUG &&
log("PresentationControlService - init server socket fail: " + e); // jshint ignore:line
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
this._port = this._serverSocket.port;
@ -235,7 +235,7 @@ PresentationControlService.prototype = {
} catch (e) {
DEBUG && log("PresentationControlService - createTransport throws: " + e); // jshint ignore:line
// Pop the exception to |TCPDevice.establishControlChannel|
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return socketTransport;
},
@ -947,7 +947,7 @@ TCPControlChannel.prototype = {
reconnect(aPresentationId, aUrl) {
DEBUG && log("TCPControlChannel - reconnect with role: " + this._direction); // jshint ignore:line
if (this._direction != "sender") {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
this._stateMachine.reconnect(aPresentationId, aUrl);

View File

@ -85,7 +85,7 @@ const mockedServerSocket = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIServerSocket, Ci.nsIFactory]),
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},
@ -227,7 +227,7 @@ const mockedDevicePrompt = {
]),
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},
@ -260,7 +260,7 @@ const mockedSessionTransport = {
]),
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},
@ -362,7 +362,7 @@ const mockedNetworkManager = {
QueryInterface: ChromeUtils.generateQI([Ci.nsINetworkManager, Ci.nsIFactory]),
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},
@ -380,7 +380,7 @@ const mockedRequestUIGlue = {
]),
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},

View File

@ -165,7 +165,7 @@ const mockDevice = {
type: "type",
establishControlChannel(url, presentationId) {
if (triggerControlChannelError) {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
sendAsyncMessage("control-channel-established");
return mockControlChannelOfSender;
@ -185,7 +185,7 @@ const mockDevicePrompt = {
]),
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},
@ -220,7 +220,7 @@ const mockRequestUIGlue = {
},
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},

View File

@ -62,7 +62,7 @@ function loadPrivilegedScriptTest() {
const interfaces = [Ci.nsIPresentationChannelDescription];
if (!interfaces.some(v => iid.equals(v))) {
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
return this;
},
@ -102,13 +102,13 @@ function loadPrivilegedScriptTest() {
];
if (!interfaces.some(v => iid.equals(v))) {
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
return this;
},
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},

View File

@ -52,7 +52,7 @@ function MockFactory(aClass) {
MockFactory.prototype = {
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
switch (typeof this._cls) {
case "function":
@ -64,7 +64,7 @@ MockFactory.prototype = {
}
},
lockFactory(aLock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -27,7 +27,7 @@ XPCOMUtils.defineLazyGetter(this, "PushService", function() {
return PushService;
}
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
});
// Observer notification topics for push messages and subscription status

View File

@ -41,12 +41,12 @@ let mockAlertsService = {
if (aIID.equals(Ci.nsISupports) || aIID.equals(Ci.nsIAlertsService)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
createInstance(aOuter, aIID) {
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},

View File

@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
if (aIID.equals(Ci.nsIObserver) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
},
observe: function(subject, topic, data) {
obs.removeObserver(observer, "cycle-collector-begin");

View File

@ -12,12 +12,12 @@ var provider = {
]),
createInstance: function eventsink_ci(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
lockFactory: function eventsink_lockf(lock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
startup() {},
watch() {},

View File

@ -12,12 +12,12 @@ var provider = {
]),
createInstance: function eventsink_ci(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
lockFactory: function eventsink_lockf(lock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
startup() {},
watch() {},

View File

@ -20,7 +20,7 @@ function loadFile(aUriSpec) {
enablePrivilege("UniversalXPConnect");
var serv = Cc[IOSERVICE_CTRID].getService(nsIIOService);
if (!serv) {
throw Cr.ERR_FAILURE;
throw Components.Exception("", Cr.ERR_FAILURE);
}
var chan = NetUtil.newChannel({
uri: aUriSpec,

View File

@ -13,7 +13,7 @@ var factory = {
throw new Error("There is no history service");
},
lockFactory() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -28,7 +28,7 @@ var observer = {
if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIObserver))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
observe(subject, topic, data) {

View File

@ -35,7 +35,7 @@ function printpreview() {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
}
var prefs = Cc["@mozilla.org/preferences-service;1"]

View File

@ -35,7 +35,7 @@ function printpreview() {
if (iid.equals(Ci.nsIWebProgessListener) ||
iid.equals(Ci.nsISupportsWeakReference))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
}
var prefs = Cc["@mozilla.org/preferences-service;1"]

View File

@ -42,7 +42,7 @@ function printpreview(hasMozPrintCallback) {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference))
return this;
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
}
var prefs = Cc["@mozilla.org/preferences-service;1"]

View File

@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1160724
QueryInterface(iid) {
if (!iid.equals(Ci.nsISupports) &&
!iid.equals(Ci.nsIConsoleListener)) {
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
return this;
},

View File

@ -1022,7 +1022,7 @@ FilePickerDelegate.prototype = {
aMode === Ci.nsIFilePicker.modeGetFolder ||
aMode === Ci.nsIFilePicker.modeSave
) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
this._prompt = new PromptDelegate(aParent);
this._msg = {
@ -1044,7 +1044,7 @@ FilePickerDelegate.prototype = {
},
show() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
open(aFilePickerShownCallback) {
@ -1084,7 +1084,7 @@ FilePickerDelegate.prototype = {
get file() {
if (!this._fileData) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
const fileData = this._fileData[0];
if (!fileData) {
@ -1099,7 +1099,7 @@ FilePickerDelegate.prototype = {
*_getEnumerator(aDOMFile) {
if (!this._fileData) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
for (const fileData of this._fileData) {
@ -1123,7 +1123,7 @@ FilePickerDelegate.prototype = {
get domFileOrDirectory() {
if (!this._fileData) {
throw Cr.NS_ERROR_NOT_AVAILABLE;
throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return this._fileData[0] ? this._fileData[0].domFile : null;
},

View File

@ -176,12 +176,12 @@ PushSubscription.prototype = {
/** The last time a message was sent to this subscription. */
get lastPush() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/** The total number of messages sent to this subscription. */
get pushCount() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
@ -203,7 +203,7 @@ PushSubscription.prototype = {
/** The private key used to decrypt incoming push messages, in JWK format */
get p256dhPrivateKey() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**

View File

@ -403,7 +403,7 @@ function run_test() {
if (aIID.equals(Ci.nsIObserver) || aIID.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_NOINTERFACE;
throw Components.Exception("", Cr.NS_NOINTERFACE);
}
observe(aSubject, aTopic, aState) {

View File

@ -44,7 +44,7 @@ CustomProtocolHandler.prototype = {
/** nsIFactory */
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(aIID);
},
@ -78,7 +78,7 @@ CustomChannel.prototype = {
return this._uploadStream;
},
set uploadStream(val) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
setUploadStream(aStream, aContentType, aContentLength) {
this._uploadStream = aStream;
@ -105,10 +105,10 @@ CustomChannel.prototype = {
return -1;
},
set contentLength(val) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
open() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
asyncOpen(aListener) {
var data = `

View File

@ -575,7 +575,7 @@ function CustomPipe(name) {
);
if (this._readable < count || self._data.length < count) {
throw Cr.NS_BASE_STREAM_WOULD_BLOCK;
throw Components.Exception("", Cr.NS_BASE_STREAM_WOULD_BLOCK);
}
this._readable -= count;
return self._data.splice(0, count);
@ -881,7 +881,7 @@ function CustomPipe(name) {
);
if (this._writable < bytes.length) {
throw Cr.NS_BASE_STREAM_WOULD_BLOCK;
throw Components.Exception("", Cr.NS_BASE_STREAM_WOULD_BLOCK);
}
self._data.push.apply(self._data, bytes);
@ -907,7 +907,7 @@ function CustomPipe(name) {
throw self._status;
}
if (this._writable === 0) {
throw Cr.NS_BASE_STREAM_WOULD_BLOCK;
throw Components.Exception("", Cr.NS_BASE_STREAM_WOULD_BLOCK);
}
var actualWritten;

View File

@ -279,7 +279,7 @@ OpenCallback.prototype = {
LOG_C2(self, "Notifying");
self.goon(entry);
});
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
};

View File

@ -257,12 +257,12 @@ ChannelEventSink.prototype = {
if (iid.equals(Ci.nsIChannelEventSink)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
asyncOnChannelRedirect(oldChannel, newChannel, flags, callback) {
if (this._flags & ES_ABORT_REDIRECT) {
throw Cr.NS_BINDING_ABORTED;
throw Components.Exception("", Cr.NS_BINDING_ABORTED);
}
callback.onRedirectVerifyCallback(Cr.NS_OK);

View File

@ -20,12 +20,12 @@ var unsafeAboutModule = {
var factory = {
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return unsafeAboutModule.QueryInterface(aIID);
},
lockFactory(aLock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -95,7 +95,7 @@ Requestor.prototype = {
return this.prompter;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
prompter: null,
@ -159,7 +159,7 @@ Test.prototype = {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable(request, stream, offset, count) {

View File

@ -148,7 +148,7 @@ Requestor.prototype = {
getInterface: function requestor_gi(iid) {
if (iid.equals(Ci.nsIAuthPrompt)) {
dump("authprompt1 not implemented\n");
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
if (iid.equals(Ci.nsIAuthPrompt2)) {
try {
@ -161,7 +161,7 @@ Requestor.prototype = {
do_throw(e);
}
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
prompt2: null,
@ -197,7 +197,7 @@ var listener = {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {

View File

@ -183,7 +183,7 @@ AuthPrompt2.prototype = {
},
asyncPromptAuth: function ap2_async(chan, cb, ctx, lvl, info) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
@ -211,7 +211,7 @@ Requestor.prototype = {
return this.prompt2;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
prompt1: null,
@ -231,7 +231,7 @@ RealmTestRequestor.prototype = {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
promptAuth: function realmtest_checkAuth(channel, level, authInfo) {
@ -241,7 +241,7 @@ RealmTestRequestor.prototype = {
},
asyncPromptAuth: function realmtest_async(chan, cb, ctx, lvl, info) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
@ -265,7 +265,7 @@ var listener = {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {

View File

@ -36,7 +36,7 @@ NotificationCallbacks.prototype = {
Assert.equal(newChan.originalURI.spec, this._newURI.spec);
Assert.equal(newChan.originalURI, newChan.URI);
Assert.equal(newChan.URI.spec, this._newURI.spec);
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
};

View File

@ -15,7 +15,7 @@ XPCOMUtils.defineLazyGetter(this, "systemSettings", function() {
mainThreadOnly: true,
PACURI: "http://localhost:" + httpserv.identity.primaryPort + "/redirect",
getProxyForURI(aURI) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
});

View File

@ -23,12 +23,12 @@ var sniffer = {
QueryInterface: ChromeUtils.generateQI(["nsIFactory", "nsIContentSniffer"]),
createInstance: function sniffer_ci(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
lockFactory: function sniffer_lockf(lock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
getMIMETypeFromContent(request, data, length) {
@ -69,11 +69,11 @@ var listener = {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
},
onStopRequest: function test_onStopR(request, status) {

View File

@ -42,11 +42,11 @@ var listener = {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {
throw Cr.NS_ERROR_UNEXPECTED;
throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
},
onStopRequest: function test_onStopR(request, status) {

View File

@ -22,12 +22,12 @@ var eventsink = {
QueryInterface: ChromeUtils.generateQI(["nsIFactory", "nsIChannelEventSink"]),
createInstance: function eventsink_ci(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
lockFactory: function eventsink_lockf(lock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
asyncOnChannelRedirect: function eventsink_onredir(
@ -38,14 +38,14 @@ var eventsink = {
) {
// veto
this.called = true;
throw Cr.NS_BINDING_ABORTED;
throw Components.Exception("", Cr.NS_BINDING_ABORTED);
},
getInterface: function eventsink_gi(iid) {
if (iid.equals(Ci.nsIChannelEventSink)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
called: false,
@ -86,7 +86,7 @@ var listener = {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {

View File

@ -59,7 +59,7 @@ class UnxpectedAuthPrompt2 {
}
asyncPromptAuth() {
this.signal.triggered = true;
throw Cr.ERROR_UNEXPECTED;
throw Components.Exception("", Cr.ERROR_UNEXPECTED);
}
}
@ -72,7 +72,7 @@ class AuthRequestor {
if (iid.equals(Ci.nsIAuthPrompt2)) {
return this.prompt();
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
}

View File

@ -77,7 +77,7 @@ class UnxpectedAuthPrompt2 {
}
asyncPromptAuth() {
this.signal.triggered = true;
throw Cr.ERROR_UNEXPECTED;
throw Components.Exception("", Cr.ERROR_UNEXPECTED);
}
}
@ -105,7 +105,7 @@ class AuthRequestor {
if (iid.equals(Ci.nsIAuthPrompt2)) {
return this.prompt();
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
}

View File

@ -128,7 +128,7 @@ function makeListener(headerIdx, bodyIdx) {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {

View File

@ -44,7 +44,7 @@ var listenerCallback = {
if (iid.equals(Ci.nsIProgressEventSink)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
onProgress(request, progress, progressMax) {

View File

@ -42,7 +42,7 @@ var progressCallback = {
) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
onStartRequest(request) {

View File

@ -30,7 +30,7 @@ TestProtocolHandler.prototype = {
Ci.nsIProtocolHandler.ALLOWS_PROXY |
Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
newChannel(uri, aLoadInfo) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
allowPort(port, scheme) {
return true;
@ -98,7 +98,7 @@ TestFilter.prototype = {
applyFilter(uri, pi, cb) {
if (this._result == THROW) {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
var pi_tail = pps.newProxyInfo(

View File

@ -41,7 +41,7 @@ TestProtocolHandler.prototype = {
Ci.nsIProtocolHandler.ALLOWS_PROXY |
Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
newChannel(uri, aLoadInfo) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
allowPort(port, scheme) {
return true;

View File

@ -136,7 +136,7 @@ var connectHandler = {
) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};

View File

@ -51,7 +51,7 @@ Requestor.prototype = {
return this.prompt2;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
prompt2: null,

View File

@ -120,7 +120,7 @@ Requestor.prototype = {
return this.prompt;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
prompt: null,
@ -145,7 +145,7 @@ var listener = {
} catch (e) {
do_throw("Unexpected exception: " + e);
}
throw Cr.NS_ERROR_ABORT;
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable: function test_ODA() {

View File

@ -215,7 +215,7 @@ class DNSListener {
if (aIID.equals(Ci.nsIDNSListener) || aIID.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
// Implement then so we can await this as a promise.

View File

@ -189,7 +189,7 @@ var PACSystemSettings = {
mainThreadOnly: true,
PACURI: null,
getProxyForURI: function getProxyForURI(aURI) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};

View File

@ -566,7 +566,7 @@ const MarionetteFactory = {
createInstance(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
if (!this.instance_) {

View File

@ -38,7 +38,7 @@ AboutPage.prototype = {
createInstance(outer, iid) {
if (outer !== null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},

View File

@ -66,7 +66,7 @@ var makeFakeAppDir = function() {
return appD.clone();
}
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
QueryInterace(iid) {
@ -77,7 +77,7 @@ var makeFakeAppDir = function() {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};

View File

@ -124,7 +124,7 @@ var updateAppInfo = function(options) {
let factory = {
createInstance(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return currentAppInfo.QueryInterface(iid);

View File

@ -57,7 +57,7 @@ var MockRegistrar = Object.freeze({
let factory = {
createInstance(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
let wrappedMock;
@ -78,7 +78,7 @@ var MockRegistrar = Object.freeze({
return wrappedMock.QueryInterface(iid);
},
lockFactory(lock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -50,7 +50,7 @@ class MockRegistry {
get valueCount() {
if (!this.values) {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return this.values.size;
},
@ -68,7 +68,7 @@ class MockRegistry {
getValueName(index) {
if (!this.values || index >= this.values.size) {
throw Cr.NS_ERROR_FAILURE;
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
let names = Array.from(this.values.keys());
return names[index];

View File

@ -21,12 +21,12 @@ var newFactory = function(window) {
return {
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new MockColorPickerInstance(window).QueryInterface(aIID);
},
lockFactory(aLock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -31,12 +31,12 @@ var newFactory = function(window) {
return {
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new MockFilePickerInstance(window).QueryInterface(aIID);
},
lockFactory(aLock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -18,12 +18,12 @@ var newClassID = Cc["@mozilla.org/uuid-generator;1"]
var newFactory = {
createInstance(aOuter, aIID) {
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new MockPermissionPromptInstance().QueryInterface(aIID);
},
lockFactory(aLock) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
};

View File

@ -24,7 +24,7 @@ class ControllersChild extends JSWindowActorChild {
if (value.type == "long") {
params.setLongValue(name, parseInt(value.value));
} else {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
}
this.docShell.doCommandWithParams(data.cmd, params);

View File

@ -73,7 +73,7 @@ function mockServicesChromeScript() {
createInstance: function(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},

View File

@ -81,7 +81,7 @@ add_task(async function test_webRequest_auth_nonblocking_forwardAuthProvider() {
getInterface: ChromeUtils.generateQI([Ci.nsIAuthPromptProvider,
Ci.nsIAuthPrompt2]),
promptAuth(channel, level, authInfo) {
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
getAuthPrompt(reason, iid) {
return this;
@ -140,7 +140,7 @@ add_task(async function test_webRequest_auth_nonblocking_forwardAuthPrompt2() {
Ci.nsIAuthPrompt2]),
getInterface: ChromeUtils.generateQI([Ci.nsIAuthPrompt2]),
promptAuth(request, level, authInfo) {
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
asyncPromptAuth(request, callback, context, level, authInfo) {
// We just cancel here, we're only ensuring that non-webrequest

View File

@ -17,7 +17,7 @@ var mockNetworkStatusService = {
createInstance(outer, iiD) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iiD);
},

View File

@ -41,7 +41,7 @@ const mockAlertsService = {
createInstance(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},

View File

@ -317,7 +317,7 @@ var ChannelEventSink = {
// nsIFactory implementation
createInstance(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
@ -341,7 +341,7 @@ class AuthRequestor {
try {
return this.notificationCallbacks.getInterface(iid);
} catch (e) {}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
_getForwardedInterface(iid) {
@ -390,7 +390,7 @@ class AuthRequestor {
return callbacks.getInterface(Ci.nsIAuthPrompt2);
} catch (e) {}
}
throw Cr.NS_ERROR_NO_INTERFACE;
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
// nsIAuthPrompt2 asyncPromptAuth

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