Commit ed31a5a6 authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Convert ==/!= to ===/!== in: //chrome/renderer/

CL generated with:

$ git ls-files 'chrome/renderer/*.js' | xargs grep -l -P ' [!=]= (?!null)' | xargs perl -p -i -e 's/ ([!=])= (?!null)/ \1== /g'

Bug: 720034
Change-Id: I64e170031fdd2087dd3adf50276228fbfaf6fd57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003917
Commit-Queue: Dan Beam <dbeam@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732257}
parent 5e341638
...@@ -38,13 +38,13 @@ apiBridge.registerCustomHook(function(bindingsAPI) { ...@@ -38,13 +38,13 @@ apiBridge.registerCustomHook(function(bindingsAPI) {
apiFunctions.setHandleRequest('inspect', function(options, callback) { apiFunctions.setHandleRequest('inspect', function(options, callback) {
var renderViewId = options.render_view_id; var renderViewId = options.render_view_id;
if (typeof renderViewId == 'string') { if (typeof renderViewId === 'string') {
renderViewId = parseInt(renderViewId); renderViewId = parseInt(renderViewId);
if (isNaN(renderViewId)) if (isNaN(renderViewId))
throw new Error('Invalid value for render_view_id'); throw new Error('Invalid value for render_view_id');
} }
var renderProcessId = options.render_process_id; var renderProcessId = options.render_process_id;
if (typeof renderProcessId == 'string') { if (typeof renderProcessId === 'string') {
renderProcessId = parseInt(renderProcessId); renderProcessId = parseInt(renderProcessId);
if (isNaN(renderProcessId)) if (isNaN(renderProcessId))
throw new Error('Invalid value for render_process_id'); throw new Error('Invalid value for render_process_id');
......
...@@ -15,18 +15,20 @@ bindingUtil.registerEventArgumentMassager('downloads.onDeterminingFilename', ...@@ -15,18 +15,20 @@ bindingUtil.registerEventArgumentMassager('downloads.onDeterminingFilename',
function isValidResult(result) { function isValidResult(result) {
if (result === undefined) if (result === undefined)
return false; return false;
if (typeof(result) != 'object') { if (typeof result !== 'object') {
console.error('Error: Invocation of form suggest(' + typeof(result) + console.error(
') doesn\'t match definition suggest({filename: string, ' + 'Error: Invocation of form suggest(' + typeof result +
'conflictAction: string})'); ') doesn\'t match definition suggest({filename: string, ' +
'conflictAction: string})');
return false; return false;
} else if ((typeof(result.filename) != 'string') || } else if (
(result.filename.length == 0)) { typeof result.filename !== 'string' || result.filename.length === 0) {
console.error('Error: "filename" parameter to suggest() must be a ' + console.error('Error: "filename" parameter to suggest() must be a ' +
'non-empty string'); 'non-empty string');
return false; return false;
} else if ([undefined, 'uniquify', 'overwrite', 'prompt'].indexOf( } else if ([
result.conflictAction) < 0) { undefined, 'uniquify', 'overwrite', 'prompt'
].indexOf(result.conflictAction) < 0) {
console.error('Error: "conflictAction" parameter to suggest() must be ' + console.error('Error: "conflictAction" parameter to suggest() must be ' +
'one of undefined, "uniquify", "overwrite", "prompt"'); 'one of undefined, "uniquify", "overwrite", "prompt"');
return false; return false;
...@@ -48,10 +50,9 @@ bindingUtil.registerEventArgumentMassager('downloads.onDeterminingFilename', ...@@ -48,10 +50,9 @@ bindingUtil.registerEventArgumentMassager('downloads.onDeterminingFilename',
} }
try { try {
var results = dispatch([downloadItem, suggestCallback]); var results = dispatch([downloadItem, suggestCallback]);
var async = (results && var async =
results.results && (results && results.results && (results.results.length !== 0) &&
(results.results.length != 0) && (results.results[0] === true));
(results.results[0] === true));
if (suggestable && !async) if (suggestable && !async)
suggestCallback(); suggestCallback();
} catch (e) { } catch (e) {
......
...@@ -44,7 +44,7 @@ function CreateOperationError() { ...@@ -44,7 +44,7 @@ function CreateOperationError() {
// returns true. // returns true.
function catchInvalidTokenError(reject) { function catchInvalidTokenError(reject) {
if (chrome.runtime.lastError && if (chrome.runtime.lastError &&
chrome.runtime.lastError.message == errorInvalidToken) { chrome.runtime.lastError.message === errorInvalidToken) {
reject(chrome.runtime.lastError); reject(chrome.runtime.lastError);
return true; return true;
} }
......
...@@ -41,7 +41,7 @@ function annotateDate(date) { ...@@ -41,7 +41,7 @@ function annotateDate(date) {
*/ */
function verifyImageURI(uri) { function verifyImageURI(uri) {
// The URI is specified by a user, so the type may be incorrect. // The URI is specified by a user, so the type may be incorrect.
if (typeof uri != 'string' && !(uri instanceof String)) if (typeof uri !== 'string' && !(uri instanceof String))
return false; return false;
return METADATA_THUMBNAIL_FORMAT.test(uri); return METADATA_THUMBNAIL_FORMAT.test(uri);
......
...@@ -15,7 +15,7 @@ apiBridge.registerCustomHook(function(bindingsAPI) { ...@@ -15,7 +15,7 @@ apiBridge.registerCustomHook(function(bindingsAPI) {
// Validate message.data. // Validate message.data.
var payloadSize = 0; var payloadSize = 0;
forEach(message.data, function(property, value) { forEach(message.data, function(property, value) {
if (property.length == 0) if (property.length === 0)
throw new Error("One of data keys is empty."); throw new Error("One of data keys is empty.");
var lowerCasedProperty = property.toLowerCase(); var lowerCasedProperty = property.toLowerCase();
...@@ -33,7 +33,7 @@ apiBridge.registerCustomHook(function(bindingsAPI) { ...@@ -33,7 +33,7 @@ apiBridge.registerCustomHook(function(bindingsAPI) {
throw new Error("Payload exceeded allowed size limit. Payload size is: " throw new Error("Payload exceeded allowed size limit. Payload size is: "
+ payloadSize); + payloadSize);
if (payloadSize == 0) if (payloadSize === 0)
throw new Error("No data to send."); throw new Error("No data to send.");
return arguments; return arguments;
......
...@@ -12,7 +12,7 @@ apiBridge.registerCustomHook(function(binding, id, contextType) { ...@@ -12,7 +12,7 @@ apiBridge.registerCustomHook(function(binding, id, contextType) {
path = '/'; path = '/';
else else
path = String(path); path = String(path);
if (path[0] != '/') if (path[0] !== '/')
path = '/' + path; path = '/' + path;
return 'https://' + id + '.chromiumapp.org' + path; return 'https://' + id + '.chromiumapp.org' + path;
}); });
......
...@@ -262,12 +262,12 @@ function MediaSinkExtraDataAdapter(value) { ...@@ -262,12 +262,12 @@ function MediaSinkExtraDataAdapter(value) {
this.$data = null; this.$data = null;
this.$tag = undefined; this.$tag = undefined;
if (value == undefined) { if (value === undefined) {
return; return;
} }
var keys = Object.keys(value); var keys = Object.keys(value);
if (keys.length == 0) { if (keys.length === 0) {
return; return;
} }
...@@ -295,7 +295,7 @@ MediaSinkExtraDataAdapter.Tags = { ...@@ -295,7 +295,7 @@ MediaSinkExtraDataAdapter.Tags = {
Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'dial_media_sink', { Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'dial_media_sink', {
get: function() { get: function() {
if (this.$tag != MediaSinkExtraDataAdapter.Tags.dial_media_sink) { if (this.$tag !== MediaSinkExtraDataAdapter.Tags.dial_media_sink) {
throw new ReferenceError( throw new ReferenceError(
'MediaSinkExtraDataAdapter.dial_media_sink is not currently set.'); 'MediaSinkExtraDataAdapter.dial_media_sink is not currently set.');
} }
...@@ -310,7 +310,7 @@ Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'dial_media_sink', { ...@@ -310,7 +310,7 @@ Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'dial_media_sink', {
Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'cast_media_sink', { Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'cast_media_sink', {
get: function() { get: function() {
if (this.$tag != MediaSinkExtraDataAdapter.Tags.cast_media_sink) { if (this.$tag !== MediaSinkExtraDataAdapter.Tags.cast_media_sink) {
throw new ReferenceError( throw new ReferenceError(
'MediaSinkExtraDataAdapter.cast_media_sink is not currently set.'); 'MediaSinkExtraDataAdapter.cast_media_sink is not currently set.');
} }
...@@ -324,7 +324,7 @@ Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'cast_media_sink', { ...@@ -324,7 +324,7 @@ Object.defineProperty(MediaSinkExtraDataAdapter.prototype, 'cast_media_sink', {
}); });
MediaSinkExtraDataAdapter.fromNewVersion = function(other) { MediaSinkExtraDataAdapter.fromNewVersion = function(other) {
if (other.$tag == mediaRouter.mojom.MediaSinkExtraData.Tags.dialMediaSink) { if (other.$tag === mediaRouter.mojom.MediaSinkExtraData.Tags.dialMediaSink) {
return new MediaSinkExtraDataAdapter({ return new MediaSinkExtraDataAdapter({
'dial_media_sink': 'dial_media_sink':
DialMediaSinkAdapter.fromNewVersion(other.dialMediaSink), DialMediaSinkAdapter.fromNewVersion(other.dialMediaSink),
...@@ -338,7 +338,7 @@ MediaSinkExtraDataAdapter.fromNewVersion = function(other) { ...@@ -338,7 +338,7 @@ MediaSinkExtraDataAdapter.fromNewVersion = function(other) {
}; };
MediaSinkExtraDataAdapter.prototype.toNewVersion = function() { MediaSinkExtraDataAdapter.prototype.toNewVersion = function() {
if (this.$tag == MediaSinkExtraDataAdapter.Tags.dial_media_sink) { if (this.$tag === MediaSinkExtraDataAdapter.Tags.dial_media_sink) {
return new mediaRouter.mojom.MediaSinkExtraData({ return new mediaRouter.mojom.MediaSinkExtraData({
'dialMediaSink': this.dial_media_sink.toNewVersion(), 'dialMediaSink': this.dial_media_sink.toNewVersion(),
}); });
...@@ -550,7 +550,7 @@ function routeToMojo_(route) { ...@@ -550,7 +550,7 @@ function routeToMojo_(route) {
* @return {!mediaRouter.mojom.RouteMessage} A Mojo RouteMessage object. * @return {!mediaRouter.mojom.RouteMessage} A Mojo RouteMessage object.
*/ */
function messageToMojo_(message) { function messageToMojo_(message) {
if ("string" == typeof message.message) { if ('string' === typeof message.message) {
return new mediaRouter.mojom.RouteMessage({ return new mediaRouter.mojom.RouteMessage({
'type': mediaRouter.mojom.RouteMessage.Type.TEXT, 'type': mediaRouter.mojom.RouteMessage.Type.TEXT,
'message': message.message, 'message': message.message,
......
...@@ -46,16 +46,16 @@ function parseOmniboxDescription(input) { ...@@ -46,16 +46,16 @@ function parseOmniboxDescription(input) {
function walk(node) { function walk(node) {
for (var i = 0, child; child = node.childNodes[i]; i++) { for (var i = 0, child; child = node.childNodes[i]; i++) {
// Append text nodes to our description. // Append text nodes to our description.
if (child.nodeType == Node.TEXT_NODE) { if (child.nodeType === Node.TEXT_NODE) {
var shouldTrim = result.description.length == 0; var shouldTrim = result.description.length === 0;
result.description += sanitizeString(child.nodeValue, shouldTrim); result.description += sanitizeString(child.nodeValue, shouldTrim);
continue; continue;
} }
// Process and descend into a subset of recognized tags. // Process and descend into a subset of recognized tags.
if (child.nodeType == Node.ELEMENT_NODE && if (child.nodeType === Node.ELEMENT_NODE &&
(child.nodeName == 'dim' || child.nodeName == 'match' || (child.nodeName === 'dim' || child.nodeName === 'match' ||
child.nodeName == 'url')) { child.nodeName === 'url')) {
var style = { var style = {
'type': child.nodeName, 'type': child.nodeName,
'offset': result.description.length 'offset': result.description.length
...@@ -79,14 +79,14 @@ function parseOmniboxDescription(input) { ...@@ -79,14 +79,14 @@ function parseOmniboxDescription(input) {
apiBridge.registerCustomHook(function(bindingsAPI) { apiBridge.registerCustomHook(function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions; var apiFunctions = bindingsAPI.apiFunctions;
apiFunctions.setUpdateArgumentsPreValidate('setDefaultSuggestion', apiFunctions.setUpdateArgumentsPreValidate(
function(suggestResult) { 'setDefaultSuggestion', function(suggestResult) {
if (suggestResult.content != undefined) { // null, etc. if (suggestResult.content != null) {
throw new Error( throw new Error(
'setDefaultSuggestion cannot contain the "content" field'); 'setDefaultSuggestion cannot contain the "content" field');
} }
return [suggestResult]; return [suggestResult];
}); });
apiFunctions.setHandleRequest('setDefaultSuggestion', function(details) { apiFunctions.setHandleRequest('setDefaultSuggestion', function(details) {
var parseResult = parseOmniboxDescription(details.description); var parseResult = parseOmniboxDescription(details.description);
......
...@@ -11,7 +11,7 @@ var normalizeAlgorithm = ...@@ -11,7 +11,7 @@ var normalizeAlgorithm =
// Any unknown parameters will be ignored. // Any unknown parameters will be ignored.
function normalizeImportParams(importParams) { function normalizeImportParams(importParams) {
if (!importParams.name || if (!importParams.name ||
Object.prototype.toString.call(importParams.name) != '[object String]') { Object.prototype.toString.call(importParams.name) !== '[object String]') {
throw new Error('Algorithm: name: Missing or not a String'); throw new Error('Algorithm: name: Missing or not a String');
} }
......
...@@ -42,7 +42,7 @@ function CreateOperationError() { ...@@ -42,7 +42,7 @@ function CreateOperationError() {
// returns true. // returns true.
function catchInvalidTokenError(reject) { function catchInvalidTokenError(reject) {
if (bindingUtil.hasLastError() && if (bindingUtil.hasLastError() &&
chrome.runtime.lastError.message == errorInvalidToken) { chrome.runtime.lastError.message === errorInvalidToken) {
var error = chrome.runtime.lastError; var error = chrome.runtime.lastError;
bindingUtil.clearLastError(); bindingUtil.clearLastError();
reject(error); reject(error);
...@@ -65,7 +65,7 @@ $Object.setPrototypeOf(SubtleCryptoImpl.prototype, null); ...@@ -65,7 +65,7 @@ $Object.setPrototypeOf(SubtleCryptoImpl.prototype, null);
SubtleCryptoImpl.prototype.sign = function(algorithm, key, dataView) { SubtleCryptoImpl.prototype.sign = function(algorithm, key, dataView) {
var subtleCrypto = this; var subtleCrypto = this;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (key.type != 'private' || key.usages.indexOf(KeyUsage.sign) == -1) if (key.type !== 'private' || key.usages.indexOf(KeyUsage.sign) === -1)
throw CreateInvalidAccessError(); throw CreateInvalidAccessError();
var normalizedAlgorithmParameters = var normalizedAlgorithmParameters =
...@@ -99,12 +99,12 @@ SubtleCryptoImpl.prototype.sign = function(algorithm, key, dataView) { ...@@ -99,12 +99,12 @@ SubtleCryptoImpl.prototype.sign = function(algorithm, key, dataView) {
SubtleCryptoImpl.prototype.exportKey = function(format, key) { SubtleCryptoImpl.prototype.exportKey = function(format, key) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (format == 'pkcs8') { if (format === 'pkcs8') {
// Either key.type is not 'private' or the key is not extractable. In both // Either key.type is not 'private' or the key is not extractable. In both
// cases the error is the same. // cases the error is the same.
throw CreateInvalidAccessError(); throw CreateInvalidAccessError();
} else if (format == 'spki') { } else if (format === 'spki') {
if (key.type != 'public') if (key.type !== 'public')
throw CreateInvalidAccessError(); throw CreateInvalidAccessError();
resolve(getSpki(key)); resolve(getSpki(key));
} else { } else {
......
...@@ -94,7 +94,7 @@ bindingUtil.registerEventArgumentMassager('syncFileSystem.onFileStatusChanged', ...@@ -94,7 +94,7 @@ bindingUtil.registerEventArgumentMassager('syncFileSystem.onFileStatusChanged',
var fileInfo = new Object(); var fileInfo = new Object();
fileInfo.fileEntry = fileEntry; fileInfo.fileEntry = fileEntry;
fileInfo.status = args[1]; fileInfo.status = args[1];
if (fileInfo.status == "synced") { if (fileInfo.status === 'synced') {
fileInfo.action = args[2]; fileInfo.action = args[2];
fileInfo.direction = args[3]; fileInfo.direction = args[3];
} }
......
...@@ -21,7 +21,7 @@ apiBridge.registerCustomHook(function(bindingsAPI, extensionId) { ...@@ -21,7 +21,7 @@ apiBridge.registerCustomHook(function(bindingsAPI, extensionId) {
// Convenience function for processing webkitGetUserMedia() error objects to // Convenience function for processing webkitGetUserMedia() error objects to
// provide runtime.lastError messages for the tab capture API. // provide runtime.lastError messages for the tab capture API.
function getErrorMessage(error, fallbackMessage) { function getErrorMessage(error, fallbackMessage) {
if (!error || (typeof error.message != 'string')) if (!error || (typeof error.message !== 'string'))
return fallbackMessage; return fallbackMessage;
return error.message.replace(/(navigator\.)?(webkit)?GetUserMedia/gi, return error.message.replace(/(navigator\.)?(webkit)?GetUserMedia/gi,
name); name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment