Bug 527623: Add some temporary logging code in order to figure out the intermittent oranges in test_bug503481b.html. This code will be backed out once we have a log of a failing test. r=jst

This commit is contained in:
Jonas Sicking 2009-11-16 19:07:22 -08:00
Родитель 2a4cae9773
Коммит c172cea058
2 изменённых файлов: 48 добавлений и 0 удалений

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

@ -509,6 +509,15 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
!aElement->GetScriptAsync();
mPreloads.RemoveElementAt(i);
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Grabbing existing speculative load for %s (%p). async:%d defer:%d\n",
spec.get(), request.get(), aElement->GetScriptAsync(),
request->mDefer);
}
rv = CheckContentPolicy(mDocument, aElement, request->mURI, type);
if (NS_FAILED(rv)) {
// Note, we're dropping our last ref to request here.
@ -558,6 +567,14 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mIsInline = PR_FALSE;
request->mLoading = PR_TRUE;
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Starting normal load for %s (%p). async:%d defer:%d\n",
spec.get(), request.get(), aElement->GetScriptAsync(),
request->mDefer);
}
rv = StartLoad(request, type);
if (NS_FAILED(rv)) {
return rv;
@ -570,6 +587,10 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mLineNo = aElement->GetScriptLineNumber();
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
printf("Creating inline request (%p).\n", request.get());
}
// If we've got existing pending requests, add ourselves
// to this list.
if (!hadPendingRequests && ReadyToExecuteScripts() &&
@ -609,6 +630,10 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
nsAFlatString* script;
nsAutoString textData;
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
printf("Running request (%p).\n", aRequest);
}
// If there's no script text, we try to get it from the element
if (aRequest->mIsInline) {
// XXX This is inefficient - GetText makes multiple
@ -957,6 +982,13 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
NS_ASSERTION(request, "null request in stream complete handler");
NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Finished loading %s (%p). status:%d\n", spec.get(), request,
aStatus);
}
nsresult rv = PrepareLoadedRequest(request, aLoader, aStatus, aStringLen,
aString);
if (NS_FAILED(rv)) {
@ -1110,6 +1142,14 @@ nsScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
request->mLoading = PR_TRUE;
request->mDefer = PR_FALSE; // This is computed later when we go to execute the
// script.
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Starting speculative load for %s (%p).\n", spec.get(),
request.get());
}
nsresult rv = StartLoad(request, aType);
if (NS_FAILED(rv)) {
return;

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

@ -4,6 +4,13 @@
<!-- Async script that isn't preloaded -->
<script async src="file_bug503481.sjs?blockOn=R&body=runFirst();"></script>
<script>
function enableLogs(b) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("content.scriptloader.logloads", b);
}
enableLogs(true);
firstRan = false;
secondRan = false;
thirdRan = false;
@ -37,6 +44,7 @@ function done() {
parent.is(forthRan, true, "forth should have run by onload");
parent.is(fifthRan, true, "fifth should have run by onload");
parent.is(sixthRan, true, "sixth should have run by onload");
enableLogs(false);
parent.SimpleTest.finish();
}