Remove extra newlines around comments

This commit is contained in:
Kevin Sawicki 2016-01-14 11:10:12 -08:00
parent 990dc30e8d
commit 030d2a843c
40 changed files with 103 additions and 425 deletions

View file

@ -10,9 +10,7 @@ webViewConstants = require('./web-view-constants');
remote = require('electron').remote;
// Helper function to resolve url set in attribute.
a = document.createElement('a');
resolveURL = function(url) {
@ -20,12 +18,8 @@ resolveURL = function(url) {
return a.href;
};
/*
Attribute objects.
Default implementation of a WebView attribute.
*/
// Attribute objects.
// Default implementation of a WebView attribute.
WebViewAttribute = (function() {
function WebViewAttribute(name, webViewImpl) {
this.name = name;
@ -35,32 +29,24 @@ WebViewAttribute = (function() {
this.defineProperty();
}
// 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.
WebViewAttribute.prototype.setValue = function(value) {
return this.webViewImpl.webviewNode.setAttribute(this.name, value || '');
};
// Changes the attribute's value without triggering its mutation handler.
WebViewAttribute.prototype.setValueIgnoreMutation = function(value) {
this.ignoreMutation = true;
this.setValue(value);
return this.ignoreMutation = false;
};
// Defines this attribute as a property on the webview node.
WebViewAttribute.prototype.defineProperty = function() {
return Object.defineProperty(this.webViewImpl.webviewNode, this.name, {
get: (function(_this) {
@ -77,18 +63,14 @@ WebViewAttribute = (function() {
});
};
// Called when the attribute's value changes.
WebViewAttribute.prototype.handleMutation = function() {};
return WebViewAttribute;
})();
// An attribute that is treated as a Boolean.
BooleanAttribute = (function(superClass) {
extend(BooleanAttribute, superClass);
@ -112,9 +94,7 @@ BooleanAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that specifies whether transparency is allowed in the webview.
AllowTransparencyAttribute = (function(superClass) {
extend(AllowTransparencyAttribute, superClass);
@ -133,9 +113,7 @@ AllowTransparencyAttribute = (function(superClass) {
})(BooleanAttribute);
// Attribute used to define the demension limits of autosizing.
AutosizeDimensionAttribute = (function(superClass) {
extend(AutosizeDimensionAttribute, superClass);
@ -168,9 +146,7 @@ AutosizeDimensionAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that specifies whether the webview should be autosized.
AutosizeAttribute = (function(superClass) {
extend(AutosizeAttribute, superClass);
@ -184,9 +160,7 @@ AutosizeAttribute = (function(superClass) {
})(BooleanAttribute);
// Attribute representing the state of the storage partition.
PartitionAttribute = (function(superClass) {
extend(PartitionAttribute, superClass);
@ -214,9 +188,7 @@ PartitionAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that handles the location and navigation of the webview.
SrcAttribute = (function(superClass) {
extend(SrcAttribute, superClass);
@ -236,29 +208,23 @@ SrcAttribute = (function(superClass) {
SrcAttribute.prototype.setValueIgnoreMutation = function(value) {
WebViewAttribute.prototype.setValueIgnoreMutation.call(this, value);
/*
takeRecords() is needed to clear queued up src mutations. Without it, it
is possible for this change to get picked up asyncronously by src's
mutation observer |observer|, and then get handled even though we do not
want to handle this mutation.
*/
// takeRecords() is needed to clear queued up src mutations. Without it, it
// is possible for this change to get picked up asyncronously by src's
// mutation observer |observer|, and then get handled even though we do not
// want to handle this mutation.
return this.observer.takeRecords();
};
SrcAttribute.prototype.handleMutation = function(oldValue, newValue) {
/*
Once we have navigated, we don't allow clearing the src attribute.
Once <webview> enters a navigated state, it cannot return to a
placeholder state.
*/
// Once we have navigated, we don't allow clearing the src attribute.
// Once <webview> enters a navigated state, it cannot return to a
// placeholder state.
if (!newValue && oldValue) {
/*
src attribute changes normally initiate a navigation. We suppress
the next src attribute handler call to avoid reloading the page
on every guest-initiated navigation.
*/
// src attribute changes normally initiate a navigation. We suppress
// the next src attribute handler call to avoid reloading the page
// on every guest-initiated navigation.
this.setValueIgnoreMutation(oldValue);
return;
}
@ -266,13 +232,10 @@ SrcAttribute = (function(superClass) {
};
/*
The purpose of this mutation observer is to catch assignment to the src
attribute without any changes to its value. This is useful in the case
where the webview guest has crashed and navigating to the same address
spawns off a new process.
*/
// The purpose of this mutation observer is to catch assignment to the src
// attribute without any changes to its value. This is useful in the case
// where the webview guest has crashed and navigating to the same address
// spawns off a new process.
SrcAttribute.prototype.setupMutationObserver = function() {
var params;
this.observer = new MutationObserver((function(_this) {
@ -328,9 +291,7 @@ SrcAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute specifies HTTP referrer.
HttpReferrerAttribute = (function(superClass) {
extend(HttpReferrerAttribute, superClass);
@ -342,9 +303,7 @@ HttpReferrerAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute specifies user agent
UserAgentAttribute = (function(superClass) {
extend(UserAgentAttribute, superClass);
@ -356,9 +315,7 @@ UserAgentAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that set preload script.
PreloadAttribute = (function(superClass) {
extend(PreloadAttribute, superClass);
@ -384,9 +341,7 @@ PreloadAttribute = (function(superClass) {
})(WebViewAttribute);
// Sets up all of the webview attributes.
WebViewImpl.prototype.setupWebViewAttributes = function() {
var attribute, autosizeAttributes, i, len, results;
this.attributes = {};