Permalink
Browse files

Update to electron 1.4.13 (and other dependencies) and fix all tests

  • Loading branch information...
1 parent 77af4ca commit 3d2bcba19e66571ac658586d02ee4774804b977b @mixu committed Jan 5, 2017
Showing with 25 additions and 22 deletions.
  1. +1 −1 bin/electroshot.js
  2. +1 −1 electron/index.js
  3. +6 −6 electron/preload.js
  4. +6 −6 electron/target-window.js
  5. +6 −6 package.json
  6. +5 −2 test/args.test.js
View
@@ -3,7 +3,7 @@ var fs = require('fs'),
path = require('path'),
spawn = require('child_process').spawn;
-var electron = require('electron-prebuilt'),
+var electron = require('electron'),
express = require('express'),
subarg = require('subarg'),
xtend = require('xtend'),
View
@@ -2,7 +2,7 @@ var fs = require('fs'),
path = require('path');
ml = require('minilog');
-var app = require('app'),
+var app = require('electron').app,
subarg = require('subarg');
var argv = subarg(process.argv.slice(2));
View
@@ -1,5 +1,5 @@
-var ipc = require('ipc');
-var webFrame = require('web-frame');
+var ipc = require('electron').ipcRenderer;
+var webFrame = require('electron').webFrame;
function waitFor(num, onDone) {
if (num) {
@@ -15,8 +15,8 @@ function waitFor(num, onDone) {
});
});
}
-ipc.on('ensure-rendered', function ensureRendered(delay, eventName) {
- console.log('RECEIVE', 'ensure-rendered');
+ipc.on('ensure-rendered', function ensureRendered(event, delay, eventName) {
+ console.log('RECEIVE', 'ensure-rendered', delay, eventName);
try {
var style = document.createElement('style');
// WebKit hack :(
@@ -31,7 +31,7 @@ ipc.on('ensure-rendered', function ensureRendered(delay, eventName) {
});
});
-ipc.on('get-dimensions', function ensureRendered(selector) {
+ipc.on('get-dimensions', function ensureRendered(event, selector) {
console.log('get-dimensions', selector);
var result;
try {
@@ -59,7 +59,7 @@ ipc.on('get-content-dimensions', function() {
});
});
-ipc.on('set-zoom-factor', function(factor) {
+ipc.on('set-zoom-factor', function(event, factor) {
console.log('set-zoom-factor', factor);
webFrame.setZoomFactor(factor);
ipc.send('return-zoom-factor');
@@ -2,8 +2,8 @@ var fs = require('fs'),
os = require('os'),
path = require('path');
-var ipc = require('ipc'),
- BrowserWindow = require('browser-window'),
+var ipc = require('electron').ipcMain,
+ BrowserWindow = require('electron').BrowserWindow,
xtend = require('xtend');
var log = require('minilog')('electron');
@@ -17,7 +17,7 @@ function TargetWindow() {
// sync initialization
TargetWindow.prototype.initialize = function(task, onDone) {
var self = this;
- var display = require('screen');
+ var display = require('electron').screen;
var browserOpts = {
show: true,
// SEGFAULTS on linux (!) with Electron 0.33.7 (!!)
@@ -64,7 +64,7 @@ TargetWindow.prototype.initialize = function(task, onDone) {
//this.window.setMaximumSize(task.device.screenSize.width, task.device.screenSize.height);
}
- this.window.loadUrl(task.url, task['user-agent'] !== '' ? { userAgent: task['user-agent'] } : {});
+ this.window.loadURL(task.url, task['user-agent'] !== '' ? { userAgent: task['user-agent'] } : {});
// this happens before the page starts executing
if (task.device) {
this.window.webContents.enableDeviceEmulation(task.device);
@@ -180,7 +180,7 @@ TargetWindow.prototype.reset = function() {
if (this.task.cookies) {
// TODO wait
this.task.cookies.forEach(function(cookie) {
- self.window.webContents.session.cookies.remove(cookie, function() {});
+ self.window.webContents.session.cookies.remove(cookie.url, cookie.name, function() {});
});
}
// reset network emulation
@@ -237,7 +237,7 @@ TargetWindow.prototype.capture = function(dims, onDone) {
TargetWindow.prototype.pdf = function(onDone) {
var self = this;
var task = this.task;
- this.window.printToPDF(xtend({
+ this.window.webContents.printToPDF(xtend({
pageSize: 'A4',
marginsType: 0,
printBackground: false,
View
@@ -18,17 +18,17 @@
"dependencies": {
"chromium-emulated-devices": "~1.0.0",
"chromium-emulated-networks": "~1.0.0",
- "cookie": "~0.2.2",
- "electron-prebuilt": "~0.33.6",
+ "cookie": "~0.3.1",
+ "electron": "~1.4.13",
"es6-template": "~1.0.3",
- "express": "~4.13.3",
+ "express": "~4.14.0",
"file-fixture": "0.0.2",
"log-symbols": "~1.0.2",
- "minilog": "~2.0.8",
+ "minilog": "~3.1.0",
"miniq": "~1.0.0",
- "sanitize-filename": "~1.4.5",
+ "sanitize-filename": "~1.6.1",
"subarg": "~1.0.0",
- "tough-cookie": "~2.2.0",
+ "tough-cookie": "~2.3.2",
"xtend": "~4.0.0"
}
}
View
@@ -20,8 +20,11 @@ argsToTasks = function(args) {
if (task['user-agent'] === '') {
delete task['user-agent'];
}
- if (task['cookie'] === '') {
- delete task['cookie'];
+ if (task.cookie === '') {
+ delete task.cookie;
+ }
+ if (task.root === '') {
+ delete task.root;
}
if (!task.js) {
delete task.js;

0 comments on commit 3d2bcba

Please sign in to comment.