mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-17 20:57:30 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
45
layout/generic/test/file_SlowImage.sjs
Normal file
45
layout/generic/test/file_SlowImage.sjs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const IMG_BYTES = atob(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAA" +
|
||||
"DUlEQVQImWNgY2P7DwABOgESJhRQtgAAAABJRU5ErkJggg==");
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
getObjectState("context", function(obj) {
|
||||
let ctx;
|
||||
if (obj == null) {
|
||||
ctx = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
ctx.wrappedJSObject = ctx;
|
||||
|
||||
ctx.promise = new Promise(resolve => {
|
||||
ctx.resolve = resolve;
|
||||
});
|
||||
|
||||
setObjectState("context", ctx);
|
||||
} else {
|
||||
ctx = obj.wrappedJSObject;
|
||||
}
|
||||
Promise.resolve(ctx).then(next);
|
||||
});
|
||||
|
||||
function next(ctx) {
|
||||
if (request.queryString.indexOf("continue") >= 0) {
|
||||
ctx.resolve();
|
||||
}
|
||||
|
||||
ctx.promise.then(() => {
|
||||
response.setHeader("Content-Type", "image/png");
|
||||
response.write(IMG_BYTES);
|
||||
response.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue