-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dartium: need a way to turn on checked mode from the HTML page #3092
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
Comments
This comment was originally written by antonm@google.com If we can control checked mode per isolate level via embedder's API, that should be trivial to add. However, why not open a separate instance of Dartium with different profile? cc @a-siva. |
This comment was originally written by antonm@google.com Added this to the Later milestone. |
I don't really want to use a different profile, and have to put it somewhere and have different bookmarks and autocomplete history and stuff. It's useful to have the Chromium profile remember those things. Plus it's not very discoverable (also a problem with the environment variable). I don't understand how we can get Dart into real Chrome when such an important language feature is configured via global environment variable at launch time... However, on the development side, this is quite a bit better now that the Editor makes it easy to configure and now that it defaults to checked mode. |
This comment was originally written by antonm@google.com I am going to close it, please, reopen if you think it's very important to have. Added AsDesigned label. |
yes, this is important! We cannot have important properties of Dart in Chrome be affected by environment variables. It seems totally crazy. You can't ask users to open their browser with a magic environment variable. The HTML page needs to control these. Added Triaged label. |
cc @dgrove. |
I agree with John here - we need a way of controlling this inside the browser (and really, per-tab). |
Does the VM support Anton's suggestion in #1? If not, we should file the appropriate bug over there. |
This is something we want to support: This is not something we will support: The third suggestion (abusing mime type) is the same as the first from the VM perspective, as the bindings could pass us the flag when recognizing the special mime type. But very wrong on other aspects: Need to have a special mime type for every possible flag (including cross product), layers in between would potentially need to know how to handle these special mime types, ... |
Thanks Ivan. Yeah looking back on this now (with some months of hindsight), the flags= seems like the only sensible one of my 3 suggestions :). Maybe there are other ideas, though. |
+1 to flags="checked". I think this would work very well. |
Alternatively, something like this in the header: <meta name="dart-flags" content="checked"> This is probably safer than adding an attribute to the script tag. Strictly speaking, your html won't validate if you throw custom attributes in there (and data-* attributes are supposed to be ignored by the browser according to spec). |
Filed a blocking bug on the VM. Marked this as being blocked by #9498. |
This comment was originally written by antonm@google.com Just a thing to consider: what happens to isolates spawned? Most sensible behaviour seems to be they inherit the mode from the parent isolate. Any hidden issues? |
This makes sense to me. I think it would be simpler to have a setting for the page rather than per script tag (e.g., the meta tag approach), so you don't mix and match on the same page. I think this would also make the DartController logic simpler, but perhaps not. |
This comment was originally written by antonm@google.com Let's see how embedder's API will shape out, but technically the same VM can run isolates for various pages, so my immediate reaction is implementation-wise page granularity won't make things simpler. |
Right, I was thinking one set of flags per DartController that'd be passed into each Dart_CreateIsolate. |
Did anything ever come of this? |
I believe most of our Dart-IDE plugins will launch Dartium in checked mode for a while now. |
New commits in this revision: git log --format=%C(auto) %h %s cafadd17ba285dad9ebe6d34c617bc0d70d096b3..98a01e1cdbf441f030f1be76417860b6b372663d ✓ cafadd17 Don't use null safety (yet) (#3112) 98a01e1c Store credentials in a config directory (#3092) 4ee280b7 Fixed messages (#3110) bbdac802 Third party hosted pub registry authentication (#3007) b1bedc53 `--examples` for get/upgrade/downgrade/add/remove (#2857) Change-Id: Ibf6ffe33820c97114958c1564a7c22a46ff73d9c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213348 Commit-Queue: Sigurd Meldgaard <sigurdm@google.com> Reviewed-by: Jonas Jensen <jonasfj@google.com>
To turn on checked mode in Dartium, you have to set an environment variable. This means the checked mode setting applies globally to all web pages and apps, and has to be specified by the end user not the developer.
Something is not right with this picture :)
I'd like to be able to configure this in the HTML page. For now it'd be nice to have something simple like this:
navigator.webkitStartDart({ checked: true });
Ultimately it might make more sense to be specified per script tag. That's kind of tricky but here are some ideas:
... with a new attribute:
<script type="application/dart" src="list_example.dart" flags="checked">
... abusing mime-type:
<script type="application/dart+checked" src="list_example.dart">
... or have a way to declare the mode in the Dart source with a # directive.
<script type="application/dart">
#option checked
#import ...
The text was updated successfully, but these errors were encountered: