| Differences between
and this patch
- a/LayoutTests/ChangeLog +25 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-03-28  Gavin Peters  <gavinp@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Add beforeload to icon and prefetch link rel types
6
        https://bugs.webkit.org/show_bug.cgi?id=56424
7
8
        Unfortunately, there's lots of expectations changes here, in a strange
9
        disjoint set.  On the chromium port, favicon loads don't occur in DRT, so the
10
        favicon changes are expected to fail.  On the ports without prefetching, we
11
        expect the prefetching test to fail.
12
13
        * fast/dom/HTMLLinkElement/prefetch-beforeload-expected.txt: Added.
14
        * fast/dom/HTMLLinkElement/prefetch-beforeload.html: Added.
15
        * http/tests/misc/link-rel-icon-beforeload-expected.txt: Added.
16
        * http/tests/misc/link-rel-icon-beforeload.html: Added.
17
        * http/tests/resources/network-simulator.php:
18
        * platform/chromium/test_expectations.txt:
19
        * platform/gtk/Skipped:
20
        * platform/mac/Skipped:
21
        * platform/qt/Skipped:
22
        * platform/win/Skipped:
23
        * webarchive/test-link-rel-icon-beforeload-expected.webarchive: Added.
24
        * webarchive/test-link-rel-icon-beforeload.html: Added.
25
1
2011-03-28  Adam Barth  <abarth@webkit.org>
26
2011-03-28  Adam Barth  <abarth@webkit.org>
2
27
3
        Reviewed by Eric Seidel.
28
        Reviewed by Eric Seidel.
- a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-beforeload-expected.txt +2 lines
Line 0 a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-beforeload-expected.txt_sec1
1
PASS beforeload called
2
This test will only print "PASS" or "FAIL" if link prefetches are enabled, otherwise it will show nothing below.
- a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-beforeload.html +14 lines
Line 0 a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-beforeload.html_sec1
1
<body>
2
<div id="console"></div>
3
<script src="../../js/resources/js-test-pre.js"></script>
4
<script>
5
if (window.layoutTestController) {
6
    layoutTestController.dumpAsText();
7
}
8
</script>
9
<html>
10
<p>This test will only print "PASS" or "FAIL" if link prefetches are
11
enabled, otherwise it will show nothing below.</p>
12
<link href="prefetch.link" rel="prefetch" onbeforeload="testPassed('beforeload called');return false" onload="testFailed('onload')" onerror="testFailed('onerror')" />
13
</html>
14
- a/LayoutTests/http/tests/misc/link-rel-icon-beforeload-expected.txt +7 lines
Line 0 a/LayoutTests/http/tests/misc/link-rel-icon-beforeload-expected.txt_sec1
1
<unknown> - didFinishLoading
2
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)
3
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>
4
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)
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>
7
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.
- a/LayoutTests/http/tests/misc/link-rel-icon-beforeload.html +22 lines
Line 0 a/LayoutTests/http/tests/misc/link-rel-icon-beforeload.html_sec1
1
<html>
2
<head>
3
<script>
4
function runTest()
5
{
6
    if (window.layoutTestController) {
7
        layoutTestController.dumpAsText();
8
        layoutTestController.dumpResourceLoadCallbacks();
9
        layoutTestController.setIconDatabaseEnabled(true);
10
        layoutTestController.queueReload();
11
    }
12
}
13
</script>
14
</head>
15
<body onload="runTest()">
16
<link rel="icon" onbeforeload="return false" href="dont-load-this.ico">
17
<p>This test should not show a request for the favicon
18
dont-load-this.ico, since the beforeload handler on the favicon link
19
returns false.  Therefore, if the resource request list below shows a
20
request for dont-load-this.ico, then this test has failed.
21
</body>
22
</html>
- a/LayoutTests/platform/chromium/test_expectations.txt +3 lines
Lines 3335-3337 BUGWK82013 WIN LINUX : fast/text/justify-ideograph-leading-expansion.html = IMAG a/LayoutTests/platform/chromium/test_expectations.txt_sec1
3335
3335
3336
// New test added in r82056. The arrow does not point upwards.
3336
// New test added in r82056. The arrow does not point upwards.
3337
BUGCR77574 LINUX : fast/blockflow/fallback-orientation.html = IMAGE
3337
BUGCR77574 LINUX : fast/blockflow/fallback-orientation.html = IMAGE
3338
3339
// Chrome doesn't load favicons in DRT tests.
3340
BUGWK57259 : http/tests/misc/link-rel-icon-beforeload.html = FAIL PASS
- a/LayoutTests/platform/gtk/Skipped +1 lines
Lines 917-922 fast/forms/slider-zoomed.html a/LayoutTests/platform/gtk/Skipped_sec1
917
fast/dom/HTMLLinkElement/link-and-subresource-test.html
917
fast/dom/HTMLLinkElement/link-and-subresource-test.html
918
fast/dom/HTMLLinkElement/prefetch.html
918
fast/dom/HTMLLinkElement/prefetch.html
919
fast/dom/HTMLLinkElement/prefetch-onload.html
919
fast/dom/HTMLLinkElement/prefetch-onload.html
920
fast/dom/HTMLLinkElement/prefetch-beforeload.html
920
921
921
# Tests failing because the context menu is grabbing mouse events.
922
# Tests failing because the context menu is grabbing mouse events.
922
# https://bugs.webkit.org/show_bug.cgi?id=40601
923
# https://bugs.webkit.org/show_bug.cgi?id=40601
- a/LayoutTests/platform/mac/Skipped +1 lines
Lines 182-187 fast/dom/Window/window-properties-device-orientation.html a/LayoutTests/platform/mac/Skipped_sec1
182
# Link prefetch is disabled by default
182
# Link prefetch is disabled by default
183
fast/dom/HTMLLinkElement/link-and-subresource-test.html
183
fast/dom/HTMLLinkElement/link-and-subresource-test.html
184
fast/dom/HTMLLinkElement/prefetch.html
184
fast/dom/HTMLLinkElement/prefetch.html
185
fast/dom/HTMLLinkElement/prefetch-beforeload.html
185
fast/dom/HTMLLinkElement/prefetch-onload.html
186
fast/dom/HTMLLinkElement/prefetch-onload.html
186
http/tests/misc/prefetch-purpose.html
187
http/tests/misc/prefetch-purpose.html
187
188
- a/LayoutTests/platform/qt/Skipped +1 lines
Lines 2977-2982 media/video-delay-load-event.html a/LayoutTests/platform/qt/Skipped_sec1
2977
# Link prefetch is disabled by default
2977
# Link prefetch is disabled by default
2978
fast/dom/HTMLLinkElement/link-and-subresource-test.html
2978
fast/dom/HTMLLinkElement/link-and-subresource-test.html
2979
fast/dom/HTMLLinkElement/prefetch.html
2979
fast/dom/HTMLLinkElement/prefetch.html
2980
fast/dom/HTMLLinkElement/prefetch-beforeload.html
2980
fast/dom/HTMLLinkElement/prefetch-onload.html
2981
fast/dom/HTMLLinkElement/prefetch-onload.html
2981
http/tests/misc/prefetch-purpose.html
2982
http/tests/misc/prefetch-purpose.html
2982
2983
- a/LayoutTests/platform/win/Skipped +1 lines
Lines 987-992 fast/dom/Window/window-properties-device-orientation.html a/LayoutTests/platform/win/Skipped_sec1
987
# Link prefetch is disabled by default
987
# Link prefetch is disabled by default
988
fast/dom/HTMLLinkElement/link-and-subresource-test.html
988
fast/dom/HTMLLinkElement/link-and-subresource-test.html
989
fast/dom/HTMLLinkElement/prefetch.html
989
fast/dom/HTMLLinkElement/prefetch.html
990
fast/dom/HTMLLinkElement/prefetch-beforeload.html
990
fast/dom/HTMLLinkElement/prefetch-onload.html
991
fast/dom/HTMLLinkElement/prefetch-onload.html
991
http/tests/misc/prefetch-purpose.html
992
http/tests/misc/prefetch-purpose.html
992
993
- a/LayoutTests/webarchive/test-link-rel-icon-beforeload-expected.webarchive +48 lines
Line 0 a/LayoutTests/webarchive/test-link-rel-icon-beforeload-expected.webarchive_sec1
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
<plist version="1.0">
4
<dict>
5
	<key>WebMainResource</key>
6
	<dict>
7
		<key>WebResourceData</key>
8
		<string>&lt;html&gt;&lt;head&gt;
9
&lt;script&gt;
10
function runTest()
11
{
12
    if (window.layoutTestController) {
13
        layoutTestController.setIconDatabaseEnabled(true);
14
        layoutTestController.dumpDOMAsWebArchive();
15
        layoutTestController.queueReload();
16
    }
17
}
18
&lt;/script&gt;
19
&lt;/head&gt;
20
&lt;body onload="runTest()"&gt;
21
&lt;div id="console"&gt;&lt;div style="font-family: monospace; color: green; "&gt;PASS&lt;/div&gt;&lt;/div&gt;
22
&lt;script&gt;
23
function print(message, color) 
24
{
25
    var paragraph = document.createElement("div");
26
    paragraph.appendChild(document.createTextNode(message));
27
    paragraph.style.fontFamily = "monospace";
28
    if (color)
29
        paragraph.style.color = color;
30
    document.getElementById("console").appendChild(paragraph);
31
}
32
&lt;/script&gt;
33
&lt;p&gt;This test should have a green 'PASS' just above this line.  If it doesn't, you failed.
34
&lt;link rel="icon" onbeforeload="print('PASS','green');return false" href="resources/favicon.ico" type="image/x-icon"&gt;
35
36
37
&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
38
		<key>WebResourceFrameName</key>
39
		<string></string>
40
		<key>WebResourceMIMEType</key>
41
		<string>text/html</string>
42
		<key>WebResourceTextEncodingName</key>
43
		<string>UTF-8</string>
44
		<key>WebResourceURL</key>
45
		<string>file:///LayoutTests/webarchive/test-link-rel-icon-beforeload.html</string>
46
	</dict>
47
</dict>
48
</plist>
- a/LayoutTests/webarchive/test-link-rel-icon-beforeload.html +30 lines
Line 0 a/LayoutTests/webarchive/test-link-rel-icon-beforeload.html_sec1
1
<html>
2
<head>
3
<script>
4
function runTest()
5
{
6
    if (window.layoutTestController) {
7
        layoutTestController.setIconDatabaseEnabled(true);
8
        layoutTestController.dumpDOMAsWebArchive();
9
        layoutTestController.queueReload();
10
    }
11
}
12
</script>
13
</head>
14
<body onload="runTest()">
15
<div id="console"></div>
16
<script>
17
function print(message, color) 
18
{
19
    var paragraph = document.createElement("div");
20
    paragraph.appendChild(document.createTextNode(message));
21
    paragraph.style.fontFamily = "monospace";
22
    if (color)
23
        paragraph.style.color = color;
24
    document.getElementById("console").appendChild(paragraph);
25
}
26
</script>
27
<p>This test should have a green 'PASS' just above this line.  If it doesn't, you failed.
28
<link rel="icon" onbeforeload="print('PASS','green');return false" href="resources/favicon.ico" type="image/x-icon">
29
</body>
30
</html>
- a/Source/WebCore/ChangeLog +21 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-03-28  Gavin Peters  <gavinp@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Add beforeload to icon and prefetch link rel types
6
        https://bugs.webkit.org/show_bug.cgi?id=56424
7
8
        Over in https://lists.webkit.org/pipermail/webkit-dev/2011-February/016034.html , a webkit-dev
9
        thread, I've discussed my hopes for the link element, and adding the link header.  This
10
        change helps improve the link header by making it participate in the beforeload event in
11
        two more important cases.
12
13
        Tests: fast/dom/HTMLLinkElement/prefetch-beforeload.html
14
               http/tests/misc/link-rel-icon-beforeload.html
15
               webarchive/test-link-rel-icon-beforeload.html
16
17
        * html/HTMLLinkElement.cpp:
18
        (WebCore::HTMLLinkElement::checkBeforeLoadEvent):
19
        (WebCore::HTMLLinkElement::process):
20
        * html/HTMLLinkElement.h:
21
1
2011-03-28  Adam Barth  <abarth@webkit.org>
22
2011-03-28  Adam Barth  <abarth@webkit.org>
2
23
3
        Reviewed by Eric Seidel.
24
        Reviewed by Eric Seidel.
- a/Source/WebCore/html/HTMLLinkElement.cpp -6 / +18 lines
Lines 193-198 void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, RelAttribute a/Source/WebCore/html/HTMLLinkElement.cpp_sec1
193
    }
193
    }
194
}
194
}
195
195
196
bool HTMLLinkElement::checkBeforeLoadEvent()
197
{
198
    RefPtr<Document> originalDocument = document();
199
    if (!dispatchBeforeLoadEvent(m_url))
200
        return false;
201
    // A beforeload handler might have removed us from the document or changed the document.
202
    if (!inDocument() || document() != originalDocument)
203
        return false;
204
    return true;
205
}
206
196
void HTMLLinkElement::process()
207
void HTMLLinkElement::process()
197
{
208
{
198
    if (!inDocument() || m_isInShadowTree) {
209
    if (!inDocument() || m_isInShadowTree) {
Lines 204-211 void HTMLLinkElement::process() a/Source/WebCore/html/HTMLLinkElement.cpp_sec2
204
215
205
    // IE extension: location of small icon for locationbar / bookmarks
216
    // IE extension: location of small icon for locationbar / bookmarks
206
    // We'll record this URL per document, even if we later only use it in top level frames
217
    // We'll record this URL per document, even if we later only use it in top level frames
207
    if (m_relAttribute.m_isIcon && m_url.isValid() && !m_url.isEmpty())
218
    if (m_relAttribute.m_isIcon && m_url.isValid() && !m_url.isEmpty()) {
219
        if (!checkBeforeLoadEvent()) 
220
            return;
208
        document()->setIconURL(m_url.string(), type);
221
        document()->setIconURL(m_url.string(), type);
222
    }
209
223
210
    if (m_relAttribute.m_isDNSPrefetch) {
224
    if (m_relAttribute.m_isDNSPrefetch) {
211
        Settings* settings = document()->settings();
225
        Settings* settings = document()->settings();
Lines 217-222 void HTMLLinkElement::process() a/Source/WebCore/html/HTMLLinkElement.cpp_sec3
217
231
218
#if ENABLE(LINK_PREFETCH)
232
#if ENABLE(LINK_PREFETCH)
219
    if (m_relAttribute.m_isLinkPrefetch && m_url.isValid() && document()->frame()) {
233
    if (m_relAttribute.m_isLinkPrefetch && m_url.isValid() && document()->frame()) {
234
        if (!checkBeforeLoadEvent())
235
            return;
220
        m_cachedLinkPrefetch = document()->cachedResourceLoader()->requestLinkPrefetch(m_url);
236
        m_cachedLinkPrefetch = document()->cachedResourceLoader()->requestLinkPrefetch(m_url);
221
        if (m_cachedLinkPrefetch)
237
        if (m_cachedLinkPrefetch)
222
            m_cachedLinkPrefetch->addClient(this);
238
            m_cachedLinkPrefetch->addClient(this);
Lines 238-248 void HTMLLinkElement::process() a/Source/WebCore/html/HTMLLinkElement.cpp_sec4
238
            m_cachedSheet = 0;
254
            m_cachedSheet = 0;
239
        }
255
        }
240
256
241
        RefPtr<Document> originalDocument = document();
257
        if (!checkBeforeLoadEvent())
242
        if (!dispatchBeforeLoadEvent(m_url))
243
            return;
244
        // A beforeload handler might have removed us from the document or changed the document.
245
        if (!inDocument() || document() != originalDocument)
246
            return;
258
            return;
247
259
248
        m_loading = true;
260
        m_loading = true;
- a/Source/WebCore/html/HTMLLinkElement.h +1 lines
Lines 82-87 private: a/Source/WebCore/html/HTMLLinkElement.h_sec1
82
#if ENABLE(LINK_PREFETCH)
82
#if ENABLE(LINK_PREFETCH)
83
    void onloadTimerFired(Timer<HTMLLinkElement>*);
83
    void onloadTimerFired(Timer<HTMLLinkElement>*);
84
#endif
84
#endif
85
    bool checkBeforeLoadEvent();
85
    void process();
86
    void process();
86
    static void processCallback(Node*);
87
    static void processCallback(Node*);
87
88

Return to Bug 56424