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

Side by Side Diff: pkg/polymer/lib/boot.js

Issue 462333002: Change how we check for user agent, in preparation for breaking change in Dartium. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Experimental bootstrap to initialize polymer applications. This library is 5 /// Experimental bootstrap to initialize polymer applications. This library is
6 /// not used by default, and may be replaced by Dart code in the near future. 6 /// not used by default, and may be replaced by Dart code in the near future.
7 /// 7 ///
8 /// This script contains logic to bootstrap polymer apps during development. It 8 /// This script contains logic to bootstrap polymer apps during development. It
9 /// internally discovers Dart script tags through HTML imports, and constructs 9 /// internally discovers Dart script tags through HTML imports, and constructs
10 /// a new entrypoint for the application that is then launched in an isolate. 10 /// a new entrypoint for the application that is then launched in an isolate.
(...skipping 15 matching lines...) Expand all
26 /// script tags in the main page, so you may need to move some code into an HTML 26 /// script tags in the main page, so you may need to move some code into an HTML
27 /// import. For example, If you need to run some initialization code before any 27 /// import. For example, If you need to run some initialization code before any
28 /// other code is executed, include an HTML import to an html file with a 28 /// other code is executed, include an HTML import to an html file with a
29 /// "application/dart" script tag that contains an initializer 29 /// "application/dart" script tag that contains an initializer
30 /// method with the body of your old main, and make sure this tag is placed 30 /// method with the body of your old main, and make sure this tag is placed
31 /// above other html-imports that load the rest of the application. 31 /// above other html-imports that load the rest of the application.
32 /// Initialization methods are executed in the order in which they are 32 /// Initialization methods are executed in the order in which they are
33 /// discovered in the HTML document. 33 /// discovered in the HTML document.
34 (function() { 34 (function() {
35 // Only run in Dartium. 35 // Only run in Dartium.
36 if (navigator.userAgent.indexOf('(Dart)') === -1) return; 36 if (!navigator.dartEnabled &&
37 // TODO(sigmund): remove userAgent check once 1.6 rolls as stable.
38 // See: dartbug.com/18463
39 (navigator.userAgent.indexOf('(Dart)') === -1)) {
40 return;
41 }
37 42
38 // Extract a Dart import URL from a script tag, which is the 'src' attribute 43 // Extract a Dart import URL from a script tag, which is the 'src' attribute
39 // of the script tag, or a data-url with the script contents for inlined code. 44 // of the script tag, or a data-url with the script contents for inlined code.
40 function getScriptUrl(script) { 45 function getScriptUrl(script) {
41 var url = script.src; 46 var url = script.src;
42 if (url) { 47 if (url) {
43 // Normalize package: urls 48 // Normalize package: urls
44 var index = url.indexOf('packages/'); 49 var index = url.indexOf('packages/');
45 if (index == 0 || (index > 0 && url[index - 1] == '/')) { 50 if (index == 0 || (index > 0 && url[index - 1] == '/')) {
46 url = "package:" + url.slice(index + 9); 51 url = "package:" + url.slice(index + 9);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 + 'doesn\'t have a main, but a top-level method marked with ' 124 + 'doesn\'t have a main, but a top-level method marked with '
120 + '@initMethod instead'); 125 + '@initMethod instead');
121 for (var i = 0; i < results.badTags.length; i++) { 126 for (var i = 0; i < results.badTags.length; i++) {
122 console.warn(results.badTags[i]); 127 console.warn(results.badTags[i]);
123 } 128 }
124 } 129 }
125 newScript.textContent = createMain(results.scripts); 130 newScript.textContent = createMain(results.scripts);
126 document.body.appendChild(newScript); 131 document.body.appendChild(newScript);
127 }); 132 });
128 })(); 133 })();
OLDNEW
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698