Bug 180019

Summary: [WebIDL] Remove the need to specify [MayThrowException]
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, ashvayka, beidson, calvaris, cdumez, changseok, cmarcelo, darin, dino, don.olmstead, eric.carlson, esprehn+autocc, ews-watchlist, fmalita, glenn, graouts, gyuyoung.kim, hi, hta, japhet, jer.noble, jiewen_tan, joepeck, jsbell, kangil.han, kondapallykalyan, macpherson, menard, mifenton, pdr, philipj, sabouhallawa, schenney, sergio, tommyw, toyoshim, webkit-bug-importer, yutak
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 216429, 216441, 216442    
Bug Blocks: 177453    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Just the code changes (no IDL or test result changes)
none
Patch
none
Patch none

Sam Weinig
Reported 2017-11-26 11:48:08 PST
[WebIDL] Remove the need to specify [MayThrowException] for operations
Attachments
Patch (431.29 KB, patch)
2017-11-26 11:54 PST, Sam Weinig
no flags
Patch (401.08 KB, patch)
2017-11-26 13:43 PST, Sam Weinig
no flags
Patch (366.44 KB, patch)
2017-11-26 16:51 PST, Sam Weinig
no flags
Patch (367.28 KB, patch)
2017-11-26 17:08 PST, Sam Weinig
no flags
Patch (645.18 KB, patch)
2021-03-21 09:45 PDT, Sam Weinig
no flags
Just the code changes (no IDL or test result changes) (49.65 KB, patch)
2021-03-21 09:51 PDT, Sam Weinig
no flags
Patch (651.80 KB, patch)
2021-03-22 09:24 PDT, Sam Weinig
no flags
Patch (651.75 KB, patch)
2021-03-22 16:14 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2017-11-26 11:54:19 PST Comment hidden (obsolete)
EWS Watchlist
Comment 2 2017-11-26 11:56:51 PST Comment hidden (obsolete)
Sam Weinig
Comment 3 2017-11-26 13:43:53 PST Comment hidden (obsolete)
EWS Watchlist
Comment 4 2017-11-26 13:46:08 PST Comment hidden (obsolete)
Sam Weinig
Comment 5 2017-11-26 16:51:05 PST Comment hidden (obsolete)
EWS Watchlist
Comment 6 2017-11-26 16:58:52 PST Comment hidden (obsolete)
Sam Weinig
Comment 7 2017-11-26 17:08:32 PST Comment hidden (obsolete)
EWS Watchlist
Comment 8 2017-11-26 17:10:04 PST Comment hidden (obsolete)
Alexey Shvayka
Comment 9 2021-03-16 16:18:04 PDT
*** Bug 177453 has been marked as a duplicate of this bug. ***
Sam Weinig
Comment 10 2021-03-21 08:56:25 PDT
I have a change to remove all the remaining uses of [MayThrowException], so am going to broaden this a bit.
Sam Weinig
Comment 11 2021-03-21 09:45:54 PDT Comment hidden (obsolete)
Sam Weinig
Comment 12 2021-03-21 09:47:32 PDT
It's a big one, but it finally does away with [MayThrowException].
Sam Weinig
Comment 13 2021-03-21 09:47:55 PDT
And a huge amount of it is just test changes.
Sam Weinig
Comment 14 2021-03-21 09:51:06 PDT
Created attachment 423830 [details] Just the code changes (no IDL or test result changes)
Sam Weinig
Comment 15 2021-03-21 09:53:16 PDT
Added a version with just the code changes to make it a bit easier to look at.
Sam Weinig
Comment 16 2021-03-22 09:24:40 PDT
Chris Dumez
Comment 17 2021-03-22 11:47:01 PDT
Comment on attachment 423898 [details] Patch r=me if the bots are happy. Very nice.
Darin Adler
Comment 18 2021-03-22 11:48:40 PDT
Comment on attachment 423898 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423898&action=review Reading the patch now, spotted a couple errors, but still reading through the rest > Source/WebCore/ChangeLog:14 > + compile. To work around this, toJS<>() can now take a lambda as it's value, and it's -> its > Source/WebCore/ChangeLog:93 > + required as we actually look at the return type via deduction and need it match. need it match -> need it to match
Darin Adler
Comment 19 2021-03-22 11:51:20 PDT
Comment on attachment 423898 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423898&action=review > Source/WebCore/bindings/js/JSDOMExceptionHandling.h:101 > return; Why not take out the return if we are using else?
Darin Adler
Comment 20 2021-03-22 11:55:40 PDT
Comment on attachment 423898 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423898&action=review Not that we needed to, but if we wanted a smaller patch could have done "allow but ignore MayThrowException" and then did the "remove and forbid MayThrowException" in a follow up. > Source/WebCore/dom/Element.h:212 > + // Bindings variants of the above two functions that have the correct return type. Not 100% sure we need the comment. The names seem self-explanatory and while it’s hard to notice the only difference is the return type, the repercussions of not noticing are very small. > Source/WebCore/dom/Element.h:214 > + inline void removeAttributeForBindings(const AtomString& qualifiedName) { removeAttribute(qualifiedName); } > + inline void removeAttributeNSForBindings(const AtomString& namespaceURI, const AtomString& localName) { removeAttributeNS(namespaceURI, localName); } The "inline" here can be omitted and has no effect.
Darin Adler
Comment 21 2021-03-22 11:55:52 PDT
OK, done with my review pass.
Sam Weinig
Comment 22 2021-03-22 16:14:32 PDT
Sam Weinig
Comment 23 2021-03-22 16:15:04 PDT
*** Bug 177453 has been marked as a duplicate of this bug. ***
EWS
Comment 24 2021-03-22 17:49:07 PDT
Committed r274832: <https://commits.webkit.org/r274832> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423956 [details].
Radar WebKit Bug Importer
Comment 25 2021-03-22 17:50:19 PDT
Don Olmstead
Comment 26 2021-03-23 13:46:13 PDT
After this patch I see the following error in a non-unified build. WebCore/DerivedSources/JSWebGLLoseContext.cpp:146:57: error: use of undeclared identifier 'IDLUndefined' RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.loseContext(); }))); ^ WebCore/DerivedSources/JSWebGLLoseContext.cpp:161:71: warning: expression result unused [-Wunused-value] RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.restoreContext(); }))); ^~~~~~~~~~~~~~~~~~~~ JavaScriptCore/PrivateHeaders\JavaScriptCore/ExceptionScope.h:113:16: note: expanded from macro 'RELEASE_AND_RETURN' return expression__; \ ^~~~~~~~~~~~ WebCore/DerivedSources/JSWebGLLoseContext.cpp:161:93: warning: expression result unused [-Wunused-value] RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.restoreContext(); }))); ^~~~~~~~~~ JavaScriptCore/PrivateHeaders\JavaScriptCore/ExceptionScope.h:113:16: note: expanded from macro 'RELEASE_AND_RETURN' return expression__; \ ^~~~~~~~~~~~ WebCore/DerivedSources/JSWebGLLoseContext.cpp:161:57: error: use of undeclared identifier 'IDLUndefined' RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.restoreContext(); })));
Darin Adler
Comment 27 2021-03-23 13:52:59 PDT
(In reply to Don Olmstead from comment #26) > After this patch I see the following error in a non-unified build. The fix for this is to add the necessary includes. It looks like the AddToIncludesForIDLType function is missing code for the case of "undefined". I think it might be something like this: if ($type->name eq "undefined") { AddToIncludes("IDLTypes.h", $includesRef, $conditional); return; }
Darin Adler
Comment 28 2021-03-23 15:17:11 PDT
Can someone who is doing a non-unified build (Don?) try the above addition to CodeGeneratorJS.pm with my suggestion above to see if it works?
Don Olmstead
Comment 29 2021-03-23 15:41:41 PDT
(In reply to Darin Adler from comment #28) > Can someone who is doing a non-unified build (Don?) try the above addition > to CodeGeneratorJS.pm with my suggestion above to see if it works? (In reply to Darin Adler from comment #27) > (In reply to Don Olmstead from comment #26) > > After this patch I see the following error in a non-unified build. > > The fix for this is to add the necessary includes. It looks like the > AddToIncludesForIDLType function is missing code for the case of > "undefined". I think it might be something like this: > > if ($type->name eq "undefined") { > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > return; > } I can give that a shot. Might not get to it until tomorrow though. Thanks for the hint! Always appreciated!
Chris Dumez
Comment 30 2021-03-23 15:53:52 PDT
(In reply to Don Olmstead from comment #29) > (In reply to Darin Adler from comment #28) > > Can someone who is doing a non-unified build (Don?) try the above addition > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > (In reply to Darin Adler from comment #27) > > (In reply to Don Olmstead from comment #26) > > > After this patch I see the following error in a non-unified build. > > > > The fix for this is to add the necessary includes. It looks like the > > AddToIncludesForIDLType function is missing code for the case of > > "undefined". I think it might be something like this: > > > > if ($type->name eq "undefined") { > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > return; > > } > > I can give that a shot. Might not get to it until tomorrow though. > > Thanks for the hint! Always appreciated! Follow-up build fix landed in <https://commits.webkit.org/r274906>.
Sam Weinig
Comment 31 2021-03-23 15:55:38 PDT
(In reply to Chris Dumez from comment #30) > (In reply to Don Olmstead from comment #29) > > (In reply to Darin Adler from comment #28) > > > Can someone who is doing a non-unified build (Don?) try the above addition > > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > > > (In reply to Darin Adler from comment #27) > > > (In reply to Don Olmstead from comment #26) > > > > After this patch I see the following error in a non-unified build. > > > > > > The fix for this is to add the necessary includes. It looks like the > > > AddToIncludesForIDLType function is missing code for the case of > > > "undefined". I think it might be something like this: > > > > > > if ($type->name eq "undefined") { > > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > > return; > > > } > > > > I can give that a shot. Might not get to it until tomorrow though. > > > > Thanks for the hint! Always appreciated! > > Follow-up build fix landed in <https://commits.webkit.org/r274906>. Did that cause no bindings test changes?
Chris Dumez
Comment 32 2021-03-23 16:10:21 PDT
(In reply to Sam Weinig from comment #31) > (In reply to Chris Dumez from comment #30) > > (In reply to Don Olmstead from comment #29) > > > (In reply to Darin Adler from comment #28) > > > > Can someone who is doing a non-unified build (Don?) try the above addition > > > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > > > > > (In reply to Darin Adler from comment #27) > > > > (In reply to Don Olmstead from comment #26) > > > > > After this patch I see the following error in a non-unified build. > > > > > > > > The fix for this is to add the necessary includes. It looks like the > > > > AddToIncludesForIDLType function is missing code for the case of > > > > "undefined". I think it might be something like this: > > > > > > > > if ($type->name eq "undefined") { > > > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > > > return; > > > > } > > > > > > I can give that a shot. Might not get to it until tomorrow though. > > > > > > Thanks for the hint! Always appreciated! > > > > Follow-up build fix landed in <https://commits.webkit.org/r274906>. > > Did that cause no bindings test changes? It did, sorry. I updated them at <https://commits.webkit.org/r274909>. BTW, I don't know if I am going crazy or if something is wrong with my machine but generating the JS bindings seems to be crazy slow. I wonder if we regressed speed somewhat recently.
Sam Weinig
Comment 33 2021-03-23 16:21:27 PDT
(In reply to Chris Dumez from comment #32) > (In reply to Sam Weinig from comment #31) > > (In reply to Chris Dumez from comment #30) > > > (In reply to Don Olmstead from comment #29) > > > > (In reply to Darin Adler from comment #28) > > > > > Can someone who is doing a non-unified build (Don?) try the above addition > > > > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > > > > > > > (In reply to Darin Adler from comment #27) > > > > > (In reply to Don Olmstead from comment #26) > > > > > > After this patch I see the following error in a non-unified build. > > > > > > > > > > The fix for this is to add the necessary includes. It looks like the > > > > > AddToIncludesForIDLType function is missing code for the case of > > > > > "undefined". I think it might be something like this: > > > > > > > > > > if ($type->name eq "undefined") { > > > > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > > > > return; > > > > > } > > > > > > > > I can give that a shot. Might not get to it until tomorrow though. > > > > > > > > Thanks for the hint! Always appreciated! > > > > > > Follow-up build fix landed in <https://commits.webkit.org/r274906>. > > > > Did that cause no bindings test changes? > > It did, sorry. I updated them at <https://commits.webkit.org/r274909>. > > BTW, I don't know if I am going crazy or if something is wrong with my > machine but generating the JS bindings seems to be crazy slow. I wonder if > we regressed speed somewhat recently. Can you quantify it anyway? As one data point, I haven't seen any bugs from ap about a compile time slowdown (which I usually do when I regress it).
Chris Dumez
Comment 34 2021-03-23 16:24:21 PDT
(In reply to Chris Dumez from comment #32) > (In reply to Sam Weinig from comment #31) > > (In reply to Chris Dumez from comment #30) > > > (In reply to Don Olmstead from comment #29) > > > > (In reply to Darin Adler from comment #28) > > > > > Can someone who is doing a non-unified build (Don?) try the above addition > > > > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > > > > > > > (In reply to Darin Adler from comment #27) > > > > > (In reply to Don Olmstead from comment #26) > > > > > > After this patch I see the following error in a non-unified build. > > > > > > > > > > The fix for this is to add the necessary includes. It looks like the > > > > > AddToIncludesForIDLType function is missing code for the case of > > > > > "undefined". I think it might be something like this: > > > > > > > > > > if ($type->name eq "undefined") { > > > > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > > > > return; > > > > > } > > > > > > > > I can give that a shot. Might not get to it until tomorrow though. > > > > > > > > Thanks for the hint! Always appreciated! > > > > > > Follow-up build fix landed in <https://commits.webkit.org/r274906>. > > > > Did that cause no bindings test changes? > > It did, sorry. I updated them at <https://commits.webkit.org/r274909>. > > BTW, I don't know if I am going crazy or if something is wrong with my > machine but generating the JS bindings seems to be crazy slow. I wonder if > we regressed speed somewhat recently. r274832: real 1m9.199s user 0m29.724s sys 0m38.310s r273000: real 1m6.759s user 0m29.013s sys 0m36.827s Seems slow to regenerate bindings tests results on an iMac Pro but at least it's not a recent regression :)
Don Olmstead
Comment 35 2021-03-24 12:56:02 PDT
(In reply to Chris Dumez from comment #30) > (In reply to Don Olmstead from comment #29) > > (In reply to Darin Adler from comment #28) > > > Can someone who is doing a non-unified build (Don?) try the above addition > > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > > > (In reply to Darin Adler from comment #27) > > > (In reply to Don Olmstead from comment #26) > > > > After this patch I see the following error in a non-unified build. > > > > > > The fix for this is to add the necessary includes. It looks like the > > > AddToIncludesForIDLType function is missing code for the case of > > > "undefined". I think it might be something like this: > > > > > > if ($type->name eq "undefined") { > > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > > return; > > > } > > > > I can give that a shot. Might not get to it until tomorrow though. > > > > Thanks for the hint! Always appreciated! > > Follow-up build fix landed in <https://commits.webkit.org/r274906>. So after the change I was still getting the error. If I manually add #include "JSDOMConvertBase.h" it compiles fine.
Chris Dumez
Comment 36 2021-03-24 12:58:58 PDT
(In reply to Don Olmstead from comment #35) > (In reply to Chris Dumez from comment #30) > > (In reply to Don Olmstead from comment #29) > > > (In reply to Darin Adler from comment #28) > > > > Can someone who is doing a non-unified build (Don?) try the above addition > > > > to CodeGeneratorJS.pm with my suggestion above to see if it works? > > > > > > (In reply to Darin Adler from comment #27) > > > > (In reply to Don Olmstead from comment #26) > > > > > After this patch I see the following error in a non-unified build. > > > > > > > > The fix for this is to add the necessary includes. It looks like the > > > > AddToIncludesForIDLType function is missing code for the case of > > > > "undefined". I think it might be something like this: > > > > > > > > if ($type->name eq "undefined") { > > > > AddToIncludes("IDLTypes.h", $includesRef, $conditional); > > > > return; > > > > } > > > > > > I can give that a shot. Might not get to it until tomorrow though. > > > > > > Thanks for the hint! Always appreciated! > > > > Follow-up build fix landed in <https://commits.webkit.org/r274906>. > > So after the change I was still getting the error. "the" error or a different error. The error was: > use of undeclared identifier 'IDLUndefined' My patch included the right error for that type. JSDOMConvertBase.h may be needed too, not for IDLUndefined. > > If I manually add #include "JSDOMConvertBase.h" it compiles fine.
Darin Adler
Comment 37 2021-03-24 13:03:52 PDT
(In reply to Chris Dumez from comment #36) > (In reply to Don Olmstead from comment #35) > > So after the change I was still getting the error. > > "the" error or a different error. Yes, can we see the error?
Don Olmstead
Comment 38 2021-03-24 13:06:59 PDT
(In reply to Darin Adler from comment #37) > (In reply to Chris Dumez from comment #36) > > (In reply to Don Olmstead from comment #35) > > > So after the change I was still getting the error. > > > > "the" error or a different error. > > Yes, can we see the error? Yea sorry I misspoke. Should've been `an` not `the`. It was just on the same line but now on toJS<IDLUndefined>. WebCore/DerivedSources/JSWebGLLoseContext.cpp:147:57: error: 'IDLUndefined' does not refer to a value RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.loseContext(); }))); ^ ../../Source/WebCore/bindings\IDLTypes.h:96:8: note: declared here struct IDLUndefined : IDLType<void> { };
Darin Adler
Comment 39 2021-03-24 13:48:37 PDT
Given that detail, I agree: we should use JSDOMConvertBase.h in AddToIncludesForIDLType instead of IDLTypes.h.
Note You need to log in before you can comment on or make changes to this bug.