Unreviewed, rolling out r129388.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 20:07:13 +0000 (20:07 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 20:07:13 +0000 (20:07 +0000)
http://trac.webkit.org/changeset/129388
https://bugs.webkit.org/show_bug.cgi?id=97477

Caused an assertion in a WebKit2 unit test (Requested by
abarth on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-24

.:

* Source/autotools/symbols.filter:

Source/WebCore:

* WebCore.exp.in:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequest):
* loader/cache/CachedImage.cpp:
* loader/cache/CachedImage.h:
(WebCore::CachedImage::stillNeedsLoad):
(CachedImage):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::didAddClient):
* loader/cache/CachedResource.h:
(WebCore):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::CachedResourceLoader):
(WebCore::CachedResourceLoader::requestImage):
(WebCore::CachedResourceLoader::canRequest):
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::revalidateResource):
(WebCore::CachedResourceLoader::loadResource):
(WebCore::CachedResourceLoader::determineRevalidationPolicy):
(WebCore::CachedResourceLoader::setAutoLoadImages):
* loader/cache/CachedResourceLoader.h:
(CachedResourceLoader):
* page/Settings.cpp:
(WebCore::setLoadsImagesAutomaticallyInAllFrames):
(WebCore::Settings::Settings):
(WebCore::Settings::setLoadsImagesAutomatically):
(WebCore::Settings::loadsImagesAutomaticallyTimerFired):
(WebCore::Settings::setImagesEnabled):
* page/Settings.h:
(Settings):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
* testing/InternalSettings.h:
(Backup):
(InternalSettings):
* testing/InternalSettings.idl:

Source/WebKit2:

* win/WebKit2.def:

LayoutTests:

* fast/loader/display-image-unset-allows-cached-image-load-expected.txt: Removed.
* fast/loader/display-image-unset-allows-cached-image-load.html: Removed.
* fast/loader/display-image-unset-can-block-image-and-can-reload-in-place-expected.txt: Removed.
* fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html: Removed.
* fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place-expected.txt: Removed.
* fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html: Removed.
* fast/loader/resources/image1.html: Removed.
* fast/loader/resources/image2.html: Removed.
* platform/chromium/permissionclient/image-permissions-expected.txt:
* platform/chromium/permissionclient/image-permissions.html:
* platform/chromium/permissionclient/resources/image.html:
* platform/wk2/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129402 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/loader/display-image-unset-allows-cached-image-load-expected.txt [deleted file]
LayoutTests/fast/loader/display-image-unset-allows-cached-image-load.html [deleted file]
LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place-expected.txt [deleted file]
LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html [deleted file]
LayoutTests/fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place-expected.txt [deleted file]
LayoutTests/fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html [deleted file]
LayoutTests/fast/loader/resources/image1.html [deleted file]
LayoutTests/fast/loader/resources/image2.html [deleted file]
LayoutTests/platform/chromium/permissionclient/image-permissions-expected.txt
LayoutTests/platform/chromium/permissionclient/image-permissions.html
LayoutTests/platform/chromium/permissionclient/resources/image.html
LayoutTests/platform/wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedImage.h
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceLoader.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/autotools/symbols.filter

index ca5b945..27cb51d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-09-24  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r129388.
+        http://trac.webkit.org/changeset/129388
+        https://bugs.webkit.org/show_bug.cgi?id=97477
+
+        Caused an assertion in a WebKit2 unit test (Requested by
+        abarth on #webkit).
+
+        * Source/autotools/symbols.filter:
+
 2012-09-24  Dominik Röttsches  <dominik.rottsches@intel.com>
 
         [EFL][DRT] Enable Regions support
index c2bd018..a546b9f 100644 (file)
@@ -1,3 +1,25 @@
+2012-09-24  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r129388.
+        http://trac.webkit.org/changeset/129388
+        https://bugs.webkit.org/show_bug.cgi?id=97477
+
+        Caused an assertion in a WebKit2 unit test (Requested by
+        abarth on #webkit).
+
+        * fast/loader/display-image-unset-allows-cached-image-load-expected.txt: Removed.
+        * fast/loader/display-image-unset-allows-cached-image-load.html: Removed.
+        * fast/loader/display-image-unset-can-block-image-and-can-reload-in-place-expected.txt: Removed.
+        * fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html: Removed.
+        * fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place-expected.txt: Removed.
+        * fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html: Removed.
+        * fast/loader/resources/image1.html: Removed.
+        * fast/loader/resources/image2.html: Removed.
+        * platform/chromium/permissionclient/image-permissions-expected.txt:
+        * platform/chromium/permissionclient/image-permissions.html:
+        * platform/chromium/permissionclient/resources/image.html:
+        * platform/wk2/Skipped:
+
 2012-09-24  Erik Arvidsson  <arv@chromium.org>
 
         DOM4 remove method
diff --git a/LayoutTests/fast/loader/display-image-unset-allows-cached-image-load-expected.txt b/LayoutTests/fast/loader/display-image-unset-allows-cached-image-load-expected.txt
deleted file mode 100644 (file)
index 6e15aac..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Test that WebKitDisplayImagesKey unset does not block image in cache.
-PASS
diff --git a/LayoutTests/fast/loader/display-image-unset-allows-cached-image-load.html b/LayoutTests/fast/loader/display-image-unset-allows-cached-image-load.html
deleted file mode 100644 (file)
index 08d703d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<html>
-<head>
-<script>
-// Opens two windows containing the same image. First window will populate the cache with
-// image. The second window is opened with WebKitDisplayImagesKey unset, but image should
-// still load since it is in cache.
-function runTest()
-{
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-        testRunner.setCanOpenWindows();
-        testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
-
-        document.getElementById('result').innerHTML = 'FAILURE: image1.html not loaded';
-        window.open("resources/image1.html", "_blank");
-    }
-}
-
-function image1Loaded()
-{
-    testRunner.overridePreference('WebKitDisplayImagesKey', 0);
-    document.getElementById('result').innerHTML = 'FAILURE: image2.html not loaded';
-    window.setTimeout(function() {window.open("resources/image2.html", "_blank");}, 0);
-}
-
-function image2Loaded()
-{
-    document.getElementById('result').innerHTML = 'PASS';
-               testRunner.notifyDone();
-}
-</script>
-</head>
-<body onload="runTest()">
-Test that WebKitDisplayImagesKey unset does not block image in cache.
-<div id="result">FAILURE: Test script didn't run.</div>
-</body>
-</html>
-
diff --git a/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place-expected.txt b/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place-expected.txt
deleted file mode 100644 (file)
index 7a9ef53..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Test that DisplayImages disabled can block http image and can be reloaded in-place when toggled.
-SUCCESS
-
diff --git a/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html b/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html
deleted file mode 100644 (file)
index 312f509..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<html>
-<head>
-<script>
-// Setting WebKitDisplayImagesKey is asynchronous, so using queueReload and setInterval to check when the setting actually take effect.
-
-var intervalId;
-var imageOnloadFired = 0;
-
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    window.internals.settings.setImagesEnabled(true);
-    testRunner.overridePreference('WebKitDisplayImagesKey', 0);
-    testRunner.queueReload();
-}
-
-function runTest()
-{
-    var image = document.getElementById('image');
-    if (image.naturalHeight != 0 || image.naturalWidth != 0 || imageOnloadFired != 0) {
-        document.getElementById('result').innerHTML = 'FAILURE: Image should not be loaded when DisplayImage is unset';
-        return;
-    }
-
-    testRunner.overridePreference('WebKitDisplayImagesKey', 1);
-    document.getElementById('result').innerHTML = 'FAILURE: Image should reload in-place when DispalyImage is changes from unset to set';
-    testRunner.waitUntilDone();
-    intervalId = window.setInterval(runTestRest, 10);
-}
-
-function runTestRest()
-{
-    var image = document.getElementById('image');
-    if (image.naturalHeight == 33 && image.naturalWidth == 37 && imageOnloadFired == 1) {
-        document.getElementById('result').innerHTML = 'SUCCESS';
-        window.clearInterval(intervalId);
-        testRunner.notifyDone();
-    }
-}
-</script>
-</head>
-<body onload="runTest()">
-  Test that DisplayImages disabled can block http image and can be reloaded in-place when toggled.
-  <div id="result">FAILURE: Test script didn't run.</div>
-  <img id="image" src="../images/resources/oval.png" onload="imageOnloadFired=1;">
-</body>
-</html>
-
diff --git a/LayoutTests/fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place-expected.txt b/LayoutTests/fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place-expected.txt
deleted file mode 100644 (file)
index 951d460..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Test that EnableImages unset can block image and can be reloaded in-place when toggled.
-SUCCESS
-
diff --git a/LayoutTests/fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html b/LayoutTests/fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html
deleted file mode 100644 (file)
index 3f48e62..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<html>
-<head>
-<script>
-// Setting ImagesEnabled is asynchronous, so using queueReload and setInterval to check when the setting actually take effect.
-
-var intervalId;
-var imageOnloadFired = 0;
-
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.overridePreference('WebKitDisplayImagesKey', 1);
-    window.internals.settings.setImagesEnabled(false);
-    testRunner.queueReload();
-}
-
-function runTest()
-{
-    var image = document.getElementById('image');
-    if (image.naturalHeight != 0 || image.naturalWidth != 0 || imageOnloadFired != 0) {
-        document.getElementById('result').innerHTML = 'FAILURE: Image should not be loaded when ImagesEnabled is unset';
-        return;
-    }
-
-    window.internals.settings.setImagesEnabled(true);
-    document.getElementById('result').innerHTML = 'FAILURE: Image should reload in-place when ImagesEnabled is changes from unset to set';
-    testRunner.waitUntilDone();
-    intervalId = window.setInterval(runTestRest, 10);
-}
-
-function runTestRest()
-{
-    var image = document.getElementById('image');
-    if (image.naturalHeight == 33 && image.naturalWidth == 37 || imageOnloadFired == 1) {
-        document.getElementById('result').innerHTML = 'SUCCESS';
-        window.clearInterval(intervalId);
-        testRunner.notifyDone();
-    }
-}
-</script>
-</head>
-<body onload="runTest()">
-  Test that EnableImages unset can block image and can be reloaded in-place when toggled.
-  <div id="result">FAILURE: Test script didn't run.</div>
-  <img id="image" src="../images/resources/oval.png" onload="imageOnloadFired=1;">
-</body>
-</html>
-
diff --git a/LayoutTests/fast/loader/resources/image1.html b/LayoutTests/fast/loader/resources/image1.html
deleted file mode 100644 (file)
index cd69dc3..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-  <img src="../../images/resources/oval.png" onload="window.opener.image1Loaded();">
-</body>
-</html>
diff --git a/LayoutTests/fast/loader/resources/image2.html b/LayoutTests/fast/loader/resources/image2.html
deleted file mode 100644 (file)
index c037fff..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-  <img src="../../images/resources/oval.png" onload="window.opener.image2Loaded();">
-</body>
-</html>
index e607a10..60e76a5 100644 (file)
@@ -5,4 +5,6 @@ PERMISSION CLIENT: allowImage((file test):platform/chromium/permissionclient/res
 
 
 PASS: first image loaded
+PASS: error event for not cached image
+PASS: error event for image from cache
 
index f57a3b7..7b5e2c5 100644 (file)
@@ -1,9 +1,6 @@
 <html>
 <head>
 <script>
-// Blocked images can be reloaded, so neither onload nor onerror is called.
-// Only check here that onload is never called when image is blocked.
-
 if (window.testRunner) {
     testRunner.dumpAsText();
     testRunner.dumpPermissionClientCallbacks();
@@ -24,12 +21,14 @@ function loaded()
 
     // Load an image not in cache.
     var img = document.createElement('img');
+    img.onerror = function () { log("PASS: error event for not cached image"); }
     img.onload = function () { log("FAIL: not cached image loaded"); }
     img.src = "resources/boston.gif?nocache";
     document.getElementById("img").appendChild(img);
 
     // Load an image from cache.
     var imgFromCache = document.createElement('img');
+    imgFromCache.onerror = function () { log("PASS: error event for image from cache"); }
     imgFromCache.onload = function () { log("FAIL: image from cache loaded"); }
     imgFromCache.src = "resources/boston.gif";
     document.getElementById("img").appendChild(imgFromCache);
@@ -42,7 +41,7 @@ function loaded()
 </script>
 </head>
 <body>
-<img src="resources/boston.gif" onload="loaded()">
+<img src="resources/boston.gif" onload="loaded()" onerror="log('FAIL: error event for first image')">
 <div id="img"></div>
 <div id="results"></div>
 </body>
index 2397717..e2adfe3 100644 (file)
@@ -8,7 +8,7 @@ function log(a)
 </script>
 </head>
 <body>
-<img src="boston.gif" onload="log('FAIL: load event for iframed image')">
+<img src="boston.gif" onload="log('FAIL: load event for iframed image)" onerror="log('FAIL: error event for iframed image')">
 <div id="results"></div>
 </body>
 </html>
index a681132..bc4201f 100644 (file)
@@ -203,7 +203,6 @@ fast/canvas/webgl/webgl-specific.html
 fast/canvas/webgl/oes-vertex-array-object.html
 fast/harness/override-preferences-2.html
 fast/images/animated-gif-restored-from-bfcache.html
-fast/loader/display-image-unset-allows-cached-image-load.html
 fast/text/zero-font-size.html
 
 # WebKitTestRunner needs to support layoutTestController.dumpDOMAsWebArchive
@@ -318,8 +317,6 @@ svg/custom/svg-allowed-in-dashboard-object.html
 # <https://bugs.webkit.org/show_bug.cgi?id=42672>
 fast/css/compare-content-style.html
 fast/frames/frame-display-none-focus.html
-fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html
-fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html
 fast/loader/reload-policy-delegate.html
 
 # WebKitTestRunner needs layoutTestController.queueLoad
index c9839c4..fe458c5 100644 (file)
@@ -1,3 +1,52 @@
+2012-09-24  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r129388.
+        http://trac.webkit.org/changeset/129388
+        https://bugs.webkit.org/show_bug.cgi?id=97477
+
+        Caused an assertion in a WebKit2 unit test (Requested by
+        abarth on #webkit).
+
+        * WebCore.exp.in:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didBeginDocument):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequest):
+        * loader/cache/CachedImage.cpp:
+        * loader/cache/CachedImage.h:
+        (WebCore::CachedImage::stillNeedsLoad):
+        (CachedImage):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::didAddClient):
+        * loader/cache/CachedResource.h:
+        (WebCore):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::CachedResourceLoader):
+        (WebCore::CachedResourceLoader::requestImage):
+        (WebCore::CachedResourceLoader::canRequest):
+        (WebCore::CachedResourceLoader::requestResource):
+        (WebCore::CachedResourceLoader::revalidateResource):
+        (WebCore::CachedResourceLoader::loadResource):
+        (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+        (WebCore::CachedResourceLoader::setAutoLoadImages):
+        * loader/cache/CachedResourceLoader.h:
+        (CachedResourceLoader):
+        * page/Settings.cpp:
+        (WebCore::setLoadsImagesAutomaticallyInAllFrames):
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::setLoadsImagesAutomatically):
+        (WebCore::Settings::loadsImagesAutomaticallyTimerFired):
+        (WebCore::Settings::setImagesEnabled):
+        * page/Settings.h:
+        (Settings):
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup):
+        (WebCore::InternalSettings::Backup::restoreTo):
+        * testing/InternalSettings.h:
+        (Backup):
+        (InternalSettings):
+        * testing/InternalSettings.idl:
+
 2012-09-24  Erik Arvidsson  <arv@chromium.org>
 
         DOM4 remove method
index 379244e..58c504d 100644 (file)
@@ -852,7 +852,6 @@ __ZN7WebCore8GradientC1ERKNS_10FloatPointES3_
 __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEiNS0_10AnchorTypeE
 __ZN7WebCore8Settings14setJavaEnabledEb
 __ZN7WebCore8Settings15setWebGLEnabledEb
-__ZN7WebCore8Settings16setImagesEnabledEb
 __ZN7WebCore8Settings16setScriptEnabledEb
 __ZN7WebCore8Settings16setUsesPageCacheEb
 __ZN7WebCore8Settings17setPluginsEnabledEb
index 41772ca..b26b6d4 100644 (file)
@@ -647,7 +647,6 @@ void FrameLoader::didBeginDocument(bool dispatch)
     m_frame->document()->initContentSecurityPolicy();
 
     Settings* settings = m_frame->document()->settings();
-    m_frame->document()->cachedResourceLoader()->setImagesEnabled(!settings || settings->areImagesEnabled());
     m_frame->document()->cachedResourceLoader()->setAutoLoadImages(settings && settings->loadsImagesAutomatically());
 
     if (m_documentLoader) {
index 56de0d3..ff3be6e 100644 (file)
@@ -167,13 +167,11 @@ void SubresourceLoader::willSendRequest(ResourceRequest& newRequest, const Resou
     
     ResourceLoader::willSendRequest(newRequest, redirectResponse);
     if (!previousURL.isNull() && !newRequest.isNull() && previousURL != newRequest.url()) {
-        if (m_document->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
-            if (m_resource->type() != CachedResource::ImageResource || !m_document->cachedResourceLoader()->shouldDeferImageLoad(newRequest.url())) {
-                m_resource->willSendRequest(newRequest, redirectResponse);
-                return;
-            }
+        if (!m_document->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
+            cancel();
+            return;
         }
-        cancel();
+        m_resource->willSendRequest(newRequest, redirectResponse);
     }
 }
 
index 41075a7..4316616 100644 (file)
@@ -29,6 +29,7 @@
 #include "CachedResourceClient.h"
 #include "CachedResourceClientWalker.h"
 #include "CachedResourceLoader.h"
+#include "Frame.h"
 #include "FrameLoaderClient.h"
 #include "FrameLoaderTypes.h"
 #include "FrameView.h"
index 078f7ab..4865c7e 100644 (file)
@@ -82,7 +82,8 @@ public:
     virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; }
 
     virtual bool isImage() const { return true; }
-    virtual bool stillNeedsLoad() const OVERRIDE { return !errorOccurred() && status() == Unknown && !isLoading(); }
+    bool stillNeedsLoad() const { return !errorOccurred() && status() == Unknown && !isLoading(); }
+    void load();
 
     // ImageObserver
     virtual void decodedSizeChanged(const Image* image, int delta);
index 33d1ba8..43c3d14 100755 (executable)
@@ -32,6 +32,7 @@
 #include "CachedResourceLoader.h"
 #include "CrossOriginAccessControl.h"
 #include "Document.h"
+#include "Frame.h"
 #include "FrameLoaderClient.h"
 #include "InspectorInstrumentation.h"
 #include "KURL.h"
@@ -389,7 +390,7 @@ void CachedResource::didAddClient(CachedResourceClient* c)
         m_clients.add(c);
         m_clientsAwaitingCallback.remove(c);
     }
-    if (!isLoading() && !stillNeedsLoad())
+    if (!isLoading())
         c->notifyFinished(this);
 }
 
index b739d68..0cad3ee 100644 (file)
@@ -45,6 +45,7 @@ class CachedMetadata;
 class CachedResourceClient;
 class CachedResourceHandleBase;
 class CachedResourceLoader;
+class Frame;
 class InspectorResource;
 class PurgeableBuffer;
 class SecurityOrigin;
@@ -143,7 +144,6 @@ public:
 
     bool isLoading() const { return m_loading; }
     void setLoading(bool b) { m_loading = b; }
-    virtual bool stillNeedsLoad() const { return false; }
 
     SubresourceLoader* loader() { return m_loader.get(); }
 
index d1f6a5f..353a62a 100644 (file)
@@ -46,7 +46,6 @@
 #include "MemoryCache.h"
 #include "PingLoader.h"
 #include "ResourceLoadScheduler.h"
-#include "SchemeRegistry.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include <wtf/UnusedParam.h>
@@ -116,7 +115,6 @@ CachedResourceLoader::CachedResourceLoader(Document* document)
     , m_requestCount(0)
     , m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired)
     , m_autoLoadImages(true)
-    , m_imagesEnabled(true)
     , m_allowStaleResources(false)
 {
 }
@@ -161,7 +159,10 @@ CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(ResourceReq
             return 0;
         }
     }
-    return static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request, String(), defaultCachedResourceOptions(), ResourceLoadPriorityUnresolved, false, clientDefersImage(request.url()) ? DeferredByClient : NoDefer).get());
+    CachedResourceHandle<CachedImage> resource(static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request, String(), defaultCachedResourceOptions()).get()));
+    if (autoLoadImages() && resource && resource->stillNeedsLoad())
+        resource->load(this, defaultCachedResourceOptions());
+    return resource;
 }
 
 CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(ResourceRequest& request)
@@ -361,6 +362,12 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
     case CachedResource::ImageResource:
         if (!m_document->contentSecurityPolicy()->allowImageFromSource(url))
             return false;
+
+        if (frame()) {
+            Settings* settings = frame()->settings();
+            if (!frame()->loader()->client()->allowImage(!settings || settings->areImagesEnabled(), url))
+                return false;
+        }
         break;
     case CachedResource::FontResource: {
         if (!m_document->contentSecurityPolicy()->allowFontFromSource(url))
@@ -394,7 +401,7 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
     return true;
 }
 
-CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, ResourceRequest& request, const String& charset, const ResourceLoaderOptions& options, ResourceLoadPriority priority, bool forPreload, DeferOption defer)
+CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, ResourceRequest& request, const String& charset, const ResourceLoaderOptions& options, ResourceLoadPriority priority, bool forPreload)
 {
     KURL url = request.url();
     
@@ -423,16 +430,16 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
     if (request.url() != url)
         request.setURL(url);
 
-    const RevalidationPolicy policy = determineRevalidationPolicy(type, request, forPreload, resource.get(), defer);
-    switch (policy) {
+    switch (determineRevalidationPolicy(type, request, forPreload, resource.get())) {
+    case Load:
+        resource = loadResource(type, request, charset, priority, options);
+        break;
     case Reload:
         memoryCache()->remove(resource.get());
-        // Fall through
-    case Load:
-        resource = loadResource(type, request, charset);
+        resource = loadResource(type, request, charset, priority, options);
         break;
     case Revalidate:
-        resource = revalidateResource(resource.get());
+        resource = revalidateResource(resource.get(), priority, options);
         break;
     case Use:
         memoryCache()->resourceAccessed(resource.get());
@@ -443,27 +450,12 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
     if (!resource)
         return 0;
 
-    resource->setLoadPriority(priority);
-    if ((policy != Use || resource->stillNeedsLoad()) && NoDefer == defer) {
-        resource->load(this, options);
-
-        // We don't support immediate loads, but we do support immediate failure.
-        if (resource->errorOccurred()) {
-            if (resource->inCache())
-                memoryCache()->remove(resource.get());
-            return 0;
-        }
-    }
-
-    if (!request.url().protocolIsData())
-        m_validatedURLs.add(request.url());
-
     ASSERT(resource->url() == url.string());
     m_documentResources.set(resource->url(), resource);
     return resource;
 }
 
-CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(CachedResource* resource)
+CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(CachedResource* resource, ResourceLoadPriority priority, const ResourceLoaderOptions& options)
 {
     ASSERT(resource);
     ASSERT(resource->inCache());
@@ -473,6 +465,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(Ca
     
     // Copy the URL out of the resource to be revalidated in case it gets deleted by the remove() call below.
     String url = resource->url();
+    bool urlProtocolIsData = resource->url().protocolIsData();
     CachedResourceHandle<CachedResource> newResource = createResource(resource->type(), resource->resourceRequest(), resource->encoding());
     
     LOG(ResourceLoading, "Resource %p created to revalidate %p", newResource.get(), resource);
@@ -480,10 +473,16 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(Ca
     
     memoryCache()->remove(resource);
     memoryCache()->add(newResource.get());
+    
+    newResource->setLoadPriority(priority);
+    newResource->load(this, options);
+
+    if (!urlProtocolIsData)
+        m_validatedURLs.add(url);
     return newResource;
 }
 
-CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedResource::Type type, ResourceRequest& request, const String& charset)
+CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedResource::Type type, ResourceRequest& request, const String& charset, ResourceLoadPriority priority, const ResourceLoaderOptions& options)
 {
     ASSERT(!memoryCache()->resourceForURL(request.url()));
     
@@ -491,20 +490,35 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe
     
     CachedResourceHandle<CachedResource> resource = createResource(type, request, charset);
     
-    if (!memoryCache()->add(resource.get()))
+    bool inCache = memoryCache()->add(resource.get());
+    
+    resource->setLoadPriority(priority);
+    resource->load(this, options);
+    
+    if (!inCache)
         resource->setOwningCachedResourceLoader(this);
+
+    // We don't support immediate loads, but we do support immediate failure.
+    if (resource->errorOccurred()) {
+        if (inCache)
+            memoryCache()->remove(resource.get());
+        return 0;
+    }
+
+    if (!request.url().protocolIsData())
+        m_validatedURLs.add(request.url());
     return resource;
 }
 
-CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, DeferOption defer) const
+CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource) const
 {
     if (!existingResource)
         return Load;
-
+    
     // We already have a preload going for this URL.
     if (forPreload && existingResource->isPreloaded())
         return Use;
-
+    
     // If the same URL has been loaded as a different type, we need to reload.
     if (existingResource->type() != type) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to type mismatch.");
@@ -519,11 +533,6 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
     // of things about how revalidation works that manual headers violate, so punt to Reload instead.
     if (request.isConditional())
         return Reload;
-
-    // Do not load from cache if images are not enabled. The load for this image will be blocked
-    // in CachedImage::load.
-    if (DeferredByClient == defer)
-        return Reload;
     
     // Don't reload resources while pasting.
     if (m_allowStaleResources)
@@ -620,39 +629,15 @@ void CachedResourceLoader::setAutoLoadImages(bool enable)
     if (!m_autoLoadImages)
         return;
 
-    reloadImagesIfNotDeferred();
-}
-
-void CachedResourceLoader::setImagesEnabled(bool enable)
-{
-    if (enable == m_imagesEnabled)
-        return;
-
-    m_imagesEnabled = enable;
-
-    if (!m_imagesEnabled)
-        return;
-
-    reloadImagesIfNotDeferred();
-}
-
-bool CachedResourceLoader::clientDefersImage(const KURL& url) const
-{
-    return frame() && !frame()->loader()->client()->allowImage(m_imagesEnabled, url);
-}
-
-bool CachedResourceLoader::shouldDeferImageLoad(const KURL& url) const
-{
-    return clientDefersImage(url) || !m_autoLoadImages;
-}
-
-void CachedResourceLoader::reloadImagesIfNotDeferred()
-{
     DocumentResourceMap::iterator end = m_documentResources.end();
     for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != end; ++it) {
         CachedResource* resource = it->second.get();
-        if (resource->type() == CachedResource::ImageResource && !clientDefersImage(resource->url()))
-            const_cast<CachedResource*>(resource)->load(this, defaultCachedResourceOptions());
+        if (resource->type() == CachedResource::ImageResource) {
+            CachedImage* image = const_cast<CachedImage*>(static_cast<const CachedImage*>(resource));
+
+            if (image->stillNeedsLoad())
+                image->load(this, defaultCachedResourceOptions());
+        }
     }
 }
 
index b5dc694..f4755c2 100644 (file)
@@ -97,10 +97,6 @@ public:
 
     bool autoLoadImages() const { return m_autoLoadImages; }
     void setAutoLoadImages(bool);
-
-    void setImagesEnabled(bool);
-
-    bool shouldDeferImageLoad(const KURL&) const;
     
     CachePolicy cachePolicy() const;
     
@@ -126,23 +122,19 @@ public:
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
 private:
-    enum DeferOption { NoDefer, DeferredByClient };
-    CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, ResourceRequest&, const String& charset, const ResourceLoaderOptions&, ResourceLoadPriority = ResourceLoadPriorityUnresolved, bool isPreload = false, DeferOption = NoDefer);
-    CachedResourceHandle<CachedResource> revalidateResource(CachedResource*);
-    CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, ResourceRequest&, const String& charset);
+    CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, ResourceRequest&, const String& charset, const ResourceLoaderOptions&, ResourceLoadPriority = ResourceLoadPriorityUnresolved, bool isPreload = false);
+    CachedResourceHandle<CachedResource> revalidateResource(CachedResource*, ResourceLoadPriority, const ResourceLoaderOptions&);
+    CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, ResourceRequest&, const String& charset, ResourceLoadPriority, const ResourceLoaderOptions&);
     void requestPreload(CachedResource::Type, ResourceRequest&, const String& charset);
 
     enum RevalidationPolicy { Use, Revalidate, Reload, Load };
-    RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, ResourceRequest&, bool forPreload, CachedResource* existingResource, DeferOption) const;
+    RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, ResourceRequest&, bool forPreload, CachedResource* existingResource) const;
     
     void notifyLoadedFromMemoryCache(CachedResource*);
     bool checkInsecureContent(CachedResource::Type, const KURL&) const;
 
     void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*);
     void performPostLoadActions();
-
-    bool clientDefersImage(const KURL&) const;
-    void reloadImagesIfNotDeferred();
     
     HashSet<String> m_validatedURLs;
     mutable DocumentResourceMap m_documentResources;
@@ -160,9 +152,8 @@ private:
 
     Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;
 
-    // 29 bits left
+    // 30 bits left
     bool m_autoLoadImages : 1;
-    bool m_imagesEnabled : 1;
     bool m_allowStaleResources : 1;
 };
 
index 30666c5..df42596 100644 (file)
@@ -46,12 +46,10 @@ using namespace std;
 
 namespace WebCore {
 
-static void setImageLoadingSettings(Page* page)
+static void setLoadsImagesAutomaticallyInAllFrames(Page* page)
 {
-    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
-        frame->document()->cachedResourceLoader()->setImagesEnabled(page->settings()->areImagesEnabled());
+    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
         frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
-    }
 }
 
 // Sets the entry in the font map for the given script. If family is the empty string, removes the entry instead.
@@ -293,7 +291,7 @@ Settings::Settings(Page* page)
     , m_windowFocusRestricted(true)
     , m_diagnosticLoggingEnabled(false)
     , m_scrollingPerformanceLoggingEnabled(false)
-    , m_setImageLoadingSettingsTimer(this, &Settings::imageLoadingSettingsTimerFired)
+    , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
     , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds)
 {
     // A Frame may not have been created yet, so we initialize the AtomicString
@@ -468,12 +466,12 @@ void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
     // Starting these loads synchronously is not important.  By putting it on a 0-delay, properly closing the Page cancels them
     // before they have a chance to really start.
     // See http://webkit.org/b/60572 for more discussion.
-    m_setImageLoadingSettingsTimer.startOneShot(0);
+    m_loadsImagesAutomaticallyTimer.startOneShot(0);
 }
 
-void Settings::imageLoadingSettingsTimerFired(Timer<Settings>*)
+void Settings::loadsImagesAutomaticallyTimerFired(Timer<Settings>*)
 {
-    setImageLoadingSettings(m_page);
+    setLoadsImagesAutomaticallyInAllFrames(m_page);
 }
 
 void Settings::setLoadsSiteIconsIgnoringImageLoadingSetting(bool loadsSiteIcons)
@@ -519,9 +517,6 @@ void Settings::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles)
 void Settings::setImagesEnabled(bool areImagesEnabled)
 {
     m_areImagesEnabled = areImagesEnabled;
-
-    // See comment in setLoadsImagesAutomatically.
-    m_setImageLoadingSettingsTimer.startOneShot(0);
 }
 
 void Settings::setMediaEnabled(bool isMediaEnabled)
index c18dfd7..83986f6 100644 (file)
@@ -818,8 +818,8 @@ namespace WebCore {
 
         bool m_scrollingPerformanceLoggingEnabled : 1;
 
-        Timer<Settings> m_setImageLoadingSettingsTimer;
-        void imageLoadingSettingsTimerFired(Timer<Settings>*);
+        Timer<Settings> m_loadsImagesAutomaticallyTimer;
+        void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
         
         double m_incrementalRenderingSuppressionTimeoutInSeconds;
 
index bb9eed6..bd23766 100755 (executable)
@@ -100,7 +100,6 @@ InternalSettings::Backup::Backup(Page* page, Settings* settings)
     , m_canStartMedia(page->canStartMedia())
     , m_originalMockScrollbarsEnabled(settings->mockScrollbarsEnabled())
     , m_langAttributeAwareFormControlUIEnabled(RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled())
-    , m_imagesEnabled(settings->areImagesEnabled())
 {
 }
 
@@ -136,7 +135,6 @@ void InternalSettings::Backup::restoreTo(Page* page, Settings* settings)
     page->setCanStartMedia(m_canStartMedia);
     settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled);
     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttributeAwareFormControlUIEnabled);
-    settings->setImagesEnabled(m_imagesEnabled);
 }
 
 InternalSettings* InternalSettings::from(Page* page)
@@ -661,10 +659,4 @@ void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled)
     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled);
 }
 
-void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec)
-{
-    InternalSettingsGuardForSettings();
-    settings()->setImagesEnabled(enabled);
-}
-
 }
index be8810d..2c073df 100755 (executable)
@@ -82,7 +82,6 @@ public:
         bool m_canStartMedia;
         bool m_originalMockScrollbarsEnabled;
         bool m_langAttributeAwareFormControlUIEnabled;
-        bool m_imagesEnabled;
     };
 
     typedef RefCountedSupplement<Page, InternalSettings> SuperType;
@@ -148,8 +147,6 @@ public:
     void setMemoryInfoEnabled(bool, ExceptionCode&);
     void setStorageBlockingPolicy(const String&, ExceptionCode&);
     void setLangAttributeAwareFormControlUIEnabled(bool);
-    void setImagesEnabled(bool enabled, ExceptionCode&);
-
 private:
     explicit InternalSettings(Page*);
     virtual void hostDestroyed() OVERRIDE { m_page = 0; }
index d8a8aaf..9673d2f 100755 (executable)
@@ -82,7 +82,6 @@ module window {
 #endif
         void setMemoryInfoEnabled(in boolean enabled) raises(DOMException);
         void setStorageBlockingPolicy(in DOMString policy) raises(DOMException);
-        void setImagesEnabled(in boolean enabled) raises(DOMException);
     };
 }
 
index 2a2d9d2..65f75e5 100644 (file)
@@ -1,3 +1,14 @@
+2012-09-24  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r129388.
+        http://trac.webkit.org/changeset/129388
+        https://bugs.webkit.org/show_bug.cgi?id=97477
+
+        Caused an assertion in a WebKit2 unit test (Requested by
+        abarth on #webkit).
+
+        * win/WebKit2.def:
+
 2012-09-24  Simon Pena  <spena@igalia.com>
 
         [GTK] Add Select All method to WebKit2 GTK+ API
index e0b7da9..f4578f7 100644 (file)
@@ -222,7 +222,6 @@ EXPORTS
         ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
         ?setFantasyFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z
         ?setFixedFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z
-        ?setImagesEnabled@Settings@WebCore@@QAEX_N@Z
         ?setMockScrollbarsEnabled@Settings@WebCore@@SAX_N@Z
         ?mockScrollbarsEnabled@Settings@WebCore@@SA_NXZ
         ?setUsesOverlayScrollbars@Settings@WebCore@@SAX_N@Z
index 49676cf..e2a4229 100644 (file)
@@ -162,7 +162,6 @@ _ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE;
 _ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb;
 _ZN7WebCore10ScrollView21setDelegatesScrollingEb;
 _ZN7WebCore4Node14removedLastRefEv;
-_ZN7WebCore8Settings16setImagesEnabledEb;
 _ZN7WebCore8Settings18setFixedFontFamilyERKN3WTF12AtomicStringE11UScriptCode;
 _ZN7WebCore8Settings18setSerifFontFamilyERKN3WTF12AtomicStringE11UScriptCode;
 _ZN7WebCore8Settings20setCursiveFontFamilyERKN3WTF12AtomicStringE11UScriptCode;