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

sysend

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sysend - npm Package Compare versions

Comparing version 1.16.3 to 1.17.0

2

package.json
{
"name": "sysend",
"version": "1.16.3",
"version": "1.17.0",
"description": "Communication and Synchronization between browser tabs/windows. Works cross-domain.",

@@ -5,0 +5,0 @@ "main": "sysend.js",

@@ -5,4 +5,4 @@ <p align="center">

[![npm](https://img.shields.io/badge/npm-1.16.3-blue.svg)](https://www.npmjs.com/package/sysend)
![bower](https://img.shields.io/badge/bower-1.16.3-yellow.svg)
[![npm](https://img.shields.io/badge/npm-1.17.0-blue.svg)](https://www.npmjs.com/package/sysend)
![bower](https://img.shields.io/badge/bower-1.17.0-yellow.svg)
![downloads](https://img.shields.io/npm/dt/sysend.svg)

@@ -24,3 +24,3 @@ [![jsdelivr](https://img.shields.io/jsdelivr/npm/hm/sysend)](https://www.jsdelivr.com/package/npm/sysend)

GNU/Linux: in Chromium 34, FireFox 29, Opera 12.16 (64bit)<br/>
GNU/Linux: in Chromium 34, Firefox 29, Opera 12.16 (64bit)<br/>
Windows 10 64bit: in IE11 and Edge 38, Chrome 56, Firefox 51<br/>

@@ -32,6 +32,33 @@ MacOS X El Captain: Safari 9, Chrome 56, Firefox 51

All cross-domain communication is disabled by default with Safari 7+. Because of a feature that
block 3rd party tracking for iframe, and any iframe used for cross-domain communication runs in
sandboxed environment. That's why this library like any other solution for cross-domain
blocks 3rd party tracking for iframe, and any iframe used for cross-domain communication runs in
a sandboxed environment. That's why this library like any other solution for cross-domain
communication, don't work on Safari.
## Note about Chrome 115+ and different domains
Since version 115 Google Chrome introduced Third-party storage partitioning. Because of this feature,
Cross-domain communication only works on subdomains. There will probably be a way to share the context
using some kind of permission API, that in the future may also land in Safari (hopefully). More information
about this can be found in [#54](https://github.com/jcubic/sysend.js/issues/54).
Information about the API can also be found in Google Chrome documentation:
[Storage Partitioning](https://developer.chrome.com/docs/privacy-sandbox/storage-partitioning/)
There is a new API: Storage Access API. It's available when you
[register](https://developer.chrome.com/origintrials/#/trials/active) for the
[Origin Trial](https://developer.chrome.com/origintrials/#/view_trial/577023702256844801).
You can register two and more domains, you will have a token that you need to add to the proxy html file (in the head tag):
```html
<meta http-equiv="origin-trial" content="<TOKEN>" />
```
You can also use the HTTP header:
```
Origin-Trial: <TOKEN>
```
Right now the API only works with localStorage fallback.
## Installation

@@ -38,0 +65,0 @@

/**@license
* sysend.js - send messages between browser windows/tabs version 1.16.3
* sysend.js - send messages between browser windows/tabs version 1.17.0
*

@@ -4,0 +4,0 @@ * Copyright (C) 2014-2023 Jakub T. Jankiewicz <https://jcubic.pl/me>

/**@license
* sysend.js - send messages between browser windows/tabs version 1.16.3
* sysend.js - send messages between browser windows/tabs version 1.17.0-beta
*

@@ -42,2 +42,4 @@ * Copyright (C) 2014-2023 Jakub T. Jankiewicz <https://jcubic.pl/me>

var list_id = 0;
// Storage Access API handler
var sa_handle;

@@ -452,4 +454,12 @@ // id of the window/tabAnd two-way communication is tracked in

// -------------------------------------------------------------------------
function ls() {
if (sa_handle) {
return sa_handle.localStorage;
} else {
return localStorage;
}
}
// -------------------------------------------------------------------------
function get(key) {
return localStorage.getItem(make_internal(key));
return ls().getItem(make_internal(key));
}

@@ -460,9 +470,9 @@ // -------------------------------------------------------------------------

if (id == 0) {
localStorage.setItem(make_internal(key), random_value);
ls().setItem(make_internal(key), random_value);
}
localStorage.setItem(uniq_prefix + key, value);
ls().setItem(uniq_prefix + key, value);
}
// -------------------------------------------------------------------------
function remove(key) {
localStorage.removeItem(uniq_prefix + key);
ls().removeItem(uniq_prefix + key);
}

@@ -501,4 +511,4 @@ // -------------------------------------------------------------------------

try {
localStorage.setItem(uniq_prefix, 1);
localStorage.removeItem(uniq_prefix);
ls().setItem(uniq_prefix, 1);
ls().removeItem(uniq_prefix);
return false;

@@ -601,2 +611,3 @@ } catch (e) {

var re = new RegExp('^' + uniq_prefix);
var localStorage = ls();
for(var key in localStorage) {

@@ -652,24 +663,46 @@ if (key.match(re)) {

// -------------------------------------------------------------------------
function init() {
if (typeof window.BroadcastChannel === 'function') {
function init_channel() {
if (sa_handle) {
if (sa_handle.hasOwnProperty('BroadcastChannel')) {
channel = new sa_handle.BroadcastChannel(uniq_prefix);
}
} else {
channel = new window.BroadcastChannel(uniq_prefix);
channel.addEventListener('message', function(event) {
if (event.target.name === uniq_prefix) {
if (is_proxy_iframe()) {
var payload = {
name: uniq_prefix,
data: event.data,
iframe_id: target_id
};
if (is_valid_origin(origin(document.referrer))) {
window.parent.postMessage(JSON.stringify(payload), '*');
}
} else {
var key = event.data && event.data.name;
if (callbacks[key]) {
invoke(key, unserialize(event.data.data));
}
}
if (!channel) {
return;
}
channel.addEventListener('message', function(event) {
if (event.target.name === uniq_prefix) {
if (is_proxy_iframe()) {
var payload = {
name: uniq_prefix,
data: event.data,
iframe_id: target_id
};
if (is_valid_origin(origin(document.referrer))) {
window.parent.postMessage(JSON.stringify(payload), '*');
}
} else {
var key = event.data && event.data.name;
if (callbacks[key]) {
invoke(key, unserialize(event.data.data));
}
}
});
}
});
}
// -------------------------------------------------------------------------
function init() {
if (typeof window.BroadcastChannel === 'function') {
if (is_proxy_iframe() && document.requestStorageAccess) {
document.requestStorageAccess({
all: true
}).then(function(handle) {
sa_handle = handle;
init_channel();
});
} else {
init_channel();
}
} else if (is_private_mode) {

@@ -687,2 +720,3 @@ warn('Your browser don\'t support localStorgage. ' +

if (is_sysend_post_message(e) && is_valid_origin(e.origin)) {
try {

@@ -689,0 +723,0 @@ var payload = JSON.parse(e.data);

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