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

Don't register CanvasKit with `define` #22745

Merged
merged 3 commits into from Nov 25, 2020

Conversation

@hterkelsen
Copy link
Contributor

@hterkelsen hterkelsen commented Nov 25, 2020

Description

Sidesteps an issue where CanvasKit tries to automatically register itself with RequireJS by monkey-patching exports and module to be defined only when executing the Flutter-loaded CanvasKit script.

Related Issues

Fixes flutter/flutter#69263
Fixes flutter/flutter#58428

Tests

Tested hot reload with the default app and with the flutter_pdfview example in flutter/flutter#58428

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Reviewer Checklist

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change.
@hterkelsen hterkelsen requested review from yjbanov and nturgut Nov 25, 2020
@flutter-dashboard
Copy link

@flutter-dashboard flutter-dashboard bot commented Nov 25, 2020

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla google-cla bot added the cla: yes label Nov 25, 2020
@hterkelsen hterkelsen requested a review from ditman Nov 25, 2020
Copy link
Contributor

@nturgut nturgut left a comment

If we believe a test would be useful, we can now add tests for DDC+Canvaskit.

Thanks for adding the comments!

objectConstructor.callMethod('defineProperty',
<dynamic>[js.context, 'exports', exportsAccessor]);
Comment on lines +504 to +505

This comment has been minimized.

@ditman

ditman Nov 25, 2020
Member

It seems that exports is actually module.exports. Do we want to expose it like that?

Currently if the script writes in module.exports, that won't be available in exports; I'm not sure if that can break stuff?

https://stackoverflow.com/a/16383925/1738205

This comment has been minimized.

@hterkelsen

hterkelsen Nov 25, 2020
Author Contributor

We don't care about making exports == module.exports, we only care about making these fake objects so that CanvasKit goes into the first case "if (typeof exports === 'object' && typeof module === 'object')". When CanvasKit sets module.exports = CanvasKitInit it should be a no-op.

@ditman
ditman approved these changes Nov 25, 2020
Copy link
Member

@ditman ditman left a comment

LGTM!

@hterkelsen hterkelsen merged commit e890901 into flutter:master Nov 25, 2020
20 checks passed
20 checks passed
Linux Android AOT Engine
Details
Linux Android Debug Engine
Details
Linux Android Scenarios
Details
Linux Fuchsia
Details
Linux Host Engine
Details
Linux Web Engine
Details
Linux Web Framework tests
Details
Mac Android AOT Engine
Details
Mac Android Debug Engine
Details
Mac Host Engine
Details
Mac Web Engine
Details
Mac iOS Engine
Details
WIP Ready for review
Details
Windows Android AOT Engine
Details
Windows Host Engine
Details
Windows Web Engine
Details
build_and_test_linux_unopt_debug Task Summary
Details
cla/google All necessary CLAs are signed
licenses_check Task Summary
Details
luci-engine
Details
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 25, 2020
chaselatta added a commit to chaselatta/engine that referenced this pull request Nov 30, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 30, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 30, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 30, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 30, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2020
cbracken pushed a commit to flutter/flutter that referenced this pull request Dec 1, 2020
* d6beaed Roll Fuchsia Linux SDK from gkfmiRsIl... to un3JixwuO... (flutter/engine#22744)

* 8832b48 Roll Skia from 888c5d3e57eb to 51b74afb84d4 (12 revisions) (flutter/engine#22746)

* e890901 Don't register CanvasKit with `define` (flutter/engine#22745)

* 3c51679 Roll Skia from 51b74afb84d4 to 452369182f6e (1 revision) (flutter/engine#22749)

* 5bf6533 Introduce a delegate class for gpu metal rendering (flutter/engine#22611)

* 5131aa4 Roll Skia from 452369182f6e to f2efb80bc316 (4 revisions) (flutter/engine#22750)

* 7b5f79f fuchsia: Ensure full-screen input interceptor (flutter/engine#22687)

* cec8a6e Manual roll of Dart SDK from ce76503f5b46 to dcd5a8f005a (flutter/engine#22766)

* 001a511 Roll Fuchsia Linux SDK from un3JixwuO... to Bnaeivv07... (flutter/engine#22757)

* b9615b1 Roll Fuchsia Mac SDK from 36uDTGJQp... to qpkZl0s5J... (flutter/engine#22753)

* c4c4763 Roll Skia from f2efb80bc316 to 8d78da910e45 (5 revisions) (flutter/engine#22754)

* dbd1abe Roll Dart SDK from dcd5a8f005a2 to 960620d2e811 (794 revisions) (flutter/engine#22768)

* 1c2a6bd Fix the unchecked conversion warning for searchPaths in PlayStoreDynamicFeatureManager (flutter/engine#22654)

* 81af789 add file package to deps in prep for glob update (flutter/engine#22770)

* a35e3fe Let FlutterFragment not pop the whole activity by default when more fragments are in the activity (flutter/engine#22692)

* adb3312 Revert "Introduce a delegate class for gpu metal rendering (#22611)" (flutter/engine#22775)

* bcc8832 Cleanup dart_runner examples & tests. (flutter/engine#22769)

* 609307d Roll Skia from 8d78da910e45 to fd41d878b13d (20 revisions) (flutter/engine#22772)

* 587c023 [web] Add new line break type (prohibited) (flutter/engine#22771)

* 6b2ed2b Roll Skia from fd41d878b13d to 70fe17e12f38 (6 revisions) (flutter/engine#22776)

* 7910a17 Roll Dart SDK from 960620d2e811 to 7a2a3968ef53 (12 revisions) (flutter/engine#22778)

* f4ada80 Roll Skia from 70fe17e12f38 to 4c6f57a23e63 (1 revision) (flutter/engine#22781)

* 3101dff [web] Optimize Matrix4.identity (flutter/engine#22622)

* a4ce848 Add FlutterPlayStoreSplitApplication for simpler opt in to Split AOT (flutter/engine#22752)

* 747b7912c Add file.dart to DEPS (flutter/engine#22794)

* 40fa345c0 Fix race condition in key event handling on Android (flutter/engine#22658)

* d2ad4419b Fix PlatformDispatcher.locale to return something meaningful when there are no locales. (flutter/engine#22608)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.