Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onekeyfe/extension-bridge-hosted

Package Overview
Dependencies
Maintainers
2
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onekeyfe/extension-bridge-hosted - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

4

dist/bridgeSetup/contentScript.js

@@ -1,2 +0,2 @@

import { consts, isLegacyExtMessage, fakeDebugLogger, injectedFactory, } from '@onekeyfe/cross-inpage-provider-core';
import { consts, isLegacyExtMessage, appDebugLogger, injectedFactory, } from '@onekeyfe/cross-inpage-provider-core';
import messagePort from '../extensionMessagePort';

@@ -20,3 +20,3 @@ const { EXT_PORT_CS_TO_BG, JS_BRIDGE_MESSAGE_DIRECTION, JS_BRIDGE_MESSAGE_EXT_CHANNEL } = consts;

function setupMessagePort(options = {}) {
const debugLogger = options.debugLogger || fakeDebugLogger;
const debugLogger = options.debugLogger || appDebugLogger;
messagePort.connect({

@@ -23,0 +23,0 @@ name: EXT_PORT_CS_TO_BG,

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

function setupMessagePort(options = {}) {
const debugLogger = options.debugLogger || cross_inpage_provider_core_1.fakeDebugLogger;
const debugLogger = options.debugLogger || cross_inpage_provider_core_1.appDebugLogger;
extensionMessagePort_1.default.connect({

@@ -28,0 +28,0 @@ name: EXT_PORT_CS_TO_BG,

@@ -23,2 +23,13 @@ "use strict";

}
_getOriginFromPort(port) {
var _a, _b, _c;
// chrome
let origin = ((_a = port === null || port === void 0 ? void 0 : port.sender) === null || _a === void 0 ? void 0 : _a.origin) || '';
// firefox
if (!origin && ((_b = port === null || port === void 0 ? void 0 : port.sender) === null || _b === void 0 ? void 0 : _b.url)) {
const uri = new URL((_c = port === null || port === void 0 ? void 0 : port.sender) === null || _c === void 0 ? void 0 : _c.url);
origin = (uri === null || uri === void 0 ? void 0 : uri.origin) || '';
}
return origin;
}
setupMessagePortConnect(config) {

@@ -29,4 +40,3 @@ extensionMessagePort_1.default.connect({

onMessage: (payload, port0) => {
var _a;
let origin = ((_a = port0.sender) === null || _a === void 0 ? void 0 : _a.origin) || '';
let origin = this._getOriginFromPort(port0) || '';
// in ext ui, port.sender?.origin is always empty,

@@ -33,0 +43,0 @@ // so we trust remote (background) origin

@@ -13,4 +13,5 @@ /// <reference types="chrome" />

sendPayload(payload: IJsBridgeMessagePayload | string): void;
_getOriginFromPort(port: chrome.runtime.Port): string;
setupMessagePortConnect(config: IJsBridgeExtUiConfig): void;
}
export { JsBridgeExtUi };

@@ -17,2 +17,13 @@ import messagePort from './extensionMessagePort';

}
_getOriginFromPort(port) {
var _a, _b, _c;
// chrome
let origin = ((_a = port === null || port === void 0 ? void 0 : port.sender) === null || _a === void 0 ? void 0 : _a.origin) || '';
// firefox
if (!origin && ((_b = port === null || port === void 0 ? void 0 : port.sender) === null || _b === void 0 ? void 0 : _b.url)) {
const uri = new URL((_c = port === null || port === void 0 ? void 0 : port.sender) === null || _c === void 0 ? void 0 : _c.url);
origin = (uri === null || uri === void 0 ? void 0 : uri.origin) || '';
}
return origin;
}
setupMessagePortConnect(config) {

@@ -23,4 +34,3 @@ messagePort.connect({

onMessage: (payload, port0) => {
var _a;
let origin = ((_a = port0.sender) === null || _a === void 0 ? void 0 : _a.origin) || '';
let origin = this._getOriginFromPort(port0) || '';
// in ext ui, port.sender?.origin is always empty,

@@ -27,0 +37,0 @@ // so we trust remote (background) origin

{
"name": "@onekeyfe/extension-bridge-hosted",
"version": "0.0.4",
"version": "0.0.5",
"keywords": [

@@ -31,6 +31,6 @@ "cross-inpage-provider"

"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "^0.0.4",
"@onekeyfe/cross-inpage-provider-types": "^0.0.4"
"@onekeyfe/cross-inpage-provider-core": "^0.0.5",
"@onekeyfe/cross-inpage-provider-types": "^0.0.5"
},
"gitHead": "d47447804157874b2607aea82f92ff3a132c5e67"
"gitHead": "fc053fe3c2920fca734addae381339a29a09b716"
}
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