Title: [182266] trunk
Revision
182266
Author
commit-qu...@webkit.org
Date
2015-04-01 17:22:54 -0700 (Wed, 01 Apr 2015)

Log Message

Unreviewed, rolling out r182247.
https://bugs.webkit.org/show_bug.cgi?id=143326

unfortunately broke some tests (Requested by dino on #webkit).

Reverted changeset:

"Async loading of image resources"
https://bugs.webkit.org/show_bug.cgi?id=134488
http://trac.webkit.org/changeset/182247

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (182265 => 182266)


--- trunk/LayoutTests/ChangeLog	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/ChangeLog	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,3 +1,16 @@
+2015-04-01  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r182247.
+        https://bugs.webkit.org/show_bug.cgi?id=143326
+
+        unfortunately broke some tests (Requested by dino on #webkit).
+
+        Reverted changeset:
+
+        "Async loading of image resources"
+        https://bugs.webkit.org/show_bug.cgi?id=134488
+        http://trac.webkit.org/changeset/182247
+
 2015-04-01  Dean Jackson  <d...@apple.com>
 
         fast/events/mouse-cursor-image-set.html is timing out on Apple platforms

Deleted: trunk/LayoutTests/fast/dom/HTMLImageElement/image-load-post-onload-expected.txt (182265 => 182266)


--- trunk/LayoutTests/fast/dom/HTMLImageElement/image-load-post-onload-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/fast/dom/HTMLImageElement/image-load-post-onload-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,2 +0,0 @@
-This tests that an image element is loading even if its src was changed after the page's onload event.
-SUCCESS

Deleted: trunk/LayoutTests/fast/dom/HTMLImageElement/image-load-post-onload.html (182265 => 182266)


--- trunk/LayoutTests/fast/dom/HTMLImageElement/image-load-post-onload.html	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/fast/dom/HTMLImageElement/image-load-post-onload.html	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
-<script>
-function runTest() {
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-    }
-
-    var image = new Image();
-    var first = true;
-    image._onload_ = function () {
-        if (!first) {
-            document.getElementById('result').innerHTML = 'SUCCESS';
-            if (window.testRunner)
-                testRunner.notifyDone();
-        }
-        image.src = '';
-        first = false;
-    }
-
-    image.src = ''
-}
-</script>
-<body _onload_="runTest()">
-    <div>This tests that an image element is loading even if its src was changed after the page's onload event.</div>
-<div id="result">FAILURE</div>
-</body>
-</html>

Modified: trunk/LayoutTests/fast/dom/HTMLImageElement/image-loading-gc.html (182265 => 182266)


--- trunk/LayoutTests/fast/dom/HTMLImageElement/image-loading-gc.html	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/fast/dom/HTMLImageElement/image-loading-gc.html	2015-04-02 00:22:54 UTC (rev 182266)
@@ -32,7 +32,7 @@
 }
 </script>
 <body _onload_="runTest()">
-    <div>This tests that an image element won't be garbage collected when it's loading, even if it doesn't have any references.</div>
+<div>This tests that an image element won't be garbage collected when it's loading, even if it doesn't have any references.
 <div id="result">FAILURE</div>
 </body>
 </html>

Deleted: trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse-expected.txt (182265 => 182266)


--- trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,6 +0,0 @@
-image-set-4x.png has MIME type image/png
-PASS currentSrcFileName("foo") is "image-set-4x.png"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse.html (182265 => 182266)


--- trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse.html	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse.html	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<script src=""
-<script src=""
-<script src=""
-<script>
-    if (window.testRunner)
-        testRunner.dumpAsText();
-
-    function updateSrc() {
-        var img = document.getElementById("foo");
-        // Here we're setting sizes last, and srcset after src to make sure image loading is done is "stable-state"
-        img.src = ""
-        img.srcset = "../../../hidpi/resources/image-set-1x.png 200w, ../../../hidpi/resources/image-set-2x.png 400w, ../resources/image-set-4x.png 800w";
-        img.sizes = "400px";
-    }
-
-    addEventListener("DOMContentLoaded", function() {
-        if (sessionStorage.pageReloaded)
-            testRunner.dumpResourceResponseMIMETypes();
-        updateSrc();
-    }, false);
-
-    function runTest()
-    {
-        shouldBe('currentSrcFileName("foo")', '"image-set-4x.png"');
-    }
-</script>
-<img id="foo">

Modified: trunk/LayoutTests/fast/dom/image-object.html (182265 => 182266)


--- trunk/LayoutTests/fast/dom/image-object.html	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/fast/dom/image-object.html	2015-04-02 00:22:54 UTC (rev 182266)
@@ -46,7 +46,8 @@
         debug('FAILURE: Empty image should have complete set to true.');
         numErrs++;
     }
-    i2 = new Image();
+    
+    i2 = new Image()
     i2._onload_ = imageLoaded;
     i2.src = '';
 }

Modified: trunk/LayoutTests/http/tests/misc/image-blocked-src-change-expected.txt (182265 => 182266)


--- trunk/LayoutTests/http/tests/misc/image-blocked-src-change-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/http/tests/misc/image-blocked-src-change-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Not allowed to load local resource: compass.jpg
+CONSOLE MESSAGE: line 44: Not allowed to load local resource: compass.jpg
 Test case for bug 17897 : Not Rendering Images Imported from XHTML Document
 
 You should see PASSED once and 250 x 50 green box. The console should also show a blocked attempt to load a local resource.

Modified: trunk/LayoutTests/http/tests/misc/image-blocked-src-no-change-expected.txt (182265 => 182266)


--- trunk/LayoutTests/http/tests/misc/image-blocked-src-no-change-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/http/tests/misc/image-blocked-src-no-change-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: Not allowed to load local resource: compass.jpg
-CONSOLE MESSAGE: Not allowed to load local resource: compass.jpg
+CONSOLE MESSAGE: line 27: Not allowed to load local resource: compass.jpg
+CONSOLE MESSAGE: line 21: Not allowed to load local resource: compass.jpg
 Test case for bug 17897 : Not Rendering Images Imported from XHTML Document
 
 This test checks that setting an image url should lead to load even if the image was in error and the url is not changed.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt (182265 => 182266)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -5,4 +5,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.html
 REQUEST_METHOD: POST
 === POST DATA =""
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.html","referrer":"","violated-directive":"img-src 'none'","original-policy":"img-src 'none'; report-uri resources/save-report.php","blocked-uri":"file"}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.html","referrer":"","violated-directive":"img-src 'none'","original-policy":"img-src 'none'; report-uri resources/save-report.php","blocked-uri":"file","source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.html","line-number":12}}

Modified: trunk/LayoutTests/http/tests/security/frame-loading-via-document-write-expected.txt (182265 => 182266)


--- trunk/LayoutTests/http/tests/security/frame-loading-via-document-write-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/http/tests/security/frame-loading-via-document-write-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Not allowed to load local resource: abe.png
+CONSOLE MESSAGE: line 1: Not allowed to load local resource: abe.png
 
 
 --------

Modified: trunk/LayoutTests/http/tests/security/local-image-from-remote-expected.txt (182265 => 182266)


--- trunk/LayoutTests/http/tests/security/local-image-from-remote-expected.txt	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/LayoutTests/http/tests/security/local-image-from-remote-expected.txt	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Not allowed to load local resource: compass.jpg
+CONSOLE MESSAGE: line 14: Not allowed to load local resource: compass.jpg
 This test is to see if a remote file can include a local image. 
 Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT. 
 

Modified: trunk/Source/WebCore/ChangeLog (182265 => 182266)


--- trunk/Source/WebCore/ChangeLog	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/ChangeLog	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1,3 +1,16 @@
+2015-04-01  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r182247.
+        https://bugs.webkit.org/show_bug.cgi?id=143326
+
+        unfortunately broke some tests (Requested by dino on #webkit).
+
+        Reverted changeset:
+
+        "Async loading of image resources"
+        https://bugs.webkit.org/show_bug.cgi?id=134488
+        http://trac.webkit.org/changeset/182247
+
 2015-04-01  Alex Christensen  <achristen...@webkit.org>
 
         [Content Extensions] Only add unique universal action locations.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (182265 => 182266)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-04-02 00:22:54 UTC (rev 182266)
@@ -2101,7 +2101,7 @@
 		536D5A23193E8E0C00CE4CAB /* ParsingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A22193E8E0C00CE4CAB /* ParsingUtilities.h */; };
 		536D5A25193F40FC00CE4CAB /* SourceSizeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */; };
 		536D5A27193F410B00CE4CAB /* SourceSizeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A26193F410B00CE4CAB /* SourceSizeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		53B895AF19DC7ED9009CAA93 /* MicroTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 53B895AD19DC7C37009CAA93 /* MicroTask.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		53B895AF19DC7ED9009CAA93 /* MicroTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 53B895AD19DC7C37009CAA93 /* MicroTask.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		53C8298D13D8D92700DE2DEB /* RenderFlexibleBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */; };
 		53C8298E13D8D92700DE2DEB /* RenderFlexibleBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */; };

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (182265 => 182266)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -29,7 +29,6 @@
 #include "JSEventTarget.h"
 #include "JSMainThreadExecState.h"
 #include "JSMainThreadExecStateInstrumentation.h"
-#include "MicroTask.h"
 #include "ScriptController.h"
 #include "WorkerGlobalScope.h"
 #include <runtime/ExceptionHelpers.h>
@@ -152,8 +151,6 @@
             }
         }
     }
-    if (scriptExecutionContext->isDocument())
-        MicroTaskQueue::singleton().runMicroTasks();
 }
 
 bool JSEventListener::virtualisAttribute() const

Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.cpp (182265 => 182266)


--- trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -34,7 +34,6 @@
 #include "JSMainThreadExecState.h"
 #include "JSMainThreadExecStateInstrumentation.h"
 #include "JSWorkerGlobalScope.h"
-#include "MicroTask.h"
 #include "ScriptController.h"
 #include "ScriptExecutionContext.h"
 #include "ScriptSourceCode.h"
@@ -126,8 +125,6 @@
         executeFunctionInContext(window, window->shell(), document);
     else
         frame->script().executeScriptInWorld(*m_isolatedWorld, m_code);
-
-    MicroTaskQueue::singleton().runMicroTasks();
 }
 
 void ScheduledAction::execute(WorkerGlobalScope& workerGlobalScope)

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (182265 => 182266)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -452,7 +452,7 @@
 
 void HTMLImageElement::didMoveToNewDocument(Document* oldDocument)
 {
-    m_imageLoader.elementDidMoveToNewDocument(oldDocument);
+    m_imageLoader.elementDidMoveToNewDocument();
     HTMLElement::didMoveToNewDocument(oldDocument);
 }
 

Modified: trunk/Source/WebCore/html/HTMLImageLoader.cpp (182265 => 182266)


--- trunk/Source/WebCore/html/HTMLImageLoader.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/html/HTMLImageLoader.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -76,8 +76,6 @@
 void HTMLImageLoader::notifyFinished(CachedResource*)
 {
     CachedImage* cachedImage = image();
-    if (!cachedImage)
-        return;
 
     Ref<Element> protect(element());
     ImageLoader::notifyFinished(cachedImage);

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (182265 => 182266)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -1495,7 +1495,7 @@
 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
 {
     if (imageLoader())
-        imageLoader()->elementDidMoveToNewDocument(oldDocument);
+        imageLoader()->elementDidMoveToNewDocument();
 
     bool needsSuspensionCallback = this->needsSuspensionCallback();
     if (oldDocument) {

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (182265 => 182266)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -306,7 +306,7 @@
     }
 
     if (m_imageLoader)
-        m_imageLoader->elementDidMoveToNewDocument(oldDocument);
+        m_imageLoader->elementDidMoveToNewDocument();
 
     HTMLPlugInElement::didMoveToNewDocument(oldDocument);
 }

Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (182265 => 182266)


--- trunk/Source/WebCore/html/HTMLVideoElement.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -309,7 +309,7 @@
 void HTMLVideoElement::didMoveToNewDocument(Document* oldDocument)
 {
     if (m_imageLoader)
-        m_imageLoader->elementDidMoveToNewDocument(oldDocument);
+        m_imageLoader->elementDidMoveToNewDocument();
     HTMLMediaElement::didMoveToNewDocument(oldDocument);
 }
 

Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (182265 => 182266)


--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -34,7 +34,6 @@
 #include "HTMLTreeBuilder.h"
 #include "HTMLDocument.h"
 #include "InspectorInstrumentation.h"
-#include "MicroTask.h"
 
 namespace WebCore {
 
@@ -410,8 +409,6 @@
     if (m_scriptRunner && !m_scriptRunner->executeScriptsWaitingForParsing())
         return;
     end();
-    if (!isExecutingScript())
-        MicroTaskQueue::singleton().runMicroTasks();
 }
 
 void HTMLDocumentParser::attemptToEnd()

Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (182265 => 182266)


--- trunk/Source/WebCore/loader/ImageLoader.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/loader/ImageLoader.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -2,8 +2,6 @@
  * Copyright (C) 1999 Lars Knoll (kn...@kde.org)
  *           (C) 1999 Antti Koivisto (koivi...@kde.org)
  * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright 2014 The Chromium Authors. All rights reserved.
- * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -36,11 +34,9 @@
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
 #include "HTMLParserIdioms.h"
-#include "MemoryCache.h"
 #include "Page.h"
 #include "RenderImage.h"
 #include "RenderSVGImage.h"
-#include "ScriptController.h"
 #include "SecurityOrigin.h"
 #include <wtf/NeverDestroyed.h>
 
@@ -67,25 +63,6 @@
 
 namespace WebCore {
 
-class ImageLoader::ImageLoaderTask : public MicroTask {
-public:
-    ImageLoaderTask(WeakPtr<ImageLoader> loader, CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy shouldBypassMainWorldContentSecurityPolicy)
-        : m_loader(loader)
-        , m_shouldBypassMainWorldContentSecurityPolicy(shouldBypassMainWorldContentSecurityPolicy)
-    {
-    }
-
-private:
-    virtual void run() override
-    {
-        if (m_loader && m_loader->hasPendingTask())
-            m_loader->doUpdateFromElement(m_shouldBypassMainWorldContentSecurityPolicy);
-    }
-
-    WeakPtr<ImageLoader> m_loader;
-    CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy m_shouldBypassMainWorldContentSecurityPolicy;
-};
-
 static ImageEventSender& beforeLoadEventSender()
 {
     static NeverDestroyed<ImageEventSender> sender(eventNames().beforeloadEvent);
@@ -114,14 +91,12 @@
     : m_element(element)
     , m_image(0)
     , m_derefElementTimer(*this, &ImageLoader::timerFired)
-    , m_weakFactory(this)
     , m_hasPendingBeforeLoadEvent(false)
     , m_hasPendingLoadEvent(false)
     , m_hasPendingErrorEvent(false)
     , m_imageComplete(true)
     , m_loadManually(false)
     , m_elementIsProtected(false)
-    , m_hasPendingTask(false)
 {
 }
 
@@ -184,26 +159,28 @@
         imageResource->resetAnimation();
 }
 
-void ImageLoader::doUpdateFromElement(CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy shouldBypassMainWorldContentSecurityPolicy)
+void ImageLoader::updateFromElement()
 {
-    m_hasPendingTask = false;
-    Document& document = m_element.document();
-    AtomicString attr = m_element.imageSourceURL();
+    // If we're not making renderers for the page, then don't load images.  We don't want to slow
+    // down the raw HTML parsing case by loading images we don't intend to display.
+    Document& document = element().document();
+    if (!document.hasLivingRenderTree())
+        return;
 
-    String srcURI = sourceURI(attr);
-    URL url;
-    // Set url value only if srcURI is not empty. Otherwise, url will be the URL for the document itself.
-    if (!srcURI.isEmpty())
-        url = ""
+    AtomicString attr = element().imageSourceURL();
+
+    // Avoid loading a URL we already failed to load.
+    if (!m_failedLoadURL.isEmpty() && attr == m_failedLoadURL)
+        return;
+
     // Do not load any image if the 'src' attribute is missing or if it is
     // an empty string.
     CachedResourceHandle<CachedImage> newImage = 0;
-    if (!url.isNull()) {
-        ResourceRequest resourceRequest(url);
-        CachedResourceRequest request(resourceRequest);
+    if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) {
+        CachedResourceRequest request(ResourceRequest(document.completeURL(sourceURI(attr))));
         request.setInitiator(&element());
 
-        AtomicString crossOriginMode = m_element.fastGetAttribute(HTMLNames::crossoriginAttr);
+        String crossOriginMode = element().fastGetAttribute(HTMLNames::crossoriginAttr);
         if (!crossOriginMode.isNull()) {
             StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
             updateRequestForAccessControl(request.mutableResourceRequest(), document.securityOrigin(), allowCredentials);
@@ -218,7 +195,7 @@
             document.cachedResourceLoader().m_documentResources.set(newImage->url(), newImage.get());
             document.cachedResourceLoader().setAutoLoadImages(autoLoadOtherImages);
         } else
-            newImage = document.cachedResourceLoader().requestImage(request, shouldBypassMainWorldContentSecurityPolicy);
+            newImage = document.cachedResourceLoader().requestImage(request);
 
         // If we do not have an image here, it means that a cross-site
         // violation occurred, or that the image was blocked via Content
@@ -236,7 +213,7 @@
         m_hasPendingErrorEvent = true;
         errorEventSender().dispatchEventSoon(*this);
     }
-
+    
     CachedImage* oldImage = m_image.get();
     if (newImage != oldImage) {
         if (m_hasPendingBeforeLoadEvent) {
@@ -288,49 +265,8 @@
     // Only consider updating the protection ref-count of the Element immediately before returning
     // from this function as doing so might result in the destruction of this ImageLoader.
     updatedHasPendingEvent();
-    document.decrementLoadEventDelayCount();
 }
 
-void ImageLoader::updateFromElement()
-{
-    AtomicString attribute = m_element.imageSourceURL();
-
-    // Avoid loading a URL we already failed to load.
-    if (!m_failedLoadURL.isEmpty() && attribute == m_failedLoadURL)
-        return;
-
-    // If we're not making renderers for the page, then don't load images. We don't want to slow
-    // down the raw HTML parsing case by loading images we don't intend to display.
-    Document& document = element().document();
-    if (!document.hasLivingRenderTree())
-        return;
-
-    CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy shouldBypassMainWorldContentSecurityPolicy = CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy::No;
-    if (document.frame() && document.frame()->script().shouldBypassMainWorldContentSecurityPolicy())
-        shouldBypassMainWorldContentSecurityPolicy = CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy::Yes;
-
-    if (!m_hasPendingTask) {
-        m_hasPendingTask = true;
-        document.incrementLoadEventDelayCount();
-        if (shouldLoadImmediately(attribute))
-            doUpdateFromElement(CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy::No);
-        else
-            MicroTaskQueue::singleton().queueMicroTask(std::make_unique<ImageLoaderTask>(createWeakPtr(), shouldBypassMainWorldContentSecurityPolicy));
-    }
-}
-
-bool ImageLoader::shouldLoadImmediately(const AtomicString& attribute) const
-{
-    String srcURI = sourceURI(attribute);
-    URL url = ""
-    return (srcURI.isEmpty()
-        || url.isEmpty()
-        || m_loadManually
-        || !is<HTMLImageElement>(m_element)
-        || url.protocolIsData()
-        || MemoryCache::singleton().resourceForURL(url));
-}
-
 void ImageLoader::updateFromElementIgnoringPreviousError()
 {
     clearFailedLoadURL();
@@ -340,7 +276,6 @@
 void ImageLoader::notifyFinished(CachedResource* resource)
 {
     ASSERT(m_failedLoadURL.isEmpty());
-    ASSERT(resource);
     ASSERT(resource == m_image.get());
 
     m_imageComplete = true;
@@ -350,9 +285,6 @@
     if (!m_hasPendingLoadEvent)
         return;
 
-    ASSERT(image());
-    ASSERT(element().document().securityOrigin());
-
     if (element().fastHasAttribute(HTMLNames::crossoriginAttr)
         && !element().document().securityOrigin()->canRequest(image()->response().url())
         && !resource->passesAccessControlCheck(element().document().securityOrigin())) {
@@ -532,13 +464,8 @@
     errorEventSender().dispatchPendingEvents();
 }
 
-void ImageLoader::elementDidMoveToNewDocument(Document* oldDocument)
+void ImageLoader::elementDidMoveToNewDocument()
 {
-    if (m_hasPendingTask) {
-        if (oldDocument)
-            oldDocument->decrementLoadEventDelayCount();
-        m_element.document().incrementLoadEventDelayCount();
-    }
     clearFailedLoadURL();
     clearImage();
 }

Modified: trunk/Source/WebCore/loader/ImageLoader.h (182265 => 182266)


--- trunk/Source/WebCore/loader/ImageLoader.h	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/loader/ImageLoader.h	2015-04-02 00:22:54 UTC (rev 182266)
@@ -25,21 +25,14 @@
 
 #include "CachedImageClient.h"
 #include "CachedResourceHandle.h"
-#include "CachedResourceLoader.h"
-#include "MicroTask.h"
 #include "Timer.h"
-#include <wtf/RefCounted.h>
-#include <wtf/WeakPtr.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
 
-class Document;
 class Element;
 class ImageLoader;
 class RenderImageResource;
-class URL;
-class Task;
 
 template<typename T> class EventSender;
 typedef EventSender<ImageLoader> ImageEventSender;
@@ -57,12 +50,12 @@
     // doesn't change; starts new load unconditionally (matches Firefox and Opera behavior).
     void updateFromElementIgnoringPreviousError();
 
-    void elementDidMoveToNewDocument(Document* oldDocument);
+    void elementDidMoveToNewDocument();
 
     Element& element() { return m_element; }
     const Element& element() const { return m_element; }
 
-    bool imageComplete() const { return m_imageComplete && !m_hasPendingTask; }
+    bool imageComplete() const { return m_imageComplete; }
 
     CachedImage* image() const { return m_image.get(); }
     void clearImage(); // Cancels pending beforeload and load events, and doesn't dispatch new ones.
@@ -70,7 +63,7 @@
     void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
 
     bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
-    bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent || m_hasPendingTask; }
+    bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
 
     void dispatchPendingEvent(ImageEventSender*);
 
@@ -78,17 +71,11 @@
     static void dispatchPendingLoadEvents();
     static void dispatchPendingErrorEvents();
 
-    bool hasPendingTask() const { return m_hasPendingTask; }
-
 protected:
     explicit ImageLoader(Element&);
     virtual void notifyFinished(CachedResource*) override;
 
 private:
-    class ImageLoaderTask;
-
-    // Called from the task or from updateFromElement to initiate the load.
-    void doUpdateFromElement(CachedResourceLoader::ShouldBypassMainWorldContentSecurityPolicy);
     virtual void dispatchLoadEvent() = 0;
     virtual String sourceURI(const AtomicString&) const = 0;
 
@@ -106,14 +93,9 @@
 
     void timerFired();
 
-    // Determine whether to initiate a synchronous load or to schedule a microtask.
-    bool shouldLoadImmediately(const AtomicString& attribtue) const;
-    WeakPtr<ImageLoader> createWeakPtr() { return m_weakFactory.createWeakPtr(); }
-
     Element& m_element;
     CachedResourceHandle<CachedImage> m_image;
     Timer m_derefElementTimer;
-    WeakPtrFactory<ImageLoader> m_weakFactory;
     AtomicString m_failedLoadURL;
     bool m_hasPendingBeforeLoadEvent : 1;
     bool m_hasPendingLoadEvent : 1;
@@ -121,7 +103,6 @@
     bool m_imageComplete : 1;
     bool m_loadManually : 1;
     bool m_elementIsProtected : 1;
-    bool m_hasPendingTask : 1;
 };
 
 }

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (182265 => 182266)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -173,7 +173,7 @@
     return sessionID;
 }
 
-CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest& request, ShouldBypassMainWorldContentSecurityPolicy shouldBypassMainWorldContentSecurityPolicy)
+CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest& request)
 {
     if (Frame* frame = this->frame()) {
         if (frame->loader().pageDismissalEventBeingDispatched() != FrameLoader::NoDismissal) {
@@ -185,7 +185,7 @@
     }
     
     request.setDefer(clientDefersImage(request.resourceRequest().url()) ? CachedResourceRequest::DeferredByClient : CachedResourceRequest::NoDefer);
-    return downcast<CachedImage>(requestResource(CachedResource::ImageResource, request, shouldBypassMainWorldContentSecurityPolicy).get());
+    return downcast<CachedImage>(requestResource(CachedResource::ImageResource, request).get());
 }
 
 CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest& request, bool isSVG)
@@ -357,7 +357,7 @@
     return true;
 }
 
-bool CachedResourceLoader::canRequest(CachedResource::Type type, const URL& url, const ResourceLoaderOptions& options, bool forPreload, ShouldBypassMainWorldContentSecurityPolicy bypassMainWorldContentSecurityPolicy)
+bool CachedResourceLoader::canRequest(CachedResource::Type type, const URL& url, const ResourceLoaderOptions& options, bool forPreload)
 {
     if (document() && !document()->securityOrigin()->canDisplay(url)) {
         if (!forPreload)
@@ -366,10 +366,8 @@
         return 0;
     }
 
-
     // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
-    bool shouldBypassMainWorldContentSecurityPolicy = (bypassMainWorldContentSecurityPolicy == ShouldBypassMainWorldContentSecurityPolicy::Yes)
-        || (frame() && frame()->script().shouldBypassMainWorldContentSecurityPolicy());
+    bool shouldBypassMainWorldContentSecurityPolicy = (frame() && frame()->script().shouldBypassMainWorldContentSecurityPolicy());
 
     // Some types of resources can be loaded only from the same origin.  Other
     // types of resources, like Images, Scripts, and CSS, can be loaded from
@@ -494,7 +492,7 @@
         frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceRequestKey(), description, value, ShouldSample::Yes);
 }
 
-CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest& request, ShouldBypassMainWorldContentSecurityPolicy shouldBypassMainWorldContentSecurityPolicy)
+CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest& request)
 {
     URL url = ""
     
@@ -506,7 +504,7 @@
     if (!url.isValid())
         return nullptr;
 
-    if (!canRequest(type, url, request.options(), request.forPreload(), shouldBypassMainWorldContentSecurityPolicy))
+    if (!canRequest(type, url, request.options(), request.forPreload()))
         return nullptr;
 
 #if ENABLE(CONTENT_EXTENSIONS)

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (182265 => 182266)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h	2015-04-02 00:22:54 UTC (rev 182266)
@@ -71,9 +71,7 @@
     static Ref<CachedResourceLoader> create(DocumentLoader* documentLoader) { return adoptRef(*new CachedResourceLoader(documentLoader)); }
     ~CachedResourceLoader();
 
-    enum class ShouldBypassMainWorldContentSecurityPolicy { No, Yes };
-
-    CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&, ShouldBypassMainWorldContentSecurityPolicy = ShouldBypassMainWorldContentSecurityPolicy::No);
+    CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&);
     CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&);
     CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&);
     CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&);
@@ -133,7 +131,7 @@
     void preload(CachedResource::Type, CachedResourceRequest&, const String& charset);
     void checkForPendingPreloads();
     void printPreloadStats();
-    bool canRequest(CachedResource::Type, const URL&, const ResourceLoaderOptions&, bool forPreload = false, ShouldBypassMainWorldContentSecurityPolicy = ShouldBypassMainWorldContentSecurityPolicy::No);
+    bool canRequest(CachedResource::Type, const URL&, const ResourceLoaderOptions&, bool forPreload = false);
 
     static const ResourceLoaderOptions& defaultCachedResourceOptions();
 
@@ -142,7 +140,7 @@
 private:
     explicit CachedResourceLoader(DocumentLoader*);
 
-    CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&, ShouldBypassMainWorldContentSecurityPolicy = ShouldBypassMainWorldContentSecurityPolicy::No);
+    CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&);
     CachedResourceHandle<CachedResource> revalidateResource(const CachedResourceRequest&, CachedResource*);
     CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, CachedResourceRequest&);
 #if ENABLE(RESOURCE_TIMING)

Modified: trunk/Source/WebCore/svg/SVGImageElement.cpp (182265 => 182266)


--- trunk/Source/WebCore/svg/SVGImageElement.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/svg/SVGImageElement.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -205,7 +205,7 @@
 
 void SVGImageElement::didMoveToNewDocument(Document* oldDocument)
 {
-    m_imageLoader.elementDidMoveToNewDocument(oldDocument);
+    m_imageLoader.elementDidMoveToNewDocument();
     SVGGraphicsElement::didMoveToNewDocument(oldDocument);
 }
 

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (182265 => 182266)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2015-04-02 00:16:36 UTC (rev 182265)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2015-04-02 00:22:54 UTC (rev 182266)
@@ -40,7 +40,6 @@
 #include "HTMLNames.h"
 #include "HTMLStyleElement.h"
 #include "ImageLoader.h"
-#include "MicroTask.h"
 #include "ProcessingInstruction.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
@@ -201,7 +200,6 @@
     document()->setReadyState(Document::Interactive);
     clearCurrentNodeStack();
     document()->finishedParsing();
-    MicroTaskQueue::singleton().runMicroTasks();
 }
 
 void XMLDocumentParser::finish()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to