Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (194971 => 194972)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2016-01-13 20:17:25 UTC (rev 194971)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2016-01-13 20:17:31 UTC (rev 194972)
@@ -1,5 +1,25 @@
2016-01-13 Matthew Hanson <matthew_han...@apple.com>
+ Merge r191180. rdar://problem/24154291
+
+ 2015-10-16 Chris Dumez <cdu...@apple.com>
+
+ HTMLPreloadScanner should preload iframes
+ https://bugs.webkit.org/show_bug.cgi?id=150097
+ <rdar://problem/23094475>
+
+ Reviewed by Antti Koivisto.
+
+ Add layout test to check that iframes are indeed preloaded.
+
+ * fast/preloader/frame-src-expected.txt: Added.
+ * fast/preloader/frame-src.html: Added.
+ * fast/preloader/resources/testFrame.html: Added.
+ * http/tests/loading/preload-no-store-frame-src-expected.txt: Added.
+ * http/tests/loading/preload-no-store-frame-src.html: Added.
+
+2016-01-13 Matthew Hanson <matthew_han...@apple.com>
+
Merge r193939. rdar://problem/24154418
2015-12-10 Daniel Bates <daba...@apple.com>
Added: branches/safari-601-branch/LayoutTests/fast/preloader/frame-src-expected.txt (0 => 194972)
--- branches/safari-601-branch/LayoutTests/fast/preloader/frame-src-expected.txt (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/preloader/frame-src-expected.txt 2016-01-13 20:17:31 UTC (rev 194972)
@@ -0,0 +1,6 @@
+js-test-pre.js has MIME type text/_javascript_
+testFrame.html has MIME type text/html
+PASS internals.isPreloaded("resources/testFrame.html"); is true
+Tests that iframes are preloaded.
+
+
Added: branches/safari-601-branch/LayoutTests/fast/preloader/frame-src.html (0 => 194972)
--- branches/safari-601-branch/LayoutTests/fast/preloader/frame-src.html (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/preloader/frame-src.html 2016-01-13 20:17:31 UTC (rev 194972)
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpResourceResponseMIMETypes();
+</script>
+<script src=""
+<script src=""
+<script>
+ shouldBeTrue('internals.isPreloaded("resources/testFrame.html");');
+</script>
+</head>
+<body>
+<p>Tests that iframes are preloaded.</p>
+<iframe src=""
+</body>
+</html>
+
Added: branches/safari-601-branch/LayoutTests/fast/preloader/resources/testFrame.html (0 => 194972)
--- branches/safari-601-branch/LayoutTests/fast/preloader/resources/testFrame.html (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/preloader/resources/testFrame.html 2016-01-13 20:17:31 UTC (rev 194972)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<body>
+<p>Test frame</p>
+</body>
Added: branches/safari-601-branch/LayoutTests/http/tests/loading/preload-no-store-frame-src-expected.txt (0 => 194972)
--- branches/safari-601-branch/LayoutTests/http/tests/loading/preload-no-store-frame-src-expected.txt (rev 0)
+++ branches/safari-601-branch/LayoutTests/http/tests/loading/preload-no-store-frame-src-expected.txt 2016-01-13 20:17:31 UTC (rev 194972)
@@ -0,0 +1,17 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+js-test-pre.js has MIME type application/x-_javascript_
+slow-script.pl has MIME type application/_javascript_
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+no-store-frame.php has MIME type text/html
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+PASS internals.isPreloaded("/navigation/resources/no-store-frame.php"); is true
+Tests that 'no-store' iframes are preloaded.
+
+
Added: branches/safari-601-branch/LayoutTests/http/tests/loading/preload-no-store-frame-src.html (0 => 194972)
--- branches/safari-601-branch/LayoutTests/http/tests/loading/preload-no-store-frame-src.html (rev 0)
+++ branches/safari-601-branch/LayoutTests/http/tests/loading/preload-no-store-frame-src.html 2016-01-13 20:17:31 UTC (rev 194972)
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpResourceResponseMIMETypes();
+</script>
+<script src=""
+<script src=""
+<script>
+ shouldBeTrue('internals.isPreloaded("/navigation/resources/no-store-frame.php");');
+</script>
+</head>
+<body>
+<p>Tests that 'no-store' iframes are preloaded.</p>
+<iframe src=""
+</body>
+</html>
+
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (194971 => 194972)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2016-01-13 20:17:25 UTC (rev 194971)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2016-01-13 20:17:31 UTC (rev 194972)
@@ -1,5 +1,33 @@
2016-01-13 Matthew Hanson <matthew_han...@apple.com>
+ Merge r191180. rdar://problem/24154291
+
+ 2015-10-16 Chris Dumez <cdu...@apple.com>
+
+ HTMLPreloadScanner should preload iframes
+ https://bugs.webkit.org/show_bug.cgi?id=150097
+ <rdar://problem/23094475>
+
+ Reviewed by Antti Koivisto.
+
+ HTMLPreloadScanner should preload iframes to decrease page load time.
+
+ Tests:
+ - fast/preloader/frame-src.html
+ - http/tests/loading/preload-no-store-frame-src.html
+
+ * html/parser/HTMLPreloadScanner.cpp:
+ (WebCore::TokenPreloadScanner::tagIdFor):
+ (WebCore::TokenPreloadScanner::initiatorFor):
+ (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
+ (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
+ (WebCore::TokenPreloadScanner::StartTagScanner::resourceType):
+ (WebCore::TokenPreloadScanner::StartTagScanner::setUrlToLoad): Deleted.
+ (WebCore::TokenPreloadScanner::StartTagScanner::charset): Deleted.
+ * html/parser/HTMLPreloadScanner.h:
+
+2016-01-13 Matthew Hanson <matthew_han...@apple.com>
+
Merge r190641. rdar://problem/24154291
2015-10-06 Chris Dumez <cdu...@apple.com>
Modified: branches/safari-601-branch/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (194971 => 194972)
--- branches/safari-601-branch/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2016-01-13 20:17:25 UTC (rev 194971)
+++ branches/safari-601-branch/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2016-01-13 20:17:31 UTC (rev 194972)
@@ -44,6 +44,8 @@
TokenPreloadScanner::TagId TokenPreloadScanner::tagIdFor(const HTMLToken::DataVector& data)
{
AtomicString tagName(data);
+ if (tagName == iframeTag)
+ return TagId::Iframe;
if (tagName == imgTag)
return TagId::Img;
if (tagName == inputTag)
@@ -66,6 +68,8 @@
String TokenPreloadScanner::initiatorFor(TagId tagId)
{
switch (tagId) {
+ case TagId::Iframe:
+ return "iframe";
case TagId::Img:
return "img";
case TagId::Input:
@@ -153,6 +157,10 @@
void processAttribute(const AtomicString& attributeName, const String& attributeValue)
{
switch (m_tagId) {
+ case TagId::Iframe:
+ if (match(attributeName, srcAttr))
+ setUrlToLoad(attributeValue);
+ break;
case TagId::Img:
if (match(attributeName, srcsetAttr) && m_srcSetAttribute.isNull()) {
m_srcSetAttribute = attributeValue;
@@ -222,12 +230,25 @@
CachedResource::Type resourceType() const
{
- if (m_tagId == TagId::Script)
+ switch (m_tagId) {
+ case TagId::Iframe:
+ return CachedResource::MainResource;
+ case TagId::Script:
return CachedResource::Script;
- if (m_tagId == TagId::Img || (m_tagId == TagId::Input && m_inputIsImage))
+ case TagId::Img:
+ case TagId::Input:
+ ASSERT(m_tagId != TagId::Input || m_inputIsImage);
return CachedResource::ImageResource;
- if (m_tagId == TagId::Link && m_linkIsStyleSheet)
+ case TagId::Link:
+ ASSERT(m_linkIsStyleSheet);
return CachedResource::CSSStyleSheet;
+ case TagId::Meta:
+ case TagId::Unknown:
+ case TagId::Style:
+ case TagId::Base:
+ case TagId::Template:
+ break;
+ }
ASSERT_NOT_REACHED();
return CachedResource::RawResource;
}
@@ -237,6 +258,9 @@
if (m_urlToLoad.isEmpty())
return false;
+ if (protocolIs(m_urlToLoad, "data") || protocolIs(m_urlToLoad, "about"))
+ return false;
+
if (m_tagId == TagId::Link && !m_linkIsStyleSheet)
return false;
Modified: branches/safari-601-branch/Source/WebCore/html/parser/HTMLPreloadScanner.h (194971 => 194972)
--- branches/safari-601-branch/Source/WebCore/html/parser/HTMLPreloadScanner.h 2016-01-13 20:17:25 UTC (rev 194971)
+++ branches/safari-601-branch/Source/WebCore/html/parser/HTMLPreloadScanner.h 2016-01-13 20:17:31 UTC (rev 194972)
@@ -45,6 +45,7 @@
private:
enum class TagId {
// These tags are scanned by the StartTagScanner.
+ Iframe,
Img,
Input,
Link,