Changeset 95203 in webkit
- Timestamp:
- Sep 15, 2011 11:27:48 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95196 r95203 1 2011-09-14 Sam Weinig <sam@webkit.org> 2 3 Experiment with removing ability to call a collection (except document.all) 4 https://bugs.webkit.org/show_bug.cgi?id=67579 5 6 Reviewed by Anders Carlsson. 7 8 * fast/dom/Element/id-in-formcollection-expected.txt: 9 * fast/dom/Element/id-in-formcollection.html: 10 * fast/dom/HTMLOptionElement/collection-setter-getter-expected.txt: 11 * fast/dom/HTMLOptionElement/collection-setter-getter.html: 12 Don't use call syntax for tests that aren't explicitly testing it. 13 14 * fast/dom/NodeList/nodelist-item-call-as-function-expected.txt: 15 * fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js: 16 Update test to show that we throw on call. 17 18 * fast/profiler/call-nodelist-as-function-expected.txt: Removed. 19 * fast/profiler/call-nodelist-as-function.html: Removed. 20 Remove test of removed feature. 21 1 22 2011-09-15 David Levin <levin@chromium.org> 2 23 -
trunk/LayoutTests/fast/dom/Element/id-in-formcollection-expected.txt
r52312 r95203 4 4 5 5 6 PASS elems ("ids1",1).getAttribute("name") is "name2"6 PASS elems["ids1"][1].getAttribute("name") is "name2" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/fast/dom/Element/id-in-formcollection.html
r52312 r95203 17 17 18 18 var elems = document.getElementById("idf1").elements; 19 shouldBe('elems ("ids1",1).getAttribute("name")', '"name2"');19 shouldBe('elems["ids1"][1].getAttribute("name")', '"name2"'); 20 20 21 21 var successfullyParsed = true; -
trunk/LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter-expected.txt
r38633 r95203 5 5 6 6 PASS my_form.set_sel.options.length is 3 7 PASS options (0)is document.getElementById('one')8 PASS options (1)is document.getElementById('two')7 PASS options[0] is document.getElementById('one') 8 PASS options[1] is document.getElementById('two') 9 9 PASS successfullyParsed is true 10 10 -
trunk/LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html
r38633 r95203 27 27 28 28 var options = document.my_form.get_sel.options; 29 shouldBe("options (0)", "document.getElementById('one')");30 shouldBe("options (1)", "document.getElementById('two')");29 shouldBe("options[0]", "document.getElementById('one')"); 30 shouldBe("options[1]", "document.getElementById('two')"); 31 31 32 32 var successfullyParsed = true; -
trunk/LayoutTests/fast/dom/NodeList/nodelist-item-call-as-function-expected.txt
r52627 r95203 1 This tests that items in a NodeList can be retrieved directly by calling as a function with an integral index parameter, starting from 0. 2 It means NodeList[0] and NodeList(0) both work. 1 This tests that items in a NodeList cannot be called indexed using [[Call]]. 3 2 4 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 5 4 6 5 7 PASS nodeList[0] is nodeList(0) 8 PASS !nodeList[nodeList.length] is !nodeList(nodeList.length) 6 PASS nodeList(0) threw exception TypeError: '[object NodeList]' is not a function (evaluating 'nodeList(0)'). 9 7 PASS successfullyParsed is true 10 8 -
trunk/LayoutTests/fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js
r52627 r95203 1 description('This tests that items in a NodeList can be retrieved directly by calling as a function with an integral index parameter, starting from 0.<br>It means NodeList[0] and NodeList(0) both work.');1 description('This tests that items in a NodeList cannot be called indexed using [[Call]].'); 2 2 3 3 var nodeList = document.getElementsByTagName('div'); 4 shouldBe("nodeList[0]", "nodeList(0)"); 5 shouldBe("!nodeList[nodeList.length]", "!nodeList(nodeList.length)"); 4 shouldThrow("nodeList(0)"); 6 5 7 6 var successfullyParsed = true; -
trunk/Source/WebCore/ChangeLog
r95198 r95203 1 2011-09-15 Sam Weinig <sam@webkit.org> 2 3 Experiment with removing ability to call a collection (except document.all) 4 https://bugs.webkit.org/show_bug.cgi?id=67579 5 6 Reviewed by Anders Carlsson. 7 8 At the request of the public-script-coord mailing list (specifically Brendan Eich, see 9 http://lists.w3.org/Archives/Public/public-script-coord/2011JulSep/0360.html), this 10 patch removes the ability to call a collection (either a NodeList or HTMLCollection, 11 but not an HTMLAllCollection) as function, a syntax that we adopted to emulate IE. 12 It is being landed to find out if there are any sites relying on this behavior of WebKit, 13 or, if it is only used in IE only paths. If we find sites are breaking, it should be rolled 14 out and we should inform the public-script-coord mailing list. 15 16 * bindings/js/JSHTMLAllCollectionCustom.cpp: 17 Update comment. 18 19 * bindings/js/JSHTMLCollectionCustom.cpp: 20 * bindings/js/JSNodeListCustom.cpp: 21 Remove custom call code. 22 23 * bindings/scripts/CodeGeneratorV8.pm: 24 Add support for V8CustomCall. 25 26 * dom/NodeList.idl: 27 * html/HTMLCollection.idl: 28 Remove CustomCall. 29 1 30 2011-09-15 Andreas Kling <kling@webkit.org> 2 31 -
trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
r91652 r95203 58 58 } 59 59 60 // HTMLCollections are strange objects, they support both get and call, 61 // so that document.forms.item(0) and document.forms(0) both work. 60 // HTMLAllCollections are strange objects, they support both get and call. 62 61 static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) 63 62 { -
trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
r91652 r95203 54 54 } 55 55 56 // HTMLCollections are strange objects, they support both get and call,57 // so that document.forms.item(0) and document.forms(0) both work.58 static EncodedJSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec)59 {60 if (exec->argumentCount() < 1)61 return JSValue::encode(jsUndefined());62 63 // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case.64 JSHTMLCollection* jsCollection = static_cast<JSHTMLCollection*>(exec->callee());65 HTMLCollection* collection = jsCollection->impl();66 67 // Also, do we need the TypeError test here ?68 69 if (exec->argumentCount() == 1) {70 // Support for document.all(<index>) etc.71 bool ok;72 UString string = exec->argument(0).toString(exec);73 unsigned index = Identifier::toUInt32(string, ok);74 if (ok)75 return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index)));76 77 // Support for document.images('<name>') etc.78 return JSValue::encode(getNamedItems(exec, jsCollection, Identifier(exec, string)));79 }80 81 // The second arg, if set, is the index of the item we want82 bool ok;83 UString string = exec->argument(0).toString(exec);84 unsigned index = Identifier::toUInt32(exec->argument(1).toString(exec), ok);85 if (ok) {86 AtomicString pstr = ustringToAtomicString(string);87 Node* node = collection->namedItem(pstr);88 while (node) {89 if (!index)90 return JSValue::encode(toJS(exec, jsCollection->globalObject(), node));91 node = collection->nextNamedItem(pstr);92 --index;93 }94 }95 96 return JSValue::encode(jsUndefined());97 }98 99 CallType JSHTMLCollection::getCallData(CallData& callData)100 {101 callData.native.function = callHTMLCollection;102 return CallTypeHost;103 }104 105 56 bool JSHTMLCollection::canGetItemsForName(ExecState*, HTMLCollection* collection, const Identifier& propertyName) 106 57 { -
trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp
r84699 r95203 47 47 } 48 48 49 // Need to support call so that list(0) works.50 static EncodedJSValue JSC_HOST_CALL callNodeList(ExecState* exec)51 {52 bool ok;53 unsigned index = Identifier::toUInt32(exec->argument(0).toString(exec), ok);54 if (!ok)55 return JSValue::encode(jsUndefined());56 JSNodeList* thisObj = static_cast<JSNodeList*>(exec->callee());57 return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl()->item(index)));58 }59 60 CallType JSNodeList::getCallData(CallData& callData)61 {62 callData.native.function = callNodeList;63 return CallTypeHost;64 }65 66 49 bool JSNodeList::canGetItemsForName(ExecState*, NodeList* impl, const Identifier& propertyName) 67 50 { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r94891 r95203 623 623 my $dataNode = shift; 624 624 625 if ($dataNode->extendedAttributes->{"CustomCall"} ) {625 if ($dataNode->extendedAttributes->{"CustomCall"} || $dataNode->extendedAttributes->{"V8CustomCall"}) { 626 626 push(@headerContent, " static v8::Handle<v8::Value> callAsFunctionCallback(const v8::Arguments&);\n"); 627 627 } … … 1873 1873 my $dataNode = shift; 1874 1874 my $interfaceName = $dataNode->name; 1875 my $hasCustomCall = $dataNode->extendedAttributes->{"CustomCall"} ;1875 my $hasCustomCall = $dataNode->extendedAttributes->{"CustomCall"} || $dataNode->extendedAttributes->{"V8CustomCall"}; 1876 1876 1877 1877 # FIXME: Remove hard-coded HTMLOptionsCollection reference. -
trunk/Source/WebCore/dom/NodeList.idl
r92433 r95203 25 25 HasIndexGetter, 26 26 HasNameGetter, 27 CustomCall27 V8CustomCall 28 28 ] NodeList { 29 29 -
trunk/Source/WebCore/html/HTMLCollection.idl
r92327 r95203 24 24 HasIndexGetter, 25 25 HasNameGetter, 26 CustomCall,26 V8CustomCall, 27 27 CustomToJS, 28 28 GenerateIsReachable,
Note: See TracChangeset
for help on using the changeset viewer.