Title: [132973] trunk
Revision
132973
Author
[email protected]
Date
2012-10-30 18:43:02 -0700 (Tue, 30 Oct 2012)

Log Message

DOM URL is flaky when workers are used
https://bugs.webkit.org/show_bug.cgi?id=99178

Reviewed by Geoffrey Garen.

Source/WebCore:

Extend JSNoStaticTables to also avoid direct access of static tables in constructor objects.

Test: fast/workers/worker-domurl.html

* bindings/scripts/CodeGeneratorJS.pm:
(constructorHashTableAccessor):
(GenerateConstructorDefinition):

LayoutTests:

Test that the methods of the URL constructor are accesible from both main and worker threads.

* fast/workers/resources/worker-domurl.js: Added.
(log):
(onmessage):
* fast/workers/worker-domurl-expected.txt: Added.
* fast/workers/worker-domurl.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (132972 => 132973)


--- trunk/LayoutTests/ChangeLog	2012-10-31 01:39:45 UTC (rev 132972)
+++ trunk/LayoutTests/ChangeLog	2012-10-31 01:43:02 UTC (rev 132973)
@@ -1,3 +1,18 @@
+2012-10-30  Allan Sandfeld Jensen  <[email protected]>
+
+        DOM URL is flaky when workers are used
+        https://bugs.webkit.org/show_bug.cgi?id=99178
+
+        Reviewed by Geoffrey Garen.
+
+        Test that the methods of the URL constructor are accesible from both main and worker threads.
+
+        * fast/workers/resources/worker-domurl.js: Added.
+        (log):
+        (onmessage):
+        * fast/workers/worker-domurl-expected.txt: Added.
+        * fast/workers/worker-domurl.html: Added.
+
 2012-10-30  Hans Muller  <[email protected]>
 
         [CSS Exclusions] Multiple segment polygon layout does not get all segments

Added: trunk/LayoutTests/fast/workers/resources/worker-domurl.js (0 => 132973)


--- trunk/LayoutTests/fast/workers/resources/worker-domurl.js	                        (rev 0)
+++ trunk/LayoutTests/fast/workers/resources/worker-domurl.js	2012-10-31 01:43:02 UTC (rev 132973)
@@ -0,0 +1,19 @@
+function log(message)
+{
+    postMessage(message);
+}
+
+_onmessage_ = function(event)
+{
+    if (URL.createObjectURL == undefined)
+        log('FAIL: URL.createObjectURL undefined');
+    else
+        log('PASS: URL.createObjectURL defined');
+
+    if (URL.revokeObjectURL == undefined)
+        log('FAIL: URL.revokeObjectURL undefined');
+    else
+        log('PASS: URL.revokeObjectURL defined');
+
+    log('DONE');
+}

Added: trunk/LayoutTests/fast/workers/worker-domurl-expected.txt (0 => 132973)


--- trunk/LayoutTests/fast/workers/worker-domurl-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/workers/worker-domurl-expected.txt	2012-10-31 01:43:02 UTC (rev 132973)
@@ -0,0 +1,7 @@
+PASS: window.URL.createObjectURL defined
+PASS: window.URL.revokeObjectURL defined
+PASS: URL.createObjectURL defined
+PASS: URL.revokeObjectURL defined
+PASS: window.URL.createObjectURL defined
+PASS: window.URL.revokeObjectURL defined
+

Added: trunk/LayoutTests/fast/workers/worker-domurl.html (0 => 132973)


--- trunk/LayoutTests/fast/workers/worker-domurl.html	                        (rev 0)
+++ trunk/LayoutTests/fast/workers/worker-domurl.html	2012-10-31 01:43:02 UTC (rev 132973)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<body>
+<pre id='console'></pre>
+
+<script>
+function log(message)
+{
+    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
+}
+
+function runTest() {
+    var worker = new Worker('resources/worker-domurl.js');
+    worker._onmessage_ = function(event) {
+        if (event.data == 'DONE') {
+            testDOMURL();
+            if (window.testRunner)
+                testRunner.notifyDone();
+        } else
+            log(event.data);
+    }
+    testDOMURL();
+    worker.postMessage('');
+}
+
+function testDOMURL() 
+{
+    if (window.URL.createObjectURL == undefined)
+        log('FAIL: window.URL.createObjectURL undefined');
+    else
+        log('PASS: window.URL.createObjectURL defined');
+
+    if (window.URL.revokeObjectURL == undefined)
+        log('FAIL: window.URL.revokeObjectURL undefined');
+    else
+        log('PASS: window.URL.revokeObjectURL defined');
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+window._onload_ = runTest;
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (132972 => 132973)


--- trunk/Source/WebCore/ChangeLog	2012-10-31 01:39:45 UTC (rev 132972)
+++ trunk/Source/WebCore/ChangeLog	2012-10-31 01:43:02 UTC (rev 132973)
@@ -1,3 +1,18 @@
+2012-10-30  Allan Sandfeld Jensen  <[email protected]>
+
+        DOM URL is flaky when workers are used
+        https://bugs.webkit.org/show_bug.cgi?id=99178
+
+        Reviewed by Geoffrey Garen.
+
+        Extend JSNoStaticTables to also avoid direct access of static tables in constructor objects.
+
+        Test: fast/workers/worker-domurl.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (constructorHashTableAccessor):
+        (GenerateConstructorDefinition):
+
 2012-10-30  Jae Hyun Park  <[email protected]>
 
         Coordinated Graphics: Remove unused methods

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (132972 => 132973)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-10-31 01:39:45 UTC (rev 132972)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-10-31 01:43:02 UTC (rev 132973)
@@ -377,6 +377,17 @@
     }
 }
 
+sub constructorHashTableAccessor
+{
+    my $noStaticTables = shift;
+    my $constructorClassName = shift;
+    if ($noStaticTables) {
+        return "get${constructorClassName}Table(exec)";
+    } else {
+        return "&${constructorClassName}Table";
+    }
+}
+
 sub GetGenerateIsReachable
 {
     my $dataNode = shift;
@@ -3727,7 +3738,16 @@
         push(@$outputArray, "{\n");
         push(@$outputArray, "}\n\n");
     } else {
-        push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleInterfaceName}Constructor\", &Base::s_info, &${constructorClassName}Table, 0, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
+        if ($dataNode->extendedAttributes->{"JSNoStaticTables"}) {
+            push(@$outputArray, "static const HashTable* get${constructorClassName}Table(ExecState* exec)\n");
+            push(@$outputArray, "{\n");
+            push(@$outputArray, "    return getHashTableForGlobalData(exec->globalData(), &${constructorClassName}Table);\n");
+            push(@$outputArray, "}\n\n");
+            push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleInterfaceName}Constructor\", &Base::s_info, 0, get${constructorClassName}Table, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
+        } else {
+            push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleInterfaceName}Constructor\", &Base::s_info, &${constructorClassName}Table, 0, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
+        }
+
         push(@$outputArray, "${constructorClassName}::${constructorClassName}(Structure* structure, JSDOMGlobalObject* globalObject)\n");
         push(@$outputArray, "    : DOMConstructorObject(structure, globalObject)\n");
         push(@$outputArray, "{\n");
@@ -3765,12 +3785,12 @@
 
         push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)\n");
         push(@$outputArray, "{\n");
-        push(@$outputArray, "    return getStatic${kind}Slot<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, jsCast<${constructorClassName}*>(cell), propertyName, slot);\n");
+        push(@$outputArray, "    return getStatic${kind}Slot<${constructorClassName}, JSDOMWrapper>(exec, " . constructorHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $constructorClassName) . ", jsCast<${constructorClassName}*>(cell), propertyName, slot);\n");
         push(@$outputArray, "}\n\n");
 
         push(@$outputArray, "bool ${constructorClassName}::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)\n");
         push(@$outputArray, "{\n");
-        push(@$outputArray, "    return getStatic${kind}Descriptor<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, jsCast<${constructorClassName}*>(object), propertyName, descriptor);\n");
+        push(@$outputArray, "    return getStatic${kind}Descriptor<${constructorClassName}, JSDOMWrapper>(exec, " . constructorHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $constructorClassName) . ", jsCast<${constructorClassName}*>(object), propertyName, descriptor);\n");
         push(@$outputArray, "}\n\n");
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to