Add support for webkit-test-runner jscOptions in DumpRenderTree and WebKitTestRunner.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jun 2018 22:15:05 +0000 (22:15 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jun 2018 22:15:05 +0000 (22:15 +0000)
commita33ecf63aa72b2a99bd02f55dca521ed52d21419
treebb41b04669228f13c7dc8655c8d28256e7add52e
parent8fe50a92b12cfb29ca0ac70482f55593c60dc3c8
Add support for webkit-test-runner jscOptions in DumpRenderTree and WebKitTestRunner.
https://bugs.webkit.org/show_bug.cgi?id=186451
<rdar://problem/40875792>

Reviewed by Tim Horton.

Source/JavaScriptCore:

Enhance setOptions() to be able to take a comma separated options string in
addition to white space separated options strings.

* runtime/Options.cpp:
(JSC::isSeparator):
(JSC::Options::setOptions):

Tools:

This jscOptions option can be used by a layout test to specify some JSC runtime
options needed by the test e.g. by adding something like this to the top of the
html file after the DOCTYPE tag:
    <!-- webkit-test-runner [ jscOptions=--useIntlPluralRules=true ] -->

If more than one option is needed, the options can be specified as a comma
separated string e.g.
    <!-- webkit-test-runner [ jscOptions=--useIntlPluralRules=true,--useZombieMode=true ] -->

This only works with JSC options that can be changed at runtime.  Not all JSC
options can be changed this way as some options are only checked and set once at
VM / process initialization time: changing this type of options may have no
effect.  It's the test writer's responsibility to determine which options are
appropriate for with this webkit-test-runner jscOptions option.

This implementation is a workaround until we can change the run-webkit-tests
scripts to parse the option and apply it to a new launch of DRT or WKTR:
https://bugs.webkit.org/show_bug.cgi?id=186452

* DumpRenderTree/TestOptions.cpp:
(TestOptions::TestOptions):
(TestOptions::webViewIsCompatibleWithOptions const):
* DumpRenderTree/TestOptions.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(setJSCOptions):
(resetWebViewToConsistentStateBeforeTesting):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):

LayoutTests:

* js/intl-numberformat-format-to-parts.html:
* js/intl-pluralrules.html:
* js/script-tests/intl-numberformat-format-to-parts.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232733 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/js/intl-numberformat-format-to-parts.html
LayoutTests/js/intl-pluralrules.html
LayoutTests/js/script-tests/intl-numberformat-format-to-parts.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/Options.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.cpp
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h