mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1417251, part 1 - Make the reftest harness support loading of consecutive URIs differing only by hash. r=dbaron,bz
When the URIs of consecutively loaded tests/references differed only by hash we would previously do an anchor scroll causing us to fail timing out waiting for a 'load' event that would never come. This change makes us load such URIs using nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE to force a reload of the document. MozReview-Commit-ID: 6Fhy9h1tZol
This commit is contained in:
parent
2f89e4a502
commit
c73cc60a66
@ -10493,6 +10493,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
(aFlags & INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) != 0;
|
||||
mURIResultedInDocument = false; // reset the clock...
|
||||
|
||||
// Note that there is code that relies on this check to stop us entering the
|
||||
// `doShortCircuitedLoad` block below for certain load types. (For example,
|
||||
// reftest-content.js uses LOAD_FLAGS_BYPASS_CACHE for this purpose.)
|
||||
if (aLoadType == LOAD_NORMAL ||
|
||||
aLoadType == LOAD_STOP_CONTENT ||
|
||||
LOAD_TYPE_HAS_FLAGS(aLoadType, LOAD_FLAGS_REPLACE_HISTORY) ||
|
||||
|
@ -1055,9 +1055,35 @@ function DoAssertionCheck()
|
||||
SendAssertionCount(numAsserts);
|
||||
}
|
||||
|
||||
function URIsEqualIgnoringHash(uri1, uri2)
|
||||
{
|
||||
let hashIndex1 = uri1.indexOf("#");
|
||||
if (hashIndex1 > -1) {
|
||||
uri1 = uri1.substr(0, hashIndex1);
|
||||
}
|
||||
let hashIndex2 = uri2.indexOf("#");
|
||||
if (hashIndex2 > -1) {
|
||||
uri2 = uri2.substr(0, hashIndex2);
|
||||
}
|
||||
return uri1 == uri2;
|
||||
}
|
||||
|
||||
function LoadURI(uri)
|
||||
{
|
||||
var flags = webNavigation().LOAD_FLAGS_NONE;
|
||||
let flags = CI.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
|
||||
if (URIsEqualIgnoringHash(uri, gCurrentURL)) {
|
||||
// In this case the new URI would normally just cause an anchor scroll
|
||||
// so we use LOAD_FLAGS_BYPASS_CACHE to force a reload so we'll get a
|
||||
// 'load' event. (The code that handles new URIs once they're ready is
|
||||
// triggered by a 'load' event, so we'll time out if we don't get one).
|
||||
//
|
||||
// Note that we avoid using this flag in general since we don't want
|
||||
// to unnecessarily reload and reprocess common font files, images,
|
||||
// etc. for every test/reference (that may slow down reftest runs).
|
||||
flags = CI.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
|
||||
}
|
||||
|
||||
webNavigation().loadURI(uri, flags, null, null, null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user