Merge backout.

This commit is contained in:
Kyle Huey 2011-09-29 15:19:28 -04:00
commit 9c2d4dcffd
30 changed files with 72 additions and 70 deletions

View File

@ -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();
}

View File

@ -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);
});
}

View File

@ -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) {

View File

@ -43,6 +43,7 @@
#include "nsIDOMProgressEvent.h"
#include "nsComponentManagerUtils.h"
#include "nsEventDispatcher.h"
#include "xpcprivate.h"
#define ERROR_STR "error"
#define ABORT_STR "abort"

View File

@ -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"

View File

@ -59,6 +59,7 @@
#include "nsIContentSecurityPolicy.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "xpcpublic.h"
using namespace mozilla;

View File

@ -78,6 +78,7 @@
#include "nsIRequest.h"
#include "mozilla/Preferences.h"
#include "nsDOMLists.h"
#include "xpcpublic.h"
using namespace mozilla;

View File

@ -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");

View File

@ -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) {

View File

@ -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);

View File

@ -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();
}

View File

@ -1,9 +1,9 @@
<html>
<head>
<script>
var xhr = new XMLHttpRequest();
var readystatechange = function() {};
xhr.onreadystatechange = readystatechange;
var fcn = function() {};
var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, fcn, false);
var filter = iter.filter;
function testme(obj) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

View File

@ -18,10 +18,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=502959
<script type="application/javascript">
/** Test for Bug 502959 **/
var xhr = new XMLHttpRequest();
// Whatever you do don't use the word "wrapped" in this function.
function foo() {
ok(true, "Able to call the function");
}
var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, foo, false);
var doublewrapped = iter.filter;
xhr.onreadystatechange = function() { ok(true, "Able to call the double-wrapped function"); };
var doublewrapped = xhr.onreadystatechange;
ok(doublewrapped.toString().indexOf("wrapped") > 0, "got a double-wrapped object back");
(function () {
@ -29,7 +33,7 @@ ok(doublewrapped.toString().indexOf("wrapped") > 0, "got a double-wrapped object
Components.utils.forceGC();
})();
doublewrapped.handleEvent({});
doublewrapped.acceptNode(document);
</script>
</pre>

View File

@ -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;

View File

@ -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);
},

View File

@ -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();
}

View File

@ -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));
},

View File

@ -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;
},

View File

@ -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;

View File

@ -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);
},

View File

@ -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) {

View File

@ -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);
},

View File

@ -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

View File

@ -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);

View File

@ -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,

View File

@ -87,7 +87,7 @@ function callHandleEvent() {
gXHR.responseXML = null;
}
var e = { target: gXHR };
gXHR.onload.handleEvent(e);
gXHR.onload(e);
}
// update xml not found

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
},