diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/remote-experiment-loader.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/remote-experiment-loader.js index b736dad1ebff..0599d4a0a02d 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/remote-experiment-loader.js +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/remote-experiment-loader.js @@ -132,7 +132,7 @@ function downloadFile(url, cb, lastModified) { console.info("Using binary mode to download jar file."); req.overrideMimeType('text/plain; charset=x-user-defined'); } - req.onreadystatechange = function(aEvt) { + req.addEventListener("readystatechange", function(aEvt) { if (req.readyState == 4) { if (req.status == 200) { // check security channel: @@ -154,7 +154,7 @@ function downloadFile(url, cb, lastModified) { cb(null); } } - }; + }, false); req.send(); } diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js index cb6775ac3887..684948a41bd9 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js @@ -846,7 +846,7 @@ TestPilotExperiment.prototype = { req.setRequestHeader("Content-type", "application/json"); req.setRequestHeader("Content-length", dataString.length); req.setRequestHeader("Connection", "close"); - req.onreadystatechange = function(aEvt) { + req.addEventListener("readystatechange", function(aEvt) { if (req.readyState == 4) { if (req.status == 200 || req.status == 201 || req.status == 202) { let location = req.getResponseHeader("Location"); @@ -887,7 +887,7 @@ TestPilotExperiment.prototype = { callback(false); } } - }; + }, false); req.send(dataString); }); }, @@ -919,7 +919,7 @@ TestPilotExperiment.prototype = { req.setRequestHeader("Content-type", "application/json"); req.setRequestHeader("Content-length", dataString.length); req.setRequestHeader("Connection", "close"); - req.onreadystatechange = function(aEvt) { + req.addEventListener("readystatechange", function(aEvt) { if (req.readyState == 4) { if (req.status == 200 || req.status == 201 || req.status == 202) { logger.info("Quit reason posted successfully " + req.responseText); @@ -933,7 +933,7 @@ TestPilotExperiment.prototype = { } } } - }; + }, false); logger.trace("Sending quit reason."); req.send(dataString); } else { @@ -1069,7 +1069,7 @@ TestPilotBuiltinSurvey.prototype = { req.setRequestHeader("Content-type", "application/json"); req.setRequestHeader("Content-length", params.length); req.setRequestHeader("Connection", "close"); - req.onreadystatechange = function(aEvt) { + req.addEventListener("readystatechange", function(aEvt) { if (req.readyState == 4) { if (req.status == 200 || req.status == 201 || req.status == 202) { @@ -1099,7 +1099,7 @@ TestPilotBuiltinSurvey.prototype = { callback(false); } } - }; + }, false); req.send(params); }); } diff --git a/build/win32/crashinject.cpp b/build/win32/crashinject.cpp index 10e64273016e..cc089735383e 100644 --- a/build/win32/crashinject.cpp +++ b/build/win32/crashinject.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv) wcscpy(slash, L"crashinjectdll.dll"); // now find our target process - HANDLE targetProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD, + HANDLE targetProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION, FALSE, pid); if (targetProc == NULL) { diff --git a/content/base/src/FileIOObject.cpp b/content/base/src/FileIOObject.cpp index af70ca09423d..cfa07bcfa757 100644 --- a/content/base/src/FileIOObject.cpp +++ b/content/base/src/FileIOObject.cpp @@ -43,6 +43,7 @@ #include "nsIDOMProgressEvent.h" #include "nsComponentManagerUtils.h" #include "nsEventDispatcher.h" +#include "xpcprivate.h" #define ERROR_STR "error" #define ABORT_STR "abort" diff --git a/content/base/src/nsDOMFileReader.cpp b/content/base/src/nsDOMFileReader.cpp index ffe992cdb7e2..5b4c1799dcc1 100644 --- a/content/base/src/nsDOMFileReader.cpp +++ b/content/base/src/nsDOMFileReader.cpp @@ -77,7 +77,8 @@ #include "nsIScriptObjectPrincipal.h" #include "nsFileDataProtocolHandler.h" #include "mozilla/Preferences.h" -#include "xpcprivate.h" +#include "xpcprivate.h" +#include "xpcpublic.h" #include "xpcquickstubs.h" #include "jstypedarray.h" diff --git a/content/base/src/nsEventSource.cpp b/content/base/src/nsEventSource.cpp index 7bcb5d3aaa9c..6be83536da16 100644 --- a/content/base/src/nsEventSource.cpp +++ b/content/base/src/nsEventSource.cpp @@ -59,6 +59,7 @@ #include "nsIContentSecurityPolicy.h" #include "nsContentUtils.h" #include "mozilla/Preferences.h" +#include "xpcpublic.h" using namespace mozilla; diff --git a/content/base/src/nsWebSocket.cpp b/content/base/src/nsWebSocket.cpp index 12ab15edc9a2..7268c138f129 100644 --- a/content/base/src/nsWebSocket.cpp +++ b/content/base/src/nsWebSocket.cpp @@ -78,6 +78,7 @@ #include "nsIRequest.h" #include "mozilla/Preferences.h" #include "nsDOMLists.h" +#include "xpcpublic.h" using namespace mozilla; diff --git a/content/base/test/unit/test_bug553888.js b/content/base/test/unit/test_bug553888.js index 9433f7a8aba3..60cdf77d386e 100644 --- a/content/base/test/unit/test_bug553888.js +++ b/content/base/test/unit/test_bug553888.js @@ -79,12 +79,12 @@ function run_test() { .createInstance(Components.interfaces.nsIXMLHttpRequest); request.open("GET", redirectURL, true); request.setRequestHeader("X-Custom-Header", "present"); - request.onreadystatechange = function() { + request.addEventListener("readystatechange", function() { if (request.readyState == 4) { do_check_eq(request.status, 200); server.stop(do_test_finished); } - }; + }, false); request.send(); try { request.setRequestHeader("X-Unwanted-Header", "present"); diff --git a/content/base/test/unit/test_error_codes.js b/content/base/test/unit/test_error_codes.js index 35528bb1a399..c8e2da29459d 100644 --- a/content/base/test/unit/test_error_codes.js +++ b/content/base/test/unit/test_error_codes.js @@ -46,7 +46,7 @@ var asyncXHR = { request.open("GET", "http://localhost:4444/test_error_code.xml", true); var self = this; - request.onerror = function(event) { self.onError(event); }; + request.addEventListener("error", function(event) { self.onError(event); }, false); request.send(null); }, onError: function doAsyncRequest_onError(event) { diff --git a/dom/system/NetworkGeolocationProvider.js b/dom/system/NetworkGeolocationProvider.js index 14c919b09ef8..9c0361c3a4b4 100755 --- a/dom/system/NetworkGeolocationProvider.js +++ b/dom/system/NetworkGeolocationProvider.js @@ -239,10 +239,10 @@ WifiGeoPositionProvider.prototype = { xhr.mozBackgroundRequest = true; xhr.open("GET", providerUrl, false); xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS; - xhr.onerror = function(req) { + xhr.addEventListener("error", function(req) { LOG("onerror: " + req); - }; - xhr.onload = function (req) { + }, false); + xhr.addEventListener("load", function (req) { LOG("service returned: " + req.target.responseText); response = JSON.parse(req.target.responseText); /* @@ -288,7 +288,7 @@ WifiGeoPositionProvider.prototype = { } } } - }; + }, false); LOG("************************************* ------>>>> sending."); xhr.send(null); diff --git a/js/src/xpconnect/tests/chrome/test_doublewrappedcompartments.xul b/js/src/xpconnect/tests/chrome/test_doublewrappedcompartments.xul index 6917344af6c2..3cece3a3981c 100644 --- a/js/src/xpconnect/tests/chrome/test_doublewrappedcompartments.xul +++ b/js/src/xpconnect/tests/chrome/test_doublewrappedcompartments.xul @@ -30,12 +30,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596 var wrappedWin = $('ifr').contentWindow; var unwrapped = wrappedWin.wrappedJSObject; - var readystatechange = unwrapped.xhr.onreadystatechange; - is(utils.getClassName(readystatechange), 'Proxy', 'properly wrapped'); - is(typeof readystatechange.QueryInterface, 'function', 'double wrapped'); + var filter = unwrapped.filter; + is(utils.getClassName(filter), 'Proxy', 'properly wrapped'); + is(typeof filter.QueryInterface, 'function', 'double wrapped'); - ok(unwrapped.testme(readystatechange), - 'content didn\'t get a proxy, but another double wrapped object'); + ok(unwrapped.testme(filter), + "content didn't get a proxy, but another double wrapped object"); SimpleTest.finish(); } diff --git a/js/src/xpconnect/tests/mochitest/file_doublewrappedcompartments.html b/js/src/xpconnect/tests/mochitest/file_doublewrappedcompartments.html index b983bf863266..a3ebd681912a 100644 --- a/js/src/xpconnect/tests/mochitest/file_doublewrappedcompartments.html +++ b/js/src/xpconnect/tests/mochitest/file_doublewrappedcompartments.html @@ -1,9 +1,9 @@ diff --git a/js/src/xpconnect/tests/mochitest/test_bug505915.html b/js/src/xpconnect/tests/mochitest/test_bug505915.html index 158a95f3d7b1..3f4c7f87eb92 100644 --- a/js/src/xpconnect/tests/mochitest/test_bug505915.html +++ b/js/src/xpconnect/tests/mochitest/test_bug505915.html @@ -38,16 +38,6 @@ function go() { "threw a security exception instead of an invalid child exception"); } - var xhr = new XMLHttpRequest(); - - try { - xhr.onreadystatechange = ifr.contentWindow; - ok(false, "weird behavior"); - } catch (e) { - ok(/NS_ERROR_XPC_SECURITY_MANAGER_VETO/.test(e), - "threw a security exception instead of an invalid child exception"); - } - // Location is always wrapped, so test it separately. ifr.onload = null; diff --git a/mobile/modules/LocaleRepository.jsm b/mobile/modules/LocaleRepository.jsm index c3ba1316d4ba..e7d63a1a4919 100644 --- a/mobile/modules/LocaleRepository.jsm +++ b/mobile/modules/LocaleRepository.jsm @@ -105,7 +105,7 @@ var LocaleRepository = { request.overrideMimeType("text/xml"); let self = this; - request.onreadystatechange = function () { + request.addEventListener("readystatechange", function () { if (request.readyState == 4) { if (request.status == 200) { self.log("---- got response") @@ -122,7 +122,7 @@ var LocaleRepository = { Cu.reportError("Locale Repository: Error getting locale from AMO [" + request.status + "]"); } } - }; + }, false); request.send(null); }, diff --git a/netwerk/test/unit/test_xmlhttprequest.js b/netwerk/test/unit/test_xmlhttprequest.js index 273316ad590c..9a59b88b93d2 100644 --- a/netwerk/test/unit/test_xmlhttprequest.js +++ b/netwerk/test/unit/test_xmlhttprequest.js @@ -38,10 +38,10 @@ function run_test() // Test async XHR sending let async = createXHR(true); - async.onreadystatechange = function(event) { + async.addEventListener("readystatechange", function(event) { if (checkResults(async)) httpserver.stop(do_test_finished); - }; + }, false); async.send(null); do_test_pending(); } diff --git a/toolkit/components/telemetry/TelemetryPing.js b/toolkit/components/telemetry/TelemetryPing.js index 01db8b20d303..5b047de7695e 100644 --- a/toolkit/components/telemetry/TelemetryPing.js +++ b/toolkit/components/telemetry/TelemetryPing.js @@ -320,8 +320,8 @@ TelemetryPing.prototype = { if (isTestPing) Services.obs.notifyObservers(null, "telemetry-test-xhr-complete", null); } - request.onerror = function(aEvent) finishRequest(request.channel); - request.onload = function(aEvent) finishRequest(request.channel); + request.addEventListener("error", function(aEvent) finishRequest(request.channel), false); + request.addEventListener("load", function(aEvent) finishRequest(request.channel), false); request.send(JSON.stringify(payload)); }, diff --git a/toolkit/components/url-classifier/content/xml-fetcher.js b/toolkit/components/url-classifier/content/xml-fetcher.js index 6e52e5a0cbe2..1edad3470aff 100644 --- a/toolkit/components/url-classifier/content/xml-fetcher.js +++ b/toolkit/components/url-classifier/content/xml-fetcher.js @@ -103,15 +103,14 @@ PROT_XMLFetcher.prototype = { // Create a closure var self = this; - this._request.onreadystatechange = function() { + this._request.addEventListener("readystatechange", function() { self.readyStateChange(self); - } + }, false); this._request.send(null); }, cancel: function() { - this._request.onreadystatechange = null; this._request.abort(); this._request = null; }, diff --git a/toolkit/crashreporter/CrashSubmit.jsm b/toolkit/crashreporter/CrashSubmit.jsm index d1a52d789e4d..6d60e5398619 100644 --- a/toolkit/crashreporter/CrashSubmit.jsm +++ b/toolkit/crashreporter/CrashSubmit.jsm @@ -257,7 +257,7 @@ Submitter.prototype = { // add the minidump formData.append("upload_file_minidump", File(this.dump.path)); let self = this; - xhr.onreadystatechange = function (aEvt) { + xhr.addEventListener("readystatechange", function (aEvt) { if (xhr.readyState == 4) { if (xhr.status != 200) { self.notifyStatus(FAILED); @@ -267,7 +267,7 @@ Submitter.prototype = { self.submitSuccess(ret); } } - }; + }, false); xhr.send(formData); return true; diff --git a/toolkit/mozapps/extensions/AddonRepository.jsm b/toolkit/mozapps/extensions/AddonRepository.jsm index 7ebea12f42d6..36a7cf92f95b 100644 --- a/toolkit/mozapps/extensions/AddonRepository.jsm +++ b/toolkit/mozapps/extensions/AddonRepository.jsm @@ -1176,8 +1176,10 @@ var AddonRepository = { this._request.overrideMimeType("text/xml"); let self = this; - this._request.onerror = function(aEvent) { self._reportFailure(); }; - this._request.onload = function(aEvent) { + this._request.addEventListener("error", function(aEvent) { + self._reportFailure(); + }, false); + this._request.addEventListener("load", function(aEvent) { let request = aEvent.target; let responseXML = request.responseXML; @@ -1196,7 +1198,7 @@ var AddonRepository = { totalResults = parsedTotalResults; aHandleResults(elements, totalResults); - }; + }, false); this._request.send(null); }, diff --git a/toolkit/mozapps/extensions/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/AddonUpdateChecker.jsm index 7aa1bb2539fe..163b279dc8f8 100644 --- a/toolkit/mozapps/extensions/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/AddonUpdateChecker.jsm @@ -451,8 +451,8 @@ function UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver) { this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; this.request.overrideMimeType("text/xml"); var self = this; - this.request.onload = function(event) { self.onLoad() }; - this.request.onerror = function(event) { self.onError() }; + this.request.addEventListener("load", function(event) { self.onLoad() }, false); + this.request.addEventListener("error", function(event) { self.onError() }, false); this.request.send(null); } catch (e) { diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index e9d0a2cfccee..63ac4db23635 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -227,7 +227,7 @@ var LightweightThemeManager = { req.open("GET", theme.updateURL, true); var self = this; - req.onload = function () { + req.addEventListener("load", function () { if (req.status != 200) return; @@ -240,7 +240,7 @@ var LightweightThemeManager = { var currentTheme = self.currentTheme; if (currentTheme && currentTheme.id == theme.id) self.currentTheme = newData; - }; + }, false); req.send(null); }, diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index 7efc0ee8ad1a..23cd11a75a54 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -546,8 +546,8 @@ Blocklist.prototype = { request.QueryInterface(Components.interfaces.nsIJSXMLHttpRequest); var self = this; - request.onerror = function(event) { self.onXMLError(event); }; - request.onload = function(event) { self.onXMLLoad(event); }; + request.addEventListener("error", function(event) { self.onXMLError(event); }, false); + request.addEventListener("load", function(event) { self.onXMLLoad(event); }, false); request.send(null); // When the blocklist loads we need to compare it to the current copy so diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index b856c81f33b4..8f365e56df12 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -2155,9 +2155,9 @@ Checker.prototype = { this._request.setRequestHeader("Cache-Control", "no-cache"); var self = this; - this._request.onerror = function(event) { self.onError(event); }; - this._request.onload = function(event) { self.onLoad(event); }; - this._request.onprogress = function(event) { self.onProgress(event); }; + this._request.addEventListener("error", function(event) { self.onError(event); } ,false); + this._request.addEventListener("load", function(event) { self.onLoad(event); }, false); + this._request.addEventListener("progress", function(event) { self.onProgress(event); }, false); LOG("Checker:checkForUpdates - sending request to: " + url); this._request.send(null); diff --git a/toolkit/mozapps/update/test/unit/head_update.js.in b/toolkit/mozapps/update/test/unit/head_update.js.in index e1d475e0a824..b7195d7f90bf 100644 --- a/toolkit/mozapps/update/test/unit/head_update.js.in +++ b/toolkit/mozapps/update/test/unit/head_update.js.in @@ -1007,6 +1007,9 @@ xhr.prototype = { _onload: null, set onload(val) { gXHR._onload = makeHandler(val); }, get onload() { return gXHR._onload; }, + addEventListener: function(event, val, capturing) { + eval("gXHR._on" + event + " = val"); + }, flags: AUS_Ci.nsIClassInfo.SINGLETON, implementationLanguage: AUS_Ci.nsIProgrammingLanguage.JAVASCRIPT, getHelperForLanguage: function(language) null, diff --git a/toolkit/mozapps/update/test/unit/test_0020_general.js b/toolkit/mozapps/update/test/unit/test_0020_general.js index 4b8c4be4b591..c24a7e6f8dac 100644 --- a/toolkit/mozapps/update/test/unit/test_0020_general.js +++ b/toolkit/mozapps/update/test/unit/test_0020_general.js @@ -87,7 +87,7 @@ function callHandleEvent() { gXHR.responseXML = null; } var e = { target: gXHR }; - gXHR.onload.handleEvent(e); + gXHR.onload(e); } // update xml not found diff --git a/toolkit/mozapps/update/test/unit/test_0030_general.js b/toolkit/mozapps/update/test/unit/test_0030_general.js index 3fcab51e4336..e7f0ced92ee6 100644 --- a/toolkit/mozapps/update/test/unit/test_0030_general.js +++ b/toolkit/mozapps/update/test/unit/test_0030_general.js @@ -77,7 +77,7 @@ function callHandleEvent() { catch(e) { } var e = { target: gXHR }; - gXHR.onload.handleEvent(e); + gXHR.onload(e); } // Helper function for testing mar downloads that have the correct size diff --git a/toolkit/mozapps/update/test/unit/test_0040_general.js b/toolkit/mozapps/update/test/unit/test_0040_general.js index b6d02efae83b..8c8e5500ea58 100644 --- a/toolkit/mozapps/update/test/unit/test_0040_general.js +++ b/toolkit/mozapps/update/test/unit/test_0040_general.js @@ -63,7 +63,7 @@ function end_test() { // call the nsIDOMEventListener's handleEvent method for onload. function callHandleEvent() { var e = { target: gXHR }; - gXHR.onload.handleEvent(e); + gXHR.onload(e); } // Helper function for parsing the result from the contructed url diff --git a/toolkit/mozapps/update/test/unit/test_0050_general.js b/toolkit/mozapps/update/test/unit/test_0050_general.js index a707559ca871..6542a4049582 100644 --- a/toolkit/mozapps/update/test/unit/test_0050_general.js +++ b/toolkit/mozapps/update/test/unit/test_0050_general.js @@ -68,7 +68,7 @@ function end_test() { function callHandleEvent() { gXHR.status = gExpectedStatusCode; var e = { target: gXHR }; - gXHR.onload.handleEvent(e); + gXHR.onload(e); } // Helper functions for testing nsIUpdateCheckListener statusText diff --git a/toolkit/mozapps/webapps/OpenWebapps.js b/toolkit/mozapps/webapps/OpenWebapps.js index 938b2966095d..8a2a06b7ec82 100644 --- a/toolkit/mozapps/webapps/OpenWebapps.js +++ b/toolkit/mozapps/webapps/OpenWebapps.js @@ -166,7 +166,7 @@ OpenWebapps.prototype = { let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); xhr.open("GET", aURL, true); - xhr.onload = function() { + xhr.addEventListener("load", function() { if (xhr.status == 200) { try { let manifest = JSON.parse(xhr.responseText); @@ -185,12 +185,12 @@ OpenWebapps.prototype = { else if (aError) { aError.handle({ code: "networkError", message: "Unable to retrieve manifest" }); } - } + }, false); - xhr.onerror = function() { + xhr.addEventListener("error", function() { if (aError) aError.handle({ code: "networkError", message: "Unable to retrieve manifest" }); - } + }, false); xhr.send(null); },