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

Unified Diff: pkg/dev_compiler/lib/js/legacy/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/legacy/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
index 6991a90e99901f8fa11c397ac9a8b2854204a10d..c0c3f05d11cc203a607799e15680e01e43e668ce 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -2331,7 +2331,56 @@ dart_library.library('dart_sdk', null, /* Imports */[
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