Title: [286550] trunk
Revision
286550
Author
tzaga...@apple.com
Date
2021-12-06 10:46:03 -0800 (Mon, 06 Dec 2021)

Log Message

Restore navigator.hardwareConcurrency
https://bugs.webkit.org/show_bug.cgi?id=233381
<rdar://85023911>

Reviewed by Saam Barati.

LayoutTests/imported/w3c:

* web-platform-tests/html/dom/idlharness.https-expected.txt:
* web-platform-tests/html/dom/idlharness.worker-expected.txt:
* web-platform-tests/workers/WorkerNavigator-hardware-concurrency.any.worker-expected.txt:

Source/WebCore:

Navigator.hardwareConcurrency was removed in r219379, but it is now used
by emscripten to implement std::thread::hardware_concurrency()

Test: fast/dom/navigator-hardwareConcurrency.html

* page/Navigator.idl:
* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::hardwareConcurrency):
* page/NavigatorBase.h:
* page/WorkerNavigator.idl:

LayoutTests:

* fast/dom/Window/resources/window-property-collector.js:
(emitExpectedResult):
* fast/dom/navigator-detached-no-crash-expected.txt:
* fast/dom/navigator-hardwareConcurrency-expected.txt: Added.
* fast/dom/navigator-hardwareConcurrency.html: Added.
* fast/workers/resources/worker-navigator.js:
* fast/workers/worker-navigator-expected.txt:
* platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt:
* platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/win/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/wincairo/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (286549 => 286550)


--- trunk/LayoutTests/ChangeLog	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/ChangeLog	2021-12-06 18:46:03 UTC (rev 286550)
@@ -1,3 +1,33 @@
+2021-12-06  Tadeu Zagallo  <tzaga...@apple.com>
+
+        Restore navigator.hardwareConcurrency
+        https://bugs.webkit.org/show_bug.cgi?id=233381
+        <rdar://85023911>
+
+        Reviewed by Saam Barati.
+
+        * fast/dom/Window/resources/window-property-collector.js:
+        (emitExpectedResult):
+        * fast/dom/navigator-detached-no-crash-expected.txt:
+        * fast/dom/navigator-hardwareConcurrency-expected.txt: Added.
+        * fast/dom/navigator-hardwareConcurrency.html: Added.
+        * fast/workers/resources/worker-navigator.js:
+        * fast/workers/worker-navigator-expected.txt:
+        * platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt:
+        * platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+        * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+        * platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+        * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+        * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+        * platform/mac/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/win/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/wincairo/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+
 2021-12-06  Said Abou-Hallawa  <s...@apple.com>
 
         [GPU Process] (REGRESSION r285597): Set the filterRegion of the CSSFilter after it is created

Modified: trunk/LayoutTests/fast/dom/Window/resources/window-property-collector.js (286549 => 286550)


--- trunk/LayoutTests/fast/dom/Window/resources/window-property-collector.js	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/fast/dom/Window/resources/window-property-collector.js	2021-12-06 18:46:03 UTC (rev 286550)
@@ -65,6 +65,7 @@
         break;
     case "navigator.appCodeName":
     case "navigator.appName":
+    case "navigator.hardwareConcurrency":
     case "navigator.language":
     case "navigator.onLine":
     case "navigator.platform":

Modified: trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -10,6 +10,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -38,6 +39,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Added: trunk/LayoutTests/fast/dom/navigator-hardwareConcurrency-expected.txt (0 => 286550)


--- trunk/LayoutTests/fast/dom/navigator-hardwareConcurrency-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/navigator-hardwareConcurrency-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -0,0 +1,3 @@
+Tests for navigator.hardwareConcurrency
+
+PASS

Added: trunk/LayoutTests/fast/dom/navigator-hardwareConcurrency.html (0 => 286550)


--- trunk/LayoutTests/fast/dom/navigator-hardwareConcurrency.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/navigator-hardwareConcurrency.html	2021-12-06 18:46:03 UTC (rev 286550)
@@ -0,0 +1,16 @@
+<html>
+<body>
+<p>Tests for navigator.hardwareConcurrency</p>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var concurrency = navigator.hardwareConcurrency;
+
+    if(concurrency && concurrency > 0)
+        document.write("PASS");
+    else
+        document.write("Fail, navigator.hardwareConcurrency is " + concurrency);
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/workers/resources/worker-navigator.js (286549 => 286550)


--- trunk/LayoutTests/fast/workers/resources/worker-navigator.js	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/fast/workers/resources/worker-navigator.js	2021-12-06 18:46:03 UTC (rev 286550)
@@ -12,6 +12,9 @@
 worker.postMessage("eval typeof navigator");
 worker.postMessage("eval navigator");
 
+// NavigatorConcurrentHardware
+worker.postMessage("eval navigator.hardwareConcurrency >= 1 && navigator.hardwareConcurrency <= 8");
+
 // NavigatorID
 worker.postMessage("eval navigator.appCodeName === 'Mozilla'");
 worker.postMessage("eval navigator.appName === 'Netscape'");

Modified: trunk/LayoutTests/fast/workers/worker-navigator-expected.txt (286549 => 286550)


--- trunk/LayoutTests/fast/workers/worker-navigator-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/fast/workers/worker-navigator-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -2,6 +2,7 @@
 
 typeof navigator: object
 navigator: [object WorkerNavigator]
+navigator.hardwareConcurrency >= 1 && navigator.hardwareConcurrency <= 8: true
 navigator.appCodeName === 'Mozilla': true
 navigator.appName === 'Netscape': true
 navigator.appVersion.indexOf('WebKit') != 0: true

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286549 => 286550)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-06 18:46:03 UTC (rev 286550)
@@ -1,3 +1,15 @@
+2021-12-06  Tadeu Zagallo  <tzaga...@apple.com>
+
+        Restore navigator.hardwareConcurrency
+        https://bugs.webkit.org/show_bug.cgi?id=233381
+        <rdar://85023911>
+
+        Reviewed by Saam Barati.
+
+        * web-platform-tests/html/dom/idlharness.https-expected.txt:
+        * web-platform-tests/html/dom/idlharness.worker-expected.txt:
+        * web-platform-tests/workers/WorkerNavigator-hardware-concurrency.any.worker-expected.txt:
+
 2021-12-03  Sergio Villar Senin  <svil...@igalia.com>
 
         [css-flexbox] WPT import. December 2021 edition

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4617,7 +4617,7 @@
 PASS Navigator interface: attribute plugins
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4642,7 +4642,7 @@
 PASS Navigator interface: window.navigator must inherit property "plugins" with the proper type
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS PluginArray interface: existence and properties of interface object
 PASS PluginArray interface object length
 PASS PluginArray interface object name

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt (286549 => 286550)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -761,7 +761,7 @@
 PASS WorkerNavigator interface: attribute language
 PASS WorkerNavigator interface: attribute languages
 PASS WorkerNavigator interface: attribute onLine
-FAIL WorkerNavigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS WorkerNavigator interface: attribute hardwareConcurrency
 PASS WorkerNavigator must be primary interface of self.navigator
 PASS Stringification of self.navigator
 PASS WorkerNavigator interface: self.navigator must inherit property "appCodeName" with the proper type
@@ -778,7 +778,7 @@
 PASS WorkerNavigator interface: self.navigator must inherit property "language" with the proper type
 PASS WorkerNavigator interface: self.navigator must inherit property "languages" with the proper type
 PASS WorkerNavigator interface: self.navigator must inherit property "onLine" with the proper type
-FAIL WorkerNavigator interface: self.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS WorkerNavigator interface: self.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS WorkerLocation interface: existence and properties of interface object
 PASS WorkerLocation interface object length
 PASS WorkerLocation interface object name

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/workers/WorkerNavigator-hardware-concurrency.any.worker-expected.txt (286549 => 286550)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/workers/WorkerNavigator-hardware-concurrency.any.worker-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/workers/WorkerNavigator-hardware-concurrency.any.worker-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -1,3 +1,3 @@
 
-FAIL Test worker navigator hardware concurrency. assert_true: expected true got false
+PASS Test worker navigator hardware concurrency.
 

Modified: trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -761,7 +761,7 @@
 PASS WorkerNavigator interface: attribute language
 PASS WorkerNavigator interface: attribute languages
 PASS WorkerNavigator interface: attribute onLine
-FAIL WorkerNavigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS WorkerNavigator interface: attribute hardwareConcurrency
 PASS WorkerNavigator must be primary interface of self.navigator
 PASS Stringification of self.navigator
 PASS WorkerNavigator interface: self.navigator must inherit property "appCodeName" with the proper type
@@ -778,7 +778,7 @@
 PASS WorkerNavigator interface: self.navigator must inherit property "language" with the proper type
 PASS WorkerNavigator interface: self.navigator must inherit property "languages" with the proper type
 PASS WorkerNavigator interface: self.navigator must inherit property "onLine" with the proper type
-FAIL WorkerNavigator interface: self.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS WorkerNavigator interface: self.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS WorkerLocation interface: existence and properties of interface object
 PASS WorkerLocation interface object length
 PASS WorkerLocation interface object name

Modified: trunk/LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -7,6 +7,7 @@
 navigator.contacts is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -36,6 +37,7 @@
 navigator.contacts is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4839,7 +4839,7 @@
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
 FAIL Navigator interface: attribute pdfViewerEnabled assert_true: The prototype object must have a property "pdfViewerEnabled" expected true got false
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4865,7 +4865,7 @@
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
 FAIL Navigator interface: window.navigator must inherit property "pdfViewerEnabled" with the proper type assert_inherits: property "pdfViewerEnabled" not found in prototype chain
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS PluginArray interface: existence and properties of interface object
 PASS PluginArray interface object length
 PASS PluginArray interface object name

Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4795,7 +4795,7 @@
 PASS Navigator interface: attribute plugins
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4820,7 +4820,7 @@
 PASS Navigator interface: window.navigator must inherit property "plugins" with the proper type
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS ImageBitmap interface: existence and properties of interface object
 PASS ImageBitmap interface object length
 PASS ImageBitmap interface object name

Modified: trunk/LayoutTests/platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4805,7 +4805,7 @@
 PASS Navigator interface: attribute plugins
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4830,7 +4830,7 @@
 PASS Navigator interface: window.navigator must inherit property "plugins" with the proper type
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS ImageBitmap interface: existence and properties of interface object
 PASS ImageBitmap interface object length
 PASS ImageBitmap interface object name

Modified: trunk/LayoutTests/platform/mac/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/mac/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/mac/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -9,6 +9,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -35,6 +36,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Modified: trunk/LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -5,6 +5,7 @@
 navigator.appVersion is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -31,6 +32,7 @@
 navigator.appVersion is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4839,7 +4839,7 @@
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
 FAIL Navigator interface: attribute pdfViewerEnabled assert_true: The prototype object must have a property "pdfViewerEnabled" expected true got false
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4865,7 +4865,7 @@
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
 FAIL Navigator interface: window.navigator must inherit property "pdfViewerEnabled" with the proper type assert_inherits: property "pdfViewerEnabled" not found in prototype chain
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS PluginArray interface: existence and properties of interface object
 PASS PluginArray interface object length
 PASS PluginArray interface object name

Modified: trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -9,6 +9,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.isLoggedIn() is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
@@ -45,6 +46,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.isLoggedIn() is OK
 navigator.javaEnabled() is OK
 navigator.language is OK

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4805,7 +4805,7 @@
 PASS Navigator interface: attribute plugins
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4830,7 +4830,7 @@
 PASS Navigator interface: window.navigator must inherit property "plugins" with the proper type
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS ImageBitmap interface: existence and properties of interface object
 PASS ImageBitmap interface object length
 PASS ImageBitmap interface object name

Modified: trunk/LayoutTests/platform/win/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/win/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/win/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -9,6 +9,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -31,6 +32,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Modified: trunk/LayoutTests/platform/wincairo/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/wincairo/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/wincairo/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -7,6 +7,7 @@
 navigator.contacts is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -27,6 +28,7 @@
 navigator.contacts is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Modified: trunk/LayoutTests/platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -7,6 +7,7 @@
 navigator.contacts is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -37,6 +38,7 @@
 navigator.contacts is OK
 navigator.cookieEnabled is OK
 navigator.getStorageUpdates() is OK
+navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK

Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (286549 => 286550)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-12-06 18:46:03 UTC (rev 286550)
@@ -4839,7 +4839,7 @@
 PASS Navigator interface: attribute mimeTypes
 PASS Navigator interface: operation javaEnabled()
 FAIL Navigator interface: attribute pdfViewerEnabled assert_true: The prototype object must have a property "pdfViewerEnabled" expected true got false
-FAIL Navigator interface: attribute hardwareConcurrency assert_true: The prototype object must have a property "hardwareConcurrency" expected true got false
+PASS Navigator interface: attribute hardwareConcurrency
 PASS Navigator must be primary interface of window.navigator
 PASS Stringification of window.navigator
 PASS Navigator interface: window.navigator must inherit property "appCodeName" with the proper type
@@ -4865,7 +4865,7 @@
 PASS Navigator interface: window.navigator must inherit property "mimeTypes" with the proper type
 PASS Navigator interface: window.navigator must inherit property "javaEnabled()" with the proper type
 FAIL Navigator interface: window.navigator must inherit property "pdfViewerEnabled" with the proper type assert_inherits: property "pdfViewerEnabled" not found in prototype chain
-FAIL Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type assert_inherits: property "hardwareConcurrency" not found in prototype chain
+PASS Navigator interface: window.navigator must inherit property "hardwareConcurrency" with the proper type
 PASS PluginArray interface: existence and properties of interface object
 PASS PluginArray interface object length
 PASS PluginArray interface object name

Modified: trunk/Source/WebCore/ChangeLog (286549 => 286550)


--- trunk/Source/WebCore/ChangeLog	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/Source/WebCore/ChangeLog	2021-12-06 18:46:03 UTC (rev 286550)
@@ -1,3 +1,22 @@
+2021-12-06  Tadeu Zagallo  <tzaga...@apple.com>
+
+        Restore navigator.hardwareConcurrency
+        https://bugs.webkit.org/show_bug.cgi?id=233381
+        <rdar://85023911>
+
+        Reviewed by Saam Barati.
+
+        Navigator.hardwareConcurrency was removed in r219379, but it is now used
+        by emscripten to implement std::thread::hardware_concurrency()
+
+        Test: fast/dom/navigator-hardwareConcurrency.html
+
+        * page/Navigator.idl:
+        * page/NavigatorBase.cpp:
+        (WebCore::NavigatorBase::hardwareConcurrency):
+        * page/NavigatorBase.h:
+        * page/WorkerNavigator.idl:
+
 2021-12-06  Said Abou-Hallawa  <s...@apple.com>
         [GPU Process] (REGRESSION r285597): Set the filterRegion of the CSSFilter after it is created
         https://bugs.webkit.org/show_bug.cgi?id=233849

Modified: trunk/Source/WebCore/page/Navigator.idl (286549 => 286550)


--- trunk/Source/WebCore/page/Navigator.idl	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/Source/WebCore/page/Navigator.idl	2021-12-06 18:46:03 UTC (rev 286550)
@@ -25,6 +25,8 @@
     // Non-standard.
     [Conditional=NAVIGATOR_STANDALONE] readonly attribute boolean standalone;
 
+    readonly attribute unsigned long long hardwareConcurrency;
+
     // Non-standard.
     // FIXME: Remove this. WebKit is the only engine that still has this.
     undefined getStorageUpdates();

Modified: trunk/Source/WebCore/page/NavigatorBase.cpp (286549 => 286550)


--- trunk/Source/WebCore/page/NavigatorBase.cpp	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/Source/WebCore/page/NavigatorBase.cpp	2021-12-06 18:46:03 UTC (rev 286550)
@@ -175,4 +175,24 @@
 }
 #endif
 
+int NavigatorBase::hardwareConcurrency()
+{
+    static int numberOfCores;
+
+    static std::once_flag once;
+    std::call_once(once, [] {
+        // Enforce a maximum for the number of cores reported to mitigate
+        // fingerprinting for the minority of machines with large numbers of cores.
+        // If machines with more than 8 cores become commonplace, we should bump this number.
+        // see https://bugs.webkit.org/show_bug.cgi?id=132588 for the
+        // rationale behind this decision.
+        if (WTF::numberOfProcessorCores() < 8)
+            numberOfCores = 4;
+        else
+            numberOfCores = 8;
+    });
+
+    return numberOfCores;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/NavigatorBase.h (286549 => 286550)


--- trunk/Source/WebCore/page/NavigatorBase.h	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/Source/WebCore/page/NavigatorBase.h	2021-12-06 18:46:03 UTC (rev 286550)
@@ -64,6 +64,8 @@
     StorageManager& storage();
     WebLockManager& locks();
 
+    static int hardwareConcurrency();
+
 protected:
     explicit NavigatorBase(ScriptExecutionContext*);
 

Modified: trunk/Source/WebCore/page/WorkerNavigator.idl (286549 => 286550)


--- trunk/Source/WebCore/page/WorkerNavigator.idl	2021-12-06 18:40:13 UTC (rev 286549)
+++ trunk/Source/WebCore/page/WorkerNavigator.idl	2021-12-06 18:46:03 UTC (rev 286550)
@@ -31,6 +31,7 @@
     GenerateIsReachable=Impl,
     JSCustomMarkFunction,
 ] interface WorkerNavigator {
+    readonly attribute unsigned long long hardwareConcurrency;
 };
 
 WorkerNavigator includes NavigatorID;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to