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

Side by Side Diff: pkg/dev_compiler/lib/js/legacy/dart_library.js

Issue 2649613003: Fix for Animation and other polyfills (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /* This file defines the module loader for the dart runtime. 5 /* This file defines the module loader for the dart runtime.
6 */ 6 */
7 var dart_library; 7 var dart_library;
8 if (!dart_library) { 8 if (!dart_library) {
9 dart_library = 9 dart_library =
10 typeof module != "undefined" && module.exports || {}; 10 typeof module != "undefined" && module.exports || {};
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 dart_library.start = start; 133 dart_library.start = start;
134 134
135 let _bootstrapped = false; 135 let _bootstrapped = false;
136 function bootstrap() { 136 function bootstrap() {
137 if (_bootstrapped) return; 137 if (_bootstrapped) return;
138 _bootstrapped = true; 138 _bootstrapped = true;
139 139
140 // Force import of core. 140 // Force import of core.
141 var dart_sdk = import_('dart_sdk'); 141 var dart_sdk = import_('dart_sdk');
142 142
143 // TODO(vsm): Move this to a shared location:
144 // https://github.com/dart-lang/sdk/issues/27605
145 if (typeof NodeList !== "undefined") {
146 // TODO(vsm): Do we still need these?
147 NodeList.prototype.get = function(i) { return this[i]; };
148 NamedNodeMap.prototype.get = function(i) { return this[i]; };
149 DOMTokenList.prototype.get = function(i) { return this[i]; };
150 HTMLCollection.prototype.get = function(i) { return this[i]; };
151
152 // Expose constructors for DOM types dart:html needs to assume are
153 // available on window.
154 if (typeof PannerNode == "undefined") {
155 let audioContext;
156 if (typeof AudioContext == "undefined" &&
157 (typeof webkitAudioContext != "undefined")) {
158 audioContext = new webkitAudioContext();
159 } else {
160 audioContext = new AudioContext();
161 window.StereoPannerNode =
162 audioContext.createStereoPanner().constructor;
163 }
164 window.PannerNode = audioContext.createPanner().constructor;
165 }
166 if (typeof AudioSourceNode == "undefined") {
167 window.AudioSourceNode = MediaElementAudioSourceNode.constructor;
168 }
169 if (typeof FontFaceSet == "undefined") {
170 window.FontFaceSet = document.fonts.__proto__.constructor;
171 }
172 if (typeof MemoryInfo == "undefined") {
173 if (typeof window.performance.memory != "undefined") {
174 window.MemoryInfo = window.performance.memory.constructor;
175 }
176 }
177 if (typeof Geolocation == "undefined") {
178 navigator.geolocation.constructor;
179 }
180 if (typeof Animation == "undefined") {
181 let d = document.createElement('div');
182 if (typeof d.animate != "undefined") {
183 window.Animation = d.animate(d).constructor;
184 }
185 }
186 if (typeof SourceBufferList == "undefined") {
187 window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
188 }
189 }
190
191 // This import is only needed for chrome debugging. We should provide an 143 // This import is only needed for chrome debugging. We should provide an
192 // option to compile without it. 144 // option to compile without it.
193 dart_sdk._debugger.registerDevtoolsFormatter(); 145 dart_sdk._debugger.registerDevtoolsFormatter();
194 } 146 }
195 147
196 })(dart_library); 148 })(dart_library);
197 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698