Skip to content

Commit 897ff99

Browse files
committed
Remove unused code
1 parent d34b2c7 commit 897ff99

File tree

2 files changed

+0
-85
lines changed

2 files changed

+0
-85
lines changed

src/util.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,6 @@ csscriticLib.util = function () {
3939
return url + delimiter + "_=" + Date.now();
4040
};
4141

42-
module.ajax = function (url) {
43-
return new Promise(function (fulfill, reject) {
44-
var xhr = new XMLHttpRequest();
45-
46-
xhr.onload = function () {
47-
if (xhr.status === 200 || xhr.status === 0) {
48-
fulfill(xhr.response);
49-
} else {
50-
reject();
51-
}
52-
};
53-
54-
xhr.onerror = function () {
55-
reject();
56-
};
57-
58-
try {
59-
xhr.open("get", getUncachableURL(url), true);
60-
xhr.send();
61-
} catch (e) {
62-
reject();
63-
}
64-
});
65-
};
66-
6742
module.loadAsBlob = function (url) {
6843
return new Promise(function (fulfill, reject) {
6944
var xhr = new XMLHttpRequest();

test/specs/utilSpec.js

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -55,66 +55,6 @@ describe("Utility", function () {
5555
});
5656
});
5757

58-
describe("ajax", function () {
59-
it("should load content from a URL", function (done) {
60-
util.ajax(testHelper.fixture("simple.js")).then(function (content) {
61-
expect(content).toEqual('var s = "hello";\n');
62-
63-
done();
64-
});
65-
});
66-
67-
it("should call error callback on fail", function (done) {
68-
util.ajax(testHelper.fixture("non_existing_url.html")).then(
69-
null,
70-
function () {
71-
done();
72-
}
73-
);
74-
});
75-
76-
it("should not cache repeated calls by default", function () {
77-
var dateNowSpy = spyOn(window.Date, "now").and.returnValue(42),
78-
ajaxRequest = jasmine.createSpyObj("ajaxRequest", [
79-
"open",
80-
"addEventListener",
81-
"overrideMimeType",
82-
"send",
83-
]);
84-
85-
spyOn(window, "XMLHttpRequest").and.returnValue(ajaxRequest);
86-
87-
util.ajax("non_existing_url.html");
88-
89-
expect(ajaxRequest.open.calls.mostRecent().args[1]).toEqual(
90-
"non_existing_url.html?_=42"
91-
);
92-
93-
dateNowSpy.and.returnValue(43);
94-
util.ajax("non_existing_url.html");
95-
expect(ajaxRequest.open.calls.mostRecent().args[1]).toEqual(
96-
"non_existing_url.html?_=43"
97-
);
98-
});
99-
100-
it("should not break existing query parameters", function () {
101-
var ajaxRequest = jasmine.createSpyObj("ajaxRequest", [
102-
"open",
103-
"addEventListener",
104-
"overrideMimeType",
105-
"send",
106-
]);
107-
spyOn(window.Date, "now").and.returnValue(42);
108-
spyOn(window, "XMLHttpRequest").and.returnValue(ajaxRequest);
109-
110-
util.ajax("non_existing_url?someParam=foo");
111-
112-
expect(ajaxRequest.open.calls.mostRecent().args[1]).toEqual(
113-
"non_existing_url?someParam=foo&_=42"
114-
);
115-
});
116-
});
117-
11858
describe("loadAsBlob", function () {
11959
var blob2Text = function (blob) {
12060
var defer = ayepromise.defer(),

0 commit comments

Comments
 (0)