Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

goose-chrome-environment

Package Overview
Dependencies
49
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.18 to 1.1.0

470

lib/ChromeEnvironment.js

@@ -190,7 +190,2 @@ 'use strict';

_this._redirectUrls = [];
if (!_this._url) {
throw new Error('You must pass `url` to PuppeteerEnvironment');
}
_this._browser = null;

@@ -212,36 +207,43 @@ _this._page = null;

debug('Preparing...');
_context.next = 3;
if (!(this._browser && this._browser.process() && this._page)) {
_context.next = 4;
break;
}
debug('Already initialized.');
return _context.abrupt('return');
case 4:
_context.next = 6;
return (0, _get3.default)(ChromeEnvironment.prototype.__proto__ || (0, _getPrototypeOf2.default)(ChromeEnvironment.prototype), 'prepare', this).call(this);
case 3:
_context.next = 5;
case 6:
_context.next = 8;
return this._setup();
case 5:
_context.next = 7;
case 8:
_context.next = 10;
return this._setViewport();
case 7:
_context.next = 9;
case 10:
_context.next = 12;
return this._setUserAgent();
case 9:
_context.next = 11;
case 12:
_context.next = 14;
return this._setTimeout();
case 11:
_context.next = 13;
case 14:
_context.next = 16;
return this._handlePuppeteerEvents();
case 13:
_context.next = 15;
return this._navigateTo(this._url);
case 16:
if (!this._url) {
_context.next = 19;
break;
}
case 15:
_context.next = 17;
return this._validateProxy();
case 17:
_context.next = 19;
return this._injectFiles(this._getVendors());
return this.goto(this._url);

@@ -262,3 +264,61 @@ case 19:

}()
/**
* Go to the page
* @param {string} url
* @return {Promise<{}>}
*/
}, {
key: 'goto',
value: function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(url) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (url) {
_context2.next = 2;
break;
}
throw new Error('Missing url parameter passed to ChromeEnvironment');
case 2:
this._url = url;
this._proxyErrors = [];
this._redirectUrls = [];
this._navigationActions = [];
this._requestingActions = [];
_context2.next = 9;
return this._navigateTo(url);
case 9:
_context2.next = 11;
return this._validateProxy();
case 11:
_context2.next = 13;
return this._injectFiles(this._getVendors());
case 13:
return _context2.abrupt('return', this._page);
case 14:
case 'end':
return _context2.stop();
}
}
}, _callee2, this);
}));
function goto(_x) {
return _ref2.apply(this, arguments);
}
return goto;
}()
}, {
key: 'setProxy',

@@ -306,7 +366,7 @@ value: function setProxy(proxy) {

value: function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(fileName) {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(fileName) {
var options, screenShotFilePath, screenShotFileName;
return _regenerator2.default.wrap(function _callee2$(_context2) {
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context3.prev = _context3.next) {
case 0:

@@ -316,7 +376,7 @@ options = this._options;

if (this._options.snapshot) {
_context2.next = 3;
_context3.next = 3;
break;
}
return _context2.abrupt('return', _promise2.default.resolve());
return _context3.abrupt('return', _promise2.default.resolve());

@@ -328,7 +388,7 @@ case 3:

debug('.snapshot() to %s', screenShotFileName);
_context2.next = 8;
_context3.next = 8;
return mkdir(screenShotFilePath);
case 8:
return _context2.abrupt('return', this._page.screenshot({
return _context3.abrupt('return', this._page.screenshot({
path: screenShotFileName,

@@ -346,10 +406,10 @@ fullPage: true,

case 'end':
return _context2.stop();
return _context3.stop();
}
}
}, _callee2, this);
}, _callee3, this);
}));
function snapshot(_x) {
return _ref2.apply(this, arguments);
function snapshot(_x2) {
return _ref3.apply(this, arguments);
}

@@ -362,8 +422,8 @@

value: function () {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(timeout) {
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(timeout) {
var _this2 = this;
return _regenerator2.default.wrap(function _callee3$(_context3) {
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context4.prev = _context4.next) {
case 0:

@@ -373,3 +433,3 @@ // eslint-disable-next-line no-param-reassign

_context3.next = 3;
_context4.next = 3;
return new _promise2.default(function (resolve, reject) {

@@ -394,3 +454,3 @@ var timeoutId = setTimeout(function () {

case 3:
_context3.next = 5;
_context4.next = 5;
return this._injectFiles(this._getVendors());

@@ -400,10 +460,10 @@

case 'end':
return _context3.stop();
return _context4.stop();
}
}
}, _callee3, this);
}, _callee4, this);
}));
function waitForPage(_x2) {
return _ref3.apply(this, arguments);
function waitForPage(_x3) {
return _ref4.apply(this, arguments);
}

@@ -416,8 +476,8 @@

value: function () {
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(uri, timeout) {
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(uri, timeout) {
var _this3 = this;
return _regenerator2.default.wrap(function _callee4$(_context4) {
return _regenerator2.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context4.prev = _context4.next) {
switch (_context5.prev = _context5.next) {
case 0:

@@ -427,3 +487,3 @@ // eslint-disable-next-line no-param-reassign

return _context4.abrupt('return', new _promise2.default(function (resolve, reject) {
return _context5.abrupt('return', new _promise2.default(function (resolve, reject) {
var timeoutId = setTimeout(function () {

@@ -451,10 +511,10 @@ debug('Timeout %s has reached for waiting query %s', timeout, uri);

case 'end':
return _context4.stop();
return _context5.stop();
}
}
}, _callee4, this);
}, _callee5, this);
}));
function waitForQuery(_x3, _x4) {
return _ref4.apply(this, arguments);
function waitForQuery(_x4, _x5) {
return _ref5.apply(this, arguments);
}

@@ -467,20 +527,20 @@

value: function () {
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5() {
return _regenerator2.default.wrap(function _callee5$(_context5) {
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6() {
return _regenerator2.default.wrap(function _callee6$(_context6) {
while (1) {
switch (_context5.prev = _context5.next) {
switch (_context6.prev = _context6.next) {
case 0:
debug('Back');
return _context5.abrupt('return', this._page.goBack());
return _context6.abrupt('return', this._page.goBack());
case 2:
case 'end':
return _context5.stop();
return _context6.stop();
}
}
}, _callee5, this);
}, _callee6, this);
}));
function back() {
return _ref5.apply(this, arguments);
return _ref6.apply(this, arguments);
}

@@ -493,22 +553,22 @@

value: function () {
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(selector) {
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(selector) {
var position;
return _regenerator2.default.wrap(function _callee6$(_context6) {
return _regenerator2.default.wrap(function _callee7$(_context7) {
while (1) {
switch (_context6.prev = _context6.next) {
switch (_context7.prev = _context7.next) {
case 0:
_context6.next = 2;
_context7.next = 2;
return this._getElementPosition(selector);
case 2:
position = _context6.sent;
_context6.next = 5;
position = _context7.sent;
_context7.next = 5;
return this.mouseDown(selector);
case 5:
_context6.next = 7;
_context7.next = 7;
return this._page.mouse.click(position.x, position.y);
case 7:
_context6.next = 9;
_context7.next = 9;
return this.mouseUp(selector);

@@ -518,10 +578,10 @@

case 'end':
return _context6.stop();
return _context7.stop();
}
}
}, _callee6, this);
}, _callee7, this);
}));
function mouseClick(_x5) {
return _ref6.apply(this, arguments);
function mouseClick(_x6) {
return _ref7.apply(this, arguments);
}

@@ -537,19 +597,19 @@

value: function () {
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(selector) {
return _regenerator2.default.wrap(function _callee7$(_context7) {
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(selector) {
return _regenerator2.default.wrap(function _callee8$(_context8) {
while (1) {
switch (_context7.prev = _context7.next) {
switch (_context8.prev = _context8.next) {
case 0:
return _context7.abrupt('return', this._page.mouse.down({ button: 'left' }));
return _context8.abrupt('return', this._page.mouse.down({ button: 'left' }));
case 1:
case 'end':
return _context7.stop();
return _context8.stop();
}
}
}, _callee7, this);
}, _callee8, this);
}));
function mouseDown(_x6) {
return _ref7.apply(this, arguments);
function mouseDown(_x7) {
return _ref8.apply(this, arguments);
}

@@ -565,19 +625,19 @@

value: function () {
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(selector) {
return _regenerator2.default.wrap(function _callee8$(_context8) {
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(selector) {
return _regenerator2.default.wrap(function _callee9$(_context9) {
while (1) {
switch (_context8.prev = _context8.next) {
switch (_context9.prev = _context9.next) {
case 0:
return _context8.abrupt('return', this._page.mouse.up({ button: 'left' }));
return _context9.abrupt('return', this._page.mouse.up({ button: 'left' }));
case 1:
case 'end':
return _context8.stop();
return _context9.stop();
}
}
}, _callee8, this);
}, _callee9, this);
}));
function mouseUp(_x7) {
return _ref8.apply(this, arguments);
function mouseUp(_x8) {
return _ref9.apply(this, arguments);
}

@@ -590,9 +650,9 @@

value: function () {
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(selector) {
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(selector) {
var position;
return _regenerator2.default.wrap(function _callee9$(_context9) {
return _regenerator2.default.wrap(function _callee10$(_context10) {
while (1) {
switch (_context9.prev = _context9.next) {
switch (_context10.prev = _context10.next) {
case 0:
_context9.next = 2;
_context10.next = 2;
return this.evaluateJs(selector, /* @covignore */function (selector) {

@@ -613,6 +673,6 @@ // eslint-disable-next-line no-undef

case 2:
position = _context9.sent;
position = _context10.sent;
if (position) {
_context9.next = 5;
_context10.next = 5;
break;

@@ -626,14 +686,14 @@ }

return _context9.abrupt('return', position);
return _context10.abrupt('return', position);
case 7:
case 'end':
return _context9.stop();
return _context10.stop();
}
}
}, _callee9, this);
}, _callee10, this);
}));
function _getElementPosition(_x8) {
return _ref9.apply(this, arguments);
function _getElementPosition(_x9) {
return _ref10.apply(this, arguments);
}

@@ -653,12 +713,12 @@

value: function () {
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10() {
return _regenerator2.default.wrap(function _callee10$(_context10) {
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11() {
return _regenerator2.default.wrap(function _callee11$(_context11) {
while (1) {
switch (_context10.prev = _context10.next) {
switch (_context11.prev = _context11.next) {
case 0:
_context10.next = 2;
_context11.next = 2;
return this._createInstance();
case 2:
_context10.next = 4;
_context11.next = 4;
return this._createPage();

@@ -668,10 +728,10 @@

case 'end':
return _context10.stop();
return _context11.stop();
}
}
}, _callee10, this);
}, _callee11, this);
}));
function _setup() {
return _ref10.apply(this, arguments);
return _ref11.apply(this, arguments);
}

@@ -691,14 +751,14 @@

value: function () {
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11() {
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12() {
var args, proxy;
return _regenerator2.default.wrap(function _callee11$(_context11) {
return _regenerator2.default.wrap(function _callee12$(_context12) {
while (1) {
switch (_context11.prev = _context11.next) {
switch (_context12.prev = _context12.next) {
case 0:
args = ['--no-sandbox', '--disable-dev-shm-usage'];
_context11.next = 3;
_context12.next = 3;
return this._rotateProxy();
case 3:
proxy = _context11.sent;
proxy = _context12.sent;

@@ -708,3 +768,3 @@ if (proxy) {

}
_context11.next = 7;
_context12.next = 7;
return puppeteer.launch({

@@ -717,14 +777,14 @@ ignoreHTTPSErrors: this._options.ignoreSslErrors,

case 7:
this._browser = _context11.sent;
this._browser = _context12.sent;
case 8:
case 'end':
return _context11.stop();
return _context12.stop();
}
}
}, _callee11, this);
}, _callee12, this);
}));
function _createInstance() {
return _ref11.apply(this, arguments);
return _ref12.apply(this, arguments);
}

@@ -743,24 +803,24 @@

value: function () {
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12() {
return _regenerator2.default.wrap(function _callee12$(_context12) {
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13() {
return _regenerator2.default.wrap(function _callee13$(_context13) {
while (1) {
switch (_context12.prev = _context12.next) {
switch (_context13.prev = _context13.next) {
case 0:
debug('._createPage() has called');
_context12.next = 3;
_context13.next = 3;
return this._browser.newPage();
case 3:
this._page = _context12.sent;
this._page = _context13.sent;
if (!this._proxyCurrent) {
_context12.next = 7;
_context13.next = 7;
break;
}
_context12.next = 7;
_context13.next = 7;
return this._page.authenticate(this._proxyCurrent);
case 7:
_context12.next = 9;
_context13.next = 9;
return this._page.setRequestInterception(true);

@@ -770,10 +830,10 @@

case 'end':
return _context12.stop();
return _context13.stop();
}
}
}, _callee12, this);
}, _callee13, this);
}));
function _createPage() {
return _ref12.apply(this, arguments);
return _ref13.apply(this, arguments);
}

@@ -792,6 +852,6 @@

value: function () {
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13() {
return _regenerator2.default.wrap(function _callee13$(_context13) {
var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14() {
return _regenerator2.default.wrap(function _callee14$(_context14) {
while (1) {
switch (_context13.prev = _context13.next) {
switch (_context14.prev = _context14.next) {
case 0:

@@ -801,3 +861,3 @@ debug('._tearDownInstance() tearing down');

if (!(!this._browser || !this._browser.process())) {
_context13.next = 4;
_context14.next = 4;
break;

@@ -807,11 +867,11 @@ }

debug('Puppeteer process already exited, not killing');
return _context13.abrupt('return', _promise2.default.resolve());
return _context14.abrupt('return', _promise2.default.resolve());
case 4:
if (!this._page) {
_context13.next = 8;
_context14.next = 8;
break;
}
_context13.next = 7;
_context14.next = 7;
return this._page.close();

@@ -823,3 +883,3 @@

case 8:
_context13.next = 10;
_context14.next = 10;
return this._browser.close();

@@ -832,10 +892,10 @@

case 'end':
return _context13.stop();
return _context14.stop();
}
}
}, _callee13, this);
}, _callee14, this);
}));
function tearDown() {
return _ref13.apply(this, arguments);
return _ref14.apply(this, arguments);
}

@@ -856,20 +916,20 @@

value: function () {
var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(url) {
return _regenerator2.default.wrap(function _callee14$(_context14) {
var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15(url) {
return _regenerator2.default.wrap(function _callee15$(_context15) {
while (1) {
switch (_context14.prev = _context14.next) {
switch (_context15.prev = _context15.next) {
case 0:
debug('.goto() url: ' + url);
return _context14.abrupt('return', this._page.goto(url));
return _context15.abrupt('return', this._page.goto(url));
case 2:
case 'end':
return _context14.stop();
return _context15.stop();
}
}
}, _callee14, this);
}, _callee15, this);
}));
function _navigateTo(_x9) {
return _ref14.apply(this, arguments);
function _navigateTo(_x10) {
return _ref15.apply(this, arguments);
}

@@ -890,7 +950,7 @@

value: function () {
var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15() {
var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee16() {
var screen, width, height, viewport;
return _regenerator2.default.wrap(function _callee15$(_context15) {
return _regenerator2.default.wrap(function _callee16$(_context16) {
while (1) {
switch (_context15.prev = _context15.next) {
switch (_context16.prev = _context16.next) {
case 0:

@@ -909,14 +969,14 @@ screen = this._options.screen;

this._options.screen = viewport;
return _context15.abrupt('return', this._page.setViewport(viewport));
return _context16.abrupt('return', this._page.setViewport(viewport));
case 8:
case 'end':
return _context15.stop();
return _context16.stop();
}
}
}, _callee15, this);
}, _callee16, this);
}));
function _setViewport() {
return _ref15.apply(this, arguments);
return _ref16.apply(this, arguments);
}

@@ -937,7 +997,7 @@

value: function () {
var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee16() {
var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee17() {
var userAgent;
return _regenerator2.default.wrap(function _callee16$(_context16) {
return _regenerator2.default.wrap(function _callee17$(_context17) {
while (1) {
switch (_context16.prev = _context16.next) {
switch (_context17.prev = _context17.next) {
case 0:

@@ -950,14 +1010,14 @@ userAgent = this._options.userAgent;

debug('.userAgent() to ' + userAgent);
return _context16.abrupt('return', this._page.setUserAgent(userAgent));
return _context17.abrupt('return', this._page.setUserAgent(userAgent));
case 4:
case 'end':
return _context16.stop();
return _context17.stop();
}
}
}, _callee16, this);
}, _callee17, this);
}));
function _setUserAgent() {
return _ref16.apply(this, arguments);
return _ref17.apply(this, arguments);
}

@@ -978,7 +1038,7 @@

value: function () {
var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee17() {
var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee18() {
var timeout;
return _regenerator2.default.wrap(function _callee17$(_context17) {
return _regenerator2.default.wrap(function _callee18$(_context18) {
while (1) {
switch (_context17.prev = _context17.next) {
switch (_context18.prev = _context18.next) {
case 0:

@@ -988,14 +1048,14 @@ timeout = this._options.timeout;

debug('.timeout() to ' + timeout);
return _context17.abrupt('return', this._page.setDefaultNavigationTimeout(timeout));
return _context18.abrupt('return', this._page.setDefaultNavigationTimeout(timeout));
case 3:
case 'end':
return _context17.stop();
return _context18.stop();
}
}
}, _callee17, this);
}, _callee18, this);
}));
function _setTimeout() {
return _ref17.apply(this, arguments);
return _ref18.apply(this, arguments);
}

@@ -1090,7 +1150,7 @@

value: function () {
var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee18() {
var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee19() {
var proxy, currentProxy, foundProxy;
return _regenerator2.default.wrap(function _callee18$(_context18) {
return _regenerator2.default.wrap(function _callee19$(_context19) {
while (1) {
switch (_context18.prev = _context18.next) {
switch (_context19.prev = _context19.next) {
case 0:

@@ -1101,11 +1161,11 @@ proxy = this._proxy;

if (proxy) {
_context18.next = 4;
_context19.next = 4;
break;
}
return _context18.abrupt('return', _promise2.default.resolve(null));
return _context19.abrupt('return', _promise2.default.resolve(null));
case 4:
if (!Array.isArray(proxy)) {
_context18.next = 18;
_context19.next = 18;
break;

@@ -1115,24 +1175,24 @@ }

this._removeUnavailableProxy();
_context18.next = 8;
_context19.next = 8;
return typeof this._options.proxyRotator === 'function';
case 8:
if (!_context18.sent) {
_context18.next = 12;
if (!_context19.sent) {
_context19.next = 12;
break;
}
_context18.t0 = this._options.proxyRotator(proxy, currentProxy);
_context18.next = 13;
_context19.t0 = this._options.proxyRotator(proxy, currentProxy);
_context19.next = 13;
break;
case 12:
_context18.t0 = _promise2.default.resolve(sample(proxy));
_context19.t0 = _promise2.default.resolve(sample(proxy));
case 13:
foundProxy = _context18.t0;
foundProxy = _context19.t0;
this._proxyErrors = [];
this._proxyCurrent = foundProxy;
_context18.next = 19;
_context19.next = 19;
break;

@@ -1144,14 +1204,14 @@

case 19:
return _context18.abrupt('return', this._proxyCurrent);
return _context19.abrupt('return', this._proxyCurrent);
case 20:
case 'end':
return _context18.stop();
return _context19.stop();
}
}
}, _callee18, this);
}, _callee19, this);
}));
function _rotateProxy() {
return _ref18.apply(this, arguments);
return _ref19.apply(this, arguments);
}

@@ -1191,10 +1251,10 @@

value: function () {
var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee19(files) {
var _ref20 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee20(files) {
var _this4 = this;
return _regenerator2.default.wrap(function _callee19$(_context19) {
return _regenerator2.default.wrap(function _callee20$(_context20) {
while (1) {
switch (_context19.prev = _context19.next) {
switch (_context20.prev = _context20.next) {
case 0:
return _context19.abrupt('return', _promise2.default.all(files.map(function (file) {
return _context20.abrupt('return', _promise2.default.all(files.map(function (file) {
debug('injecting file %s', file);

@@ -1206,10 +1266,10 @@ return _this4._injectFile(file);

case 'end':
return _context19.stop();
return _context20.stop();
}
}
}, _callee19, this);
}, _callee20, this);
}));
function _injectFiles(_x10) {
return _ref19.apply(this, arguments);
function _injectFiles(_x11) {
return _ref20.apply(this, arguments);
}

@@ -1222,10 +1282,10 @@

value: function () {
var _ref20 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee20(filePath) {
var _ref21 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee21(filePath) {
var page, contents;
return _regenerator2.default.wrap(function _callee20$(_context20) {
return _regenerator2.default.wrap(function _callee21$(_context21) {
while (1) {
switch (_context20.prev = _context20.next) {
switch (_context21.prev = _context21.next) {
case 0:
page = this._page;
_context20.next = 3;
_context21.next = 3;
return new _promise2.default(function (resolve, reject) {

@@ -1241,17 +1301,17 @@ fs.readFile(filePath, 'utf8', function (err, data) {

case 3:
contents = _context20.sent;
contents = _context21.sent;
contents += '//# sourceURL=' + filePath.replace(/\n/g, '');
return _context20.abrupt('return', page.mainFrame().evaluate(contents));
return _context21.abrupt('return', page.mainFrame().evaluate(contents));
case 6:
case 'end':
return _context20.stop();
return _context21.stop();
}
}
}, _callee20, this);
}, _callee21, this);
}));
function _injectFile(_x11) {
return _ref20.apply(this, arguments);
function _injectFile(_x12) {
return _ref21.apply(this, arguments);
}

@@ -1355,3 +1415,3 @@

page.on('response', function (response) {
// debug('Resource recieved %o', resource);
// debug('Resource received %o', { status: response.status(), url: response.request().url() });
var url = response.request().url();

@@ -1358,0 +1418,0 @@ // redirect has occurred

{
"version": "1.0.18",
"version": "1.1.0",
"name": "goose-chrome-environment",

@@ -4,0 +4,0 @@ "main": "lib/ChromeEnvironment.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc