Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: pkg/polymer/lib/src/loader.dart

Issue 329923002: Remove platform.js from polymer.html, hint in the linter that it should be used (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/src/loader.dart
diff --git a/pkg/polymer/lib/src/loader.dart b/pkg/polymer/lib/src/loader.dart
index f80353223f5d7b39bd1d79eb5d3a120d956e2df0..573720052aab5fbeb11bf1c20a5f54ee25f6cd6d 100644
--- a/pkg/polymer/lib/src/loader.dart
+++ b/pkg/polymer/lib/src/loader.dart
@@ -86,14 +86,26 @@ void configureForDeployment(List<Function> initializers) {
/// * if it has a Dart class, run PolymerDeclaration's register.
/// * otherwise it is a JS prototype, run polymer-element's normal register.
void _hookJsPolymer() {
+ // Note: platform.js is not used directly here, but we check that it is loaded
+ // to provide a good error message in Dartium if people forgot to include it.
+ // Otherwise, polymer.js below will fail with a hard to understand error
+ // message.
+ var platform = js.context['Platform'];
+ if (platform == null) {
+ throw new StateError('platform.js, dart_support.js must be loaded at'
+ ' the top of your application, before any other scripts or HTML'
+ ' imports that use polymer. Putting these two script tags at the top of'
+ ' your <head> element should address this issue:'
+ ' <script src="packages/web_components/platform.js"></script> and '
+ ' <script src="packages/web_components/dart_support.js"></script>.');
+ }
var polymerJs = js.context['Polymer'];
if (polymerJs == null) {
throw new StateError('polymer.js must be loaded before polymer.dart, please'
' add <link rel="import" href="packages/polymer/polymer.html"> to your'
' <head> before any Dart scripts. Alternatively you can get a different'
' version of polymer.js by following the instructions at'
- ' http://www.polymer-project.org; if you do that be sure to include'
- ' the platform polyfills.');
+ ' http://www.polymer-project.org.');
}
// TODO(jmesserly): dart:js appears to not callback in the correct zone:

Powered by Google App Engine
This is Rietveld 408576698