Dart in Chrome extensions: ready for production?

1,559 views
Skip to first unread message

Alexander Tkachev

unread,
Dec 5, 2012, 6:18:14 AM12/5/12
to mi...@dartlang.org
Hello everyone!

I wrote a very simple web app just to learn Dart: https://github.com/Leksat/time_tracker
It only useful when it's opened in a popup window. So I decide to create a Chrome extension. Also very simple: click on extension icon will open a popup with my app.
The extension works perfect in Google Chrome and Dartium.

So, what I wanted to say...
Most of people I know don't want to use Dart (or even look on it) until "Google will use it in some of its live services/apps".
In my opinion, Chrome App Store is the area where Dart already can be used safely, without worries about cross-browser compatibility, etc.
Of course, I don't know for sure, but maybe if Dart team will create some more or less usefull extension for Chrome, it will attract more attention to Dart. 

What do you think about it?

Anton Muhin

unread,
Dec 6, 2012, 9:53:24 AM12/6/12
to General Dart Discussion
You're right, Alexander.

We're planning to implementation extensions API, but right now we just
do not have another time to do that.

And thanks a lot for trying Dart.

yours,
anton.
> --
> Consider asking HOWTO questions at Stack Overflow:
> http://stackoverflow.com/tags/dart
>
>

financeCoding

unread,
Dec 26, 2012, 7:00:03 PM12/26/12
to mi...@dartlang.org
Hi Alexander,

A few of us from the dart community have similar feelings about using apps API. https://github.com/dart-gde/chrome.dart is still in very early days and depends on js-interop for all the communications to the existing javascript API. Our goal is to have a working library for chrome.*, sooner then later. So far only two  scopes are available chrome.serial and chrome.socket. The library is WIP and no guarantees included :) 

I found deploying to Chrome App Store with dart to be simple enough. Easier to wrap your head around then thinking about browser compatibility. 

KInd Regards,
Adam 

Meow

unread,
Dec 27, 2012, 12:52:25 AM12/27/12
to mi...@dartlang.org
I'm writing a Chrome Extension in Dart.
I found that I had to wrap Dart code in sand-boxed frames, for dart2js uses "new Function()" which is prohibited by manifest version 2.
Things are getting too complex and I don't have much time. So I decided to put the development on hold until next February.
For now only the core logic has been implemented. Settings and browser communication are left undone.

Dart Web Components seem to be the best way to implement the UI. I'll give it a try later.

I'm also looking forward to more good news on the extensions API.

Seth Ladd

unread,
Jan 4, 2013, 1:18:36 AM1/4/13
to General Dart Discussion
Thanks for trying Dart!

For the record, there is a command-line flag for dart2js to emit CSP compatible code. You can try to compile your Dart code with --disallow-unsafe-eval Among other others, this eliminates "new Function()" from the generated JavaScript. Give it a shot and let us know!

Seth


--

s_

unread,
Jan 4, 2013, 1:24:12 AM1/4/13
to mi...@dartlang.org
That's great! I was once told that removing unsafe code is not a
design goal of dart2js, but now it seems the Dart team does care about
CSP.

I'll try it out later.

Dominic Hamon

unread,
Feb 1, 2013, 7:21:04 PM2/1/13
to General Dart Discussion
I am finally getting around to trying this, and I've found that I'm still getting unsafe eval when calling in to the socket API (using the prerelease chrome.dart project)

I haven't quite debugged it (having to debug in JS due to dartium complaining about a web_ui overload of an Element method with different signature) but it seems to be in the socket connect code. Anyone else seeing this, or am I doing it wrong?

Dan Grove

unread,
Feb 1, 2013, 7:45:34 PM2/1/13
to General Dart Discussion, web...@dartlang.org
+web-ui for the dartium issue (@Dominic - are you using bleeding_edge or trunk? web_ui runs against the trunk build and is pushed to pub weekly to match the trunk releases)

Dominic Hamon

unread,
Feb 1, 2013, 7:47:48 PM2/1/13
to General Dart Discussion, web-ui
web_ui 0.3.1+2
dart sdk 17657
dartium 17946

Siggi Cherem

unread,
Feb 1, 2013, 8:27:13 PM2/1/13
to Dominic Hamon, General Dart Discussion, web-ui
Hey Dominic - it seems that the problem is indeed that you are using a newer dartium.

The SDK comes also with a dartium included that matches the same revision (r17657), let us know if you still see errors there. 


--
You received this message because you are subscribed to the Google Groups "Dart-Web-UI" group.
To post to this group, send email to web...@dartlang.org.
Visit this group at http://groups.google.com/a/dartlang.org/group/web-ui/?hl=en-US.
 
 

Ross Smith

unread,
Feb 1, 2013, 9:02:20 PM2/1/13
to mi...@dartlang.org, Dominic Hamon, web-ui
You may be already doing this, but your entry point needs to bring in the js from the js library or else it will break CSP when it injects it, possibly this is what you are hitting.  Try adding this to your entry point (chrome app) html (if you didn't already!):

<script type="text/javascript" src="packages/js/dart_interop.js"></script> 

Dominic Hamon

unread,
Feb 4, 2013, 2:31:38 PM2/4/13
to Ross Smith, General Dart Discussion, web-ui
That's the one, thanks.

I had to include it after browser/dart.js, and because i'm building a packaged app I needed to pull it out of the symlinked package, but that fixed this error :)

Ross Smith

unread,
Feb 4, 2013, 3:07:39 PM2/4/13
to mi...@dartlang.org, Ross Smith, web-ui
Cheers, I opened an issue on Friday to track it, with more details :)

Reply all
Reply to author
Forward
0 new messages