Title: [144668] trunk/Source
Revision
144668
Author
[email protected]
Date
2013-03-04 13:47:29 -0800 (Mon, 04 Mar 2013)

Log Message

Remove contextInternalContext from JSContextInternal.h
https://bugs.webkit.org/show_bug.cgi?id=111356

Reviewed by Geoffrey Garen.

We don't need it any more since we have globalContextRef in JSContext.

Source/_javascript_Core:

* API/JSContext.mm:
* API/JSContextInternal.h:
* API/JSValue.mm:
(+[JSValue valueWithBool:inContext:]):
(+[JSValue valueWithDouble:inContext:]):
(+[JSValue valueWithInt32:inContext:]):
(+[JSValue valueWithUInt32:inContext:]):
(+[JSValue valueWithNewObjectInContext:]):
(+[JSValue valueWithNewArrayInContext:]):
(+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]):
(+[JSValue valueWithNewErrorFromMessage:inContext:]):
(+[JSValue valueWithNullInContext:]):
(+[JSValue valueWithUndefinedInContext:]):
(-[JSValue toBool]):
(-[JSValue toDouble]):
(-[JSValue toNumber]):
(-[JSValue toString]):
(-[JSValue toDate]):
(-[JSValue toArray]):
(-[JSValue toDictionary]):
(-[JSValue valueForProperty:]):
(-[JSValue setValue:forProperty:]):
(-[JSValue deleteProperty:]):
(-[JSValue hasProperty:]):
(-[JSValue valueAtIndex:]):
(-[JSValue setValue:atIndex:]):
(-[JSValue isUndefined]):
(-[JSValue isNull]):
(-[JSValue isBoolean]):
(-[JSValue isNumber]):
(-[JSValue isString]):
(-[JSValue isObject]):
(-[JSValue isEqualToObject:]):
(-[JSValue isEqualWithTypeCoercionToObject:]):
(-[JSValue isInstanceOf:]):
(-[JSValue callWithArguments:]):
(-[JSValue constructWithArguments:]):
(-[JSValue invokeMethod:withArguments:]):
(valueToObject):
(objectToValueWithoutCopy):
(objectToValue):
(-[JSValue initWithValue:inContext:]):
(-[JSValue dealloc]):
(-[JSValue description]):
* API/JSWrapperMap.mm:
(createObjectWithCustomBrand):
(-[JSObjCClassInfo allocateConstructorAndPrototypeWithSuperClassInfo:]):
(-[JSObjCClassInfo wrapperForObject:]):
(-[JSWrapperMap jsWrapperForObject:]):
* API/ObjCCallbackFunction.mm:
(ObjCCallbackFunction::call):
(objCCallbackFunctionForInvocation):

Source/WebKit/mac:

* WebView/WebScriptWorld.mm:
(+[WebScriptWorld scriptWorldForJavaScriptContext:]):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSContext.mm (144667 => 144668)


--- trunk/Source/_javascript_Core/API/JSContext.mm	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/_javascript_Core/API/JSContext.mm	2013-03-04 21:47:29 UTC (rev 144668)
@@ -190,11 +190,6 @@
     return self;
 }
 
-JSGlobalContextRef contextInternalContext(JSContext *context)
-{
-    return context->m_context;
-}
-
 - (void)dealloc
 {
     [m_wrapperMap release];

Modified: trunk/Source/_javascript_Core/API/JSContextInternal.h (144667 => 144668)


--- trunk/Source/_javascript_Core/API/JSContextInternal.h	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/_javascript_Core/API/JSContextInternal.h	2013-03-04 21:47:29 UTC (rev 144668)
@@ -61,8 +61,6 @@
 
 - (id)initWithGlobalContextRef:(JSGlobalContextRef)context;
 
-JS_EXPORT_PRIVATE JSGlobalContextRef contextInternalContext(JSContext *);
-
 - (void)notifyException:(JSValueRef)exception;
 - (JSValue *)valueFromNotifyException:(JSValueRef)exception;
 - (BOOL)boolFromNotifyException:(JSValueRef)exception;

Modified: trunk/Source/_javascript_Core/API/JSValue.mm (144667 => 144668)


--- trunk/Source/_javascript_Core/API/JSValue.mm	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/_javascript_Core/API/JSValue.mm	2013-03-04 21:47:29 UTC (rev 144668)
@@ -69,62 +69,62 @@
 
 + (JSValue *)valueWithBool:(BOOL)value inContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSValueMakeBoolean(contextInternalContext(context), value) inContext:context];
+    return [JSValue valueWithValue:JSValueMakeBoolean([context globalContextRef], value) inContext:context];
 }
 
 + (JSValue *)valueWithDouble:(double)value inContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSValueMakeNumber(contextInternalContext(context), value) inContext:context];
+    return [JSValue valueWithValue:JSValueMakeNumber([context globalContextRef], value) inContext:context];
 }
 
 + (JSValue *)valueWithInt32:(int32_t)value inContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSValueMakeNumber(contextInternalContext(context), value) inContext:context];
+    return [JSValue valueWithValue:JSValueMakeNumber([context globalContextRef], value) inContext:context];
 }
 
 + (JSValue *)valueWithUInt32:(uint32_t)value inContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSValueMakeNumber(contextInternalContext(context), value) inContext:context];
+    return [JSValue valueWithValue:JSValueMakeNumber([context globalContextRef], value) inContext:context];
 }
 
 + (JSValue *)valueWithNewObjectInContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSObjectMake(contextInternalContext(context), 0, 0) inContext:context];
+    return [JSValue valueWithValue:JSObjectMake([context globalContextRef], 0, 0) inContext:context];
 }
 
 + (JSValue *)valueWithNewArrayInContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSObjectMakeArray(contextInternalContext(context), 0, NULL, 0) inContext:context];
+    return [JSValue valueWithValue:JSObjectMakeArray([context globalContextRef], 0, NULL, 0) inContext:context];
 }
 
 + (JSValue *)valueWithNewRegularExpressionFromPattern:(NSString *)pattern flags:(NSString *)flags inContext:(JSContext *)context
 {
     JSStringRef patternString = JSStringCreateWithCFString((CFStringRef)pattern);
     JSStringRef flagsString = JSStringCreateWithCFString((CFStringRef)flags);
-    JSValueRef arguments[2] = { JSValueMakeString(contextInternalContext(context), patternString), JSValueMakeString(contextInternalContext(context), flagsString) };
+    JSValueRef arguments[2] = { JSValueMakeString([context globalContextRef], patternString), JSValueMakeString([context globalContextRef], flagsString) };
     JSStringRelease(patternString);
     JSStringRelease(flagsString);
 
-    return [JSValue valueWithValue:JSObjectMakeRegExp(contextInternalContext(context), 2, arguments, 0) inContext:context];
+    return [JSValue valueWithValue:JSObjectMakeRegExp([context globalContextRef], 2, arguments, 0) inContext:context];
 }
 
 + (JSValue *)valueWithNewErrorFromMessage:(NSString *)message inContext:(JSContext *)context
 {
     JSStringRef string = JSStringCreateWithCFString((CFStringRef)message);
-    JSValueRef argument = JSValueMakeString(contextInternalContext(context), string);
+    JSValueRef argument = JSValueMakeString([context globalContextRef], string);
     JSStringRelease(string);
 
-    return [JSValue valueWithValue:JSObjectMakeError(contextInternalContext(context), 1, &argument, 0) inContext:context];
+    return [JSValue valueWithValue:JSObjectMakeError([context globalContextRef], 1, &argument, 0) inContext:context];
 }
 
 + (JSValue *)valueWithNullInContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSValueMakeNull(contextInternalContext(context)) inContext:context];
+    return [JSValue valueWithValue:JSValueMakeNull([context globalContextRef]) inContext:context];
 }
 
 + (JSValue *)valueWithUndefinedInContext:(JSContext *)context
 {
-    return [JSValue valueWithValue:JSValueMakeUndefined(contextInternalContext(context)) inContext:context];
+    return [JSValue valueWithValue:JSValueMakeUndefined([context globalContextRef]) inContext:context];
 }
 
 - (id)toObject
@@ -140,13 +140,13 @@
 
 - (BOOL)toBool
 {
-    return JSValueToBoolean(contextInternalContext(_context), m_value);
+    return JSValueToBoolean([_context globalContextRef], m_value);
 }
 
 - (double)toDouble
 {
     JSValueRef exception = 0;
-    double result = JSValueToNumber(contextInternalContext(_context), m_value, &exception);
+    double result = JSValueToNumber([_context globalContextRef], m_value, &exception);
     if (exception) {
         [_context notifyException:exception];
         return std::numeric_limits<double>::quiet_NaN();
@@ -168,7 +168,7 @@
 - (NSNumber *)toNumber
 {
     JSValueRef exception = 0;
-    id result = valueToNumber(contextInternalContext(_context), m_value, &exception);
+    id result = valueToNumber([_context globalContextRef], m_value, &exception);
     if (exception)
         [_context notifyException:exception];
     return result;
@@ -177,7 +177,7 @@
 - (NSString *)toString
 {
     JSValueRef exception = 0;
-    id result = valueToString(contextInternalContext(_context), m_value, &exception);
+    id result = valueToString([_context globalContextRef], m_value, &exception);
     if (exception)
         [_context notifyException:exception];
     return result;
@@ -186,7 +186,7 @@
 - (NSDate *)toDate
 {
     JSValueRef exception = 0;
-    id result = valueToDate(contextInternalContext(_context), m_value, &exception);
+    id result = valueToDate([_context globalContextRef], m_value, &exception);
     if (exception)
         [_context notifyException:exception];
     return result;
@@ -195,7 +195,7 @@
 - (NSArray *)toArray
 {
     JSValueRef exception = 0;
-    id result = valueToArray(contextInternalContext(_context), m_value, &exception);
+    id result = valueToArray([_context globalContextRef], m_value, &exception);
     if (exception)
         [_context notifyException:exception];
     return result;
@@ -204,7 +204,7 @@
 - (NSDictionary *)toDictionary
 {
     JSValueRef exception = 0;
-    id result = valueToDictionary(contextInternalContext(_context), m_value, &exception);
+    id result = valueToDictionary([_context globalContextRef], m_value, &exception);
     if (exception)
         [_context notifyException:exception];
     return result;
@@ -213,12 +213,12 @@
 - (JSValue *)valueForProperty:(NSString *)propertyName
 {
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
     JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName);
-    JSValueRef result = JSObjectGetProperty(contextInternalContext(_context), object, name, &exception);
+    JSValueRef result = JSObjectGetProperty([_context globalContextRef], object, name, &exception);
     JSStringRelease(name);
     if (exception)
         return [_context valueFromNotifyException:exception];
@@ -229,14 +229,14 @@
 - (void)setValue:(id)value forProperty:(NSString *)propertyName
 {
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception) {
         [_context notifyException:exception];
         return;
     }
 
     JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName);
-    JSObjectSetProperty(contextInternalContext(_context), object, name, objectToValue(_context, value), 0, &exception);
+    JSObjectSetProperty([_context globalContextRef], object, name, objectToValue(_context, value), 0, &exception);
     JSStringRelease(name);
     if (exception) {
         [_context notifyException:exception];
@@ -247,12 +247,12 @@
 - (BOOL)deleteProperty:(NSString *)propertyName
 {
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context boolFromNotifyException:exception];
 
     JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName);
-    BOOL result = JSObjectDeleteProperty(contextInternalContext(_context), object, name, &exception);
+    BOOL result = JSObjectDeleteProperty([_context globalContextRef], object, name, &exception);
     JSStringRelease(name);
     if (exception)
         return [_context boolFromNotifyException:exception];
@@ -263,12 +263,12 @@
 - (BOOL)hasProperty:(NSString *)propertyName
 {
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context boolFromNotifyException:exception];
 
     JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName);
-    BOOL result = JSObjectHasProperty(contextInternalContext(_context), object, name);
+    BOOL result = JSObjectHasProperty([_context globalContextRef], object, name);
     JSStringRelease(name);
     return result;
 }
@@ -286,11 +286,11 @@
         return [self valueForProperty:[[JSValue valueWithDouble:index inContext:_context] toString]];
 
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
-    JSValueRef result = JSObjectGetPropertyAtIndex(contextInternalContext(_context), object, (unsigned)index, &exception);
+    JSValueRef result = JSObjectGetPropertyAtIndex([_context globalContextRef], object, (unsigned)index, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
@@ -305,13 +305,13 @@
         return [self setValue:value forProperty:[[JSValue valueWithDouble:index inContext:_context] toString]];
 
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception) {
         [_context notifyException:exception];
         return;
     }
 
-    JSObjectSetPropertyAtIndex(contextInternalContext(_context), object, (unsigned)index, objectToValue(_context, value), &exception);
+    JSObjectSetPropertyAtIndex([_context globalContextRef], object, (unsigned)index, objectToValue(_context, value), &exception);
     if (exception) {
         [_context notifyException:exception];
         return;
@@ -320,43 +320,43 @@
 
 - (BOOL)isUndefined
 {
-    return JSValueIsUndefined(contextInternalContext(_context), m_value);
+    return JSValueIsUndefined([_context globalContextRef], m_value);
 }
 
 - (BOOL)isNull
 {
-    return JSValueIsNull(contextInternalContext(_context), m_value);
+    return JSValueIsNull([_context globalContextRef], m_value);
 }
 
 - (BOOL)isBoolean
 {
-    return JSValueIsBoolean(contextInternalContext(_context), m_value);
+    return JSValueIsBoolean([_context globalContextRef], m_value);
 }
 
 - (BOOL)isNumber
 {
-    return JSValueIsNumber(contextInternalContext(_context), m_value);
+    return JSValueIsNumber([_context globalContextRef], m_value);
 }
 
 - (BOOL)isString
 {
-    return JSValueIsString(contextInternalContext(_context), m_value);
+    return JSValueIsString([_context globalContextRef], m_value);
 }
 
 - (BOOL)isObject
 {
-    return JSValueIsObject(contextInternalContext(_context), m_value);
+    return JSValueIsObject([_context globalContextRef], m_value);
 }
 
 - (BOOL)isEqualToObject:(id)value
 {
-    return JSValueIsStrictEqual(contextInternalContext(_context), m_value, objectToValue(_context, value));
+    return JSValueIsStrictEqual([_context globalContextRef], m_value, objectToValue(_context, value));
 }
 
 - (BOOL)isEqualWithTypeCoercionToObject:(id)value
 {
     JSValueRef exception = 0;
-    BOOL result = JSValueIsEqual(contextInternalContext(_context), m_value, objectToValue(_context, value), &exception);
+    BOOL result = JSValueIsEqual([_context globalContextRef], m_value, objectToValue(_context, value), &exception);
     if (exception)
         return [_context boolFromNotifyException:exception];
 
@@ -366,11 +366,11 @@
 - (BOOL)isInstanceOf:(id)value
 {
     JSValueRef exception = 0;
-    JSObjectRef constructor = JSValueToObject(contextInternalContext(_context), objectToValue(_context, value), &exception);
+    JSObjectRef constructor = JSValueToObject([_context globalContextRef], objectToValue(_context, value), &exception);
     if (exception)
         return [_context boolFromNotifyException:exception];
 
-    BOOL result = JSValueIsInstanceOfConstructor(contextInternalContext(_context), m_value, constructor, &exception);
+    BOOL result = JSValueIsInstanceOfConstructor([_context globalContextRef], m_value, constructor, &exception);
     if (exception)
         return [_context boolFromNotifyException:exception];
 
@@ -385,11 +385,11 @@
         arguments[i] = objectToValue(_context, [argumentArray objectAtIndex:i]);
 
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
-    JSValueRef result = JSObjectCallAsFunction(contextInternalContext(_context), object, 0, argumentCount, arguments, &exception);
+    JSValueRef result = JSObjectCallAsFunction([_context globalContextRef], object, 0, argumentCount, arguments, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
@@ -404,11 +404,11 @@
         arguments[i] = objectToValue(_context, [argumentArray objectAtIndex:i]);
 
     JSValueRef exception = 0;
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
-    JSObjectRef result = JSObjectCallAsConstructor(contextInternalContext(_context), object, argumentCount, arguments, &exception);
+    JSObjectRef result = JSObjectCallAsConstructor([_context globalContextRef], object, argumentCount, arguments, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
@@ -423,21 +423,21 @@
         argumentArray[i] = objectToValue(_context, [arguments objectAtIndex:i]);
 
     JSValueRef exception = 0;
-    JSObjectRef thisObject = JSValueToObject(contextInternalContext(_context), m_value, &exception);
+    JSObjectRef thisObject = JSValueToObject([_context globalContextRef], m_value, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
     JSStringRef name = JSStringCreateWithCFString((CFStringRef)method);
-    JSValueRef function = JSObjectGetProperty(contextInternalContext(_context), thisObject, name, &exception);
+    JSValueRef function = JSObjectGetProperty([_context globalContextRef], thisObject, name, &exception);
     JSStringRelease(name);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
-    JSObjectRef object = JSValueToObject(contextInternalContext(_context), function, &exception);
+    JSObjectRef object = JSValueToObject([_context globalContextRef], function, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
-    JSValueRef result = JSObjectCallAsFunction(contextInternalContext(_context), object, thisObject, argumentCount, argumentArray, &exception);
+    JSValueRef result = JSObjectCallAsFunction([_context globalContextRef], object, thisObject, argumentCount, argumentArray, &exception);
     if (exception)
         return [_context valueFromNotifyException:exception];
 
@@ -710,10 +710,10 @@
 
 id valueToObject(JSContext *context, JSValueRef value)
 {
-    JSContainerConvertor::Task result = valueToObjectWithoutCopy(contextInternalContext(context), value);
+    JSContainerConvertor::Task result = valueToObjectWithoutCopy([context globalContextRef], value);
     if (result.type == ContainerNone)
         return result.objc;
-    return containerValueToObject(contextInternalContext(context), result);
+    return containerValueToObject([context globalContextRef], result);
 }
 
 id valueToNumber(JSGlobalContextRef context, JSValueRef value, JSValueRef* exception)
@@ -856,7 +856,7 @@
 
 static ObjcContainerConvertor::Task objectToValueWithoutCopy(JSContext *context, id object)
 {
-    JSGlobalContextRef contextRef = contextInternalContext(context);
+    JSGlobalContextRef contextRef = [context globalContextRef];
 
     if (!object)
         return (ObjcContainerConvertor::Task){ object, JSValueMakeUndefined(contextRef), ContainerNone };
@@ -899,7 +899,7 @@
 
 JSValueRef objectToValue(JSContext *context, id object)
 {
-    JSGlobalContextRef contextRef = contextInternalContext(context);
+    JSGlobalContextRef contextRef = [context globalContextRef];
 
     ObjcContainerConvertor::Task task = objectToValueWithoutCopy(context, object);
     if (task.type == ContainerNone)
@@ -957,7 +957,7 @@
     ASSERT(value);
     _context = [context retain];
     m_value = value;
-    JSValueProtect(contextInternalContext(_context), m_value);
+    JSValueProtect([_context globalContextRef], m_value);
     return self;
 }
 
@@ -1075,7 +1075,7 @@
 
 - (void)dealloc
 {
-    JSValueUnprotect(contextInternalContext(_context), m_value);
+    JSValueUnprotect([_context globalContextRef], m_value);
     [_context release];
     _context = nil;
     [super dealloc];
@@ -1083,7 +1083,7 @@
 
 - (NSString *)description
 {
-    if (id wrapped = tryUnwrapObjcObject(contextInternalContext(_context), m_value))
+    if (id wrapped = tryUnwrapObjcObject([_context globalContextRef], m_value))
         return [wrapped description];
     return [self toString];
 }

Modified: trunk/Source/_javascript_Core/API/JSWrapperMap.mm (144667 => 144668)


--- trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2013-03-04 21:47:29 UTC (rev 144668)
@@ -124,7 +124,7 @@
     definition.className = [brand UTF8String];
     definition.parentClass = parentClass;
     JSClassRef classRef = JSClassCreate(&definition);
-    JSObjectRef result = JSObjectMake(contextInternalContext(context), classRef, privateData);
+    JSObjectRef result = JSObjectMake([context globalContextRef], classRef, privateData);
     JSClassRelease(classRef);
     return [[JSValue alloc] initWithValue:result inContext:context];
 }
@@ -343,7 +343,7 @@
     ASSERT(!m_constructor || !m_prototype);
     ASSERT((m_class == [NSObject class]) == !superClassInfo);
     if (!superClassInfo) {
-        JSContextRef cContext = contextInternalContext(m_context);
+        JSContextRef cContext = [m_context globalContextRef];
         JSValue *constructor = m_context[@"Object"];
         if (!m_constructor)
             m_constructor = toJS(JSValueToObject(cContext, valueInternalValue(constructor), 0));
@@ -368,7 +368,7 @@
         else
             constructor = createObjectWithCustomBrand(m_context, [NSString stringWithFormat:@"%sConstructor", className], wrapperClass(), [m_class retain]);
 
-        JSContextRef cContext = contextInternalContext(m_context);
+        JSContextRef cContext = [m_context globalContextRef];
         m_prototype = toJS(JSValueToObject(cContext, valueInternalValue(prototype), 0));
         m_constructor = toJS(JSValueToObject(cContext, valueInternalValue(constructor), 0));
 
@@ -382,7 +382,7 @@
         });
 
         // Set [Prototype].
-        JSObjectSetPrototype(contextInternalContext(m_context), toRef(m_prototype.get()), toRef(superClassInfo->m_prototype.get()));
+        JSObjectSetPrototype([m_context globalContextRef], toRef(m_prototype.get()), toRef(superClassInfo->m_prototype.get()));
 
         [constructor release];
         [prototype release];
@@ -407,8 +407,8 @@
         [self reallocateConstructorAndOrPrototype];
     ASSERT(!!m_prototype);
 
-    JSObjectRef wrapper = JSObjectMake(contextInternalContext(m_context), m_classRef, [object retain]);
-    JSObjectSetPrototype(contextInternalContext(m_context), wrapper, toRef(m_prototype.get()));
+    JSObjectRef wrapper = JSObjectMake([m_context globalContextRef], m_classRef, [object retain]);
+    JSObjectSetPrototype([m_context globalContextRef], wrapper, toRef(m_prototype.get()));
     return [JSValue valueWithValue:wrapper inContext:m_context];
 }
 
@@ -485,7 +485,7 @@
     // (1) For immortal objects JSValues will effectively leak and this results in error output being logged - we should avoid adding associated objects to immortal objects.
     // (2) A long lived object may rack up many JSValues. When the contexts are released these will unprotect the associated _javascript_ objects,
     //     but still, would probably nicer if we made it so that only one associated object was required, broadcasting object dealloc.
-    JSC::ExecState* exec = toJS(contextInternalContext(m_context));
+    JSC::ExecState* exec = toJS([m_context globalContextRef]);
     jsWrapper = toJS(exec, valueInternalValue(wrapper)).toObject(exec);
     m_cachedJSWrappers.set(object, jsWrapper);
     return wrapper;

Modified: trunk/Source/_javascript_Core/API/ObjCCallbackFunction.mm (144667 => 144668)


--- trunk/Source/_javascript_Core/API/ObjCCallbackFunction.mm	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/_javascript_Core/API/ObjCCallbackFunction.mm	2013-03-04 21:47:29 UTC (rev 144668)
@@ -57,7 +57,7 @@
 class CallbackArgumentBoolean : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef*) override
     {
-        bool value = JSValueToBoolean(contextInternalContext(context), argument);
+        bool value = JSValueToBoolean([context globalContextRef], argument);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -66,7 +66,7 @@
 class CallbackArgumentInteger : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        T value = (T)JSC::toInt32(JSValueToNumber(contextInternalContext(context), argument, exception));
+        T value = (T)JSC::toInt32(JSValueToNumber([context globalContextRef], argument, exception));
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -75,7 +75,7 @@
 class CallbackArgumentDouble : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        T value = (T)JSValueToNumber(contextInternalContext(context), argument, exception);
+        T value = (T)JSValueToNumber([context globalContextRef], argument, exception);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -113,7 +113,7 @@
 
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        JSGlobalContextRef contextRef = contextInternalContext(context);
+        JSGlobalContextRef contextRef = [context globalContextRef];
 
         id object = tryUnwrapObjcObject(contextRef, argument);
         if (object && [object isKindOfClass:m_class]) {
@@ -136,7 +136,7 @@
 class CallbackArgumentNSNumber : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        id value = valueToNumber(contextInternalContext(context), argument, exception);
+        id value = valueToNumber([context globalContextRef], argument, exception);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -144,7 +144,7 @@
 class CallbackArgumentNSString : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        id value = valueToString(contextInternalContext(context), argument, exception);
+        id value = valueToString([context globalContextRef], argument, exception);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -152,7 +152,7 @@
 class CallbackArgumentNSDate : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        id value = valueToDate(contextInternalContext(context), argument, exception);
+        id value = valueToDate([context globalContextRef], argument, exception);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -160,7 +160,7 @@
 class CallbackArgumentNSArray : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        id value = valueToArray(contextInternalContext(context), argument, exception);
+        id value = valueToArray([context globalContextRef], argument, exception);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -168,7 +168,7 @@
 class CallbackArgumentNSDictionary : public CallbackArgument {
     virtual void set(NSInvocation *invocation, NSInteger argumentNumber, JSContext *context, JSValueRef argument, JSValueRef* exception) override
     {
-        id value = valueToDictionary(contextInternalContext(context), argument, exception);
+        id value = valueToDictionary([context globalContextRef], argument, exception);
         [invocation setArgument:&value atIndex:argumentNumber];
     }
 };
@@ -275,7 +275,7 @@
 class CallbackResultVoid : public CallbackResult {
     virtual JSValueRef get(NSInvocation *, JSContext *context, JSValueRef*) override
     {
-        return JSValueMakeUndefined(contextInternalContext(context));
+        return JSValueMakeUndefined([context globalContextRef]);
     }
 };
 
@@ -294,7 +294,7 @@
     {
         T value;
         [invocation getReturnValue:&value];
-        return JSValueMakeNumber(contextInternalContext(context), value);
+        return JSValueMakeNumber([context globalContextRef], value);
     }
 };
 
@@ -303,7 +303,7 @@
     {
         bool value;
         [invocation getReturnValue:&value];
-        return JSValueMakeBoolean(contextInternalContext(context), value);
+        return JSValueMakeBoolean([context globalContextRef], value);
     }
 };
 
@@ -489,7 +489,7 @@
 
 JSValueRef ObjCCallbackFunction::call(JSContext *context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
-    JSGlobalContextRef contextRef = contextInternalContext(context);
+    JSGlobalContextRef contextRef = [context globalContextRef];
 
     size_t firstArgument;
     switch (m_type) {
@@ -582,10 +582,10 @@
     // The result should be a regular host function, rather than a callable C API object.
     // Patch in the right length & [Prototype] values for now, but should fix this.
     // Function.prototype.toString currently fails, since this is not yet a subclass of functon, but call & apply do work.
-    JSObjectRef functionObject = JSObjectMake(contextInternalContext(context), objCCallbackFunctionClass(), new ObjCCallbackFunction(context, invocation, type, instanceClass, arguments.release(), result.release()));
+    JSObjectRef functionObject = JSObjectMake([context globalContextRef], objCCallbackFunctionClass(), new ObjCCallbackFunction(context, invocation, type, instanceClass, arguments.release(), result.release()));
     JSValue *value = [JSValue valueWithValue:functionObject inContext:context];
     value[@"length"] = @(argumentCount);
-    JSObjectSetPrototype(contextInternalContext(context), functionObject, valueInternalValue(context[@"Function"][@"prototype"]));
+    JSObjectSetPrototype([context globalContextRef], functionObject, valueInternalValue(context[@"Function"][@"prototype"]));
     value[@"toString"] = [context evaluateScript:@"(function(){ return '"
         "function <Objective-C>() {" "\\n"
         "    [native code]"          "\\n"

Modified: trunk/Source/_javascript_Core/ChangeLog (144667 => 144668)


--- trunk/Source/_javascript_Core/ChangeLog	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-03-04 21:47:29 UTC (rev 144668)
@@ -1,3 +1,65 @@
+2013-03-04  Mark Hahnenberg  <[email protected]>
+
+        Remove contextInternalContext from JSContextInternal.h
+        https://bugs.webkit.org/show_bug.cgi?id=111356
+
+        Reviewed by Geoffrey Garen.
+
+        We don't need it any more since we have globalContextRef in JSContext.
+
+        * API/JSContext.mm:
+        * API/JSContextInternal.h:
+        * API/JSValue.mm:
+        (+[JSValue valueWithBool:inContext:]):
+        (+[JSValue valueWithDouble:inContext:]):
+        (+[JSValue valueWithInt32:inContext:]):
+        (+[JSValue valueWithUInt32:inContext:]):
+        (+[JSValue valueWithNewObjectInContext:]):
+        (+[JSValue valueWithNewArrayInContext:]):
+        (+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]):
+        (+[JSValue valueWithNewErrorFromMessage:inContext:]):
+        (+[JSValue valueWithNullInContext:]):
+        (+[JSValue valueWithUndefinedInContext:]):
+        (-[JSValue toBool]):
+        (-[JSValue toDouble]):
+        (-[JSValue toNumber]):
+        (-[JSValue toString]):
+        (-[JSValue toDate]):
+        (-[JSValue toArray]):
+        (-[JSValue toDictionary]):
+        (-[JSValue valueForProperty:]):
+        (-[JSValue setValue:forProperty:]):
+        (-[JSValue deleteProperty:]):
+        (-[JSValue hasProperty:]):
+        (-[JSValue valueAtIndex:]):
+        (-[JSValue setValue:atIndex:]):
+        (-[JSValue isUndefined]):
+        (-[JSValue isNull]):
+        (-[JSValue isBoolean]):
+        (-[JSValue isNumber]):
+        (-[JSValue isString]):
+        (-[JSValue isObject]):
+        (-[JSValue isEqualToObject:]):
+        (-[JSValue isEqualWithTypeCoercionToObject:]):
+        (-[JSValue isInstanceOf:]):
+        (-[JSValue callWithArguments:]):
+        (-[JSValue constructWithArguments:]):
+        (-[JSValue invokeMethod:withArguments:]):
+        (valueToObject):
+        (objectToValueWithoutCopy):
+        (objectToValue):
+        (-[JSValue initWithValue:inContext:]):
+        (-[JSValue dealloc]):
+        (-[JSValue description]):
+        * API/JSWrapperMap.mm:
+        (createObjectWithCustomBrand):
+        (-[JSObjCClassInfo allocateConstructorAndPrototypeWithSuperClassInfo:]):
+        (-[JSObjCClassInfo wrapperForObject:]):
+        (-[JSWrapperMap jsWrapperForObject:]):
+        * API/ObjCCallbackFunction.mm:
+        (ObjCCallbackFunction::call):
+        (objCCallbackFunctionForInvocation):
+
 2013-03-04  Andreas Kling  <[email protected]>
 
         Add simple vector traits for JSC::Identifier.

Modified: trunk/Source/WebKit/mac/ChangeLog (144667 => 144668)


--- trunk/Source/WebKit/mac/ChangeLog	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-03-04 21:47:29 UTC (rev 144668)
@@ -1,3 +1,15 @@
+2013-03-04  Mark Hahnenberg  <[email protected]>
+
+        Remove contextInternalContext from JSContextInternal.h
+        https://bugs.webkit.org/show_bug.cgi?id=111356
+
+        Reviewed by Geoffrey Garen.
+
+        We don't need it any more since we have globalContextRef in JSContext.
+
+        * WebView/WebScriptWorld.mm:
+        (+[WebScriptWorld scriptWorldForJavaScriptContext:]):
+
 2013-03-04  Laszlo Gombos  <[email protected]>
 
         JSC_OBJC_API_ENABLED should be removed from FeatureDefines.h

Modified: trunk/Source/WebKit/mac/WebView/WebScriptWorld.mm (144667 => 144668)


--- trunk/Source/WebKit/mac/WebView/WebScriptWorld.mm	2013-03-04 21:44:07 UTC (rev 144667)
+++ trunk/Source/WebKit/mac/WebView/WebScriptWorld.mm	2013-03-04 21:47:29 UTC (rev 144668)
@@ -110,7 +110,7 @@
 #if JSC_OBJC_API_ENABLED
 + (WebScriptWorld *)scriptWorldForJavaScriptContext:(JSContext *)context
 {
-    return [self scriptWorldForGlobalContext:contextInternalContext(context)];
+    return [self scriptWorldForGlobalContext:[context globalContextRef]];
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to