Permalink
Browse files

[[FIX]] add the "fetch" global for "browser" environment

Closes #2355
  • Loading branch information...
julienw authored and caitp committed Apr 30, 2015
1 parent 2b673d9 commit b3b41c8555da07eaeacb0648cdc8cbbec62c2f59
Showing with 14 additions and 0 deletions.
  1. +1 −0 src/vars.js
  2. +10 −0 tests/unit/fixtures/browser.js
  3. +3 −0 tests/unit/options.js
@@ -83,6 +83,7 @@ exports.browser = {
ElementTimeControl : false,
Event : false,
event : false,
fetch : false,
FileReader : false,
FormData : false,
focus : false,
@@ -25,3 +25,13 @@ var comment = new Comment("");
var df = new DocumentFragment();
var range = new Range();
var text = new Text("");

// Fetch example
// comes from MDN https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch
var myImage = document.querySelector('.my-image');
fetch('flowers.jpg').then(function(response) {
return response.blob();
}).then(function(response) {
var objectURL = URL.createObjectURL(response);
myImage.src = objectURL;
});
@@ -1509,6 +1509,9 @@ exports.browser = function (test) {
.addError(25, "'DocumentFragment' is not defined.")
.addError(26, "'Range' is not defined.")
.addError(27, "'Text' is not defined.")
.addError(31, "'document' is not defined.")
.addError(32, "'fetch' is not defined.")
.addError(35, "'URL' is not defined.")
.test(src, {es3: true, undef: true });

TestRun(test).test(src, {es3: true, browser: true, undef: true });

0 comments on commit b3b41c8

Please sign in to comment.