Use // for single line comments

This commit is contained in:
Kevin Sawicki 2016-01-14 10:35:29 -08:00
parent 26350f4ccb
commit f4af744519
43 changed files with 311 additions and 310 deletions

View file

@ -10,7 +10,7 @@ getNextId = function() {
};
/* |options.type| can not be empty and has to include 'window' or 'screen'. */
// |options.type| can not be empty and has to include 'window' or 'screen'.
isValid = function(options) {
return ((options != null ? options.types : void 0) != null) && Array.isArray(options.types);

View file

@ -3,13 +3,13 @@ var common;
common = require('../../../../common/api/lib/exports/electron');
/* Import common modules. */
// Import common modules.
common.defineProperties(exports);
Object.defineProperties(exports, {
/* Renderer side modules, please sort with alphabet order. */
// Renderer side modules, please sort with alphabet order.
desktopCapturer: {
enumerable: true,
get: function() {

View file

@ -8,7 +8,7 @@ binding = process.atomBinding('ipc');
v8Util = process.atomBinding('v8_util');
/* Created by init.coffee. */
// Created by init.coffee.
ipcRenderer = v8Util.getHiddenValue(global, 'ipc');

View file

@ -6,12 +6,12 @@ ref = require('electron'), ipcRenderer = ref.ipcRenderer, deprecate = ref.deprec
EventEmitter = require('events').EventEmitter;
/* This module is deprecated, we mirror everything from ipcRenderer. */
// This module is deprecated, we mirror everything from ipcRenderer.
deprecate.warn('ipc module', 'require("electron").ipcRenderer');
/* Routes events of ipcRenderer. */
// Routes events of ipcRenderer.
ipc = new EventEmitter;
@ -23,7 +23,7 @@ ipcRenderer.emit = function() {
};
/* Deprecated. */
// Deprecated.
for (method in ipcRenderer) {
if (method.startsWith('send')) {

View file

@ -8,7 +8,7 @@ v8Util = process.atomBinding('v8_util');
callbacksRegistry = new CallbacksRegistry;
/* Check for circular reference. */
// Check for circular reference.
isCircular = function(field, visited) {
if (typeof field === 'object') {
@ -21,7 +21,7 @@ isCircular = function(field, visited) {
};
/* Convert the arguments object into an array of meta data. */
// Convert the arguments object into an array of meta data.
wrapArgs = function(args, visited) {
var valueToMeta;
@ -91,7 +91,7 @@ wrapArgs = function(args, visited) {
};
/* Convert meta data from browser into real value. */
// Convert meta data from browser into real value.
metaToValue = function(meta) {
var RemoteFunction, el, i, j, len, len1, member, ref1, ref2, results, ret;
@ -122,13 +122,13 @@ metaToValue = function(meta) {
default:
if (meta.type === 'function') {
/* A shadow class to represent the remote function object. */
// A shadow class to represent the remote function object.
ret = RemoteFunction = (function() {
function RemoteFunction() {
var obj;
if (this.constructor === RemoteFunction) {
/* Constructor call. */
// Constructor call.
obj = ipcRenderer.sendSync('ATOM_BROWSER_CONSTRUCTOR', meta.id, wrapArgs(arguments));
/*
@ -139,7 +139,7 @@ metaToValue = function(meta) {
return metaToValue(obj);
} else {
/* Function call. */
// Function call.
obj = ipcRenderer.sendSync('ATOM_BROWSER_FUNCTION_CALL', meta.id, wrapArgs(arguments));
return metaToValue(obj);
}
@ -152,7 +152,7 @@ metaToValue = function(meta) {
ret = v8Util.createObjectWithName(meta.name);
}
/* Polulate delegate members. */
// Polulate delegate members.
ref2 = meta.members;
for (j = 0, len1 = ref2.length; j < len1; j++) {
member = ref2[j];
@ -171,14 +171,14 @@ metaToValue = function(meta) {
return ipcRenderer.send('ATOM_BROWSER_DEREFERENCE', meta.id);
});
/* Remember object's id. */
// Remember object's id.
v8Util.setHiddenValue(ret, 'atomId', meta.id);
return ret;
}
};
/* Construct a plain object from the meta. */
// Construct a plain object from the meta.
metaToPlainObject = function(meta) {
var i, len, name, obj, ref1, ref2, value;
@ -212,12 +212,12 @@ createRemoteMemberFunction = function(metaId, name) {
var ret;
if (this.constructor === RemoteMemberFunction) {
/* Constructor call. */
// Constructor call.
ret = ipcRenderer.sendSync('ATOM_BROWSER_MEMBER_CONSTRUCTOR', metaId, name, wrapArgs(arguments));
return metaToValue(ret);
} else {
/* Call member function. */
// Call member function.
ret = ipcRenderer.sendSync('ATOM_BROWSER_MEMBER_CALL', metaId, name, wrapArgs(arguments));
return metaToValue(ret);
}
@ -241,39 +241,39 @@ createRemoteMemberProperty = function(metaId, name) {
configurable: false,
set: function(value) {
/* Set member data. */
// Set member data.
ipcRenderer.sendSync('ATOM_BROWSER_MEMBER_SET', metaId, name, value);
return value;
},
get: function() {
/* Get member data. */
// Get member data.
return metaToValue(ipcRenderer.sendSync('ATOM_BROWSER_MEMBER_GET', metaId, name));
}
};
};
/* Browser calls a callback in renderer. */
// Browser calls a callback in renderer.
ipcRenderer.on('ATOM_RENDERER_CALLBACK', function(event, id, args) {
return callbacksRegistry.apply(id, metaToValue(args));
});
/* A callback in browser is released. */
// A callback in browser is released.
ipcRenderer.on('ATOM_RENDERER_RELEASE_CALLBACK', function(event, id) {
return callbacksRegistry.remove(id);
});
/* List all built-in modules in browser process. */
// List all built-in modules in browser process.
browserModules = require('../../../browser/api/lib/exports/electron');
/* And add a helper receiver for each one. */
// And add a helper receiver for each one.
fn = function(name) {
return Object.defineProperty(exports, name, {
@ -305,12 +305,12 @@ exports.require = function(module) {
};
/* Optimize require('electron'). */
// Optimize require('electron').
moduleCache.electron = exports;
/* Alias to remote.require('electron').xxx. */
// Alias to remote.require('electron').xxx.
builtinCache = {};
@ -324,7 +324,7 @@ exports.getBuiltin = function(module) {
};
/* Get current BrowserWindow object. */
// Get current BrowserWindow object.
windowCache = null;
@ -338,7 +338,7 @@ exports.getCurrentWindow = function() {
};
/* Get current WebContents object. */
// Get current WebContents object.
webContentsCache = null;
@ -352,7 +352,7 @@ exports.getCurrentWebContents = function() {
};
/* Get a global object in browser. */
// Get a global object in browser.
exports.getGlobal = function(name) {
var meta;
@ -361,7 +361,7 @@ exports.getGlobal = function(name) {
};
/* Get the process object in browser. */
// Get the process object in browser.
processCache = null;
@ -373,7 +373,7 @@ exports.__defineGetter__('process', function() {
});
/* Create a funtion that will return the specifed value when called in browser. */
// Create a funtion that will return the specifed value when called in browser.
exports.createFunctionWithReturnValue = function(returnValue) {
var func;
@ -385,7 +385,7 @@ exports.createFunctionWithReturnValue = function(returnValue) {
};
/* Get the guest WebContents from guestInstanceId. */
// Get the guest WebContents from guestInstanceId.
exports.getGuestWebContents = function(guestInstanceId) {
var meta;

View file

@ -19,12 +19,12 @@ Module = require('module');
process.argv.splice(1, 1);
/* Clear search paths. */
// Clear search paths.
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths'));
/* Import common settings. */
// Import common settings.
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
@ -35,12 +35,12 @@ if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
}
/* Expose public APIs. */
// Expose public APIs.
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib', 'exports'));
/* The global variable will be used by ipc for event dispatching */
// The global variable will be used by ipc for event dispatching
v8Util = process.atomBinding('v8_util');
@ -54,7 +54,7 @@ electron.ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', (event, m
electron.webFrame[method].apply(electron.webFrame, args);
});
/* Process command line arguments. */
// Process command line arguments.
nodeIntegration = 'false';
@ -63,11 +63,11 @@ for (i = 0, len = ref.length; i < len; i++) {
arg = ref[i];
if (arg.indexOf('--guest-instance-id=') === 0) {
/* This is a guest web view. */
// This is a guest web view.
process.guestInstanceId = parseInt(arg.substr(arg.indexOf('=') + 1));
} else if (arg.indexOf('--opener-id=') === 0) {
/* This is a guest BrowserWindow. */
// This is a guest BrowserWindow.
process.openerId = parseInt(arg.substr(arg.indexOf('=') + 1));
} else if (arg.indexOf('--node-integration=') === 0) {
nodeIntegration = arg.substr(arg.indexOf('=') + 1);
@ -78,20 +78,20 @@ for (i = 0, len = ref.length; i < len; i++) {
if (location.protocol === 'chrome-devtools:') {
/* Override some inspector APIs. */
// Override some inspector APIs.
require('./inspector');
nodeIntegration = 'true';
} else if (location.protocol === 'chrome-extension:') {
/* Add implementations of chrome API. */
// Add implementations of chrome API.
require('./chrome-api');
nodeIntegration = 'true';
} else {
/* Override default web functions. */
// Override default web functions.
require('./override');
/* Load webview tag implementation. */
// Load webview tag implementation.
if (process.guestInstanceId == null) {
require('./web-view/web-view');
require('./web-view/web-view-attributes');
@ -100,27 +100,27 @@ if (location.protocol === 'chrome-devtools:') {
if (nodeIntegration === 'true' || nodeIntegration === 'all' || nodeIntegration === 'except-iframe' || nodeIntegration === 'manual-enable-iframe') {
/* Export node bindings to global. */
// Export node bindings to global.
global.require = require;
global.module = module;
/* Set the __filename to the path of html file if it is file: protocol. */
// Set the __filename to the path of html file if it is file: protocol.
if (window.location.protocol === 'file:') {
pathname = process.platform === 'win32' && window.location.pathname[0] === '/' ? window.location.pathname.substr(1) : window.location.pathname;
global.__filename = path.normalize(decodeURIComponent(pathname));
global.__dirname = path.dirname(global.__filename);
/* Set module's filename so relative require can work as expected. */
// Set module's filename so relative require can work as expected.
module.filename = global.__filename;
/* Also search for module under the html file. */
// Also search for module under the html file.
module.paths = module.paths.concat(Module._nodeModulePaths(global.__dirname));
} else {
global.__filename = __filename;
global.__dirname = __dirname;
}
/* Redirect window.onerror to uncaughtException. */
// Redirect window.onerror to uncaughtException.
window.onerror = function(message, filename, lineno, colno, error) {
if (global.process.listeners('uncaughtException').length > 0) {
global.process.emit('uncaughtException', error);
@ -130,13 +130,13 @@ if (nodeIntegration === 'true' || nodeIntegration === 'all' || nodeIntegration =
}
};
/* Emit the 'exit' event when page is unloading. */
// Emit the 'exit' event when page is unloading.
window.addEventListener('unload', function() {
return process.emit('exit');
});
} else {
/* Delete Node's symbols after the Environment has been loaded. */
// Delete Node's symbols after the Environment has been loaded.
process.once('loaded', function() {
delete global.process;
delete global.setImmediate;
@ -146,7 +146,7 @@ if (nodeIntegration === 'true' || nodeIntegration === 'all' || nodeIntegration =
}
/* Load the script specfied by the "preload" attribute. */
// Load the script specfied by the "preload" attribute.
if (preloadScript) {
try {

View file

@ -2,10 +2,10 @@ var convertToMenuTemplate, createFileSelectorElement, createMenu, pathToHtml5Fil
window.onload = function() {
/* Use menu API to show context menu. */
// Use menu API to show context menu.
InspectorFrontendHost.showContextMenuAtPoint = createMenu;
/* Use dialog API to override file chooser dialog. */
// Use dialog API to override file chooser dialog.
return WebInspector.createFileSelectorElement = createFileSelectorElement;
};
@ -52,7 +52,7 @@ createMenu = function(x, y, items, document) {
Menu = remote.Menu;
menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
/* The menu is expected to show asynchronously. */
// The menu is expected to show asynchronously.
return setTimeout(function() {
return menu.popup(remote.getCurrentWindow());
});

View file

@ -4,7 +4,7 @@ var BrowserWindowProxy, a, getHistoryOperation, ipcRenderer, ref, remote, resolv
ref = require('electron'), ipcRenderer = ref.ipcRenderer, remote = ref.remote;
/* Helper function to resolve relative url. */
// Helper function to resolve relative url.
a = window.top.document.createElement('a');
@ -14,7 +14,7 @@ resolveURL = function(url) {
};
/* Window object returned by "window.open". */
// Window object returned by "window.open".
BrowserWindowProxy = (function() {
BrowserWindowProxy.proxies = {};
@ -70,14 +70,14 @@ BrowserWindowProxy = (function() {
if (process.guestInstanceId == null) {
/* Override default window.close. */
// Override default window.close.
window.close = function() {
return remote.getCurrentWindow().close();
};
}
/* Make the browser window or guest view emit "new-window" event. */
// Make the browser window or guest view emit "new-window" event.
window.open = function(url, frameName, features) {
var feature, guestId, i, ints, j, len, len1, name, options, ref1, ref2, value;
@ -90,7 +90,7 @@ window.open = function(url, frameName, features) {
options = {};
ints = ['x', 'y', 'width', 'height', 'min-width', 'max-width', 'min-height', 'max-height', 'zoom-factor'];
/* Make sure to get rid of excessive whitespace in the property name */
// Make sure to get rid of excessive whitespace in the property name
ref1 = features.split(/,\s*/);
for (i = 0, len = ref1.length; i < len; i++) {
feature = ref1[i];
@ -117,7 +117,7 @@ window.open = function(url, frameName, features) {
options.height = 600;
}
/* Resolve relative urls. */
// Resolve relative urls.
url = resolveURL(url);
for (j = 0, len1 = ints.length; j < len1; j++) {
name = ints[j];
@ -134,7 +134,7 @@ window.open = function(url, frameName, features) {
};
/* Use the dialog API to implement alert(). */
// Use the dialog API to implement alert().
window.alert = function(message, title) {
var buttons;
@ -149,11 +149,11 @@ window.alert = function(message, title) {
buttons: buttons
});
/* Alert should always return undefined. */
// Alert should always return undefined.
};
/* And the confirm(). */
// And the confirm().
window.confirm = function(message, title) {
var buttons, cancelId;
@ -171,7 +171,7 @@ window.confirm = function(message, title) {
};
/* But we do not support prompt(). */
// But we do not support prompt().
window.prompt = function() {
throw new Error('prompt() is and will not be supported.');
@ -183,9 +183,9 @@ if (process.openerId != null) {
ipcRenderer.on('ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', function(event, sourceId, message, sourceOrigin) {
/* Manually dispatch event instead of using postMessage because we also need to */
// Manually dispatch event instead of using postMessage because we also need to
/* set event.source. */
// set event.source.
event = document.createEvent('Event');
event.initEvent('message', false, false);
event.data = message;
@ -195,7 +195,7 @@ ipcRenderer.on('ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', function(event, sourceId,
});
/* Forward history operations to browser. */
// Forward history operations to browser.
sendHistoryOperation = function() {
var args;
@ -228,7 +228,7 @@ Object.defineProperty(window.history, 'length', {
});
/* Make document.hidden and document.visibilityState return the correct value. */
// Make document.hidden and document.visibilityState return the correct value.
Object.defineProperty(document, 'hidden', {
get: function() {

View file

@ -11,7 +11,7 @@ webViewConstants = require('./web-view-constants');
remote = require('electron').remote;
/* Helper function to resolve url set in attribute. */
// Helper function to resolve url set in attribute.
a = document.createElement('a');
@ -36,21 +36,21 @@ WebViewAttribute = (function() {
}
/* Retrieves and returns the attribute's value. */
// Retrieves and returns the attribute's value.
WebViewAttribute.prototype.getValue = function() {
return this.webViewImpl.webviewNode.getAttribute(this.name) || this.value;
};
/* Sets the attribute's value. */
// Sets the attribute's value.
WebViewAttribute.prototype.setValue = function(value) {
return this.webViewImpl.webviewNode.setAttribute(this.name, value || '');
};
/* Changes the attribute's value without triggering its mutation handler. */
// Changes the attribute's value without triggering its mutation handler.
WebViewAttribute.prototype.setValueIgnoreMutation = function(value) {
this.ignoreMutation = true;
@ -59,7 +59,7 @@ WebViewAttribute = (function() {
};
/* Defines this attribute as a property on the webview node. */
// Defines this attribute as a property on the webview node.
WebViewAttribute.prototype.defineProperty = function() {
return Object.defineProperty(this.webViewImpl.webviewNode, this.name, {
@ -78,7 +78,7 @@ WebViewAttribute = (function() {
};
/* Called when the attribute's value changes. */
// Called when the attribute's value changes.
WebViewAttribute.prototype.handleMutation = function() {};
@ -87,7 +87,7 @@ WebViewAttribute = (function() {
})();
/* An attribute that is treated as a Boolean. */
// An attribute that is treated as a Boolean.
BooleanAttribute = (function(superClass) {
extend(BooleanAttribute, superClass);
@ -113,7 +113,7 @@ BooleanAttribute = (function(superClass) {
})(WebViewAttribute);
/* Attribute that specifies whether transparency is allowed in the webview. */
// Attribute that specifies whether transparency is allowed in the webview.
AllowTransparencyAttribute = (function(superClass) {
extend(AllowTransparencyAttribute, superClass);
@ -134,7 +134,7 @@ AllowTransparencyAttribute = (function(superClass) {
})(BooleanAttribute);
/* Attribute used to define the demension limits of autosizing. */
// Attribute used to define the demension limits of autosizing.
AutosizeDimensionAttribute = (function(superClass) {
extend(AutosizeDimensionAttribute, superClass);
@ -169,7 +169,7 @@ AutosizeDimensionAttribute = (function(superClass) {
})(WebViewAttribute);
/* Attribute that specifies whether the webview should be autosized. */
// Attribute that specifies whether the webview should be autosized.
AutosizeAttribute = (function(superClass) {
extend(AutosizeAttribute, superClass);
@ -185,7 +185,7 @@ AutosizeAttribute = (function(superClass) {
})(BooleanAttribute);
/* Attribute representing the state of the storage partition. */
// Attribute representing the state of the storage partition.
PartitionAttribute = (function(superClass) {
extend(PartitionAttribute, superClass);
@ -198,7 +198,7 @@ PartitionAttribute = (function(superClass) {
PartitionAttribute.prototype.handleMutation = function(oldValue, newValue) {
newValue = newValue || '';
/* The partition cannot change if the webview has already navigated. */
// The partition cannot change if the webview has already navigated.
if (!this.webViewImpl.beforeFirstNavigation) {
window.console.error(webViewConstants.ERROR_MSG_ALREADY_NAVIGATED);
this.setValueIgnoreMutation(oldValue);
@ -215,7 +215,7 @@ PartitionAttribute = (function(superClass) {
})(WebViewAttribute);
/* Attribute that handles the location and navigation of the webview. */
// Attribute that handles the location and navigation of the webview.
SrcAttribute = (function(superClass) {
extend(SrcAttribute, superClass);
@ -310,7 +310,7 @@ SrcAttribute = (function(superClass) {
return;
}
/* Navigate to |this.src|. */
// Navigate to |this.src|.
opts = {};
httpreferrer = this.webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue();
if (httpreferrer) {
@ -329,7 +329,7 @@ SrcAttribute = (function(superClass) {
})(WebViewAttribute);
/* Attribute specifies HTTP referrer. */
// Attribute specifies HTTP referrer.
HttpReferrerAttribute = (function(superClass) {
extend(HttpReferrerAttribute, superClass);
@ -343,7 +343,7 @@ HttpReferrerAttribute = (function(superClass) {
})(WebViewAttribute);
/* Attribute specifies user agent */
// Attribute specifies user agent
UserAgentAttribute = (function(superClass) {
extend(UserAgentAttribute, superClass);
@ -357,7 +357,7 @@ UserAgentAttribute = (function(superClass) {
})(WebViewAttribute);
/* Attribute that set preload script. */
// Attribute that set preload script.
PreloadAttribute = (function(superClass) {
extend(PreloadAttribute, superClass);
@ -385,7 +385,7 @@ PreloadAttribute = (function(superClass) {
})(WebViewAttribute);
/* Sets up all of the webview attributes. */
// Sets up all of the webview attributes.
WebViewImpl.prototype.setupWebViewAttributes = function() {
var attribute, autosizeAttributes, i, len, results;

View file

@ -1,6 +1,6 @@
module.exports = {
/* Attributes. */
// Attributes.
ATTRIBUTE_ALLOWTRANSPARENCY: 'allowtransparency',
ATTRIBUTE_AUTOSIZE: 'autosize',
ATTRIBUTE_MAXHEIGHT: 'maxheight',
@ -18,10 +18,10 @@ module.exports = {
ATTRIBUTE_PRELOAD: 'preload',
ATTRIBUTE_USERAGENT: 'useragent',
/* Internal attribute. */
// Internal attribute.
ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid',
/* Error messages. */
// Error messages.
ERROR_MSG_ALREADY_NAVIGATED: 'The object has already navigated, so its partition cannot be changed.',
ERROR_MSG_CANNOT_INJECT_SCRIPT: '<webview>: ' + 'Script cannot be injected into content until the page has loaded.',
ERROR_MSG_INVALID_PARTITION_ATTRIBUTE: 'Invalid partition attribute.',

View file

@ -13,7 +13,7 @@ guestViewInternal = require('./guest-view-internal');
webViewConstants = require('./web-view-constants');
/* ID generator. */
// ID generator.
nextId = 0;
@ -22,7 +22,7 @@ getNextId = function() {
};
/* Represents the internal state of the WebView node. */
// Represents the internal state of the WebView node.
WebViewImpl = (function() {
function WebViewImpl(webviewNode) {
@ -33,7 +33,7 @@ WebViewImpl = (function() {
this.elementAttached = false;
this.beforeFirstNavigation = true;
/* on* Event handlers. */
// on* Event handlers.
this.on = {};
this.browserPluginNode = this.createBrowserPluginNode();
shadowRoot = this.webviewNode.createShadowRoot();
@ -62,7 +62,7 @@ WebViewImpl = (function() {
};
/* Resets some state upon reattaching <webview> element to the DOM. */
// Resets some state upon reattaching <webview> element to the DOM.
WebViewImpl.prototype.reset = function() {
// Unlisten the zoom-level-changed event.
@ -87,7 +87,7 @@ WebViewImpl = (function() {
};
/* Sets the <webview>.request property. */
// Sets the <webview>.request property.
WebViewImpl.prototype.setRequestPropertyOnWebViewNode = function(request) {
return Object.defineProperty(this.webviewNode, 'request', {
@ -110,14 +110,14 @@ WebViewImpl = (function() {
this.webviewNode.addEventListener('focus', (function(_this) {
return function(e) {
/* Focus the BrowserPlugin when the <webview> takes focus. */
// Focus the BrowserPlugin when the <webview> takes focus.
return _this.browserPluginNode.focus();
};
})(this));
return this.webviewNode.addEventListener('blur', (function(_this) {
return function(e) {
/* Blur the BrowserPlugin when the <webview> loses focus. */
// Blur the BrowserPlugin when the <webview> loses focus.
return _this.browserPluginNode.blur();
};
})(this));
@ -137,7 +137,7 @@ WebViewImpl = (function() {
return;
}
/* Let the changed attribute handle its own mutation; */
// Let the changed attribute handle its own mutation;
return this.attributes[attributeName].handleMutation(oldValue, newValue);
};
@ -146,7 +146,7 @@ WebViewImpl = (function() {
this.browserPluginNode.removeAttribute(webViewConstants.ATTRIBUTE_INTERNALINSTANCEID);
this.internalInstanceId = parseInt(newValue);
/* Track when the element resizes using the element resize callback. */
// Track when the element resizes using the element resize callback.
webFrame.registerElementResizeCallback(this.internalInstanceId, this.onElementResize.bind(this));
if (!this.guestInstanceId) {
return;
@ -163,9 +163,9 @@ WebViewImpl = (function() {
width = node.offsetWidth;
height = node.offsetHeight;
/* Check the current bounds to make sure we do not resize <webview> */
// Check the current bounds to make sure we do not resize <webview>
/* outside of current constraints. */
// outside of current constraints.
maxWidth = this.attributes[webViewConstants.ATTRIBUTE_MAXWIDTH].getValue() | width;
maxHeight = this.attributes[webViewConstants.ATTRIBUTE_MAXHEIGHT].getValue() | width;
minWidth = this.attributes[webViewConstants.ATTRIBUTE_MINWIDTH].getValue() | width;
@ -186,7 +186,7 @@ WebViewImpl = (function() {
WebViewImpl.prototype.onElementResize = function(newSize) {
/* Dispatch the 'resize' event. */
// Dispatch the 'resize' event.
var resizeEvent;
resizeEvent = new Event('resize', {
bubbles: true
@ -214,10 +214,10 @@ WebViewImpl = (function() {
};
/* Adds an 'on<event>' property on the webview, which can be used to set/unset */
// Adds an 'on<event>' property on the webview, which can be used to set/unset
/* an event handler. */
// an event handler.
WebViewImpl.prototype.setupEventProperty = function(eventName) {
var propertyName;
@ -244,7 +244,7 @@ WebViewImpl = (function() {
};
/* Updates state upon loadcommit. */
// Updates state upon loadcommit.
WebViewImpl.prototype.onLoadCommit = function(webViewEvent) {
var newValue, oldValue;
@ -306,7 +306,7 @@ WebViewImpl = (function() {
})();
/* Registers browser plugin <object> custom element. */
// Registers browser plugin <object> custom element.
registerBrowserPluginElement = function() {
var proto;
@ -315,7 +315,7 @@ registerBrowserPluginElement = function() {
this.setAttribute('type', 'application/browser-plugin');
this.setAttribute('id', 'browser-plugin-' + getNextId());
/* The <object> node fills in the <webview> container. */
// The <object> node fills in the <webview> container.
this.style.display = 'block';
this.style.width = '100%';
return this.style.height = '100%';
@ -330,7 +330,7 @@ registerBrowserPluginElement = function() {
};
proto.attachedCallback = function() {
/* Load the plugin immediately. */
// Load the plugin immediately.
var unused;
return unused = this.nonExistentAttribute;
};
@ -345,7 +345,7 @@ registerBrowserPluginElement = function() {
};
/* Registers <webview> custom element. */
// Registers <webview> custom element.
registerWebViewElement = function() {
var createBlockHandler, createNonBlockHandler, i, j, len, len1, m, methods, nonblockMethods, proto;
@ -384,7 +384,7 @@ registerWebViewElement = function() {
}
};
/* Public-facing API methods. */
// Public-facing API methods.
methods = ['getURL', 'getTitle', 'isLoading', 'isWaitingForResponse', 'stop', 'reload', 'reloadIgnoringCache', 'canGoBack', 'canGoForward', 'canGoToOffset', 'clearHistory', 'goBack', 'goForward', 'goToIndex', 'goToOffset', 'isCrashed', 'setUserAgent', 'getUserAgent', 'openDevTools', 'closeDevTools', 'isDevToolsOpened', 'isDevToolsFocused', 'inspectElement', 'setAudioMuted', 'isAudioMuted', 'undo', 'redo', 'cut', 'copy', 'paste', 'pasteAndMatchStyle', 'delete', 'selectAll', 'unselect', 'replace', 'replaceMisspelling', 'findInPage', 'stopFindInPage', 'getId', 'downloadURL', 'inspectServiceWorker', 'print', 'printToPDF'];
nonblockMethods = [
'executeJavaScript',
@ -397,7 +397,7 @@ registerWebViewElement = function() {
'setZoomLevelLimits',
];
/* Forward proto.foo* method calls to WebViewImpl.foo*. */
// Forward proto.foo* method calls to WebViewImpl.foo*.
createBlockHandler = function(m) {
return function() {
var args, internal, ref1;
@ -423,15 +423,16 @@ registerWebViewElement = function() {
proto[m] = createNonBlockHandler(m);
}
/* Deprecated. */
// Deprecated.
deprecate.rename(proto, 'getUrl', 'getURL');
window.WebView = webFrame.registerEmbedderCustomElement('webview', {
prototype: proto
});
/* Delete the callbacks so developers cannot call them and produce unexpected */
/* behavior. */
/*
Delete the callbacks so developers cannot call them and produce unexpected
behavior.
*/
delete proto.createdCallback;
delete proto.attachedCallback;
delete proto.detachedCallback;