New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

freedom

Package Overview
Dependencies
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freedom - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

spec/helper/beacon0.js

2

bower.json
{
"name": "freedom",
"version": "0.5.0",
"version": "0.5.1",
"homepage": "http://freedomjs.com",

@@ -5,0 +5,0 @@ "repository": {

{
"name": "freedom",
"description": "Embracing a distributed web",
"version": "0.5.0",
"version": "0.5.1",
"homepage": "http://freedomjs.com",

@@ -6,0 +6,0 @@ "bugs": {

@@ -80,3 +80,3 @@ /*globals fdom, document */

this.win = frame;
continuation({});
continuation();
};

@@ -83,0 +83,0 @@

@@ -199,9 +199,19 @@ /*

WebRTCTransportProvider.prototype.onData = function(msg) {
// console.log("TransportProvider.prototype.message: Got Message:" + JSON.stringify(msg));
//console.log("TransportProvider.prototype.message: Got Message:" + JSON.stringify(msg));
if (msg.buffer) {
this._handleData(msg.channelLabel, msg.buffer);
} else if (msg.binary) {
var fileReader = new FileReaderSync();
var asArrayBuffer = fileReader.readAsArrayBuffer(msg.binary);
this._handleData(msg.channelLabel, asArrayBuffer);
if (typeof FileReaderSync === 'undefined') {
var fileReader = new FileReader();
fileReader.onload = function(handleData, channelLabel) {
return function(e) {
handleData(channelLabel, e.target.result);
};
}(this._handleData.bind(this), msg.channelLabel);
fileReader.readAsArrayBuffer(msg.binary);
} else {
var fileReaderSync = new FileReaderSync();
var arrayBuffer = fileReaderSync.readAsArrayBuffer(msg.binary);
this._handleData(msg.channelLabel, arrayBuffer);
}
} else if (msg.text) {

@@ -208,0 +218,0 @@ console.error("Strings not supported.");

@@ -26,3 +26,3 @@ freedom.js

* [freedom.latest.js](http://freedomjs.org/release/master/freedom.latest.js) (unstable)
* [freedom.v0.4.4.js](http://freedomjs.org/release/master/freedom.v0.4.4.js) (stable)
* [freedom.v0.5.0.js](http://freedomjs.org/release/v0.5/freedom.v0.5.0.js) (stable)

@@ -63,5 +63,5 @@ Chrome Apps:

Other helpful grunt commands:
* ```grunt freedom``` - Build freedom.js
* ```grunt freedom``` - Build freedom.js and run phantomjs unit tests
* ```grunt demo``` - Build and run demos
* ```grunt test``` - Run the subset of tests that are compatible with phantomjs
* ```grunt test``` - Run unit tests in Chrome and Firefox
* ```grunt debug``` - Build all tests and launch a webserver. freedom.js unit and integration tests can then be run by navigating to http://localhost:8000/_SpecRunner.html

@@ -68,0 +68,0 @@

@@ -65,3 +65,5 @@ describe("integration: transport.webrtc.json", function() {

expect(signals.length).toBeGreaterThan(0);
expect(result.data instanceof ArrayBuffer).toBe(true);
//@todo This returns false on Firefox 30
//expect(result.data instanceof ArrayBuffer).toBe(true);
expect(result.data.byteLength).toEqual(4);
expect(result.tag).toEqual("tag");

@@ -95,3 +97,5 @@ expect(resultStr).toEqual(testString);

expect(signals.length).toBeGreaterThan(0);
expect(result.data instanceof ArrayBuffer).toBe(true);
//@todo This returns false on Firefox 30
//expect(result.data instanceof ArrayBuffer).toBe(true);
expect(result.data.byteLength).toEqual(170586);
expect(result.tag).toEqual("tag");

@@ -125,3 +129,5 @@ expect(resultStr).toEqual(testString);

expect(signals.length).toBeGreaterThan(0);
expect(result.data instanceof ArrayBuffer).toBe(true);
//@todo This returns false on Firefox 30
//expect(result.data instanceof ArrayBuffer).toBe(true);
expect(result.data.byteLength).toEqual(26);
expect(resultStr).toEqual(toSend[result.tag]);

@@ -128,0 +134,0 @@ tagsRecievedOn.push(result.tag);

@@ -45,3 +45,3 @@ describe('fdom.port.ModuleInternal', function() {

global.document = document;
callback = function() {

@@ -52,5 +52,30 @@ expect(fileIncluded).toEqual(true);

}
app.loadScripts(loc, 'relative://spec/helper/beacon.js');
app.loadScripts(loc, ['relative://spec/helper/beacon.js', 'non_existing_file']);
});
it('load scripts sequentially', function(done) {
setupResolvers();
global.document = document;
fileIncluded = false;
fileIncluded0 = false;
callback0 = function() {
expect(fileIncluded0).toEqual(true);
expect(fileIncluded).toEqual(false);
delete callback0;
};
callback = function() {
expect(fileIncluded0).toEqual(true);
expect(fileIncluded).toEqual(true);
delete callback;
done();
};
app.loadScripts(loc, ['relative://spec/helper/beacon0.js',
'relative://spec/helper/beacon.js',
'non_existing_file']);
})
it('exposes dependency apis', function(done) {

@@ -57,0 +82,0 @@ var source = createTestPort('test');

@@ -137,2 +137,7 @@ describe("fdom.resources", function() {

});
it("should remove buggy cca URLs", function() {
resources.httpResolver('chrome-extension:////extensionid/manifest.json', 'resource.js', r, f);
expect(spy).toHaveBeenCalledWith('chrome-extension://extensionid/resource.js');
});
});

@@ -323,32 +323,44 @@ /*globals fdom:true, Promise */

fdom.port.ModuleInternal.prototype.loadScripts = function(from, scripts) {
var i = 0,
safe = true,
importer = function importScripts(script, resolve) {
// TODO(salomegeo): add a test for failure.
var importer = function importScripts(script, resolve, reject) {
try {
this.config.global.importScripts(script);
resolve();
}.bind(this),
urls = [],
outstanding = 0,
load = function(url) {
urls.push(url);
outstanding -= 1;
if (outstanding === 0) {
if (safe) {
this.emit(this.externalChannel, {
type: 'ready'
});
this.tryLoad(importer, urls);
} else {
this.tryLoad(importer, urls).then(function() {
this.emit(this.externalChannel, {
type: 'ready'
});
}.bind(this));
}
}
}.bind(this);
} catch(e) {
reject(e);
}
}.bind(this);
var scripts_count;
if (typeof scripts === 'string') {
scripts_count = 1;
} else {
scripts_count = scripts.length;
}
var load = function(next) {
if (next === scripts_count) {
this.emit(this.externalChannel, {
type: "ready"
});
return;
}
var script;
if (typeof scripts === 'string') {
script = scripts;
} else {
script = scripts[next];
}
fdom.resources.get(from, script).then(function(url) {
this.tryLoad(importer, url).then(function() {
load(next + 1);
}.bind(this));
}.bind(this));
}.bind(this);
if (!this.config.global.importScripts) {
safe = false;
importer = function(url, resolve) {
importer = function(url, resolve, reject) {
var script = this.config.global.document.createElement('script');

@@ -361,11 +373,3 @@ script.src = url;

if (typeof scripts === 'string') {
outstanding = 1;
fdom.resources.get(from, scripts).then(load);
} else {
outstanding = scripts.length;
for (i = 0; i < scripts.length; i += 1) {
fdom.resources.get(from, scripts[i]).then(load);
}
}
load(0);
};

@@ -381,16 +385,9 @@

*/
fdom.port.ModuleInternal.prototype.tryLoad = function(importer, urls) {
var i,
promises = [];
try {
for (i = 0; i < urls.length; i += 1) {
promises.push(new Promise(importer.bind({}, urls[i])));
}
} catch(e) {
fdom.port.ModuleInternal.prototype.tryLoad = function(importer, url) {
return new Promise(importer.bind({}, url)).catch(function(e) {
fdom.debug.warn(e.stack);
fdom.debug.error("Error loading " + urls[i], e);
fdom.debug.error("Error loading " + url, e);
fdom.debug.error("If the stack trace is not useful, see https://" +
"github.com/UWNetworksLab/freedom/wiki/Debugging-Script-Parse-Errors");
}
return Promise.all(promises);
});
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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