[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

simonjam at chromium.org simonjam at chromium.org
Fri Jan 21 14:59:54 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 92bc9b02895ff36a69d1c86431fc731e2dcee3d5
Author: simonjam at chromium.org <simonjam at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 6 02:41:13 2011 +0000

    2011-01-05  James Simonsen  <simonjam at chromium.org>
    
            Reviewed by Adam Barth.
    
            [Web Timing] Zero out some values on cross-origin redirects
            https://bugs.webkit.org/show_bug.cgi?id=49294
    
            * fast/dom/script-tests/webtiming.js:
            (checkTimingBeforeLoad): Remove unload. Its behavior depends on prior navigation and is tested separately.
            (checkTimingWhileDeferred): Ditto.
            (checkWebTimingOnDOMContentLoaded): Ditto.
            (checkWebTimingWhileAsync): Ditto.
            (checkWebTimingOnLoad): Ditto.
            (checkWebTimingAfterLoad): Ditto.
            * fast/dom/webtiming-expected.txt:
            * http/tests/misc/resources/webtiming-cross-origin-and-back-redirect1.php: Added.
            * http/tests/misc/resources/webtiming-cross-origin-and-back-redirect2.php: Added.
            * http/tests/misc/resources/webtiming-cross-origin-and-back1.html: Added.
            * http/tests/misc/resources/webtiming-cross-origin-and-back2.html: Added.
            * http/tests/misc/resources/webtiming-cross-origin-redirect.html: Added.
            * http/tests/misc/resources/webtiming-cross-origin-redirect.php: Added.
            * http/tests/misc/resources/webtiming-no-origin.html: Added.
            * http/tests/misc/webtiming-origins-expected.txt: Added.
            * http/tests/misc/webtiming-origins.html: Added.
            * platform/gtk/Skipped: Skip new web timing test.
            * platform/mac/Skipped: Ditto.
            * platform/win/Skipped: Ditto.
    2011-01-05  James Simonsen  <simonjam at chromium.org>
    
            Reviewed by Adam Barth.
    
            [Web Timing] Zero out some values on cross-origin redirects
            https://bugs.webkit.org/show_bug.cgi?id=49294
    
            Tests: http/tests/misc/webtiming-cross-origin-redirect.php
                   http/tests/misc/webtiming-origins.html
    
            * loader/DocumentLoadTiming.h:
            (WebCore::DocumentLoadTiming::DocumentLoadTiming): Add flags for cross-origin redirects and same-origin navigation.
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::~FrameLoader):
            (WebCore::FrameLoader::stopLoading): Don't overwrite previous unload times.
            (WebCore::FrameLoader::completed):
            (WebCore::FrameLoader::loadWithDocumentLoader): Remember previous URL to see if navigation is same-origin.
            (WebCore::FrameLoader::commitProvisionalLoad): Set flag if navigation is same-origin.
            * loader/FrameLoader.h:
            * loader/MainResourceLoader.cpp:
            (WebCore::MainResourceLoader::willSendRequest): Set flag on cross-origin redirects.
            * page/PerformanceNavigation.cpp:
            (WebCore::PerformanceNavigation::redirectCount): Clear if cross-origin redirect flag is set.
            * page/PerformanceTiming.cpp:
            (WebCore::PerformanceTiming::redirectStart): Ditto.
            (WebCore::PerformanceTiming::redirectEnd): Ditto.
            (WebCore::PerformanceTiming::unloadEventStart): Clear if cross-origin navigation is set.
            (WebCore::PerformanceTiming::unloadEventEnd): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75129 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 54686e3..35abd13 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,31 @@
+2011-01-05  James Simonsen  <simonjam at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [Web Timing] Zero out some values on cross-origin redirects
+        https://bugs.webkit.org/show_bug.cgi?id=49294
+
+        * fast/dom/script-tests/webtiming.js:
+        (checkTimingBeforeLoad): Remove unload. Its behavior depends on prior navigation and is tested separately.
+        (checkTimingWhileDeferred): Ditto.
+        (checkWebTimingOnDOMContentLoaded): Ditto.
+        (checkWebTimingWhileAsync): Ditto.
+        (checkWebTimingOnLoad): Ditto.
+        (checkWebTimingAfterLoad): Ditto.
+        * fast/dom/webtiming-expected.txt:
+        * http/tests/misc/resources/webtiming-cross-origin-and-back-redirect1.php: Added.
+        * http/tests/misc/resources/webtiming-cross-origin-and-back-redirect2.php: Added.
+        * http/tests/misc/resources/webtiming-cross-origin-and-back1.html: Added.
+        * http/tests/misc/resources/webtiming-cross-origin-and-back2.html: Added.
+        * http/tests/misc/resources/webtiming-cross-origin-redirect.html: Added.
+        * http/tests/misc/resources/webtiming-cross-origin-redirect.php: Added.
+        * http/tests/misc/resources/webtiming-no-origin.html: Added.
+        * http/tests/misc/webtiming-origins-expected.txt: Added.
+        * http/tests/misc/webtiming-origins.html: Added.
+        * platform/gtk/Skipped: Skip new web timing test.
+        * platform/mac/Skipped: Ditto.
+        * platform/win/Skipped: Ditto.
+
 2011-01-05  Helder Correia  <helder at sencha.com>
 
         Reviewed by Ariya Hidayat.
diff --git a/LayoutTests/fast/dom/script-tests/webtiming.js b/LayoutTests/fast/dom/script-tests/webtiming.js
index fa6eb18..3016021 100644
--- a/LayoutTests/fast/dom/script-tests/webtiming.js
+++ b/LayoutTests/fast/dom/script-tests/webtiming.js
@@ -19,9 +19,6 @@ function checkTimingBeforeLoad()
 {
     shouldBeGreaterThanOrEqual("timing.navigationStart", "oneHourAgoUTC");
 
-    shouldBeGreaterThanOrEqual("timing.unloadEventStart", "timing.navigationStart");
-    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.unloadEventStart");
-
     shouldBe("timing.redirectStart", "0");
     shouldBe("timing.redirectEnd", "0");
     shouldBe("navigation.redirectCount", "0");
@@ -54,9 +51,6 @@ function checkTimingWhileDeferred()
 {
     shouldBeGreaterThanOrEqual("timing.navigationStart", "oneHourAgoUTC");
 
-    shouldBeGreaterThanOrEqual("timing.unloadEventStart", "timing.navigationStart");
-    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.unloadEventStart");
-
     shouldBe("timing.redirectStart", "0");
     shouldBe("timing.redirectEnd", "0");
     shouldBe("navigation.redirectCount", "0");
@@ -90,9 +84,6 @@ function checkTimingWhileDeferred()
 function checkWebTimingOnDOMContentLoaded() {
     shouldBeGreaterThanOrEqual("timing.navigationStart", "oneHourAgoUTC");
 
-    shouldBeGreaterThanOrEqual("timing.unloadEventStart", "timing.navigationStart");
-    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.unloadEventStart");
-
     shouldBe("timing.redirectStart", "0");
     shouldBe("timing.redirectEnd", "0");
     shouldBe("navigation.redirectCount", "0");
@@ -132,9 +123,6 @@ function checkWebTimingWhileAsync()
 {
     shouldBeGreaterThanOrEqual("timing.navigationStart", "oneHourAgoUTC");
 
-    shouldBeGreaterThanOrEqual("timing.unloadEventStart", "timing.navigationStart");
-    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.unloadEventStart");
-
     shouldBe("timing.redirectStart", "0");
     shouldBe("timing.redirectEnd", "0");
     shouldBe("navigation.redirectCount", "0");
@@ -169,9 +157,6 @@ function checkWebTimingOnLoad()
 {
     shouldBeGreaterThanOrEqual("timing.navigationStart", "oneHourAgoUTC");
 
-    shouldBeGreaterThanOrEqual("timing.unloadEventStart", "timing.navigationStart");
-    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.unloadEventStart");
-
     shouldBe("timing.redirectStart", "0");
     shouldBe("timing.redirectEnd", "0");
     shouldBe("navigation.redirectCount", "0");
@@ -207,9 +192,6 @@ function checkWebTimingAfterLoad()
 {
     shouldBeGreaterThanOrEqual("timing.navigationStart", "oneHourAgoUTC");
 
-    shouldBeGreaterThanOrEqual("timing.unloadEventStart", "timing.navigationStart");
-    shouldBeGreaterThanOrEqual("timing.unloadEventEnd", "timing.unloadEventStart");
-
     shouldBe("timing.redirectStart", "0");
     shouldBe("timing.redirectEnd", "0");
     shouldBe("navigation.redirectCount", "0");
diff --git a/LayoutTests/fast/dom/webtiming-expected.txt b/LayoutTests/fast/dom/webtiming-expected.txt
index 9d9f95e..333e9f7 100644
--- a/LayoutTests/fast/dom/webtiming-expected.txt
+++ b/LayoutTests/fast/dom/webtiming-expected.txt
@@ -4,8 +4,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS timing.navigationStart is >= oneHourAgoUTC
-PASS timing.unloadEventStart is >= timing.navigationStart
-PASS timing.unloadEventEnd is >= timing.unloadEventStart
 PASS timing.redirectStart is 0
 PASS timing.redirectEnd is 0
 PASS navigation.redirectCount is 0
@@ -25,8 +23,6 @@ PASS timing.domComplete is 0
 PASS timing.loadEventStart is 0
 PASS timing.loadEventEnd is 0
 PASS timing.navigationStart is >= oneHourAgoUTC
-PASS timing.unloadEventStart is >= timing.navigationStart
-PASS timing.unloadEventEnd is >= timing.unloadEventStart
 PASS timing.redirectStart is 0
 PASS timing.redirectEnd is 0
 PASS navigation.redirectCount is 0
@@ -46,8 +42,6 @@ PASS timing.domComplete is 0
 PASS timing.loadEventStart is 0
 PASS timing.loadEventEnd is 0
 PASS timing.navigationStart is >= oneHourAgoUTC
-PASS timing.unloadEventStart is >= timing.navigationStart
-PASS timing.unloadEventEnd is >= timing.unloadEventStart
 PASS timing.redirectStart is 0
 PASS timing.redirectEnd is 0
 PASS navigation.redirectCount is 0
@@ -67,8 +61,6 @@ PASS timing.domComplete is 0
 PASS timing.loadEventStart is 0
 PASS timing.loadEventEnd is 0
 PASS timing.navigationStart is >= oneHourAgoUTC
-PASS timing.unloadEventStart is >= timing.navigationStart
-PASS timing.unloadEventEnd is >= timing.unloadEventStart
 PASS timing.redirectStart is 0
 PASS timing.redirectEnd is 0
 PASS navigation.redirectCount is 0
@@ -88,8 +80,6 @@ PASS timing.domComplete is 0
 PASS timing.loadEventStart is 0
 PASS timing.loadEventEnd is 0
 PASS timing.navigationStart is >= oneHourAgoUTC
-PASS timing.unloadEventStart is >= timing.navigationStart
-PASS timing.unloadEventEnd is >= timing.unloadEventStart
 PASS timing.redirectStart is 0
 PASS timing.redirectEnd is 0
 PASS navigation.redirectCount is 0
@@ -110,8 +100,6 @@ PASS timing.domComplete is >= timing.domContentLoadedEventEnd
 PASS timing.loadEventStart is >= timing.responseEnd
 PASS timing.loadEventEnd is 0
 PASS timing.navigationStart is >= oneHourAgoUTC
-PASS timing.unloadEventStart is >= timing.navigationStart
-PASS timing.unloadEventEnd is >= timing.unloadEventStart
 PASS timing.redirectStart is 0
 PASS timing.redirectEnd is 0
 PASS navigation.redirectCount is 0
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back-redirect1.php b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back-redirect1.php
new file mode 100644
index 0000000..268849a
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back-redirect1.php
@@ -0,0 +1,5 @@
+<?php
+  // Tests run from 127.0.0.1, so localhost will appear to be a different origin.
+  header('Location: http://localhost:8000/misc/resources/webtiming-cross-origin-and-back-redirect2.php');
+  header('HTTP/1.0 302 Found');
+?>
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back-redirect2.php b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back-redirect2.php
new file mode 100644
index 0000000..59c6b7a
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back-redirect2.php
@@ -0,0 +1,5 @@
+<?php
+  // 127.0.0.1 is where the test originally started. We redirected to "localhost" before this.
+  header('Location: http://127.0.0.1:8000/misc/resources/webtiming-cross-origin-and-back2.html');
+  header('HTTP/1.0 302 Found');
+?>
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back1.html b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back1.html
new file mode 100644
index 0000000..775886c
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back1.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<script src="../../js-test-resources/js-test-pre.js"></script>
+<script>
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+function doRedirect() {
+    window.location = "http://127.0.0.1:8000/misc/resources/webtiming-cross-origin-and-back-redirect1.php";
+}
+addEventListener("load", setTimeout(doRedirect, 0));
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back2.html b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back2.html
new file mode 100644
index 0000000..d66a05f
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-and-back2.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js-test-resources/js-test-style.css">
+<script src="../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("If the destination and previous page have the same origin, then Web Timing should report unload timing.");
+
+var performance = window.webkitPerformance || {};
+var navigation = performance.navigation || {};
+var timing = performance.timing || {};
+
+function performTest() {
+    // FIXME: Need a way to synchronize the test so that loadEventEnd is non-zero.
+    var shouldBeZeroList = ["loadEventEnd", "redirectStart", "redirectEnd", "sslHandshakeStart"];
+
+    var timingProperties = new Array;
+    for (var property in timing) {
+        timingProperties.push(property);
+    }
+    timingProperties.sort();
+    for (var i = 0; i < timingProperties.length; ++i) {
+        if (shouldBeZeroList.indexOf(timingProperties[i]) >= 0)
+            shouldBe("timing." + timingProperties[i], "0");
+        else
+            shouldBeNonZero("timing." + timingProperties[i]);
+    }
+    shouldBe("navigation.redirectCount", "0");
+
+    finishJSTest();
+}
+
+window.addEventListener("load", performTest);
+
+var jsTestIsAsync = true;
+var successfullyParsed = true;
+</script>
+<script src="../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-redirect.html b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-redirect.html
new file mode 100644
index 0000000..7dd3dc1
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-redirect.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js-test-resources/js-test-style.css">
+<script src="../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Web Timing should zero out redirect stats after a cross-origin redirect.");
+
+var performance = window.webkitPerformance || {};
+var navigation = performance.navigation || {};
+var timing = performance.timing || {};
+
+function performTest() {
+    // FIXME: Need a way to synchronize the test so that loadEventEnd is non-zero.
+    var shouldBeZeroList = ["loadEventEnd", "redirectStart", "redirectEnd", "sslHandshakeStart", "unloadEventStart", "unloadEventEnd"];
+
+    var timingProperties = new Array;
+    for (var property in timing) {
+        timingProperties.push(property);
+    }
+    timingProperties.sort();
+    for (var i = 0; i < timingProperties.length; ++i) {
+        if (shouldBeZeroList.indexOf(timingProperties[i]) >= 0)
+            shouldBe("timing." + timingProperties[i], "0");
+        else
+            shouldBeNonZero("timing." + timingProperties[i]);
+    }
+    shouldBe("navigation.redirectCount", "0");
+
+    finishJSTest();
+}
+
+window.addEventListener("load", performTest);
+
+var jsTestIsAsync = true;
+var successfullyParsed = true;
+</script>
+<script src="../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-redirect.php b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-redirect.php
new file mode 100644
index 0000000..5f98197
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-cross-origin-redirect.php
@@ -0,0 +1,5 @@
+<?php
+  // Tests run from 127.0.0.1, so localhost will appear to be a different origin.
+  header('Location: http://localhost:8080/misc/resources/webtiming-cross-origin-redirect.html');
+  header('HTTP/1.0 302 Found');
+?>
diff --git a/LayoutTests/http/tests/misc/resources/webtiming-no-origin.html b/LayoutTests/http/tests/misc/resources/webtiming-no-origin.html
new file mode 100644
index 0000000..ed361eb
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/webtiming-no-origin.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js-test-resources/js-test-style.css">
+<script src="../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Web Timing should report zeros for redirects and unload since there was no preceding page.");
+
+var performance = window.webkitPerformance || {};
+var navigation = performance.navigation || {};
+var timing = performance.timing || {};
+
+function performTest() {
+    // FIXME: Need a way to synchronize the test so that loadEventEnd is non-zero.
+    var shouldBeZeroList = ["loadEventEnd", "redirectStart", "redirectEnd", "sslHandshakeStart", "unloadEventStart", "unloadEventEnd"];
+
+    var timingProperties = new Array;
+    for (var property in timing) {
+        timingProperties.push(property);
+    }
+    timingProperties.sort();
+    for (var i = 0; i < timingProperties.length; ++i) {
+        if (shouldBeZeroList.indexOf(timingProperties[i]) >= 0)
+            shouldBe("timing." + timingProperties[i], "0");
+        else
+            shouldBeNonZero("timing." + timingProperties[i]);
+    }
+    shouldBe("navigation.redirectCount", "0");
+
+    finishJSTest();
+}
+
+window.addEventListener("load", performTest);
+
+var jsTestIsAsync = true;
+var successfullyParsed = true;
+</script>
+<script src="../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/webtiming-origins-expected.txt b/LayoutTests/http/tests/misc/webtiming-origins-expected.txt
new file mode 100644
index 0000000..d2db777
--- /dev/null
+++ b/LayoutTests/http/tests/misc/webtiming-origins-expected.txt
@@ -0,0 +1,106 @@
+  
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+Web Timing should report zeros for redirects and unload since there was no preceding page.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS timing.connectEnd is non-zero.
+PASS timing.connectStart is non-zero.
+PASS timing.domComplete is non-zero.
+PASS timing.domContentLoadedEventEnd is non-zero.
+PASS timing.domContentLoadedEventStart is non-zero.
+PASS timing.domInteractive is non-zero.
+PASS timing.domLoading is non-zero.
+PASS timing.domainLookupEnd is non-zero.
+PASS timing.domainLookupStart is non-zero.
+PASS timing.fetchStart is non-zero.
+PASS timing.loadEventEnd is 0
+PASS timing.loadEventStart is non-zero.
+PASS timing.navigationStart is non-zero.
+PASS timing.redirectEnd is 0
+PASS timing.redirectStart is 0
+PASS timing.requestStart is non-zero.
+PASS timing.responseEnd is non-zero.
+PASS timing.responseStart is non-zero.
+PASS timing.sslHandshakeStart is 0
+PASS timing.unloadEventEnd is 0
+PASS timing.unloadEventStart is 0
+PASS navigation.redirectCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+Web Timing should zero out redirect stats after a cross-origin redirect.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS timing.connectEnd is non-zero.
+PASS timing.connectStart is non-zero.
+PASS timing.domComplete is non-zero.
+PASS timing.domContentLoadedEventEnd is non-zero.
+PASS timing.domContentLoadedEventStart is non-zero.
+PASS timing.domInteractive is non-zero.
+PASS timing.domLoading is non-zero.
+PASS timing.domainLookupEnd is non-zero.
+PASS timing.domainLookupStart is non-zero.
+PASS timing.fetchStart is non-zero.
+PASS timing.loadEventEnd is 0
+PASS timing.loadEventStart is non-zero.
+PASS timing.navigationStart is non-zero.
+PASS timing.redirectEnd is 0
+PASS timing.redirectStart is 0
+PASS timing.requestStart is non-zero.
+PASS timing.responseEnd is non-zero.
+PASS timing.responseStart is non-zero.
+PASS timing.sslHandshakeStart is 0
+PASS timing.unloadEventEnd is 0
+PASS timing.unloadEventStart is 0
+PASS navigation.redirectCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame2-->-->'
+--------
+If the destination and previous page have the same origin, then Web Timing should report unload timing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS timing.connectEnd is non-zero.
+PASS timing.connectStart is non-zero.
+PASS timing.domComplete is non-zero.
+PASS timing.domContentLoadedEventEnd is non-zero.
+PASS timing.domContentLoadedEventStart is non-zero.
+PASS timing.domInteractive is non-zero.
+PASS timing.domLoading is non-zero.
+PASS timing.domainLookupEnd is non-zero.
+PASS timing.domainLookupStart is non-zero.
+PASS timing.fetchStart is non-zero.
+PASS timing.loadEventEnd is 0
+PASS timing.loadEventStart is non-zero.
+PASS timing.navigationStart is non-zero.
+PASS timing.redirectEnd is 0
+PASS timing.redirectStart is 0
+PASS timing.requestStart is non-zero.
+PASS timing.responseEnd is non-zero.
+PASS timing.responseStart is non-zero.
+PASS timing.sslHandshakeStart is 0
+PASS timing.unloadEventEnd is non-zero.
+PASS timing.unloadEventStart is non-zero.
+PASS navigation.redirectCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/misc/webtiming-origins.html b/LayoutTests/http/tests/misc/webtiming-origins.html
new file mode 100644
index 0000000..ec9bd31
--- /dev/null
+++ b/LayoutTests/http/tests/misc/webtiming-origins.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpChildFramesAsText();
+}
+</script>
+</head>
+<body>
+<iframe width="640" height="480" src="resources/webtiming-no-origin.html"></iframe>
+<iframe width="640" height="480" src="resources/webtiming-cross-origin-redirect.php"></iframe>
+<iframe width="640" height="480" src="resources/webtiming-cross-origin-and-back1.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 084b60a..be54c16 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5312,6 +5312,7 @@ fast/dom/navigation-type-reload.html
 fast/dom/webtiming.html
 fast/dom/webtiming-navigate-within-document.html
 fast/dom/webtiming-document-open.html
+http/tests/misc/webtiming-origins.html
 http/tests/misc/webtiming-one-redirect.php
 http/tests/misc/webtiming-slow-load.php
 http/tests/misc/webtiming-ssl.php
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index 73dcbc7..b21beba 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -215,6 +215,7 @@ fast/dom/navigation-type-reload.html
 fast/dom/webtiming.html
 fast/dom/webtiming-document-open.html
 fast/dom/webtiming-navigate-within-document.html
+http/tests/misc/webtiming-origins.html
 http/tests/misc/webtiming-one-redirect.php
 http/tests/misc/webtiming-slow-load.php
 http/tests/misc/webtiming-ssl.php
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index c4f685d..19ef79c 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -1042,6 +1042,7 @@ fast/dom/navigation-type-reload.html
 fast/dom/webtiming.html
 fast/dom/webtiming-document-open.html
 fast/dom/webtiming-navigate-within-document.html
+http/tests/misc/webtiming-origins.html
 http/tests/misc/webtiming-one-redirect.php
 http/tests/misc/webtiming-slow-load.php
 http/tests/misc/webtiming-ssl.php
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9d5b022..96f2700 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2011-01-05  James Simonsen  <simonjam at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [Web Timing] Zero out some values on cross-origin redirects
+        https://bugs.webkit.org/show_bug.cgi?id=49294
+
+        Tests: http/tests/misc/webtiming-cross-origin-redirect.php
+               http/tests/misc/webtiming-origins.html
+
+        * loader/DocumentLoadTiming.h:
+        (WebCore::DocumentLoadTiming::DocumentLoadTiming): Add flags for cross-origin redirects and same-origin navigation.
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::~FrameLoader):
+        (WebCore::FrameLoader::stopLoading): Don't overwrite previous unload times.
+        (WebCore::FrameLoader::completed):
+        (WebCore::FrameLoader::loadWithDocumentLoader): Remember previous URL to see if navigation is same-origin.
+        (WebCore::FrameLoader::commitProvisionalLoad): Set flag if navigation is same-origin.
+        * loader/FrameLoader.h:
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::willSendRequest): Set flag on cross-origin redirects.
+        * page/PerformanceNavigation.cpp:
+        (WebCore::PerformanceNavigation::redirectCount): Clear if cross-origin redirect flag is set.
+        * page/PerformanceTiming.cpp:
+        (WebCore::PerformanceTiming::redirectStart): Ditto.
+        (WebCore::PerformanceTiming::redirectEnd): Ditto.
+        (WebCore::PerformanceTiming::unloadEventStart): Clear if cross-origin navigation is set.
+        (WebCore::PerformanceTiming::unloadEventEnd): Ditto.
+
 2011-01-05  Helder Correia  <helder at sencha.com>
 
         Reviewed by Ariya Hidayat.
diff --git a/WebCore/loader/DocumentLoadTiming.h b/WebCore/loader/DocumentLoadTiming.h
index 368004b..d4aa7d0 100644
--- a/WebCore/loader/DocumentLoadTiming.h
+++ b/WebCore/loader/DocumentLoadTiming.h
@@ -40,6 +40,8 @@ struct DocumentLoadTiming {
         , responseEnd(0.0)
         , loadEventStart(0.0)
         , loadEventEnd(0.0)
+        , hasCrossOriginRedirect(false)
+        , hasSameOriginAsPreviousDocument(false)
     {
     }
 
@@ -53,6 +55,8 @@ struct DocumentLoadTiming {
     double responseEnd;
     double loadEventStart;
     double loadEventEnd;
+    bool hasCrossOriginRedirect;
+    bool hasSameOriginAsPreviousDocument;
 };
 
 }
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index eb09e57..8a8061e 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -212,7 +212,7 @@ FrameLoader::~FrameLoader()
     HashSet<Frame*>::iterator end = m_openedFrames.end();
     for (HashSet<Frame*>::iterator it = m_openedFrames.begin(); it != end; ++it)
         (*it)->loader()->m_opener = 0;
-        
+
     m_client->frameLoaderDestroyed();
 
     if (m_networkingContext)
@@ -383,11 +383,10 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic
                         // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed
                         // while dispatching the event, so protect it to prevent writing the end
                         // time into freed memory.
-                        if (RefPtr<DocumentLoader> documentLoader = m_provisionalDocumentLoader) {
+                        RefPtr<DocumentLoader> documentLoader = m_provisionalDocumentLoader;
+                        if (documentLoader && !documentLoader->timing()->unloadEventStart && !documentLoader->timing()->unloadEventEnd) {
                             DocumentLoadTiming* timing = documentLoader->timing();
                             ASSERT(timing->navigationStart);
-                            ASSERT(!timing->unloadEventStart);
-                            ASSERT(!timing->unloadEventEnd);
                             m_frame->domWindow()->dispatchTimedEvent(unloadEvent, m_frame->domWindow()->document(), &timing->unloadEventStart, &timing->unloadEventEnd);
                             ASSERT(timing->unloadEventStart >= timing->navigationStart);
                         } else
@@ -1186,7 +1185,7 @@ void FrameLoader::completed()
 
     for (Frame* descendant = m_frame->tree()->traverseNext(m_frame); descendant; descendant = descendant->tree()->traverseNext(m_frame))
         descendant->navigationScheduler()->startTimer();
-    
+
     if (Frame* parent = m_frame->tree()->parent())
         parent->loader()->checkCompleted();
 
@@ -1438,6 +1437,9 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t
     if (m_pageDismissalEventBeingDispatched)
         return;
 
+    if (m_frame->document())
+        m_previousUrl = m_frame->document()->url();
+
     policyChecker()->setLoadType(type);
     RefPtr<FormState> formState = prpFormState;
     bool isFormSubmission = formState;
@@ -1834,15 +1836,21 @@ void FrameLoader::commitProvisionalLoad()
     HistoryItem* item = history()->currentItem();
     if (!m_frame->tree()->parent() && PageCache::canCache(m_frame->page()) && !item->isInPageCache())
         pageCache()->add(item, m_frame->page());
-    
+
     if (m_loadType != FrameLoadTypeReplace)
         closeOldDataSources();
-    
+
     if (!cachedPage && !m_stateMachine.creatingInitialEmptyDocument())
         m_client->makeRepresentation(pdl.get());
-    
+
     transitionToCommitted(cachedPage);
-    
+
+    if (pdl) {
+        // Check if the destination page is allowed to access the previous page's timing information.
+        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url());
+        m_documentLoader->timing()->hasSameOriginAsPreviousDocument = securityOrigin->canRequest(m_previousUrl);
+    }
+
     // Call clientRedirectCancelledOrFinished() here so that the frame load delegate is notified that the redirect's
     // status has changed, if there was a redirect.  The frame load delegate may have saved some state about
     // the redirect in its -webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:.  Since we are
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index f1c2189..ca78603 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -480,11 +480,13 @@ private:
     bool m_didPerformFirstNavigation;
     bool m_loadingFromCachedPage;
     bool m_suppressOpenerInNewFrame;
-    
+
     SandboxFlags m_sandboxFlags;
     SandboxFlags m_forcedSandboxFlags;
 
     RefPtr<FrameNetworkingContext> m_networkingContext;
+
+    KURL m_previousUrl;
 };
 
 // This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index 85ceb19..e6abefd 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -164,7 +164,7 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
     // deferrals plays less of a part in this function in preventing the bad behavior deferring 
     // callbacks is meant to prevent.
     ASSERT(!newRequest.isNull());
-    
+
     // The additional processing can do anything including possibly removing the last
     // reference to this object; one example of this is 3266216.
     RefPtr<MainResourceLoader> protect(this);
@@ -172,6 +172,12 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
     ASSERT(documentLoader()->timing()->fetchStart);
     if (!redirectResponse.isNull()) {
         DocumentLoadTiming* documentLoadTiming = documentLoader()->timing();
+
+        // Check if the redirected url is allowed to access the redirecting url's timing information.
+        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(newRequest.url());
+        if (!securityOrigin->canRequest(redirectResponse.url()))
+            documentLoadTiming->hasCrossOriginRedirect = true;
+
         documentLoadTiming->redirectCount++;
         if (!documentLoadTiming->redirectStart)
             documentLoadTiming->redirectStart = documentLoadTiming->fetchStart;
@@ -183,7 +189,7 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
     // URL of the main frame which doesn't change when we redirect.
     if (frameLoader()->isLoadingMainFrame())
         newRequest.setFirstPartyForCookies(newRequest.url());
-    
+
     // If we're fielding a redirect in response to a POST, force a load from origin, since
     // this is a common site technique to return to a page viewing some data that the POST
     // just modified.
@@ -192,7 +198,7 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
         newRequest.setCachePolicy(ReloadIgnoringCacheData);
 
     ResourceLoader::willSendRequest(newRequest, redirectResponse);
-    
+
     // Don't set this on the first request. It is set when the main load was started.
     m_documentLoader->setRequest(newRequest);
 
diff --git a/WebCore/page/PerformanceNavigation.cpp b/WebCore/page/PerformanceNavigation.cpp
index 597af20..a46639a 100644
--- a/WebCore/page/PerformanceNavigation.cpp
+++ b/WebCore/page/PerformanceNavigation.cpp
@@ -83,7 +83,11 @@ unsigned short PerformanceNavigation::redirectCount() const
     if (!loader)
         return 0;
 
-    return loader->timing()->redirectCount;
+    DocumentLoadTiming* timing = loader->timing();
+    if (timing->hasCrossOriginRedirect)
+        return 0;
+
+    return timing->redirectCount;
 }
 
 } // namespace WebCore
diff --git a/WebCore/page/PerformanceTiming.cpp b/WebCore/page/PerformanceTiming.cpp
index 189023c..fb8bfb7 100644
--- a/WebCore/page/PerformanceTiming.cpp
+++ b/WebCore/page/PerformanceTiming.cpp
@@ -103,6 +103,9 @@ unsigned long long PerformanceTiming::unloadEventStart() const
     if (!timing)
         return 0;
 
+    if (!timing->hasSameOriginAsPreviousDocument)
+        return 0;
+
     return toIntegerMilliseconds(timing->unloadEventStart);
 }
 
@@ -112,6 +115,9 @@ unsigned long long PerformanceTiming::unloadEventEnd() const
     if (!timing)
         return 0;
 
+    if (!timing->hasSameOriginAsPreviousDocument)
+        return 0;
+
     return toIntegerMilliseconds(timing->unloadEventEnd);
 }
 
@@ -121,6 +127,9 @@ unsigned long long PerformanceTiming::redirectStart() const
     if (!timing)
         return 0;
 
+    if (timing->hasCrossOriginRedirect)
+        return 0;
+
     return toIntegerMilliseconds(timing->redirectStart);
 }
 
@@ -130,6 +139,9 @@ unsigned long long PerformanceTiming::redirectEnd() const
     if (!timing)
         return 0;
 
+    if (timing->hasCrossOriginRedirect)
+        return 0;
+
     return toIntegerMilliseconds(timing->redirectEnd);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list