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

Unified Diff: pkg/dev_compiler/lib/js/es6/dart_sdk.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:
Download patch
Index: pkg/dev_compiler/lib/js/es6/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/es6/dart_sdk.js b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
index 65c5bcccfc2359800a48f2aaf676877005697856..7fdf7c807d9197a0ce4b5139f5ad540e956e67f4 100644
--- a/pkg/dev_compiler/lib/js/es6/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
@@ -2328,7 +2328,56 @@ dart.export = function(to, from, name) {
dart.copyProperties = function(to, from) {
return dart.copyTheseProperties(to, from, dart.getOwnNamesAndSymbols(from));
};
-dart.global = typeof window == "undefined" ? global : window;
+dart.global = (function() {
+ if (typeof NodeList !== "undefined") {
+ NodeList.prototype.get = function(i) {
+ return this[i];
+ };
+ NamedNodeMap.prototype.get = function(i) {
+ return this[i];
+ };
+ DOMTokenList.prototype.get = function(i) {
+ return this[i];
+ };
+ HTMLCollection.prototype.get = function(i) {
+ return this[i];
+ };
+ if (typeof PannerNode == "undefined") {
+ let audioContext;
+ if (typeof AudioContext == "undefined" && typeof webkitAudioContext != "undefined") {
+ audioContext = new webkitAudioContext();
+ } else {
+ audioContext = new AudioContext();
+ window.StereoPannerNode = audioContext.createStereoPanner().constructor;
+ }
+ window.PannerNode = audioContext.createPanner().constructor;
+ }
+ if (typeof AudioSourceNode == "undefined") {
+ window.AudioSourceNode = MediaElementAudioSourceNode.__proto__;
+ }
+ if (typeof FontFaceSet == "undefined") {
+ window.FontFaceSet = document.fonts.__proto__.constructor;
+ }
+ if (typeof MemoryInfo == "undefined") {
+ if (typeof window.performance.memory != "undefined") {
+ window.MemoryInfo = window.performance.memory.constructor;
+ }
+ }
+ if (typeof Geolocation == "undefined") {
+ navigator.geolocation.constructor;
+ }
+ if (typeof Animation == "undefined") {
+ let d = document.createElement('div');
+ if (typeof d.animate != "undefined") {
+ window.Animation = d.animate(d).constructor;
+ }
+ }
+ if (typeof SourceBufferList == "undefined") {
+ window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
+ }
+ }
+ return typeof window == "undefined" ? global : window;
+})();
dart.JsSymbol = Symbol;
dart._mixins = Symbol("mixins");
dart.implements = Symbol("implements");

Powered by Google App Engine
This is Rietveld 408576698