Commit 409c59fe authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Avoid "duplicate FILE_MANAGER_HOST" warnings

Also fix a "missing semicolon" JS presubmit failure.

Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Ib607e0e25c74ff85cc9d5ba2f23c596e0f509723
Reviewed-on: https://chromium-review.googlesource.com/1100660
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Reviewed-by: default avatarSasha Morrissey <sashab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568667}
parent 3fab2ea2
...@@ -4,13 +4,21 @@ ...@@ -4,13 +4,21 @@
/** /**
* Protocol + host parts of extension URL. * Protocol + host parts of extension URL.
*
* The __FILE_NAME suffix is because the same string constant is used in
* multiple JS files, and JavaScript doesn't have C's #define mechanism (which
* only affects the file its in). Without the suffix, we'd have "constant
* FILE_MANAGER_HOST assigned a value more than once" compiler warnings.
*
* @type {string} * @type {string}
* @const * @const
*/ */
var FILE_MANAGER_HOST = 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj'; var FILE_MANAGER_HOST__EXIF_PARSER =
'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj';
importScripts( importScripts(
FILE_MANAGER_HOST + '/foreground/js/metadata/exif_constants.js'); FILE_MANAGER_HOST__EXIF_PARSER +
'/foreground/js/metadata/exif_constants.js');
function ExifParser(parent) { function ExifParser(parent) {
ImageParser.call(this, parent, 'jpeg', /\.jpe?g$/i); ImageParser.call(this, parent, 'jpeg', /\.jpe?g$/i);
...@@ -311,8 +319,9 @@ ExifParser.prototype.readTagValue = function(br, tag) { ...@@ -311,8 +319,9 @@ ExifParser.prototype.readTagValue = function(br, tag) {
* @param {boolean=} opt_signed * @param {boolean=} opt_signed
*/ */
function unsafeRead(size, opt_readFunction, opt_signed) { function unsafeRead(size, opt_readFunction, opt_signed) {
var readFunction = opt_readFunction || var readFunction = opt_readFunction || function(size) {
function(size) { return br.readScalar(size, opt_signed) }; return br.readScalar(size, opt_signed);
};
var totalSize = tag.componentCount * size; var totalSize = tag.componentCount * size;
if (totalSize < 1) { if (totalSize < 1) {
......
...@@ -4,15 +4,24 @@ ...@@ -4,15 +4,24 @@
/** /**
* Protocol + host parts of extension URL. * Protocol + host parts of extension URL.
*
* The __FILE_NAME suffix is because the same string constant is used in
* multiple JS files, and JavaScript doesn't have C's #define mechanism (which
* only affects the file its in). Without the suffix, we'd have "constant
* FILE_MANAGER_HOST assigned a value more than once" compiler warnings.
*
* @type {string} * @type {string}
* @const * @const
*/ */
var FILE_MANAGER_HOST = 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj'; var FILE_MANAGER_HOST__ID3_PARSER =
'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj';
importScripts( importScripts(
FILE_MANAGER_HOST + '/foreground/js/metadata/function_sequence.js'); FILE_MANAGER_HOST__ID3_PARSER +
'/foreground/js/metadata/function_sequence.js');
importScripts( importScripts(
FILE_MANAGER_HOST + '/foreground/js/metadata/function_parallel.js'); FILE_MANAGER_HOST__ID3_PARSER +
'/foreground/js/metadata/function_parallel.js');
/** /**
* ID3 parser. * ID3 parser.
......
...@@ -4,16 +4,27 @@ ...@@ -4,16 +4,27 @@
/** /**
* Protocol + host parts of extension URL. * Protocol + host parts of extension URL.
*
* The __FILE_NAME suffix is because the same string constant is used in
* multiple JS files, and JavaScript doesn't have C's #define mechanism (which
* only affects the file its in). Without the suffix, we'd have "constant
* FILE_MANAGER_HOST assigned a value more than once" compiler warnings.
*
* @type {string} * @type {string}
* @const * @const
*/ */
var FILE_MANAGER_HOST = 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj'; var FILE_MANAGER_HOST__METADATA_DISPATCHER =
'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj';
// All of these scripts could be imported with a single call to importScripts, // All of these scripts could be imported with a single call to importScripts,
// but then load and compile time errors would all be reported from the same // but then load and compile time errors would all be reported from the same
// line. // line.
importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/metadata_parser.js'); importScripts(
importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/byte_reader.js'); FILE_MANAGER_HOST__METADATA_DISPATCHER +
'/foreground/js/metadata/metadata_parser.js');
importScripts(
FILE_MANAGER_HOST__METADATA_DISPATCHER +
'/foreground/js/metadata/byte_reader.js');
/** /**
* Dispatches metadata requests to the correct parser. * Dispatches metadata requests to the correct parser.
...@@ -29,10 +40,18 @@ function MetadataDispatcher(port) { ...@@ -29,10 +40,18 @@ function MetadataDispatcher(port) {
// Make sure to update component_extension_resources.grd // Make sure to update component_extension_resources.grd
// when adding new parsers. // when adding new parsers.
importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/exif_parser.js'); importScripts(
importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/image_parsers.js'); FILE_MANAGER_HOST__METADATA_DISPATCHER +
importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/mpeg_parser.js'); '/foreground/js/metadata/exif_parser.js');
importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/id3_parser.js'); importScripts(
FILE_MANAGER_HOST__METADATA_DISPATCHER +
'/foreground/js/metadata/image_parsers.js');
importScripts(
FILE_MANAGER_HOST__METADATA_DISPATCHER +
'/foreground/js/metadata/mpeg_parser.js');
importScripts(
FILE_MANAGER_HOST__METADATA_DISPATCHER +
'/foreground/js/metadata/id3_parser.js');
var patterns = []; var patterns = [];
......
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