Title: [193728] branches/safari-601.4-branch

Diff

Modified: branches/safari-601.4-branch/LayoutTests/ChangeLog (193727 => 193728)


--- branches/safari-601.4-branch/LayoutTests/ChangeLog	2015-12-08 08:41:41 UTC (rev 193727)
+++ branches/safari-601.4-branch/LayoutTests/ChangeLog	2015-12-08 08:42:52 UTC (rev 193728)
@@ -1,5 +1,30 @@
 2015-12-08  Babak Shafiei  <bshaf...@apple.com>
 
+        Merge r192604.
+
+    2015-11-18  Jiewen Tan  <jiewen_...@apple.com>
+
+            [WK1] Crash loading Blink layout test fast/dom/Window/property-access-on-cached-window-after-frame-removed.html
+            https://bugs.webkit.org/show_bug.cgi?id=150198
+            <rdar://problem/23136026>
+
+            Reviewed by Brent Fulgham.
+
+            * fast/dom/Window/666869-expected.txt: Added.
+            * fast/dom/Window/666869.html: Added.
+            Test case is from Mozilla.
+            * fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt: Added.
+            * fast/dom/Window/property-access-on-cached-window-after-frame-removed.html: Added.
+            * fast/dom/Window/resources/window-property-collector.js: Added.
+            (collectProperties):
+            (emitExpectedResult):
+            (collectPropertiesHelper):
+            Test case is from Blink r168256:
+            https://codereview.chromium.org/131113003
+            * platform/mac-wk2/TestExpectations:
+
+2015-12-08  Babak Shafiei  <bshaf...@apple.com>
+
         Merge r192433.
 
     2015-11-13  Jiewen Tan  <jiewen_...@apple.com>

Copied: branches/safari-601.4-branch/LayoutTests/fast/dom/Window/666869-expected.txt (from rev 193708, branches/safari-601.1.46.60-branch/LayoutTests/fast/dom/Window/666869-expected.txt) (0 => 193728)


--- branches/safari-601.4-branch/LayoutTests/fast/dom/Window/666869-expected.txt	                        (rev 0)
+++ branches/safari-601.4-branch/LayoutTests/fast/dom/Window/666869-expected.txt	2015-12-08 08:42:52 UTC (rev 193728)
@@ -0,0 +1 @@
+PASS. WebKit didn't crash.

Copied: branches/safari-601.4-branch/LayoutTests/fast/dom/Window/666869.html (from rev 193708, branches/safari-601.1.46.60-branch/LayoutTests/fast/dom/Window/666869.html) (0 => 193728)


--- branches/safari-601.4-branch/LayoutTests/fast/dom/Window/666869.html	                        (rev 0)
+++ branches/safari-601.4-branch/LayoutTests/fast/dom/Window/666869.html	2015-12-08 08:42:52 UTC (rev 193728)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function boom()
+    {
+        var f = document.getElementById("f");
+        var frameWin = f.contentWindow;
+        document.body.removeChild(f);
+        frameWin.performance;
+
+        document.write("PASS. WebKit didn't crash.");
+    }
+</script>
+</head>
+<body _onload_="boom();"><iframe id="f" src=""
+</html>

Copied: branches/safari-601.4-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt (from rev 193708, branches/safari-601.1.46.60-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt) (0 => 193728)


--- branches/safari-601.4-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt	                        (rev 0)
+++ branches/safari-601.4-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt	2015-12-08 08:42:52 UTC (rev 193728)
@@ -0,0 +1 @@
+Pass. WebKit didn't crash.

Copied: branches/safari-601.4-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed.html (from rev 193708, branches/safari-601.1.46.60-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed.html) (0 => 193728)


--- branches/safari-601.4-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed.html	                        (rev 0)
+++ branches/safari-601.4-branch/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed.html	2015-12-08 08:42:52 UTC (rev 193728)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+var childWindow;
+var propertiesToVerify = [];
+
+function insertExpectedResult(path, expected)
+{
+    var propertyPath = path.join('.');
+    propertiesToVerify.push({'property': "childWindow." + propertyPath, 'expected': expected});
+}
+
+function runTest()
+{
+    var frame = document.getElementById("frame");
+    childWindow = frame.contentWindow;
+    // Have expected results assume that the frame has been closed (=> window.closed = true.)
+    collectProperties(true);
+    frame.parentNode.removeChild(frame);
+    for (var i = 0; i < propertiesToVerify.length; ++i)
+        shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected);
+    document.write("Pass. WebKit didn't crash.");
+}
+</script>
+</head>
+<body>
+<iframe id="frame" src="" _onload_="runTest()"></iframe>
+</body>
+</html>

Copied: branches/safari-601.4-branch/LayoutTests/fast/dom/Window/resources/window-property-collector.js (from rev 193708, branches/safari-601.1.46.60-branch/LayoutTests/fast/dom/Window/resources/window-property-collector.js) (0 => 193728)


--- branches/safari-601.4-branch/LayoutTests/fast/dom/Window/resources/window-property-collector.js	                        (rev 0)
+++ branches/safari-601.4-branch/LayoutTests/fast/dom/Window/resources/window-property-collector.js	2015-12-08 08:42:52 UTC (rev 193728)
@@ -0,0 +1,121 @@
+function collectProperties(windowHasBeenGCed)
+{
+    // Collect properties of the top-level window, since touching the properties
+    // of a DOMWindow affects its internal C++ state.
+    collectPropertiesHelper(window, windowHasBeenGCed, []);
+
+    propertiesToVerify.sort(function (a, b)
+    {
+        if (a.property < b.property)
+            return -1
+        if (a.property > b.property)
+            return 1;
+        return 0;
+    });
+}
+
+function emitExpectedResult(path, expected)
+{
+    // Skip internals properties, since they aren't web accessible.
+    if (path[0] == 'internals'
+        || path[0] == 'propertiesToVerify' // Skip the list we're building...
+        || path[0] == 'clientInformation' // Just an alias for navigator.
+        || path[0] == 'testRunner' // Skip testRunner since they are only for testing.
+        || path[0] == 'layoutTestController' // Just an alias for testRunner.
+        || path[0] == 'eventSender') { // Skip eventSender since they are only for testing.
+        return;
+    }
+
+    // Skip the properties which are hard to expect a stable result.
+    if (path[0] == 'accessibilityController' // we can hardly estimate the states of the cached WebAXObjects.
+        || path[0] == 'localStorage') { // local storage is not reliably cleared between tests.
+        return;
+    }
+
+    // FIXME: Skip MemoryInfo for now, since it's not implemented as a DOMWindowProperty, and has
+    // no way of knowing when it's detached. Eventually this should have the same behavior.
+    if (path.length >= 2 && (path[0] == 'console' || path[0] == 'performance') && path[1] == 'memory')
+        return;
+
+    // Skip things that are assumed to be constants.
+    if (path[path.length - 1].toUpperCase() == path[path.length - 1])
+        return;
+
+    // Various special cases for legacy reasons. Please do not add entries to this list.
+    var propertyPath = path.join('.');
+
+    // Connection type depends on the host, skip.
+    if (propertyPath == 'navigator.connection.type')
+      return;
+    if (propertyPath == 'navigator.connection.downlinkMax')
+      return;
+
+    switch (propertyPath) {
+    case "location.href":
+        expected = "'about:blank'";
+        break;
+    case "location.origin":
+        expected = "'null'";
+        break;
+    case "location.pathname":
+        expected = "'blank'";
+        break;
+    case "location.protocol":
+        expected = "'about:'";
+        break;
+    case "navigator.appCodeName":
+    case "navigator.appName":
+    case "navigator.hardwareConcurrency":
+    case "navigator.language":
+    case "navigator.onLine":
+    case "navigator.platform":
+    case "navigator.product":
+    case "navigator.productSub":
+    case "navigator.vendor":
+        expected = "window." + propertyPath;
+        break;
+    case "screen.orientation":
+        expected = "'portrait-primary'";
+        break;
+    case "history.scrollRestoration":
+        expected = "'auto'";
+        break;
+    }
+
+    insertExpectedResult(path, expected);
+}
+
+function collectPropertiesHelper(object, windowHasBeenGCed, path)
+{
+    if (path.length > 20)
+        throw 'Error: probably looping';
+
+    for (var property in object) {
+        // Skip internals properties, since they aren't web accessible.
+        if (property === 'internals')
+            continue;
+        path.push(property);
+        var type = typeof(object[property]);
+        if (type == "object") {
+            if (object[property] === null) {
+                emitExpectedResult(path, "null");
+            } else if (!object[property].Window
+                && !(object[property] instanceof Node)
+                && !(object[property] instanceof MimeTypeArray)
+                && !(object[property] instanceof PluginArray)) {
+                // Skip some traversing through types that will end up in cycles...
+                collectPropertiesHelper(object[property], windowHasBeenGCed, path);
+            }
+        } else if (type == "string") {
+            emitExpectedResult(path, "''");
+        } else if (type == "number") {
+            emitExpectedResult(path, "0");
+        } else if (type == "boolean") {
+            expected = "false";
+            if (path == "closed" && windowHasBeenGCed )
+                expected = "true";
+            emitExpectedResult(path, expected);
+        }
+        path.pop();
+    }
+}

Modified: branches/safari-601.4-branch/LayoutTests/platform/mac-wk2/TestExpectations (193727 => 193728)


--- branches/safari-601.4-branch/LayoutTests/platform/mac-wk2/TestExpectations	2015-12-08 08:41:41 UTC (rev 193727)
+++ branches/safari-601.4-branch/LayoutTests/platform/mac-wk2/TestExpectations	2015-12-08 08:42:52 UTC (rev 193728)
@@ -340,6 +340,9 @@
 
 [ Debug ] editing/undo/remove-css-property-and-remove-style.html [ Pass Failure ]
 
+# Test for WK1 only
+fast/dom/Window/property-access-on-cached-window-after-frame-removed.html [ Skip ]
+
 ### END OF (3) Unclassified failures
 ########################################
 

Modified: branches/safari-601.4-branch/Source/WebCore/ChangeLog (193727 => 193728)


--- branches/safari-601.4-branch/Source/WebCore/ChangeLog	2015-12-08 08:41:41 UTC (rev 193727)
+++ branches/safari-601.4-branch/Source/WebCore/ChangeLog	2015-12-08 08:42:52 UTC (rev 193728)
@@ -1,5 +1,25 @@
 2015-12-08  Babak Shafiei  <bshaf...@apple.com>
 
+        Merge r192604.
+
+    2015-11-18  Jiewen Tan  <jiewen_...@apple.com>
+
+            [WK1] Crash loading Blink layout test fast/dom/Window/property-access-on-cached-window-after-frame-removed.html
+            https://bugs.webkit.org/show_bug.cgi?id=150198
+            <rdar://problem/23136026>
+
+            Reviewed by Brent Fulgham.
+
+            Test: fast/dom/Window/property-access-on-cached-window-after-frame-removed.html
+
+            Properties of a contentWindow could be accessed even if the frame who owns the window is
+            detached. Therefore, check whether the document loader is still alive before using it.
+
+            * page/PerformanceTiming.cpp:
+            (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
+
+2015-12-08  Babak Shafiei  <bshaf...@apple.com>
+
         Merge r192433.
 
     2015-11-13  Jiewen Tan  <jiewen_...@apple.com>

Modified: branches/safari-601.4-branch/Source/WebCore/page/PerformanceTiming.cpp (193727 => 193728)


--- branches/safari-601.4-branch/Source/WebCore/page/PerformanceTiming.cpp	2015-12-08 08:41:41 UTC (rev 193727)
+++ branches/safari-601.4-branch/Source/WebCore/page/PerformanceTiming.cpp	2015-12-08 08:42:52 UTC (rev 193728)
@@ -340,9 +340,9 @@
 unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double monotonicSeconds) const
 {
     ASSERT(monotonicSeconds >= 0);
-    const DocumentLoadTiming* timing = documentLoadTiming();
-    ASSERT(timing);
-    return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonicSeconds));
+    if (const DocumentLoadTiming* timing = documentLoadTiming())
+        return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonicSeconds));
+    return 0;
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to