Skip to content

Commit

Permalink
fix: revert promise to native promise #53
Browse files Browse the repository at this point in the history
  • Loading branch information
noe132 committed Nov 19, 2021
1 parent b7ba50c commit e39084f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils/addMetaData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ const scriptContent = fs.readFileSync(path.join(__dirname, '../dist/iciba.user.j
// TEMP FIX: remove sourcemapping from base64-arraybuffer
.replace(/\n\/\/# sourceMappingURL=.{1,100}\n/, '\n')

// #53 Promise was overridden
const inits = `
var Promise = Reflect.getPrototypeOf(Response.prototype.text().catch(() => {})).constructor;
window.Promise = Promise;
var self = window;
`

const content = [
metaData,
'\n',
inits,
'if (typeof GM !== \'undefined\' || typeof GM_setValue !== \'undefined\') {\n',
scriptContent,
'\n}',
Expand Down

0 comments on commit e39084f

Please sign in to comment.