Socket
Socket
Sign inDemoInstall

@metamask/post-message-stream

Package Overview
Dependencies
Maintainers
8
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/post-message-stream - npm Package Compare versions

Comparing version 6.1.0 to 6.1.1

19

dist/window/WindowPostMessageStream.js
"use strict";
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WindowPostMessageStream = void 0;
const utils_1 = require("@metamask/utils");
const BasePostMessageStream_1 = require("../BasePostMessageStream");
const utils_1 = require("../utils");
const utils_2 = require("../utils");
/* istanbul ignore next */
const getSource = (_a = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'source')) === null || _a === void 0 ? void 0 : _a.get;
(0, utils_1.assert)(getSource, 'MessageEvent.prototype.source getter is not defined.');
/* istanbul ignore next */
const getOrigin = (_b = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'origin')) === null || _b === void 0 ? void 0 : _b.get;
(0, utils_1.assert)(getOrigin, 'MessageEvent.prototype.origin getter is not defined.');
/**

@@ -45,8 +53,11 @@ * A {@link Window.postMessage} stream.

const message = event.data;
if ((this._targetOrigin !== '*' && event.origin !== this._targetOrigin) ||
event.source !== this._targetWindow ||
!(0, utils_1.isValidStreamMessage)(message) ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
if ((this._targetOrigin !== '*' &&
getOrigin.call(event) !== this._targetOrigin) ||
getSource.call(event) !== this._targetWindow ||
!(0, utils_2.isValidStreamMessage)(message) ||
message.target !== this._name) {
return;
}
/* eslint-enable @typescript-eslint/no-non-null-assertion */
this._onData(message.data);

@@ -53,0 +64,0 @@ }

{
"name": "@metamask/post-message-stream",
"version": "6.1.0",
"version": "6.1.1",
"description": "Sets up a duplex object stream over window.postMessage",

@@ -35,3 +35,3 @@ "homepage": "https://github.com/MetaMask/post-message-stream#readme",

"dependencies": {
"@metamask/utils": "^3.0.1",
"@metamask/utils": "^4.0.0",
"readable-stream": "2.3.3"

@@ -38,0 +38,0 @@ },

Sorry, the diff of this file is not supported yet

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