Skip to content

Commit c76b56d

Browse files
43081jjuangj
authored andcommitted
Closure update to v20170521 (#4325)
* Bump closure compiler to v20170521 * update closure library to v20170521 * use typed tagnames rather than strings * remove use of pathIsModule closure method
1 parent 094fda2 commit c76b56d

File tree

551 files changed

+138921
-33636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

551 files changed

+138921
-33636
lines changed

java/client/test/org/openqa/selenium/environment/webserver/GeneratedJsTestServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
4949
+ " var path = '../../.." + req.getPathInfo() + "';\n"
5050
+ " goog.addDependency(path, ['" + symbol + "'],\n"
5151
+ " goog.dependencies_.requires['../../.." + req.getPathInfo() + "'] || [],\n"
52-
+ " !!goog.dependencies_.pathIsModule[path]);\n"
52+
+ " !!goog.dependencies_.loadFlags[path]);\n"
5353
+ " goog.require('" + symbol + "');\n"
5454
+ " })()\n"
5555
+ "</script></head><body></body></html>").getBytes(Charsets.UTF_8);

javascript/atoms/domcore.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,16 @@ bot.dom.core.getProperty = function(element, propertyName) {
159159
* the given tag name. If the tag name is not provided, returns true if the node
160160
* is an element, regardless of the tag name.h
161161
*
162+
* @template T
162163
* @param {Node} node The node to test.
163-
* @param {string=} opt_tagName Tag name to test the node for.
164+
* @param {(goog.dom.TagName<!T>|string)=} opt_tagName Tag name to test the node for.
164165
* @return {boolean} Whether the node is an element with the given tag name.
165166
*/
166167
bot.dom.core.isElement = function(node, opt_tagName) {
168+
// because we call this with deprecated tags such as SHADOW
169+
if (opt_tagName && (typeof opt_tagName !== 'string')) {
170+
opt_tagName = opt_tagName.toString();
171+
}
167172
return !!node && node.nodeType == goog.dom.NodeType.ELEMENT &&
168173
(!opt_tagName || node.tagName.toUpperCase() == opt_tagName);
169174
};

rake-tasks/crazy_fun/mappings/javascript.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def parse_deps(file)
221221
IO.read(file).each_line do |line|
222222
if data = @@ADD_DEP_REGEX.match(line)
223223
info = Info.new(File.expand_path(data[1], @closure_dir))
224-
info.is_module = data[4] == "true"
224+
info.is_module = (data[4] != "false" and data[4] != "{}")
225225
@@DEPS_FILES[file].push(info)
226226
@@FILES[file] = info
227227

@@ -334,7 +334,7 @@ def resolve_deps(file, symbol, result_list, seen_list)
334334
"\\s*,\\s*",
335335
"\\[([^\\]]+)?\\]", # Required symbols
336336
"\\s*",
337-
"(?:,\\s*(true|false))?", # Module flag.
337+
"(?:,\\s*(true|false|(?:\\{[^\\}]*\\})))?", # Module flag.
338338
"\\s*\\)"
339339
].each {|r| r.to_s}.join('')
340340
@@MODULE_REGEX = /^goog\.module\s*\(\s*['"]([^'"]+)['"]\s*\)/
@@ -570,7 +570,7 @@ def handle(fun, dir, args)
570570
mkdir_p File.dirname(output)
571571

572572
flag_file = File.join(File.dirname(output), "closure_flags.txt")
573-
File.open(flag_file, 'w') {|f| f.write(expanded_flags)}
573+
File.open(flag_file, 'w') {|f| f.write(expanded_flags)}
574574

575575
cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner --flagfile " << flag_file
576576
sh cmd
@@ -865,7 +865,7 @@ def handle(fun, dir, args)
865865
mkdir_p File.dirname(output)
866866

867867
flag_file = File.join(File.dirname(output), "closure_flags.txt")
868-
File.open(flag_file, 'w') {|f| f.write(expanded_flags)}
868+
File.open(flag_file, 'w') {|f| f.write(expanded_flags)}
869869

870870
cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner " <<
871871
"--flagfile " << flag_file

third_party/closure/bin/README.md

Lines changed: 40 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ The [Closure Compiler](https://developers.google.com/closure/compiler/) is a too
99
* [Download a specific version](https://github.com/google/closure-compiler/wiki/Binary-Downloads). Also available via:
1010
- [Maven](https://github.com/google/closure-compiler/wiki/Maven)
1111
- [NPM](https://www.npmjs.com/package/google-closure-compiler)
12+
* [Use the JavaScript version](https://github.com/google/closure-compiler-js), with no Java dependency
1213
* See the [Google Developers Site](https://developers.google.com/closure/compiler/docs/gettingstarted_app) for documentation including instructions for running the compiler from the command line.
1314

1415
## Options for Getting Help
15-
1. Post in the [Closure Compiler Discuss Group](https://groups.google.com/forum/#!forum/closure-compiler-discuss)
16-
2. Ask a question on [Stack Overflow](http://stackoverflow.com/questions/tagged/google-closure-compiler)
17-
3. Consult the [FAQ](https://github.com/google/closure-compiler/wiki/FAQ)
16+
1. Post in the [Closure Compiler Discuss Group](https://groups.google.com/forum/#!forum/closure-compiler-discuss).
17+
2. Ask a question on [Stack Overflow](http://stackoverflow.com/questions/tagged/google-closure-compiler).
18+
3. Consult the [FAQ](https://github.com/google/closure-compiler/wiki/FAQ).
1819

1920
## Building it Yourself
2021

@@ -40,21 +41,29 @@ Note: The Closure Compiler requires [Java 7 or higher](http://www.java.com/).
4041
</profile>
4142
```
4243

43-
3. Run `mvn -DskipTests` (omit the `-DskipTests` if you want to run all the
44+
3. On the command line, at the root of this project, run `mvn -DskipTests` (omit the `-DskipTests` if you want to run all the
4445
unit tests too).
4546

46-
This will produce a jar file called `target/closure-compiler-1.0-SNAPSHOT.jar`.
47+
This will produce a jar file called `target/closure-compiler-1.0-SNAPSHOT.jar`. You can run this jar
48+
as per the [Running section](#running) of this Readme. If you want to depend on the compiler via
49+
Maven in another Java project, use the `com.google.javascript/closure-compiler-unshaded` artifact.
50+
51+
Running `mvn -DskipTests -pl externs/pom.xml,pom-main.xml,pom-main-shaded.xml`
52+
will skip building the GWT version of the compiler. This can speed up the build process significantly.
4753

4854
### Using [Eclipse](http://www.eclipse.org/)
4955

5056
1. Download and open the [Eclipse IDE](http://www.eclipse.org/).
51-
2. Navigate to `File > New > Project ...` and create a Java Project. Give
52-
the project a name.
53-
3. Select `Create project from existing source` and choose the root of the
54-
checked-out source tree as the existing directory.
55-
3. Navigate to the `build.xml` file. You will see all the build rules in
56-
the Outline pane. Run the `jar` rule to build the compiler in
57-
`build/compiler.jar`.
57+
2. On the command line, at the root of this project, run `mvn eclipse:eclipse -DdownloadSources=true` to download JARs and build Eclipse project configuration.
58+
3. Navigate to `File > Import > Maven > Existing Maven Projects` and browse to closure-compiler inside of Eclipse.
59+
4. Import both closure-compiler and the nested externs project.
60+
5. Disregard the warnings about maven-antrun-plugin and build errors.
61+
6. In Package Explorer, remove from the build path:
62+
- `src/com/google/javascript/jscomp/debugger/DebuggerGwtMain.java`
63+
- `src/com/google/javascript/jscomp/gwt/`
64+
7. [Exclude the files](http://stackoverflow.com/questions/1187868/how-can-i-exclude-some-folders-from-my-eclipse-project) in the directory `src/com/google/debugging/sourcemap/super` from the project.
65+
8. Build project in Eclipse (right click on the project `closure-compiler-parent` and select `Build Project`).
66+
9. See *Using Maven* above to build the JAR.
5867

5968
## Running
6069

@@ -88,6 +97,14 @@ java -jar compiler.jar --help
8897
More detailed information about running the Closure Compiler is available in the
8998
[documentation](http://code.google.com/closure/compiler/docs/gettingstarted_app.html).
9099

100+
101+
### Run using Eclipse
102+
103+
1. Open the class `src/com/google/javascript/jscomp/CommandLineRunner.java` or create your own extended version of the class.
104+
2. Run the class in Eclipse.
105+
3. See the instructions above on how to use the interactive mode - but beware of the [bug](http://stackoverflow.com/questions/4711098/passing-end-of-transmission-ctrl-d-character-in-eclipse-cdt-console) regarding passing "End of Transmission" in the Eclipse console.
106+
107+
91108
## Compiling Multiple Scripts
92109

93110
If you have multiple scripts, you should compile them all together with one
@@ -147,7 +164,9 @@ will re-order the inputs automatically.
147164
signed for them.
148165
2. To make sure your changes are of the type that will be accepted, ask about your patch on the [Closure Compiler Discuss Group](https://groups.google.com/forum/#!forum/closure-compiler-discuss)
149166
3. Fork the repository.
150-
4. Make your changes.
167+
4. Make your changes. Check out our
168+
[coding conventions](https://github.com/google/closure-compiler/wiki/Contributors#coding-conventions)
169+
for details on making sure your code is in correct style.
151170
5. Submit a pull request for your changes. A project developer will review your work and then merge your request into the project.
152171

153172
## Closure Compiler License
@@ -210,19 +229,14 @@ system have been added.</td>
210229
### Args4j
211230

212231
<table>
213-
<tr>
214-
<td>Code Path</td>
215-
<td><code>lib/args4j.jar</code></td>
216-
</tr>
217-
218232
<tr>
219233
<td>URL</td>
220234
<td>https://args4j.dev.java.net/</td>
221235
</tr>
222236

223237
<tr>
224238
<td>Version</td>
225-
<td>2.0.26</td>
239+
<td>2.33</td>
226240
</tr>
227241

228242
<tr>
@@ -245,11 +259,6 @@ options/arguments in your CUI application.</td>
245259
### Guava Libraries
246260

247261
<table>
248-
<tr>
249-
<td>Code Path</td>
250-
<td><code>lib/guava.jar</code></td>
251-
</tr>
252-
253262
<tr>
254263
<td>URL</td>
255264
<td>https://github.com/google/guava</td>
@@ -279,19 +288,14 @@ options/arguments in your CUI application.</td>
279288
### JSR 305
280289

281290
<table>
282-
<tr>
283-
<td>Code Path</td>
284-
<td><code>lib/jsr305.jar</code></td>
285-
</tr>
286-
287291
<tr>
288292
<td>URL</td>
289-
<td>http://code.google.com/p/jsr-305/</td>
293+
<td>https://github.com/findbugsproject/findbugs</td>
290294
</tr>
291295

292296
<tr>
293297
<td>Version</td>
294-
<td>svn revision 47</td>
298+
<td>3.0.1</td>
295299
</tr>
296300

297301
<tr>
@@ -313,19 +317,14 @@ options/arguments in your CUI application.</td>
313317
### JUnit
314318

315319
<table>
316-
<tr>
317-
<td>Code Path</td>
318-
<td><code>lib/junit.jar</code></td>
319-
</tr>
320-
321320
<tr>
322321
<td>URL</td>
323322
<td>http://sourceforge.net/projects/junit/</td>
324323
</tr>
325324

326325
<tr>
327326
<td>Version</td>
328-
<td>4.11</td>
327+
<td>4.12</td>
329328
</tr>
330329

331330
<tr>
@@ -347,19 +346,14 @@ options/arguments in your CUI application.</td>
347346
### Protocol Buffers
348347

349348
<table>
350-
<tr>
351-
<td>Code Path</td>
352-
<td><code>lib/protobuf-java.jar</code></td>
353-
</tr>
354-
355349
<tr>
356350
<td>URL</td>
357351
<td>https://github.com/google/protobuf</td>
358352
</tr>
359353

360354
<tr>
361355
<td>Version</td>
362-
<td>2.5.0</td>
356+
<td>3.0.2</td>
363357
</tr>
364358

365359
<tr>
@@ -382,19 +376,14 @@ an encoding of structured data.</td>
382376
### Truth
383377

384378
<table>
385-
<tr>
386-
<td>Code Path</td>
387-
<td><code>lib/truth.jar</code></td>
388-
</tr>
389-
390379
<tr>
391380
<td>URL</td>
392381
<td>https://github.com/google/truth</td>
393382
</tr>
394383

395384
<tr>
396385
<td>Version</td>
397-
<td>0.24</td>
386+
<td>0.32</td>
398387
</tr>
399388

400389
<tr>
@@ -416,21 +405,14 @@ an encoding of structured data.</td>
416405
### Ant
417406

418407
<table>
419-
<tr>
420-
<td>Code Path</td>
421-
<td>
422-
<code>lib/ant.jar</code>, <code>lib/ant-launcher.jar</code>
423-
</td>
424-
</tr>
425-
426408
<tr>
427409
<td>URL</td>
428410
<td>http://ant.apache.org/bindownload.cgi</td>
429411
</tr>
430412

431413
<tr>
432414
<td>Version</td>
433-
<td>1.8.1</td>
415+
<td>1.9.7</td>
434416
</tr>
435417

436418
<tr>
@@ -453,19 +435,14 @@ without make's wrinkles and with the full portability of pure java code.</td>
453435
### GSON
454436

455437
<table>
456-
<tr>
457-
<td>Code Path</td>
458-
<td><code>lib/gson.jar</code></td>
459-
</tr>
460-
461438
<tr>
462439
<td>URL</td>
463440
<td>https://github.com/google/gson</td>
464441
</tr>
465442

466443
<tr>
467444
<td>Version</td>
468-
<td>2.2.4</td>
445+
<td>2.7</td>
469446
</tr>
470447

471448
<tr>
788 KB
Binary file not shown.

third_party/closure/goog/a11y/aria/aria.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ goog.a11y.aria.ROLE_ATTRIBUTE_ = 'role';
5454
* they don't contain content to be made accessible.
5555
* @private
5656
*/
57-
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [
57+
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = goog.object.createSet([
5858
goog.dom.TagName.A, goog.dom.TagName.AREA, goog.dom.TagName.BUTTON,
5959
goog.dom.TagName.HEAD, goog.dom.TagName.INPUT, goog.dom.TagName.LINK,
6060
goog.dom.TagName.MENU, goog.dom.TagName.META, goog.dom.TagName.OPTGROUP,
6161
goog.dom.TagName.OPTION, goog.dom.TagName.PROGRESS, goog.dom.TagName.STYLE,
6262
goog.dom.TagName.SELECT, goog.dom.TagName.SOURCE, goog.dom.TagName.TEXTAREA,
6363
goog.dom.TagName.TITLE, goog.dom.TagName.TRACK
64-
];
64+
]);
6565

6666

6767
/**
@@ -70,7 +70,7 @@ goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [
7070
* to manage their active descendants or children. See
7171
* {@link http://www.w3.org/TR/wai-aria/states_and_properties
7272
* #aria-activedescendant} for more information.
73-
* @private @const
73+
* @private @const {!Array<goog.a11y.aria.Role>}
7474
*/
7575
goog.a11y.aria.CONTAINER_ROLES_ = [
7676
goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.Role.GRID,
@@ -113,7 +113,7 @@ goog.a11y.aria.setRole = function(element, roleName) {
113113
/**
114114
* Gets role of an element.
115115
* @param {!Element} element DOM element to get role of.
116-
* @return {goog.a11y.aria.Role} ARIA Role name.
116+
* @return {?goog.a11y.aria.Role} ARIA Role name.
117117
*/
118118
goog.a11y.aria.getRole = function(element) {
119119
var role = element.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
@@ -275,12 +275,11 @@ goog.a11y.aria.setLabel = function(element, label) {
275275
* semantics is well supported by most screen readers.
276276
* Only to be used internally by the ARIA library in goog.a11y.aria.*.
277277
* @param {!Element} element The element to assert an ARIA role set.
278-
* @param {!goog.array.ArrayLike<string>} allowedRoles The child roles of
278+
* @param {!IArrayLike<string>} allowedRoles The child roles of
279279
* the roles.
280280
*/
281281
goog.a11y.aria.assertRoleIsSetInternalUtil = function(element, allowedRoles) {
282-
if (goog.array.contains(
283-
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_, element.tagName)) {
282+
if (goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[element.tagName]) {
284283
return;
285284
}
286285
var elementRole = /** @type {string}*/ (goog.a11y.aria.getRole(element));
@@ -359,7 +358,7 @@ goog.a11y.aria.getStateString = function(element, stateName) {
359358
* Only to be used internally by the ARIA library in goog.a11y.aria.*.
360359
* @param {!Element} element DOM node to get state from.
361360
* @param {!goog.a11y.aria.State} stateName State name.
362-
* @return {!goog.array.ArrayLike<string>} string Array
361+
* @return {!IArrayLike<string>} string Array
363362
* value of the state attribute.
364363
*/
365364
goog.a11y.aria.getStringArrayStateInternalUtil = function(element, stateName) {
@@ -398,7 +397,7 @@ goog.a11y.aria.isContainerRole = function(element) {
398397
/**
399398
* Splits the input stringValue on whitespace.
400399
* @param {string} stringValue The value of the string to split.
401-
* @return {!goog.array.ArrayLike<string>} string Array
400+
* @return {!IArrayLike<string>} string Array
402401
* value as result of the split.
403402
* @private
404403
*/

0 commit comments

Comments
 (0)