Skip to content

Commit 4ac9d43

Browse files
committed
Merge pull request #899 from vandenoever/closure20150505
Upgrade to Closure Compile 2015-05-05
2 parents 5d7858f + 3d0a011 commit 4ac9d43

38 files changed

Lines changed: 19420 additions & 86 deletions

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ MESSAGE ( STATUS "external downloads will be stored/expected in: ${EXTERNALS_DOW
9696
ExternalProject_Add(
9797
ClosureCompiler
9898
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
99-
URL "http://dl.google.com/closure-compiler/compiler-20130823.tar.gz"
100-
URL_MD5 105db24c4676e23f2495adfdea3159bc
99+
URL "http://dl.google.com/closure-compiler/compiler-20150505.tar.gz"
100+
URL_MD5 dea8e282c316316daeb39fcd5708d369
101101
CONFIGURE_COMMAND ""
102102
BUILD_COMMAND ""
103103
INSTALL_COMMAND ""

programs/benchmark/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add_custom_command(
2525
--transform_amd_modules
2626
--process_common_js_modules
2727
--common_js_entry_module HTMLBenchmark.js
28-
--common_js_module_path_prefix ${CMAKE_CURRENT_SOURCE_DIR}/js
28+
--common_js_module_path_prefix ${CMAKE_CURRENT_SOURCE_DIR}/js/
2929
--compilation_level SIMPLE_OPTIMIZATIONS
3030
--formatting PRETTY_PRINT
3131
--js_output_file "benchmark.js-"
@@ -35,4 +35,4 @@ add_custom_command(
3535
DEPENDS ClosureCompiler webodf.js-target
3636
)
3737

38-
add_custom_target(html-benchmark DEPENDS benchmark.js-target ${BENCHMARK_HTML})
38+
add_custom_target(html-benchmark DEPENDS benchmark.js-target ${BENCHMARK_HTML})

programs/benchmark/js/HTMLBenchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ define([
7272

7373
/**
7474
* Extract supported benchmark options from the url query parameters
75-
* @return {!{fileUrl: !string, includeSlow: !boolean, colour: string|undefined}}
75+
* @return {!{fileUrl: !string, includeSlow: !boolean, colour: (string|undefined)}}
7676
*/
7777
function getConfiguration() {
7878
var params = getQueryParams();

webodf/CMakeLists.txt

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,33 @@ include(${CMAKE_BINARY_DIR}/jsfileslist.txt)
1313

1414
configure_file(webodfversion.js.in ${CMAKE_CURRENT_BINARY_DIR}/webodfversion.js)
1515

16+
set(EXTERNS_LIST
17+
"--use_only_custom_externs"
18+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/es3.js"
19+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/es5.js"
20+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/es6.js"
21+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_dom1.js"
22+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_dom2.js"
23+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_dom3.js"
24+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_elementtraversal.js"
25+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_anim_timing.js"
26+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_range.js"
27+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_xml.js"
28+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_css.js"
29+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_event.js"
30+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/window.js"
31+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/gecko_xml.js"
32+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/gecko_dom.js"
33+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/ie_dom.js"
34+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/gecko_event.js"
35+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/ie_event.js"
36+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/html5.js"
37+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/iphone.js"
38+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/fileapi.js"
39+
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js"
40+
)
41+
string(REPLACE ";" " " EXTERNS "${EXTERNS_LIST}")
42+
1643
set(TESTJSFILES
1744
tests/core/UnitTester.js
1845
tests/core/ZipTests.js
@@ -73,7 +100,47 @@ add_custom_target(webodf.css.js-target DEPENDS webodf.css.js)
73100

74101
# Windows has a command-line limit of around 8,000 chars, so files to be compiled are supplied to CC using the --flagfile
75102
# option to help keep the length of the compilation command as small as possible.
76-
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/cc-noTestFiles.txt "--warning_level VERBOSE --jscomp_error accessControls --jscomp_error ambiguousFunctionDecl --jscomp_error checkEventfulObjectDisposal --jscomp_error checkRegExp --jscomp_error checkStructDictInheritance --jscomp_error checkTypes --jscomp_error checkVars --jscomp_error const --jscomp_error constantProperty --jscomp_error deprecated --jscomp_error duplicateMessage --jscomp_error es3 --jscomp_error es5Strict --jscomp_error externsValidation --jscomp_error fileoverviewTags --jscomp_error globalThis --jscomp_error invalidCasts --jscomp_error misplacedTypeAnnotation --jscomp_error missingProperties --jscomp_error missingProvide --jscomp_error missingRequire --jscomp_error missingReturn --jscomp_off nonStandardJsDocs --jscomp_error suspiciousCode --jscomp_error strictModuleDepCheck --jscomp_error typeInvalidation --jscomp_error undefinedNames --jscomp_error undefinedVars --jscomp_error unknownDefines --jscomp_error uselessCode --jscomp_error visibility --summary_detail_level 3")
103+
SET(CLOSURE_ERROR_OPTION_LIST
104+
"--jscomp_error accessControls"
105+
"--jscomp_error ambiguousFunctionDecl"
106+
"--jscomp_error checkEventfulObjectDisposal"
107+
"--jscomp_error checkRegExp"
108+
"--jscomp_error checkStructDictInheritance"
109+
"--jscomp_error checkTypes"
110+
"--jscomp_error checkVars"
111+
# "--jscomp error conformanceViolations"
112+
"--jscomp_error const"
113+
"--jscomp_error constantProperty"
114+
"--jscomp_error deprecated"
115+
"--jscomp_error deprecatedAnnotations"
116+
"--jscomp_error duplicateMessage"
117+
"--jscomp_error es3"
118+
"--jscomp_error es5Strict"
119+
"--jscomp_error externsValidation"
120+
"--jscomp_error fileoverviewTags"
121+
"--jscomp_error globalThis"
122+
"--jscomp_error inferredConstCheck"
123+
"--jscomp_error invalidCasts"
124+
"--jscomp_error misplacedTypeAnnotation"
125+
"--jscomp_error missingGetCssName"
126+
"--jscomp_error missingProperties"
127+
"--jscomp_error missingProvide"
128+
"--jscomp_off missingRequire"
129+
"--jscomp_error missingReturn"
130+
# "--jscomp_error newCheckTypes"
131+
"--jscomp_off nonStandardJsDocs"
132+
"--jscomp_error suspiciousCode"
133+
"--jscomp_error strictModuleDepCheck"
134+
"--jscomp_error typeInvalidation"
135+
"--jscomp_error undefinedNames"
136+
"--jscomp_error undefinedVars"
137+
"--jscomp_error unknownDefines"
138+
"--jscomp_error uselessCode"
139+
"--jscomp_error useOfGoogBase"
140+
"--jscomp_error visibility")
141+
string(REPLACE ";" " " CLOSURE_ERROR_OPTIONS "${CLOSURE_ERROR_OPTION_LIST}")
142+
143+
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/cc-noTestFiles.txt "--warning_level VERBOSE ${CLOSURE_ERROR_OPTIONS} --summary_detail_level 3 ${EXTERNS}")
77144

78145
file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/cc-noTestFiles.txt " --js ${HEADERCOMPILED_FILE}")
79146

@@ -133,7 +200,6 @@ add_custom_command(
133200
--define IS_COMPILED_CODE=true
134201
--compilation_level ADVANCED_OPTIMIZATIONS
135202
--formatting PRETTY_PRINT
136-
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
137203
--js_output_file compiled.js-
138204
COMMAND ${CMAKE_COMMAND} ARGS -E rename compiled.js- compiled.js
139205
DEPENDS ClosureCompiler ${LIBJSFILES} ${TESTJSFILES} tools/externs.js
@@ -149,7 +215,6 @@ add_custom_command(
149215
--jscomp_error reportUnknownTypes
150216
--define IS_COMPILED_CODE=true
151217
--compilation_level SIMPLE_OPTIMIZATIONS
152-
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
153218
--js_output_file webodf.js-
154219
COMMAND ${CMAKE_COMMAND} ARGS -E rename webodf.js- webodf.js
155220
DEPENDS ClosureCompiler ${LIBJSFILES} tools/externs.js
@@ -166,7 +231,6 @@ add_custom_command(
166231
--define IS_COMPILED_CODE=true
167232
--compilation_level WHITESPACE_ONLY
168233
--formatting PRETTY_PRINT
169-
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
170234
--js_output_file webodf-debug.js-
171235
# in WHITESPACE_ONLY mode, it is not possible to define IS_COMPILED_CODE
172236
# so the value for IS_COMPILED_CODE is set by find and replace in the code

webodf/lib/core/NodeFilterChain.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/**
2828
* @constructor
29-
* @extends NodeFilter
29+
* @implements NodeFilter
3030
* @param {!Array.<!NodeFilter>} filters
3131
*/
3232
core.NodeFilterChain = function (filters) {
@@ -47,4 +47,4 @@ core.NodeFilterChain = function (filters) {
4747
}
4848
return FILTER_ACCEPT;
4949
};
50-
};
50+
};

webodf/lib/core/PositionIterator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ core.PositionIterator = function PositionIterator(root, whatToShow, filter,
8787
* Empty text nodes are not considered to be a valid position for the
8888
* positioniterator. They should be filtered out in all cases.
8989
* @constructor
90-
* @extends NodeFilter
90+
* @implements NodeFilter
9191
*/
9292
function EmptyTextNodeFilter() {
9393
/**
@@ -104,7 +104,7 @@ core.PositionIterator = function PositionIterator(root, whatToShow, filter,
104104
}
105105
/**
106106
* @constructor
107-
* @extends NodeFilter
107+
* @implements NodeFilter
108108
* @param {!NodeFilter} filter
109109
*/
110110
function FilteredEmptyTextNodeFilter(filter) {

webodf/lib/gui/BlacklistNamespaceNodeFilter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/**
2828
* @constructor
29-
* @extends NodeFilter
29+
* @implements NodeFilter
3030
* @param {!Array.<!string>} excludedNamespaces
3131
*/
3232
gui.BlacklistNamespaceNodeFilter = function (excludedNamespaces) {
@@ -53,4 +53,4 @@ gui.BlacklistNamespaceNodeFilter = function (excludedNamespaces) {
5353
});
5454
}
5555
init();
56-
};
56+
};

webodf/lib/gui/DirectFormattingController.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,14 @@ gui.DirectFormattingController = function DirectFormattingController(
853853
function emptyFunction() {
854854
}
855855
/*jslint emptyblock: false*/
856+
857+
/**
858+
* @return {!boolean}
859+
*/
860+
function emptyBoolFunction () {
861+
return false;
862+
}
863+
856864
/**
857865
* @return {!boolean}
858866
*/
@@ -897,13 +905,13 @@ gui.DirectFormattingController = function DirectFormattingController(
897905
}
898906

899907
if (!directParagraphStylingEnabled) {
900-
self.alignParagraphCenter = emptyFunction;
901-
self.alignParagraphJustified = emptyFunction;
902-
self.alignParagraphLeft = emptyFunction;
903-
self.alignParagraphRight = emptyFunction;
908+
self.alignParagraphCenter = emptyBoolFunction;
909+
self.alignParagraphJustified = emptyBoolFunction;
910+
self.alignParagraphLeft = emptyBoolFunction;
911+
self.alignParagraphRight = emptyBoolFunction;
904912
self.createParagraphStyleOps = function () { return []; };
905-
self.indent = emptyFunction;
906-
self.outdent = emptyFunction;
913+
self.indent = emptyBoolFunction;
914+
self.outdent = emptyBoolFunction;
907915
}
908916
}
909917

webodf/lib/gui/OdfTextBodyNodeFilter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* - Any node within a text:tracked-changes block
3131
*
3232
* @constructor
33-
* @extends NodeFilter
33+
* @implements NodeFilter
3434
*/
3535
gui.OdfTextBodyNodeFilter = function () {
3636
"use strict";
@@ -54,4 +54,4 @@ gui.OdfTextBodyNodeFilter = function () {
5454
}
5555
return FILTER_ACCEPT;
5656
};
57-
};
57+
};

webodf/lib/gui/SessionController.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ gui.SessionControllerOptions = function () {
436436

437437
/**
438438
* Return the number of mouse clicks if the mouse event is for the primary button. Otherwise return 0.
439-
* @param {!Event} event
439+
* @param {!UIEvent} event
440440
* @return {!number}
441441
*/
442442
function computeClickCount(event) {
@@ -450,7 +450,7 @@ gui.SessionControllerOptions = function () {
450450
* This is necessary because the mouse-up binding needs to be global in order to handle mouse-up
451451
* events that occur when the user releases the mouse button outside the canvas.
452452
* This filter limits selection changes to mouse down events that start inside the canvas
453-
* @param {!Event} e
453+
* @param {!UIEvent} e
454454
*/
455455
function handleMouseDown(e) {
456456
var target = getTarget(e),
@@ -515,7 +515,7 @@ gui.SessionControllerOptions = function () {
515515
/**
516516
* Causes a cursor movement to the position hinted by a mouse click
517517
* event.
518-
* @param {!Event} event
518+
* @param {!UIEvent} event
519519
* @return {undefined}
520520
*/
521521
function moveByMouseClickEvent(event) {
@@ -617,7 +617,7 @@ gui.SessionControllerOptions = function () {
617617
}
618618

619619
/**
620-
* @param {!Event} event
620+
* @param {!UIEvent} event
621621
* @return {undefined}
622622
*/
623623
function handleMouseClickEvent(event) {
@@ -678,7 +678,7 @@ gui.SessionControllerOptions = function () {
678678
// TODO: IE10 on a test machine does not have the "detail" property set on "mouseup" events here,
679679
// even if the docs claim it should exist, cmp. http://msdn.microsoft.com/en-au/library/ie/ff974344(v=vs.85).aspx
680680
// So doubleclicks will not be detected on (some?) IE currently.
681-
clickEvent = domUtils.cloneEvent(event);
681+
clickEvent = /**@type{!UIEvent}*/(domUtils.cloneEvent(event));
682682
handleMouseClickTimeoutId = runtime.setTimeout(function () {
683683
moveByMouseClickEvent(clickEvent);
684684
}, 0);
@@ -718,7 +718,7 @@ gui.SessionControllerOptions = function () {
718718
}
719719

720720
/**
721-
* @param {!Event} e
721+
* @param {!UIEvent} e
722722
*/
723723
function handleContextMenu(e) {
724724
// TODO Various browsers have different default behaviours on right click
@@ -731,7 +731,7 @@ gui.SessionControllerOptions = function () {
731731
}
732732

733733
/**
734-
* @param {!Event} event
734+
* @param {!UIEvent} event
735735
*/
736736
function handleMouseUp(event) {
737737
var target = /**@type{!Element}*/(getTarget(event)),
@@ -790,15 +790,16 @@ gui.SessionControllerOptions = function () {
790790
function rangeSelectionOnly(fn) {
791791
/**
792792
* @param {*} e
793-
* return {function(*):(boolean|undefined)
793+
* @return {!boolean|undefined}
794794
*/
795-
return function (e) {
795+
function f(e) {
796796
var selectionType = odtDocument.getCursor(inputMemberId).getSelectionType();
797797
if (selectionType === ops.OdtCursor.RangeSelection) {
798798
return fn(e);
799799
}
800800
return true;
801-
};
801+
}
802+
return f;
802803
}
803804

804805
/**

0 commit comments

Comments
 (0)