diff options
21 files changed, 228 insertions, 28 deletions
diff --git a/LayoutTests/fast/dom/HTMLLinkElement/link-and-subresource-test-expected.txt b/LayoutTests/fast/dom/HTMLLinkElement/link-and-subresource-test-expected.txt new file mode 100644 index 0000000..ac1b174 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/link-and-subresource-test-expected.txt @@ -0,0 +1,10 @@ +nick.jpg has MIME type image/jpeg +nick.jpg has MIME type image/jpeg +This test verifies that an image which is prefetched, and which is also contained as a subresource of the current document can be loaded correctly as a subresource. See bug 49236 in which this wasn't working. + +When this test succeeds, you'll see an image of Nick on a sailboat immediately below this text. When this test fails, you will see no images at all. + +NICK_ONLOAD called +NICK_ONLOAD called +SUCCESS. Two loads. + diff --git a/LayoutTests/fast/dom/HTMLLinkElement/link-and-subresource-test.html b/LayoutTests/fast/dom/HTMLLinkElement/link-and-subresource-test.html new file mode 100644 index 0000000..594eafd --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/link-and-subresource-test.html @@ -0,0 +1,39 @@ +<html> +<body> +<script> +function log(message) +{ + var item = document.createElement("li"); + item.appendChild(document.createTextNode(message)); + document.getElementById("console").appendChild(item); +} + +nick_load_count = 0 + +function nick_onload() +{ + log("NICK_ONLOAD called"); + ++nick_load_count; + if (nick_load_count == 2) { + log("SUCCESS. Two loads."); + layoutTestController.notifyDone(); + } +} + +if (window.layoutTestController) { + layoutTestController.waitUntilDone(); + layoutTestController.dumpAsText(); + layoutTestController.dumpResourceResponseMIMETypes(); +} +</script> +<p>This test verifies that an image which is prefetched, and which is also contained as a +subresource of the current document can be loaded correctly as a subresource. See +bug 49236 in which this wasn't working. +<p>When this test succeeds, you'll see an image of Nick on a sailboat immediately below +this text. When this test fails, you will see no images at all. +<link rel="prefetch" href="resources/nick.jpg" onload="nick_onload()" /> +<img src="resources/nick.jpg" onload="nick_onload()" /> +<hr> +<p><ol id="console"></ol></p> +</body></html> + diff --git a/LayoutTests/fast/dom/HTMLLinkElement/onload-completion-test-expected.txt b/LayoutTests/fast/dom/HTMLLinkElement/onload-completion-test-expected.txt new file mode 100644 index 0000000..bc6cf74 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/onload-completion-test-expected.txt @@ -0,0 +1,4 @@ +This test verifies that at the time a body onload function is called that the subresources of this page (in particular the image) are already loaded. The page verifies that the image has the expected dimensions at the time of the onload event, and prints its result based on that. This is a regression test for a bug introduced by the patch for bug 3652. + + +SUCCESS. diff --git a/LayoutTests/fast/dom/HTMLLinkElement/onload-completion-test.html b/LayoutTests/fast/dom/HTMLLinkElement/onload-completion-test.html new file mode 100644 index 0000000..6e24184 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/onload-completion-test.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<script text="text/javascript"> +function runtest() +{ +var nick=document.getElementById('nick'); +var row=document.getElementById('the_table').insertRow(-1); +var result=row.insertCell(0); +if (nick.naturalWidth == 320 && nick.naturalHeight == 240) + result.innerHTML = "SUCCESS."; +else + result.innerHTML = "FAILURE!"; +if (window.layoutTestController) + layoutTestController.dumpAsText(); +} +</script> +<body onload="runtest()"> +<p>This test verifies that at the time a body onload function is +called that the subresources of this page (in particular the image) +are already loaded. The page verifies that the image has the expected +dimensions at the time of the onload event, and prints its result +based on that. This is a regression test for a bug introduced by the +patch for bug 3652.</p> +<img id=nick src="resources/nick.jpg"> +<table id="the_table" border="1"> +<tr><td></td></tr> +</table> +</body> diff --git a/LayoutTests/fast/dom/HTMLLinkElement/pending-stylesheet-count.html b/LayoutTests/fast/dom/HTMLLinkElement/pending-stylesheet-count.html new file mode 100644 index 0000000..435021b --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/pending-stylesheet-count.html @@ -0,0 +1,32 @@ +<html> +<head> +<style type="text/css"> + #square { width: 100px; height: 100px; } + .red { background: red; } + .green { background: green; } +</style> +<script type="text/javascript"> + function test() + { + var linkStr = '<link rel="stylesheet" type="text/css" href="resources/doesnotneedtoexist">'; + var target = document.getElementById('t'); + target.innerHTML = linkStr; + target.innerHTML = ''; + var square = document.getElementById('square'); + square.className = 'green'; + } +</script> +</head> +<body onload="test()"> + <p> + This is a test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=9252">http://bugzilla.opendarwin.org/show_bug.cgi?id=9252</a> + REGRESSION: Very odd roll-over issues (content disappearing)</i>. + </p> + <p> + There should be a green square below. + </p> + <hr> + <div id="t"></div> + <div id="square" class="red"></div> +</body> +</html> diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-detached-expected.txt b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-detached-expected.txt new file mode 100644 index 0000000..44311f8 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-detached-expected.txt @@ -0,0 +1,3 @@ +This test passes if it doesn't crash. + + diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-detached.html b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-detached.html new file mode 100644 index 0000000..2d5d76c --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-detached.html @@ -0,0 +1,20 @@ +<body> +<script> +if (window.layoutTestController) + layoutTestController.dumpAsText(); +</script> +<html> +<p>This test passes if it doesn't crash.</p> +<div id="frag"></div> +<script> +// Fun with innerHTML. +document.getElementById('frag').innerHTML = '<link href="prefetch.link" rel="prefetch">'; + +// Fun with detached documents. +var doc = document.implementation.createDocument('application/html+xml'); +var lnk = doc.createElement('link'); +lnk.setAttribute('rel', 'prefetch'); +lnk.setAttribute('href', 'prefetch.link'); +doc.documentElement.appendChild(lnk); +</script> +</html> diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-expected.txt b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-expected.txt new file mode 100644 index 0000000..9ea65dc --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-expected.txt @@ -0,0 +1,4 @@ +prefetch.link has MIME type application/octet-stream +This test requires DumpRenderTree to see the log of what resources are loaded. + +SUCCESS! prefetch onload called. diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-onload-expected.txt b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-onload-expected.txt new file mode 100644 index 0000000..dac6e93 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-onload-expected.txt @@ -0,0 +1,6 @@ +This tests that onload events can be attached to link elements with rel=prefetch. Since prefetch links are just there as a performance optimization, the onload event is their only programatic side-effect. + +If it works you should see a message below saying the test has passed. + +TEST PASSED. + diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch-onload.html b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-onload.html new file mode 100644 index 0000000..37cfdbf --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch-onload.html @@ -0,0 +1,29 @@ +<html> +<head> +<script type="text/javascript"> +function log(message) +{ + var item = document.createElement("li"); + item.appendChild(document.createTextNode(message)); + document.getElementById("console").appendChild(item); +} +function done() +{ + log("TEST PASSED."); + if (window.layoutTestController) + layoutTestController.notifyDone(); + } +if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); +} +</script> +</head> +<body> +<p>This tests that onload events can be attached to link elements with rel=prefetch. Since prefetch links are just there as a performance optimization, the onload event is their only programatic side-effect.</p> +<p>If it works you should see a message below saying the test has passed.</p> +<link href="prefetch.link" rel="prefetch" onload="done()" > +<hr> +<p><ol id="console"></ol></p> +</body> +</html> diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch.html b/LayoutTests/fast/dom/HTMLLinkElement/prefetch.html new file mode 100644 index 0000000..5c223f9 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch.html @@ -0,0 +1,23 @@ +<body> +<script> +function log(message) { + var item = document.createElement("li"); + item.appendChild(document.createTextNode(message)); + document.getElementById("console").appendChild(item); +} +function prefetch_onload() { + log("SUCCESS! prefetch onload called."); + layoutTestController.notifyDone(); +} +if (window.layoutTestController) { + layoutTestController.waitUntilDone(); + layoutTestController.dumpAsText(); + layoutTestController.dumpResourceResponseMIMETypes(); +} +</script> +<html> +<p>This test requires DumpRenderTree to see the log of what resources are loaded. +<link href="prefetch.link" rel="prefetch" onload="prefetch_onload()"> +<p><ol id="console"></ol> +</html> + diff --git a/LayoutTests/fast/dom/HTMLLinkElement/prefetch.link b/LayoutTests/fast/dom/HTMLLinkElement/prefetch.link new file mode 100644 index 0000000..9051267 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/prefetch.link @@ -0,0 +1 @@ +This is the link that is fetched by the prefetch-onload test diff --git a/LayoutTests/fast/dom/HTMLLinkElement/resources/nick.jpg b/LayoutTests/fast/dom/HTMLLinkElement/resources/nick.jpg Binary files differnew file mode 100644 index 0000000..3d9fb57 --- /dev/null +++ b/LayoutTests/fast/dom/HTMLLinkElement/resources/nick.jpg diff --git a/LayoutTests/platform/android/layout_test_directories.txt b/LayoutTests/platform/android/layout_test_directories.txt index 703c4da..a1288ac 100755 --- a/LayoutTests/platform/android/layout_test_directories.txt +++ b/LayoutTests/platform/android/layout_test_directories.txt @@ -18,6 +18,7 @@ fast/dom/HTMLFormElement fast/dom/HTMLHtmlElement fast/dom/HTMLKeygenElement fast/dom/HTMLLabelElement +fast/dom/HTMLLinklement fast/dom/HTMLMetaElement fast/dom/HTMLTableRowElement fast/dom/HTMLTableSectionElement diff --git a/LayoutTests/platform/android/test_expectations.txt b/LayoutTests/platform/android/test_expectations.txt index d0a039c..c42969c 100644 --- a/LayoutTests/platform/android/test_expectations.txt +++ b/LayoutTests/platform/android/test_expectations.txt @@ -40,6 +40,8 @@ fast/regex/slow.html CRASH // Causes DumpRenderTree to hang with V8 // This first block of tests are for features for which Android // should pass all tests. They are skipped only temporarily. // TODO: Fix these failing tests and remove them from this list. +fast/dom/HTMLLinkElement/link-and-subresource-test.html FAIL // Requires layoutTestController.dumpResourceResponseMIMETypes(), see http://b/issue?id=4470249 +fast/dom/HTMLLinkElement/prefetch.html FAIL // Requires layoutTestController.dumpResourceResponseMIMETypes(), see http://b/issue?id=4470249 fast/encoding/char-decoding.html FAIL // fails in Java HTTP stack, see http://b/issue?id=3047156 fast/encoding/hanarei-blog32-fc2-com.html FAIL // fails in Java HTTP stack, see http://b/issue?id=3046986 fast/encoding/mailto-always-utf-8.html FAIL // Requires waitForPolicyDelegate(), see http://b/issue?id=3043468 @@ -92,6 +94,7 @@ dom/xhtml/level3/core/nodegetbaseuri17.xhtml FAIL dom/xhtml/level3/core/nodegetbaseuri18.xhtml FAIL dom/xhtml/level3/core/nodelookupnamespaceuri01.xhtml FAIL dom/xhtml/level3/core/nodelookupprefix19.xhtml FAIL +fast/dom/HTMLLinkElement/pending-stylesheet-count.html FAIL // Expected failures for pixel tests fast/encoding/denormalised-voiced-japanese-chars.html FAIL diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp index 115a044..34c02e9 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -1315,6 +1315,7 @@ void LayerAndroid::dumpLayers(FILE* file, int indentLevel) const writeMatrix(file, indentLevel + 1, "drawMatrix", drawTransform()); writeMatrix(file, indentLevel + 1, "transformMatrix", m_transform); + writeRect(file, indentLevel + 1, "clippingRect", SkRect(m_clippingRect)); if (m_isFixed) { writeLength(file, indentLevel + 1, "fixedLeft", m_fixedLeft); diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp index 7a69853..f2b2dc8 100644 --- a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp +++ b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp @@ -325,9 +325,6 @@ void ShaderProgram::clip(const FloatRect& clip) if (clip == m_clipRect) return; - if (clip.width() == 0 && clip.height() == 0) - return; - // we should only call glScissor in this function, so that we can easily // track the current clipping rect. diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index 2fd441d..d25240b 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -89,10 +89,6 @@ void RenderView::computeLogicalWidth() setLogicalWidth(viewLogicalWidth()); #ifdef ANDROID_LAYOUT setVisibleWidth(m_frameView->textWrapWidth()); - const Settings * settings = document()->settings(); - ASSERT(settings); - if (settings->useWideViewport() && settings->viewportWidth() == -1 && width() < minPreferredLogicalWidth()) - setWidth(m_minPreferredLogicalWidth); #endif } diff --git a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 66b7e34..60f6263 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -361,8 +361,7 @@ void ChromeClientAndroid::exceededDatabaseQuota(Frame* frame, const String& name SecurityOrigin* origin = frame->document()->securityOrigin(); DatabaseTracker& tracker = WebCore::DatabaseTracker::tracker(); - // We want to wait on a new quota from the UI thread. Reset the m_newQuota variable to represent we haven't received a new quota. - m_newQuota = -1; + m_isNewQuotaSet = false; // This origin is being tracked and has exceeded it's quota. Call into // the Java side of things to inform the user. @@ -380,15 +379,19 @@ void ChromeClientAndroid::exceededDatabaseQuota(Frame* frame, const String& name // We've sent notification to the browser so now wait for it to come back. m_quotaThreadLock.lock(); - while (m_newQuota == -1) { + while (!m_isNewQuotaSet) { m_quotaThreadCondition.wait(m_quotaThreadLock); } m_quotaThreadLock.unlock(); - // If new quota is unavailable, we may be able to resolve the situation by shrinking the quota of an origin that asked for a lot but is only using a little. - // If we find such a site, shrink it's quota and ask Java to try again. + if (m_newQuota < currentQuota) + m_newQuota = currentQuota; - if ((unsigned long long) m_newQuota == currentQuota && !m_triedToReclaimDBQuota) { + // If new quota is unavailable, we may be able to resolve the situation by + // shrinking the quota of an origin that asked for a lot but is only using a + // little. If we find such a site, shrink it's quota and ask Java to try + // again. + if (m_newQuota == currentQuota && !m_triedToReclaimDBQuota) { m_triedToReclaimDBQuota = true; // we should only try this once per quota overflow. unsigned long long reclaimedQuotaBytes = tryToReclaimDatabaseQuota(origin); @@ -435,10 +438,7 @@ static unsigned long long tryToReclaimDatabaseQuota(SecurityOrigin* originNeedin #if ENABLE(OFFLINE_WEB_APPLICATIONS) void ChromeClientAndroid::reachedMaxAppCacheSize(int64_t spaceNeeded) { - // Set m_newQuota before calling into the Java side. If we do this after, - // we could overwrite the result passed from the Java side and deadlock in the - // wait call below. - m_newQuota = -1; + m_isNewQuotaSet = false; Page* page = m_webFrame->page(); Frame* mainFrame = page->mainFrame(); FrameView* view = mainFrame->view(); @@ -446,7 +446,7 @@ void ChromeClientAndroid::reachedMaxAppCacheSize(int64_t spaceNeeded) // We've sent notification to the browser so now wait for it to come back. m_quotaThreadLock.lock(); - while (m_newQuota == -1) { + while (!m_isNewQuotaSet) { m_quotaThreadCondition.wait(m_quotaThreadLock); } m_quotaThreadLock.unlock(); @@ -516,9 +516,10 @@ void ChromeClientAndroid::setCursor(const Cursor&) notImplemented(); } -void ChromeClientAndroid::wakeUpMainThreadWithNewQuota(long newQuota) { +void ChromeClientAndroid::wakeUpMainThreadWithNewQuota(long long newQuota) { MutexLocker locker(m_quotaThreadLock); - m_newQuota = newQuota; + m_newQuota = newQuota < 0 ? 0 : newQuota; + m_isNewQuotaSet = true; m_quotaThreadCondition.signal(); } diff --git a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 93737cf..6d8f6f3 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -163,7 +163,7 @@ namespace android { // Android-specific void setWebFrame(android::WebFrame* webframe); android::WebFrame* webFrame() { return m_webFrame; } - void wakeUpMainThreadWithNewQuota(long newQuota); + void wakeUpMainThreadWithNewQuota(long long newQuota); #if USE(ACCELERATED_COMPOSITING) virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer* g); @@ -206,7 +206,8 @@ namespace android { #endif WTF::ThreadCondition m_quotaThreadCondition; WTF::Mutex m_quotaThreadLock; - long m_newQuota; + unsigned long long m_newQuota; + bool m_isNewQuotaSet; bool m_triedToReclaimDBQuota; }; diff --git a/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php b/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php index 28a1a8a..87e3e84 100644 --- a/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php +++ b/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php @@ -74,8 +74,6 @@ function main() { global $rootDir; - $path = getAbsolutePath($_GET['path']); - if (!isset($_GET['separator'])) { $separator = "\n"; } else { @@ -91,14 +89,18 @@ } # Very primitive check if path tries to go above DOCUMENT_ROOT or is absolute - if (strpos($_GET['path'], "..") !== False || - substr($_GET['path'], 0, 1) == DIRECTORY_SEPARATOR) { + $path = $_GET['path']; + if (strpos($path, "..") !== False || + substr($path, 0, 1) == DIRECTORY_SEPARATOR) { return; } # If we don't want realpath to append any prefixes we need to pass it an absolute path - $path = realpath(getAbsolutePath($_GET['path'])); - $relPath = substr($path, strlen($rootDir) + 1); + $relPath = substr(realpath(getAbsolutePath($path)), strlen($rootDir) + 1); + + # If the path is not found, return nothing. + if ($path !== "" && $relPath == "") + return; # If there is an error of some sort it will be output as a part of the answer! foreach (getAllFilesUnderAsArray($relPath, $recurse, $mode) as $i => $value) { |