Changeset 89503 in webkit


Ignore:
Timestamp:
Jun 22, 2011 5:28:56 PM (13 years ago)
Author:
Nate Chapin
Message:

2011-06-22 Nate Chapin <Nate Chapin>

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 <Nate Chapin>

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 <Nate Chapin>

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 <Nate Chapin>

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 <Nate Chapin>

Reviewed by Adam Barth.

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

  • GNUmakefile.am:
Location:
trunk
Files:
1 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r89426 r89503  
     12011-06-22  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add symbols required for window.internals.
     6        https://bugs.webkit.org/show_bug.cgi?id=62066
     7
     8        * Source/autotools/symbols.filter:
     9
    1102011-06-22  Martin Robinson  <mrobinson@igalia.com>
    211
  • trunk/LayoutTests/ChangeLog

    r89500 r89503  
     12011-06-22  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Test updates for https://bugs.webkit.org/show_bug.cgi?id=62066.
     6
     7        * fast/preloader/scan-body-from-head-import.html: Use window.internals.
     8        * fast/preloader/scan-body-from-head-script.html: Use window.internals.
     9        * http/tests/loading/cross-origin-XHR-willLoadRequest-expected.txt:
     10        * http/tests/loading/cross-origin-XHR-willLoadRequest.html:
     11        * http/tests/loading/preload-append-scan-expected.txt:
     12        * http/tests/loading/preload-append-scan.php: Use window.internals.
     13        * http/tests/misc/favicon-loads-with-icon-loading-override-expected.txt:
     14        * http/tests/misc/link-rel-icon-beforeload-expected.txt:
     15        * platform/chromium-linux/fast/preloader/scan-body-from-head-script-expected.txt:  Removed.
     16
    1172011-06-22  Jessie Berlin  <jberlin@apple.com>
    218
  • trunk/LayoutTests/fast/preloader/scan-body-from-head-import-expected.txt

    r82658 r89503  
    1 style1.css has MIME type text/css
    2 image1.png has MIME type image/png
    31
    42This tests that resources in the body which block parsing (script, css) are preloaded
     
    119</body>
    1210</html>
    13 
     11PASS
  • trunk/LayoutTests/fast/preloader/scan-body-from-head-import.html

    r82658 r89503  
    22<head>
    33<script>
    4 if (window.layoutTestController) {
     4if (window.layoutTestController)
    55    layoutTestController.dumpAsText();
    6     layoutTestController.dumpResourceResponseMIMETypes();
     6
     7function checkForPreload() {
     8    var result;
     9    if (internals.isPreloaded(document, "resources/image1.png") && internals.isPreloaded(document, "resources/style1.css"))
     10        result = "PASS";
     11    else
     12        result = "FAIL";
     13    document.getElementsByTagName("body")[0].appendChild(document.createTextNode(result));
    714}
     15
     16window.addEventListener("DOMContentLoaded", checkForPreload, false);
    817</script>
    918<script src=resources/non-existant.js></script>
  • trunk/LayoutTests/fast/preloader/scan-body-from-head-script-expected.txt

    r82658 r89503  
    1 script1.js has MIME type application/x-javascript
    2 image1.png has MIME type image/png
    31
    42This tests that resources in the body which block parsing (script, css) are preloaded
     
    97</body>
    108</html>
    11 
     9PASS
  • trunk/LayoutTests/fast/preloader/scan-body-from-head-script.html

    r82658 r89503  
    22<head>
    33<script>
    4 if (window.layoutTestController) {
     4if (window.layoutTestController)
    55    layoutTestController.dumpAsText();
    6     layoutTestController.dumpResourceResponseMIMETypes();
     6
     7function checkForPreload() {
     8    var result;
     9    if (internals.isPreloaded(document, "resources/image1.png") && internals.isPreloaded(document, "resources/script1.js"))
     10        result = "PASS";
     11    else
     12        result = "FAIL";
     13    document.getElementsByTagName("body")[0].appendChild(document.createTextNode(result));
    714}
     15
     16window.addEventListener("DOMContentLoaded", checkForPreload, false);
    817</script>
    918<script src=resources/non-existant.js></script>
  • trunk/LayoutTests/http/tests/loading/cross-origin-XHR-willLoadRequest-expected.txt

    r75768 r89503  
    33main frame - didFinishDocumentLoadForFrame
    44main frame - didHandleOnloadEventsForFrame
     5main frame - didFinishLoadForFrame
    56CONSOLE 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.
    6 main frame - didFinishLoadForFrame
    77The console message above should report failure to load foo.txt due to cross-origin access, not a network error.
  • trunk/LayoutTests/http/tests/loading/cross-origin-XHR-willLoadRequest.html

    r84770 r89503  
    11<script>
    22    layoutTestController.dumpAsText();
     3    layoutTestController.waitUntilDone();
    34    layoutTestController.addURLToRedirect("http://localhost:8000/loading/resources/bar.txt", "http://localhost:8000/loading/resources/foo.txt");
    45
    56    var request = new XMLHttpRequest();
     7    request.onreadystatechange = function() {
     8        if (request.readyState == 4)
     9            layoutTestController.notifyDone();
     10    }
    611    request.open("GET", "http://localhost:8000/loading/resources/bar.txt");
    712    request.send();
  • trunk/LayoutTests/http/tests/loading/preload-append-scan-expected.txt

    r83321 r89503  
    11main frame - didStartProvisionalLoadForFrame
    22main frame - didCommitLoadForFrame
    3 slow-script.pl has MIME type application/javascript
    43main frame - didFinishDocumentLoadForFrame
    54main frame - didHandleOnloadEventsForFrame
    6 preload-test.jpg has MIME type image/jpeg
    75main frame - didFinishLoadForFrame
    86
    97This test needs to be run in DRT. Preload scanner should see the image resource.
    108<img src="resources/preload-test.jpg">
    11 
     9PASS
  • trunk/LayoutTests/http/tests/loading/preload-append-scan.php

    r83321 r89503  
    66print str_repeat("A", 2048);
    77?> -->
     8<body>
    89<script>
    9 if (window.layoutTestController) {
     10if (window.layoutTestController)
    1011    layoutTestController.dumpAsText();
    11     layoutTestController.dumpResourceResponseMIMETypes();
     12
     13function checkForPreload() {
     14    var result;
     15    if (internals.isPreloaded(document, "resources/preload-test.jpg"))
     16        result = "PASS";
     17    else
     18        result = "FAIL";
     19    document.getElementsByTagName("body")[0].appendChild(document.createTextNode(result));
    1220}
     21
     22window.addEventListener("DOMContentLoaded", checkForPreload, false);
     23
    1324function debug(x) {}
    1425</script>
  • trunk/LayoutTests/http/tests/misc/favicon-loads-with-icon-loading-override-expected.txt

    r83628 r89503  
    33http://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>
    44http://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)
    5 http://127.0.0.1:8000/misc/favicon-loads-with-icon-loading-override.html - didFinishLoading
    6 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>
    75https://bugs.webkit.org/show_bug.cgi?id=58292 - Provide new setting to allow site icon loading despite disabling automatic image loading in general.
    86Resource load callbacks will reveal if the favicon still gets loaded if automatic image loading is disabled, but site icon image loading override is enabled.
  • trunk/LayoutTests/http/tests/misc/link-rel-icon-beforeload-expected.txt

    r82342 r89503  
    33http://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>
    44http://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)
    5 http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - didFinishLoading
    6 http://127.0.0.1:8000/favicon.ico - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/favicon.ico, http status code 200>
    75This 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.
  • trunk/Source/WebCore/ChangeLog

    r89499 r89503  
     12011-06-22  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Don't let all subresources keep isLoadingInAPISense() from
     6        returning false, only requests that affect
     7        CachedResourceRequest::requestCount().
     8
     9        Also, add a callback to Internals to determine whether
     10        a resource has been preloaded.
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=62066
     13
     14        * WebCore.exp.in:
     15        * dom/Document.cpp: Add m_loadEventFinished.
     16        * dom/Document.h:
     17        * loader/DocumentLoader.cpp:
     18        (WebCore::DocumentLoader::isLoadingInAPISense):
     19        * loader/cache/CachedResourceLoader.cpp:
     20        (WebCore::CachedResourceLoader::isPreloaded):
     21        * loader/cache/CachedResourceLoader.h:
     22        * testing/Internals.cpp:
     23        (WebCore::Internals::isPreloaded):
     24        * testing/Internals.h:
     25        * testing/Internals.idl:
     26
    1272011-06-22  Chris Rogers  <crogers@google.com>
    228
  • trunk/Source/WebCore/WebCore.exp.in

    r89440 r89503  
    11801180__ZNK7WebCore19ResourceRequestBase6isNullEv
    11811181__ZNK7WebCore19ResourceRequestBase7isEmptyEv
     1182__ZNK7WebCore20CachedResourceLoader11isPreloadedERKN3WTF6StringE
    11821183__ZNK7WebCore20HTMLTableCellElement9cellAboveEv
    11831184__ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
  • trunk/Source/WebCore/dom/Document.cpp

    r89283 r89503  
    388388    , m_titleSetExplicitly(false)
    389389    , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFired)
     390    , m_loadEventFinished(false)
    390391    , m_startTime(currentTime())
    391392    , m_overMinimumLayoutThreshold(false)
     
    34013402        return;
    34023403    domWindow->dispatchLoadEvent();
     3404    m_loadEventFinished = true;
    34033405}
    34043406
  • trunk/Source/WebCore/dom/Document.h

    r89212 r89503  
    998998
    999999    bool processingLoadEvent() const { return m_processingLoadEvent; }
     1000    bool loadEventFinished() const { return m_loadEventFinished; }
    10001001
    10011002#if ENABLE(DATABASE)
     
    12791280
    12801281    Element* m_cssTarget;
    1281    
     1282
     1283    // FIXME: Merge these 2 variables into an enum. Also, FrameLoader::m_didCallImplicitClose
     1284    // is almost a duplication of this data, so that should probably get merged in too.
    12821285    bool m_processingLoadEvent;
     1286    bool m_loadEventFinished;
     1287
    12831288    RefPtr<SerializedScriptValue> m_pendingStateObject;
    12841289    double m_startTime;
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r89312 r89503  
    442442    // but we still need to consider subframes.
    443443    if (frameLoader()->state() != FrameStateComplete) {
    444         if (!m_primaryLoadComplete && isLoading())
     444        Document* doc = m_frame->document();
     445        if ((!m_primaryLoadComplete || !m_frame->document()->loadEventFinished()) && isLoading())
    445446            return true;
    446         if (!m_subresourceLoaders.isEmpty())
    447             return true;
    448         Document* doc = m_frame->document();
    449447        if (doc->cachedResourceLoader()->requestCount())
    450448            return true;
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r89155 r89503  
    651651    printf("PRELOADING %s\n",  resource->url().latin1().data());
    652652#endif
     653}
     654
     655bool CachedResourceLoader::isPreloaded(const String& urlString) const
     656{
     657    const KURL& url = m_document->completeURL(urlString);
     658
     659    if (m_preloads) {
     660        ListHashSet<CachedResource*>::iterator end = m_preloads->end();
     661        for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) {
     662            CachedResource* resource = *it;
     663            if (resource->url() == url)
     664                return true;
     665        }
     666    }
     667
     668    Deque<PendingPreload>::const_iterator dequeEnd = m_pendingPreloads.end();
     669    for (Deque<PendingPreload>::const_iterator it = m_pendingPreloads.begin(); it != dequeEnd; ++it) {
     670        PendingPreload pendingPreload = *it;
     671        if (pendingPreload.m_request.url() == url)
     672            return true;
     673    }
     674    return false;
    653675}
    654676
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.h

    r89155 r89503  
    9797    void decrementRequestCount(const CachedResource*);
    9898    int requestCount();
    99    
     99
     100    bool isPreloaded(const String& urlString) const;
    100101    void clearPreloads();
    101102    void clearPendingPreloads();
  • trunk/Source/WebCore/testing/Internals.cpp

    r89230 r89503  
    2727#include "Internals.h"
    2828
     29#include "CachedResourceLoader.h"
     30#include "Document.h"
    2931#include "RenderTreeAsText.h"
    3032#include "ShadowContentElement.h"
     
    4345Internals::Internals()
    4446{
     47}
     48
     49bool Internals::isPreloaded(Document* document, const String& url)
     50{
     51    if (!document)
     52        return false;
     53
     54    return document->cachedResourceLoader()->isPreloaded(url);
    4555}
    4656
  • trunk/Source/WebCore/testing/Internals.h

    r89230 r89503  
    2828
    2929#include "ExceptionCode.h"
     30#include "PlatformString.h"
    3031#include <wtf/PassRefPtr.h>
    3132#include <wtf/RefCounted.h>
     
    4142    static PassRefPtr<Internals> create();
    4243    virtual ~Internals();
     44   
     45    bool isPreloaded(Document*, const String& url);
    4346
    4447    PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&);
  • trunk/Source/WebCore/testing/Internals.idl

    r89269 r89503  
    3030        Element createShadowContentElement(in Document document) raises(DOMException);
    3131        DOMString elementRenderTreeAsText(in Element element) raises(DOMException);
     32        boolean isPreloaded(in Document document, in DOMString url);
    3233    };
    3334}
  • trunk/Source/WebKit2/ChangeLog

    r89482 r89503  
     12011-06-22  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add win symbols for new window.internals functionality.
     6        https://bugs.webkit.org/show_bug.cgi?id=62066
     7
     8        * win/WebKit2.def:
     9
    1102011-06-22  Balazs Kelemen  <kbalazs@webkit.org>
    211
  • trunk/Source/WebKit2/win/WebKit2.def

    r89230 r89503  
    137137        ; Re-exports from WebCore for WebCoreTestSupport
    138138        ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
     139        ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
    139140        ?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z
    140141        ?virtualFunctionToPreventWeakVtable@JSDOMWrapper@WebCore@@MAEXXZ
  • trunk/Source/autotools/symbols.filter

    r89234 r89503  
    4646_ZN7WebCore9JSElement6s_infoE;
    4747_ZN7WebCore9toElementEN3JSC7JSValueE;
     48_ZNK7WebCore20CachedResourceLoader11isPreloadedERKN3WTF6StringE;
    4849_ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE;
    4950local:
  • trunk/Tools/ChangeLog

    r89502 r89503  
     12011-06-22  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add libsoup to libWebCoreInternals build.
     6        https://bugs.webkit.org/show_bug.cgi?id=62066
     7
     8        * GNUmakefile.am:
     9
    1102011-06-22  Dirk Pranke  <dpranke@chromium.org>
    211
  • trunk/Tools/GNUmakefile.am

    r89426 r89503  
    112112libWebCoreInternals_la_CFLAGS = \
    113113        -fno-strict-aliasing \
    114         $(javascriptcore_cflags)
     114        $(javascriptcore_cflags) \
     115        $(LIBSOUP_CFLAGS)
    115116
    116117# DumpRenderTree
Note: See TracChangeset for help on using the changeset viewer.