From 8fc8264aa2eec4cb7b2c2effc02e3a74752a7b14 Mon Sep 17 00:00:00 2001 From: Awal Garg Date: Mon, 31 Aug 2015 20:42:47 +0530 Subject: [PATCH] blacklist fetch --- source/codeWorker.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/codeWorker.js b/source/codeWorker.js index 63067dd..4c04dbe 100644 --- a/source/codeWorker.js +++ b/source/codeWorker.js @@ -73,6 +73,16 @@ var whitey = { 'WorkerMessageEvent': 1 }; +/** + * DOM specification doesn't define an enumerable `fetch` function object on the global object + * so we add the property here, and the following code will blacklist it. + * (`fetch` descends from `GlobalFetch`, and is thus present in worker code as well) + * Just in case someone runs the bot on some old browser where `fetch` is not defined anyways, + * this will have no effect. + * Reason for blacklisting fetch: well, same as XHR. + */ +global.fetch = undefined; + [ global, Object.getPrototypeOf(global) ].forEach(function ( obj ) { Object.getOwnPropertyNames( obj ).forEach(function( prop ) { if( whitey.hasOwnProperty(prop) ) {