New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

testcafe-hammerhead

Package Overview
Dependencies
Maintainers
7
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testcafe-hammerhead - npm Package Compare versions

Comparing version 24.7.2 to 24.7.3

lib/utils/get-client-script-suffix.js

47

lib/processing/resources/page.js

@@ -49,2 +49,27 @@ "use strict";

}
static _createShadowUIStyleLinkNode(url) {
return parse5Utils.createElement('link', [
{ name: 'rel', value: 'stylesheet' },
{ name: 'type', value: 'text/css' },
{ name: 'class', value: class_name_1.default.uiStylesheet },
{ name: 'href', value: url },
]);
}
static _createShadowUIScriptWithUrlNode(url) {
return parse5Utils.createElement('script', [
{ name: 'type', value: 'text/javascript' },
{ name: 'class', value: class_name_1.default.script },
{ name: 'charset', value: 'UTF-8' },
{ name: 'src', value: url },
]);
}
static _createShadowUIScriptWithContentNode(content) {
const scriptAsContentElement = parse5Utils.createElement('script', [
{ name: 'type', value: 'text/javascript' },
{ name: 'class', value: class_name_1.default.script },
{ name: 'charset', value: 'UTF-8' },
]);
scriptAsContentElement.childNodes = [parse5Utils.createTextNode(content, scriptAsContentElement)];
return scriptAsContentElement;
}
_createRestoreStoragesScript(storageKey, storages) {

@@ -79,8 +104,3 @@ const parsedDocumentFragment = parse5_1.default.parseFragment(util_1.default.format(self_removing_scripts_1.default.restoreStorages, storageKey, (0, json_1.stringify)(storages.localStorage), storageKey, (0, json_1.stringify)(storages.sessionStorage)));

processingOptions.stylesheets.forEach(stylesheetUrl => {
injectedResources.unshift(parse5Utils.createElement('link', [
{ name: 'rel', value: 'stylesheet' },
{ name: 'type', value: 'text/css' },
{ name: 'class', value: class_name_1.default.uiStylesheet },
{ name: 'href', value: stylesheetUrl },
]));
injectedResources.unshift(PageProcessor._createShadowUIStyleLinkNode(stylesheetUrl));
});

@@ -90,8 +110,3 @@ }

processingOptions.scripts.forEach(scriptUrl => {
injectedResources.push(parse5Utils.createElement('script', [
{ name: 'type', value: 'text/javascript' },
{ name: 'class', value: class_name_1.default.script },
{ name: 'charset', value: 'UTF-8' },
{ name: 'src', value: scriptUrl },
]));
injectedResources.push(PageProcessor._createShadowUIScriptWithUrlNode(scriptUrl));
});

@@ -101,9 +116,3 @@ }

processingOptions.embeddedScripts.forEach(script => {
const embeddedScriptElement = parse5Utils.createElement('script', [
{ name: 'type', value: 'text/javascript' },
{ name: 'class', value: class_name_1.default.script },
{ name: 'charset', value: 'UTF-8' },
]);
embeddedScriptElement.childNodes = [parse5Utils.createTextNode(script, embeddedScriptElement)];
injectedResources.push(embeddedScriptElement);
injectedResources.push(PageProcessor._createShadowUIScriptWithContentNode(script));
});

@@ -110,0 +119,0 @@ }

@@ -34,3 +34,2 @@ "use strict";

const script_1 = __importDefault(require("../processing/resources/script"));
const read_file_relative_1 = require("read-file-relative");
const http_2 = require("../utils/http");

@@ -45,2 +44,3 @@ const request_pipeline_1 = require("../request-pipeline");

const json_1 = require("../utils/json");
const load_client_script_1 = __importDefault(require("../utils/load-client-script"));
const SESSION_IS_NOT_OPENED_ERR = 'Session is not opened in proxy';

@@ -75,7 +75,6 @@ function parseAsJson(msg) {

this.openSessions = new Map();
const { ssl, developmentMode, cache, proxyless, } = prepareOptions;
const { ssl, developmentMode, cache, } = prepareOptions;
const protocol = ssl ? 'https:' : 'http:';
const opts = this._getOpts(ssl);
const createServer = this._getCreateServerMethod(ssl);
this.proxyless = proxyless;
this.server1Info = createServerInfo(hostname, port1, port2, protocol, cache);

@@ -116,9 +115,5 @@ this.server2Info = createServerInfo(hostname, port2, port1, protocol, cache);

_registerServiceRoutes(developmentMode) {
const developmentModeSuffix = developmentMode ? '' : '.min';
const hammerheadFileName = `hammerhead${developmentModeSuffix}.js`;
const hammerheadScriptContent = (0, read_file_relative_1.readSync)(`../client/${hammerheadFileName}`);
const transportWorkerFileName = `transport-worker${developmentModeSuffix}.js`;
const transportWorkerContent = (0, read_file_relative_1.readSync)(`../client/${transportWorkerFileName}`);
const workerHammerheadFileName = `worker-hammerhead${developmentModeSuffix}.js`;
const workerHammerheadContent = (0, read_file_relative_1.readSync)(`../client/${workerHammerheadFileName}`);
const hammerheadScriptContent = (0, load_client_script_1.default)(service_routes_1.default.hammerhead, developmentMode);
const transportWorkerContent = (0, load_client_script_1.default)(service_routes_1.default.transportWorker, developmentMode);
const workerHammerheadContent = (0, load_client_script_1.default)(service_routes_1.default.workerHammerhead, developmentMode);
this.GET(service_routes_1.default.hammerhead, {

@@ -137,3 +132,3 @@ contentType: 'application/x-javascript',

this.POST(service_routes_1.default.messaging, (req, res, serverInfo) => this._onServiceMessage(req, res, serverInfo));
if (this.proxyless)
if (this.options.proxyless)
this.OPTIONS(service_routes_1.default.messaging, (req, res) => this._onServiceMessagePreflight(req, res));

@@ -152,3 +147,3 @@ this.GET(service_routes_1.default.task, (req, res, serverInfo) => this._onTaskScriptRequest(req, res, serverInfo, false));

res.setHeader(builtin_header_names_1.default.setCookie, session.takePendingSyncCookies());
(0, http_2.respondWithJSON)(res, result, false, this.proxyless);
(0, http_2.respondWithJSON)(res, result, false, this.options.proxyless);
}

@@ -223,3 +218,3 @@ catch (err) {

url = urlUtils.prepareUrl(url);
if (this.proxyless)
if (this.options.proxyless)
return url;

@@ -226,0 +221,0 @@ return urlUtils.getProxyUrl(url, {

@@ -77,3 +77,3 @@ "use strict";

iframeTaskScriptTemplate = iframeTaskScriptTemplate || '{{{iframeTaskScriptTemplate}}}';
if ((_a = this.proxy) === null || _a === void 0 ? void 0 : _a.proxyless) {
if ((_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.proxyless) {
referer = '""';

@@ -97,3 +97,3 @@ cookie = '""';

windowId: windowId || '',
proxyless: ((_b = this.proxy) === null || _b === void 0 ? void 0 : _b.proxyless) || false,
proxyless: ((_b = this.proxy) === null || _b === void 0 ? void 0 : _b.options.proxyless) || false,
});

@@ -100,0 +100,0 @@ }

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SCRIPTS = void 0;
exports.SCRIPTS = ['/hammerhead.js'];
const service_routes_1 = __importDefault(require("../proxy/service-routes"));
exports.SCRIPTS = [service_routes_1.default.hammerhead];

@@ -12,2 +12,3 @@ "use strict";

const internal_properties_1 = __importDefault(require("../processing/dom/internal-properties"));
const CLEANUP_FORMATTING_REGEXP = /\n\s*|\/\*[\S\s]*?\*\//g;
function create(script) {

@@ -32,3 +33,3 @@ return `

</script>
`.replace(/\n\s*|\/\*[\S\s]*?\*\//g, '');
`.replace(CLEANUP_FORMATTING_REGEXP, '');
}

@@ -35,0 +36,0 @@ exports.default = {

{
"name": "testcafe-hammerhead",
"description": "A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).",
"version": "24.7.2",
"version": "24.7.3",
"homepage": "https://github.com/DevExpress/testcafe-hammerhead",

@@ -6,0 +6,0 @@ "bugs": {

@@ -197,2 +197,14 @@ interface StaticContent {

export interface RouterOptions {
staticContentCaching?: object;
}
export interface ProxyOptions extends RouterOptions {
ssl: object;
developmentMode: boolean;
cache: boolean;
disableHttp2: boolean;
proxyless: boolean;
}
/** The Session class is used to create a web-proxy session **/

@@ -258,2 +270,5 @@ export abstract class Session {

/** Proxy options **/
options: ProxyOptions;
/** Information about server1 **/

@@ -260,0 +275,0 @@ server1Info: ServerInfo;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc