-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] consolidate JS interop code #30007
Conversation
9215e41 to
2a1efdb
Compare
| // added by this script during the rewrite. | ||
| void _validateEngineSource(String engineDartPath, String engineDartCode) { | ||
| const List<String> expectedLines = <String>[ | ||
| 'library engine;', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was bitten before by having a different number of spaces. That's why I added \s+ to many regexes above. Maybe turn this into a list of regexes?
Another issue that I can think of is this line could have a trailing comment in the source code:
library engine; // some comment here.Could also be fixed if we use a list of regexes.
If you think this is overkill now, you can just leave it as is. We can always fix it in the future if it becomes a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing for this particular line it probably doesn't matter. But I agree, for code that's more malleable that could be annoying.
| @JS() | ||
| library dart._engine; | ||
| import 'dart:async'; | ||
| import 'dart:collection'; | ||
| import 'dart:convert' hide Codec; | ||
| import 'dart:developer' as developer; | ||
| import 'dart:html' as html; | ||
| import 'dart:js' as js; | ||
| import 'dart:js_util' as js_util; | ||
| import 'dart:_js_annotations'; | ||
| import 'dart:math' as math; | ||
| import 'dart:svg' as svg; | ||
| import 'dart:typed_data'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, this change is expected fail sdk_rewriter_test.dart. So the tests need to be updated as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
d37e94f to
94d137e
Compare
The original flutter#30007 was reverted because it broke the framework. Turns out the framework still used the WebExperiments code, which has been cleaned up in flutter/flutter#94739. This PR must land after flutter/flutter#94739. This reverts commit bd3a394.
The original #30007 was reverted because it broke the framework. Turns out the framework still used the WebExperiments code, which has been cleaned up in flutter/flutter#94739. This PR must land after flutter/flutter#94739. This reverts commit bd3a394.
canvaskit_api.dart- interop with CanvasKit APIsafe_browser_api.dart- interop with browser APIs that can't be accessed normally viadart:html,dart:svg, ordart:webgl.js_access_test.dartthat:engine.dartis exclusively an import/export library (there's no functional code in it)