Changeset 222175 in webkit for trunk/Source/JavaScriptCore/API
- Timestamp:
- Sep 18, 2017, 1:06:34 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore/API
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r222017 r222175 268 268 JSObject* jsObject = toJS(object); 269 269 JSValue jsValue = toJS(exec, value); 270 271 if (JSProxy* proxy = jsDynamicCast<JSProxy*>(vm, jsObject)) {272 if (JSGlobalObject* globalObject = jsDynamicCast<JSGlobalObject*>(vm, proxy->target())) {273 globalObject->resetPrototype(vm, jsValue.isObject() ? jsValue : jsNull());274 return;275 }276 // Someday we might use proxies for something other than JSGlobalObjects, but today is not that day.277 RELEASE_ASSERT_NOT_REACHED();278 }279 270 jsObject->setPrototype(vm, exec, jsValue.isObject() ? jsValue : jsNull()); 271 handleExceptionIfNeeded(exec, nullptr); 280 272 } 281 273 -
trunk/Source/JavaScriptCore/API/tests/CustomGlobalObjectClassTest.c
r216914 r222175 111 111 JSObjectRef object = JSContextGetGlobalObject(context); 112 112 113 JSValueRef originalPrototype = JSObjectGetPrototype(context, object); 113 114 JSObjectRef above = JSObjectMake(context, 0, 0); 114 JSStringRef test = JSStringCreateWithUTF8CString("test");115 JSValueRef value = JSValueMakeString(context, test);116 JSObjectSetProperty(context, above, test, value, kJSPropertyAttributeDontEnum, 0);117 118 115 JSObjectSetPrototype(context, object, above); 119 JSStringRef script = JSStringCreateWithUTF8CString("test === \"test\""); 120 JSValueRef result = JSEvaluateScript(context, script, 0, 0, 0, 0); 121 122 assertTrue(JSValueToBoolean(context, result), "test === \"test\""); 123 124 JSStringRelease(test); 125 JSStringRelease(script); 116 JSValueRef prototypeAfterChangingAttempt = JSObjectGetPrototype(context, object); 117 assertTrue(JSValueIsStrictEqual(context, prototypeAfterChangingAttempt, originalPrototype), "Global object's [[Prototype]] cannot be changed after instantiating it"); 126 118 } 127 119
Note:
See TracChangeset
for help on using the changeset viewer.