-
Notifications
You must be signed in to change notification settings - Fork 297
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
initEvent should not require three parameters #387
Comments
Maybe the type should be optional, too. |
https://bugs.webkit.org/show_bug.cgi?id=166284 Reviewed by Dan Bernstein. LayoutTests/imported/w3c: * web-platform-tests/dom/interfaces-expected.txt: We regress conformance, but a change has been proposed to the spec. Hopefully this will be a temporary regression. Source/WebCore: We added this quirk in r207908 and expanded it in r209946 and r210034. Many web compatibility issues have been found, which leads us to believe that many more exist. This reverts the behavior to match how it was before r203848. This change was proposed to the spec in whatwg/dom#387 * dom/Event.cpp: (WebCore::Event::initEventForBindings): Deleted. * dom/Event.h: * dom/Event.idl: * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::IOSApplication::isBaiduNuomi): Deleted. (WebCore::IOSApplication::isAutoNaviAMap): Deleted. (WebCore::IOSApplication::isFlipboard): Deleted. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@210045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
That means those pages break in browsers other than Safari? |
One example was web content packaged inside an iOS app. Only WebKit would ever read it. All the affected content had one parameter in the call site of initEvent. I don't see a reason to require the other two, especially if Chrome and Safari don't require them. |
@foolip do you know if there are other instances where Chrome does not require arguments? Does seem good to fix this if both Chrome and Safari match. Do you know what Edge does? |
Edge requires three parameters. |
To clarify Alex's comment, we did not find any evidence of actual Web breakage. However, matching the specification in WebKit broke a lot of iOS apps using WebViews and at least one Safari extension. |
That's generally not a good enough reason to change the standard, but if @foolip and @smaug---- et al would support adding it to Chrome and Firefox I don't see much reason to stop this. It's a rather trivial IDL change. |
Any actual web pages breaking in FF or Edge because of this? Links? How do all the other init*Event methods behave? |
As I said, we have no evidence of actual Web breakage. Sadly, there are a lot of WebKit-specific apps / extensions calling initEvent() with a single parameter. We usually deal with this by adding quirks until those apps get fixed. However, in this case, it seems to be a common pattern and it is breaking a lot of iOS apps. I agree that this is not a very compelling argument to get the specification changed but Alex thought it was worth trying given the pain we're currently experiencing. Also note that those 2 boolean parameters are not required when you use the Event constructor (i.e. You can call the Event constructor with only a type) and those have default values (false) for the constructor. Therefore, having initEvent() behave similarly wouldn't look too surprising. |
Also note that Chrome 55 behaves does not have initEvent() parameters as mandatory. So Safari and Chrome are in agreement at least. |
As I asked, how do other init*Event methods behave? |
In WebKit, parameters to all init*Event() methods are optional (except for initCustomEvent). The same appears to be true for Chrome based on grep'ing of their code. Note that the parameters to initCustomEvent() were optional in WebKit until recently (not even sure this shipped in Safari yet). |
Any thoughts on this? We had to roll this change out in WebKit because it broke way too many popular iOS apps (including Flipboard and WeChat). |
Not long before this issue was filed, I suggested that @LoonyBean try fixing this in Blink, giving it good chances of working out because Firefox and Edge would already throw. If there is a way for WebKit to make the change, then that'd be great. However, different behavior for a browser and WebView seems the only option, and not a good one. So, I think we should make the two boolean arguments optional. I'd support doing the same for all |
Is there even a legacy event that has |
Any update on this? Would anyone oppose if I wrote to PR to update the DOM spec and the web-platform-tests? |
That sounds good to me. So to recap, the proposal here is that we change all This will require changes in DOM, HTML, UI Events, and maybe more? |
I do think it would be good if we coordinated the changes to all these standards, to keep it all consistent and make implementation easier. |
I would like to see the change across the board as well. In Blink, these are the
https://software.hixie.ch/utilities/js/live-dom-viewer/saved/4873 is a quick test that confirms what our IDL files suggest, namely that I checked all of the rest, and much to my surprise and delight didn't find any cases where an event interface member would have to be made nullable to accommodate this change. (I found many things like this when looking at event init dicts with no required members.) |
To clarify, I don't think the change to DOM needs to block on every other PR being ready. In particular, https://w3c.github.io/uievents/ doesn't even have the arguments, and if there's any trouble in fixing that I think we should still fix everything in HTML and DOM. |
I am going to try and find time this week end to write the DOM / HTML spec changes, as well as updating the web-platform-tests accordingly. |
…t the first Make all parameters to initEvent() / initCustomEvent() optional except the first. This aligns the specification with WebKit and gets it closer to Blink. This closes issue whatwg#387.
…t the first Make all parameters to initEvent() / initCustomEvent() optional except the first. This aligns the specification with WebKit and gets it closer to Blink. This closes issue whatwg#387.
Make all parameters to initMessageEvent() optional except the first one. See corresponding DOM change at: whatwg/dom#417 and discussion at: whatwg/dom#387
…t the first one Make all parameters to initEvent() / initCustomEvent() optional except the first one. to match: - whatwg/dom#417 - whatwg/dom#387
Make all parameters to initMessageEvent() optional except the first one. See corresponding HTML specification change at: whatwg/html#2410 and discussion at: whatwg/dom#387
Uploaded PRs for DOM, HTML and WPT. |
Will fully align WebKit via https://bugs.webkit.org/show_bug.cgi?id=169176. |
Make all parameters to initMessageEvent() optional except the first one. See corresponding DOM change at: whatwg/dom#417 and discussion at: whatwg/dom#387
@cdumez can you file bugs against Edge and Firefox too? And does Chrome need a bug? I'll land this tomorrow. I'm satisfied with the PR and tests PR. |
(And thanks for making those!) |
…t the first one Make all parameters to initEvent() / initCustomEvent() optional except the first one. to match: - whatwg/dom#417 - whatwg/dom#387
…e first See whatwg/dom#387 and whatwg/dom#417 for corresponding DOM Standard changes.
I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1345044 and https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11187286/. @foolip can you file the Chrome issue? I wasn't entirely sure it was needed since it seems that Chrome doesn't match either the standard or this revision so likely that's already tracked? |
See corresponding HTML Standard change at whatwg/html#2410 and discussion at whatwg/dom#387.
Tests: web-platform-tests/wpt#5044. See corresponding DOM Standard change at whatwg/dom#417 and discussion at whatwg/dom#387.
Yes, this is tracked by https://bugs.chromium.org/p/chromium/issues/detail?id=673698 in Chromium, and the needed change is to make the first argument required. |
Thank you for merging and filing the bugs. WebKit is now aligned with the spec: |
whatwg/dom#387 BUG=673698 Review-Url: https://codereview.chromium.org/2579993002 Cr-Commit-Position: refs/heads/master@{#458108}
…d:60001 of https://codereview.chromium.org/2579993002/ ) Reason for revert: It looks this broke the external/wpt/dom/interfaces.html test: https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Mac10.12/builds/448 https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Mac10.12/builds/438 ... Original issue's description: > Make initEvent's first argument non-optional > > whatwg/dom#387 > > BUG=673698 > > Review-Url: https://codereview.chromium.org/2579993002 > Cr-Commit-Position: refs/heads/master@{#458108} > Committed: https://chromium.googlesource.com/chromium/src/+/2948f11e04fba5f0dc7244229c542152c97c1624 TBR=foolip@chromium.org,lunalu@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=673698 Review-Url: https://codereview.chromium.org/2760173002 Cr-Commit-Position: refs/heads/master@{#458227}
whatwg/dom#387 BUG=673698 Review-Url: https://codereview.chromium.org/2579993002 Cr-Original-Commit-Position: refs/heads/master@{#458108} Committed: https://chromium.googlesource.com/chromium/src/+/2948f11e04fba5f0dc7244229c542152c97c1624 Review-Url: https://codereview.chromium.org/2579993002 Cr-Commit-Position: refs/heads/master@{#458443}
Tests: web-platform-tests/wpt#5044. See corresponding DOM Standard change at whatwg/dom#417 and discussion at whatwg/dom#387.
https://bugs.webkit.org/show_bug.cgi?id=166284 Reviewed by Dan Bernstein. LayoutTests/imported/w3c: * web-platform-tests/dom/interfaces-expected.txt: We regress conformance, but a change has been proposed to the spec. Hopefully this will be a temporary regression. Source/WebCore: We added this quirk in r207908 and expanded it in r209946 and r210034. Many web compatibility issues have been found, which leads us to believe that many more exist. This reverts the behavior to match how it was before r203848. This change was proposed to the spec in whatwg/dom#387 * dom/Event.cpp: (WebCore::Event::initEventForBindings): Deleted. * dom/Event.h: * dom/Event.idl: * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::IOSApplication::isBaiduNuomi): Deleted. (WebCore::IOSApplication::isAutoNaviAMap): Deleted. (WebCore::IOSApplication::isFlipboard): Deleted. Canonical link: https://commits.webkit.org/183664@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
I have found many instances of web content calling initEvent with only one parameter. Matching the current spec makes these pages not work, showing up as unresponsive blank white pages.
I therefore propose changing this:
void initEvent(DOMString type, boolean bubbles, boolean cancelable); // historical
to this:
void initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // historical
The text was updated successfully, but these errors were encountered: