Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy callers #412

Merged
merged 1 commit into from Sep 12, 2017
Merged

Remove legacy callers #412

merged 1 commit into from Sep 12, 2017

Conversation

TimothyGu
Copy link
Member

@TimothyGu TimothyGu commented Aug 16, 2017

Turns out there is only one interface in the Platform using legacy callers (HTMLAllCollection). Define the exotic behaviors there instead. PR for that is pending.

Fixes #407.
Fixes #408.


Preview | Diff

@domenic
Copy link
Member

domenic commented Aug 16, 2017

@bzbarsky, are you OK with this? I believe last time we discussed document.all we found out Firefox is the only one using actual IDL to fully define its behavior, so for other browsers I think they will be fine with custom bindings in the HTML spec. But I want to check with you from Firefox's perspective.

I think this is a good change from a spec point of view, myself.

@annevk
Copy link
Member

annevk commented Aug 16, 2017

(I think @domenic knows, but we probably need to ping again in two weeks unless bz manages to not miss a single email once he gets back.)

@bzbarsky
Copy link
Collaborator

In practice this probably doesn't matter too much; Gecko would just keep supporting legacycaller and using IDL for this. If no one else is using IDL here, then clearly there's no implementation change involved, so this is just spec bookkeeping....

@samweinig
Copy link

In practice this probably doesn't matter too much; Gecko would just keep supporting legacycaller and using IDL for this. If no one else is using IDL here, then clearly there's no implementation change involved, so this is just spec bookkeeping....

WebKit also implements and uses legacycaller for its HTMLAllCollection implementation.

@domenic
Copy link
Member

domenic commented Sep 7, 2017

@samweinig are you OK with removing legacycaller from IDL and just having a one-off [[Call]] defined in HTML, like in whatwg/html#2932 ? I think it'd be best to leave features used in only one, legacy place out of IDL.

@samweinig
Copy link

@domenic yeah, I'm not sure it makes much difference. I'll either just keep our legacycaller stuff (or perhaps simplify it since it supports things like overloading) or change the syntax to an extended attribute.

I'm not 100% I see the value of removing it. I get that we don't want more specs using it, but it seems like having as much of this legacy stuff in the same place has some value. I also have some concern that the more we specify exotic behavior (like a custom [[Call]]) the more it might encourage other specs to do that, kind of moving the problem around.

That said, it seems ok.

@annevk
Copy link
Member

annevk commented Sep 8, 2017

@samweinig note that we already have legacy stuff in HTML for WindowProxy and Location. And we'll have to add a special slot to HTMLAllCollection that influences the type of object it is as far as the ECMAScript standard goes as well. So legacy is already HTML + IDL.

@samweinig
Copy link

@annevk that's a good point, and ultimately why it seems fine.

domenic pushed a commit to whatwg/html that referenced this pull request Sep 8, 2017
@domenic
Copy link
Member

domenic commented Sep 8, 2017

@TimothyGu mind rebasing?

@TimothyGu
Copy link
Member Author

@domenic Done.

Turns out there is only one interface in the Platform using legacy
callers (HTMLAllCollection). Define the exotic behaviors there instead.

Fixes whatwg#407.
Fixes whatwg#408.
@TimothyGu
Copy link
Member Author

Freshly rebased.

@annevk annevk merged commit 2b1a990 into whatwg:master Sep 12, 2017
@annevk
Copy link
Member

annevk commented Sep 12, 2017

I went ahead and merged this to avoid another merge conflict. Hope that's okay.

JonWBedard pushed a commit to WebKit/WebKit that referenced this pull request Jan 5, 2021
https://bugs.webkit.org/show_bug.cgi?id=220246

Reviewed by Sam Weinig.

Before this change, [LegacyCaller] implementation was very complex yet versatile, handling
overloads and multiple callers via operation cloning.

This patch removes [LegacyCaller], instead of simplifying it, and leverages [CustomGetCallData]
to implement HTMLAllCollection's [[Call]] method for a few reasons:

1. Legacy callers were removed from the WebIDL spec [1], with `document.all` being the only
   use case; callable objects won't ever be introduced.
2. To closely match the HTML spec [2] by returning early rather than passing nullish AtomString.
3. To make getCallData() override more obvious to a reader unfamiliar with legacy callers.
4. To maximize the amount of code removed from the generator.

No new tests, no behavior change.

[1] whatwg/webidl#412
[2] https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#HTMLAllCollection-call

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSHTMLAllCollectionCustom.cpp: Added.
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::JSHTMLAllCollection::getCallData):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
(GenerateGetCallData):
(InstanceOverridesGetCallData):
(AddLegacyCallerOperationIfNeeded): Deleted.
(GeneratePluginCall): Deleted.
(GenerateLegacyCallerDefinitions): Deleted.
(GenerateLegacyCallerDefinition): Deleted.
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/IDLParser.pm:
(cloneArgument): Deleted.
(cloneOperation): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjDOMConstructor::construct):
(WebCore::callJSTestObj1): Deleted.
(WebCore::callJSTestObj2): Deleted.
(WebCore::callJSTestObj3): Deleted.
(WebCore::JSTestObj::getCallData): Deleted.
(WebCore::jsTestObjPrototypeFunction_legacyCallerNamedBody): Deleted.
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/TestObj.idl:
* html/HTMLAllCollection.idl:


Canonical link: https://commits.webkit.org/232734@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
yury-s pushed a commit to yury-s/webkit-http that referenced this pull request Jan 5, 2021
https://bugs.webkit.org/show_bug.cgi?id=220246

Reviewed by Sam Weinig.

Before this change, [LegacyCaller] implementation was very complex yet versatile, handling
overloads and multiple callers via operation cloning.

This patch removes [LegacyCaller], instead of simplifying it, and leverages [CustomGetCallData]
to implement HTMLAllCollection's [[Call]] method for a few reasons:

1. Legacy callers were removed from the WebIDL spec [1], with `document.all` being the only
   use case; callable objects won't ever be introduced.
2. To closely match the HTML spec [2] by returning early rather than passing nullish AtomString.
3. To make getCallData() override more obvious to a reader unfamiliar with legacy callers.
4. To maximize the amount of code removed from the generator.

No new tests, no behavior change.

[1] whatwg/webidl#412
[2] https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#HTMLAllCollection-call

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSHTMLAllCollectionCustom.cpp: Added.
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::JSHTMLAllCollection::getCallData):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
(GenerateGetCallData):
(InstanceOverridesGetCallData):
(AddLegacyCallerOperationIfNeeded): Deleted.
(GeneratePluginCall): Deleted.
(GenerateLegacyCallerDefinitions): Deleted.
(GenerateLegacyCallerDefinition): Deleted.
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/IDLParser.pm:
(cloneArgument): Deleted.
(cloneOperation): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjDOMConstructor::construct):
(WebCore::callJSTestObj1): Deleted.
(WebCore::callJSTestObj2): Deleted.
(WebCore::callJSTestObj3): Deleted.
(WebCore::JSTestObj::getCallData): Deleted.
(WebCore::jsTestObjPrototypeFunction_legacyCallerNamedBody): Deleted.
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/TestObj.idl:
* html/HTMLAllCollection.idl:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@271137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants