Commit 94a630a0 authored by japhet@chromium.org's avatar japhet@chromium.org
Browse files

2011-06-22 Nate Chapin <japhet@chromium.org>

        Reviewed by Adam Barth.

        Add symbols required for window.internals.
        https://bugs.webkit.org/show_bug.cgi?id=62066

        * Source/autotools/symbols.filter:
2011-06-22  Nate Chapin  <japhet@chromium.org>

        Reviewed by Adam Barth.

        Test updates for https://bugs.webkit.org/show_bug.cgi?id=62066.

        * fast/preloader/scan-body-from-head-import.html: Use window.internals.
        * fast/preloader/scan-body-from-head-script.html: Use window.internals.
        * http/tests/loading/cross-origin-XHR-willLoadRequest-expected.txt:
        * http/tests/loading/cross-origin-XHR-willLoadRequest.html:
        * http/tests/loading/preload-append-scan-expected.txt:
        * http/tests/loading/preload-append-scan.php: Use window.internals.
        * http/tests/misc/favicon-loads-with-icon-loading-override-expected.txt:
        * http/tests/misc/link-rel-icon-beforeload-expected.txt:
        * platform/chromium-linux/fast/preloader/scan-body-from-head-script-expected.txt:  Removed.
2011-06-22  Nate Chapin  <japhet@chromium.org>

        Reviewed by Adam Barth.

        Don't let all subresources keep isLoadingInAPISense() from
        returning false, only requests that affect
        CachedResourceRequest::requestCount().

        Also, add a callback to Internals to determine whether
        a resource has been preloaded.

        https://bugs.webkit.org/show_bug.cgi?id=62066

        * WebCore.exp.in:
        * dom/Document.cpp: Add m_loadEventFinished.
        * dom/Document.h:
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::isLoadingInAPISense):
        * loader/cache/CachedResourceLoader.cpp:
        (WebCore::CachedResourceLoader::isPreloaded):
        * loader/cache/CachedResourceLoader.h:
        * testing/Internals.cpp:
        (WebCore::Internals::isPreloaded):
        * testing/Internals.h:
        * testing/Internals.idl:
2011-06-22  Nate Chapin  <japhet@chromium.org>

        Reviewed by Adam Barth.

        Add win symbols for new window.internals functionality.
        https://bugs.webkit.org/show_bug.cgi?id=62066

        * win/WebKit2.def:
2011-06-22  Nate Chapin  <japhet@chromium.org>

        Reviewed by Adam Barth.

        Add libsoup to libWebCoreInternals build.
        https://bugs.webkit.org/show_bug.cgi?id=62066

        * GNUmakefile.am:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89503 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b26197aa
2011-06-22 Nate Chapin <japhet@chromium.org>
Reviewed by Adam Barth.
Add symbols required for window.internals.
https://bugs.webkit.org/show_bug.cgi?id=62066
* Source/autotools/symbols.filter:
2011-06-22 Martin Robinson <mrobinson@igalia.com>
 
Reviewed by Adam Roben.
......
2011-06-22 Nate Chapin <japhet@chromium.org>
Reviewed by Adam Barth.
Test updates for https://bugs.webkit.org/show_bug.cgi?id=62066.
* fast/preloader/scan-body-from-head-import.html: Use window.internals.
* fast/preloader/scan-body-from-head-script.html: Use window.internals.
* http/tests/loading/cross-origin-XHR-willLoadRequest-expected.txt:
* http/tests/loading/cross-origin-XHR-willLoadRequest.html:
* http/tests/loading/preload-append-scan-expected.txt:
* http/tests/loading/preload-append-scan.php: Use window.internals.
* http/tests/misc/favicon-loads-with-icon-loading-override-expected.txt:
* http/tests/misc/link-rel-icon-beforeload-expected.txt:
* platform/chromium-linux/fast/preloader/scan-body-from-head-script-expected.txt: Removed.
2011-06-22 Jessie Berlin <jberlin@apple.com>
 
[WebKit2 Tests] plugins/npruntime/embed-property-equality.html failing since introduction in
......
style1.css has MIME type text/css
image1.png has MIME type image/png
This tests that resources in the body which block parsing (script, css) are preloaded
ahead of other resources (images). It requires DumpRenderTree to see the log of what
......@@ -10,4 +8,4 @@ resources are loaded.
</style>
</body>
</html>
PASS
<html>
<head>
<script>
if (window.layoutTestController) {
if (window.layoutTestController)
layoutTestController.dumpAsText();
layoutTestController.dumpResourceResponseMIMETypes();
function checkForPreload() {
var result;
if (internals.isPreloaded(document, "resources/image1.png") && internals.isPreloaded(document, "resources/style1.css"))
result = "PASS";
else
result = "FAIL";
document.getElementsByTagName("body")[0].appendChild(document.createTextNode(result));
}
window.addEventListener("DOMContentLoaded", checkForPreload, false);
</script>
<script src=resources/non-existant.js></script>
</head>
......
script1.js has MIME type application/x-javascript
image1.png has MIME type image/png
This tests that resources in the body which block parsing (script, css) are preloaded
ahead of other resources (images). It requires DumpRenderTree to see the log of what
......@@ -8,4 +6,4 @@ resources are loaded.
<script src=resources/script1.js></script>
</body>
</html>
PASS
<html>
<head>
<script>
if (window.layoutTestController) {
if (window.layoutTestController)
layoutTestController.dumpAsText();
layoutTestController.dumpResourceResponseMIMETypes();
function checkForPreload() {
var result;
if (internals.isPreloaded(document, "resources/image1.png") && internals.isPreloaded(document, "resources/script1.js"))
result = "PASS";
else
result = "FAIL";
document.getElementsByTagName("body")[0].appendChild(document.createTextNode(result));
}
window.addEventListener("DOMContentLoaded", checkForPreload, false);
</script>
<script src=resources/non-existant.js></script>
</head>
......
......@@ -2,6 +2,6 @@ main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/loading/resources/foo.txt. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
main frame - didFinishLoadForFrame
CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/loading/resources/foo.txt. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
The console message above should report failure to load foo.txt due to cross-origin access, not a network error.
<script>
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
layoutTestController.addURLToRedirect("http://localhost:8000/loading/resources/bar.txt", "http://localhost:8000/loading/resources/foo.txt");
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState == 4)
layoutTestController.notifyDone();
}
request.open("GET", "http://localhost:8000/loading/resources/bar.txt");
request.send();
</script>
......
main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
slow-script.pl has MIME type application/javascript
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
preload-test.jpg has MIME type image/jpeg
main frame - didFinishLoadForFrame
This test needs to be run in DRT. Preload scanner should see the image resource.
<img src="resources/preload-test.jpg">
PASS
......@@ -5,11 +5,22 @@ header("Content-Type: text/html; charset=utf-8");
# Spam a bunch of As to make sure we blow past any buffers.
print str_repeat("A", 2048);
?> -->
<body>
<script>
if (window.layoutTestController) {
if (window.layoutTestController)
layoutTestController.dumpAsText();
layoutTestController.dumpResourceResponseMIMETypes();
function checkForPreload() {
var result;
if (internals.isPreloaded(document, "resources/preload-test.jpg"))
result = "PASS";
else
result = "FAIL";
document.getElementsByTagName("body")[0].appendChild(document.createTextNode(result));
}
window.addEventListener("DOMContentLoaded", checkForPreload, false);
function debug(x) {}
</script>
<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=1000"></script>
......
......@@ -2,8 +2,6 @@
http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html, main document URL http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html, http method GET> redirectResponse (null)
http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html, http status code 200>
http://127.0.0.1:8000/misc/resources/favicon.ico - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/misc/resources/favicon.ico, main document URL http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html, http method GET> redirectResponse (null)
http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html - didFinishLoading
http://127.0.0.1:8000/misc/resources/favicon.ico - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/misc/resources/favicon.ico, http status code 200>
https://bugs.webkit.org/show_bug.cgi?id=58292 - Provide new setting to allow site icon loading despite disabling automatic image loading in general.
Resource load callbacks will reveal if the favicon still gets loaded if automatic image loading is disabled, but site icon image loading override is enabled.
......@@ -2,6 +2,4 @@
http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, main document URL http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, http method GET> redirectResponse (null)
http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, http status code 200>
http://127.0.0.1:8000/favicon.ico - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/favicon.ico, main document URL http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, http method GET> redirectResponse (null)
http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - didFinishLoading
http://127.0.0.1:8000/favicon.ico - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/favicon.ico, http status code 200>
This test should not show a request for the favicon dont-load-this.ico, since the beforeload handler on the favicon link returns false. Therefore, if the resource request list below shows a request for dont-load-this.ico, then this test has failed.
script1.js has MIME type application/javascript
image1.png has MIME type image/png
This tests that resources in the body which block parsing (script, css) are preloaded
ahead of other resources (images). It requires DumpRenderTree to see the log of what
resources are loaded.
<img src=resources/image1.png>
<script src=resources/script1.js></script>
</body>
</html>
2011-06-22 Nate Chapin <japhet@chromium.org>
Reviewed by Adam Barth.
Don't let all subresources keep isLoadingInAPISense() from
returning false, only requests that affect
CachedResourceRequest::requestCount().
Also, add a callback to Internals to determine whether
a resource has been preloaded.
https://bugs.webkit.org/show_bug.cgi?id=62066
* WebCore.exp.in:
* dom/Document.cpp: Add m_loadEventFinished.
* dom/Document.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::isLoadingInAPISense):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::isPreloaded):
* loader/cache/CachedResourceLoader.h:
* testing/Internals.cpp:
(WebCore::Internals::isPreloaded):
* testing/Internals.h:
* testing/Internals.idl:
2011-06-22 Chris Rogers <crogers@google.com>
 
Reviewed by David Levin.
......
......@@ -1179,6 +1179,7 @@ __ZNK7WebCore19ResourceRequestBase15httpHeaderFieldEPKc
__ZNK7WebCore19ResourceRequestBase3urlEv
__ZNK7WebCore19ResourceRequestBase6isNullEv
__ZNK7WebCore19ResourceRequestBase7isEmptyEv
__ZNK7WebCore20CachedResourceLoader11isPreloadedERKN3WTF6StringE
__ZNK7WebCore20HTMLTableCellElement9cellAboveEv
__ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
__ZNK7WebCore20ResourceResponseBase14httpStatusTextEv
......
......@@ -387,6 +387,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
, m_ignoreDestructiveWriteCount(0)
, m_titleSetExplicitly(false)
, m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFired)
, m_loadEventFinished(false)
, m_startTime(currentTime())
, m_overMinimumLayoutThreshold(false)
, m_extraLayoutDelay(0)
......@@ -3400,6 +3401,7 @@ void Document::dispatchWindowLoadEvent()
if (!domWindow)
return;
domWindow->dispatchLoadEvent();
m_loadEventFinished = true;
}
void Document::enqueueWindowEvent(PassRefPtr<Event> event)
......
......@@ -997,6 +997,7 @@ public:
void statePopped(SerializedScriptValue*);
bool processingLoadEvent() const { return m_processingLoadEvent; }
bool loadEventFinished() const { return m_loadEventFinished; }
#if ENABLE(DATABASE)
virtual bool allowDatabaseAccess() const;
......@@ -1278,8 +1279,12 @@ private:
Timer<Document> m_updateFocusAppearanceTimer;
Element* m_cssTarget;
// FIXME: Merge these 2 variables into an enum. Also, FrameLoader::m_didCallImplicitClose
// is almost a duplication of this data, so that should probably get merged in too.
bool m_processingLoadEvent;
bool m_loadEventFinished;
RefPtr<SerializedScriptValue> m_pendingStateObject;
double m_startTime;
bool m_overMinimumLayoutThreshold;
......
......@@ -441,11 +441,9 @@ bool DocumentLoader::isLoadingInAPISense() const
// Once a frame has loaded, we no longer need to consider subresources,
// but we still need to consider subframes.
if (frameLoader()->state() != FrameStateComplete) {
if (!m_primaryLoadComplete && isLoading())
return true;
if (!m_subresourceLoaders.isEmpty())
return true;
Document* doc = m_frame->document();
if ((!m_primaryLoadComplete || !m_frame->document()->loadEventFinished()) && isLoading())
return true;
if (doc->cachedResourceLoader()->requestCount())
return true;
if (DocumentParser* parser = doc->parser())
......
......@@ -652,6 +652,28 @@ void CachedResourceLoader::requestPreload(CachedResource::Type type, ResourceReq
#endif
}
bool CachedResourceLoader::isPreloaded(const String& urlString) const
{
const KURL& url = m_document->completeURL(urlString);
if (m_preloads) {
ListHashSet<CachedResource*>::iterator end = m_preloads->end();
for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) {
CachedResource* resource = *it;
if (resource->url() == url)
return true;
}
}
Deque<PendingPreload>::const_iterator dequeEnd = m_pendingPreloads.end();
for (Deque<PendingPreload>::const_iterator it = m_pendingPreloads.begin(); it != dequeEnd; ++it) {
PendingPreload pendingPreload = *it;
if (pendingPreload.m_request.url() == url)
return true;
}
return false;
}
void CachedResourceLoader::clearPreloads()
{
#if PRELOAD_DEBUG
......
......@@ -96,7 +96,8 @@ public:
void incrementRequestCount(const CachedResource*);
void decrementRequestCount(const CachedResource*);
int requestCount();
bool isPreloaded(const String& urlString) const;
void clearPreloads();
void clearPendingPreloads();
void preload(CachedResource::Type, ResourceRequest&, const String& charset, bool referencedFromBody);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment