Bug 148125

Summary: Add ability to save and restore JSC options.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, bfulgham, commit-queue, fpizlo, ggaren, keith_miller, mmirman, msaboff, saam
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 147968    
Attachments:
Description Flags
the fix.
none
fix 2: fixed some style issues.
mark.lam: review-
fix 3: fixed previous bug in tests
mark.lam: review-
fix 4: fixed builds. saam: review+

Description Mark Lam 2015-08-18 00:44:16 PDT
This is needed for testing purposes.
Comment 1 Mark Lam 2015-08-18 01:11:39 PDT
Created attachment 259259 [details]
the fix.
Comment 2 WebKit Commit Bot 2015-08-18 01:14:02 PDT
Attachment 259259 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Options.h:416:  The parameter name "level" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Options.h:418:  The parameter name "level" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Options.h:418:  The parameter name "id" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/API/JSOptions.cpp:29:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/Options.cpp:379:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/runtime/Options.cpp:384:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Total errors found: 6 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Mark Lam 2015-08-18 01:28:12 PDT
Created attachment 259260 [details]
fix 2: fixed some style issues.

The remaining 2 style complaints are bogus.
Comment 4 WebKit Commit Bot 2015-08-18 01:29:25 PDT
Attachment 259260 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/JSOptions.cpp:29:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/Options.cpp:379:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 2 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Mark Lam 2015-08-18 08:50:21 PDT
Comment on attachment 259260 [details]
fix 2: fixed some style issues.

Has bugs.  Will fix.  Cancelling review for now.
Comment 6 Geoffrey Garen 2015-08-18 10:09:37 PDT
Comment on attachment 259260 [details]
fix 2: fixed some style issues.

View in context: https://bugs.webkit.org/attachment.cgi?id=259260&action=review

> Source/JavaScriptCore/API/JSOptionsPrivate.h:56
> + @abstract Gets the JSC options in a string.
> + @result A pointer to a string of options.
> + @discussion When done, the user must call JSReleaseOptions to release the gotten options string.
> + */
> +JS_EXPORT const char* JSGetOptions();
> +
> +/*!
> + @function
> + @abstract Sets options specified in the options string.
> + @param options The options that will be applied.
> + */
> +JS_EXPORT void JSSetOption(const char* options);
> +
> +/*!
> + @function
> + @abstract Releases the previously saved JSOptions.
> + @param savedOptions The previously saved JSOptions.
> + */
> +JS_EXPORT void JSReleaseOptions(const char* savedOptions);
> +    

We shouldn't add API just for testing. Our testing code can use internal headers directly instead.
Comment 7 Mark Lam 2015-08-18 13:15:52 PDT
Created attachment 259293 [details]
fix 3: fixed previous bug in tests
Comment 8 WebKit Commit Bot 2015-08-18 13:17:48 PDT
Attachment 259293 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Options.cpp:379:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Mark Lam 2015-08-18 13:41:29 PDT
Created attachment 259294 [details]
fix 4: fixed builds.
Comment 10 WebKit Commit Bot 2015-08-18 13:43:08 PDT
Attachment 259294 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Options.cpp:379:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Saam Barati 2015-08-19 13:29:39 PDT
Comment on attachment 259294 [details]
fix 4: fixed builds.

View in context: https://bugs.webkit.org/attachment.cgi?id=259294&action=review

r=me

> Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp:120
> +        JSValueRef v = nullptr;

can we name this scriptResult or something better than "v"?
Comment 12 Mark Lam 2015-08-19 13:42:58 PDT
Thanks.  I've renamed "v" to "scriptResult" in the test as you suggested.

Landed in 188648: <http://trac.webkit.org/r188648>.
Comment 13 Brent Fulgham 2015-08-19 17:19:50 PDT
This introduced some Windows test failures

Starting 5 threads for CompareAndSwap test.  Test should complete without hanging.
   started Thread 0
   started Thread 1
   started Thread 2
Waiting for 5 threads to join
   started Thread 3
   finished Thread 2
   finished Thread 1
   finished Thread 3
   finished Thread 0
   started Thread 4
   finished Thread 4
PASS: CompareAndSwap test completed without a hang
PASS: returned private data when set by JSObjectSetPrivate().
PASS: returned null when accessing character pointer of a null String.
PASS: returned empty when accessing character pointer of an empty String.
PASS: returned 0 length for null String.
PASS: returned 0 length for empty String.
PASS: Set private property.
PASS: Did not allow JSObjectSetPrivateProperty on a non-API object.
PASS: Retrieved private property.
PASS: JSObjectGetPrivateProperty return NULL.
PASS: Cannot access private property through ordinary property lookup.
PASS: Private property does not appear to have been collected.
PASS: Set private property to NULL.
PASS: Retrieved private property.
PASS: Parsed null String as JSON correctly.
PASS: Parsed valid JSON string.
PASS: Correctly returned null for invalid JSON data.
PASS: Correctly serialised with indent of 0.
PASS: Correctly serialised with indent of 4.
PASS: returned null when attempting to serialize unserializable value.
PASS: returned null when attempting to serialize unserializable value.
PASS: set exception on serialisation error
PASS: globalStaticValue should be 3 and is.
PASS: globalStaticFunction() should be 4 and is.
PASS: this.globalStaticFunction() should be 4 and is.
PASS: globalStaticFunction2(); should be 10 and is.
PASS: globalStaticFunction2(); should be 20 and is.
PASS: this.globalStaticFunction2(); should be 20 and is.
PASS: iAmNotAStaticFunction(); should be 10 and is.
PASS: iAmNotAStaticFunction(); should be 20 and is.
PASS: typeof MyObject should be function and is.
PASS: MyObject.cantFind should be undefined and is.
PASS: MyObject.regularType should be 1 and is.
PASS: MyObject.alwaysOne should be 1 and is.
PASS: MyObject.cantDelete should be 1 and is.
PASS: delete MyObject.throwOnDelete should be an exception and is.
PASS: MyObject.cantSet should be undefined and is.
PASS: MyObject.throwOnGet should be an exception and is.
PASS: MyObject.throwOnSet = 5 should be an exception and is.
PASS: MyObject('throwOnCall') should be an exception and is.
PASS: new MyObject('throwOnConstruct') should be an exception and is.
PASS: 'throwOnHasInstance' instanceof MyObject should be an exception and is.
PASS: MyObject.nullGetForwardSet should be 1 and is.
PASS: MyObject.myPropertyName was enumerated
PASS: MyObject.regularType was enumerated
PASS: typeof alwaysOneDescriptor should be object and is.
PASS: alwaysOneDescriptor.value should be 1 and is.
PASS: alwaysOneDescriptor.configurable should be true and is.
PASS: alwaysOneDescriptor.enumerable should be false and is.
PASS: typeof cantFindDescriptor should be object and is.
PASS: cantFindDescriptor.value should be undefined and is.
PASS: cantFindDescriptor.configurable should be true and is.
PASS: cantFindDescriptor.enumerable should be false and is.
PASS: getting property descriptor of throwOnGet threw exception
PASS: typeof myPropertyNameDescriptor should be object and is.
PASS: myPropertyNameDescriptor.value should be 1 and is.
PASS: myPropertyNameDescriptor.configurable should be true and is.
PASS: myPropertyNameDescriptor.enumerable should be false and is.
PASS: getting property descriptor of hasPropertyLie threw exception
PASS: Object.getOwnPropertyDescriptor(MyObject, "doesNotExist") should be undefined and is.
PASS: delete MyObject.regularType should be true and is.
PASS: MyObject.regularType should be undefined and is.
PASS: MyObject(0) should be 1 and is.
PASS: MyObject() should be undefined and is.
PASS: typeof myObject should be object and is.
PASS: MyObject ? 1 : 0 should be true and is.
PASS: +MyObject should be 1 and is.
PASS: (Object.prototype.toString.call(MyObject)) should be [object MyObject] and is.
PASS: (MyObject.toString()) should be [object MyObject] and is.
PASS: String(MyObject) should be MyObjectAsString and is.
PASS: MyObject - 0 should be 1 and is.
PASS: MyObject.valueOf() should be 1 and is.
PASS: typeof MyConstructor should be object and is.
PASS: typeof constructedObject should be object and is.
PASS: constructedObject.value should be 1 and is.
PASS: myObject instanceof MyObject should be true and is.
PASS: (new Object()) instanceof MyObject should be false and is.
PASS: new MyBadConstructor() threw: TypeError: Type error
PASS: MyObject.nullGetSet should be 1 and is.
PASS: MyObject.nullCall() threw: ReferenceError: Static function property defined with NULL callAsFunction callback.
PASS: MyObject.hasPropertyLie threw: ReferenceError: hasProperty callback returned true for a property that doesn't exist.
PASS: derived instanceof Derived should be true and is.
PASS: derived instanceof Base should be true and is.
PASS: derived.baseProtoDup() should be 2 and is.
PASS: derived.baseProto() should be 1 and is.
PASS: derived.baseDup should be 2 and is.
PASS: derived.baseOnly should be 1 and is.
PASS: derived.protoOnly() should be 2 and is.
PASS: derived.protoDup should be 2 and is.
PASS: derived.derivedOnly should be 2 and is.
PASS: derived.baseHardNull() should be undefined and is.
PASS: derived.baseDup = 0 should be 2 and is.
PASS: derived.baseOnly = 0 should be 1 and is.
PASS: derived.derivedOnly = 0 should be 2 and is.
PASS: derived.protoDup = 0 should be 2 and is.
PASS: derived2 instanceof Derived2 should be true and is.
PASS: derived2 instanceof Derived should be true and is.
PASS: derived2 instanceof Base should be true and is.
PASS: derived2.baseProtoDup() should be 2 and is.
PASS: derived2.baseProto() should be 1 and is.
PASS: derived2.baseDup should be 2 and is.
PASS: derived2.baseOnly should be 1 and is.
PASS: derived2.protoOnly() should be 2 and is.
PASS: derived2.protoDup should be 2 and is.
PASS: derived2.derivedOnly should be 2 and is.
PASS: derived2.baseDup = 0 should be 2 and is.
PASS: derived2.baseOnly = 0 should be 1 and is.
PASS: derived2.derivedOnly = 0 should be 2 and is.
PASS: derived2.protoDup = 0 should be 2 and is.
PASS: Object.getOwnPropertyDescriptor(derived, "baseProto") should be undefined and is.
PASS: Object.getOwnPropertyDescriptor(derived, "baseProtoDup") should be undefined and is.
PASS: typeof baseDupDescriptor should be object and is.
PASS: baseDupDescriptor.value should be 2 and is.
PASS: baseDupDescriptor.configurable should be true and is.
PASS: baseDupDescriptor.enumerable should be false and is.
PASS: typeof baseOnlyDescriptor should be object and is.
PASS: baseOnlyDescriptor.value should be 1 and is.
PASS: baseOnlyDescriptor.configurable should be true and is.
PASS: baseOnlyDescriptor.enumerable should be false and is.
PASS: Object.getOwnPropertyDescriptor(derived, "protoOnly") should be undefined and is.
PASS: typeof protoDupDescriptor should be object and is.
PASS: protoDupDescriptor.value should be 2 and is.
PASS: protoDupDescriptor.configurable should be true and is.
PASS: protoDupDescriptor.enumerable should be false and is.
PASS: typeof derivedOnlyDescriptor should be object and is.
PASS: derivedOnlyDescriptor.value should be 2 and is.
PASS: derivedOnlyDescriptor.configurable should be true and is.
PASS: derivedOnlyDescriptor.enumerable should be false and is.
PASS: undefined instanceof MyObject should be false and is.
PASS: undefined instanceof EvilExceptionObject threw: RangeError: Maximum call stack size exceeded.
PASS: undefined instanceof EvilExceptionObject should be true and is.
PASS: EvilExceptionObject*5 threw: RangeError: Maximum call stack size exceeded.
PASS: String(EvilExceptionObject) threw: RangeError: Maximum call stack size exceeded.
PASS: console should be [object Console] and is.
PASS: typeof console.log should be function and is.
PASS: EmptyObject should be [object CallbackObject] and is.
PASS: PropertyCatchalls.x should be 4 and is.
PASS: x should be null and is.
PASS: PropertyCatchalls[make_throw]=1 threw: 5
PASS: PropertyCatchalls[make_throw]=1 threw: 5
PASS: y should be null and is.
PASS: z should be null and is.
PASS: Test script executed successfully.
PASS: Promise is exposed under JSContext API.
PASS: LLINT script timed out as expected.
PASS: LLINT TerminatedExecutionException was not catchable as expected.
PASS: LLINT script timed out as expected when no callback is specified.
PASS: LLINT script timeout was cancelled as expected.
PASS: LLINT script timeout was extended as expected.
PASS: Baseline script timed out as expected.
PASS: Baseline TerminatedExecutionException was not catchable as expected.
PASS: Baseline script timed out as expected when no callback is specified.
PASS: Baseline script timeout was cancelled as expected.
FAIL: Baseline script did not timeout.
PASS: DFG script timed out as expected.
PASS: DFG TerminatedExecutionException was not catchable as expected.
PASS: DFG script timed out as expected when no callback is specified.
PASS: DFG script timeout was cancelled as expected.
FAIL: DFG script did not timeout.
PASS: FTL script timed out as expected.
PASS: FTL TerminatedExecutionException was not catchable as expected.
PASS: FTL script timed out as expected when no callback is specified.
PASS: FTL script timeout was cancelled as expected.
FAIL: FTL script did not timeout.
PASS: JSGlobalContextRef called its JSClassRef finalizer as expected.
PASS: Infinite prototype chain does not occur.
PASS: A cycle in a prototype chain can't be created.
PASS: throwException did not crash when handling an error with appendMessageToError set and no codeBlock available.
PASS: global context name behaves as expected.
FAIL: Some tests failed.
testAPI completed with rc=256 (1)
program finished with exit code 1
elapsedTime=4.960808