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

Side by Side Diff: lib/runtime/dart_library.js

Issue 1974063002: polyfill prototypes on window for important dart:html types where recent versions of Chrome hide th… (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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) 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 7
8 var dart_library = 8 var dart_library =
9 typeof module != "undefined" && module.exports || {}; 9 typeof module != "undefined" && module.exports || {};
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Force import of core. 108 // Force import of core.
109 var dart_sdk = import_('dart_sdk'); 109 var dart_sdk = import_('dart_sdk');
110 110
111 // TODO(vsm): DOM facades? 111 // TODO(vsm): DOM facades?
112 // See: https://github.com/dart-lang/dev_compiler/issues/173 112 // See: https://github.com/dart-lang/dev_compiler/issues/173
113 if (typeof NodeList !== "undefined") { 113 if (typeof NodeList !== "undefined") {
114 NodeList.prototype.get = function(i) { return this[i]; }; 114 NodeList.prototype.get = function(i) { return this[i]; };
115 NamedNodeMap.prototype.get = function(i) { return this[i]; }; 115 NamedNodeMap.prototype.get = function(i) { return this[i]; };
116 DOMTokenList.prototype.get = function(i) { return this[i]; }; 116 DOMTokenList.prototype.get = function(i) { return this[i]; };
117 HTMLCollection.prototype.get = function(i) { return this[i]; }; 117 HTMLCollection.prototype.get = function(i) { return this[i]; };
118 // Expose constructors for DOM types dart:html needs to assume are
119 // available on window.
120 if (typeof PannerNode == "undefined") {
121 let audioContext = new AudioContext();
122 window.PannerNode = audioContext.createPanner().constructor;
123 window.StereoPannerNode = audioContext.createStereoPanner().constructor;
124 }
125 if (typeof AudioSourceNode == "undefined") {
126 window.AudioSourceNode = MediaElementAudioSourceNode.constructor;
127 }
128 if (typeof FontFaceSet == "undefined") {
129 window.FontFaceSet = document.fonts.__proto__.constructor;
130 }
131 if (typeof MemoryInfo == "undefined") {
132 window.MemoryInfo = window.performance.memory.constructor;
133 }
134 if (typeof Geolocation == "undefined") {
135 navigator.geolocation.constructor;
136 }
137 if (typeof Animation == "undefined") {
138 let d = document.createElement('div');
139 window.Animation = d.animate(d).constructor;
140 }
141 if (typeof WebGLVertexArrayObjectOES == "undefined") {
142 window.WebGLVertexArrayObjectOES = document.createElement('canvas')
143 .getContext('webgl')
144 .getExtension("OES_vertex_array_object")
145 .createVertexArrayOES().constructor;
146 }
118 } 147 }
119 148
120 // This import is only needed for chrome debugging. We should provide an 149 // This import is only needed for chrome debugging. We should provide an
121 // option to compile without it. 150 // option to compile without it.
122 dart_sdk._debugger.registerDevtoolsFormatter(); 151 dart_sdk._debugger.registerDevtoolsFormatter();
123 } 152 }
124 153
125 })(dart_library); 154 })(dart_library);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698