Changeset 121817 in webkit
- Timestamp:
- Jul 3, 2012 5:23:35 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121813 r121817 1 2012-07-03 Joshua Bell <jsbell@chromium.org> 2 3 Binding: IDL type DOMString[] shouldn't match null 4 https://bugs.webkit.org/show_bug.cgi?id=84217 5 6 Reviewed by Kentaro Hara. 7 8 Similar to r121714, IDL overloads with T[] (which is only minimally supported) 9 were being treated as Nullable by default during overloaded method dispatching, 10 which deviates from the WebIDL specification. Extend the previous change to 11 look for Nullable (specified by "?" type suffix in the IDL) for array types. 12 13 Also, after inspection of the spec, use a strict "is this an Array?" test in 14 the JS generator rather than an "inherits from Array.prototype?" test, to 15 match the WebIDL spec. 16 17 IDL files with affected overloads are modified to include the "?" suffix 18 so that no behavior changes are introduced by this patch - the JS and V8 19 generator results before/after the change show no diffs apart from the stricter 20 isJSArray() test. 21 22 Test: bindings/scripts/test/TestObj.idl (a non-Nullable T[] overload) 23 24 * Modules/indexeddb/IDBDatabase.idl: Tag T[] overloads with ? suffix. 25 * Modules/indexeddb/IDBObjectStore.idl: Ditto. 26 * Modules/vibration/NavigatorVibration.idl: Ditto. 27 * bindings/scripts/CodeGeneratorJS.pm: Check isNullable for T[]. 28 (GenerateParametersCheckExpression): 29 * bindings/scripts/CodeGeneratorV8.pm: Ditto. 30 (GenerateParametersCheckExpression): 31 * bindings/scripts/test/JS/JSTestObj.cpp: Rebaselined. 32 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9): 33 (WebCore): 34 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): 35 * bindings/scripts/test/TestObj.idl: Tag existing T[] with ?, add non-? T[]. 36 * bindings/scripts/test/V8/V8TestObj.cpp: Rebaselined. 37 (WebCore::TestObjV8Internal::overloadedMethod9Callback): 38 (TestObjV8Internal): 39 (WebCore::TestObjV8Internal::overloadedMethodCallback): 40 1 41 2012-07-03 Nate Chapin <japhet@chromium.org> 2 42 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl
r121714 r121817 48 48 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList? storeNames, in [Optional=DefaultIsNullString] DOMString mode) 49 49 raises (IDBDatabaseException); 50 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in [Optional=DefaultIsNullString] DOMString mode)50 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[]? storeNames, in [Optional=DefaultIsNullString] DOMString mode) 51 51 raises (IDBDatabaseException); 52 52 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString storeName, in [Optional=DefaultIsNullString] DOMString mode) … … 56 56 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList? storeNames, in unsigned short mode) 57 57 raises (IDBDatabaseException); 58 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in unsigned short mode)58 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[]? storeNames, in unsigned short mode) 59 59 raises (IDBDatabaseException); 60 60 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString storeName, in unsigned short mode) -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
r121714 r121817 60 60 raises (IDBDatabaseException); 61 61 62 IDBIndex createIndex(in DOMString name, in DOMString[] keyPath, in [Optional] Dictionary options)62 IDBIndex createIndex(in DOMString name, in DOMString[]? keyPath, in [Optional] Dictionary options) 63 63 raises (IDBDatabaseException); 64 64 IDBIndex createIndex(in DOMString name, in DOMString keyPath, in [Optional] Dictionary options) -
trunk/Source/WebCore/Modules/vibration/NavigatorVibration.idl
r108272 r121817 24 24 Supplemental=Navigator 25 25 ] NavigatorVibration { 26 void webkitVibrate(in unsigned long[] pattern) raises(DOMException);26 void webkitVibrate(in unsigned long[]? pattern) raises(DOMException); 27 27 void webkitVibrate(in unsigned long time) raises(DOMException); 28 28 }; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r121714 r121817 1261 1261 } elsif (IsArrayType($type)) { 1262 1262 # FIXME: Add proper support for T[], T[]?, sequence<T> 1263 push(@andExpression, "(${value}.isNull() || (${value}.isObject() && asObject(${value})->inherits(&JSArray::s_info)))"); 1263 if ($parameter->isNullable) { 1264 push(@andExpression, "(${value}.isNull() || (${value}.isObject() && isJSArray(${value})))"); 1265 } else { 1266 push(@andExpression, "(${value}.isObject() && isJSArray(${value}))"); 1267 } 1264 1268 $usedArguments{$parameterIndex} = 1; 1265 1269 } elsif (!IsNativeType($type)) { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r121714 r121817 1358 1358 } elsif (IsArrayType($type)) { 1359 1359 # FIXME: Add proper support for T[], T[]?, sequence<T>. 1360 push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())"); 1360 if ($parameter->isNullable) { 1361 push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())"); 1362 } else { 1363 push(@andExpression, "(${value}->IsArray())"); 1364 } 1361 1365 } elsif (IsWrapperType($type)) { 1362 1366 if ($parameter->isNullable) { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r121714 r121817 2161 2161 } 2162 2162 2163 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod9(ExecState* exec) 2164 { 2165 JSValue thisValue = exec->hostThisValue(); 2166 if (!thisValue.inherits(&JSTestObj::s_info)) 2167 return throwVMTypeError(exec); 2168 JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); 2169 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); 2170 TestObj* impl = static_cast<TestObj*>(castedThis->impl()); 2171 if (exec->argumentCount() < 1) 2172 return throwVMError(exec, createNotEnoughArgumentsError(exec)); 2173 RefPtr<DOMStringList> arrayArg(toDOMStringList(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); 2174 if (exec->hadException()) 2175 return JSValue::encode(jsUndefined()); 2176 impl->overloadedMethod(arrayArg); 2177 return JSValue::encode(jsUndefined()); 2178 } 2179 2163 2180 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) 2164 2181 { … … 2178 2195 if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(&JSDOMStringList::s_info))))) 2179 2196 return jsTestObjPrototypeFunctionOverloadedMethod6(exec); 2180 if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(&JSArray::s_info)))))2197 if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && isJSArray(arg0))))) 2181 2198 return jsTestObjPrototypeFunctionOverloadedMethod7(exec); 2182 2199 if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(&JSTestObj::s_info)))) 2183 2200 return jsTestObjPrototypeFunctionOverloadedMethod8(exec); 2201 if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0)))) 2202 return jsTestObjPrototypeFunctionOverloadedMethod9(exec); 2184 2203 return throwVMTypeError(exec); 2185 2204 } -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r121714 r121817 170 170 void overloadedMethod(in [Callback] TestCallback callback); 171 171 void overloadedMethod(in DOMStringList? listArg); 172 void overloadedMethod(in DOMString[]? arrayArg); 173 void overloadedMethod(in TestObj objArg); 172 174 void overloadedMethod(in DOMString[] arrayArg); 173 void overloadedMethod(in TestObj objArg);174 175 #endif 175 176 -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r121714 r121817 1583 1583 } 1584 1584 1585 static v8::Handle<v8::Value> overloadedMethod9Callback(const v8::Arguments& args) 1586 { 1587 INC_STATS("DOM.TestObj.overloadedMethod9"); 1588 if (args.Length() < 1) 1589 return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); 1590 TestObj* imp = V8TestObj::toNative(args.Holder()); 1591 EXCEPTION_BLOCK(RefPtr<DOMStringList>, arrayArg, v8ValueToWebCoreDOMStringList(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); 1592 imp->overloadedMethod(arrayArg); 1593 return v8::Handle<v8::Value>(); 1594 } 1595 1585 1596 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args) 1586 1597 { … … 1602 1613 if ((args.Length() == 1 && (V8TestObj::HasInstance(args[0])))) 1603 1614 return overloadedMethod8Callback(args); 1615 if ((args.Length() == 1 && (args[0]->IsArray()))) 1616 return overloadedMethod9Callback(args); 1604 1617 return V8Proxy::throwTypeError(0, args.GetIsolate()); 1605 1618 }
Note: See TracChangeset
for help on using the changeset viewer.