mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound.
This commit is contained in:
commit
e97eef4d6f
@ -454,39 +454,15 @@ EventSource::OnStopRequest(nsIRequest *aRequest,
|
||||
|
||||
nsresult rv;
|
||||
nsresult healthOfRequestResult = CheckHealthOfRequestCallback(aRequest);
|
||||
if (NS_SUCCEEDED(healthOfRequestResult)) {
|
||||
// check if we had an incomplete UTF8 char at the end of the stream
|
||||
if (mLastConvertionResult == NS_PARTIAL_MORE_INPUT) {
|
||||
rv = ParseCharacter(REPLACEMENT_CHAR);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// once we reach the end of the stream we must
|
||||
// dispatch the current event
|
||||
switch (mStatus)
|
||||
{
|
||||
case PARSE_STATE_CR_CHAR:
|
||||
case PARSE_STATE_COMMENT:
|
||||
case PARSE_STATE_FIELD_NAME:
|
||||
case PARSE_STATE_FIRST_CHAR_OF_FIELD_VALUE:
|
||||
case PARSE_STATE_FIELD_VALUE:
|
||||
case PARSE_STATE_BEGIN_OF_LINE:
|
||||
rv = SetFieldAndClear();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = DispatchCurrentMessageEvent(); // there is an empty line (CRCR)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
break;
|
||||
|
||||
// Just for not getting warnings when compiling
|
||||
case PARSE_STATE_OFF:
|
||||
case PARSE_STATE_BEGIN_OF_STREAM:
|
||||
case PARSE_STATE_BOM_WAS_READ:
|
||||
break;
|
||||
}
|
||||
if (NS_SUCCEEDED(healthOfRequestResult) &&
|
||||
mLastConvertionResult == NS_PARTIAL_MORE_INPUT) {
|
||||
// we had an incomplete UTF8 char at the end of the stream
|
||||
rv = ParseCharacter(REPLACEMENT_CHAR);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
ClearFields();
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &EventSource::ReestablishConnection);
|
||||
NS_ENSURE_STATE(event);
|
||||
@ -1298,6 +1274,8 @@ EventSource::DispatchAllMessageEvents()
|
||||
NS_WARNING("Failed to dispatch the message event!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
mLastEventID.Assign(message->mLastEventID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1348,7 +1326,6 @@ EventSource::SetFieldAndClear()
|
||||
case PRUnichar('i'):
|
||||
if (mLastFieldName.EqualsLiteral("id")) {
|
||||
mCurrentMessage.mLastEventID.Assign(mLastFieldValue);
|
||||
mLastEventID.Assign(mLastFieldValue);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -497,8 +497,6 @@ MOCHITEST_FILES_B = \
|
||||
eventsource_redirect_to.resource^headers^ \
|
||||
badContentType.eventsource \
|
||||
badContentType.eventsource^headers^ \
|
||||
badEventFieldName.eventsource \
|
||||
badEventFieldName.eventsource^headers^ \
|
||||
badHTTPResponseCode.eventsource \
|
||||
badHTTPResponseCode.eventsource^headers^ \
|
||||
badMessageEvent.eventsource \
|
||||
@ -627,6 +625,8 @@ MOCHITEST_FILES_B = \
|
||||
test_bothCSPheaders.html \
|
||||
file_bothCSPheaders.html \
|
||||
file_bothCSPheaders.html^headers^ \
|
||||
badMessageEvent2.eventsource \
|
||||
badMessageEvent2.eventsource^headers^ \
|
||||
$(NULL)
|
||||
|
||||
# OOP tests don't work on Windows (bug 763081) or native-fennec
|
||||
|
@ -2,4 +2,6 @@
|
||||
:and its Content-Type must be equal to text/event-stream
|
||||
|
||||
event: message
|
||||
data: 1
|
||||
data: 1
|
||||
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
retry:500
|
||||
event: message
|
||||
data: 1
|
||||
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
retry:500
|
||||
:space isn't a valid NCName char, am I right?
|
||||
event: message event
|
||||
data: 1
|
@ -1,3 +1,5 @@
|
||||
retry:500
|
||||
event: message
|
||||
data: 1
|
||||
|
||||
|
||||
|
@ -1,2 +1,4 @@
|
||||
retry:500
|
||||
event: message
|
||||
|
||||
|
||||
|
5
content/base/test/badMessageEvent2.eventsource
Normal file
5
content/base/test/badMessageEvent2.eventsource
Normal file
@ -0,0 +1,5 @@
|
||||
retry:500
|
||||
data: ok
|
||||
|
||||
id: invalid-id
|
||||
data: not-ok
|
@ -4,7 +4,7 @@ var timer = null;
|
||||
var strings_to_send = ["data\r\n\nda", "ta", ":", "de", "layed1\n\n",
|
||||
"",
|
||||
"",
|
||||
"data:delayed2", "", ""];
|
||||
"data:delayed2\n\n", "", ""];
|
||||
var resp = null;
|
||||
|
||||
function sendNextString()
|
||||
|
@ -18,3 +18,5 @@ retry:500
|
||||
|
||||
event:keypress
|
||||
retry:500
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
retry:500
|
||||
data: 1
|
||||
|
||||
|
||||
|
@ -21,3 +21,4 @@ retry:500
|
||||
event: message
|
||||
data: 5
|
||||
|
||||
|
||||
|
@ -2,4 +2,6 @@
|
||||
:and its Content-Type must be equal to text/event-stream
|
||||
|
||||
event: message
|
||||
data: 1
|
||||
data: 1
|
||||
|
||||
|
||||
|
@ -13,5 +13,4 @@ data:çãá"'@`~Ý Ḿyyyy
|
||||
data: :xxabcdefghij
|
||||
data:çãá"'@`~Ý Ḿyyyy : zz
|
||||
|
||||
:a message dispatched because of eof
|
||||
data:1
|
||||
|
||||
|
@ -207,8 +207,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
// d) wrong Content-Type test
|
||||
// e) bad http response code test
|
||||
// f) message eventsource without a data test
|
||||
// g) eventsource with invalid NCName char in the event field test
|
||||
// h) DNS error
|
||||
// g) DNS error
|
||||
// h) EventSource which last message doesn't end with an empty line. See bug 710546
|
||||
|
||||
function doTest3(test_id) {
|
||||
gEventSourceObj3_a = new EventSource("http://example.org/tests/content/base/test/eventsource.resource");
|
||||
@ -310,30 +310,44 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
}
|
||||
|
||||
function doTest3_g(test_id) {
|
||||
gEventSourceObj3_g = new EventSource("badEventFieldName.eventsource");
|
||||
gEventSourceObj3_g = new EventSource("http://hdfskjghsbg.jtiyoejowe.dafsgbhjab.com");
|
||||
|
||||
fnInvalidNCName.hits = 0;
|
||||
gEventSourceObj3_g.addEventListener('message event', fnInvalidNCName, true);
|
||||
gEventSourceObj3_g.onmessage = fn_onmessage;
|
||||
gEventSourceObj3_g.hits = [];
|
||||
gEventSourceObj3_g.hits['fn_onmessage'] = 0;
|
||||
|
||||
setTimeout(function() {
|
||||
ok(fnInvalidNCName.hits != 0, "Test 3.g failed");
|
||||
ok(gEventSourceObj3_g.hits['fn_onmessage'] == 0, "Test 3.g failed");
|
||||
gEventSourceObj3_g.close();
|
||||
setTestHasFinished(test_id);
|
||||
}, parseInt(1500*stress_factor));
|
||||
}
|
||||
|
||||
function fnMessageListenerTest3h(e) {
|
||||
fnMessageListenerTest3h.msg_ok = (fnMessageListenerTest3h.msg_ok && e.data == "ok");
|
||||
fnMessageListenerTest3h.id_ok = (fnMessageListenerTest3h.msg_ok && e.lastEventId == "");
|
||||
}
|
||||
|
||||
function doTest3_h(test_id) {
|
||||
gEventSourceObj3_h = new EventSource("http://hdfskjghsbg.jtiyoejowe.dafsgbhjab.com");
|
||||
gEventSourceObj3_h = new EventSource("badMessageEvent2.eventsource");
|
||||
|
||||
gEventSourceObj3_h.addEventListener('message event', fnMessageListenerTest3h, true);
|
||||
fnMessageListenerTest3h.msg_ok = true;
|
||||
fnMessageListenerTest3h.id_ok = true;
|
||||
|
||||
gEventSourceObj3_h.onmessage = fn_onmessage;
|
||||
gEventSourceObj3_h.hits = [];
|
||||
gEventSourceObj3_h.hits['fn_onmessage'] = 0;
|
||||
|
||||
setTimeout(function() {
|
||||
ok(gEventSourceObj3_h.hits['fn_onmessage'] == 0, "Test 3.h failed");
|
||||
ok(gEventSourceObj3_h.hits['fn_onmessage'] > 1, "Test 3.h.1 failed");
|
||||
if (gEventSourceObj3_h.hits['fn_onmessage'] > 1) {
|
||||
ok(fnMessageListenerTest3h.msg_ok, "Test 3.h.2 failed");
|
||||
ok(fnMessageListenerTest3h.id_ok, "Test 3.h.3 failed");
|
||||
}
|
||||
gEventSourceObj3_h.close();
|
||||
setTestHasFinished(test_id);
|
||||
}, parseInt(1500*stress_factor));
|
||||
}, parseInt(3000*stress_factor));
|
||||
}
|
||||
|
||||
// in order to test (4)
|
||||
@ -544,8 +558,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
} else if (fn_somedata.expected == 1) {
|
||||
ok(e.data == " :xxabcdefghij\nçãá\"\'@`~Ý Ḿyyyy : zz",
|
||||
"Test 6.b failed");
|
||||
} else if (fn_somedata.expected == 2) {
|
||||
ok(e.data == "1", "Test 6.c failed");
|
||||
gEventSourceObj6.close();
|
||||
} else {
|
||||
ok(false, "Test 6 failed (unexpected message event)");
|
||||
|
@ -186,7 +186,7 @@ static PRTime sFirstCollectionTime;
|
||||
|
||||
static bool sIsInitialized;
|
||||
static bool sDidShutdown;
|
||||
|
||||
static bool sShuttingDown;
|
||||
static int32_t sContextCount;
|
||||
|
||||
static PRTime sMaxScriptRunTime;
|
||||
@ -194,7 +194,7 @@ static PRTime sMaxChromeScriptRunTime;
|
||||
|
||||
static nsIScriptSecurityManager *sSecurityManager;
|
||||
|
||||
// nsMemoryPressureObserver observes the memory-pressure notifications
|
||||
// nsJSEnvironmentObserver observes the memory-pressure notifications
|
||||
// and forces a garbage collection and cycle collection when it happens, if
|
||||
// the appropriate pref is set.
|
||||
|
||||
@ -211,26 +211,40 @@ GetCollectionTimeDelta()
|
||||
return 0;
|
||||
}
|
||||
|
||||
class nsMemoryPressureObserver MOZ_FINAL : public nsIObserver
|
||||
static void
|
||||
KillTimers()
|
||||
{
|
||||
nsJSContext::KillGCTimer();
|
||||
nsJSContext::KillShrinkGCBuffersTimer();
|
||||
nsJSContext::KillCCTimer();
|
||||
nsJSContext::KillFullGCTimer();
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
}
|
||||
|
||||
class nsJSEnvironmentObserver MOZ_FINAL : public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMemoryPressureObserver, nsIObserver)
|
||||
NS_IMPL_ISUPPORTS1(nsJSEnvironmentObserver, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMemoryPressureObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
nsJSEnvironmentObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
if (sGCOnMemoryPressure) {
|
||||
if (sGCOnMemoryPressure && !nsCRT::strcmp(aTopic, "memory-pressure")) {
|
||||
nsJSContext::GarbageCollectNow(js::gcreason::MEM_PRESSURE,
|
||||
nsJSContext::NonIncrementalGC,
|
||||
nsJSContext::NonCompartmentGC,
|
||||
nsJSContext::ShrinkingGC);
|
||||
nsJSContext::CycleCollectNow();
|
||||
} else if (!nsCRT::strcmp(aTopic, "quit-application")) {
|
||||
sShuttingDown = true;
|
||||
KillTimers();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3068,7 +3082,7 @@ nsJSContext::LoadEnd()
|
||||
void
|
||||
nsJSContext::PokeGC(js::gcreason::Reason aReason, int aDelay)
|
||||
{
|
||||
if (sGCTimer) {
|
||||
if (sGCTimer || sShuttingDown) {
|
||||
// There's already a timer for GC'ing, just return
|
||||
return;
|
||||
}
|
||||
@ -3097,7 +3111,7 @@ nsJSContext::PokeGC(js::gcreason::Reason aReason, int aDelay)
|
||||
void
|
||||
nsJSContext::PokeShrinkGCBuffers()
|
||||
{
|
||||
if (sShrinkGCBuffersTimer) {
|
||||
if (sShrinkGCBuffersTimer || sShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3117,7 +3131,7 @@ nsJSContext::PokeShrinkGCBuffers()
|
||||
void
|
||||
nsJSContext::MaybePokeCC()
|
||||
{
|
||||
if (sCCTimer || sDidShutdown) {
|
||||
if (sCCTimer || sShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3260,11 +3274,13 @@ DOMGCSliceCallback(JSRuntime *aRt, js::GCProgress aProgress, const js::GCDescrip
|
||||
// The GC has more work to do, so schedule another GC slice.
|
||||
if (aProgress == js::GC_SLICE_END) {
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
CallCreateInstance("@mozilla.org/timer;1", &sInterSliceGCTimer);
|
||||
sInterSliceGCTimer->InitWithFuncCallback(InterSliceGCTimerFired,
|
||||
NULL,
|
||||
NS_INTERSLICE_GC_DELAY,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
if (!sShuttingDown) {
|
||||
CallCreateInstance("@mozilla.org/timer;1", &sInterSliceGCTimer);
|
||||
sInterSliceGCTimer->InitWithFuncCallback(InterSliceGCTimerFired,
|
||||
NULL,
|
||||
NS_INTERSLICE_GC_DELAY,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
|
||||
if (aProgress == js::GC_CYCLE_END) {
|
||||
@ -3278,7 +3294,7 @@ DOMGCSliceCallback(JSRuntime *aRt, js::GCProgress aProgress, const js::GCDescrip
|
||||
|
||||
if (aDesc.isCompartment) {
|
||||
++sCompartmentGCCount;
|
||||
if (!sFullGCTimer) {
|
||||
if (!sFullGCTimer && !sShuttingDown) {
|
||||
CallCreateInstance("@mozilla.org/timer;1", &sFullGCTimer);
|
||||
js::gcreason::Reason reason = js::gcreason::FULL_GC_TIMER;
|
||||
sFullGCTimer->InitWithFuncCallback(FullGCTimerFired,
|
||||
@ -3404,6 +3420,7 @@ nsJSRuntime::Startup()
|
||||
sRuntime = nullptr;
|
||||
sIsInitialized = false;
|
||||
sDidShutdown = false;
|
||||
sShuttingDown = false;
|
||||
sContextCount = 0;
|
||||
sSecurityManager = nullptr;
|
||||
}
|
||||
@ -3720,9 +3737,9 @@ nsJSRuntime::Init()
|
||||
"javascript.options.gc_on_memory_pressure",
|
||||
true);
|
||||
|
||||
nsIObserver* memPressureObserver = new nsMemoryPressureObserver();
|
||||
NS_ENSURE_TRUE(memPressureObserver, NS_ERROR_OUT_OF_MEMORY);
|
||||
obs->AddObserver(memPressureObserver, "memory-pressure", false);
|
||||
nsIObserver* observer = new nsJSEnvironmentObserver();
|
||||
obs->AddObserver(observer, "memory-pressure", false);
|
||||
obs->AddObserver(observer, "quit-application", false);
|
||||
|
||||
sIsInitialized = true;
|
||||
|
||||
@ -3751,11 +3768,7 @@ nsJSRuntime::GetNameSpaceManager()
|
||||
void
|
||||
nsJSRuntime::Shutdown()
|
||||
{
|
||||
nsJSContext::KillGCTimer();
|
||||
nsJSContext::KillShrinkGCBuffersTimer();
|
||||
nsJSContext::KillCCTimer();
|
||||
nsJSContext::KillFullGCTimer();
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
KillTimers();
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
@ -3767,6 +3780,7 @@ nsJSRuntime::Shutdown()
|
||||
NS_IF_RELEASE(sSecurityManager);
|
||||
}
|
||||
|
||||
sShuttingDown = true;
|
||||
sDidShutdown = true;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ function process_log(contents) {
|
||||
gTestItems = [];
|
||||
for (var j in lines) {
|
||||
var line = lines[j];
|
||||
var match = line.match(/^(?:NEXT ERROR )?REFTEST (.*)$/);
|
||||
var match = line.match(/^(?:NEXT ERROR |\d\d:\d\d:\d\d +INFO - +)*REFTEST (.*)$/);
|
||||
if (!match)
|
||||
continue;
|
||||
line = match[1];
|
||||
|
Loading…
Reference in New Issue
Block a user