🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

webext-content-scripts

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webext-content-scripts - npm Package Compare versions

Comparing version
2.7.3
to
2.8.0
+1
-0
index.d.ts

@@ -29,1 +29,2 @@ import type { ContentScript, ExtensionFileOrCode, RunAt } from './types.js';

export declare function canAccessTab(target: number | Target): Promise<boolean>;
export declare function assertTabAccess(target: number | Target): Promise<void>;
+4
-1

@@ -235,3 +235,3 @@ import chromeP from 'webext-polyfill-kinda';

try {
await executeFunction(castTarget(target), () => true);
await assertTabAccess(target);
return true;

@@ -243,1 +243,4 @@ }

}
export async function assertTabAccess(target) {
await executeFunction(castTarget(target), () => true);
}
{
"name": "webext-content-scripts",
"version": "2.7.3",
"version": "2.8.0",
"description": "Utility functions to inject content scripts in WebExtensions, for Manifest v2 and v3",

@@ -5,0 +5,0 @@ "keywords": [

@@ -28,2 +28,3 @@ # webext-content-scripts [![npm version](https://img.shields.io/npm/v/webext-content-scripts.svg)](https://www.npmjs.com/package/webext-content-scripts)

canAccessTab,
assertTabAccess,
} from 'webext-content-scripts';

@@ -222,2 +223,16 @@ ```

### `assertTabAccess(tabId)`
### `assertTabAccess({tabId, frameId})`
Like `canAccessTab`, but instead of returning `false` on failure it throws whatever error the browser throws.
Note that you don't need to verify access before calling `executeScript`, just call `executeScript` directly and it will throw exactly the same way.
```js
const tabId = 42;
await assertTabAccess(tabId); // throws if the extension has no access
chrome.tabs.repload(tabId);
```
### `isScriptableUrl(url)`

@@ -224,0 +239,0 @@