| OLD | NEW |
| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // TODO(vsm): DOM facades? | 128 // TODO(vsm): DOM facades? |
| 129 // See: https://github.com/dart-lang/dev_compiler/issues/173 | 129 // See: https://github.com/dart-lang/dev_compiler/issues/173 |
| 130 if (typeof NodeList !== "undefined") { | 130 if (typeof NodeList !== "undefined") { |
| 131 NodeList.prototype.get = function(i) { return this[i]; }; | 131 NodeList.prototype.get = function(i) { return this[i]; }; |
| 132 NamedNodeMap.prototype.get = function(i) { return this[i]; }; | 132 NamedNodeMap.prototype.get = function(i) { return this[i]; }; |
| 133 DOMTokenList.prototype.get = function(i) { return this[i]; }; | 133 DOMTokenList.prototype.get = function(i) { return this[i]; }; |
| 134 HTMLCollection.prototype.get = function(i) { return this[i]; }; | 134 HTMLCollection.prototype.get = function(i) { return this[i]; }; |
| 135 // Expose constructors for DOM types dart:html needs to assume are | 135 // Expose constructors for DOM types dart:html needs to assume are |
| 136 // available on window. | 136 // available on window. |
| 137 if (typeof PannerNode == "undefined") { | 137 if (typeof PannerNode == "undefined") { |
| 138 let audioContext = new AudioContext(); | 138 let audioContext; |
| 139 if (typeof AudioContext == "undefined" && |
| 140 (typeof webkitAudioContext != "undefined")) { |
| 141 audioContext = new webkitAudioContext(); |
| 142 } else { |
| 143 audioContext = new AudioContext(); |
| 144 window.StereoPannerNode = |
| 145 audioContext.createStereoPanner().constructor; |
| 146 } |
| 139 window.PannerNode = audioContext.createPanner().constructor; | 147 window.PannerNode = audioContext.createPanner().constructor; |
| 140 window.StereoPannerNode = audioContext.createStereoPanner().constructor; | |
| 141 } | 148 } |
| 142 if (typeof AudioSourceNode == "undefined") { | 149 if (typeof AudioSourceNode == "undefined") { |
| 143 window.AudioSourceNode = MediaElementAudioSourceNode.constructor; | 150 window.AudioSourceNode = MediaElementAudioSourceNode.constructor; |
| 144 } | 151 } |
| 145 if (typeof FontFaceSet == "undefined") { | 152 if (typeof FontFaceSet == "undefined") { |
| 146 window.FontFaceSet = document.fonts.__proto__.constructor; | 153 window.FontFaceSet = document.fonts.__proto__.constructor; |
| 147 } | 154 } |
| 148 if (typeof MemoryInfo == "undefined") { | 155 if (typeof MemoryInfo == "undefined") { |
| 149 window.MemoryInfo = window.performance.memory.constructor; | 156 if (typeof window.performance.memory != "undefined") { |
| 157 window.MemoryInfo = window.performance.memory.constructor; |
| 158 } |
| 150 } | 159 } |
| 151 if (typeof Geolocation == "undefined") { | 160 if (typeof Geolocation == "undefined") { |
| 152 navigator.geolocation.constructor; | 161 navigator.geolocation.constructor; |
| 153 } | 162 } |
| 154 if (typeof Animation == "undefined") { | 163 if (typeof Animation == "undefined") { |
| 155 let d = document.createElement('div'); | 164 let d = document.createElement('div'); |
| 156 window.Animation = d.animate(d).constructor; | 165 if (typeof d.animate != "undefined") { |
| 166 window.Animation = d.animate(d).constructor; |
| 167 } |
| 157 } | 168 } |
| 158 if (typeof SourceBufferList == "undefined") { | 169 if (typeof SourceBufferList == "undefined") { |
| 159 window.SourceBufferList = new MediaSource().sourceBuffers.constructor; | 170 window.SourceBufferList = new MediaSource().sourceBuffers.constructor; |
| 160 } | 171 } |
| 161 } | 172 } |
| 162 | 173 |
| 163 // This import is only needed for chrome debugging. We should provide an | 174 // This import is only needed for chrome debugging. We should provide an |
| 164 // option to compile without it. | 175 // option to compile without it. |
| 165 dart_sdk._debugger.registerDevtoolsFormatter(); | 176 dart_sdk._debugger.registerDevtoolsFormatter(); |
| 166 } | 177 } |
| 167 | 178 |
| 168 })(dart_library); | 179 })(dart_library); |
| OLD | NEW |