Back out ec584a62ec26 (bug 918719) for Android failures in test_bug918719.html

This commit is contained in:
Phil Ringnalda 2016-09-08 19:02:30 -07:00
Родитель 4ca89baabe
Коммит b33391adc0
7 изменённых файлов: 6 добавлений и 93 удалений

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

@ -1,13 +0,0 @@
// Send a payload that's over 32k in size, which for a plain response should be
// large enough to ensure that OnDataAvailable is called more than once (and so
// the XHR will be triggered to send more than one "loading" event if desired).
function handleRequest(request, response)
{
let data = (new Array(1 << 18)).join("A");
response.processAsync();
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Content-Length", "" + data.length, false);
response.write(data, data.length);
response.finish();
}

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

@ -7,7 +7,6 @@ support-files =
bug346659-parent-echoer.html
bug346659-parent.html
bug458091_child.html
bug918719.sjs
child_bug260264.html
devicemotion_inner.html
devicemotion_outer.html
@ -156,7 +155,6 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
[test_bug857555.html]
[test_bug862540.html]
[test_bug876098.html]
[test_bug918719.html]
[test_bug927901.html]
[test_devicemotion_multiple_listeners.html]
skip-if = toolkit == 'android' #bug 775227

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

@ -1,62 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=918719
-->
<head>
<title>Test for Bug 918719</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=918719">Mozilla Bug 918719</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function runTest() {
return new Promise(function(resolve) {
let loadingEventCount = 0,
xhr = new XMLHttpRequest();
xhr.open("GET", "bug918719.sjs");
xhr.onreadystatechange = function() {
if (xhr.readyState == 3) {
loadingEventCount++;
} else if (xhr.readyState == 4) {
resolve(loadingEventCount);
}
}
xhr.send();
});
}
function prefChangePromise(args) {
return new Promise(function(resolve) {
SpecialPowers.pushPrefEnv(args, resolve);
});
}
runTest().then(function(count) {
ok(count === 1, "Only one loading readystatechange event should have been fired with the pref off.");
}).then(function() {
return prefChangePromise({"set": [["dom.fire_extra_xhr_loading_readystatechanges", true]]});
}).then(function() {
return runTest();
}).then(function(count) {
// Note this case is tricky to test, as there is no hard guarantee that the
// server will send the data in more than one chunk, even with the trick
// we're using in the sjs. As such this case *may* intermittently fail.
ok(count > 1, "Multiple loading readystatechange events should have been fired with the pref on.");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

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

@ -169,7 +169,6 @@ XMLHttpRequestMainThread::XMLHttpRequestMainThread()
mFlagSyncLooping(false), mFlagBackgroundRequest(false),
mFlagHadUploadListenersOnSend(false), mFlagACwithCredentials(false),
mFlagTimedOut(false), mFlagDeleted(false), mFlagSend(false),
mSendExtraLoadingEvents(Preferences::GetBool("dom.fire_extra_xhr_loading_readystatechanges", true)),
mUploadTransferred(0), mUploadTotal(0), mUploadComplete(true),
mProgressSinceLastProgressEvent(false),
mRequestSentTime(0), mTimeoutMilliseconds(0),
@ -1720,9 +1719,7 @@ XMLHttpRequestMainThread::OnDataAvailable(nsIRequest *request,
mDataAvailable += totalRead;
if (mState == State::headers_received || mSendExtraLoadingEvents) {
ChangeState(State::loading);
}
ChangeState(State::loading);
if (!mFlagSynchronous && !mProgressTimerIsActive) {
StartProgressEventTimer();

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

@ -696,14 +696,6 @@ protected:
// late, and ensure the XHR only handles one in-flight request at once.
bool mFlagSend;
// Before ProgressEvents were a thing, multiple readystatechange events were
// fired during the loading state to give sites a way to monitor XHR progress.
// The XHR spec now has proper progress events and dictates that only one
// "loading" readystatechange should be fired per send. However, it's possible
// that some content still relies on this old behavior, so we're keeping it
// (behind a preference) for now. See bug 918719.
bool mSendExtraLoadingEvents;
RefPtr<XMLHttpRequestUpload> mUpload;
int64_t mUploadTransferred;
int64_t mUploadTotal;

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

@ -5080,10 +5080,6 @@ pref("dom.voicemail.defaultServiceId", 0);
// Enable mapped array buffer by default.
pref("dom.mapped_arraybuffer.enabled", true);
// Whether to send more than one "loading" readystatechange during XHRs to
// simulate progress events for sites still not using modern progress events.
pref("dom.fire_extra_xhr_loading_readystatechanges", false);
// The tables used for Safebrowsing phishing and malware checks.
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,test-malware-simple,test-unwanted-simple");

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

@ -0,0 +1,5 @@
[event-readystatechange-loaded.htm]
type: testharness
[XMLHttpRequest: the LOADING state change should only happen once]
expected: FAIL