Skip to content

Commit

Permalink
Closure update to v20170521 (SeleniumHQ#4325)
Browse files Browse the repository at this point in the history
* Bump closure compiler to v20170521

* update closure library to v20170521

* use typed tagnames rather than strings

* remove use of pathIsModule closure method
  • Loading branch information
43081j authored and juangj committed Jul 19, 2017
1 parent 094fda2 commit c76b56d
Show file tree
Hide file tree
Showing 551 changed files with 138,921 additions and 33,636 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ " var path = '../../.." + req.getPathInfo() + "';\n"
+ " goog.addDependency(path, ['" + symbol + "'],\n"
+ " goog.dependencies_.requires['../../.." + req.getPathInfo() + "'] || [],\n"
+ " !!goog.dependencies_.pathIsModule[path]);\n"
+ " !!goog.dependencies_.loadFlags[path]);\n"
+ " goog.require('" + symbol + "');\n"
+ " })()\n"
+ "</script></head><body></body></html>").getBytes(Charsets.UTF_8);
Expand Down
7 changes: 6 additions & 1 deletion javascript/atoms/domcore.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,16 @@ bot.dom.core.getProperty = function(element, propertyName) {
* the given tag name. If the tag name is not provided, returns true if the node
* is an element, regardless of the tag name.h
*
* @template T
* @param {Node} node The node to test.
* @param {string=} opt_tagName Tag name to test the node for.
* @param {(goog.dom.TagName<!T>|string)=} opt_tagName Tag name to test the node for.
* @return {boolean} Whether the node is an element with the given tag name.
*/
bot.dom.core.isElement = function(node, opt_tagName) {
// because we call this with deprecated tags such as SHADOW
if (opt_tagName && (typeof opt_tagName !== 'string')) {
opt_tagName = opt_tagName.toString();
}
return !!node && node.nodeType == goog.dom.NodeType.ELEMENT &&
(!opt_tagName || node.tagName.toUpperCase() == opt_tagName);
};
Expand Down
8 changes: 4 additions & 4 deletions rake-tasks/crazy_fun/mappings/javascript.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def parse_deps(file)
IO.read(file).each_line do |line|
if data = @@ADD_DEP_REGEX.match(line)
info = Info.new(File.expand_path(data[1], @closure_dir))
info.is_module = data[4] == "true"
info.is_module = (data[4] != "false" and data[4] != "{}")
@@DEPS_FILES[file].push(info)
@@FILES[file] = info

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

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

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

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

cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner " <<
"--flagfile " << flag_file
Expand Down
103 changes: 40 additions & 63 deletions third_party/closure/bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ The [Closure Compiler](https://developers.google.com/closure/compiler/) is a too
* [Download a specific version](https://github.com/google/closure-compiler/wiki/Binary-Downloads). Also available via:
- [Maven](https://github.com/google/closure-compiler/wiki/Maven)
- [NPM](https://www.npmjs.com/package/google-closure-compiler)
* [Use the JavaScript version](https://github.com/google/closure-compiler-js), with no Java dependency
* 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.

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

## Building it Yourself

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

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

This will produce a jar file called `target/closure-compiler-1.0-SNAPSHOT.jar`.
This will produce a jar file called `target/closure-compiler-1.0-SNAPSHOT.jar`. You can run this jar
as per the [Running section](#running) of this Readme. If you want to depend on the compiler via
Maven in another Java project, use the `com.google.javascript/closure-compiler-unshaded` artifact.

Running `mvn -DskipTests -pl externs/pom.xml,pom-main.xml,pom-main-shaded.xml`
will skip building the GWT version of the compiler. This can speed up the build process significantly.

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

1. Download and open the [Eclipse IDE](http://www.eclipse.org/).
2. Navigate to `File > New > Project ...` and create a Java Project. Give
the project a name.
3. Select `Create project from existing source` and choose the root of the
checked-out source tree as the existing directory.
3. Navigate to the `build.xml` file. You will see all the build rules in
the Outline pane. Run the `jar` rule to build the compiler in
`build/compiler.jar`.
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.
3. Navigate to `File > Import > Maven > Existing Maven Projects` and browse to closure-compiler inside of Eclipse.
4. Import both closure-compiler and the nested externs project.
5. Disregard the warnings about maven-antrun-plugin and build errors.
6. In Package Explorer, remove from the build path:
- `src/com/google/javascript/jscomp/debugger/DebuggerGwtMain.java`
- `src/com/google/javascript/jscomp/gwt/`
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.
8. Build project in Eclipse (right click on the project `closure-compiler-parent` and select `Build Project`).
9. See *Using Maven* above to build the JAR.

## Running

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


### Run using Eclipse

1. Open the class `src/com/google/javascript/jscomp/CommandLineRunner.java` or create your own extended version of the class.
2. Run the class in Eclipse.
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.


## Compiling Multiple Scripts

If you have multiple scripts, you should compile them all together with one
Expand Down Expand Up @@ -147,7 +164,9 @@ will re-order the inputs automatically.
signed for them.
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)
3. Fork the repository.
4. Make your changes.
4. Make your changes. Check out our
[coding conventions](https://github.com/google/closure-compiler/wiki/Contributors#coding-conventions)
for details on making sure your code is in correct style.
5. Submit a pull request for your changes. A project developer will review your work and then merge your request into the project.

## Closure Compiler License
Expand Down Expand Up @@ -210,19 +229,14 @@ system have been added.</td>
### Args4j

<table>
<tr>
<td>Code Path</td>
<td><code>lib/args4j.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>https://args4j.dev.java.net/</td>
</tr>

<tr>
<td>Version</td>
<td>2.0.26</td>
<td>2.33</td>
</tr>

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

<table>
<tr>
<td>Code Path</td>
<td><code>lib/guava.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>https://github.com/google/guava</td>
Expand Down Expand Up @@ -279,19 +288,14 @@ options/arguments in your CUI application.</td>
### JSR 305

<table>
<tr>
<td>Code Path</td>
<td><code>lib/jsr305.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>http://code.google.com/p/jsr-305/</td>
<td>https://github.com/findbugsproject/findbugs</td>
</tr>

<tr>
<td>Version</td>
<td>svn revision 47</td>
<td>3.0.1</td>
</tr>

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

<table>
<tr>
<td>Code Path</td>
<td><code>lib/junit.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>http://sourceforge.net/projects/junit/</td>
</tr>

<tr>
<td>Version</td>
<td>4.11</td>
<td>4.12</td>
</tr>

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

<table>
<tr>
<td>Code Path</td>
<td><code>lib/protobuf-java.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>https://github.com/google/protobuf</td>
</tr>

<tr>
<td>Version</td>
<td>2.5.0</td>
<td>3.0.2</td>
</tr>

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

<table>
<tr>
<td>Code Path</td>
<td><code>lib/truth.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>https://github.com/google/truth</td>
</tr>

<tr>
<td>Version</td>
<td>0.24</td>
<td>0.32</td>
</tr>

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

<table>
<tr>
<td>Code Path</td>
<td>
<code>lib/ant.jar</code>, <code>lib/ant-launcher.jar</code>
</td>
</tr>

<tr>
<td>URL</td>
<td>http://ant.apache.org/bindownload.cgi</td>
</tr>

<tr>
<td>Version</td>
<td>1.8.1</td>
<td>1.9.7</td>
</tr>

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

<table>
<tr>
<td>Code Path</td>
<td><code>lib/gson.jar</code></td>
</tr>

<tr>
<td>URL</td>
<td>https://github.com/google/gson</td>
</tr>

<tr>
<td>Version</td>
<td>2.2.4</td>
<td>2.7</td>
</tr>

<tr>
Expand Down
Binary file modified third_party/closure/bin/compiler.jar
Binary file not shown.
17 changes: 8 additions & 9 deletions third_party/closure/goog/a11y/aria/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ goog.a11y.aria.ROLE_ATTRIBUTE_ = 'role';
* they don't contain content to be made accessible.
* @private
*/
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = goog.object.createSet([
goog.dom.TagName.A, goog.dom.TagName.AREA, goog.dom.TagName.BUTTON,
goog.dom.TagName.HEAD, goog.dom.TagName.INPUT, goog.dom.TagName.LINK,
goog.dom.TagName.MENU, goog.dom.TagName.META, goog.dom.TagName.OPTGROUP,
goog.dom.TagName.OPTION, goog.dom.TagName.PROGRESS, goog.dom.TagName.STYLE,
goog.dom.TagName.SELECT, goog.dom.TagName.SOURCE, goog.dom.TagName.TEXTAREA,
goog.dom.TagName.TITLE, goog.dom.TagName.TRACK
];
]);


/**
Expand All @@ -70,7 +70,7 @@ goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [
* to manage their active descendants or children. See
* {@link http://www.w3.org/TR/wai-aria/states_and_properties
* #aria-activedescendant} for more information.
* @private @const
* @private @const {!Array<goog.a11y.aria.Role>}
*/
goog.a11y.aria.CONTAINER_ROLES_ = [
goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.Role.GRID,
Expand Down Expand Up @@ -113,7 +113,7 @@ goog.a11y.aria.setRole = function(element, roleName) {
/**
* Gets role of an element.
* @param {!Element} element DOM element to get role of.
* @return {goog.a11y.aria.Role} ARIA Role name.
* @return {?goog.a11y.aria.Role} ARIA Role name.
*/
goog.a11y.aria.getRole = function(element) {
var role = element.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
Expand Down Expand Up @@ -275,12 +275,11 @@ goog.a11y.aria.setLabel = function(element, label) {
* semantics is well supported by most screen readers.
* Only to be used internally by the ARIA library in goog.a11y.aria.*.
* @param {!Element} element The element to assert an ARIA role set.
* @param {!goog.array.ArrayLike<string>} allowedRoles The child roles of
* @param {!IArrayLike<string>} allowedRoles The child roles of
* the roles.
*/
goog.a11y.aria.assertRoleIsSetInternalUtil = function(element, allowedRoles) {
if (goog.array.contains(
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_, element.tagName)) {
if (goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[element.tagName]) {
return;
}
var elementRole = /** @type {string}*/ (goog.a11y.aria.getRole(element));
Expand Down Expand Up @@ -359,7 +358,7 @@ goog.a11y.aria.getStateString = function(element, stateName) {
* Only to be used internally by the ARIA library in goog.a11y.aria.*.
* @param {!Element} element DOM node to get state from.
* @param {!goog.a11y.aria.State} stateName State name.
* @return {!goog.array.ArrayLike<string>} string Array
* @return {!IArrayLike<string>} string Array
* value of the state attribute.
*/
goog.a11y.aria.getStringArrayStateInternalUtil = function(element, stateName) {
Expand Down Expand Up @@ -398,7 +397,7 @@ goog.a11y.aria.isContainerRole = function(element) {
/**
* Splits the input stringValue on whitespace.
* @param {string} stringValue The value of the string to split.
* @return {!goog.array.ArrayLike<string>} string Array
* @return {!IArrayLike<string>} string Array
* value as result of the split.
* @private
*/
Expand Down
Loading

0 comments on commit c76b56d

Please sign in to comment.