Skip to content

Commit e5ac49c

Browse files
committed
Update post-message-stream patch
1 parent 0c60a2f commit e5ac49c

File tree

2 files changed

+67
-30
lines changed

2 files changed

+67
-30
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
diff --git a/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.cjs b/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.cjs
2+
index 0aaba03..e6eb9ea 100644
3+
--- a/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.cjs
4+
+++ b/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.cjs
5+
@@ -1,4 +1,11 @@
6+
"use strict";
7+
+/**
8+
+ * ============================== PATCH INFORMATION ==============================
9+
+ * This patch was added for Snaps controller integration. The MessageEvent is not
10+
+ * available in react native so we can simply return undefined here and handle the
11+
+ * origin and source elsewhere.
12+
+ * ===============================================================================
13+
+ */
14+
var __rest = (this && this.__rest) || function (s, e) {
15+
var t = {};
16+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17+
@@ -17,11 +24,13 @@ const utils_1 = require("@metamask/utils");
18+
const BasePostMessageStream_1 = require("../BasePostMessageStream.cjs");
19+
const utils_2 = require("../utils.cjs");
20+
/* istanbul ignore next */
21+
-const getSource = (_a = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'source')) === null || _a === void 0 ? void 0 : _a.get;
22+
-(0, utils_1.assert)(getSource, 'MessageEvent.prototype.source getter is not defined.');
23+
+// const getSource = (_a = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'source')) === null || _a === void 0 ? void 0 : _a.get;
24+
+// (0, utils_1.assert)(getSource, 'MessageEvent.prototype.source getter is not defined.');
25+
+const getSource = () => undefined;
26+
/* istanbul ignore next */
27+
-const getOrigin = (_b = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'origin')) === null || _b === void 0 ? void 0 : _b.get;
28+
-(0, utils_1.assert)(getOrigin, 'MessageEvent.prototype.origin getter is not defined.');
29+
+// const getOrigin = (_b = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'origin')) === null || _b === void 0 ? void 0 : _b.get;
30+
+// (0, utils_1.assert)(getOrigin, 'MessageEvent.prototype.origin getter is not defined.');
31+
+const getOrigin = () => undefined;
32+
/**
33+
* A {@link Window.postMessage} stream.
34+
*/
35+
diff --git a/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.mjs b/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.mjs
36+
index db60ec4..ff6d786 100644
37+
--- a/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.mjs
38+
+++ b/node_modules/@metamask/post-message-stream/dist/window/WindowPostMessageStream.mjs
39+
@@ -1,3 +1,10 @@
40+
+/**
41+
+ * ============================== PATCH INFORMATION ==============================
42+
+ * This patch was added for Snaps controller integration. The MessageEvent is not
43+
+ * available in react native so we can simply return undefined here and handle the
44+
+ * origin and source elsewhere.
45+
+ * ===============================================================================
46+
+ */
47+
var __rest = (this && this.__rest) || function (s, e) {
48+
var t = {};
49+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50+
@@ -14,11 +21,13 @@ import { assert } from "@metamask/utils";
51+
import { BasePostMessageStream } from "../BasePostMessageStream.mjs";
52+
import { isValidStreamMessage } from "../utils.mjs";
53+
/* istanbul ignore next */
54+
-const getSource = (_a = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'source')) === null || _a === void 0 ? void 0 : _a.get;
55+
-assert(getSource, 'MessageEvent.prototype.source getter is not defined.');
56+
+// const getSource = (_a = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'source')) === null || _a === void 0 ? void 0 : _a.get;
57+
+// assert(getSource, 'MessageEvent.prototype.source getter is not defined.');
58+
+const getSource = () => undefined;
59+
/* istanbul ignore next */
60+
-const getOrigin = (_b = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'origin')) === null || _b === void 0 ? void 0 : _b.get;
61+
-assert(getOrigin, 'MessageEvent.prototype.origin getter is not defined.');
62+
+// const getOrigin = (_b = Object.getOwnPropertyDescriptor(MessageEvent.prototype, 'origin')) === null || _b === void 0 ? void 0 : _b.get;
63+
+// assert(getOrigin, 'MessageEvent.prototype.origin getter is not defined.');
64+
+const getOrigin = () => undefined;
65+
/**
66+
* A {@link Window.postMessage} stream.
67+
*/

patches/@metamask+post-message-stream+9.0.0.patch

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)