From f16e19d9b743bf326255e5cb65b32e2ae3e08437 Mon Sep 17 00:00:00 2001 From: Simon Mavi Stewart Date: Tue, 16 Dec 2025 15:00:37 +0000 Subject: [PATCH 1/3] [bazel+closure]: Vendor the version of closure library we use We used to have a version of Google Closure Library tucked away in `//third_party/closure/goog` We never really updated it, because we switched to using `rules_closure`, and that bundles a different version of Google Closure Library. This PR vendors the version of Closure back into `third_party/closure/goog` and then updates our builds and tests to use. This is a necessary prelude to updating `rules_closure` to the latest release. That version no longer bundles a copy of closure, so we need to be using a vendored one. However, the version we end up on won't be _this_ version of closure because the later `rules_closure` has an updated closure compiler that doesn't like our code. However, one thing at a time! Let's start by vendoring the thing we're using and remove ourselves from the clutches of a bundled version of the library. --- javascript/atoms/BUILD.bazel | 118 +- javascript/atoms/fragments/BUILD.bazel | 2 +- javascript/atoms/test/test_bootstrap.js | 4 +- javascript/chrome-driver/BUILD.bazel | 12 +- .../chrome-driver/test/test_bootstrap.js | 2 +- javascript/ie-driver/BUILD.bazel | 4 +- javascript/private/closure_js_deps.bzl | 3 +- javascript/private/test_suite.bzl | 5 +- javascript/webdriver/atoms/BUILD.bazel | 14 +- javascript/webdriver/atoms/inject/BUILD.bazel | 6 +- javascript/webdriver/test/test_bootstrap.js | 2 +- third_party/closure/goog/BUILD.bazel | 216 +- .../closure/goog/a11y/aria/BUILD.bazel | 73 + third_party/closure/goog/a11y/aria/aria.js | 14 +- .../closure/goog/a11y/aria/attributes.js | 10 + third_party/closure/goog/array/BUILD.bazel | 20 + third_party/closure/goog/array/array.js | 86 +- third_party/closure/goog/asserts/BUILD.bazel | 23 + third_party/closure/goog/asserts/asserts.js | 126 +- third_party/closure/goog/async/BUILD.bazel | 118 + .../closure/goog/async/animationdelay.js | 4 +- .../closure/goog/async/conditionaldelay.js | 23 +- third_party/closure/goog/async/debouncer.js | 2 +- third_party/closure/goog/async/delay.js | 4 +- third_party/closure/goog/async/freelist.js | 22 +- third_party/closure/goog/async/nexttick.js | 24 +- third_party/closure/goog/async/run.js | 19 +- third_party/closure/goog/async/throttle.js | 2 +- third_party/closure/goog/async/workqueue.js | 5 +- third_party/closure/goog/base.js | 5031 +- .../closure/goog/bootstrap/BUILD.bazel | 22 + third_party/closure/goog/bootstrap/nodejs.js | 2 - .../closure/goog/bootstrap/webworkers.js | 8 +- .../closure/goog/collections/BUILD.bazel | 20 + third_party/closure/goog/collections/sets.js | 104 + third_party/closure/goog/color/BUILD.bazel | 40 + third_party/closure/goog/color/alpha.js | 69 +- third_party/closure/goog/color/color.js | 51 +- .../closure/goog/conformance_proto.txt | 530 + third_party/closure/goog/crypt/BUILD.bazel | 245 + third_party/closure/goog/crypt/aes.js | 5 +- third_party/closure/goog/crypt/arc4.js | 1 - third_party/closure/goog/crypt/base64.js | 238 +- third_party/closure/goog/crypt/basen.js | 63 +- third_party/closure/goog/crypt/blobhasher.js | 9 +- third_party/closure/goog/crypt/blockcipher.js | 2 - .../closure/goog/crypt/bytestring_perf.html | 25 - third_party/closure/goog/crypt/cbc.js | 2 - third_party/closure/goog/crypt/crypt.js | 10 +- .../closure/goog/crypt/crypt_perf.html | 85 - third_party/closure/goog/crypt/hash.js | 1 - third_party/closure/goog/crypt/hash32.js | 3 +- third_party/closure/goog/crypt/hashtester.js | 5 +- third_party/closure/goog/crypt/hmac.js | 8 +- third_party/closure/goog/crypt/md5.js | 7 +- third_party/closure/goog/crypt/md5_perf.html | 39 - third_party/closure/goog/crypt/pbkdf2.js | 1 - third_party/closure/goog/crypt/sha1.js | 7 +- third_party/closure/goog/crypt/sha1_perf.html | 40 - third_party/closure/goog/crypt/sha2.js | 11 +- third_party/closure/goog/crypt/sha224.js | 1 - .../closure/goog/crypt/sha224_perf.html | 40 - third_party/closure/goog/crypt/sha256.js | 1 - .../closure/goog/crypt/sha256_perf.html | 40 - third_party/closure/goog/crypt/sha2_64bit.js | 32 +- third_party/closure/goog/crypt/sha384.js | 2 - third_party/closure/goog/crypt/sha512.js | 2 - third_party/closure/goog/crypt/sha512_256.js | 2 - .../closure/goog/crypt/sha512_perf.html | 41 - third_party/closure/goog/css/filteredmenu.css | 1 + third_party/closure/goog/cssom/BUILD.bazel | 27 + third_party/closure/goog/cssom/cssom.js | 82 +- .../goog/cssom/cssom_test_import_1.css | 11 + .../goog/cssom/cssom_test_import_2.css | 10 + .../closure/goog/cssom/cssom_test_link_1.css | 10 + .../closure/goog/cssom/iframe/BUILD.bazel | 30 + .../closure/goog/cssom/iframe/style.js | 25 +- .../goog/cssom/iframe/style_test_import.css | 10 + .../closure/goog/datasource/BUILD.bazel | 124 + .../closure/goog/datasource/datamanager.js | 5 +- .../closure/goog/datasource/datasource.js | 3 +- third_party/closure/goog/datasource/expr.js | 1 - .../closure/goog/datasource/fastdatanode.js | 28 +- .../closure/goog/datasource/jsdatasource.js | 5 +- .../closure/goog/datasource/jsondatasource.js | 26 +- .../goog/datasource/jsxmlhttpdatasource.js | 4 +- .../closure/goog/datasource/xmldatasource.js | 5 +- third_party/closure/goog/date/BUILD.bazel | 76 + third_party/closure/goog/date/date.js | 218 +- third_party/closure/goog/date/datelike.js | 2 - third_party/closure/goog/date/daterange.js | 4 +- third_party/closure/goog/date/duration.js | 1 - third_party/closure/goog/date/relative.js | 345 +- .../closure/goog/date/relativecommontests.js | 606 + .../closure/goog/date/relativewithplurals.js | 119 - third_party/closure/goog/date/utcdatetime.js | 4 +- third_party/closure/goog/db/BUILD.bazel | 119 + third_party/closure/goog/db/cursor.js | 3 +- third_party/closure/goog/db/db.js | 3 +- third_party/closure/goog/db/error.js | 22 +- third_party/closure/goog/db/index.js | 125 +- third_party/closure/goog/db/indexeddb.js | 8 +- third_party/closure/goog/db/keyrange.js | 9 +- third_party/closure/goog/db/objectstore.js | 107 +- third_party/closure/goog/db/transaction.js | 1 - third_party/closure/goog/debug/BUILD.bazel | 261 + third_party/closure/goog/debug/console.js | 64 +- third_party/closure/goog/debug/debug.js | 115 +- third_party/closure/goog/debug/debugwindow.js | 3 +- .../closure/goog/debug/devcss/BUILD.bazel | 38 + .../closure/goog/debug/devcss/devcss.js | 8 +- third_party/closure/goog/debug/divconsole.js | 2 - .../closure/goog/debug/entrypointregistry.js | 4 +- third_party/closure/goog/debug/error.js | 5 +- .../closure/goog/debug/errorcontext.js | 49 + .../closure/goog/debug/errorhandler.js | 121 +- .../closure/goog/debug/errorhandlerweakdep.js | 1 - .../closure/goog/debug/errorreporter.js | 26 +- third_party/closure/goog/debug/fancywindow.js | 11 +- third_party/closure/goog/debug/formatter.js | 5 +- third_party/closure/goog/debug/fpsdisplay.js | 2 +- third_party/closure/goog/debug/logbuffer.js | 4 +- third_party/closure/goog/debug/logger.js | 55 +- third_party/closure/goog/debug/logrecord.js | 6 +- .../closure/goog/debug/logrecordserializer.js | 4 +- .../goog/debug/relativetimeprovider.js | 10 +- third_party/closure/goog/debug/tracer.js | 243 +- third_party/closure/goog/delegate/BUILD.bazel | 33 + .../closure/goog/delegate/delegateregistry.js | 379 + .../closure/goog/delegate/delegates.js | 68 + .../goog/demos/autocompleteremotedata.js | 18 + .../goog/demos/autocompleterichremotedata.js | 35 + third_party/closure/goog/demos/css/demo.css | 75 + .../closure/goog/demos/css/emojipicker.css | 36 + .../closure/goog/demos/css/emojisprite.css | 92 + third_party/closure/goog/demos/editor/deps.js | 45 + .../closure/goog/demos/editor/helloworld.js | 79 + .../goog/demos/editor/helloworlddialog.js | 180 + .../demos/editor/helloworlddialogplugin.js | 115 + .../closure/goog/demos/emoji/sprite.png | Bin 0 -> 25195 bytes .../closure/goog/demos/emoji/sprite2.png | Bin 0 -> 27856 bytes .../closure/goog/demos/graphics/tigerdata.js | 4135 ++ .../closure/goog/demos/samplecomponent.js | 188 + .../closure/goog/demos/tree/testdata.js | 260 + third_party/closure/goog/demos/xpc/xpcdemo.js | 315 + third_party/closure/goog/deps.js | 1693 +- .../closure/goog/disposable/BUILD.bazel | 29 + .../closure/goog/disposable/disposable.js | 47 +- .../closure/goog/disposable/idisposable.js | 1 - third_party/closure/goog/dom/BUILD.bazel | 491 + .../closure/goog/dom/abstractmultirange.js | 2 - third_party/closure/goog/dom/abstractrange.js | 3 +- .../goog/dom/animationframe/BUILD.bazel | 29 + .../goog/dom/animationframe/animationframe.js | 19 +- .../goog/dom/animationframe/polyfill.js | 15 +- third_party/closure/goog/dom/annotate.js | 13 +- third_party/closure/goog/dom/asserts.js | 372 + third_party/closure/goog/dom/attr.js | 2 +- .../closure/goog/dom/browserfeature.js | 124 +- .../closure/goog/dom/browserrange/BUILD.bazel | 117 + .../goog/dom/browserrange/abstractrange.js | 2 - .../goog/dom/browserrange/browserrange.js | 2 - .../goog/dom/browserrange/geckorange.js | 2 - .../closure/goog/dom/browserrange/ierange.js | 22 +- .../goog/dom/browserrange/operarange.js | 1 - .../closure/goog/dom/browserrange/w3crange.js | 2 - .../goog/dom/browserrange/webkitrange.js | 2 - .../goog/dom/bufferedviewportsizemonitor.js | 1 - third_party/closure/goog/dom/classes.js | 18 +- third_party/closure/goog/dom/classlist.js | 74 +- third_party/closure/goog/dom/controlrange.js | 34 +- third_party/closure/goog/dom/dataset.js | 72 +- third_party/closure/goog/dom/dom.js | 444 +- .../closure/goog/dom/fontsizemonitor.js | 5 +- third_party/closure/goog/dom/forms.js | 118 +- third_party/closure/goog/dom/fullscreen.js | 56 +- third_party/closure/goog/dom/iframe.js | 21 +- third_party/closure/goog/dom/inputtype.js | 2 - third_party/closure/goog/dom/iter.js | 4 +- third_party/closure/goog/dom/multirange.js | 17 +- third_party/closure/goog/dom/nodeiterator.js | 2 - third_party/closure/goog/dom/nodeoffset.js | 2 - .../closure/goog/dom/pattern/BUILD.bazel | 160 + .../goog/dom/pattern/abstractpattern.js | 7 +- .../closure/goog/dom/pattern/allchildren.js | 6 +- .../goog/dom/pattern/callback/BUILD.bazel | 41 + .../goog/dom/pattern/callback/callback.js | 3 +- .../goog/dom/pattern/callback/counter.js | 4 +- .../closure/goog/dom/pattern/callback/test.js | 4 +- .../closure/goog/dom/pattern/childmatches.js | 15 +- .../closure/goog/dom/pattern/endtag.js | 2 - .../closure/goog/dom/pattern/fulltag.js | 11 +- .../closure/goog/dom/pattern/matcher.js | 2 - .../closure/goog/dom/pattern/nodetype.js | 2 - .../closure/goog/dom/pattern/pattern.js | 4 +- .../closure/goog/dom/pattern/repeat.js | 4 +- .../closure/goog/dom/pattern/sequence.js | 2 - .../closure/goog/dom/pattern/starttag.js | 2 - third_party/closure/goog/dom/pattern/tag.js | 6 +- third_party/closure/goog/dom/pattern/text.js | 2 - third_party/closure/goog/dom/range.js | 2 +- third_party/closure/goog/dom/rangeendpoint.js | 2 - third_party/closure/goog/dom/safe.js | 612 +- .../closure/goog/dom/savedcaretrange.js | 10 +- third_party/closure/goog/dom/savedrange.js | 4 +- third_party/closure/goog/dom/selection.js | 7 +- third_party/closure/goog/dom/tagiterator.js | 14 +- third_party/closure/goog/dom/tagname.js | 24 +- third_party/closure/goog/dom/textassert.js | 46 + third_party/closure/goog/dom/textrange.js | 6 +- .../closure/goog/dom/textrangeiterator.js | 66 +- third_party/closure/goog/dom/uri.js | 61 + third_party/closure/goog/dom/vendor.js | 2 +- .../closure/goog/dom/viewportsizemonitor.js | 3 +- third_party/closure/goog/dom/xml.js | 19 +- third_party/closure/goog/editor/BUILD.bazel | 276 + .../closure/goog/editor/browserfeature.js | 6 +- .../closure/goog/editor/clicktoeditwrapper.js | 4 +- .../goog/editor/contenteditablefield.js | 8 +- third_party/closure/goog/editor/defines.js | 4 +- third_party/closure/goog/editor/field.js | 172 +- third_party/closure/goog/editor/focus.js | 2 +- third_party/closure/goog/editor/icontent.js | 2 - third_party/closure/goog/editor/link.js | 9 +- third_party/closure/goog/editor/node.js | 19 +- third_party/closure/goog/editor/plugin.js | 463 +- .../closure/goog/editor/plugin_impl.js | 480 + .../closure/goog/editor/plugins/BUILD.bazel | 388 + .../editor/plugins/abstractbubbleplugin.js | 7 +- .../editor/plugins/abstractdialogplugin.js | 2 - .../goog/editor/plugins/abstracttabhandler.js | 2 - .../goog/editor/plugins/basictextformatter.js | 38 +- .../closure/goog/editor/plugins/blockquote.js | 5 +- .../closure/goog/editor/plugins/emoticons.js | 2 - .../goog/editor/plugins/enterhandler.js | 43 +- .../goog/editor/plugins/firststrong.js | 7 +- .../goog/editor/plugins/headerformatter.js | 1 - .../closure/goog/editor/plugins/linkbubble.js | 31 +- .../goog/editor/plugins/linkdialogplugin.js | 44 +- .../goog/editor/plugins/linkshortcutplugin.js | 2 +- .../goog/editor/plugins/listtabhandler.js | 2 - .../closure/goog/editor/plugins/loremipsum.js | 4 +- .../goog/editor/plugins/removeformatting.js | 3 +- .../goog/editor/plugins/spacestabhandler.js | 2 - .../goog/editor/plugins/tagonenterhandler.js | 5 +- .../closure/goog/editor/plugins/undoredo.js | 27 +- .../goog/editor/plugins/undoredomanager.js | 12 +- .../goog/editor/plugins/undoredostate.js | 1 - third_party/closure/goog/editor/range.js | 4 +- .../closure/goog/editor/seamlessfield.js | 51 +- third_party/closure/goog/editor/style.js | 5 +- third_party/closure/goog/editor/table.js | 6 +- third_party/closure/goog/events/BUILD.bazel | 366 + .../closure/goog/events/actioneventwrapper.js | 6 +- .../closure/goog/events/actionhandler.js | 18 +- .../closure/goog/events/browserevent.js | 119 +- .../closure/goog/events/browserfeature.js | 63 +- third_party/closure/goog/events/event.js | 7 +- .../closure/goog/events/eventhandler.js | 48 +- third_party/closure/goog/events/events.js | 94 +- .../closure/goog/events/eventtarget.js | 29 +- .../closure/goog/events/eventtargettester.js | 1909 +- third_party/closure/goog/events/eventtype.js | 188 +- .../closure/goog/events/eventwrapper.js | 5 +- .../closure/goog/events/filedrophandler.js | 12 +- .../closure/goog/events/focushandler.js | 1 - third_party/closure/goog/events/imehandler.js | 2 - .../closure/goog/events/inputhandler.js | 11 +- third_party/closure/goog/events/keycodes.js | 87 +- third_party/closure/goog/events/keyhandler.js | 66 +- third_party/closure/goog/events/keynames.js | 2 - third_party/closure/goog/events/keys.js | 17 +- third_party/closure/goog/events/listenable.js | 20 +- third_party/closure/goog/events/listener.js | 3 +- .../closure/goog/events/listenermap.js | 11 +- .../closure/goog/events/mousewheelhandler.js | 10 +- .../closure/goog/events/onlinehandler.js | 7 +- .../closure/goog/events/pastehandler.js | 24 +- .../closure/goog/events/wheelhandler.js | 6 +- third_party/closure/goog/format/BUILD.bazel | 70 + .../closure/goog/format/emailaddress.js | 1 - third_party/closure/goog/format/format.js | 26 +- .../closure/goog/format/htmlprettyprinter.js | 5 +- .../format/internationalizedemailaddress.js | 9 +- .../closure/goog/format/jsonprettyprinter.js | 8 +- third_party/closure/goog/fs/BUILD.bazel | 135 + third_party/closure/goog/fs/entry.js | 5 +- third_party/closure/goog/fs/entryimpl.js | 1 + third_party/closure/goog/fs/error.js | 24 +- third_party/closure/goog/fs/filereader.js | 1 - third_party/closure/goog/fs/filesaver.js | 1 - third_party/closure/goog/fs/filesystem.js | 3 +- third_party/closure/goog/fs/filewriter.js | 1 - third_party/closure/goog/fs/fs.js | 11 +- third_party/closure/goog/fs/progressevent.js | 1 - third_party/closure/goog/fs/url.js | 14 +- .../closure/goog/functions/BUILD.bazel | 19 + .../closure/goog/functions/functions.js | 124 +- third_party/closure/goog/fx/BUILD.bazel | 208 + .../closure/goog/fx/abstractdragdrop.js | 27 +- third_party/closure/goog/fx/anim/BUILD.bazel | 24 + third_party/closure/goog/fx/anim/anim.js | 6 +- third_party/closure/goog/fx/animation.js | 13 +- third_party/closure/goog/fx/css3/BUILD.bazel | 36 + third_party/closure/goog/fx/css3/fx.js | 4 +- .../closure/goog/fx/css3/transition.js | 8 +- .../closure/goog/fx/cssspriteanimation.js | 5 +- third_party/closure/goog/fx/dom.js | 74 +- third_party/closure/goog/fx/dragdrop.js | 1 - third_party/closure/goog/fx/dragdropgroup.js | 1 - third_party/closure/goog/fx/dragger.js | 29 +- third_party/closure/goog/fx/draglistgroup.js | 86 +- .../closure/goog/fx/dragscrollsupport.js | 7 +- third_party/closure/goog/fx/easing.js | 2 - third_party/closure/goog/fx/fx.js | 1 - third_party/closure/goog/fx/transition.js | 4 +- third_party/closure/goog/goog.js | 112 + third_party/closure/goog/graphics/BUILD.bazel | 324 + .../closure/goog/graphics/abstractgraphics.js | 3 +- .../closure/goog/graphics/affinetransform.js | 45 +- .../closure/goog/graphics/canvaselement.js | 4 +- .../closure/goog/graphics/canvasgraphics.js | 7 +- third_party/closure/goog/graphics/element.js | 3 +- .../closure/goog/graphics/ellipseelement.js | 1 - .../closure/goog/graphics/ext/BUILD.bazel | 126 + .../closure/goog/graphics/ext/coordinates.js | 8 +- .../closure/goog/graphics/ext/element.js | 7 +- .../closure/goog/graphics/ext/ellipse.js | 2 +- .../closure/goog/graphics/ext/graphics.js | 10 +- .../closure/goog/graphics/ext/group.js | 4 +- .../closure/goog/graphics/ext/image.js | 2 +- third_party/closure/goog/graphics/ext/path.js | 1 - .../closure/goog/graphics/ext/rectangle.js | 2 +- .../closure/goog/graphics/ext/shape.js | 14 +- .../goog/graphics/ext/strokeandfillelement.js | 5 +- third_party/closure/goog/graphics/fill.js | 1 - third_party/closure/goog/graphics/font.js | 1 - third_party/closure/goog/graphics/graphics.js | 1 - .../closure/goog/graphics/groupelement.js | 1 - .../closure/goog/graphics/imageelement.js | 2 +- .../closure/goog/graphics/lineargradient.js | 7 +- third_party/closure/goog/graphics/path.js | 35 +- .../closure/goog/graphics/pathelement.js | 1 - third_party/closure/goog/graphics/paths.js | 1 - .../closure/goog/graphics/rectelement.js | 1 - .../closure/goog/graphics/solidfill.js | 1 - third_party/closure/goog/graphics/stroke.js | 1 - .../goog/graphics/strokeandfillelement.js | 1 - .../closure/goog/graphics/svgelement.js | 5 +- .../closure/goog/graphics/svggraphics.js | 12 +- .../closure/goog/graphics/textelement.js | 1 - .../closure/goog/graphics/vmlelement.js | 10 +- .../closure/goog/graphics/vmlgraphics.js | 21 +- third_party/closure/goog/history/BUILD.bazel | 74 + third_party/closure/goog/history/event.js | 5 +- third_party/closure/goog/history/eventtype.js | 1 - third_party/closure/goog/history/history.js | 23 +- .../closure/goog/history/html5history.js | 15 +- third_party/closure/goog/html/BUILD.bazel | 240 + .../closure/goog/html/cssspecificity.js | 176 + third_party/closure/goog/html/flash.js | 80 +- .../closure/goog/html/legacyconversions.js | 21 +- third_party/closure/goog/html/safehtml.js | 238 +- .../closure/goog/html/safehtmlformatter.js | 13 +- third_party/closure/goog/html/safescript.js | 93 +- third_party/closure/goog/html/safestyle.js | 294 +- .../closure/goog/html/safestylesheet.js | 95 +- third_party/closure/goog/html/safeurl.js | 408 +- .../closure/goog/html/safeurl_test_vectors.js | 122 + .../closure/goog/html/sanitizer/BUILD.bazel | 153 + .../goog/html/sanitizer/attributewhitelist.js | 14 + .../html/sanitizer/csspropertysanitizer.js | 163 + .../goog/html/sanitizer/csssanitizer.js | 490 +- .../goog/html/sanitizer/csssanitizer_test.js | 373 - .../goog/html/sanitizer/elementweakmap.js | 109 + .../goog/html/sanitizer/html_test_vectors.js | 27645 ++++++++++ .../goog/html/sanitizer/htmlsanitizer.js | 1034 +- .../goog/html/sanitizer/htmlsanitizer_test.js | 1503 - .../closure/goog/html/sanitizer/noclobber.js | 466 + .../html/sanitizer/safedomtreeprocessor.js | 337 + .../goog/html/sanitizer/tagblacklist.js | 11 +- .../goog/html/sanitizer/tagwhitelist.js | 2 + .../closure/goog/html/sanitizer/unsafe.js | 41 +- .../goog/html/sanitizer/unsafe_test.js | 248 - third_party/closure/goog/html/testing.js | 125 + .../closure/goog/html/textextractor.js | 127 + .../closure/goog/html/trustedresourceurl.js | 225 +- third_party/closure/goog/html/trustedtypes.js | 26 + .../closure/goog/html/uncheckedconversions.js | 45 +- third_party/closure/goog/i18n/BUILD.bazel | 340 + third_party/closure/goog/i18n/bidi.js | 143 +- .../closure/goog/i18n/bidiformatter.js | 96 +- .../closure/goog/i18n/charlistdecompressor.js | 3 +- .../closure/goog/i18n/charpickerdata.js | 168 +- third_party/closure/goog/i18n/collation.js | 4 +- .../goog/i18n/compactnumberformatsymbols.js | 1438 +- .../i18n/compactnumberformatsymbols_ext.js | 28721 ----------- .../i18n/compactnumberformatsymbolsext.js | 7237 +-- third_party/closure/goog/i18n/currency.js | 149 +- .../closure/goog/i18n/dateintervalformat.js | 16 +- .../closure/goog/i18n/dateintervalpatterns.js | 2685 +- .../goog/i18n/dateintervalpatternsext.js | 41670 +++++----------- .../closure/goog/i18n/dateintervalsymbols.js | 1911 +- .../goog/i18n/dateintervalsymbolsext.js | 34504 ++++--------- .../closure/goog/i18n/datetimeformat.js | 100 +- .../closure/goog/i18n/datetimeparse.js | 8 +- .../closure/goog/i18n/datetimepatterns.js | 1443 +- .../closure/goog/i18n/datetimepatternsext.js | 7196 +-- .../closure/goog/i18n/datetimesymbols.js | 1356 +- .../closure/goog/i18n/datetimesymbolsext.js | 8382 ++-- .../closure/goog/i18n/graphemebreak.js | 472 +- .../closure/goog/i18n/localefeature.js | 59 + .../closure/goog/i18n/messageformat.js | 51 +- third_party/closure/goog/i18n/mime.js | 13 +- third_party/closure/goog/i18n/numberformat.js | 369 +- .../closure/goog/i18n/numberformatsymbols.js | 1133 +- .../goog/i18n/numberformatsymbolsext.js | 11796 +++-- third_party/closure/goog/i18n/ordinalrules.js | 128 +- third_party/closure/goog/i18n/pluralrules.js | 217 +- .../goog/i18n/relativedatetimeformat.js | 445 + .../goog/i18n/relativedatetimesymbols.js | 10629 ++++ .../goog/i18n/relativedatetimesymbolsext.js | 26399 ++++++++++ third_party/closure/goog/i18n/timezone.js | 38 +- third_party/closure/goog/i18n/uchar.js | 35 +- .../closure/goog/i18n/uchar/BUILD.bazel | 50 + .../goog/i18n/uchar/remotenamefetcher.js | 12 +- third_party/closure/goog/i18n/ucharnames.js | 3 +- third_party/closure/goog/images/blank.gif | Bin 49 -> 0 bytes .../closure/goog/images/bubble_left.gif | Bin 85 -> 0 bytes .../closure/goog/images/bubble_right.gif | Bin 86 -> 0 bytes third_party/closure/goog/images/button-bg.gif | Bin 454 -> 0 bytes .../closure/goog/images/check-outline.gif | Bin 69 -> 0 bytes .../closure/goog/images/check-sprite.gif | Bin 75 -> 0 bytes third_party/closure/goog/images/check.gif | Bin 53 -> 0 bytes third_party/closure/goog/images/close_box.gif | Bin 65 -> 0 bytes .../closure/goog/images/color-swatch-tick.gif | Bin 69 -> 0 bytes .../closure/goog/images/dialog_close_box.gif | Bin 86 -> 0 bytes third_party/closure/goog/images/dropdn.gif | Bin 51 -> 0 bytes .../closure/goog/images/dropdn_disabled.gif | Bin 51 -> 0 bytes third_party/closure/goog/images/dropdown.gif | Bin 78 -> 0 bytes .../closure/goog/images/gears_bluedot.gif | Bin 236 -> 0 bytes .../closure/goog/images/gears_online.gif | Bin 137 -> 0 bytes .../closure/goog/images/gears_paused.gif | Bin 93 -> 0 bytes .../closure/goog/images/gears_syncing.gif | Bin 761 -> 0 bytes .../closure/goog/images/hsv-sprite-sm.gif | Bin 11851 -> 0 bytes .../closure/goog/images/hsv-sprite.gif | Bin 33309 -> 0 bytes .../closure/goog/images/hsva-sprite-sm.gif | Bin 12571 -> 0 bytes .../closure/goog/images/hsva-sprite.gif | Bin 36428 -> 0 bytes .../goog/images/left_anchor_bubble_bot.gif | Bin 431 -> 0 bytes .../goog/images/left_anchor_bubble_top.gif | Bin 332 -> 0 bytes .../closure/goog/images/menu-arrows.gif | Bin 113 -> 0 bytes .../goog/images/no_anchor_bubble_bot.gif | Bin 228 -> 0 bytes .../goog/images/no_anchor_bubble_top.gif | Bin 123 -> 0 bytes .../closure/goog/images/ratingstars.gif | Bin 1139 -> 0 bytes .../goog/images/right_anchor_bubble_bot.gif | Bin 425 -> 0 bytes .../goog/images/right_anchor_bubble_top.gif | Bin 335 -> 0 bytes .../closure/goog/images/toolbar-separator.gif | Bin 472 -> 0 bytes .../closure/goog/images/toolbar_icons.gif | Bin 1062 -> 0 bytes .../closure/goog/images/tree/cleardot.gif | Bin 43 -> 0 bytes third_party/closure/goog/images/tree/tree.gif | Bin 1568 -> 0 bytes third_party/closure/goog/iter/BUILD.bazel | 35 + third_party/closure/goog/iter/es6.js | 214 + third_party/closure/goog/iter/iter.js | 165 +- third_party/closure/goog/json/BUILD.bazel | 61 + .../closure/goog/json/evaljsonprocessor.js | 68 - third_party/closure/goog/json/hybrid.js | 35 +- .../closure/goog/json/hybridjsonprocessor.js | 47 - third_party/closure/goog/json/json.js | 94 +- third_party/closure/goog/json/json_perf.html | 29 - third_party/closure/goog/json/json_perf.js | 4 - third_party/closure/goog/json/jsonable.js | 44 + .../closure/goog/json/nativejsonprocessor.js | 2 +- .../closure/goog/labs/collections/BUILD.bazel | 19 + .../goog/labs/collections/iterables.js | 94 + third_party/closure/goog/labs/dom/BUILD.bazel | 28 + .../closure/goog/labs/events/BUILD.bazel | 42 + .../labs/events/nondisposableeventtarget.js | 14 +- .../closure/goog/labs/format/BUILD.bazel | 27 + third_party/closure/goog/labs/format/csv.js | 24 +- .../goog/labs/html/attribute_rewriter.js | 74 - .../closure/goog/labs/html/sanitizer.js | 392 - .../closure/goog/labs/html/scrubber.js | 1023 - .../closure/goog/labs/i18n/BUILD.bazel | 40 + .../closure/goog/labs/i18n/listformat.js | 15 +- .../closure/goog/labs/i18n/listsymbols.js | 29 +- .../closure/goog/labs/i18n/listsymbolsext.js | 827 +- .../closure/goog/labs/iterable/iterable.js | 140 - .../closure/goog/labs/mock/BUILD.bazel | 45 + third_party/closure/goog/labs/mock/mock.js | 303 +- .../closure/goog/labs/mock/timeoutmode.js | 50 + .../goog/labs/mock/verificationmode.js | 136 +- third_party/closure/goog/labs/net/BUILD.bazel | 80 + third_party/closure/goog/labs/net/image.js | 12 +- .../goog/labs/net/testdata/cleardot.gif | Bin 43 -> 0 bytes .../closure/goog/labs/net/webchannel.js | 319 +- .../goog/labs/net/webchannel/BUILD.bazel | 193 + .../labs/net/webchannel/basetestchannel.js | 28 +- .../goog/labs/net/webchannel/channel.js | 10 +- .../labs/net/webchannel/channelrequest.js | 250 +- .../labs/net/webchannel/connectionstate.js | 4 +- .../goog/labs/net/webchannel/environment.js | 74 + .../webchannel/forwardchannelrequestpool.js | 123 +- .../goog/labs/net/webchannel/netutils.js | 55 +- .../goog/labs/net/webchannel/requeststats.js | 29 +- .../labs/net/webchannel/webchannelbase.js | 533 +- .../net/webchannel/webchannelbasetransport.js | 79 +- .../labs/net/webchannel/webchanneldebug.js | 73 +- .../closure/goog/labs/net/webchannel/wire.js | 38 +- .../goog/labs/net/webchannel/wirev8.js | 54 +- .../goog/labs/net/webchanneltransport.js | 6 +- .../labs/net/webchanneltransportfactory.js | 1 - third_party/closure/goog/labs/net/xhr.js | 38 +- .../closure/goog/labs/object/object.js | 47 - .../closure/goog/labs/promise/promise.js | 85 - .../closure/goog/labs/pubsub/BUILD.bazel | 34 + .../goog/labs/pubsub/broadcastpubsub.js | 24 +- .../closure/goog/labs/storage/BUILD.bazel | 27 + .../labs/storage/boundedcollectablestorage.js | 5 +- .../closure/goog/labs/structs/BUILD.bazel | 23 + third_party/closure/goog/labs/structs/map.js | 345 - .../closure/goog/labs/structs/map_perf.js | 206 - .../closure/goog/labs/structs/multimap.js | 82 +- .../closure/goog/labs/style/BUILD.bazel | 23 + .../goog/labs/style/pixeldensitymonitor.js | 1 + .../closure/goog/labs/testing/BUILD.bazel | 114 + .../closure/goog/labs/testing/assertthat.js | 2 +- .../goog/labs/testing/decoratormatcher.js | 32 +- .../goog/labs/testing/dictionarymatcher.js | 28 +- .../closure/goog/labs/testing/environment.js | 258 +- .../closure/goog/labs/testing/json_fuzzing.js | 6 +- .../closure/goog/labs/testing/logicmatcher.js | 19 +- .../closure/goog/labs/testing/matcher.js | 2 +- .../goog/labs/testing/numbermatcher.js | 44 +- .../goog/labs/testing/objectmatcher.js | 49 +- .../goog/labs/testing/stringmatcher.js | 53 +- .../closure/goog/labs/useragent/BUILD.bazel | 91 + .../closure/goog/labs/useragent/browser.js | 67 +- .../closure/goog/labs/useragent/device.js | 1 - .../closure/goog/labs/useragent/engine.js | 6 +- .../closure/goog/labs/useragent/extra.js | 41 + .../closure/goog/labs/useragent/platform.js | 25 +- .../goog/labs/useragent/test_agents.js | 43 +- .../closure/goog/labs/useragent/util.js | 9 +- .../closure/goog/labs/useragent/verifier.js | 12 +- third_party/closure/goog/loader/BUILD.bazel | 37 + .../goog/loader/abstractmodulemanager.js | 402 + .../goog/loader/activemodulemanager.js | 76 + third_party/closure/goog/locale/BUILD.bazel | 88 + third_party/closure/goog/locale/countries.js | 8 +- .../goog/locale/defaultlocalenameconstants.js | 15 +- .../goog/locale/genericfontnamesdata.js | 3 +- third_party/closure/goog/locale/locale.js | 35 +- .../goog/locale/nativenameconstants.js | 1641 +- .../closure/goog/locale/scriptToLanguages.js | 1 - .../goog/locale/timezonefingerprint.js | 1 - .../closure/goog/locale/timezonelist.js | 4 +- third_party/closure/goog/log/BUILD.bazel | 24 + third_party/closure/goog/log/log.js | 4 +- third_party/closure/goog/math/BUILD.bazel | 222 + .../closure/goog/math/affinetransform.js | 45 +- third_party/closure/goog/math/bezier.js | 2 - third_party/closure/goog/math/box.js | 26 +- third_party/closure/goog/math/coordinate.js | 26 +- third_party/closure/goog/math/coordinate3.js | 26 +- .../closure/goog/math/exponentialbackoff.js | 9 +- third_party/closure/goog/math/integer.js | 137 +- .../goog/math/interpolator/BUILD.bazel | 59 + .../goog/math/interpolator/interpolator1.js | 1 - .../closure/goog/math/interpolator/linear1.js | 1 - .../closure/goog/math/interpolator/pchip1.js | 1 - .../closure/goog/math/interpolator/spline1.js | 1 - third_party/closure/goog/math/line.js | 2 - third_party/closure/goog/math/long.js | 1495 +- third_party/closure/goog/math/math.js | 32 +- third_party/closure/goog/math/matrix.js | 37 +- third_party/closure/goog/math/path.js | 35 +- third_party/closure/goog/math/paths.js | 1 - third_party/closure/goog/math/rangeset.js | 2 - third_party/closure/goog/math/rect.js | 18 +- third_party/closure/goog/math/size.js | 11 +- third_party/closure/goog/math/tdma.js | 10 +- third_party/closure/goog/math/vec2.js | 28 +- third_party/closure/goog/math/vec3.js | 17 +- third_party/closure/goog/memoize/BUILD.bazel | 19 + third_party/closure/goog/memoize/memoize.js | 61 +- .../closure/goog/messaging/BUILD.bazel | 175 + .../closure/goog/messaging/abstractchannel.js | 9 +- .../closure/goog/messaging/bufferedchannel.js | 1 - .../closure/goog/messaging/deferredchannel.js | 5 +- .../closure/goog/messaging/loggerclient.js | 4 +- .../closure/goog/messaging/loggerserver.js | 2 +- .../closure/goog/messaging/messagechannel.js | 1 - .../closure/goog/messaging/messaging.js | 3 +- .../closure/goog/messaging/multichannel.js | 9 +- .../closure/goog/messaging/portcaller.js | 3 +- .../closure/goog/messaging/portchannel.js | 15 +- .../closure/goog/messaging/portnetwork.js | 3 +- .../closure/goog/messaging/portoperator.js | 5 +- .../goog/messaging/respondingchannel.js | 22 +- .../messaging/testdata/portchannel_inner.html | 29 - .../portchannel_wrong_origin_inner.html | 29 - .../messaging/testdata/portnetwork_inner.html | 35 - .../closure/goog/mochikit/async/BUILD.bazel | 36 + .../closure/goog/mochikit/async/deferred.js | 955 + .../goog/mochikit/async/deferredlist.js | 206 + third_party/closure/goog/module/BUILD.bazel | 139 + .../goog/module/abstractmoduleloader.js | 4 +- third_party/closure/goog/module/basemodule.js | 3 +- third_party/closure/goog/module/loader.js | 11 +- third_party/closure/goog/module/module.js | 1 - third_party/closure/goog/module/moduleinfo.js | 34 +- .../closure/goog/module/moduleloadcallback.js | 1 - .../closure/goog/module/moduleloader.js | 321 +- .../closure/goog/module/modulemanager.js | 603 +- .../closure/goog/module/testdata/modA_1.js | 2 +- .../closure/goog/module/testdata/modA_2.js | 6 +- .../closure/goog/module/testdata/modB_1.js | 8 +- third_party/closure/goog/net/BUILD.bazel | 502 + .../closure/goog/net/browserchannel.js | 36 +- .../closure/goog/net/browsertestchannel.js | 12 +- third_party/closure/goog/net/bulkloader.js | 21 +- .../closure/goog/net/bulkloaderhelper.js | 4 +- third_party/closure/goog/net/channeldebug.js | 16 +- .../closure/goog/net/channelrequest.js | 19 +- third_party/closure/goog/net/cookies.js | 132 +- .../closure/goog/net/corsxmlhttpfactory.js | 22 +- .../closure/goog/net/crossdomainrpc.js | 6 +- .../closure/goog/net/crossdomainrpc_test.css | 7 + .../closure/goog/net/fetchxmlhttpfactory.js | 175 +- .../closure/goog/net/filedownloader.js | 9 +- third_party/closure/goog/net/httpstatus.js | 10 +- .../closure/goog/net/httpstatusname.js | 8 +- third_party/closure/goog/net/iframeio.js | 40 +- .../closure/goog/net/iframeloadmonitor.js | 2 +- third_party/closure/goog/net/imageloader.js | 18 +- third_party/closure/goog/net/ipaddress.js | 29 +- third_party/closure/goog/net/jsloader.js | 88 +- third_party/closure/goog/net/jsonp.js | 65 +- third_party/closure/goog/net/mockiframeio.js | 13 +- .../goog/net/multiiframeloadmonitor.js | 1 + third_party/closure/goog/net/networktester.js | 5 +- third_party/closure/goog/net/rpc/BUILD.bazel | 25 + third_party/closure/goog/net/rpc/httpcors.js | 14 +- .../closure/goog/net/rpc/httpcors_test.js | 101 - .../closure/goog/net/streams/BUILD.bazel | 142 + .../goog/net/streams/base64pbstreamparser.js | 2 +- .../goog/net/streams/base64streamdecoder.js | 5 +- .../goog/net/streams/jsonstreamparser.js | 26 +- .../goog/net/streams/nodereadablestream.js | 1 - .../goog/net/streams/pbjsonstreamparser.js | 17 +- .../goog/net/streams/pbstreamparser.js | 44 +- .../closure/goog/net/streams/streamfactory.js | 1 - third_party/closure/goog/net/tmpnetwork.js | 16 +- third_party/closure/goog/net/websocket.js | 112 +- .../closure/goog/net/wrapperxmlhttpfactory.js | 1 - third_party/closure/goog/net/xhrio.js | 87 +- third_party/closure/goog/net/xhriopool.js | 1 - third_party/closure/goog/net/xhrlike.js | 14 + third_party/closure/goog/net/xhrmanager.js | 20 +- third_party/closure/goog/net/xmlhttp.js | 12 +- .../closure/goog/net/xmlhttpfactory.js | 3 +- third_party/closure/goog/net/xpc/BUILD.bazel | 131 + .../closure/goog/net/xpc/crosspagechannel.js | 119 +- .../goog/net/xpc/crosspagechannelrole.js | 1 - .../closure/goog/net/xpc/directtransport.js | 2 +- .../net/xpc/frameelementmethodtransport.js | 259 - .../goog/net/xpc/iframepollingtransport.js | 7 +- .../goog/net/xpc/iframerelaytransport.js | 410 - .../goog/net/xpc/nativemessagingtransport.js | 5 +- .../closure/goog/net/xpc/nixtransport.js | 482 - third_party/closure/goog/net/xpc/relay.js | 16 +- .../goog/net/xpc/testdata/access_checker.html | 29 - .../goog/net/xpc/testdata/inner_peer.html | 99 - third_party/closure/goog/net/xpc/transport.js | 1 - third_party/closure/goog/net/xpc/xpc.js | 33 +- third_party/closure/goog/object/BUILD.bazel | 19 + third_party/closure/goog/object/object.js | 153 +- .../closure/goog/positioning/BUILD.bazel | 125 + .../goog/positioning/absoluteposition.js | 2 - .../goog/positioning/abstractposition.js | 6 +- .../goog/positioning/anchoredposition.js | 2 - .../positioning/anchoredviewportposition.js | 2 - .../goog/positioning/clientposition.js | 5 +- .../goog/positioning/menuanchoredposition.js | 2 - .../closure/goog/positioning/positioning.js | 10 +- .../positioning/viewportclientposition.js | 3 - .../goog/positioning/viewportposition.js | 2 - third_party/closure/goog/promise/BUILD.bazel | 59 + .../closure/goog/promise/nativeresolver.js | 38 + third_party/closure/goog/promise/promise.js | 140 +- third_party/closure/goog/promise/resolver.js | 2 + .../closure/goog/promise/testsuiteadapter.js | 2 +- third_party/closure/goog/promise/thenable.js | 14 +- third_party/closure/goog/proto/BUILD.bazel | 33 + third_party/closure/goog/proto/proto.js | 29 +- third_party/closure/goog/proto/serializer.js | 29 +- third_party/closure/goog/proto2/BUILD.bazel | 133 + third_party/closure/goog/proto2/descriptor.js | 2 + .../closure/goog/proto2/fielddescriptor.js | 26 +- .../closure/goog/proto2/lazydeserializer.js | 1 - third_party/closure/goog/proto2/message.js | 13 +- .../closure/goog/proto2/objectserializer.js | 91 +- .../closure/goog/proto2/package_test.pb.js | 189 + .../closure/goog/proto2/pbliteserializer.js | 3 +- third_party/closure/goog/proto2/serializer.js | 16 +- .../goog/proto2/textformatserializer.js | 19 +- third_party/closure/goog/proto2/util.js | 2 +- third_party/closure/goog/pubsub/BUILD.bazel | 44 + third_party/closure/goog/pubsub/pubsub.js | 10 +- .../closure/goog/pubsub/pubsub_perf.html | 290 - third_party/closure/goog/pubsub/topicid.js | 2 +- .../closure/goog/pubsub/typedpubsub.js | 22 +- third_party/closure/goog/reflect/BUILD.bazel | 19 + third_party/closure/goog/reflect/reflect.js | 14 +- third_party/closure/goog/result/BUILD.bazel | 68 + .../closure/goog/result/simpleresult.js | 2 +- third_party/closure/goog/soy/BUILD.bazel | 63 + third_party/closure/goog/soy/data.js | 219 +- third_party/closure/goog/soy/renderer.js | 185 +- third_party/closure/goog/soy/soy.js | 123 +- .../closure/goog/soy/soy_testhelper.js | 359 + third_party/closure/goog/spell/BUILD.bazel | 25 + third_party/closure/goog/spell/spellcheck.js | 14 +- third_party/closure/goog/stats/BUILD.bazel | 25 + third_party/closure/goog/stats/basicstat.js | 1 - third_party/closure/goog/storage/BUILD.bazel | 103 + .../goog/storage/collectablestorage.js | 4 +- .../goog/storage/collectablestoragetester.js | 7 +- .../closure/goog/storage/encryptedstorage.js | 13 +- third_party/closure/goog/storage/errorcode.js | 1 - .../closure/goog/storage/expiringstorage.js | 2 +- .../goog/storage/mechanism/BUILD.bazel | 173 + .../goog/storage/mechanism/errorcode.js | 1 - .../mechanism/errorhandlingmechanism.js | 2 - .../storage/mechanism/html5localstorage.js | 1 - .../storage/mechanism/html5sessionstorage.js | 1 - .../goog/storage/mechanism/html5webstorage.js | 5 +- .../goog/storage/mechanism/ieuserdata.js | 20 +- .../storage/mechanism/iterablemechanism.js | 1 - .../mechanism/iterablemechanismtester.js | 1 - .../goog/storage/mechanism/mechanism.js | 1 - .../storage/mechanism/mechanismfactory.js | 1 - .../mechanism/mechanismseparationtester.js | 1 - .../mechanism/mechanismsharingtester.js | 1 - .../mechanism/mechanismtestdefinition.js | 2 +- .../goog/storage/mechanism/mechanismtester.js | 4 +- .../storage/mechanism/prefixedmechanism.js | 1 - .../closure/goog/storage/richstorage.js | 9 +- third_party/closure/goog/storage/storage.js | 8 +- .../closure/goog/storage/storagetester.js | 2 - third_party/closure/goog/streams/BUILD.bazel | 106 + third_party/closure/goog/streams/defines.js | 29 + third_party/closure/goog/streams/full.js | 53 + third_party/closure/goog/streams/full_impl.js | 579 + .../closure/goog/streams/full_native_impl.js | 155 + .../closure/goog/streams/full_test_cases.js | 731 + .../closure/goog/streams/full_types.js | 190 + third_party/closure/goog/streams/lite.js | 51 + third_party/closure/goog/streams/lite_impl.js | 536 + .../closure/goog/streams/lite_native_impl.js | 129 + .../closure/goog/streams/lite_test_cases.js | 309 + .../closure/goog/streams/lite_types.js | 145 + third_party/closure/goog/string/BUILD.bazel | 111 + third_party/closure/goog/string/const.js | 75 +- third_party/closure/goog/string/internal.js | 386 + third_party/closure/goog/string/linkify.js | 3 +- third_party/closure/goog/string/newlines.js | 1 - third_party/closure/goog/string/path.js | 4 +- third_party/closure/goog/string/string.js | 417 +- .../closure/goog/string/stringbuffer.js | 2 +- .../closure/goog/string/stringformat.js | 8 +- .../closure/goog/string/typedstring.js | 6 +- third_party/closure/goog/structs/BUILD.bazel | 197 + third_party/closure/goog/structs/avltree.js | 670 +- .../closure/goog/structs/circularbuffer.js | 36 +- .../closure/goog/structs/collection.js | 2 - .../closure/goog/structs/inversionmap.js | 3 +- third_party/closure/goog/structs/linkedmap.js | 4 +- third_party/closure/goog/structs/map.js | 32 +- third_party/closure/goog/structs/node.js | 1 - third_party/closure/goog/structs/pool.js | 15 +- .../closure/goog/structs/prioritypool.js | 4 +- third_party/closure/goog/structs/quadtree.js | 16 +- third_party/closure/goog/structs/queue.js | 1 - .../closure/goog/structs/queue_perf.html | 126 - third_party/closure/goog/structs/set.js | 12 +- .../closure/goog/structs/set_perf.html | 267 - .../closure/goog/structs/simplepool.js | 11 +- third_party/closure/goog/structs/stringset.js | 71 +- third_party/closure/goog/structs/structs.js | 32 +- third_party/closure/goog/structs/treenode.js | 21 +- third_party/closure/goog/structs/trie.js | 7 +- third_party/closure/goog/structs/weak/weak.js | 159 - third_party/closure/goog/style/BUILD.bazel | 108 + third_party/closure/goog/style/bidi.js | 34 +- third_party/closure/goog/style/cursor.js | 2 - third_party/closure/goog/style/style.js | 100 +- .../goog/style/stylescrollbartester.js | 2 - third_party/closure/goog/style/transform.js | 6 +- third_party/closure/goog/style/transition.js | 8 +- third_party/closure/goog/test_module.js | 42 + third_party/closure/goog/test_module_dep.js | 26 + third_party/closure/goog/testing/BUILD.bazel | 553 + .../closure/goog/testing/assertionfailure.js | 58 + third_party/closure/goog/testing/asserts.js | 600 +- .../closure/goog/testing/async/BUILD.bazel | 23 + .../closure/goog/testing/async/mockcontrol.js | 48 +- .../closure/goog/testing/asynctestcase.js | 50 +- .../goog/testing/continuationtestcase.js | 34 +- .../closure/goog/testing/deferredtestcase.js | 5 +- third_party/closure/goog/testing/dom.js | 90 +- .../closure/goog/testing/editor/BUILD.bazel | 53 + .../closure/goog/testing/editor/dom.js | 9 +- .../closure/goog/testing/editor/fieldmock.js | 27 +- .../closure/goog/testing/editor/testhelper.js | 16 +- .../closure/goog/testing/events/BUILD.bazel | 62 + .../goog/testing/events/eventobserver.js | 11 +- .../closure/goog/testing/events/events.js | 218 +- .../closure/goog/testing/events/matchers.js | 2 +- .../goog/testing/events/onlinehandler.js | 1 - .../closure/goog/testing/expectedfailures.js | 2 - .../closure/goog/testing/fs/BUILD.bazel | 115 + third_party/closure/goog/testing/fs/blob.js | 20 +- third_party/closure/goog/testing/fs/entry.js | 31 +- third_party/closure/goog/testing/fs/file.js | 1 - .../closure/goog/testing/fs/filereader.js | 4 +- .../closure/goog/testing/fs/filesystem.js | 1 - .../closure/goog/testing/fs/filewriter.js | 4 +- third_party/closure/goog/testing/fs/fs.js | 2 +- .../closure/goog/testing/fs/progressevent.js | 3 +- .../closure/goog/testing/functionmock.js | 24 +- third_party/closure/goog/testing/graphics.js | 6 +- .../closure/goog/testing/i18n/BUILD.bazel | 16 + .../closure/goog/testing/i18n/asserts.js | 49 +- .../closure/goog/testing/jstdasyncwrapper.js | 13 +- .../goog/testing/jstdtestcaseadapter.js | 4 +- third_party/closure/goog/testing/jsunit.js | 43 +- .../closure/goog/testing/jsunitexception.js | 2 +- third_party/closure/goog/testing/loosemock.js | 56 +- .../goog/testing/messaging/BUILD.bazel | 54 + .../testing/messaging/mockmessagechannel.js | 2 +- .../testing/messaging/mockmessageevent.js | 1 - .../goog/testing/messaging/mockmessageport.js | 2 +- .../goog/testing/messaging/mockportnetwork.js | 5 +- third_party/closure/goog/testing/mock.js | 107 +- .../closure/goog/testing/mockclassfactory.js | 36 +- third_party/closure/goog/testing/mockclock.js | 65 +- .../closure/goog/testing/mockcontrol.js | 19 +- .../closure/goog/testing/mockinterface.js | 10 +- .../closure/goog/testing/mockmatchers.js | 41 +- .../closure/goog/testing/mockrandom.js | 6 +- third_party/closure/goog/testing/mockrange.js | 1 - .../closure/goog/testing/mockuseragent.js | 21 +- .../closure/goog/testing/multitestrunner.js | 54 +- .../closure/goog/testing/net/BUILD.bazel | 56 + .../closure/goog/testing/net/mockiframeio.js | 11 +- third_party/closure/goog/testing/net/xhrio.js | 177 +- .../closure/goog/testing/net/xhriopool.js | 10 +- .../goog/testing/objectpropertystring.js | 2 +- .../testing/parallel_closure_test_suite.js | 58 +- .../closure/goog/testing/performancetable.js | 15 +- .../closure/goog/testing/performancetimer.js | 25 +- .../closure/goog/testing/propertyreplacer.js | 63 +- .../closure/goog/testing/proto2/BUILD.bazel | 20 + .../closure/goog/testing/proto2/proto2.js | 3 +- .../closure/goog/testing/pseudorandom.js | 7 +- .../closure/goog/testing/recordfunction.js | 114 +- .../closure/goog/testing/shardingtestcase.js | 4 +- third_party/closure/goog/testing/singleton.js | 17 +- .../closure/goog/testing/stacktrace.js | 61 +- .../closure/goog/testing/storage/BUILD.bazel | 19 + .../goog/testing/storage/fakemechanism.js | 1 - .../closure/goog/testing/strictmock.js | 48 +- .../closure/goog/testing/style/BUILD.bazel | 32 + .../closure/goog/testing/style/style.js | 28 +- third_party/closure/goog/testing/testcase.js | 975 +- third_party/closure/goog/testing/testqueue.js | 2 +- .../closure/goog/testing/testrunner.js | 109 +- third_party/closure/goog/testing/testsuite.js | 36 +- .../closure/goog/testing/ui/BUILD.bazel | 48 + .../goog/testing/ui/rendererasserts.js | 2 - .../goog/testing/ui/rendererharness.js | 4 +- third_party/closure/goog/testing/ui/style.js | 2 +- .../goog/testing/ui/style_reference.html | 27 - third_party/closure/goog/timer/BUILD.bazel | 23 + third_party/closure/goog/timer/timer.js | 39 +- .../goog/transitionalforwarddeclarations.js | 32 + third_party/closure/goog/transpile.js | 2044 + third_party/closure/goog/tweak/BUILD.bazel | 89 + third_party/closure/goog/tweak/entries.js | 18 +- third_party/closure/goog/tweak/registry.js | 4 +- third_party/closure/goog/tweak/testhelpers.js | 1 - third_party/closure/goog/tweak/tweak.js | 16 +- third_party/closure/goog/tweak/tweakui.js | 22 +- third_party/closure/goog/ui/BUILD.bazel | 2296 + .../closure/goog/ui/abstractspellchecker.js | 21 +- third_party/closure/goog/ui/ac/BUILD.bazel | 181 + third_party/closure/goog/ui/ac/ac.js | 1 - .../closure/goog/ui/ac/arraymatcher.js | 1 - .../closure/goog/ui/ac/autocomplete.js | 9 +- .../closure/goog/ui/ac/cachingmatcher.js | 4 +- .../closure/goog/ui/ac/inputhandler.js | 31 +- .../closure/goog/ui/ac/remotearraymatcher.js | 6 +- third_party/closure/goog/ui/ac/renderer.js | 34 +- .../closure/goog/ui/ac/renderoptions.js | 1 - .../closure/goog/ui/ac/richinputhandler.js | 1 - third_party/closure/goog/ui/ac/richremote.js | 7 +- .../goog/ui/ac/richremotearraymatcher.js | 6 +- .../closure/goog/ui/activitymonitor.js | 1 - .../closure/goog/ui/advancedtooltip.js | 1 - third_party/closure/goog/ui/animatedzippy.js | 10 +- third_party/closure/goog/ui/attachablemenu.js | 8 +- third_party/closure/goog/ui/bidiinput.js | 12 +- third_party/closure/goog/ui/bubble.js | 54 +- third_party/closure/goog/ui/button.js | 3 +- third_party/closure/goog/ui/button_perf.html | 177 - third_party/closure/goog/ui/buttonrenderer.js | 17 +- third_party/closure/goog/ui/buttonside.js | 2 - third_party/closure/goog/ui/charcounter.js | 1 - third_party/closure/goog/ui/charpicker.js | 34 +- third_party/closure/goog/ui/checkbox.js | 23 +- .../closure/goog/ui/checkboxmenuitem.js | 2 - .../closure/goog/ui/checkboxrenderer.js | 4 +- third_party/closure/goog/ui/colorbutton.js | 59 - .../closure/goog/ui/colorbuttonrenderer.js | 75 - .../closure/goog/ui/colormenubutton.js | 4 +- .../goog/ui/colormenubuttonrenderer.js | 3 - third_party/closure/goog/ui/colorpalette.js | 1 - third_party/closure/goog/ui/colorpicker.js | 1 - .../closure/goog/ui/colorsplitbehavior.js | 59 - third_party/closure/goog/ui/combobox.js | 12 +- third_party/closure/goog/ui/component.js | 114 +- third_party/closure/goog/ui/componentutil.js | 36 + third_party/closure/goog/ui/container.js | 75 +- .../closure/goog/ui/container_perf.html | 55 - .../closure/goog/ui/containerrenderer.js | 11 +- .../closure/goog/ui/containerscroller.js | 3 +- third_party/closure/goog/ui/control.js | 68 +- third_party/closure/goog/ui/control_perf.html | 167 - third_party/closure/goog/ui/controlcontent.js | 2 - .../closure/goog/ui/controlrenderer.js | 35 +- .../closure/goog/ui/css3buttonrenderer.js | 11 +- .../closure/goog/ui/css3menubuttonrenderer.js | 1 - third_party/closure/goog/ui/cssnames.js | 2 - third_party/closure/goog/ui/custombutton.js | 4 +- .../closure/goog/ui/custombuttonrenderer.js | 10 +- .../closure/goog/ui/customcolorpalette.js | 2 - third_party/closure/goog/ui/datepicker.js | 108 +- third_party/closure/goog/ui/decorate.js | 2 +- third_party/closure/goog/ui/dialog.js | 54 +- .../closure/goog/ui/dimensionpicker.js | 77 +- .../goog/ui/dimensionpickerrenderer.js | 7 +- .../closure/goog/ui/dragdropdetector.js | 16 +- third_party/closure/goog/ui/drilldownrow.js | 14 +- .../closure/goog/ui/editor/BUILD.bazel | 176 + .../closure/goog/ui/editor/abstractdialog.js | 10 - third_party/closure/goog/ui/editor/bubble.js | 3 +- .../closure/goog/ui/editor/defaulttoolbar.js | 100 +- .../closure/goog/ui/editor/linkdialog.js | 98 +- .../closure/goog/ui/editor/messages.js | 76 +- third_party/closure/goog/ui/editor/tabpane.js | 7 +- .../goog/ui/editor/toolbarcontroller.js | 13 +- .../closure/goog/ui/editor/toolbarfactory.js | 25 +- third_party/closure/goog/ui/emoji/BUILD.bazel | 103 + third_party/closure/goog/ui/emoji/emoji.js | 1 - .../closure/goog/ui/emoji/emojipalette.js | 1 - .../goog/ui/emoji/emojipaletterenderer.js | 4 +- .../closure/goog/ui/emoji/emojipicker.js | 15 +- .../closure/goog/ui/emoji/popupemojipicker.js | 6 +- .../emoji/progressiveemojipaletterenderer.js | 6 +- .../closure/goog/ui/emoji/spriteinfo.js | 5 +- third_party/closure/goog/ui/filteredmenu.js | 19 +- .../goog/ui/filterobservingmenuitem.js | 4 +- .../ui/filterobservingmenuitemrenderer.js | 2 - .../closure/goog/ui/flatbuttonrenderer.js | 8 +- .../closure/goog/ui/flatmenubuttonrenderer.js | 11 +- third_party/closure/goog/ui/formpost.js | 3 +- third_party/closure/goog/ui/gauge.js | 1 + third_party/closure/goog/ui/hovercard.js | 15 +- third_party/closure/goog/ui/hsvapalette.js | 3 +- third_party/closure/goog/ui/hsvpalette.js | 14 +- third_party/closure/goog/ui/idgenerator.js | 24 +- third_party/closure/goog/ui/idletimer.js | 1 - third_party/closure/goog/ui/iframemask.js | 3 - .../goog/ui/imagelessbuttonrenderer.js | 1 - .../goog/ui/imagelessmenubuttonrenderer.js | 1 - .../closure/goog/ui/inputdatepicker.js | 12 +- third_party/closure/goog/ui/itemevent.js | 1 - .../closure/goog/ui/keyboardeventdata.js | 321 + .../goog/ui/keyboardshortcuthandler.js | 269 +- third_party/closure/goog/ui/labelinput.js | 30 +- .../closure/goog/ui/linkbuttonrenderer.js | 2 - third_party/closure/goog/ui/media/BUILD.bazel | 163 + .../closure/goog/ui/media/flashobject.js | 14 +- third_party/closure/goog/ui/media/flickr.js | 20 +- .../closure/goog/ui/media/googlevideo.js | 41 +- third_party/closure/goog/ui/media/media.js | 37 +- .../closure/goog/ui/media/mediamodel.js | 5 +- third_party/closure/goog/ui/media/mp3.js | 18 +- third_party/closure/goog/ui/media/photo.js | 12 +- third_party/closure/goog/ui/media/picasa.js | 29 +- third_party/closure/goog/ui/media/vimeo.js | 46 +- third_party/closure/goog/ui/media/youtube.js | 68 +- third_party/closure/goog/ui/menu.js | 6 +- .../closure/goog/ui/menubardecorator.js | 1 - .../closure/goog/ui/menubarrenderer.js | 3 +- third_party/closure/goog/ui/menubase.js | 1 - third_party/closure/goog/ui/menubutton.js | 64 +- .../closure/goog/ui/menubuttonrenderer.js | 2 - third_party/closure/goog/ui/menuheader.js | 1 - .../closure/goog/ui/menuheaderrenderer.js | 1 - third_party/closure/goog/ui/menuitem.js | 8 +- .../closure/goog/ui/menuitemrenderer.js | 4 +- third_party/closure/goog/ui/menurenderer.js | 3 +- third_party/closure/goog/ui/menuseparator.js | 2 - .../closure/goog/ui/menuseparatorrenderer.js | 2 - third_party/closure/goog/ui/modalpopup.js | 11 +- .../closure/goog/ui/nativebuttonrenderer.js | 8 +- third_party/closure/goog/ui/option.js | 2 - third_party/closure/goog/ui/palette.js | 12 +- .../closure/goog/ui/paletterenderer.js | 59 +- .../closure/goog/ui/plaintextspellchecker.js | 7 +- third_party/closure/goog/ui/popup.js | 1 - third_party/closure/goog/ui/popupbase.js | 12 +- .../closure/goog/ui/popupcolorpicker.js | 6 +- .../closure/goog/ui/popupdatepicker.js | 71 +- third_party/closure/goog/ui/popupmenu.js | 47 +- third_party/closure/goog/ui/progressbar.js | 14 +- third_party/closure/goog/ui/prompt.js | 23 +- third_party/closure/goog/ui/rangemodel.js | 2 - third_party/closure/goog/ui/ratings.js | 14 +- third_party/closure/goog/ui/registry.js | 20 +- .../closure/goog/ui/richtextspellchecker.js | 13 +- third_party/closure/goog/ui/roundedpanel.js | 2 +- .../closure/goog/ui/roundedtabrenderer.js | 2 - third_party/closure/goog/ui/scrollfloater.js | 8 +- third_party/closure/goog/ui/select.js | 5 +- .../closure/goog/ui/selectionmenubutton.js | 3 + third_party/closure/goog/ui/selectionmodel.js | 20 +- third_party/closure/goog/ui/separator.js | 2 - third_party/closure/goog/ui/serverchart.js | 50 +- third_party/closure/goog/ui/slider.js | 15 +- third_party/closure/goog/ui/sliderbase.js | 48 +- third_party/closure/goog/ui/splitbehavior.js | 335 - third_party/closure/goog/ui/splitpane.js | 16 +- .../closure/goog/ui/style/app/BUILD.bazel | 58 + .../goog/ui/style/app/buttonrenderer.js | 2 - .../goog/ui/style/app/menubuttonrenderer.js | 3 +- .../style/app/primaryactionbuttonrenderer.js | 1 - third_party/closure/goog/ui/submenu.js | 34 +- .../closure/goog/ui/submenurenderer.js | 3 +- .../closure/goog/ui/synthetickeyboardevent.js | 140 + third_party/closure/goog/ui/tab.js | 1 - third_party/closure/goog/ui/tabbar.js | 15 +- third_party/closure/goog/ui/tabbarrenderer.js | 8 +- third_party/closure/goog/ui/tablesorter.js | 11 +- third_party/closure/goog/ui/tabpane.js | 30 +- third_party/closure/goog/ui/tabrenderer.js | 6 +- third_party/closure/goog/ui/textarea.js | 10 +- .../closure/goog/ui/textarearenderer.js | 2 +- third_party/closure/goog/ui/togglebutton.js | 2 - third_party/closure/goog/ui/toolbar.js | 3 +- third_party/closure/goog/ui/toolbarbutton.js | 2 - .../closure/goog/ui/toolbarbuttonrenderer.js | 2 - .../closure/goog/ui/toolbarcolormenubutton.js | 2 - .../goog/ui/toolbarcolormenubuttonrenderer.js | 2 - .../closure/goog/ui/toolbarmenubutton.js | 2 - .../goog/ui/toolbarmenubuttonrenderer.js | 2 - .../closure/goog/ui/toolbarrenderer.js | 4 +- third_party/closure/goog/ui/toolbarselect.js | 2 - .../closure/goog/ui/toolbarseparator.js | 2 - .../goog/ui/toolbarseparatorrenderer.js | 2 - .../closure/goog/ui/toolbartogglebutton.js | 2 - third_party/closure/goog/ui/tooltip.js | 31 +- third_party/closure/goog/ui/tree/BUILD.bazel | 78 + third_party/closure/goog/ui/tree/basenode.js | 11 +- .../closure/goog/ui/tree/treecontrol.js | 2 - third_party/closure/goog/ui/tree/treenode.js | 7 +- third_party/closure/goog/ui/tree/typeahead.js | 4 +- .../closure/goog/ui/tristatemenuitem.js | 4 +- .../goog/ui/tristatemenuitemrenderer.js | 2 - third_party/closure/goog/ui/zippy.js | 46 +- third_party/closure/goog/uri/BUILD.bazel | 41 + third_party/closure/goog/uri/uri.js | 58 +- third_party/closure/goog/uri/utils.js | 11 +- .../closure/goog/useragent/BUILD.bazel | 129 + .../closure/goog/useragent/adobereader.js | 113 +- third_party/closure/goog/useragent/flash.js | 64 +- third_party/closure/goog/useragent/iphoto.js | 3 +- third_party/closure/goog/useragent/jscript.js | 67 +- .../closure/goog/useragent/keyboard.js | 3 +- .../closure/goog/useragent/platform.js | 10 +- third_party/closure/goog/useragent/product.js | 23 +- .../goog/useragent/product_isversion.js | 3 +- .../closure/goog/useragent/useragent.js | 116 +- .../goog/useragent/useragenttestutil.js | 4 +- third_party/closure/goog/vec/BUILD.bazel | 199 + third_party/closure/goog/vec/float32array.js | 5 +- third_party/closure/goog/vec/float64array.js | 5 +- third_party/closure/goog/vec/mat3.js | 13 +- third_party/closure/goog/vec/mat3d.js | 3 +- third_party/closure/goog/vec/mat3f.js | 3 +- third_party/closure/goog/vec/mat4.js | 11 +- third_party/closure/goog/vec/mat4d.js | 3 +- third_party/closure/goog/vec/mat4f.js | 3 +- third_party/closure/goog/vec/matrix3.js | 707 - third_party/closure/goog/vec/matrix4.js | 1344 - third_party/closure/goog/vec/quaternion.js | 11 +- third_party/closure/goog/vec/vec.js | 2 +- third_party/closure/goog/vec/vec2.js | 13 +- third_party/closure/goog/vec/vec2d.js | 7 +- third_party/closure/goog/vec/vec2f.js | 7 +- third_party/closure/goog/vec/vec3.js | 17 +- third_party/closure/goog/vec/vec3d.js | 7 +- third_party/closure/goog/vec/vec3f.js | 7 +- third_party/closure/goog/vec/vec4.js | 17 +- third_party/closure/goog/vec/vec4d.js | 7 +- third_party/closure/goog/vec/vec4f.js | 7 +- .../closure/goog/vec/vec_array_perf.html | 443 - third_party/closure/goog/vec/vec_perf.html | 101 - third_party/closure/goog/webgl/BUILD.bazel | 19 + third_party/closure/goog/window/BUILD.bazel | 30 + third_party/closure/goog/window/window.js | 64 +- 1123 files changed, 172416 insertions(+), 126976 deletions(-) create mode 100644 third_party/closure/goog/a11y/aria/BUILD.bazel create mode 100644 third_party/closure/goog/array/BUILD.bazel create mode 100644 third_party/closure/goog/asserts/BUILD.bazel create mode 100644 third_party/closure/goog/async/BUILD.bazel create mode 100644 third_party/closure/goog/bootstrap/BUILD.bazel create mode 100644 third_party/closure/goog/collections/BUILD.bazel create mode 100644 third_party/closure/goog/collections/sets.js create mode 100644 third_party/closure/goog/color/BUILD.bazel create mode 100644 third_party/closure/goog/conformance_proto.txt create mode 100644 third_party/closure/goog/crypt/BUILD.bazel delete mode 100644 third_party/closure/goog/crypt/bytestring_perf.html delete mode 100644 third_party/closure/goog/crypt/crypt_perf.html delete mode 100644 third_party/closure/goog/crypt/md5_perf.html delete mode 100644 third_party/closure/goog/crypt/sha1_perf.html delete mode 100644 third_party/closure/goog/crypt/sha224_perf.html delete mode 100644 third_party/closure/goog/crypt/sha256_perf.html delete mode 100644 third_party/closure/goog/crypt/sha512_perf.html create mode 100644 third_party/closure/goog/cssom/BUILD.bazel create mode 100644 third_party/closure/goog/cssom/cssom_test_import_1.css create mode 100644 third_party/closure/goog/cssom/cssom_test_import_2.css create mode 100644 third_party/closure/goog/cssom/cssom_test_link_1.css create mode 100644 third_party/closure/goog/cssom/iframe/BUILD.bazel create mode 100644 third_party/closure/goog/cssom/iframe/style_test_import.css create mode 100644 third_party/closure/goog/datasource/BUILD.bazel create mode 100644 third_party/closure/goog/date/BUILD.bazel create mode 100644 third_party/closure/goog/date/relativecommontests.js delete mode 100644 third_party/closure/goog/date/relativewithplurals.js create mode 100644 third_party/closure/goog/db/BUILD.bazel create mode 100644 third_party/closure/goog/debug/BUILD.bazel create mode 100644 third_party/closure/goog/debug/devcss/BUILD.bazel create mode 100644 third_party/closure/goog/debug/errorcontext.js create mode 100644 third_party/closure/goog/delegate/BUILD.bazel create mode 100644 third_party/closure/goog/delegate/delegateregistry.js create mode 100644 third_party/closure/goog/delegate/delegates.js create mode 100644 third_party/closure/goog/demos/autocompleteremotedata.js create mode 100644 third_party/closure/goog/demos/autocompleterichremotedata.js create mode 100644 third_party/closure/goog/demos/css/demo.css create mode 100644 third_party/closure/goog/demos/css/emojipicker.css create mode 100644 third_party/closure/goog/demos/css/emojisprite.css create mode 100644 third_party/closure/goog/demos/editor/deps.js create mode 100644 third_party/closure/goog/demos/editor/helloworld.js create mode 100644 third_party/closure/goog/demos/editor/helloworlddialog.js create mode 100644 third_party/closure/goog/demos/editor/helloworlddialogplugin.js create mode 100644 third_party/closure/goog/demos/emoji/sprite.png create mode 100644 third_party/closure/goog/demos/emoji/sprite2.png create mode 100644 third_party/closure/goog/demos/graphics/tigerdata.js create mode 100644 third_party/closure/goog/demos/samplecomponent.js create mode 100644 third_party/closure/goog/demos/tree/testdata.js create mode 100644 third_party/closure/goog/demos/xpc/xpcdemo.js create mode 100644 third_party/closure/goog/disposable/BUILD.bazel create mode 100644 third_party/closure/goog/dom/BUILD.bazel create mode 100644 third_party/closure/goog/dom/animationframe/BUILD.bazel create mode 100644 third_party/closure/goog/dom/asserts.js create mode 100644 third_party/closure/goog/dom/browserrange/BUILD.bazel create mode 100644 third_party/closure/goog/dom/pattern/BUILD.bazel create mode 100644 third_party/closure/goog/dom/pattern/callback/BUILD.bazel create mode 100644 third_party/closure/goog/dom/textassert.js create mode 100644 third_party/closure/goog/dom/uri.js create mode 100644 third_party/closure/goog/editor/BUILD.bazel create mode 100644 third_party/closure/goog/editor/plugin_impl.js create mode 100644 third_party/closure/goog/editor/plugins/BUILD.bazel create mode 100644 third_party/closure/goog/events/BUILD.bazel create mode 100644 third_party/closure/goog/format/BUILD.bazel create mode 100644 third_party/closure/goog/fs/BUILD.bazel create mode 100644 third_party/closure/goog/functions/BUILD.bazel create mode 100644 third_party/closure/goog/fx/BUILD.bazel create mode 100644 third_party/closure/goog/fx/anim/BUILD.bazel create mode 100644 third_party/closure/goog/fx/css3/BUILD.bazel create mode 100644 third_party/closure/goog/goog.js create mode 100644 third_party/closure/goog/graphics/BUILD.bazel create mode 100644 third_party/closure/goog/graphics/ext/BUILD.bazel create mode 100644 third_party/closure/goog/history/BUILD.bazel create mode 100644 third_party/closure/goog/html/BUILD.bazel create mode 100644 third_party/closure/goog/html/cssspecificity.js create mode 100644 third_party/closure/goog/html/safeurl_test_vectors.js create mode 100644 third_party/closure/goog/html/sanitizer/BUILD.bazel create mode 100644 third_party/closure/goog/html/sanitizer/csspropertysanitizer.js delete mode 100644 third_party/closure/goog/html/sanitizer/csssanitizer_test.js create mode 100644 third_party/closure/goog/html/sanitizer/elementweakmap.js create mode 100644 third_party/closure/goog/html/sanitizer/html_test_vectors.js delete mode 100644 third_party/closure/goog/html/sanitizer/htmlsanitizer_test.js create mode 100644 third_party/closure/goog/html/sanitizer/noclobber.js create mode 100644 third_party/closure/goog/html/sanitizer/safedomtreeprocessor.js delete mode 100644 third_party/closure/goog/html/sanitizer/unsafe_test.js create mode 100644 third_party/closure/goog/html/textextractor.js create mode 100644 third_party/closure/goog/html/trustedtypes.js create mode 100644 third_party/closure/goog/i18n/BUILD.bazel delete mode 100644 third_party/closure/goog/i18n/compactnumberformatsymbols_ext.js create mode 100644 third_party/closure/goog/i18n/localefeature.js create mode 100644 third_party/closure/goog/i18n/relativedatetimeformat.js create mode 100644 third_party/closure/goog/i18n/relativedatetimesymbols.js create mode 100644 third_party/closure/goog/i18n/relativedatetimesymbolsext.js create mode 100644 third_party/closure/goog/i18n/uchar/BUILD.bazel delete mode 100644 third_party/closure/goog/images/blank.gif delete mode 100644 third_party/closure/goog/images/bubble_left.gif delete mode 100644 third_party/closure/goog/images/bubble_right.gif delete mode 100644 third_party/closure/goog/images/button-bg.gif delete mode 100644 third_party/closure/goog/images/check-outline.gif delete mode 100644 third_party/closure/goog/images/check-sprite.gif delete mode 100644 third_party/closure/goog/images/check.gif delete mode 100644 third_party/closure/goog/images/close_box.gif delete mode 100644 third_party/closure/goog/images/color-swatch-tick.gif delete mode 100644 third_party/closure/goog/images/dialog_close_box.gif delete mode 100644 third_party/closure/goog/images/dropdn.gif delete mode 100644 third_party/closure/goog/images/dropdn_disabled.gif delete mode 100644 third_party/closure/goog/images/dropdown.gif delete mode 100644 third_party/closure/goog/images/gears_bluedot.gif delete mode 100644 third_party/closure/goog/images/gears_online.gif delete mode 100644 third_party/closure/goog/images/gears_paused.gif delete mode 100644 third_party/closure/goog/images/gears_syncing.gif delete mode 100644 third_party/closure/goog/images/hsv-sprite-sm.gif delete mode 100644 third_party/closure/goog/images/hsv-sprite.gif delete mode 100644 third_party/closure/goog/images/hsva-sprite-sm.gif delete mode 100644 third_party/closure/goog/images/hsva-sprite.gif delete mode 100644 third_party/closure/goog/images/left_anchor_bubble_bot.gif delete mode 100644 third_party/closure/goog/images/left_anchor_bubble_top.gif delete mode 100644 third_party/closure/goog/images/menu-arrows.gif delete mode 100644 third_party/closure/goog/images/no_anchor_bubble_bot.gif delete mode 100644 third_party/closure/goog/images/no_anchor_bubble_top.gif delete mode 100644 third_party/closure/goog/images/ratingstars.gif delete mode 100644 third_party/closure/goog/images/right_anchor_bubble_bot.gif delete mode 100644 third_party/closure/goog/images/right_anchor_bubble_top.gif delete mode 100644 third_party/closure/goog/images/toolbar-separator.gif delete mode 100644 third_party/closure/goog/images/toolbar_icons.gif delete mode 100644 third_party/closure/goog/images/tree/cleardot.gif delete mode 100644 third_party/closure/goog/images/tree/tree.gif create mode 100644 third_party/closure/goog/iter/BUILD.bazel create mode 100644 third_party/closure/goog/iter/es6.js create mode 100644 third_party/closure/goog/json/BUILD.bazel delete mode 100644 third_party/closure/goog/json/evaljsonprocessor.js delete mode 100644 third_party/closure/goog/json/hybridjsonprocessor.js delete mode 100644 third_party/closure/goog/json/json_perf.html create mode 100644 third_party/closure/goog/json/jsonable.js create mode 100644 third_party/closure/goog/labs/collections/BUILD.bazel create mode 100644 third_party/closure/goog/labs/collections/iterables.js create mode 100644 third_party/closure/goog/labs/dom/BUILD.bazel create mode 100644 third_party/closure/goog/labs/events/BUILD.bazel create mode 100644 third_party/closure/goog/labs/format/BUILD.bazel delete mode 100644 third_party/closure/goog/labs/html/attribute_rewriter.js delete mode 100644 third_party/closure/goog/labs/html/sanitizer.js delete mode 100644 third_party/closure/goog/labs/html/scrubber.js create mode 100644 third_party/closure/goog/labs/i18n/BUILD.bazel delete mode 100644 third_party/closure/goog/labs/iterable/iterable.js create mode 100644 third_party/closure/goog/labs/mock/BUILD.bazel create mode 100644 third_party/closure/goog/labs/mock/timeoutmode.js create mode 100644 third_party/closure/goog/labs/net/BUILD.bazel delete mode 100644 third_party/closure/goog/labs/net/testdata/cleardot.gif create mode 100644 third_party/closure/goog/labs/net/webchannel/BUILD.bazel create mode 100644 third_party/closure/goog/labs/net/webchannel/environment.js delete mode 100644 third_party/closure/goog/labs/object/object.js delete mode 100644 third_party/closure/goog/labs/promise/promise.js create mode 100644 third_party/closure/goog/labs/pubsub/BUILD.bazel create mode 100644 third_party/closure/goog/labs/storage/BUILD.bazel create mode 100644 third_party/closure/goog/labs/structs/BUILD.bazel delete mode 100644 third_party/closure/goog/labs/structs/map.js delete mode 100644 third_party/closure/goog/labs/structs/map_perf.js create mode 100644 third_party/closure/goog/labs/style/BUILD.bazel create mode 100644 third_party/closure/goog/labs/testing/BUILD.bazel create mode 100644 third_party/closure/goog/labs/useragent/BUILD.bazel create mode 100644 third_party/closure/goog/labs/useragent/extra.js create mode 100644 third_party/closure/goog/loader/BUILD.bazel create mode 100644 third_party/closure/goog/loader/abstractmodulemanager.js create mode 100644 third_party/closure/goog/loader/activemodulemanager.js create mode 100644 third_party/closure/goog/locale/BUILD.bazel create mode 100644 third_party/closure/goog/log/BUILD.bazel create mode 100644 third_party/closure/goog/math/BUILD.bazel create mode 100644 third_party/closure/goog/math/interpolator/BUILD.bazel create mode 100644 third_party/closure/goog/memoize/BUILD.bazel create mode 100644 third_party/closure/goog/messaging/BUILD.bazel delete mode 100644 third_party/closure/goog/messaging/testdata/portchannel_inner.html delete mode 100644 third_party/closure/goog/messaging/testdata/portchannel_wrong_origin_inner.html delete mode 100644 third_party/closure/goog/messaging/testdata/portnetwork_inner.html create mode 100644 third_party/closure/goog/mochikit/async/BUILD.bazel create mode 100644 third_party/closure/goog/mochikit/async/deferred.js create mode 100644 third_party/closure/goog/mochikit/async/deferredlist.js create mode 100644 third_party/closure/goog/module/BUILD.bazel create mode 100644 third_party/closure/goog/net/BUILD.bazel create mode 100644 third_party/closure/goog/net/crossdomainrpc_test.css create mode 100644 third_party/closure/goog/net/rpc/BUILD.bazel delete mode 100644 third_party/closure/goog/net/rpc/httpcors_test.js create mode 100644 third_party/closure/goog/net/streams/BUILD.bazel create mode 100644 third_party/closure/goog/net/xpc/BUILD.bazel delete mode 100644 third_party/closure/goog/net/xpc/frameelementmethodtransport.js delete mode 100644 third_party/closure/goog/net/xpc/iframerelaytransport.js delete mode 100644 third_party/closure/goog/net/xpc/nixtransport.js delete mode 100644 third_party/closure/goog/net/xpc/testdata/access_checker.html delete mode 100644 third_party/closure/goog/net/xpc/testdata/inner_peer.html create mode 100644 third_party/closure/goog/object/BUILD.bazel create mode 100644 third_party/closure/goog/positioning/BUILD.bazel create mode 100644 third_party/closure/goog/promise/BUILD.bazel create mode 100644 third_party/closure/goog/promise/nativeresolver.js create mode 100644 third_party/closure/goog/proto/BUILD.bazel create mode 100644 third_party/closure/goog/proto2/BUILD.bazel create mode 100644 third_party/closure/goog/proto2/package_test.pb.js create mode 100644 third_party/closure/goog/pubsub/BUILD.bazel delete mode 100644 third_party/closure/goog/pubsub/pubsub_perf.html create mode 100644 third_party/closure/goog/reflect/BUILD.bazel create mode 100644 third_party/closure/goog/result/BUILD.bazel create mode 100644 third_party/closure/goog/soy/BUILD.bazel create mode 100644 third_party/closure/goog/soy/soy_testhelper.js create mode 100644 third_party/closure/goog/spell/BUILD.bazel create mode 100644 third_party/closure/goog/stats/BUILD.bazel create mode 100644 third_party/closure/goog/storage/BUILD.bazel create mode 100644 third_party/closure/goog/storage/mechanism/BUILD.bazel create mode 100644 third_party/closure/goog/streams/BUILD.bazel create mode 100644 third_party/closure/goog/streams/defines.js create mode 100644 third_party/closure/goog/streams/full.js create mode 100644 third_party/closure/goog/streams/full_impl.js create mode 100644 third_party/closure/goog/streams/full_native_impl.js create mode 100644 third_party/closure/goog/streams/full_test_cases.js create mode 100644 third_party/closure/goog/streams/full_types.js create mode 100644 third_party/closure/goog/streams/lite.js create mode 100644 third_party/closure/goog/streams/lite_impl.js create mode 100644 third_party/closure/goog/streams/lite_native_impl.js create mode 100644 third_party/closure/goog/streams/lite_test_cases.js create mode 100644 third_party/closure/goog/streams/lite_types.js create mode 100644 third_party/closure/goog/string/BUILD.bazel create mode 100644 third_party/closure/goog/string/internal.js create mode 100644 third_party/closure/goog/structs/BUILD.bazel delete mode 100644 third_party/closure/goog/structs/queue_perf.html delete mode 100644 third_party/closure/goog/structs/set_perf.html delete mode 100644 third_party/closure/goog/structs/weak/weak.js create mode 100644 third_party/closure/goog/style/BUILD.bazel create mode 100644 third_party/closure/goog/test_module.js create mode 100644 third_party/closure/goog/test_module_dep.js create mode 100644 third_party/closure/goog/testing/BUILD.bazel create mode 100644 third_party/closure/goog/testing/assertionfailure.js create mode 100644 third_party/closure/goog/testing/async/BUILD.bazel create mode 100644 third_party/closure/goog/testing/editor/BUILD.bazel create mode 100644 third_party/closure/goog/testing/events/BUILD.bazel create mode 100644 third_party/closure/goog/testing/fs/BUILD.bazel create mode 100644 third_party/closure/goog/testing/i18n/BUILD.bazel create mode 100644 third_party/closure/goog/testing/messaging/BUILD.bazel create mode 100644 third_party/closure/goog/testing/net/BUILD.bazel create mode 100644 third_party/closure/goog/testing/proto2/BUILD.bazel create mode 100644 third_party/closure/goog/testing/storage/BUILD.bazel create mode 100644 third_party/closure/goog/testing/style/BUILD.bazel create mode 100644 third_party/closure/goog/testing/ui/BUILD.bazel delete mode 100644 third_party/closure/goog/testing/ui/style_reference.html create mode 100644 third_party/closure/goog/timer/BUILD.bazel create mode 100644 third_party/closure/goog/transitionalforwarddeclarations.js create mode 100644 third_party/closure/goog/transpile.js create mode 100644 third_party/closure/goog/tweak/BUILD.bazel create mode 100644 third_party/closure/goog/ui/BUILD.bazel create mode 100644 third_party/closure/goog/ui/ac/BUILD.bazel delete mode 100644 third_party/closure/goog/ui/button_perf.html delete mode 100644 third_party/closure/goog/ui/colorbutton.js delete mode 100644 third_party/closure/goog/ui/colorbuttonrenderer.js delete mode 100644 third_party/closure/goog/ui/colorsplitbehavior.js create mode 100644 third_party/closure/goog/ui/componentutil.js delete mode 100644 third_party/closure/goog/ui/container_perf.html delete mode 100644 third_party/closure/goog/ui/control_perf.html create mode 100644 third_party/closure/goog/ui/editor/BUILD.bazel create mode 100644 third_party/closure/goog/ui/emoji/BUILD.bazel create mode 100644 third_party/closure/goog/ui/keyboardeventdata.js create mode 100644 third_party/closure/goog/ui/media/BUILD.bazel delete mode 100644 third_party/closure/goog/ui/splitbehavior.js create mode 100644 third_party/closure/goog/ui/style/app/BUILD.bazel create mode 100644 third_party/closure/goog/ui/synthetickeyboardevent.js create mode 100644 third_party/closure/goog/ui/tree/BUILD.bazel create mode 100644 third_party/closure/goog/uri/BUILD.bazel create mode 100644 third_party/closure/goog/useragent/BUILD.bazel create mode 100644 third_party/closure/goog/vec/BUILD.bazel delete mode 100644 third_party/closure/goog/vec/matrix3.js delete mode 100644 third_party/closure/goog/vec/matrix4.js delete mode 100644 third_party/closure/goog/vec/vec_array_perf.html delete mode 100644 third_party/closure/goog/vec/vec_perf.html create mode 100644 third_party/closure/goog/webgl/BUILD.bazel create mode 100644 third_party/closure/goog/window/BUILD.bazel diff --git a/javascript/atoms/BUILD.bazel b/javascript/atoms/BUILD.bazel index 02b961abf2fd7..204267689b419 100644 --- a/javascript/atoms/BUILD.bazel +++ b/javascript/atoms/BUILD.bazel @@ -40,11 +40,11 @@ closure_js_library( ":dom", ":errors", ":events", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom:tagname", - "@io_bazel_rules_closure//closure/library/math:coordinate", - "@io_bazel_rules_closure//closure/library/math:vec2", - "@io_bazel_rules_closure//closure/library/style", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/math:coordinate", + "//third_party/closure/goog/math:vec2", + "//third_party/closure/goog/style", ], ) @@ -63,8 +63,8 @@ closure_js_library( "JSC_USE_OF_GOOG_PROVIDE", ], deps = [ - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/color:names", + "//third_party/closure/goog/array", + "//third_party/closure/goog/color:names", ], ) @@ -91,15 +91,15 @@ closure_js_library( ":events", ":locators", ":useragent", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/dom:selection", - "@io_bazel_rules_closure//closure/library/dom:tagname", - "@io_bazel_rules_closure//closure/library/math:coordinate", - "@io_bazel_rules_closure//closure/library/structs:map", - "@io_bazel_rules_closure//closure/library/structs:set", - "@io_bazel_rules_closure//closure/library/useragent", - "@io_bazel_rules_closure//closure/library/useragent:product", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:selection", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/math:coordinate", + "//third_party/closure/goog/structs:map", + "//third_party/closure/goog/structs:set", + "//third_party/closure/goog/useragent", + "//third_party/closure/goog/useragent:product", ], ) @@ -115,10 +115,10 @@ closure_js_library( deps = [ ":errors", ":useragent", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/dom:nodetype", - "@io_bazel_rules_closure//closure/library/dom:tagname", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/dom:tagname", ], ) @@ -139,16 +139,16 @@ closure_js_library( ":domcore", ":json", ":useragent", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/dom:nodetype", - "@io_bazel_rules_closure//closure/library/dom:tagname", - "@io_bazel_rules_closure//closure/library/math", - "@io_bazel_rules_closure//closure/library/math:coordinate", - "@io_bazel_rules_closure//closure/library/math:rect", - "@io_bazel_rules_closure//closure/library/string", - "@io_bazel_rules_closure//closure/library/style", - "@io_bazel_rules_closure//closure/library/useragent", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/math", + "//third_party/closure/goog/math:coordinate", + "//third_party/closure/goog/math:rect", + "//third_party/closure/goog/string", + "//third_party/closure/goog/style", + "//third_party/closure/goog/useragent", ], ) @@ -183,12 +183,12 @@ closure_js_library( ":errors", ":json", ":useragent", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/events:browserevent", - "@io_bazel_rules_closure//closure/library/style", - "@io_bazel_rules_closure//closure/library/useragent", - "@io_bazel_rules_closure//closure/library/useragent:product", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/events:browserevent", + "//third_party/closure/goog/style", + "//third_party/closure/goog/useragent", + "//third_party/closure/goog/useragent:product", ], ) @@ -209,8 +209,8 @@ closure_js_library( ":dom", ":errors", ":locators", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/dom:tagname", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:tagname", ], ) @@ -228,7 +228,7 @@ closure_js_library( ":errors", ":json", ":useragent", - "@io_bazel_rules_closure//closure/library/useragent:all_js", + "//third_party/closure/goog/useragent:all_js", ], ) @@ -250,10 +250,10 @@ closure_js_library( ":bot", ":errors", ":json", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom:nodetype", - "@io_bazel_rules_closure//closure/library/object", - "@io_bazel_rules_closure//closure/library/useragent", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/object", + "//third_party/closure/goog/useragent", ], ) @@ -265,8 +265,8 @@ closure_js_library( ], deps = [ ":useragent", - "@io_bazel_rules_closure//closure/library/json", - "@io_bazel_rules_closure//closure/library/useragent", + "//third_party/closure/goog/json", + "//third_party/closure/goog/useragent", ], ) @@ -290,13 +290,13 @@ closure_js_library( ":errors", ":json", ":useragent", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/dom:nodetype", - "@io_bazel_rules_closure//closure/library/math:rect", - "@io_bazel_rules_closure//closure/library/string", - "@io_bazel_rules_closure//closure/library/useragent", - "@io_bazel_rules_closure//closure/library/useragent:product", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/math:rect", + "//third_party/closure/goog/string", + "//third_party/closure/goog/useragent", + "//third_party/closure/goog/useragent:product", ], ) @@ -309,10 +309,10 @@ closure_js_library( "JSC_USE_OF_GOOG_PROVIDE", ], deps = [ - "@io_bazel_rules_closure//closure/library/string", - "@io_bazel_rules_closure//closure/library/useragent", - "@io_bazel_rules_closure//closure/library/useragent:product", - "@io_bazel_rules_closure//closure/library/useragent:product_isversion", + "//third_party/closure/goog/string", + "//third_party/closure/goog/useragent", + "//third_party/closure/goog/useragent:product", + "//third_party/closure/goog/useragent:product_isversion", ], ) @@ -347,9 +347,9 @@ closure_js_library( ":bot", ":errors", ":useragent", - "@io_bazel_rules_closure//closure/library/dom:nodetype", - "@io_bazel_rules_closure//closure/library/string", - "@io_bazel_rules_closure//closure/library/useragent", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/string", + "//third_party/closure/goog/useragent", ], ) diff --git a/javascript/atoms/fragments/BUILD.bazel b/javascript/atoms/fragments/BUILD.bazel index cf18aed671e80..2bbe6e6678fc2 100644 --- a/javascript/atoms/fragments/BUILD.bazel +++ b/javascript/atoms/fragments/BUILD.bazel @@ -108,7 +108,7 @@ closure_fragment( "//javascript/chrome-driver:__pkg__", ], deps = [ - "@io_bazel_rules_closure//closure/library/style", + "//third_party/closure/goog/style", ], ) diff --git a/javascript/atoms/test/test_bootstrap.js b/javascript/atoms/test/test_bootstrap.js index 84186cec89325..955116c00fd7d 100644 --- a/javascript/atoms/test/test_bootstrap.js +++ b/javascript/atoms/test/test_bootstrap.js @@ -58,14 +58,14 @@ // All the files to load. Files are specified in the order they must be // loaded, NOT alphabetical order. var files = [ - '../../../third_party/closure/goog/base.js', + '/filez/_main/third_party/closure/goog/base.js', 'deps.js' ]; if (location.pathname.lastIndexOf('/filez/_main/javascript/', 0) === 0) { directoryPath = ''; files = [ - '/filez/com_google_javascript_closure_library/closure/goog/base.js', + '/filez/_main/third_party/closure/goog/base.js', '/filez/_main/javascript/atoms/deps.js', ]; } diff --git a/javascript/chrome-driver/BUILD.bazel b/javascript/chrome-driver/BUILD.bazel index f06b66c43718b..9622666958f4a 100644 --- a/javascript/chrome-driver/BUILD.bazel +++ b/javascript/chrome-driver/BUILD.bazel @@ -15,11 +15,11 @@ closure_js_library( deps = [ "//javascript/atoms:dom", "//javascript/atoms:locators", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/math:coordinate", - "@io_bazel_rules_closure//closure/library/math:rect", - "@io_bazel_rules_closure//closure/library/math:size", - "@io_bazel_rules_closure//closure/library/style", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/math:coordinate", + "//third_party/closure/goog/math:rect", + "//third_party/closure/goog/math:size", + "//third_party/closure/goog/style", ], ) @@ -29,7 +29,7 @@ closure_fragment( function = "goog.style.getPageOffset", module = "goog.style", deps = [ - "@io_bazel_rules_closure//closure/library/style", + "//third_party/closure/goog/style", ], ) diff --git a/javascript/chrome-driver/test/test_bootstrap.js b/javascript/chrome-driver/test/test_bootstrap.js index 389c04a2b048a..54a3342ff8a85 100644 --- a/javascript/chrome-driver/test/test_bootstrap.js +++ b/javascript/chrome-driver/test/test_bootstrap.js @@ -63,7 +63,7 @@ if (location.pathname.lastIndexOf('/filez/_main/javascript/', 0) === 0) { directoryPath = ''; files = [ - '/filez/com_google_javascript_closure_library/closure/goog/base.js', + '/filez/_main/third_party/closure/goog/base.js', '/filez/_main/javascript/chrome-driver/deps.js', ]; } diff --git a/javascript/ie-driver/BUILD.bazel b/javascript/ie-driver/BUILD.bazel index ada49881dc71b..d1640d8cd439d 100644 --- a/javascript/ie-driver/BUILD.bazel +++ b/javascript/ie-driver/BUILD.bazel @@ -23,8 +23,8 @@ closure_js_library( "//javascript/atoms:errors", "//javascript/atoms:locators", "//javascript/atoms:useragent", - "@io_bazel_rules_closure//closure/library/math:coordinate", - "@io_bazel_rules_closure//closure/library/style", + "//third_party/closure/goog/math:coordinate", + "//third_party/closure/goog/style", ], ) diff --git a/javascript/private/closure_js_deps.bzl b/javascript/private/closure_js_deps.bzl index 292cd5e405038..c406a064022dc 100644 --- a/javascript/private/closure_js_deps.bzl +++ b/javascript/private/closure_js_deps.bzl @@ -98,8 +98,7 @@ def closure_js_deps(name, deps = [], testonly = None, **kwargs): $(location //javascript/private:closure_make_deps) \\ --closure-path $$(pwd)/external/com_google_javascript_closure_library/closure \\ --no-validate \\ - $$FILES | \\ - sed 's|../../../javascript/|../../../_main/javascript/|g' \\ + $$FILES \\ > $@ """, tools = ["//javascript/private:closure_make_deps"], diff --git a/javascript/private/test_suite.bzl b/javascript/private/test_suite.bzl index d8453c0368d1a..bf4bb2063ce86 100644 --- a/javascript/private/test_suite.bzl +++ b/javascript/private/test_suite.bzl @@ -3,7 +3,10 @@ load("//java:defs.bzl", "selenium_test") def closure_test_suite(name, data = [], browsers = None): data = data + [ - "@com_google_javascript_closure_library//:com_google_javascript_closure_library", + "//third_party/closure/goog:base", + "//third_party/closure/goog:deps", + "//third_party/closure/goog:library", + "//third_party/closure/goog/testing", ] selenium_test( diff --git a/javascript/webdriver/atoms/BUILD.bazel b/javascript/webdriver/atoms/BUILD.bazel index b47514b00e39d..ba739cb1f5b99 100644 --- a/javascript/webdriver/atoms/BUILD.bazel +++ b/javascript/webdriver/atoms/BUILD.bazel @@ -37,11 +37,11 @@ closure_js_library( "//javascript/atoms:domcore", "//javascript/atoms:html5", "//javascript/webdriver:key", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom", - "@io_bazel_rules_closure//closure/library/dom:tagname", - "@io_bazel_rules_closure//closure/library/math:coordinate", - "@io_bazel_rules_closure//closure/library/style", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/math:coordinate", + "//third_party/closure/goog/style", ], ) @@ -55,8 +55,8 @@ closure_js_library( visibility = ["//visibility:private"], deps = [ "//javascript/atoms:domcore", - "@io_bazel_rules_closure//closure/library/array", - "@io_bazel_rules_closure//closure/library/dom:tagname", + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom:tagname", ], ) diff --git a/javascript/webdriver/atoms/inject/BUILD.bazel b/javascript/webdriver/atoms/inject/BUILD.bazel index f74069ab3d655..da7e4cdf44e79 100644 --- a/javascript/webdriver/atoms/inject/BUILD.bazel +++ b/javascript/webdriver/atoms/inject/BUILD.bazel @@ -38,7 +38,7 @@ closure_js_library( "//javascript/atoms:action", "//javascript/atoms:inject", "//javascript/webdriver/atoms:atoms-lib", - "@io_bazel_rules_closure//closure/library/json", + "//third_party/closure/goog/json", ], ) @@ -68,7 +68,7 @@ closure_js_library( "//javascript/atoms:inject", "//javascript/atoms:useragent", "//javascript/webdriver/atoms:atoms-lib", - "@io_bazel_rules_closure//closure/library/json", + "//third_party/closure/goog/json", ], ) @@ -97,7 +97,7 @@ closure_js_library( ":execute-script", "//javascript/atoms:inject", "//javascript/atoms:locators", - "@io_bazel_rules_closure//closure/library/json", + "//third_party/closure/goog/json", ], ) diff --git a/javascript/webdriver/test/test_bootstrap.js b/javascript/webdriver/test/test_bootstrap.js index eaadf8c52e5d8..fbef8cdd01b4d 100644 --- a/javascript/webdriver/test/test_bootstrap.js +++ b/javascript/webdriver/test/test_bootstrap.js @@ -65,7 +65,7 @@ || location.pathname.lastIndexOf('/common/generated/javascript/', 0) === 0) { directoryPath = ''; files = [ - '/filez/com_google_javascript_closure_library/closure/goog/base.js', + '/filez/_main/third_party/closure/goog/base.js', '/filez/_main/javascript/atoms/deps.js', '/filez/_main/javascript/webdriver/deps.js', ]; diff --git a/third_party/closure/goog/BUILD.bazel b/third_party/closure/goog/BUILD.bazel index c7b787bece6bd..f0bb5bde4192a 100644 --- a/third_party/closure/goog/BUILD.bazel +++ b/third_party/closure/goog/BUILD.bazel @@ -1,12 +1,212 @@ -# Only present to allow us to provide the filegroup to the test webserver +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" -filegroup( +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_library") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "library", + exports = [ + "//third_party/closure/goog/a11y/aria:all_js", + "//third_party/closure/goog/array:all_js", + "//third_party/closure/goog/asserts:all_js", + "//third_party/closure/goog/async:all_js", + "//third_party/closure/goog/collections:all_js", + "//third_party/closure/goog/color:all_js", + "//third_party/closure/goog/crypt:all_js", + "//third_party/closure/goog/cssom:all_js", + "//third_party/closure/goog/datasource:all_js", + "//third_party/closure/goog/date:all_js", + "//third_party/closure/goog/db:all_js", + "//third_party/closure/goog/debug:all_js", + "//third_party/closure/goog/delegate:all_js", + "//third_party/closure/goog/disposable:all_js", + "//third_party/closure/goog/dom:all_js", + "//third_party/closure/goog/editor:all_js", + "//third_party/closure/goog/events:all_js", + "//third_party/closure/goog/format:all_js", + "//third_party/closure/goog/fs:all_js", + "//third_party/closure/goog/functions:all_js", + "//third_party/closure/goog/fx:all_js", + "//third_party/closure/goog/graphics:all_js", + "//third_party/closure/goog/history:all_js", + "//third_party/closure/goog/html:all_js", + "//third_party/closure/goog/i18n:all_js", + "//third_party/closure/goog/iter:all_js", + "//third_party/closure/goog/json:all_js", + "//third_party/closure/goog/loader:all_js", + "//third_party/closure/goog/locale:all_js", + "//third_party/closure/goog/log:all_js", + "//third_party/closure/goog/math:all_js", + "//third_party/closure/goog/memoize:all_js", + "//third_party/closure/goog/messaging:all_js", + "//third_party/closure/goog/module:all_js", + "//third_party/closure/goog/net:all_js", + "//third_party/closure/goog/object:all_js", + "//third_party/closure/goog/positioning:all_js", + "//third_party/closure/goog/promise:all_js", + "//third_party/closure/goog/proto:all_js", + "//third_party/closure/goog/proto2:all_js", + "//third_party/closure/goog/pubsub:all_js", + "//third_party/closure/goog/reflect:all_js", + "//third_party/closure/goog/result:all_js", + "//third_party/closure/goog/soy:all_js", + "//third_party/closure/goog/spell:all_js", + "//third_party/closure/goog/stats:all_js", + "//third_party/closure/goog/storage:all_js", + "//third_party/closure/goog/streams:all_js", + "//third_party/closure/goog/string:all_js", + "//third_party/closure/goog/structs:all_js", + "//third_party/closure/goog/style:all_js", + "//third_party/closure/goog/testing:all_js", + "//third_party/closure/goog/timer:all_js", + "//third_party/closure/goog/tweak:all_js", + "//third_party/closure/goog/uri:all_js", + "//third_party/closure/goog/useragent:all_js", + "//third_party/closure/goog/vec:all_js", + "//third_party/closure/goog/webgl:all_js", + "//third_party/closure/goog/window:all_js", + ], +) + +closure_js_library( + name = "testing", + testonly = True, + exports = [ + "//third_party/closure/goog:test_module", + "//third_party/closure/goog:test_module_dep", + "//third_party/closure/goog/crypt:hashtester", + "//third_party/closure/goog/events:eventtargettester", + "//third_party/closure/goog/html:testing", + "//third_party/closure/goog/promise:testsuiteadapter", + "//third_party/closure/goog/proto2:test.pb", + "//third_party/closure/goog/storage:collectablestoragetester", + "//third_party/closure/goog/storage:storagetester", + "//third_party/closure/goog/storage/mechanism:iterablemechanismtester", + "//third_party/closure/goog/storage/mechanism:mechanismseparationtester", + "//third_party/closure/goog/storage/mechanism:mechanismsharingtester", + "//third_party/closure/goog/storage/mechanism:mechanismtestdefinition", + "//third_party/closure/goog/storage/mechanism:mechanismtester", + "//third_party/closure/goog/style:stylescrollbartester", + "//third_party/closure/goog/testing:assertionfailure", + "//third_party/closure/goog/testing:asserts", + "//third_party/closure/goog/testing:asynctestcase", + "//third_party/closure/goog/testing:benchmark", + "//third_party/closure/goog/testing:continuationtestcase", + "//third_party/closure/goog/testing:deferredtestcase", + "//third_party/closure/goog/testing:dom", + "//third_party/closure/goog/testing:expectedfailures", + "//third_party/closure/goog/testing:functionmock", + "//third_party/closure/goog/testing:graphics", + "//third_party/closure/goog/testing:jstdtestcaseadapter", + "//third_party/closure/goog/testing:jsunit", + "//third_party/closure/goog/testing:jsunitexception", + "//third_party/closure/goog/testing:loosemock", + "//third_party/closure/goog/testing:mock", + "//third_party/closure/goog/testing:mockclassfactory", + "//third_party/closure/goog/testing:mockclock", + "//third_party/closure/goog/testing:mockcontrol", + "//third_party/closure/goog/testing:mockinterface", + "//third_party/closure/goog/testing:mockmatchers", + "//third_party/closure/goog/testing:mockrandom", + "//third_party/closure/goog/testing:mockrange", + "//third_party/closure/goog/testing:mockstorage", + "//third_party/closure/goog/testing:mockuseragent", + "//third_party/closure/goog/testing:multitestrunner", + "//third_party/closure/goog/testing:objectpropertystring", + "//third_party/closure/goog/testing:performancetable", + "//third_party/closure/goog/testing:performancetimer", + "//third_party/closure/goog/testing:propertyreplacer", + "//third_party/closure/goog/testing:pseudorandom", + "//third_party/closure/goog/testing:recordfunction", + "//third_party/closure/goog/testing:shardingtestcase", + "//third_party/closure/goog/testing:singleton", + "//third_party/closure/goog/testing:stacktrace", + "//third_party/closure/goog/testing:strictmock", + "//third_party/closure/goog/testing:testcase", + "//third_party/closure/goog/testing:testqueue", + "//third_party/closure/goog/testing:testrunner", + "//third_party/closure/goog/testing:testsuite", + "//third_party/closure/goog/testing/async:mockcontrol", + "//third_party/closure/goog/testing/editor:dom", + "//third_party/closure/goog/testing/editor:fieldmock", + "//third_party/closure/goog/testing/editor:testhelper", + "//third_party/closure/goog/testing/events", + "//third_party/closure/goog/testing/events:eventobserver", + "//third_party/closure/goog/testing/events:matchers", + "//third_party/closure/goog/testing/events:onlinehandler", + "//third_party/closure/goog/testing/fs", + "//third_party/closure/goog/testing/fs:blob", + "//third_party/closure/goog/testing/fs:entry", + "//third_party/closure/goog/testing/fs:file", + "//third_party/closure/goog/testing/fs:filereader", + "//third_party/closure/goog/testing/fs:filesystem", + "//third_party/closure/goog/testing/fs:filewriter", + "//third_party/closure/goog/testing/fs:progressevent", + "//third_party/closure/goog/testing/i18n:asserts", + "//third_party/closure/goog/testing/messaging:mockmessagechannel", + "//third_party/closure/goog/testing/messaging:mockmessageevent", + "//third_party/closure/goog/testing/messaging:mockmessageport", + "//third_party/closure/goog/testing/messaging:mockportnetwork", + "//third_party/closure/goog/testing/net:mockiframeio", + "//third_party/closure/goog/testing/net:xhrio", + "//third_party/closure/goog/testing/net:xhriopool", + "//third_party/closure/goog/testing/proto2", + "//third_party/closure/goog/testing/storage:fakemechanism", + "//third_party/closure/goog/testing/style", + "//third_party/closure/goog/testing/style:layoutasserts", + "//third_party/closure/goog/tweak:testhelpers", + "//third_party/closure/goog/useragent:useragenttestutil", + ], +) + +closure_js_library( name = "goog", - srcs = glob([ - "**/*.js", - ]), - visibility = [ - "//dotnet/test:__subpackages__", - "//java/test/org/openqa/selenium/environment:__pkg__", + srcs = ["goog.js"], + lenient = True, + no_closure_library = True, +) + +closure_js_library( + name = "test_module", + testonly = True, + srcs = ["test_module.js"], + lenient = True, + deps = ["//third_party/closure/goog:test_module_dep"], +) + +closure_js_library( + name = "test_module_dep", + testonly = True, + srcs = ["test_module_dep.js"], + lenient = True, +) + +filegroup( + name = "base", + srcs = [ + "base.js", + "transitionalforwarddeclarations.js", ], ) + +closure_js_library( + name = "deps", + srcs = ["deps.js"], + lenient = True, +) + +closure_js_library( + name = "transpile", + srcs = ["transpile.js"], + lenient = True, +) + +closure_css_library( + name = "css", + srcs = ["@com_google_javascript_closure_library//:css_files"], +) + diff --git a/third_party/closure/goog/a11y/aria/BUILD.bazel b/third_party/closure/goog/a11y/aria/BUILD.bazel new file mode 100644 index 0000000000000..b7d187c788516 --- /dev/null +++ b/third_party/closure/goog/a11y/aria/BUILD.bazel @@ -0,0 +1,73 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [ + ":announcer", + ":aria", + ":attributes", + ":datatables", + ":roles", + ], +) + +closure_js_library( + name = "announcer", + srcs = ["announcer.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/a11y/aria", + "//third_party/closure/goog/a11y/aria:attributes", + "//third_party/closure/goog/disposable", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/object", + "//third_party/closure/goog/timer", + ], +) + +closure_js_library( + name = "aria", + srcs = ["aria.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/a11y/aria:attributes", + "//third_party/closure/goog/a11y/aria:datatables", + "//third_party/closure/goog/a11y/aria:roles", + "//third_party/closure/goog/array", + "//third_party/closure/goog/asserts", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/object", + "//third_party/closure/goog/string", + ], +) + +closure_js_library( + name = "attributes", + srcs = ["attributes.js"], + lenient = True, +) + +closure_js_library( + name = "datatables", + srcs = ["datatables.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/a11y/aria:attributes", + "//third_party/closure/goog/object", + ], +) + +closure_js_library( + name = "roles", + srcs = ["roles.js"], + lenient = True, +) diff --git a/third_party/closure/goog/a11y/aria/aria.js b/third_party/closure/goog/a11y/aria/aria.js index 0df45f98f21fc..e6bab22b5115e 100644 --- a/third_party/closure/goog/a11y/aria/aria.js +++ b/third_party/closure/goog/a11y/aria/aria.js @@ -18,7 +18,6 @@ * states as defined by W3C ARIA standard: http://www.w3.org/TR/wai-aria/ * All modern browsers have some form of ARIA support, so no browser checks are * performed when adding ARIA to components. - * */ goog.provide('goog.a11y.aria'); @@ -304,16 +303,15 @@ goog.a11y.aria.assertRoleIsSetInternalUtil = function(element, allowedRoles) { */ goog.a11y.aria.getStateBoolean = function(element, stateName) { var attr = - /** @type {string|boolean} */ ( - element.getAttribute( - goog.a11y.aria.getAriaAttributeName_(stateName))); + /** @type {string|boolean|null} */ (element.getAttribute( + goog.a11y.aria.getAriaAttributeName_(stateName))); goog.asserts.assert( - goog.isBoolean(attr) || attr == null || attr == 'true' || + typeof attr === 'boolean' || attr == null || attr == 'true' || attr == 'false'); if (attr == null) { return attr; } - return goog.isBoolean(attr) ? attr : attr == 'true'; + return typeof attr === 'boolean' ? attr : attr == 'true'; }; @@ -330,7 +328,7 @@ goog.a11y.aria.getStateNumber = function(element, stateName) { element.getAttribute( goog.a11y.aria.getAriaAttributeName_(stateName))); goog.asserts.assert( - (attr == null || !isNaN(Number(attr))) && !goog.isBoolean(attr)); + (attr == null || !isNaN(Number(attr))) && typeof attr !== 'boolean'); return attr == null ? null : Number(attr); }; @@ -346,7 +344,7 @@ goog.a11y.aria.getStateString = function(element, stateName) { var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)); goog.asserts.assert( - (attr == null || goog.isString(attr)) && + (attr == null || typeof attr === 'string') && (attr == '' || isNaN(Number(attr))) && attr != 'true' && attr != 'false'); return (attr == null || attr == '') ? null : attr; }; diff --git a/third_party/closure/goog/a11y/aria/attributes.js b/third_party/closure/goog/a11y/aria/attributes.js index f4e0a3d0746ab..f1e62358b74a4 100644 --- a/third_party/closure/goog/a11y/aria/attributes.js +++ b/third_party/closure/goog/a11y/aria/attributes.js @@ -62,6 +62,11 @@ goog.a11y.aria.State = { // undefined}. CHECKED: 'checked', + // ARIA state that defines an element's column index or position with respect + // to the total number of columns within a table, grid, or treegrid. + // Value: number. + COLINDEX: 'colindex', + // ARIA property that identifies the element or elements whose contents or // presence are controlled by this element. // Value: space-separated IDs of other elements. @@ -160,6 +165,11 @@ goog.a11y.aria.State = { // before a form may be submitted. Value: one of {true, false}. REQUIRED: 'required', + // ARIA state that defines an element's row index or position with respect + // to the total number of rows within a table, grid, or treegrid. + // Value: number. + ROWINDEX: 'rowindex', + // ARIA state for setting the currently selected item in the list. // Value: one of {true, false, undefined}. SELECTED: 'selected', diff --git a/third_party/closure/goog/array/BUILD.bazel b/third_party/closure/goog/array/BUILD.bazel new file mode 100644 index 0000000000000..92c5a071ae642 --- /dev/null +++ b/third_party/closure/goog/array/BUILD.bazel @@ -0,0 +1,20 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [":array"], +) + +closure_js_library( + name = "array", + srcs = ["array.js"], + lenient = True, + deps = ["//third_party/closure/goog/asserts"], +) diff --git a/third_party/closure/goog/array/array.js b/third_party/closure/goog/array/array.js index 0acfbd85fd056..611f81ed22570 100644 --- a/third_party/closure/goog/array/array.js +++ b/third_party/closure/goog/array/array.js @@ -14,8 +14,6 @@ /** * @fileoverview Utilities for manipulating arrays. - * - * @author arv@google.com (Erik Arvidsson) */ @@ -39,15 +37,17 @@ goog.require('goog.asserts'); * Setting goog.TRUSTED_SITE to false will automatically set * NATIVE_ARRAY_PROTOTYPES to false. */ -goog.define('goog.NATIVE_ARRAY_PROTOTYPES', goog.TRUSTED_SITE); +goog.NATIVE_ARRAY_PROTOTYPES = + goog.define('goog.NATIVE_ARRAY_PROTOTYPES', goog.TRUSTED_SITE); /** * @define {boolean} If true, JSCompiler will use the native implementation of - * array functions where appropriate (e.g., {@code Array#filter}) and remove the + * array functions where appropriate (e.g., `Array#filter`) and remove the * unused pure JS implementation. */ -goog.define('goog.array.ASSUME_NATIVE_FUNCTIONS', false); +goog.array.ASSUME_NATIVE_FUNCTIONS = goog.define( + 'goog.array.ASSUME_NATIVE_FUNCTIONS', goog.FEATURESET_YEAR > 2012); /** @@ -104,9 +104,9 @@ goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex); - if (goog.isString(arr)) { + if (typeof arr === 'string') { // Array.prototype.indexOf uses === so only strings should be found. - if (!goog.isString(obj) || obj.length != 1) { + if (typeof obj !== 'string' || obj.length != 1) { return -1; } return arr.indexOf(obj, fromIndex); @@ -149,9 +149,9 @@ goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && fromIndex = Math.max(0, arr.length + fromIndex); } - if (goog.isString(arr)) { + if (typeof arr === 'string') { // Array.prototype.lastIndexOf uses === so only strings should be found. - if (!goog.isString(obj) || obj.length != 1) { + if (typeof obj !== 'string' || obj.length != 1) { return -1; } return arr.lastIndexOf(obj, fromIndex); @@ -185,7 +185,7 @@ goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && } : function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = 0; i < l; i++) { if (i in arr2) { f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr); @@ -210,7 +210,7 @@ goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && */ goog.array.forEachRight = function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = l - 1; i >= 0; --i) { if (i in arr2) { f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr); @@ -249,7 +249,7 @@ goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && var l = arr.length; // must be fixed during loop... see docs var res = []; var resLength = 0; - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = 0; i < l; i++) { if (i in arr2) { var val = arr2[i]; // in case f mutates arr2 @@ -288,7 +288,7 @@ goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs var res = new Array(l); - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = 0; i < l; i++) { if (i in arr2) { res[i] = f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr); @@ -411,7 +411,7 @@ goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && } : function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = 0; i < l; i++) { if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) { return true; @@ -447,7 +447,7 @@ goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && } : function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = 0; i < l; i++) { if (i in arr2 && !f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) { return false; @@ -495,7 +495,7 @@ goog.array.count = function(arr, f, opt_obj) { */ goog.array.find = function(arr, f, opt_obj) { var i = goog.array.findIndex(arr, f, opt_obj); - return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i]; + return i < 0 ? null : typeof arr === 'string' ? arr.charAt(i) : arr[i]; }; @@ -515,7 +515,7 @@ goog.array.find = function(arr, f, opt_obj) { */ goog.array.findIndex = function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = 0; i < l; i++) { if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) { return i; @@ -541,7 +541,7 @@ goog.array.findIndex = function(arr, f, opt_obj) { */ goog.array.findRight = function(arr, f, opt_obj) { var i = goog.array.findIndexRight(arr, f, opt_obj); - return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i]; + return i < 0 ? null : typeof arr === 'string' ? arr.charAt(i) : arr[i]; }; @@ -561,7 +561,7 @@ goog.array.findRight = function(arr, f, opt_obj) { */ goog.array.findIndexRight = function(arr, f, opt_obj) { var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; + var arr2 = (typeof arr === 'string') ? arr.split('') : arr; for (var i = l - 1; i >= 0; i--) { if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) { return i; @@ -819,7 +819,7 @@ goog.array.join = function(var_args) { goog.array.toArray = function(object) { var length = object.length; - // If length is not a number the following it false. This case is kept for + // If length is not a number the following is false. This case is kept for // backwards compatibility since there are callers that pass objects that are // not array like. if (length > 0) { @@ -855,8 +855,8 @@ goog.array.clone = goog.array.toArray; * a; // [0, 1, 2] * * @param {Array} arr1 The array to modify. - * @param {...(Array|VALUE)} var_args The elements or arrays of elements - * to add to arr1. + * @param {...(IArrayLike|VALUE)} var_args The elements or arrays of + * elements to add to arr1. * @template VALUE */ goog.array.extend = function(arr1, var_args) { @@ -982,8 +982,8 @@ goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) { * behavior for homogeneous arrays of String(s) and Number(s). The array * specified must be sorted in ascending order (as defined by the * comparison function). If the array is not sorted, results are undefined. - * If the array contains multiple instances of the specified target value, any - * of these instances may be found. + * If the array contains multiple instances of the specified target value, the + * left-most instance will be found. * * Runtime: O(log n) * @@ -991,9 +991,9 @@ goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) { * @param {TARGET} target The sought value. * @param {function(TARGET, VALUE): number=} opt_compareFn Optional comparison * function by which the array is ordered. Should take 2 arguments to - * compare, and return a negative number, zero, or a positive number - * depending on whether the first argument is less than, equal to, or - * greater than the second. + * compare, the target value and an element from your array, and return a + * negative number, zero, or a positive number depending on whether the + * first argument is less than, equal to, or greater than the second. * @return {number} Lowest index of the target value if found, otherwise * (-(insertion point) - 1). The insertion point is where the value should * be inserted into arr to preserve the sorted property. Return value >= 0 @@ -1072,7 +1072,7 @@ goog.array.binarySearch_ = function( var right = arr.length; // exclusive var found; while (left < right) { - var middle = (left + right) >> 1; + var middle = left + ((right - left) >>> 1); var compareResult; if (isEvaluator) { compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr); @@ -1091,8 +1091,10 @@ goog.array.binarySearch_ = function( } } // left is the index if found, or the insertion point otherwise. - // ~left is a shorthand for -left - 1. - return found ? left : ~left; + // Avoiding bitwise not operator, as that causes a loss in precision for array + // indexes outside the bounds of a 32-bit signed integer. Array indexes have + // a maximum value of 2^32-2 https://tc39.es/ecma262/#array-index + return found ? left : -left - 1; }; @@ -1201,7 +1203,7 @@ goog.array.sortObjectsByKey = function(arr, key, opt_compareFn) { /** * Tells if the array is sorted. - * @param {!Array} arr The array. + * @param {!IArrayLike} arr The array. * @param {?function(T,T):number=} opt_compareFn Function to compare the * array elements. * Should take 2 arguments to compare, and return a negative number, zero, @@ -1365,15 +1367,15 @@ goog.array.binaryRemove = function(array, value, opt_compareFn) { /** * Splits an array into disjoint buckets according to a splitting function. - * @param {Array} array The array. - * @param {function(this:S, T,number,Array):?} sorter Function to call for - * every element. This takes 3 arguments (the element, the index and the - * array) and must return a valid object key (a string, number, etc), or - * undefined, if that object should not be placed in a bucket. + * @param {IArrayLike} array The array. + * @param {function(this:S, T, number, !IArrayLike):?} sorter Function to + * call for every element. This takes 3 arguments (the element, the index + * and the array) and must return a valid object key (a string, number, + * etc), or undefined, if that object should not be placed in a bucket. * @param {S=} opt_obj The object to be used as the value of 'this' within * sorter. - * @return {!Object} An object, with keys being all of the unique return values - * of sorter, and values being arrays containing the items for + * @return {!Object>} An object, with keys being all of the unique + * return values of sorter, and values being arrays containing the items for * which the splitter returned that key. * @template T,S */ @@ -1383,7 +1385,7 @@ goog.array.bucket = function(array, sorter, opt_obj) { for (var i = 0; i < array.length; i++) { var value = array[i]; var key = sorter.call(/** @type {?} */ (opt_obj), value, i, array); - if (goog.isDef(key)) { + if (key !== undefined) { // Push the value to the right bucket, creating it if necessary. var bucket = buckets[key] || (buckets[key] = []); bucket.push(value); @@ -1604,7 +1606,7 @@ goog.array.zip = function(var_args) { * Shuffles the values in the specified array using the Fisher-Yates in-place * shuffle (also known as the Knuth Shuffle). By default, calls Math.random() * and so resets the state of that random number generator. Similarly, may reset - * the state of the any other specified random number generator. + * the state of any other specified random number generator. * * Runtime: O(n) * @@ -1633,8 +1635,8 @@ goog.array.shuffle = function(arr, opt_randFn) { * provided by index_arr. For example, the result of index copying * ['a', 'b', 'c'] with index_arr [1,0,0,2] is ['b', 'a', 'a', 'c']. * - * @param {!Array} arr The array to get a indexed copy from. - * @param {!Array} index_arr An array of indexes to get from arr. + * @param {!IArrayLike} arr The array to get a indexed copy from. + * @param {!IArrayLike} index_arr An array of indexes to get from arr. * @return {!Array} A new array of elements from arr in index_arr order. * @template T */ diff --git a/third_party/closure/goog/asserts/BUILD.bazel b/third_party/closure/goog/asserts/BUILD.bazel new file mode 100644 index 0000000000000..7f672209e8532 --- /dev/null +++ b/third_party/closure/goog/asserts/BUILD.bazel @@ -0,0 +1,23 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [":asserts"], +) + +closure_js_library( + name = "asserts", + srcs = ["asserts.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/debug:error", + "//third_party/closure/goog/dom:nodetype", + ], +) diff --git a/third_party/closure/goog/asserts/asserts.js b/third_party/closure/goog/asserts/asserts.js index 1f4b65305c143..090efe536f972 100644 --- a/third_party/closure/goog/asserts/asserts.js +++ b/third_party/closure/goog/asserts/asserts.js @@ -16,13 +16,17 @@ * @fileoverview Utilities to check the preconditions, postconditions and * invariants runtime. * - * Methods in this package should be given special treatment by the compiler + * Methods in this package are given special treatment by the compiler * for type-inference. For example, goog.asserts.assert(foo) - * will restrict foo to a truthy value. + * will make the compiler treat foo as non-nullable. Similarly, + * goog.asserts.assertNumber(foo) informs the compiler about the + * type of foo. Where applicable, such assertions are preferable to + * casts by jsdoc with @type. * * The compiler has an option to disable asserts. So code like: * - * var x = goog.asserts.assert(foo()); goog.asserts.assert(bar()); + * var x = goog.asserts.assert(foo()); + * goog.asserts.assert(bar()); * * will be transformed into: * @@ -31,7 +35,13 @@ * The compiler will leave in foo() (because its return value is used), * but it will remove bar() because it assumes it does not have side-effects. * - * @author agrieve@google.com (Andrew Grieve) + * Additionally, note the compiler will consider the type to be "tightened" for + * all statements after the assertion. For example: + * + * const /** ?Object &#ast;/ value = foo(); + * goog.asserts.assert(value); + * // "value" is of type {!Object} at this point. + * */ goog.provide('goog.asserts'); @@ -39,13 +49,13 @@ goog.provide('goog.asserts.AssertionError'); goog.require('goog.debug.Error'); goog.require('goog.dom.NodeType'); -goog.require('goog.string'); /** * @define {boolean} Whether to strip out asserts or to leave them in. */ -goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG); +goog.asserts.ENABLE_ASSERTS = + goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG); @@ -58,11 +68,7 @@ goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG); * @final */ goog.asserts.AssertionError = function(messagePattern, messageArgs) { - messageArgs.unshift(messagePattern); - goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs)); - // Remove the messagePattern afterwards to avoid permanently modifying the - // passed in array. - messageArgs.shift(); + goog.debug.Error.call(this, goog.asserts.subs_(messagePattern, messageArgs)); /** * The message pattern used to format the error message. Error handlers can @@ -94,6 +100,31 @@ goog.asserts.DEFAULT_ERROR_HANDLER = function(e) { goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER; +/** + * Does simple python-style string substitution. + * subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog". + * @param {string} pattern The string containing the pattern. + * @param {!Array<*>} subs The items to substitute into the pattern. + * @return {string} A copy of `str` in which each occurrence of + * {@code %s} has been replaced an argument from `var_args`. + * @private + */ +goog.asserts.subs_ = function(pattern, subs) { + var splitParts = pattern.split('%s'); + var returnString = ''; + + // Replace up to the last split part. We are inserting in the + // positions between split parts. + var subLast = splitParts.length - 1; + for (var i = 0; i < subLast; i++) { + // keep unsupplied as '%s' + var sub = (i < subs.length) ? subs[i] : '%s'; + returnString += splitParts[i] + sub; + } + return returnString + splitParts[subLast]; +}; + + /** * Throws an exception with the given message and "Assertion failed" prefixed * onto it. @@ -145,6 +176,7 @@ goog.asserts.setErrorHandler = function(errorHandler) { * @param {...*} var_args The items to substitute into the failure message. * @return {T} The value of the condition. * @throws {goog.asserts.AssertionError} When the condition evaluates to false. + * @closurePrimitive {asserts.truthy} */ goog.asserts.assert = function(condition, opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS && !condition) { @@ -155,6 +187,38 @@ goog.asserts.assert = function(condition, opt_message, var_args) { }; +/** + * Checks if `value` is `null` or `undefined` if goog.asserts.ENABLE_ASSERTS is + * true. + * + * @param {T} value The value to check. + * @param {string=} opt_message Error message in case of failure. + * @param {...*} var_args The items to substitute into the failure message. + * @return {R} `value` with its type narrowed to exclude `null` and `undefined`. + * + * @template T + * @template R := + * mapunion(T, (V) => + * cond(eq(V, 'null'), + * none(), + * cond(eq(V, 'undefined'), + * none(), + * V))) + * =: + * + * @throws {!goog.asserts.AssertionError} When `value` is `null` or `undefined`. + * @closurePrimitive {asserts.matchesReturn} + */ +goog.asserts.assertExists = function(value, opt_message, var_args) { + if (goog.asserts.ENABLE_ASSERTS && value == null) { + goog.asserts.doAssertFailure_( + 'Expected to exist: %s.', [value], opt_message, + Array.prototype.slice.call(arguments, 2)); + } + return value; +}; + + /** * Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case * when we want to add a check in the unreachable area like switch-case @@ -172,6 +236,7 @@ goog.asserts.assert = function(condition, opt_message, var_args) { * @param {string=} opt_message Error message in case of failure. * @param {...*} var_args The items to substitute into the failure message. * @throws {goog.asserts.AssertionError} Failure. + * @closurePrimitive {asserts.fail} */ goog.asserts.fail = function(opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS) { @@ -190,9 +255,10 @@ goog.asserts.fail = function(opt_message, var_args) { * @param {...*} var_args The items to substitute into the failure message. * @return {number} The value, guaranteed to be a number when asserts enabled. * @throws {goog.asserts.AssertionError} When the value is not a number. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertNumber = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) { + if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'number') { goog.asserts.doAssertFailure_( 'Expected number but got %s: %s.', [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); @@ -208,9 +274,10 @@ goog.asserts.assertNumber = function(value, opt_message, var_args) { * @param {...*} var_args The items to substitute into the failure message. * @return {string} The value, guaranteed to be a string when asserts enabled. * @throws {goog.asserts.AssertionError} When the value is not a string. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertString = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) { + if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'string') { goog.asserts.doAssertFailure_( 'Expected string but got %s: %s.', [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); @@ -227,6 +294,7 @@ goog.asserts.assertString = function(value, opt_message, var_args) { * @return {!Function} The value, guaranteed to be a function when asserts * enabled. * @throws {goog.asserts.AssertionError} When the value is not a function. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertFunction = function(value, opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) { @@ -245,6 +313,7 @@ goog.asserts.assertFunction = function(value, opt_message, var_args) { * @param {...*} var_args The items to substitute into the failure message. * @return {!Object} The value, guaranteed to be a non-null object. * @throws {goog.asserts.AssertionError} When the value is not an object. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertObject = function(value, opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) { @@ -263,6 +332,7 @@ goog.asserts.assertObject = function(value, opt_message, var_args) { * @param {...*} var_args The items to substitute into the failure message. * @return {!Array} The value, guaranteed to be a non-null array. * @throws {goog.asserts.AssertionError} When the value is not an array. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertArray = function(value, opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) { @@ -282,9 +352,10 @@ goog.asserts.assertArray = function(value, opt_message, var_args) { * @return {boolean} The value, guaranteed to be a boolean when asserts are * enabled. * @throws {goog.asserts.AssertionError} When the value is not a boolean. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertBoolean = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) { + if (goog.asserts.ENABLE_ASSERTS && typeof value !== 'boolean') { goog.asserts.doAssertFailure_( 'Expected boolean but got %s: %s.', [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); @@ -301,6 +372,7 @@ goog.asserts.assertBoolean = function(value, opt_message, var_args) { * @return {!Element} The value, likely to be a DOM Element when asserts are * enabled. * @throws {goog.asserts.AssertionError} When the value is not an Element. + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertElement = function(value, opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS && @@ -327,6 +399,7 @@ goog.asserts.assertElement = function(value, opt_message, var_args) { * type. * @return {T} * @template T + * @closurePrimitive {asserts.matchesReturn} */ goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) { if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) { @@ -339,6 +412,27 @@ goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) { }; +/** + * Checks whether the value is a finite number, if goog.asserts.ENABLE_ASSERTS + * is true. + * + * @param {*} value The value to check. + * @param {string=} opt_message Error message in case of failure. + * @param {...*} var_args The items to substitute into the failure message. + * @throws {goog.asserts.AssertionError} When the value is not a number, or is + * a non-finite number such as NaN, Infinity or -Infinity. + * @return {number} The value initially passed in. + */ +goog.asserts.assertFinite = function(value, opt_message, var_args) { + if (goog.asserts.ENABLE_ASSERTS && + (typeof value != 'number' || !isFinite(value))) { + goog.asserts.doAssertFailure_( + 'Expected %s to be a finite number but it is not.', [value], + opt_message, Array.prototype.slice.call(arguments, 2)); + } + return /** @type {number} */ (value); +}; + /** * Checks that no enumerable keys are present in Object.prototype. Such keys * would break most code that use {@code for (var ... in ...)} loops. @@ -361,8 +455,8 @@ goog.asserts.getType_ = function(value) { if (value instanceof Function) { return value.displayName || value.name || 'unknown type name'; } else if (value instanceof Object) { - return value.constructor.displayName || value.constructor.name || - Object.prototype.toString.call(value); + return /** @type {string} */ (value.constructor.displayName) || + value.constructor.name || Object.prototype.toString.call(value); } else { return value === null ? 'null' : typeof value; } diff --git a/third_party/closure/goog/async/BUILD.bazel b/third_party/closure/goog/async/BUILD.bazel new file mode 100644 index 0000000000000..ba23eb70768e6 --- /dev/null +++ b/third_party/closure/goog/async/BUILD.bazel @@ -0,0 +1,118 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [ + ":animationdelay", + ":conditionaldelay", + ":debouncer", + ":delay", + ":freelist", + ":nexttick", + ":run", + ":throttle", + ":workqueue", + ], +) + +closure_js_library( + name = "animationdelay", + srcs = ["animationdelay.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/disposable", + "//third_party/closure/goog/events", + "//third_party/closure/goog/functions", + ], +) + +closure_js_library( + name = "conditionaldelay", + srcs = ["conditionaldelay.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/async:delay", + "//third_party/closure/goog/disposable", + ], +) + +closure_js_library( + name = "debouncer", + srcs = ["debouncer.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/disposable", + "//third_party/closure/goog/timer", + ], +) + +closure_js_library( + name = "delay", + srcs = ["delay.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/disposable", + "//third_party/closure/goog/timer", + ], +) + +closure_js_library( + name = "freelist", + srcs = ["freelist.js"], + lenient = True, +) + +closure_js_library( + name = "nexttick", + srcs = ["nexttick.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/debug:entrypointregistry", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:safe", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/functions", + "//third_party/closure/goog/html:safehtml", + "//third_party/closure/goog/html:trustedresourceurl", + "//third_party/closure/goog/labs/useragent:browser", + "//third_party/closure/goog/labs/useragent:engine", + "//third_party/closure/goog/string:const", + ], +) + +closure_js_library( + name = "run", + srcs = ["run.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/async:nexttick", + "//third_party/closure/goog/async:workqueue", + ], +) + +closure_js_library( + name = "throttle", + srcs = ["throttle.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/disposable", + "//third_party/closure/goog/timer", + ], +) + +closure_js_library( + name = "workqueue", + srcs = ["workqueue.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/asserts", + "//third_party/closure/goog/async:freelist", + ], +) diff --git a/third_party/closure/goog/async/animationdelay.js b/third_party/closure/goog/async/animationdelay.js index d9057d86ee1c2..b900d3beb18a6 100644 --- a/third_party/closure/goog/async/animationdelay.js +++ b/third_party/closure/goog/async/animationdelay.js @@ -15,8 +15,6 @@ /** * @fileoverview A delayed callback that pegs to the next animation frame * instead of a user-configurable timeout. - * - * @author nicksantos@google.com (Nick Santos) */ goog.provide('goog.async.AnimationDelay'); @@ -64,7 +62,7 @@ goog.async.AnimationDelay = function(listener, opt_window, opt_handler) { /** * Identifier of the active delay timeout, or event listener, * or null when inactive. - * @private {goog.events.Key|number} + * @private {?goog.events.Key|number} */ this.id_ = null; diff --git a/third_party/closure/goog/async/conditionaldelay.js b/third_party/closure/goog/async/conditionaldelay.js index 1ad0d629976c0..c57f5119b6d80 100644 --- a/third_party/closure/goog/async/conditionaldelay.js +++ b/third_party/closure/goog/async/conditionaldelay.js @@ -39,7 +39,6 @@ * * // Stop the deferred function call (does nothing if it's not active). * deferredCall.stop(); - * */ @@ -53,16 +52,16 @@ goog.require('goog.async.Delay'); /** * A ConditionalDelay object invokes the associated function after a specified * interval delay and checks its return value. If the function returns - * {@code true} the conditional delay is cancelled and {@see #onSuccess} + * `true` the conditional delay is cancelled and {@see #onSuccess} * is called. Otherwise this object keeps to invoke the deferred function until - * either it returns {@code true} or the timeout is exceeded. In the latter case + * either it returns `true` or the timeout is exceeded. In the latter case * the {@see #onFailure} method will be called. * * The interval duration and timeout can be specified each time the delay is * started. Calling start on an active delay will reset the timer. * * @param {function():boolean} listener Function to call when the delay - * completes. Should return a value that type-converts to {@code true} if + * completes. Should return a value that type-converts to `true` if * the call succeeded and this delay should be stopped. * @param {Object=} opt_handler The object scope to invoke the function in. * @constructor @@ -88,7 +87,7 @@ goog.async.ConditionalDelay = function(listener, opt_handler) { this.runUntil_ = 0; /** - * True if the listener has been executed, and it returned {@code true}. + * True if the listener has been executed, and it returned `true`. * @private {boolean} */ this.isDone_ = false; @@ -127,12 +126,12 @@ goog.async.ConditionalDelay.prototype.disposeInternal = function() { /** * Starts the delay timer. The provided listener function will be called * repeatedly after the specified interval until the function returns - * {@code true} or the timeout is exceeded. Calling start on an active timer + * `true` or the timeout is exceeded. Calling start on an active timer * will stop the timer first. * @param {number=} opt_interval The time interval between the function * invocations (in milliseconds). Default is 0. * @param {number=} opt_timeout The timeout interval (in milliseconds). Takes - * precedence over the {@code opt_interval}, i.e. if the timeout is less + * precedence over the `opt_interval`, i.e. if the timeout is less * than the invocation interval, the function will be called when the * timeout is exceeded. A negative value means no timeout. Default is 0. */ @@ -168,7 +167,7 @@ goog.async.ConditionalDelay.prototype.isActive = function() { /** * @return {boolean} True if the listener has been executed and returned - * {@code true} since the last call to {@see #start}. + * `true` since the last call to {@see #start}. */ goog.async.ConditionalDelay.prototype.isDone = function() { return this.isDone_; @@ -177,7 +176,7 @@ goog.async.ConditionalDelay.prototype.isDone = function() { /** * Called when the listener has been successfully executed and returned - * {@code true}. The {@see #isDone} method should return {@code true} by now. + * `true`. The {@see #isDone} method should return `true` by now. * Designed for inheritance, should be overridden by subclasses or on the * instances if they care. */ @@ -188,7 +187,7 @@ goog.async.ConditionalDelay.prototype.onSuccess = function() { /** * Called when this delayed call is cancelled because the timeout has been - * exceeded, and the listener has never returned {@code true}. + * exceeded, and the listener has never returned `true`. * Designed for inheritance, should be overridden by subclasses or on the * instances if they care. */ @@ -198,8 +197,8 @@ goog.async.ConditionalDelay.prototype.onFailure = function() { /** - * A callback function for the underlying {@code goog.async.Delay} object. When - * executed the listener function is called, and if it returns {@code true} + * A callback function for the underlying `goog.async.Delay` object. When + * executed the listener function is called, and if it returns `true` * the delay is stopped and the {@see #onSuccess} method is invoked. * If the timeout is exceeded the delay is stopped and the * {@see #onFailure} method is called. diff --git a/third_party/closure/goog/async/debouncer.js b/third_party/closure/goog/async/debouncer.js index 729be486f6e45..848c09cead65d 100644 --- a/third_party/closure/goog/async/debouncer.js +++ b/third_party/closure/goog/async/debouncer.js @@ -92,7 +92,7 @@ goog.async.Debouncer = function(listener, interval, opt_handler) { this.refireAt_ = null; /** - * The last arguments passed into {@code fire}. + * The last arguments passed into `fire`. * @private {!IArrayLike} */ this.args_ = []; diff --git a/third_party/closure/goog/async/delay.js b/third_party/closure/goog/async/delay.js index 17d50a298fb55..4ebbf30a28fa5 100644 --- a/third_party/closure/goog/async/delay.js +++ b/third_party/closure/goog/async/delay.js @@ -17,7 +17,6 @@ * invoked after a delay, especially when that delay is frequently restarted. * Examples include delaying before displaying a tooltip, menu hysteresis, * idle timers, etc. - * @author brenneman@google.com (Shawn Brenneman) * @see ../demos/timers.html */ @@ -123,7 +122,8 @@ goog.async.Delay.prototype.disposeInternal = function() { goog.async.Delay.prototype.start = function(opt_interval) { this.stop(); this.id_ = goog.Timer.callOnce( - this.callback_, goog.isDef(opt_interval) ? opt_interval : this.interval_); + this.callback_, + opt_interval !== undefined ? opt_interval : this.interval_); }; diff --git a/third_party/closure/goog/async/freelist.js b/third_party/closure/goog/async/freelist.js index c58ddf704bfb6..92bba2b753490 100644 --- a/third_party/closure/goog/async/freelist.js +++ b/third_party/closure/goog/async/freelist.js @@ -26,13 +26,13 @@ goog.provide('goog.async.FreeList'); /** * @template ITEM */ -goog.async.FreeList = goog.defineClass(null, { +goog.async.FreeList = class { /** * @param {function():ITEM} create * @param {function(ITEM):void} reset * @param {number} limit */ - constructor: function(create, reset, limit) { + constructor(create, reset, limit) { /** @private @const {number} */ this.limit_ = limit; /** @private @const {function()} */ @@ -44,13 +44,13 @@ goog.async.FreeList = goog.defineClass(null, { this.occupants_ = 0; /** @private {ITEM} */ this.head_ = null; - }, + } /** * @return {ITEM} */ - get: function() { - var item; + get() { + let item; if (this.occupants_ > 0) { this.occupants_--; item = this.head_; @@ -60,24 +60,26 @@ goog.async.FreeList = goog.defineClass(null, { item = this.create_(); } return item; - }, + } /** * @param {ITEM} item An item available for possible future reuse. */ - put: function(item) { + put(item) { this.reset_(item); if (this.occupants_ < this.limit_) { this.occupants_++; item.next = this.head_; this.head_ = item; } - }, + } /** * Visible for testing. * @package * @return {number} */ - occupants: function() { return this.occupants_; } -}); + occupants() { + return this.occupants_; + } +}; diff --git a/third_party/closure/goog/async/nexttick.js b/third_party/closure/goog/async/nexttick.js index bd3fb0807344b..af837214425f1 100644 --- a/third_party/closure/goog/async/nexttick.js +++ b/third_party/closure/goog/async/nexttick.js @@ -16,17 +16,21 @@ * @fileoverview Provides a function to schedule running a function as soon * as possible after the current JS execution stops and yields to the event * loop. - * */ goog.provide('goog.async.nextTick'); goog.provide('goog.async.throwException'); goog.require('goog.debug.entryPointRegistry'); +goog.require('goog.dom'); goog.require('goog.dom.TagName'); +goog.require('goog.dom.safe'); goog.require('goog.functions'); +goog.require('goog.html.SafeHtml'); +goog.require('goog.html.TrustedResourceUrl'); goog.require('goog.labs.userAgent.browser'); goog.require('goog.labs.userAgent.engine'); +goog.require('goog.string.Const'); /** @@ -100,6 +104,7 @@ goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) { * @return {boolean} Whether to use the implementation of setImmediate defined * on Window. * @private + * @suppress {missingProperties} For "Window.prototype.setImmediate" */ goog.async.nextTick.useSetImmediate_ = function() { // Not a browser environment. @@ -157,15 +162,16 @@ goog.async.nextTick.getSetImmediateEmulator_ = function() { /** @constructor */ Channel = function() { // Make an empty, invisible iframe. - var iframe = /** @type {!HTMLIFrameElement} */ ( - document.createElement(String(goog.dom.TagName.IFRAME))); + var iframe = goog.dom.createElement(goog.dom.TagName.IFRAME); iframe.style.display = 'none'; - iframe.src = ''; + goog.dom.safe.setIframeSrc( + iframe, + goog.html.TrustedResourceUrl.fromConstant(goog.string.Const.EMPTY)); document.documentElement.appendChild(iframe); var win = iframe.contentWindow; var doc = win.document; doc.open(); - doc.write(''); + goog.dom.safe.documentWrite(doc, goog.html.SafeHtml.EMPTY); doc.close(); // Do not post anything sensitive over this channel, as the workaround for // pages with file: origin could allow that information to be modified or @@ -173,7 +179,6 @@ goog.async.nextTick.getSetImmediateEmulator_ = function() { var message = 'callImmediate' + Math.random(); // The same origin policy rejects attempts to postMessage from file: urls // unless the origin is '*'. - // TODO(b/16335441): Use '*' origin for data: and other similar protocols. var origin = win.location.protocol == 'file:' ? '*' : win.location.protocol + '//' + win.location.host; @@ -205,7 +210,7 @@ goog.async.nextTick.getSetImmediateEmulator_ = function() { var head = {}; var tail = head; channel['port1'].onmessage = function() { - if (goog.isDef(head.next)) { + if (head.next !== undefined) { head = head.next; var cb = head.cb; head.cb = null; @@ -221,10 +226,9 @@ goog.async.nextTick.getSetImmediateEmulator_ = function() { // Implementation for IE6 to IE10: Script elements fire an asynchronous // onreadystatechange event when inserted into the DOM. if (typeof document !== 'undefined' && - 'onreadystatechange' in - document.createElement(String(goog.dom.TagName.SCRIPT))) { + 'onreadystatechange' in goog.dom.createElement(goog.dom.TagName.SCRIPT)) { return function(cb) { - var script = document.createElement(String(goog.dom.TagName.SCRIPT)); + var script = goog.dom.createElement(goog.dom.TagName.SCRIPT); script.onreadystatechange = function() { // Clean up and call the callback. script.onreadystatechange = null; diff --git a/third_party/closure/goog/async/run.js b/third_party/closure/goog/async/run.js index 832b6faf3e915..18a09df8f2a6a 100644 --- a/third_party/closure/goog/async/run.js +++ b/third_party/closure/goog/async/run.js @@ -18,6 +18,12 @@ goog.require('goog.async.WorkQueue'); goog.require('goog.async.nextTick'); goog.require('goog.async.throwException'); +/** + * @define {boolean} If true, use the global Promise to implement goog.async.run + * assuming either the native, or polyfill version will be used. Does still + * permit tests to use forceNextTick. + */ +goog.ASSUME_NATIVE_PROMISE = goog.define('goog.ASSUME_NATIVE_PROMISE', false); /** * Fires the provided callback just before the current callstack unwinds, or as @@ -46,13 +52,12 @@ goog.async.run = function(callback, opt_context) { * @private */ goog.async.run.initializeRunner_ = function() { - // If native Promises are available in the browser, just schedule the callback - // on a fulfilled promise, which is specified to be async, but as fast as - // possible. Use goog.global.Promise instead of just Promise because the - // relevant externs may be missing, and don't alias it because this could - // confuse the compiler into thinking the polyfill is required when it should - // be treated as optional. - if (String(goog.global.Promise).indexOf('[native code]') != -1) { + if (goog.ASSUME_NATIVE_PROMISE || + (goog.global.Promise && goog.global.Promise.resolve)) { + // Use goog.global.Promise instead of just Promise because the relevant + // externs may be missing, and don't alias it because this could confuse the + // compiler into thinking the polyfill is required when it should be treated + // as optional. var promise = goog.global.Promise.resolve(undefined); goog.async.run.schedule_ = function() { promise.then(goog.async.run.processWorkQueue); diff --git a/third_party/closure/goog/async/throttle.js b/third_party/closure/goog/async/throttle.js index 504a34334d8be..cb9f1221f021e 100644 --- a/third_party/closure/goog/async/throttle.js +++ b/third_party/closure/goog/async/throttle.js @@ -68,7 +68,7 @@ goog.async.Throttle = function(listener, interval, opt_handler) { this.callback_ = goog.bind(this.onTimer_, this); /** - * The last arguments passed into {@code fire}. + * The last arguments passed into `fire`. * @private {!IArrayLike} */ this.args_ = []; diff --git a/third_party/closure/goog/async/workqueue.js b/third_party/closure/goog/async/workqueue.js index 1ff6e9e5ea97a..86a1ce3ac2ded 100644 --- a/third_party/closure/goog/async/workqueue.js +++ b/third_party/closure/goog/async/workqueue.js @@ -40,7 +40,8 @@ goog.async.WorkQueue = function() { /** @define {number} The maximum number of entries to keep for recycling. */ -goog.define('goog.async.WorkQueue.DEFAULT_MAX_UNUSED', 100); +goog.async.WorkQueue.DEFAULT_MAX_UNUSED = + goog.define('goog.async.WorkQueue.DEFAULT_MAX_UNUSED', 100); /** @const @private {goog.async.FreeList} */ @@ -112,7 +113,7 @@ goog.async.WorkQueue.prototype.getUnusedItem_ = function() { goog.async.WorkItem = function() { /** @type {?function()} */ this.fn = null; - /** @type {Object|null|undefined} */ + /** @type {?Object|null|undefined} */ this.scope = null; /** @type {?goog.async.WorkItem} */ this.next = null; diff --git a/third_party/closure/goog/base.js b/third_party/closure/goog/base.js index f1716c09b5d74..7a069f70f6b9a 100644 --- a/third_party/closure/goog/base.js +++ b/third_party/closure/goog/base.js @@ -41,19 +41,35 @@ var COMPILED = false; */ var goog = goog || {}; - /** - * Reference to the global context. In most cases this will be 'window'. + * Reference to the global object. + * https://www.ecma-international.org/ecma-262/9.0/index.html#sec-global-object + * + * More info on this implementation here: + * https://docs.google.com/document/d/1NAeW4Wk7I7FV0Y2tcUFvQdGMc89k2vdgSXInw8_nvCI/edit + * + * @const + * @suppress {undefinedVars} self won't be referenced unless `this` is falsy. + * @type {!Global} */ -goog.global = this; +goog.global = + // Check `this` first for backwards compatibility. + // Valid unless running as an ES module or in a function wrapper called + // without setting `this` properly. + // Note that base.js can't usefully be imported as an ES module, but it may + // be compiled into bundles that are loadable as ES modules. + this || + // https://developer.mozilla.org/en-US/docs/Web/API/Window/self + // For in-page browser environments and workers. + self; /** * A hook for overriding the define values in uncompiled mode. * - * In uncompiled mode, {@code CLOSURE_UNCOMPILED_DEFINES} may be defined before - * loading base.js. If a key is defined in {@code CLOSURE_UNCOMPILED_DEFINES}, - * {@code goog.define} will use the value instead of the default value. This + * In uncompiled mode, `CLOSURE_UNCOMPILED_DEFINES` may be defined before + * loading base.js. If a key is defined in `CLOSURE_UNCOMPILED_DEFINES`, + * `goog.define` will use the value instead of the default value. This * allows flags to be overwritten without compilation (this is normally * accomplished with the compiler's "define" flag). * @@ -93,6 +109,7 @@ goog.global.CLOSURE_DEFINES; * * @param {?} val Variable to test. * @return {boolean} Whether variable is defined. + * @deprecated Use `val !== undefined` instead. */ goog.isDef = function(val) { // void 0 always evaluates to undefined and hence we do not need to depend on @@ -104,6 +121,7 @@ goog.isDef = function(val) { * Returns true if the specified value is a string. * @param {?} val Variable to test. * @return {boolean} Whether variable is a string. + * @deprecated Use `typeof val === 'string'` instead. */ goog.isString = function(val) { return typeof val == 'string'; @@ -114,6 +132,7 @@ goog.isString = function(val) { * Returns true if the specified value is a boolean. * @param {?} val Variable to test. * @return {boolean} Whether variable is boolean. + * @deprecated Use `typeof val === 'boolean'` instead. */ goog.isBoolean = function(val) { return typeof val == 'boolean'; @@ -124,6 +143,7 @@ goog.isBoolean = function(val) { * Returns true if the specified value is a number. * @param {?} val Variable to test. * @return {boolean} Whether variable is a number. + * @deprecated Use `typeof val === 'number'` instead. */ goog.isNumber = function(val) { return typeof val == 'number'; @@ -148,12 +168,12 @@ goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) { // Internet Explorer exhibits strange behavior when throwing errors from // methods externed in this manner. See the testExportSymbolExceptions in // base_test.html for an example. - if (!(parts[0] in cur) && cur.execScript) { + if (!(parts[0] in cur) && typeof cur.execScript != 'undefined') { cur.execScript('var ' + parts[0]); } for (var part; parts.length && (part = parts.shift());) { - if (!parts.length && goog.isDef(opt_object)) { + if (!parts.length && opt_object !== undefined) { // last part and we have an object; use it cur[part] = opt_object; } else if (cur[part] && cur[part] !== Object.prototype[part]) { @@ -169,35 +189,66 @@ goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) { * Defines a named value. In uncompiled mode, the value is retrieved from * CLOSURE_DEFINES or CLOSURE_UNCOMPILED_DEFINES if the object is defined and * has the property specified, and otherwise used the defined defaultValue. - * When compiled the default can be overridden using the compiler - * options or the value set in the CLOSURE_DEFINES object. + * When compiled the default can be overridden using the compiler options or the + * value set in the CLOSURE_DEFINES object. Returns the defined value so that it + * can be used safely in modules. Note that the value type MUST be either + * boolean, number, or string. * * @param {string} name The distinguished name to provide. - * @param {string|number|boolean} defaultValue + * @param {T} defaultValue + * @return {T} The defined value. + * @template T */ goog.define = function(name, defaultValue) { var value = defaultValue; if (!COMPILED) { - if (goog.global.CLOSURE_UNCOMPILED_DEFINES && + var uncompiledDefines = goog.global.CLOSURE_UNCOMPILED_DEFINES; + var defines = goog.global.CLOSURE_DEFINES; + if (uncompiledDefines && // Anti DOM-clobbering runtime check (b/37736576). - /** @type {?} */ (goog.global.CLOSURE_UNCOMPILED_DEFINES).nodeType === - undefined && - Object.prototype.hasOwnProperty.call( - goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) { - value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name]; + /** @type {?} */ (uncompiledDefines).nodeType === undefined && + Object.prototype.hasOwnProperty.call(uncompiledDefines, name)) { + value = uncompiledDefines[name]; } else if ( - goog.global.CLOSURE_DEFINES && + defines && // Anti DOM-clobbering runtime check (b/37736576). - /** @type {?} */ (goog.global.CLOSURE_DEFINES).nodeType === undefined && - Object.prototype.hasOwnProperty.call( - goog.global.CLOSURE_DEFINES, name)) { - value = goog.global.CLOSURE_DEFINES[name]; + /** @type {?} */ (defines).nodeType === undefined && + Object.prototype.hasOwnProperty.call(defines, name)) { + value = defines[name]; } } - goog.exportPath_(name, value); + return value; }; +/** + * @define {number} Integer year indicating the set of browser features that are + * guaranteed to be present. This is defined to include exactly features that + * work correctly on all "modern" browsers that are stable on January 1 of the + * specified year. For example, + * ```js + * if (goog.FEATURESET_YEAR >= 2019) { + * // use APIs known to be available on all major stable browsers Jan 1, 2019 + * } else { + * // polyfill for older browsers + * } + * ``` + * This is intended to be the primary define for removing + * unnecessary browser compatibility code (such as ponyfills and workarounds), + * and should inform the default value for most other defines: + * ```js + * const ASSUME_NATIVE_PROMISE = + * goog.define('ASSUME_NATIVE_PROMISE', goog.FEATURESET_YEAR >= 2016); + * ``` + * + * The default assumption is that IE9 is the lowest supported browser, which was + * first available Jan 1, 2012. + * + * TODO(user): Reference more thorough documentation when it's available. + */ +goog.FEATURESET_YEAR = goog.define('goog.FEATURESET_YEAR', 2012); + + /** * @define {boolean} DEBUG is provided as a convenience so that debugging code * that should not be included in a production. It can be easily stripped @@ -207,7 +258,7 @@ goog.define = function(name, defaultValue) { * purposes and it is difficult for the JSCompiler to statically determine * whether they are used. */ -goog.define('goog.DEBUG', true); +goog.DEBUG = goog.define('goog.DEBUG', true); /** @@ -230,7 +281,7 @@ goog.define('goog.DEBUG', true); * be used instead of the new code (he). * */ -goog.define('goog.LOCALE', 'en'); // default to en +goog.LOCALE = goog.define('goog.LOCALE', 'en'); // default to en /** @@ -244,7 +295,7 @@ goog.define('goog.LOCALE', 'en'); // default to en * relying on non-standard implementations, specify * "--define goog.TRUSTED_SITE=false" to the compiler. */ -goog.define('goog.TRUSTED_SITE', true); +goog.TRUSTED_SITE = goog.define('goog.TRUSTED_SITE', true); /** @@ -255,21 +306,23 @@ goog.define('goog.TRUSTED_SITE', true); * @see https://goo.gl/PudQ4y * */ -goog.define('goog.STRICT_MODE_COMPATIBLE', false); +goog.STRICT_MODE_COMPATIBLE = goog.define('goog.STRICT_MODE_COMPATIBLE', false); /** * @define {boolean} Whether code that calls {@link goog.setTestOnly} should * be disallowed in the compilation unit. */ -goog.define('goog.DISALLOW_TEST_ONLY_CODE', COMPILED && !goog.DEBUG); +goog.DISALLOW_TEST_ONLY_CODE = + goog.define('goog.DISALLOW_TEST_ONLY_CODE', COMPILED && !goog.DEBUG); /** * @define {boolean} Whether to use a Chrome app CSP-compliant method for * loading scripts via goog.require. @see appendScriptSrcNode_. */ -goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', false); +goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = + goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', false); /** @@ -296,13 +349,13 @@ goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', false); */ goog.provide = function(name) { if (goog.isInModuleLoader_()) { - throw Error('goog.provide can not be used within a goog.module.'); + throw new Error('goog.provide cannot be used within a module.'); } if (!COMPILED) { // Ensure that the same namespace isn't provided twice. // A goog.module/goog.provide maps a goog.require to a specific file if (goog.isProvided_(name)) { - throw Error('Namespace "' + name + '" already declared.'); + throw new Error('Namespace "' + name + '" already declared.'); } } @@ -333,6 +386,59 @@ goog.constructNamespace_ = function(name, opt_obj) { }; +/** + * Returns CSP nonce, if set for any script tag. + * @param {?Window=} opt_window The window context used to retrieve the nonce. + * Defaults to global context. + * @return {string} CSP nonce or empty string if no nonce is present. + */ +goog.getScriptNonce = function(opt_window) { + if (opt_window && opt_window != goog.global) { + return goog.getScriptNonce_(opt_window.document); + } + if (goog.cspNonce_ === null) { + goog.cspNonce_ = goog.getScriptNonce_(goog.global.document); + } + return goog.cspNonce_; +}; + + +/** + * According to the CSP3 spec a nonce must be a valid base64 string. + * @see https://www.w3.org/TR/CSP3/#grammardef-base64-value + * @private @const + */ +goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/; + + +/** + * @private {?string} + */ +goog.cspNonce_ = null; + + +/** + * Returns CSP nonce, if set for any script tag. + * @param {!Document} doc + * @return {string} CSP nonce or empty string if no nonce is present. + * @private + */ +goog.getScriptNonce_ = function(doc) { + var script = doc.querySelector && doc.querySelector('script[nonce]'); + if (script) { + // Try to get the nonce from the IDL property first, because browsers that + // implement additional nonce protection features (currently only Chrome) to + // prevent nonce stealing via CSS do not expose the nonce via attributes. + // See https://github.com/whatwg/html/issues/2369 + var nonce = script['nonce'] || script.getAttribute('nonce'); + if (nonce && goog.NONCE_PATTERN_.test(nonce)) { + return nonce; + } + } + return ''; +}; + + /** * Module identifier validation regexp. * Note: This is a conservative check, it is very possible to be more lenient, @@ -376,12 +482,12 @@ goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/; * @return {void} */ goog.module = function(name) { - if (!goog.isString(name) || !name || + if (typeof name !== 'string' || !name || name.search(goog.VALID_MODULE_RE_) == -1) { - throw Error('Invalid module identifier'); + throw new Error('Invalid module identifier'); } - if (!goog.isInModuleLoader_()) { - throw Error( + if (!goog.isInGoogModuleLoader_()) { + throw new Error( 'Module ' + name + ' has been loaded incorrectly. Note, ' + 'modules cannot be loaded as normal scripts. They require some kind of ' + 'pre-processing step. You\'re likely trying to load a module via a ' + @@ -390,7 +496,7 @@ goog.module = function(name) { 'https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.'); } if (goog.moduleLoaderState_.moduleName) { - throw Error('goog.module may only be called once per module.'); + throw new Error('goog.module may only be called once per module.'); } // Store the module name for the loader. @@ -399,7 +505,7 @@ goog.module = function(name) { // Ensure that the same namespace isn't provided twice. // A goog.module/goog.provide maps a goog.require to a specific file if (goog.isProvided_(name)) { - throw Error('Namespace "' + name + '" already declared.'); + throw new Error('Namespace "' + name + '" already declared.'); } delete goog.implicitNamespaces_[name]; } @@ -429,7 +535,7 @@ goog.module.get = function(name) { goog.module.getInternal_ = function(name) { if (!COMPILED) { if (name in goog.loadedModules_) { - return goog.loadedModules_[name]; + return goog.loadedModules_[name].exports; } else if (!goog.implicitNamespaces_[name]) { var ns = goog.getObjectByName(name); return ns != null ? ns : null; @@ -440,17 +546,74 @@ goog.module.getInternal_ = function(name) { /** - * @private {?{moduleName: (string|undefined), declareLegacyNamespace:boolean}} + * Types of modules the debug loader can load. + * @enum {string} + */ +goog.ModuleType = { + ES6: 'es6', + GOOG: 'goog' +}; + + +/** + * @private {?{ + * moduleName: (string|undefined), + * declareLegacyNamespace:boolean, + * type: ?goog.ModuleType + * }} */ goog.moduleLoaderState_ = null; /** * @private - * @return {boolean} Whether a goog.module is currently being initialized. + * @return {boolean} Whether a goog.module or an es6 module is currently being + * initialized. */ goog.isInModuleLoader_ = function() { - return goog.moduleLoaderState_ != null; + return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_(); +}; + + +/** + * @private + * @return {boolean} Whether a goog.module is currently being initialized. + */ +goog.isInGoogModuleLoader_ = function() { + return !!goog.moduleLoaderState_ && + goog.moduleLoaderState_.type == goog.ModuleType.GOOG; +}; + + +/** + * @private + * @return {boolean} Whether an es6 module is currently being initialized. + */ +goog.isInEs6ModuleLoader_ = function() { + var inLoader = !!goog.moduleLoaderState_ && + goog.moduleLoaderState_.type == goog.ModuleType.ES6; + + if (inLoader) { + return true; + } + + var jscomp = goog.global['$jscomp']; + + if (jscomp) { + // jscomp may not have getCurrentModulePath if this is a compiled bundle + // that has some of the runtime, but not all of it. This can happen if + // optimizations are turned on so the unused runtime is removed but renaming + // and Closure pass are off (so $jscomp is still named $jscomp and the + // goog.provide/require calls still exist). + if (typeof jscomp.getCurrentModulePath != 'function') { + return false; + } + + // Bundled ES6 module. + return !!jscomp.getCurrentModulePath(); + } + + return false; }; @@ -461,13 +624,13 @@ goog.isInModuleLoader_ = function() { * @suppress {missingProvide} */ goog.module.declareLegacyNamespace = function() { - if (!COMPILED && !goog.isInModuleLoader_()) { + if (!COMPILED && !goog.isInGoogModuleLoader_()) { throw new Error( 'goog.module.declareLegacyNamespace must be called from ' + 'within a goog.module'); } if (!COMPILED && !goog.moduleLoaderState_.moduleName) { - throw Error( + throw new Error( 'goog.module must be called prior to ' + 'goog.module.declareLegacyNamespace.'); } @@ -475,6 +638,54 @@ goog.module.declareLegacyNamespace = function() { }; +/** + * Associates an ES6 module with a Closure module ID so that is available via + * goog.require. The associated ID acts like a goog.module ID - it does not + * create any global names, it is merely available via goog.require / + * goog.module.get / goog.forwardDeclare / goog.requireType. goog.require and + * goog.module.get will return the entire module as if it was import *'d. This + * allows Closure files to reference ES6 modules for the sake of migration. + * + * @param {string} namespace + * @suppress {missingProvide} + */ +goog.declareModuleId = function(namespace) { + if (!COMPILED) { + if (!goog.isInEs6ModuleLoader_()) { + throw new Error( + 'goog.declareModuleId may only be called from ' + + 'within an ES6 module'); + } + if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName) { + throw new Error( + 'goog.declareModuleId may only be called once per module.'); + } + if (namespace in goog.loadedModules_) { + throw new Error( + 'Module with namespace "' + namespace + '" already exists.'); + } + } + if (goog.moduleLoaderState_) { + // Not bundled - debug loading. + goog.moduleLoaderState_.moduleName = namespace; + } else { + // Bundled - not debug loading, no module loader state. + var jscomp = goog.global['$jscomp']; + if (!jscomp || typeof jscomp.getCurrentModulePath != 'function') { + throw new Error( + 'Module with namespace "' + namespace + + '" has been loaded incorrectly.'); + } + var exports = jscomp.require(jscomp.getCurrentModulePath()); + goog.loadedModules_[namespace] = { + exports: exports, + type: goog.ModuleType.ES6, + moduleId: namespace + }; + } +}; + + /** * Marks that the current file should only be used for testing, and never for * live code in production. @@ -489,7 +700,7 @@ goog.module.declareLegacyNamespace = function() { goog.setTestOnly = function(opt_message) { if (goog.DISALLOW_TEST_ONLY_CODE) { opt_message = opt_message || ''; - throw Error( + throw new Error( 'Importing test-only code into non-debug environment' + (opt_message ? ': ' + opt_message : '.')); } @@ -538,8 +749,7 @@ if (!COMPILED) { */ goog.isProvided_ = function(name) { return (name in goog.loadedModules_) || - (!goog.implicitNamespaces_[name] && - goog.isDefAndNotNull(goog.getObjectByName(name))); + (!goog.implicitNamespaces_[name] && goog.getObjectByName(name) != null); }; /** @@ -573,10 +783,9 @@ if (!COMPILED) { goog.getObjectByName = function(name, opt_obj) { var parts = name.split('.'); var cur = opt_obj || goog.global; - for (var part; part = parts.shift();) { - if (goog.isDefAndNotNull(cur[part])) { - cur = cur[part]; - } else { + for (var i = 0; i < parts.length; i++) { + cur = cur[parts[i]]; + if (cur == null) { return null; } } @@ -613,23 +822,8 @@ goog.globalize = function(obj, opt_global) { * and values include {'module': 'goog'} and {'lang': 'es6'}. */ goog.addDependency = function(relPath, provides, requires, opt_loadFlags) { - if (goog.DEPENDENCIES_ENABLED) { - var provide, require; - var path = relPath.replace(/\\/g, '/'); - var deps = goog.dependencies_; - if (!opt_loadFlags || typeof opt_loadFlags === 'boolean') { - opt_loadFlags = opt_loadFlags ? {'module': 'goog'} : {}; - } - for (var i = 0; provide = provides[i]; i++) { - deps.nameToPath[provide] = path; - deps.loadFlags[path] = opt_loadFlags; - } - for (var j = 0; require = requires[j]; j++) { - if (!(path in deps.requires)) { - deps.requires[path] = {}; - } - deps.requires[path][require] = true; - } + if (!COMPILED && goog.DEPENDENCIES_ENABLED) { + goog.debugLoader_.addDependency(relPath, provides, requires, opt_loadFlags); } }; @@ -650,7 +844,7 @@ goog.addDependency = function(relPath, provides, requires, opt_loadFlags) { // Externally: https://developers.google.com/closure/library/docs/depswriter // // Because of legacy clients, the DOM loader can't be easily removed from -// base.js. Work is being done to make it disableable or replaceable for +// base.js. Work was done to make it disableable or replaceable for // different environments (DOM-less JavaScript interpreters like Rhino or V8, // for example). See bootstrap/ for more information. @@ -665,7 +859,7 @@ goog.addDependency = function(relPath, provides, requires, opt_loadFlags) { * provided (and depend on the fact that some outside tool correctly ordered * the script). */ -goog.define('goog.ENABLE_DEBUG_LOADER', true); +goog.ENABLE_DEBUG_LOADER = goog.define('goog.ENABLE_DEBUG_LOADER', true); /** @@ -681,34 +875,36 @@ goog.logToConsole_ = function(msg) { /** * Implements a system for the dynamic resolution of dependencies that works in - * parallel with the BUILD system. Note that all calls to goog.require will be - * stripped by the compiler. + * parallel with the BUILD system. + * + * Note that all calls to goog.require will be stripped by the compiler. + * * @see goog.provide - * @param {string} name Namespace to include (as was given in goog.provide()) in - * the form "goog.package.part". - * @return {?} If called within a goog.module file, the associated namespace or - * module otherwise null. + * @param {string} namespace Namespace (as was given in goog.provide, + * goog.module, or goog.declareModuleId) in the form + * "goog.package.part". + * @return {?} If called within a goog.module or ES6 module file, the associated + * namespace or module otherwise null. */ -goog.require = function(name) { - // If the object already exists we do not need do do anything. +goog.require = function(namespace) { if (!COMPILED) { - if (goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_) { - goog.maybeProcessDeferredDep_(name); + // Might need to lazy load on old IE. + if (goog.ENABLE_DEBUG_LOADER) { + goog.debugLoader_.requested(namespace); } - if (goog.isProvided_(name)) { + // If the object already exists we do not need to do anything. + if (goog.isProvided_(namespace)) { if (goog.isInModuleLoader_()) { - return goog.module.getInternal_(name); + return goog.module.getInternal_(namespace); } } else if (goog.ENABLE_DEBUG_LOADER) { - var path = goog.getPathFromDeps_(name); - if (path) { - goog.writeScripts_(path); - } else { - var errorMessage = 'goog.require could not find: ' + name; - goog.logToConsole_(errorMessage); - - throw Error(errorMessage); + var moduleLoaderState = goog.moduleLoaderState_; + goog.moduleLoaderState_ = null; + try { + goog.debugLoader_.load_(namespace); + } finally { + goog.moduleLoaderState_ = moduleLoaderState; } } @@ -717,6 +913,30 @@ goog.require = function(name) { }; +/** + * Requires a symbol for its type information. This is an indication to the + * compiler that the symbol may appear in type annotations, yet it is not + * referenced at runtime. + * + * When called within a goog.module or ES6 module file, the return value may be + * assigned to or destructured into a variable, but it may not be otherwise used + * in code outside of a type annotation. + * + * Note that all calls to goog.requireType will be stripped by the compiler. + * + * @param {string} namespace Namespace (as was given in goog.provide, + * goog.module, or goog.declareModuleId) in the form + * "goog.package.part". + * @return {?} + */ +goog.requireType = function(namespace) { + // Return an empty object so that single-level destructuring of the return + // value doesn't crash at runtime when using the debug loader. Multi-level + // destructuring isn't supported. + return {}; +}; + + /** * Path for included scripts. * @type {string} @@ -745,9 +965,11 @@ goog.global.CLOSURE_NO_DEPS; * in the global scope so that it can be set before base.js is loaded, which * allows deps.js to be imported properly. * - * The function is passed the script source, which is a relative URI. It should - * return true if the script was imported, false otherwise. - * @type {(function(string): boolean)|undefined} + * The first parameter the script source, which is a relative URI. The second, + * optional parameter is the script contents, in the event the script needed + * transformation. It should return true if the script was imported, false + * otherwise. + * @type {(function(string, string=): boolean)|undefined} */ goog.global.CLOSURE_IMPORT_SCRIPT; @@ -768,22 +990,29 @@ goog.nullFunction = function() {}; * * @type {!Function} * @throws {Error} when invoked to indicate the method should be overridden. + * @deprecated Use "@abstract" annotation instead of goog.abstractMethod in new + * code. See + * https://github.com/google/closure-compiler/wiki/@abstract-classes-and-methods */ goog.abstractMethod = function() { - throw Error('unimplemented abstract method'); + throw new Error('unimplemented abstract method'); }; /** - * Adds a {@code getInstance} static method that always returns the same + * Adds a `getInstance` static method that always returns the same * instance object. * @param {!Function} ctor The constructor for the class to add the static * method to. + * @suppress {missingProperties} 'instance_' isn't a property on 'Function' + * but we don't have a better type to use here. */ goog.addSingletonGetter = function(ctor) { // instance_ is immediately set to prevent issues with sealed constructors // such as are encountered when a constructor is returned as the export object // of a goog.module in unoptimized code. + // Delcare type to avoid conformance violations that ctor.instance_ is unknown + /** @type {undefined|!Object} @suppress {underscore} */ ctor.instance_ = undefined; ctor.getInstance = function() { if (ctor.instance_) { @@ -793,14 +1022,15 @@ goog.addSingletonGetter = function(ctor) { // NOTE: JSCompiler can't optimize away Array#push. goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor; } - return ctor.instance_ = new ctor; + // Cast to avoid conformance violations that ctor.instance_ is unknown + return /** @type {!Object|undefined} */ (ctor.instance_) = new ctor; }; }; /** * All singleton classes that have been instantiated, for testing. Don't read - * it directly, use the {@code goog.testing.singleton} module. The compiler + * it directly, use the `goog.testing.singleton` module. The compiler * removes this variable if unused. * @type {!Array} * @private @@ -809,32 +1039,32 @@ goog.instantiatedSingletons_ = []; /** - * @define {boolean} Whether to load goog.modules using {@code eval} when using + * @define {boolean} Whether to load goog.modules using `eval` when using * the debug loader. This provides a better debugging experience as the * source is unmodified and can be edited using Chrome Workspaces or similar. - * However in some environments the use of {@code eval} is banned + * However in some environments the use of `eval` is banned * so we provide an alternative. */ -goog.define('goog.LOAD_MODULE_USING_EVAL', true); +goog.LOAD_MODULE_USING_EVAL = goog.define('goog.LOAD_MODULE_USING_EVAL', true); /** * @define {boolean} Whether the exports of goog.modules should be sealed when * possible. */ -goog.define('goog.SEAL_MODULE_EXPORTS', goog.DEBUG); +goog.SEAL_MODULE_EXPORTS = goog.define('goog.SEAL_MODULE_EXPORTS', goog.DEBUG); /** * The registry of initialized modules: - * the module identifier to module exports map. - * @private @const {!Object} + * The module identifier or path to module exports map. + * @private @const {!Object} */ goog.loadedModules_ = {}; /** - * True if goog.dependencies_ is available. + * True if the debug loader enabled and used. * @const {boolean} */ goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; @@ -846,2076 +1076,3119 @@ goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; * use feature detection to determine which language levels need * transpilation. */ -// NOTE(user): we could expand this to accept a language level to bypass +// NOTE(sdh): we could expand this to accept a language level to bypass // detection: e.g. goog.TRANSPILE == 'es5' would transpile ES6 files but // would leave ES3 and ES5 files alone. -goog.define('goog.TRANSPILE', 'detect'); +goog.TRANSPILE = goog.define('goog.TRANSPILE', 'detect'); + +/** + * @define {boolean} If true assume that ES modules have already been + * transpiled by the jscompiler (in the same way that transpile.js would + * transpile them - to jscomp modules). Useful only for servers that wish to use + * the debug loader and transpile server side. Thus this is only respected if + * goog.TRANSPILE is "never". + */ +goog.ASSUME_ES_MODULES_TRANSPILED = + goog.define('goog.ASSUME_ES_MODULES_TRANSPILED', false); /** - * @define {string} Path to the transpiler. Executing the script at this - * path (relative to base.js) should define a function $jscomp.transpile. + * @define {string} If a file needs to be transpiled what the output language + * should be. By default this is the highest language level this file detects + * the current environment supports. Generally this flag should not be set, but + * it could be useful to override. Example: If the current environment supports + * ES6 then by default ES7+ files will be transpiled to ES6, unless this is + * overridden. + * + * Valid values include: es3, es5, es6, es7, and es8. Anything not recognized + * is treated as es3. + * + * Note that setting this value does not force transpilation. Just if + * transpilation occurs this will be the output. So this is most useful when + * goog.TRANSPILE is set to 'always' and then forcing the language level to be + * something lower than what the environment detects. */ -goog.define('goog.TRANSPILER', 'transpile.js'); +goog.TRANSPILE_TO_LANGUAGE = goog.define('goog.TRANSPILE_TO_LANGUAGE', ''); -if (goog.DEPENDENCIES_ENABLED) { - /** - * This object is used to keep track of dependencies and other data that is - * used for loading scripts. - * @private - * @type {{ - * loadFlags: !Object>, - * nameToPath: !Object, - * requires: !Object>, - * visited: !Object, - * written: !Object, - * deferred: !Object - * }} - */ - goog.dependencies_ = { - loadFlags: {}, // 1 to 1 +/** + * @define {string} Path to the transpiler. Executing the script at this + * path (relative to base.js) should define a function $jscomp.transpile. + */ +goog.TRANSPILER = goog.define('goog.TRANSPILER', 'transpile.js'); - nameToPath: {}, // 1 to 1 - requires: {}, // 1 to many +/** + * @package {?boolean} + * Visible for testing. + */ +goog.hasBadLetScoping = null; - // Used when resolving dependencies to prevent us from visiting file twice. - visited: {}, - written: {}, // Used to keep track of script files we have written. +/** + * @return {boolean} + * @package Visible for testing. + */ +goog.useSafari10Workaround = function() { + if (goog.hasBadLetScoping == null) { + var hasBadLetScoping; + try { + hasBadLetScoping = !eval( + '"use strict";' + + 'let x = 1; function f() { return typeof x; };' + + 'f() == "number";'); + } catch (e) { + // Assume that ES6 syntax isn't supported. + hasBadLetScoping = false; + } + goog.hasBadLetScoping = hasBadLetScoping; + } + return goog.hasBadLetScoping; +}; - deferred: {} // Used to track deferred module evaluations in old IEs - }; +/** + * @param {string} moduleDef + * @return {string} + * @package Visible for testing. + */ +goog.workaroundSafari10EvalBug = function(moduleDef) { + return '(function(){' + moduleDef + + '\n' + // Terminate any trailing single line comment. + ';' + // Terminate any trailing expression. + '})();\n'; +}; - /** - * Tries to detect whether is in the context of an HTML document. - * @return {boolean} True if it looks like HTML document. - * @private - */ - goog.inHtmlDocument_ = function() { - /** @type {Document} */ - var doc = goog.global.document; - return doc != null && 'write' in doc; // XULDocument misses write. - }; +/** + * @param {function(?):?|string} moduleDef The module definition. + */ +goog.loadModule = function(moduleDef) { + // NOTE: we allow function definitions to be either in the from + // of a string to eval (which keeps the original source intact) or + // in a eval forbidden environment (CSP) we allow a function definition + // which in its body must call `goog.module`, and return the exports + // of the module. + var previousState = goog.moduleLoaderState_; + try { + goog.moduleLoaderState_ = { + moduleName: '', + declareLegacyNamespace: false, + type: goog.ModuleType.GOOG + }; + var exports; + if (goog.isFunction(moduleDef)) { + exports = moduleDef.call(undefined, {}); + } else if (typeof moduleDef === 'string') { + if (goog.useSafari10Workaround()) { + moduleDef = goog.workaroundSafari10EvalBug(moduleDef); + } - /** - * Tries to detect the base path of base.js script that bootstraps Closure. - * @private - */ - goog.findBasePath_ = function() { - if (goog.isDef(goog.global.CLOSURE_BASE_PATH) && - // Anti DOM-clobbering runtime check (b/37736576). - goog.isString(goog.global.CLOSURE_BASE_PATH)) { - goog.basePath = goog.global.CLOSURE_BASE_PATH; - return; - } else if (!goog.inHtmlDocument_()) { - return; - } - /** @type {Document} */ - var doc = goog.global.document; - // If we have a currentScript available, use it exclusively. - var currentScript = doc.currentScript; - if (currentScript) { - var scripts = [currentScript]; + exports = goog.loadModuleFromSource_.call(undefined, moduleDef); } else { - var scripts = doc.getElementsByTagName('SCRIPT'); - } - // Search backwards since the current script is in almost all cases the one - // that has base.js. - for (var i = scripts.length - 1; i >= 0; --i) { - var script = /** @type {!HTMLScriptElement} */ (scripts[i]); - var src = script.src; - var qmark = src.lastIndexOf('?'); - var l = qmark == -1 ? src.length : qmark; - if (src.substr(l - 7, 7) == 'base.js') { - goog.basePath = src.substr(0, l - 7); - return; - } + throw new Error('Invalid module definition'); } - }; + var moduleName = goog.moduleLoaderState_.moduleName; + if (typeof moduleName === 'string' && moduleName) { + // Don't seal legacy namespaces as they may be used as a parent of + // another namespace + if (goog.moduleLoaderState_.declareLegacyNamespace) { + goog.constructNamespace_(moduleName, exports); + } else if ( + goog.SEAL_MODULE_EXPORTS && Object.seal && + typeof exports == 'object' && exports != null) { + Object.seal(exports); + } - /** - * Imports a script if, and only if, that script hasn't already been imported. - * (Must be called at execution time) - * @param {string} src Script source. - * @param {string=} opt_sourceText The optionally source text to evaluate - * @private - */ - goog.importScript_ = function(src, opt_sourceText) { - var importScript = - goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; - if (importScript(src, opt_sourceText)) { - goog.dependencies_.written[src] = true; + var data = { + exports: exports, + type: goog.ModuleType.GOOG, + moduleId: goog.moduleLoaderState_.moduleName + }; + goog.loadedModules_[moduleName] = data; + } else { + throw new Error('Invalid module name \"' + moduleName + '\"'); } - }; - - - /** - * Whether the browser is IE9 or earlier, which needs special handling - * for deferred modules. - * @const @private {boolean} - */ - goog.IS_OLD_IE_ = - !!(!goog.global.atob && goog.global.document && goog.global.document.all); - - - /** - * Whether IE9 or earlier is waiting on a dependency. This ensures that - * deferred modules that have no non-deferred dependencies actually get - * loaded, since if we defer them and then never pull in a non-deferred - * script, then `goog.loadQueuedModules_` will never be called. Instead, - * if not waiting on anything we simply don't defer in the first place. - * @private {boolean} - */ - goog.oldIeWaiting_ = false; + } finally { + goog.moduleLoaderState_ = previousState; + } +}; - /** - * Given a URL initiate retrieval and execution of a script that needs - * pre-processing. - * @param {string} src Script source URL. - * @param {boolean} isModule Whether this is a goog.module. - * @param {boolean} needsTranspile Whether this source needs transpilation. - * @private - */ - goog.importProcessedScript_ = function(src, isModule, needsTranspile) { - // In an attempt to keep browsers from timing out loading scripts using - // synchronous XHRs, put each load in its own script block. - var bootstrap = 'goog.retrieveAndExec_("' + src + '", ' + isModule + ', ' + - needsTranspile + ');'; +/** + * @private @const + */ +goog.loadModuleFromSource_ = /** @type {function(string):?} */ (function() { + // NOTE: we avoid declaring parameters or local variables here to avoid + // masking globals or leaking values into the module definition. + 'use strict'; + var exports = {}; + eval(arguments[0]); + return exports; +}); - goog.importScript_('', bootstrap); - }; +/** + * Normalize a file path by removing redundant ".." and extraneous "." file + * path components. + * @param {string} path + * @return {string} + * @private + */ +goog.normalizePath_ = function(path) { + var components = path.split('/'); + var i = 0; + while (i < components.length) { + if (components[i] == '.') { + components.splice(i, 1); + } else if ( + i && components[i] == '..' && components[i - 1] && + components[i - 1] != '..') { + components.splice(--i, 2); + } else { + i++; + } + } + return components.join('/'); +}; + + +/** + * Provides a hook for loading a file when using Closure's goog.require() API + * with goog.modules. In particular this hook is provided to support Node.js. + * + * @type {(function(string):string)|undefined} + */ +goog.global.CLOSURE_LOAD_FILE_SYNC; + + +/** + * Loads file by synchronous XHR. Should not be used in production environments. + * @param {string} src Source URL. + * @return {?string} File contents, or null if load failed. + * @private + */ +goog.loadFileSync_ = function(src) { + if (goog.global.CLOSURE_LOAD_FILE_SYNC) { + return goog.global.CLOSURE_LOAD_FILE_SYNC(src); + } else { + try { + /** @type {XMLHttpRequest} */ + var xhr = new goog.global['XMLHttpRequest'](); + xhr.open('get', src, false); + xhr.send(); + // NOTE: Successful http: requests have a status of 200, but successful + // file: requests may have a status of zero. Any other status, or a + // thrown exception (particularly in case of file: requests) indicates + // some sort of error, which we treat as a missing or unavailable file. + return xhr.status == 0 || xhr.status == 200 ? xhr.responseText : null; + } catch (err) { + // No need to rethrow or log, since errors should show up on their own. + return null; + } + } +}; + + +/** + * Lazily retrieves the transpiler and applies it to the source. + * @param {string} code JS code. + * @param {string} path Path to the code. + * @param {string} target Language level output. + * @return {string} The transpiled code. + * @private + */ +goog.transpile_ = function(code, path, target) { + var jscomp = goog.global['$jscomp']; + if (!jscomp) { + goog.global['$jscomp'] = jscomp = {}; + } + var transpile = jscomp.transpile; + if (!transpile) { + var transpilerPath = goog.basePath + goog.TRANSPILER; + var transpilerCode = goog.loadFileSync_(transpilerPath); + if (transpilerCode) { + // This must be executed synchronously, since by the time we know we + // need it, we're about to load and write the ES6 code synchronously, + // so a normal script-tag load will be too slow. Wrapped in a function + // so that code is eval'd in the global scope. + (function() { + (0, eval)(transpilerCode + '\n//# sourceURL=' + transpilerPath); + }).call(goog.global); + // Even though the transpiler is optional, if $gwtExport is found, it's + // a sign the transpiler was loaded and the $jscomp.transpile *should* + // be there. + if (goog.global['$gwtExport'] && goog.global['$gwtExport']['$jscomp'] && + !goog.global['$gwtExport']['$jscomp']['transpile']) { + throw new Error( + 'The transpiler did not properly export the "transpile" ' + + 'method. $gwtExport: ' + JSON.stringify(goog.global['$gwtExport'])); + } + // transpile.js only exports a single $jscomp function, transpile. We + // grab just that and add it to the existing definition of $jscomp which + // contains the polyfills. + goog.global['$jscomp'].transpile = + goog.global['$gwtExport']['$jscomp']['transpile']; + jscomp = goog.global['$jscomp']; + transpile = jscomp.transpile; + } + } + if (!transpile) { + // The transpiler is an optional component. If it's not available then + // replace it with a pass-through function that simply logs. + var suffix = ' requires transpilation but no transpiler was found.'; + transpile = jscomp.transpile = function(code, path) { + // TODO(sdh): figure out some way to get this error to show up + // in test results, noting that the failure may occur in many + // different ways, including in loadModule() before the test + // runner even comes up. + goog.logToConsole_(path + suffix); + return code; + }; + } + // Note: any transpilation errors/warnings will be logged to the console. + return transpile(code, path, target); +}; + +//============================================================================== +// Language Enhancements +//============================================================================== + + +/** + * This is a "fixed" version of the typeof operator. It differs from the typeof + * operator in such a way that null returns 'null' and arrays return 'array'. + * @param {?} value The value to get the type of. + * @return {string} The name of the type. + */ +goog.typeOf = function(value) { + var s = typeof value; + if (s == 'object') { + if (value) { + // Check these first, so we can avoid calling Object.prototype.toString if + // possible. + // + // IE improperly marshals typeof across execution contexts, but a + // cross-context object will still return false for "instanceof Object". + if (value instanceof Array) { + return 'array'; + } else if (value instanceof Object) { + return s; + } + + // HACK: In order to use an Object prototype method on the arbitrary + // value, the compiler requires the value be cast to type Object, + // even though the ECMA spec explicitly allows it. + var className = Object.prototype.toString.call( + /** @type {!Object} */ (value)); + // In Firefox 3.6, attempting to access iframe window objects' length + // property throws an NS_ERROR_FAILURE, so we need to special-case it + // here. + if (className == '[object Window]') { + return 'object'; + } + + // We cannot always use constructor == Array or instanceof Array because + // different frames have different Array objects. In IE6, if the iframe + // where the array was created is destroyed, the array loses its + // prototype. Then dereferencing val.splice here throws an exception, so + // we can't use goog.isFunction. Calling typeof directly returns 'unknown' + // so that will work. In this case, this function will return false and + // most array functions will still work because the array is still + // array-like (supports length and []) even though it has lost its + // prototype. + // Mark Miller noticed that Object.prototype.toString + // allows access to the unforgeable [[Class]] property. + // 15.2.4.2 Object.prototype.toString ( ) + // When the toString method is called, the following steps are taken: + // 1. Get the [[Class]] property of this object. + // 2. Compute a string value by concatenating the three strings + // "[object ", Result(1), and "]". + // 3. Return Result(2). + // and this behavior survives the destruction of the execution context. + if ((className == '[object Array]' || + // In IE all non value types are wrapped as objects across window + // boundaries (not iframe though) so we have to do object detection + // for this edge case. + typeof value.length == 'number' && + typeof value.splice != 'undefined' && + typeof value.propertyIsEnumerable != 'undefined' && + !value.propertyIsEnumerable('splice') + + )) { + return 'array'; + } + // HACK: There is still an array case that fails. + // function ArrayImpostor() {} + // ArrayImpostor.prototype = []; + // var impostor = new ArrayImpostor; + // this can be fixed by getting rid of the fast path + // (value instanceof Array) and solely relying on + // (value && Object.prototype.toString.vall(value) === '[object Array]') + // but that would require many more function calls and is not warranted + // unless closure code is receiving objects from untrusted sources. + + // IE in cross-window calls does not correctly marshal the function type + // (it appears just as an object) so we cannot use just typeof val == + // 'function'. However, if the object has a call property, it is a + // function. + if ((className == '[object Function]' || + typeof value.call != 'undefined' && + typeof value.propertyIsEnumerable != 'undefined' && + !value.propertyIsEnumerable('call'))) { + return 'function'; + } + + } else { + return 'null'; + } + + } else if (s == 'function' && typeof value.call == 'undefined') { + // In Safari typeof nodeList returns 'function', and on Firefox typeof + // behaves similarly for HTML{Applet,Embed,Object}, Elements and RegExps. We + // would like to return object for those and we can detect an invalid + // function by making sure that the function object has a call method. + return 'object'; + } + return s; +}; + + +/** + * Returns true if the specified value is null. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is null. + * @deprecated Use `val === null` instead. + */ +goog.isNull = function(val) { + return val === null; +}; + + +/** + * Returns true if the specified value is defined and not null. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is defined and not null. + * @deprecated Use `val != null` instead. + */ +goog.isDefAndNotNull = function(val) { + // Note that undefined == null. + return val != null; +}; + + +/** + * Returns true if the specified value is an array. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is an array. + */ +goog.isArray = function(val) { + return goog.typeOf(val) == 'array'; +}; + + +/** + * Returns true if the object looks like an array. To qualify as array like + * the value needs to be either a NodeList or an object with a Number length + * property. Note that for this function neither strings nor functions are + * considered "array-like". + * + * @param {?} val Variable to test. + * @return {boolean} Whether variable is an array. + */ +goog.isArrayLike = function(val) { + var type = goog.typeOf(val); + // We do not use goog.isObject here in order to exclude function values. + return type == 'array' || type == 'object' && typeof val.length == 'number'; +}; + + +/** + * Returns true if the object looks like a Date. To qualify as Date-like the + * value needs to be an object and have a getFullYear() function. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is a like a Date. + */ +goog.isDateLike = function(val) { + return goog.isObject(val) && typeof val.getFullYear == 'function'; +}; + + +/** + * Returns true if the specified value is a function. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is a function. + */ +goog.isFunction = function(val) { + return goog.typeOf(val) == 'function'; +}; + + +/** + * Returns true if the specified value is an object. This includes arrays and + * functions. + * @param {?} val Variable to test. + * @return {boolean} Whether variable is an object. + */ +goog.isObject = function(val) { + var type = typeof val; + return type == 'object' && val != null || type == 'function'; + // return Object(val) === val also works, but is slower, especially if val is + // not an object. +}; + + +/** + * Gets a unique ID for an object. This mutates the object so that further calls + * with the same object as a parameter returns the same value. The unique ID is + * guaranteed to be unique across the current session amongst objects that are + * passed into `getUid`. There is no guarantee that the ID is unique or + * consistent across sessions. It is unsafe to generate unique ID for function + * prototypes. + * + * @param {Object} obj The object to get the unique ID for. + * @return {number} The unique ID for the object. + */ +goog.getUid = function(obj) { + // TODO(arv): Make the type stricter, do not accept null. + + // In Opera window.hasOwnProperty exists but always returns false so we avoid + // using it. As a consequence the unique ID generated for BaseClass.prototype + // and SubClass.prototype will be the same. + // TODO(b/141512323): UUIDs are broken for ctors with class-side inheritance. + return obj[goog.UID_PROPERTY_] || + (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_); +}; + + +/** + * Whether the given object is already assigned a unique ID. + * + * This does not modify the object. + * + * @param {!Object} obj The object to check. + * @return {boolean} Whether there is an assigned unique id for the object. + */ +goog.hasUid = function(obj) { + return !!obj[goog.UID_PROPERTY_]; +}; + + +/** + * Removes the unique ID from an object. This is useful if the object was + * previously mutated using `goog.getUid` in which case the mutation is + * undone. + * @param {Object} obj The object to remove the unique ID field from. + */ +goog.removeUid = function(obj) { + // TODO(arv): Make the type stricter, do not accept null. + + // In IE, DOM nodes are not instances of Object and throw an exception if we + // try to delete. Instead we try to use removeAttribute. + if (obj !== null && 'removeAttribute' in obj) { + obj.removeAttribute(goog.UID_PROPERTY_); + } + + try { + delete obj[goog.UID_PROPERTY_]; + } catch (ex) { + } +}; + + +/** + * Name for unique ID property. Initialized in a way to help avoid collisions + * with other closure JavaScript on the same page. + * @type {string} + * @private + */ +goog.UID_PROPERTY_ = 'closure_uid_' + ((Math.random() * 1e9) >>> 0); + + +/** + * Counter for UID. + * @type {number} + * @private + */ +goog.uidCounter_ = 0; + + +/** + * Adds a hash code field to an object. The hash code is unique for the + * given object. + * @param {Object} obj The object to get the hash code for. + * @return {number} The hash code for the object. + * @deprecated Use goog.getUid instead. + */ +goog.getHashCode = goog.getUid; + + +/** + * Removes the hash code field from an object. + * @param {Object} obj The object to remove the field from. + * @deprecated Use goog.removeUid instead. + */ +goog.removeHashCode = goog.removeUid; + + +/** + * Clones a value. The input may be an Object, Array, or basic type. Objects and + * arrays will be cloned recursively. + * + * WARNINGS: + * goog.cloneObject does not detect reference loops. Objects that + * refer to themselves will cause infinite recursion. + * + * goog.cloneObject is unaware of unique identifiers, and copies + * UIDs created by getUid into cloned results. + * + * @param {*} obj The value to clone. + * @return {*} A clone of the input value. + * @deprecated goog.cloneObject is unsafe. Prefer the goog.object methods. + */ +goog.cloneObject = function(obj) { + var type = goog.typeOf(obj); + if (type == 'object' || type == 'array') { + if (typeof obj.clone === 'function') { + return obj.clone(); + } + var clone = type == 'array' ? [] : {}; + for (var key in obj) { + clone[key] = goog.cloneObject(obj[key]); + } + return clone; + } + + return obj; +}; + + +/** + * A native implementation of goog.bind. + * @param {?function(this:T, ...)} fn A function to partially apply. + * @param {T} selfObj Specifies the object which this should point to when the + * function is run. + * @param {...*} var_args Additional arguments that are partially applied to the + * function. + * @return {!Function} A partially-applied form of the function goog.bind() was + * invoked as a method of. + * @template T + * @private + */ +goog.bindNative_ = function(fn, selfObj, var_args) { + return /** @type {!Function} */ (fn.call.apply(fn.bind, arguments)); +}; + + +/** + * A pure-JS implementation of goog.bind. + * @param {?function(this:T, ...)} fn A function to partially apply. + * @param {T} selfObj Specifies the object which this should point to when the + * function is run. + * @param {...*} var_args Additional arguments that are partially applied to the + * function. + * @return {!Function} A partially-applied form of the function goog.bind() was + * invoked as a method of. + * @template T + * @private + */ +goog.bindJs_ = function(fn, selfObj, var_args) { + if (!fn) { + throw new Error(); + } + + if (arguments.length > 2) { + var boundArgs = Array.prototype.slice.call(arguments, 2); + return function() { + // Prepend the bound arguments to the current arguments. + var newArgs = Array.prototype.slice.call(arguments); + Array.prototype.unshift.apply(newArgs, boundArgs); + return fn.apply(selfObj, newArgs); + }; + + } else { + return function() { + return fn.apply(selfObj, arguments); + }; + } +}; + + +/** + * Partially applies this function to a particular 'this object' and zero or + * more arguments. The result is a new function with some arguments of the first + * function pre-filled and the value of this 'pre-specified'. + * + * Remaining arguments specified at call-time are appended to the pre-specified + * ones. + * + * Also see: {@link #partial}. + * + * Usage: + *
var barMethBound = goog.bind(myFunction, myObj, 'arg1', 'arg2');
+ * barMethBound('arg3', 'arg4');
+ * + * @param {?function(this:T, ...)} fn A function to partially apply. + * @param {T} selfObj Specifies the object which this should point to when the + * function is run. + * @param {...*} var_args Additional arguments that are partially applied to the + * function. + * @return {!Function} A partially-applied form of the function goog.bind() was + * invoked as a method of. + * @template T + * @suppress {deprecated} See above. + */ +goog.bind = function(fn, selfObj, var_args) { + // TODO(nicksantos): narrow the type signature. + if (Function.prototype.bind && + // NOTE(nicksantos): Somebody pulled base.js into the default Chrome + // extension environment. This means that for Chrome extensions, they get + // the implementation of Function.prototype.bind that calls goog.bind + // instead of the native one. Even worse, we don't want to introduce a + // circular dependency between goog.bind and Function.prototype.bind, so + // we have to hack this to make sure it works correctly. + Function.prototype.bind.toString().indexOf('native code') != -1) { + goog.bind = goog.bindNative_; + } else { + goog.bind = goog.bindJs_; + } + return goog.bind.apply(null, arguments); +}; + + +/** + * Like goog.bind(), except that a 'this object' is not required. Useful when + * the target function is already bound. + * + * Usage: + * var g = goog.partial(f, arg1, arg2); + * g(arg3, arg4); + * + * @param {Function} fn A function to partially apply. + * @param {...*} var_args Additional arguments that are partially applied to fn. + * @return {!Function} A partially-applied form of the function goog.partial() + * was invoked as a method of. + */ +goog.partial = function(fn, var_args) { + var args = Array.prototype.slice.call(arguments, 1); + return function() { + // Clone the array (with slice()) and append additional arguments + // to the existing arguments. + var newArgs = args.slice(); + newArgs.push.apply(newArgs, arguments); + return fn.apply(/** @type {?} */ (this), newArgs); + }; +}; + + +/** + * Copies all the members of a source object to a target object. This method + * does not work on all browsers for all objects that contain keys such as + * toString or hasOwnProperty. Use goog.object.extend for this purpose. + * + * NOTE: Some have advocated for the use of goog.mixin to setup classes + * with multiple inheritence (traits, mixins, etc). However, as it simply + * uses "for in", this is not compatible with ES6 classes whose methods are + * non-enumerable. Changing this, would break cases where non-enumerable + * properties are not expected. + * + * @param {Object} target Target. + * @param {Object} source Source. + * @deprecated Prefer Object.assign + */ +goog.mixin = function(target, source) { + for (var x in source) { + target[x] = source[x]; + } + + // For IE7 or lower, the for-in-loop does not contain any properties that are + // not enumerable on the prototype object (for example, isPrototypeOf from + // Object.prototype) but also it will not include 'replace' on objects that + // extend String and change 'replace' (not that it is common for anyone to + // extend anything except Object). +}; + + +/** + * @return {number} An integer value representing the number of milliseconds + * between midnight, January 1, 1970 and the current time. + * @deprecated Use Date.now + */ +goog.now = (goog.TRUSTED_SITE && Date.now) || (function() { + // Unary plus operator converts its operand to a number which in + // the case of + // a date is done by calling getTime(). + return +new Date(); + }); - /** @private {!Array} */ - goog.queuedModules_ = []; +/** + * Evals JavaScript in the global scope. In IE this uses execScript, other + * browsers use goog.global.eval. If goog.global.eval does not evaluate in the + * global scope (for example, in Safari), appends a script tag instead. + * Throws an exception if neither execScript or eval is defined. + * @param {string} script JavaScript string. + */ +goog.globalEval = function(script) { + if (goog.global.execScript) { + goog.global.execScript(script, 'JavaScript'); + } else if (goog.global.eval) { + // Test to see if eval works + if (goog.evalWorksForGlobals_ == null) { + try { + goog.global.eval('var _evalTest_ = 1;'); + } catch (ignore) { + } + if (typeof goog.global['_evalTest_'] != 'undefined') { + try { + delete goog.global['_evalTest_']; + } catch (ignore) { + // Microsoft edge fails the deletion above in strict mode. + } + goog.evalWorksForGlobals_ = true; + } else { + goog.evalWorksForGlobals_ = false; + } + } - /** - * Return an appropriate module text. Suitable to insert into - * a script tag (that is unescaped). - * @param {string} srcUrl - * @param {string} scriptText - * @return {string} - * @private - */ - goog.wrapModule_ = function(srcUrl, scriptText) { - if (!goog.LOAD_MODULE_USING_EVAL || !goog.isDef(goog.global.JSON)) { - return '' + - 'goog.loadModule(function(exports) {' + - '"use strict";' + scriptText + - '\n' + // terminate any trailing single line comment. - ';return exports' + - '});' + - '\n//# sourceURL=' + srcUrl + '\n'; + if (goog.evalWorksForGlobals_) { + goog.global.eval(script); } else { - return '' + - 'goog.loadModule(' + - goog.global.JSON.stringify( - scriptText + '\n//# sourceURL=' + srcUrl + '\n') + - ');'; + /** @type {!Document} */ + var doc = goog.global.document; + var scriptElt = + /** @type {!HTMLScriptElement} */ (doc.createElement('script')); + scriptElt.type = 'text/javascript'; + scriptElt.defer = false; + // Note(user): can't use .innerHTML since "t('')" will fail and + // .text doesn't work in Safari 2. Therefore we append a text node. + scriptElt.appendChild(doc.createTextNode(script)); + doc.head.appendChild(scriptElt); + doc.head.removeChild(scriptElt); } - }; + } else { + throw new Error('goog.globalEval not available'); + } +}; - // On IE9 and earlier, it is necessary to handle - // deferred module loads. In later browsers, the - // code to be evaluated is simply inserted as a script - // block in the correct order. To eval deferred - // code at the right time, we piggy back on goog.require to call - // goog.maybeProcessDeferredDep_. - // - // The goog.requires are used both to bootstrap - // the loading process (when no deps are available) and - // declare that they should be available. - // - // Here we eval the sources, if all the deps are available - // either already eval'd or goog.require'd. This will - // be the case when all the dependencies have already - // been loaded, and the dependent module is loaded. - // - // But this alone isn't sufficient because it is also - // necessary to handle the case where there is no root - // that is not deferred. For that there we register for an event - // and trigger goog.loadQueuedModules_ handle any remaining deferred - // evaluations. - /** - * Handle any remaining deferred goog.module evals. - * @private - */ - goog.loadQueuedModules_ = function() { - var count = goog.queuedModules_.length; - if (count > 0) { - var queue = goog.queuedModules_; - goog.queuedModules_ = []; - for (var i = 0; i < count; i++) { - var path = queue[i]; - goog.maybeProcessDeferredPath_(path); - } - } - goog.oldIeWaiting_ = false; - }; +/** + * Indicates whether or not we can call 'eval' directly to eval code in the + * global scope. Set to a Boolean by the first call to goog.globalEval (which + * empirically tests whether eval works for globals). @see goog.globalEval + * @type {?boolean} + * @private + */ +goog.evalWorksForGlobals_ = null; - /** - * Eval the named module if its dependencies are - * available. - * @param {string} name The module to load. - * @private - */ - goog.maybeProcessDeferredDep_ = function(name) { - if (goog.isDeferredModule_(name) && goog.allDepsAreAvailable_(name)) { - var path = goog.getPathFromDeps_(name); - goog.maybeProcessDeferredPath_(goog.basePath + path); - } +/** + * Optional map of CSS class names to obfuscated names used with + * goog.getCssName(). + * @private {!Object|undefined} + * @see goog.setCssNameMapping + */ +goog.cssNameMapping_; + + +/** + * Optional obfuscation style for CSS class names. Should be set to either + * 'BY_WHOLE' or 'BY_PART' if defined. + * @type {string|undefined} + * @private + * @see goog.setCssNameMapping + */ +goog.cssNameMappingStyle_; + + + +/** + * A hook for modifying the default behavior goog.getCssName. The function + * if present, will receive the standard output of the goog.getCssName as + * its input. + * + * @type {(function(string):string)|undefined} + */ +goog.global.CLOSURE_CSS_NAME_MAP_FN; + + +/** + * Handles strings that are intended to be used as CSS class names. + * + * This function works in tandem with @see goog.setCssNameMapping. + * + * Without any mapping set, the arguments are simple joined with a hyphen and + * passed through unaltered. + * + * When there is a mapping, there are two possible styles in which these + * mappings are used. In the BY_PART style, each part (i.e. in between hyphens) + * of the passed in css name is rewritten according to the map. In the BY_WHOLE + * style, the full css name is looked up in the map directly. If a rewrite is + * not specified by the map, the compiler will output a warning. + * + * When the mapping is passed to the compiler, it will replace calls to + * goog.getCssName with the strings from the mapping, e.g. + * var x = goog.getCssName('foo'); + * var y = goog.getCssName(this.baseClass, 'active'); + * becomes: + * var x = 'foo'; + * var y = this.baseClass + '-active'; + * + * If one argument is passed it will be processed, if two are passed only the + * modifier will be processed, as it is assumed the first argument was generated + * as a result of calling goog.getCssName. + * + * @param {string} className The class name. + * @param {string=} opt_modifier A modifier to be appended to the class name. + * @return {string} The class name or the concatenation of the class name and + * the modifier. + */ +goog.getCssName = function(className, opt_modifier) { + // String() is used for compatibility with compiled soy where the passed + // className can be non-string objects. + if (String(className).charAt(0) == '.') { + throw new Error( + 'className passed in goog.getCssName must not start with ".".' + + ' You passed: ' + className); + } + + var getMapping = function(cssName) { + return goog.cssNameMapping_[cssName] || cssName; }; - /** - * @param {string} name The module to check. - * @return {boolean} Whether the name represents a - * module whose evaluation has been deferred. - * @private - */ - goog.isDeferredModule_ = function(name) { - var path = goog.getPathFromDeps_(name); - var loadFlags = path && goog.dependencies_.loadFlags[path] || {}; - var languageLevel = loadFlags['lang'] || 'es3'; - if (path && (loadFlags['module'] == 'goog' || - goog.needsTranspile_(languageLevel))) { - var abspath = goog.basePath + path; - return (abspath) in goog.dependencies_.deferred; - } - return false; + var renameByParts = function(cssName) { + // Remap all the parts individually. + var parts = cssName.split('-'); + var mapped = []; + for (var i = 0; i < parts.length; i++) { + mapped.push(getMapping(parts[i])); + } + return mapped.join('-'); }; - /** - * @param {string} name The module to check. - * @return {boolean} Whether the name represents a - * module whose declared dependencies have all been loaded - * (eval'd or a deferred module load) - * @private - */ - goog.allDepsAreAvailable_ = function(name) { - var path = goog.getPathFromDeps_(name); - if (path && (path in goog.dependencies_.requires)) { - for (var requireName in goog.dependencies_.requires[path]) { - if (!goog.isProvided_(requireName) && - !goog.isDeferredModule_(requireName)) { - return false; - } - } - } - return true; - }; + var rename; + if (goog.cssNameMapping_) { + rename = + goog.cssNameMappingStyle_ == 'BY_WHOLE' ? getMapping : renameByParts; + } else { + rename = function(a) { + return a; + }; + } + + var result = + opt_modifier ? className + '-' + rename(opt_modifier) : rename(className); + + // The special CLOSURE_CSS_NAME_MAP_FN allows users to specify further + // processing of the class name. + if (goog.global.CLOSURE_CSS_NAME_MAP_FN) { + return goog.global.CLOSURE_CSS_NAME_MAP_FN(result); + } + + return result; +}; + + +/** + * Sets the map to check when returning a value from goog.getCssName(). Example: + *
+ * goog.setCssNameMapping({
+ *   "goog": "a",
+ *   "disabled": "b",
+ * });
+ *
+ * var x = goog.getCssName('goog');
+ * // The following evaluates to: "a a-b".
+ * goog.getCssName('goog') + ' ' + goog.getCssName(x, 'disabled')
+ * 
+ * When declared as a map of string literals to string literals, the JSCompiler + * will replace all calls to goog.getCssName() using the supplied map if the + * --process_closure_primitives flag is set. + * + * @param {!Object} mapping A map of strings to strings where keys are possible + * arguments to goog.getCssName() and values are the corresponding values + * that should be returned. + * @param {string=} opt_style The style of css name mapping. There are two valid + * options: 'BY_PART', and 'BY_WHOLE'. + * @see goog.getCssName for a description. + */ +goog.setCssNameMapping = function(mapping, opt_style) { + goog.cssNameMapping_ = mapping; + goog.cssNameMappingStyle_ = opt_style; +}; + + +/** + * To use CSS renaming in compiled mode, one of the input files should have a + * call to goog.setCssNameMapping() with an object literal that the JSCompiler + * can extract and use to replace all calls to goog.getCssName(). In uncompiled + * mode, JavaScript code should be loaded before this base.js file that declares + * a global variable, CLOSURE_CSS_NAME_MAPPING, which is used below. This is + * to ensure that the mapping is loaded before any calls to goog.getCssName() + * are made in uncompiled mode. + * + * A hook for overriding the CSS name mapping. + * @type {!Object|undefined} + */ +goog.global.CLOSURE_CSS_NAME_MAPPING; + + +if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) { + // This does not call goog.setCssNameMapping() because the JSCompiler + // requires that goog.setCssNameMapping() be called with an object literal. + goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING; +} + + +/** + * Gets a localized message. + * + * This function is a compiler primitive. If you give the compiler a localized + * message bundle, it will replace the string at compile-time with a localized + * version, and expand goog.getMsg call to a concatenated string. + * + * Messages must be initialized in the form: + * + * var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'}); + * + * + * This function produces a string which should be treated as plain text. Use + * {@link goog.html.SafeHtmlFormatter} in conjunction with goog.getMsg to + * produce SafeHtml. + * + * @param {string} str Translatable string, places holders in the form {$foo}. + * @param {Object=} opt_values Maps place holder name to value. + * @param {{html: boolean}=} opt_options Options: + * html: Escape '<' in str to '<'. Used by Closure Templates where the + * generated code size and performance is critical which is why {@link + * goog.html.SafeHtmlFormatter} is not used. The value must be literal true + * or false. + * @return {string} message with placeholders filled. + */ +goog.getMsg = function(str, opt_values, opt_options) { + if (opt_options && opt_options.html) { + // Note that '&' is not replaced because the translation can contain HTML + // entities. + str = str.replace(/var x = goog.getMsgWithFallback(MSG_A, MSG_B);
+ * where MSG_A and MSG_B were initialized with goog.getMsg. + * + * @param {string} a The preferred message. + * @param {string} b The fallback message. + * @return {string} The best translated message. + */ +goog.getMsgWithFallback = function(a, b) { + return a; +}; - /** - * @param {string} abspath - * @private - */ - goog.maybeProcessDeferredPath_ = function(abspath) { - if (abspath in goog.dependencies_.deferred) { - var src = goog.dependencies_.deferred[abspath]; - delete goog.dependencies_.deferred[abspath]; - goog.globalEval(src); - } - }; +/** + * Exposes an unobfuscated global namespace path for the given object. + * Note that fields of the exported object *will* be obfuscated, unless they are + * exported in turn via this function or goog.exportProperty. + * + * Also handy for making public items that are defined in anonymous closures. + * + * ex. goog.exportSymbol('public.path.Foo', Foo); + * + * ex. goog.exportSymbol('public.path.Foo.staticFunction', Foo.staticFunction); + * public.path.Foo.staticFunction(); + * + * ex. goog.exportSymbol('public.path.Foo.prototype.myMethod', + * Foo.prototype.myMethod); + * new public.path.Foo().myMethod(); + * + * @param {string} publicPath Unobfuscated name to export. + * @param {*} object Object the name should point to. + * @param {Object=} opt_objectToExportTo The object to add the path to; default + * is goog.global. + */ +goog.exportSymbol = function(publicPath, object, opt_objectToExportTo) { + goog.exportPath_(publicPath, object, opt_objectToExportTo); +}; - /** - * Load a goog.module from the provided URL. This is not a general purpose - * code loader and does not support late loading code, that is it should only - * be used during page load. This method exists to support unit tests and - * "debug" loaders that would otherwise have inserted script tags. Under the - * hood this needs to use a synchronous XHR and is not recommeneded for - * production code. - * - * The module's goog.requires must have already been satisified; an exception - * will be thrown if this is not the case. This assumption is that no - * "deps.js" file exists, so there is no way to discover and locate the - * module-to-be-loaded's dependencies and no attempt is made to do so. - * - * There should only be one attempt to load a module. If - * "goog.loadModuleFromUrl" is called for an already loaded module, an - * exception will be throw. - * - * @param {string} url The URL from which to attempt to load the goog.module. - */ - goog.loadModuleFromUrl = function(url) { - // Because this executes synchronously, we don't need to do any additional - // bookkeeping. When "goog.loadModule" the namespace will be marked as - // having been provided which is sufficient. - goog.retrieveAndExec_(url, true, false); - }; +/** + * Exports a property unobfuscated into the object's namespace. + * ex. goog.exportProperty(Foo, 'staticFunction', Foo.staticFunction); + * ex. goog.exportProperty(Foo.prototype, 'myMethod', Foo.prototype.myMethod); + * @param {Object} object Object whose static property is being exported. + * @param {string} publicName Unobfuscated name to export. + * @param {*} symbol Object the name should point to. + */ +goog.exportProperty = function(object, publicName, symbol) { + object[publicName] = symbol; +}; - /** - * Writes a new script pointing to {@code src} directly into the DOM. - * - * NOTE: This method is not CSP-compliant. @see goog.appendScriptSrcNode_ for - * the fallback mechanism. - * - * @param {string} src The script URL. - * @private - */ - goog.writeScriptSrcNode_ = function(src) { - goog.global.document.write( - ' - - -

Closure Performance Tests - byteArrayToString

-
-
- - - - diff --git a/third_party/closure/goog/crypt/cbc.js b/third_party/closure/goog/crypt/cbc.js index b3d3f9ce233bc..789cf86816a53 100644 --- a/third_party/closure/goog/crypt/cbc.js +++ b/third_party/closure/goog/crypt/cbc.js @@ -16,8 +16,6 @@ * @fileoverview Implementation of CBC mode for block ciphers. See * http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation * #Cipher-block_chaining_.28CBC.29. for description. - * - * @author nnaze@google.com (Nathan Naze) */ goog.provide('goog.crypt.Cbc'); diff --git a/third_party/closure/goog/crypt/crypt.js b/third_party/closure/goog/crypt/crypt.js index e1f8c1dc67bb6..cca25481a9903 100644 --- a/third_party/closure/goog/crypt/crypt.js +++ b/third_party/closure/goog/crypt/crypt.js @@ -24,7 +24,7 @@ goog.require('goog.asserts'); /** * Turns a string into an array of bytes; a "byte" being a JS number in the - * range 0-255. + * range 0-255. Multi-byte characters are written as little-endian. * @param {string} str String value to arrify. * @return {!Array} Array of numbers corresponding to the * UCS character codes of each character in str. @@ -33,7 +33,8 @@ goog.crypt.stringToByteArray = function(str) { var output = [], p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); - while (c > 0xff) { + // NOTE: c <= 0xffff since JavaScript strings are UTF-16. + if (c > 0xff) { output[p++] = c & 0xff; c >>= 8; } @@ -76,9 +77,10 @@ goog.crypt.byteArrayToString = function(bytes) { * the hex values to which the numbers correspond. * @param {Uint8Array|Array} array Array of numbers representing * characters. + * @param {string=} opt_separator Optional separator between values * @return {string} Hex string. */ -goog.crypt.byteArrayToHex = function(array) { +goog.crypt.byteArrayToHex = function(array, opt_separator) { return goog.array .map( array, @@ -86,7 +88,7 @@ goog.crypt.byteArrayToHex = function(array) { var hexByte = numByte.toString(16); return hexByte.length > 1 ? hexByte : '0' + hexByte; }) - .join(''); + .join(opt_separator || ''); }; diff --git a/third_party/closure/goog/crypt/crypt_perf.html b/third_party/closure/goog/crypt/crypt_perf.html deleted file mode 100644 index 5f073759f5a04..0000000000000 --- a/third_party/closure/goog/crypt/crypt_perf.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - Closure Performance Tests - UTF8 encoding and decoding - - - - - -

Closure Performance Tests - UTF8 encoding and decoding

-

- User-agent: - -

-
-
- - - - diff --git a/third_party/closure/goog/crypt/hash.js b/third_party/closure/goog/crypt/hash.js index cef806aef9637..02219e6f21b8a 100644 --- a/third_party/closure/goog/crypt/hash.js +++ b/third_party/closure/goog/crypt/hash.js @@ -16,7 +16,6 @@ * @fileoverview Abstract cryptographic hash interface. * * See goog.crypt.Sha1 and goog.crypt.Md5 for sample implementations. - * */ goog.provide('goog.crypt.Hash'); diff --git a/third_party/closure/goog/crypt/hash32.js b/third_party/closure/goog/crypt/hash32.js index e25ef75a5cfb9..2ad6c07e9d2d5 100644 --- a/third_party/closure/goog/crypt/hash32.js +++ b/third_party/closure/goog/crypt/hash32.js @@ -16,7 +16,6 @@ * @fileoverview Implementation of 32-bit hashing functions. * * This is a direct port from the Google Java Hash class - * */ goog.provide('goog.crypt.hash32'); @@ -141,7 +140,7 @@ goog.crypt.hash32.encodeByteArray = function( /** * Performs an inplace mix of an object with the integer properties (a, b, c) * and returns the final value of c. - * @param {Object} mix Object with properties, a, b, and c. + * @param {{a:number, b:number, c:number}} mix Object with properties, a, b, and c. * @return {number} The end c-value for the mixing. * @private */ diff --git a/third_party/closure/goog/crypt/hashtester.js b/third_party/closure/goog/crypt/hashtester.js index 369e782306a81..c968b5e5d263d 100644 --- a/third_party/closure/goog/crypt/hashtester.js +++ b/third_party/closure/goog/crypt/hashtester.js @@ -14,7 +14,6 @@ /** * @fileoverview Unit tests for the abstract cryptographic hash interface. - * */ goog.provide('goog.crypt.hashTester'); @@ -23,6 +22,7 @@ goog.require('goog.array'); goog.require('goog.crypt'); goog.require('goog.dom'); goog.require('goog.dom.TagName'); +goog.require('goog.reflect'); goog.require('goog.testing.PerformanceTable'); goog.require('goog.testing.PseudoRandom'); goog.require('goog.testing.asserts'); @@ -196,7 +196,8 @@ goog.crypt.hashTester.runPerfTests = function(hashFactory, hashName) { for (var i = 0; i < updateCount; i++) { hash.update(data, byteLength); } - var digest = hash.digest(); + // Prevent JsCompiler optimizations from invalidating the benchmark. + goog.reflect.sinkValue(hash.digest()); }, label + ' (' + dataType + ')'); } diff --git a/third_party/closure/goog/crypt/hmac.js b/third_party/closure/goog/crypt/hmac.js index 15e0e1dffb53a..3d80af2d62573 100644 --- a/third_party/closure/goog/crypt/hmac.js +++ b/third_party/closure/goog/crypt/hmac.js @@ -18,8 +18,6 @@ * Usage: * var hmac = new goog.crypt.Hmac(new goog.crypt.sha1(), key, 64); * var digest = hmac.getHmac(bytes); - * - * @author benyu@google.com (Jige Yu) - port to closure */ @@ -33,9 +31,9 @@ goog.require('goog.crypt.Hash'); * @constructor * @param {!goog.crypt.Hash} hasher An object to serve as a hash function. * @param {Array} key The secret key to use to calculate the hmac. - * Should be an array of not more than {@code blockSize} integers in + * Should be an array of not more than `blockSize` integers in {0, 255}. - * @param {number=} opt_blockSize Optional. The block size {@code hasher} uses. + * @param {number=} opt_blockSize Optional. The block size `hasher` uses. * If not specified, uses the block size from the hasher, or 16 if it is * not specified. * @extends {goog.crypt.Hash} @@ -98,7 +96,7 @@ goog.crypt.Hmac.IPAD_ = 0x36; * Initializes Hmac by precalculating the inner and outer paddings. * * @param {Array} key The secret key to use to calculate the hmac. - * Should be an array of not more than {@code blockSize} integers in + * Should be an array of not more than `blockSize` integers in {0, 255}. * @private */ diff --git a/third_party/closure/goog/crypt/md5.js b/third_party/closure/goog/crypt/md5.js index 62ca9bbd7cf1d..a411c33d77eb8 100644 --- a/third_party/closure/goog/crypt/md5.js +++ b/third_party/closure/goog/crypt/md5.js @@ -29,7 +29,6 @@ * IE9 (in a VM) ~27 Mbit/s * Firefox 3.6 ~15 Mbit/s * IE8 (in a VM) ~13 Mbit/s - * */ goog.provide('goog.crypt.Md5'); @@ -154,7 +153,7 @@ goog.crypt.Md5.prototype.compress_ = function(buf, opt_offset) { var X = new Array(16); // Get 16 little endian words. It is not worth unrolling this for Chrome 11. - if (goog.isString(buf)) { + if (typeof buf === 'string') { for (var i = 0; i < 16; ++i) { X[i] = (buf.charCodeAt(opt_offset++)) | (buf.charCodeAt(opt_offset++) << 8) | @@ -349,7 +348,7 @@ goog.crypt.Md5.prototype.compress_ = function(buf, opt_offset) { /** @override */ goog.crypt.Md5.prototype.update = function(bytes, opt_length) { - if (!goog.isDef(opt_length)) { + if (opt_length === undefined) { opt_length = bytes.length; } var lengthMinusBlock = opt_length - this.blockSize; @@ -373,7 +372,7 @@ goog.crypt.Md5.prototype.update = function(bytes, opt_length) { } } - if (goog.isString(bytes)) { + if (typeof bytes === 'string') { while (i < opt_length) { block[blockLength++] = bytes.charCodeAt(i++); if (blockLength == this.blockSize) { diff --git a/third_party/closure/goog/crypt/md5_perf.html b/third_party/closure/goog/crypt/md5_perf.html deleted file mode 100644 index 57aa8c88f8724..0000000000000 --- a/third_party/closure/goog/crypt/md5_perf.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - -Closure Performance Tests - goog.crypt.Md5 - - - - - -

Closure Performance Tests - goog.crypt.Md5

-

-User-agent: - -

- - - diff --git a/third_party/closure/goog/crypt/pbkdf2.js b/third_party/closure/goog/crypt/pbkdf2.js index 366abcb961609..5c94e93c701ac 100644 --- a/third_party/closure/goog/crypt/pbkdf2.js +++ b/third_party/closure/goog/crypt/pbkdf2.js @@ -23,7 +23,6 @@ * Usage: * var key = pbkdf2.deriveKeySha1( * stringToByteArray('password'), stringToByteArray('salt'), 1000, 128); - * */ goog.provide('goog.crypt.pbkdf2'); diff --git a/third_party/closure/goog/crypt/sha1.js b/third_party/closure/goog/crypt/sha1.js index b6735fe7b4004..31146a12d4d00 100644 --- a/third_party/closure/goog/crypt/sha1.js +++ b/third_party/closure/goog/crypt/sha1.js @@ -25,7 +25,6 @@ * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s - * */ goog.provide('goog.crypt.Sha1'); @@ -125,7 +124,7 @@ goog.crypt.Sha1.prototype.compress_ = function(buf, opt_offset) { var W = this.W_; // get 16 big endian words - if (goog.isString(buf)) { + if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment @@ -205,7 +204,7 @@ goog.crypt.Sha1.prototype.update = function(bytes, opt_length) { return; } - if (!goog.isDef(opt_length)) { + if (opt_length === undefined) { opt_length = bytes.length; } @@ -228,7 +227,7 @@ goog.crypt.Sha1.prototype.update = function(bytes, opt_length) { } } - if (goog.isString(bytes)) { + if (typeof bytes === 'string') { while (n < opt_length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; diff --git a/third_party/closure/goog/crypt/sha1_perf.html b/third_party/closure/goog/crypt/sha1_perf.html deleted file mode 100644 index b26c155340d71..0000000000000 --- a/third_party/closure/goog/crypt/sha1_perf.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - -Closure Performance Tests - goog.crypt.Sha1 - - - - - -

Closure Performance Tests - goog.crypt.Sha1

-

-User-agent: - -

- - - - diff --git a/third_party/closure/goog/crypt/sha2.js b/third_party/closure/goog/crypt/sha2.js index 2778a3a1734a9..f5d2b71f837c3 100644 --- a/third_party/closure/goog/crypt/sha2.js +++ b/third_party/closure/goog/crypt/sha2.js @@ -19,7 +19,6 @@ * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Some code similar to SHA1 are borrowed from sha1.js written by mschilder@. - * */ goog.provide('goog.crypt.Sha2'); @@ -93,7 +92,7 @@ goog.crypt.Sha2 = function(numHashBlocks, initHashBlocks) { */ this.w_ = goog.global['Int32Array'] ? new Int32Array(64) : new Array(64); - if (!goog.isDef(goog.crypt.Sha2.Kx_)) { + if (goog.crypt.Sha2.Kx_ === undefined) { // This is the first time this constructor has been called. if (goog.global['Int32Array']) { // Typed arrays exist @@ -218,7 +217,7 @@ goog.crypt.Sha2.prototype.computeChunk_ = function() { /** @override */ goog.crypt.Sha2.prototype.update = function(message, opt_length) { - if (!goog.isDef(opt_length)) { + if (opt_length === undefined) { opt_length = message.length; } // Process the message from left to right up to |opt_length| bytes. @@ -231,7 +230,7 @@ goog.crypt.Sha2.prototype.update = function(message, opt_length) { var inChunk = this.inChunk_; // The input message could be either byte array of string. - if (goog.isString(message)) { + if (typeof message === 'string') { while (n < opt_length) { this.chunk_[inChunk++] = message.charCodeAt(n++); if (inChunk == this.blockSize) { @@ -243,7 +242,7 @@ goog.crypt.Sha2.prototype.update = function(message, opt_length) { while (n < opt_length) { var b = message[n++]; if (!('number' == typeof b && 0 <= b && 255 >= b && b == (b | 0))) { - throw Error('message must be a byte array'); + throw new Error('message must be a byte array'); } this.chunk_[inChunk++] = b; if (inChunk == this.blockSize) { @@ -252,7 +251,7 @@ goog.crypt.Sha2.prototype.update = function(message, opt_length) { } } } else { - throw Error('message must be string or array'); + throw new Error('message must be string or array'); } // Record the current bytes in chunk to support partial update. diff --git a/third_party/closure/goog/crypt/sha224.js b/third_party/closure/goog/crypt/sha224.js index f7855553702a4..7d40590966e63 100644 --- a/third_party/closure/goog/crypt/sha224.js +++ b/third_party/closure/goog/crypt/sha224.js @@ -19,7 +19,6 @@ * var sha224 = new goog.crypt.Sha224(); * sha224.update(bytes); * var hash = sha224.digest(); - * */ goog.provide('goog.crypt.Sha224'); diff --git a/third_party/closure/goog/crypt/sha224_perf.html b/third_party/closure/goog/crypt/sha224_perf.html deleted file mode 100644 index 4c39e6440a56b..0000000000000 --- a/third_party/closure/goog/crypt/sha224_perf.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - -Closure Performance Tests - goog.crypt.Sha224 - - - - - -

Closure Performance Tests - goog.crypt.Sha224

-

-User-agent: - -

- - - - diff --git a/third_party/closure/goog/crypt/sha256.js b/third_party/closure/goog/crypt/sha256.js index 1d7380e6e0837..91624188b6a52 100644 --- a/third_party/closure/goog/crypt/sha256.js +++ b/third_party/closure/goog/crypt/sha256.js @@ -19,7 +19,6 @@ * var sha256 = new goog.crypt.Sha256(); * sha256.update(bytes); * var hash = sha256.digest(); - * */ goog.provide('goog.crypt.Sha256'); diff --git a/third_party/closure/goog/crypt/sha256_perf.html b/third_party/closure/goog/crypt/sha256_perf.html deleted file mode 100644 index 0b7922b3f232a..0000000000000 --- a/third_party/closure/goog/crypt/sha256_perf.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - -Closure Performance Tests - goog.crypt.Sha256 - - - - - -

Closure Performance Tests - goog.crypt.Sha256

-

-User-agent: - -

- - - - diff --git a/third_party/closure/goog/crypt/sha2_64bit.js b/third_party/closure/goog/crypt/sha2_64bit.js index e45a6a078c24f..30d775c814261 100644 --- a/third_party/closure/goog/crypt/sha2_64bit.js +++ b/third_party/closure/goog/crypt/sha2_64bit.js @@ -20,8 +20,6 @@ * * This code borrows heavily from the 32-bit SHA2 implementation written by * Yue Zhang (zysxqn@). - * - * @author fy@google.com (Frank Yellin) */ goog.provide('goog.crypt.Sha2_64bit'); @@ -55,14 +53,14 @@ goog.crypt.Sha2_64bit = function(numHashBlocks, initHashBlocks) { /** * A chunk holding the currently processed message bytes. Once the chunk has - * {@code this.blocksize} bytes, we feed it into [@code computeChunk_}. + * `this.blocksize` bytes, we feed it into [@code computeChunk_}. * @private {!Uint8Array|!Array} */ this.chunk_ = goog.global['Uint8Array'] ? new Uint8Array(this.blockSize) : new Array(this.blockSize); /** - * Current number of bytes in {@code this.chunk_}. + * Current number of bytes in `this.chunk_`. * @private {number} */ this.chunkBytes_ = 0; @@ -75,7 +73,7 @@ goog.crypt.Sha2_64bit = function(numHashBlocks, initHashBlocks) { /** * Holds the previous values of accumulated hash a-h in the - * {@code computeChunk_} function. + * `computeChunk_` function. * @private {!Array} */ this.hash_ = []; @@ -98,7 +96,7 @@ goog.crypt.Sha2_64bit = function(numHashBlocks, initHashBlocks) { this.w_ = []; /** - * The value to which {@code this.hash_} should be reset when this + * The value to which `this.hash_` should be reset when this * Hasher is reset. * @private @const {!Array} */ @@ -125,7 +123,7 @@ goog.crypt.Sha2_64bit.BLOCK_SIZE_ = 1024 / 8; /** - * Contains data needed to pad messages less than {@code blocksize} bytes. + * Contains data needed to pad messages less than `blocksize` bytes. * @private {!Array} */ goog.crypt.Sha2_64bit.PADDING_ = goog.array.concat( @@ -146,11 +144,11 @@ goog.crypt.Sha2_64bit.prototype.reset = function() { /** @override */ goog.crypt.Sha2_64bit.prototype.update = function(message, opt_length) { - var length = goog.isDef(opt_length) ? opt_length : message.length; + var length = (opt_length !== undefined) ? opt_length : message.length; // Make sure this hasher is usable. if (this.needsReset_) { - throw Error('this hasher needs to be reset'); + throw new Error('this hasher needs to be reset'); } // Process the message from left to right up to |length| bytes. // When we get a 512-bit chunk, compute the hash of it and reset @@ -161,11 +159,11 @@ goog.crypt.Sha2_64bit.prototype.update = function(message, opt_length) { var chunkBytes = this.chunkBytes_; // The input message could be either byte array or string. - if (goog.isString(message)) { + if (typeof message === 'string') { for (var i = 0; i < length; i++) { var b = message.charCodeAt(i); if (b > 255) { - throw Error('Characters must be in range [0,255]'); + throw new Error('Characters must be in range [0,255]'); } this.chunk_[chunkBytes++] = b; if (chunkBytes == this.blockSize) { @@ -178,8 +176,8 @@ goog.crypt.Sha2_64bit.prototype.update = function(message, opt_length) { var b = message[i]; // Hack: b|0 coerces b to an integer, so the last part confirms that // b has no fractional part. - if (!goog.isNumber(b) || b < 0 || b > 255 || b != (b | 0)) { - throw Error('message must be a byte array'); + if (typeof b !== 'number' || b < 0 || b > 255 || b != (b | 0)) { + throw new Error('message must be a byte array'); } this.chunk_[chunkBytes++] = b; if (chunkBytes == this.blockSize) { @@ -188,7 +186,7 @@ goog.crypt.Sha2_64bit.prototype.update = function(message, opt_length) { } } } else { - throw Error('message must be string or array'); + throw new Error('message must be string or array'); } // Record the current bytes in chunk to support partial update. @@ -202,7 +200,7 @@ goog.crypt.Sha2_64bit.prototype.update = function(message, opt_length) { /** @override */ goog.crypt.Sha2_64bit.prototype.digest = function() { if (this.needsReset_) { - throw Error('this hasher needs to be reset'); + throw new Error('this hasher needs to be reset'); } var totalBits = this.total_ * 8; @@ -391,8 +389,8 @@ goog.crypt.Sha2_64bit.prototype.Sigma1_ = function(value) { /** * Calculates the SHA-2 64-bit choose function. * - * This function uses {@code value} as a mask to choose bits from either - * {@code one} if the bit is set or {@code two} if the bit is not set. + * This function uses `value` as a mask to choose bits from either + * `one` if the bit is set or `two` if the bit is not set. * * @private * @param {!goog.math.Long} value diff --git a/third_party/closure/goog/crypt/sha384.js b/third_party/closure/goog/crypt/sha384.js index 1feab8482933b..162c71f36ed4f 100644 --- a/third_party/closure/goog/crypt/sha384.js +++ b/third_party/closure/goog/crypt/sha384.js @@ -19,8 +19,6 @@ * var sha384 = new goog.crypt.Sha384(); * sha384.update(bytes); * var hash = sha384.digest(); - * - * @author fy@google.com (Frank Yellin) */ goog.provide('goog.crypt.Sha384'); diff --git a/third_party/closure/goog/crypt/sha512.js b/third_party/closure/goog/crypt/sha512.js index 100484b76803e..f119589cd9f8f 100644 --- a/third_party/closure/goog/crypt/sha512.js +++ b/third_party/closure/goog/crypt/sha512.js @@ -19,8 +19,6 @@ * var sha512 = new goog.crypt.Sha512(); * sha512.update(bytes); * var hash = sha512.digest(); - * - * @author fy@google.com (Frank Yellin) */ goog.provide('goog.crypt.Sha512'); diff --git a/third_party/closure/goog/crypt/sha512_256.js b/third_party/closure/goog/crypt/sha512_256.js index 7e423982ddaf5..d8064f03b3ff3 100644 --- a/third_party/closure/goog/crypt/sha512_256.js +++ b/third_party/closure/goog/crypt/sha512_256.js @@ -25,8 +25,6 @@ * var sha512_256 = new goog.crypt.Sha512_256(); * sha512_256.update(bytes); * var hash = sha512_256.digest(); - * - * @author fy@google.com (Frank Yellin) */ goog.provide('goog.crypt.Sha512_256'); diff --git a/third_party/closure/goog/crypt/sha512_perf.html b/third_party/closure/goog/crypt/sha512_perf.html deleted file mode 100644 index e7cf5d21acc90..0000000000000 --- a/third_party/closure/goog/crypt/sha512_perf.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - -Closure Performance Tests - goog.crypt.Sha512 - - - - - -

Closure Performance Tests - goog.crypt.Sha512

-

-User-agent: - -

- - - - diff --git a/third_party/closure/goog/css/filteredmenu.css b/third_party/closure/goog/css/filteredmenu.css index b43a113253af8..967af0847b723 100644 --- a/third_party/closure/goog/css/filteredmenu.css +++ b/third_party/closure/goog/css/filteredmenu.css @@ -18,6 +18,7 @@ .goog-menu-filter div { color: gray; + pointer-events: none; position: absolute; padding: 1px; } diff --git a/third_party/closure/goog/cssom/BUILD.bazel b/third_party/closure/goog/cssom/BUILD.bazel new file mode 100644 index 0000000000000..302d3871a5416 --- /dev/null +++ b/third_party/closure/goog/cssom/BUILD.bazel @@ -0,0 +1,27 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [ + ":cssom", + "//third_party/closure/goog/cssom/iframe:all_js", + ], +) + +closure_js_library( + name = "cssom", + srcs = ["cssom.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/array", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:tagname", + ], +) diff --git a/third_party/closure/goog/cssom/cssom.js b/third_party/closure/goog/cssom/cssom.js index 1ff34e2561ee5..f57e51ebc7d00 100644 --- a/third_party/closure/goog/cssom/cssom.js +++ b/third_party/closure/goog/cssom/cssom.js @@ -33,7 +33,7 @@ goog.require('goog.dom.TagName'); /** - * Enumeration of {@code CSSRule} types. + * Enumeration of `CSSRule` types. * @enum {number} */ goog.cssom.CssRuleType = { @@ -48,8 +48,8 @@ goog.cssom.CssRuleType = { /** * Recursively gets all CSS as text, optionally starting from a given - * CSSStyleSheet. - * @param {(CSSStyleSheet|StyleSheetList)=} opt_styleSheet The CSSStyleSheet. + * StyleSheet. + * @param {(StyleSheet|StyleSheetList)=} opt_styleSheet * @return {string} css text. */ goog.cssom.getAllCssText = function(opt_styleSheet) { @@ -60,10 +60,10 @@ goog.cssom.getAllCssText = function(opt_styleSheet) { /** * Recursively gets all CSSStyleRules, optionally starting from a given - * CSSStyleSheet. + * StyleSheet. * Note that this excludes any CSSImportRules, CSSMediaRules, etc.. - * @param {(CSSStyleSheet|StyleSheetList)=} opt_styleSheet The CSSStyleSheet. - * @return {Array} A list of CSSStyleRules. + * @param {(StyleSheet|StyleSheetList)=} opt_styleSheet + * @return {!Array} A list of CSSStyleRules. */ goog.cssom.getAllCssStyleRules = function(opt_styleSheet) { var styleSheet = opt_styleSheet || document.styleSheets; @@ -78,11 +78,12 @@ goog.cssom.getAllCssStyleRules = function(opt_styleSheet) { * Firefox will return styleSheet.cssRules, which includes ImportRules and * anything which implements the CSSRules interface. IE returns simply a list of * CSSRules. - * @param {CSSStyleSheet} styleSheet The CSSStyleSheet. + * @param {StyleSheet} styleSheet * @throws {Error} If we cannot access the rules on a stylesheet object - this * can happen if a stylesheet object's rules are accessed before the rules * have been downloaded and parsed and are "ready". * @return {CSSRuleList} An array of CSSRules or null. + * @suppress {strictMissingProperties} StyleSheet does not define cssRules */ goog.cssom.getCssRulesFromStyleSheet = function(styleSheet) { var cssRuleList = null; @@ -110,29 +111,29 @@ goog.cssom.getCssRulesFromStyleSheet = function(styleSheet) { /** - * Gets all CSSStyleSheet objects starting from some CSSStyleSheet. Note that we + * Gets all StyleSheet objects starting from some StyleSheet. Note that we * want to return the sheets in the order of the cascade, therefore if we - * encounter an import, we will splice that CSSStyleSheet object in front of - * the CSSStyleSheet that contains it in the returned array of CSSStyleSheets. - * @param {(CSSStyleSheet|StyleSheetList)=} opt_styleSheet A CSSStyleSheet. + * encounter an import, we will splice that StyleSheet object in front of + * the StyleSheet that contains it in the returned array of StyleSheets. + * @param {(StyleSheet|StyleSheetList)=} opt_styleSheet A StyleSheet. * @param {boolean=} opt_includeDisabled If true, includes disabled stylesheets, * defaults to false. - * @return {!Array} A list of CSSStyleSheet objects. + * @return {!Array} A list of StyleSheet objects. + * @suppress {strictMissingProperties} StyleSheet does not define cssRules */ goog.cssom.getAllCssStyleSheets = function( opt_styleSheet, opt_includeDisabled) { var styleSheetsOutput = []; var styleSheet = opt_styleSheet || document.styleSheets; var includeDisabled = - goog.isDef(opt_includeDisabled) ? opt_includeDisabled : false; + (opt_includeDisabled !== undefined) ? opt_includeDisabled : false; // Imports need to go first. if (styleSheet.imports && styleSheet.imports.length) { for (var i = 0, n = styleSheet.imports.length; i < n; i++) { goog.array.extend( styleSheetsOutput, - goog.cssom.getAllCssStyleSheets( - /** @type {CSSStyleSheet} */ (styleSheet.imports[i]))); + goog.cssom.getAllCssStyleSheets(styleSheet.imports[i])); } } else if (styleSheet.length) { @@ -140,15 +141,16 @@ goog.cssom.getAllCssStyleSheets = function( // http://dev.w3.org/csswg/cssom/#the-stylesheetlist for (var i = 0, n = styleSheet.length; i < n; i++) { goog.array.extend( - styleSheetsOutput, goog.cssom.getAllCssStyleSheets( - /** @type {!CSSStyleSheet} */ (styleSheet[i]))); + styleSheetsOutput, + goog.cssom.getAllCssStyleSheets( + /** @type {!StyleSheet} */ (styleSheet[i]))); } } else { // We need to walk through rules in browsers which implement .cssRules // to see if there are styleSheets buried in there. - // If we have a CSSStyleSheet within CssRules. + // If we have a StyleSheet within CssRules. var cssRuleList = goog.cssom.getCssRulesFromStyleSheet( - /** @type {!CSSStyleSheet} */ (styleSheet)); + /** @type {!StyleSheet} */ (styleSheet)); if (cssRuleList && cssRuleList.length) { // Chrome does not evaluate cssRuleList[i] to undefined when i >=n; // so we use a (i < n) check instead of cssRuleList[i] in the loop below @@ -166,7 +168,7 @@ goog.cssom.getAllCssStyleSheets = function( } } - // This is a CSSStyleSheet. (IE uses .rules, W3c and Opera cssRules.) + // This is a StyleSheet. (IE uses .rules, W3c and Opera cssRules.) if ((styleSheet.type || styleSheet.rules || styleSheet.cssRules) && (!styleSheet.disabled || includeDisabled)) { styleSheetsOutput.push(styleSheet); @@ -184,10 +186,16 @@ goog.cssom.getAllCssStyleSheets = function( goog.cssom.getCssTextFromCssRule = function(cssRule) { var cssText = ''; - if (cssRule.cssText) { - // W3C. + // Per github.com/microsoft/ChakraCore/issues/6165, IE/Edge errors when + // referencing the cssText property in some cases. + try { cssText = cssRule.cssText; - } else if (cssRule.style && cssRule.style.cssText && cssRule.selectorText) { + } catch (e) { + return ''; + } + + if (!cssText && cssRule.style && cssRule.style.cssText && + cssRule.selectorText) { // IE: The spacing here is intended to make the result consistent with // FF and Webkit. // We also remove the special properties that we may have added in @@ -205,9 +213,9 @@ goog.cssom.getCssTextFromCssRule = function(cssRule) { /** - * Get the index of the CSSRule in it's CSSStyleSheet. + * Get the index of the CSSRule in it's StyleSheet. * @param {CSSRule} cssRule A CSSRule. - * @param {CSSStyleSheet=} opt_parentStyleSheet A reference to the stylesheet + * @param {StyleSheet=} opt_parentStyleSheet A reference to the stylesheet * object this cssRule belongs to. * @throws {Error} When we cannot get the parentStyleSheet. * @return {number} The index of the CSSRule, or -1. @@ -225,7 +233,7 @@ goog.cssom.getCssRuleIndexInParentStyleSheet = function( if (!parentStyleSheet) { // We could call getAllCssStyleRules() here to get our special indexes on // the style object, but that seems like it could be wasteful. - throw Error('Cannot find a parentStyleSheet.'); + throw new Error('Cannot find a parentStyleSheet.'); } var cssRuleList = goog.cssom.getCssRulesFromStyleSheet(parentStyleSheet); @@ -246,7 +254,7 @@ goog.cssom.getCssRuleIndexInParentStyleSheet = function( * If the cssRule object isn't coming from a result of that function call, this * method will return undefined in IE. * @param {CSSRule} cssRule The CSSRule. - * @return {CSSStyleSheet} A styleSheet object. + * @return {StyleSheet} A styleSheet object. */ goog.cssom.getParentStyleSheet = function(cssRule) { return cssRule.parentStyleSheet || @@ -263,7 +271,7 @@ goog.cssom.getParentStyleSheet = function(cssRule) { * object in IE. We do some trickery in getAllCssStyleRules to hack this in. * @param {CSSRule} cssRule A CSSRule. * @param {string} cssText The text for the new CSSRule. - * @param {CSSStyleSheet=} opt_parentStyleSheet A reference to the stylesheet + * @param {StyleSheet=} opt_parentStyleSheet A reference to the stylesheet * object this cssRule belongs to. * @param {number=} opt_index The index of the cssRule in its parentStylesheet. * @throws {Error} If we cannot find a parentStyleSheet. @@ -281,18 +289,18 @@ goog.cssom.replaceCssRule = function( goog.cssom.removeCssRule(parentStyleSheet, index); goog.cssom.addCssRule(parentStyleSheet, cssText, index); } else { - throw Error('Cannot proceed without the index of the cssRule.'); + throw new Error('Cannot proceed without the index of the cssRule.'); } } else { - throw Error('Cannot proceed without the parentStyleSheet.'); + throw new Error('Cannot proceed without the parentStyleSheet.'); } }; /** - * Cross browser function to add a CSSRule into a CSSStyleSheet, optionally + * Cross browser function to add a CSSRule into a StyleSheet, optionally * at a given index. - * @param {CSSStyleSheet} cssStyleSheet The CSSRule's parentStyleSheet. + * @param {StyleSheet} cssStyleSheet The CSSRule's parentStyleSheet. * @param {string} cssText The text for the new CSSRule. * @param {number=} opt_index The index of the cssRule in its parentStylesheet. * @throws {Error} If the css rule text appears to be ill-formatted. @@ -323,15 +331,15 @@ goog.cssom.addCssRule = function(cssStyleSheet, cssText, opt_index) { var style = matches[2]; cssStyleSheet.addRule(selector, style, index); } else { - throw Error('Your CSSRule appears to be ill-formatted.'); + throw new Error('Your CSSRule appears to be ill-formatted.'); } } }; /** - * Cross browser function to remove a CSSRule in a CSSStyleSheet at an index. - * @param {CSSStyleSheet} cssStyleSheet The CSSRule's parentStyleSheet. + * Cross browser function to remove a CSSRule in a StyleSheet at an index. + * @param {StyleSheet} cssStyleSheet The CSSRule's parentStyleSheet. * @param {number} index The CSSRule's index in the parentStyleSheet. */ goog.cssom.removeCssRule = function(cssStyleSheet, index) { @@ -385,7 +393,7 @@ goog.cssom.getFileNameFromStyleSheet = function(styleSheet) { var href = styleSheet.href; // Another IE/FF difference. IE returns an empty string, while FF and others - // return null for CSSStyleSheets not from an external file. + // return null for StyleSheets not from an external file. if (!href) { return null; } @@ -399,7 +407,7 @@ goog.cssom.getFileNameFromStyleSheet = function(styleSheet) { /** * Recursively gets all CSS text or rules. - * @param {CSSStyleSheet|StyleSheetList} styleSheet The CSSStyleSheet. + * @param {StyleSheet|StyleSheetList} styleSheet * @param {boolean} isTextOutput If true, output is cssText, otherwise cssRules. * @return {string|!Array} cssText or cssRules. * @private diff --git a/third_party/closure/goog/cssom/cssom_test_import_1.css b/third_party/closure/goog/cssom/cssom_test_import_1.css new file mode 100644 index 0000000000000..566f907ff819c --- /dev/null +++ b/third_party/closure/goog/cssom/cssom_test_import_1.css @@ -0,0 +1,11 @@ +/* + * Copyright 2010 The Closure Library Authors. All Rights Reserved. + * + * Use of this source code is governed by the Apache License, Version 2.0. + * See the COPYING file for details. + */ + +@import "cssom_test_import_2.css"; +.css-import-1 { + display: block; +} diff --git a/third_party/closure/goog/cssom/cssom_test_import_2.css b/third_party/closure/goog/cssom/cssom_test_import_2.css new file mode 100644 index 0000000000000..dc31c9620a401 --- /dev/null +++ b/third_party/closure/goog/cssom/cssom_test_import_2.css @@ -0,0 +1,10 @@ +/* + * Copyright 2010 The Closure Library Authors. All Rights Reserved. + * + * Use of this source code is governed by the Apache License, Version 2.0. + * See the COPYING file for details. + */ + +.css-import-2 { + display: block; +} diff --git a/third_party/closure/goog/cssom/cssom_test_link_1.css b/third_party/closure/goog/cssom/cssom_test_link_1.css new file mode 100644 index 0000000000000..832a8e31ce983 --- /dev/null +++ b/third_party/closure/goog/cssom/cssom_test_link_1.css @@ -0,0 +1,10 @@ +/* + * Copyright 2010 The Closure Library Authors. All Rights Reserved. + * + * Use of this source code is governed by the Apache License, Version 2.0. + * See the COPYING file for details. + */ + +.css-link-1 { + display: block; +} diff --git a/third_party/closure/goog/cssom/iframe/BUILD.bazel b/third_party/closure/goog/cssom/iframe/BUILD.bazel new file mode 100644 index 0000000000000..bb556649b5318 --- /dev/null +++ b/third_party/closure/goog/cssom/iframe/BUILD.bazel @@ -0,0 +1,30 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [":style"], +) + +closure_js_library( + name = "style", + srcs = ["style.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/asserts", + "//third_party/closure/goog/cssom", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:classlist", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/string", + "//third_party/closure/goog/style", + "//third_party/closure/goog/useragent", + ], +) diff --git a/third_party/closure/goog/cssom/iframe/style.js b/third_party/closure/goog/cssom/iframe/style.js index 660e182269b5b..081f9f9f4408d 100644 --- a/third_party/closure/goog/cssom/iframe/style.js +++ b/third_party/closure/goog/cssom/iframe/style.js @@ -15,7 +15,7 @@ /** * @fileoverview Provides utility routines for copying modified - * {@code CSSRule} objects from the parent document into iframes so that any + * `CSSRule` objects from the parent document into iframes so that any * content in the iframe will be styled as if it was inline in the parent * document. * @@ -43,7 +43,6 @@ * * body .highlighted { background-color: yellow; } *

- * */ @@ -126,11 +125,11 @@ goog.cssom.iframe.style.CssRuleSet_ = function() { /** - * Initializes the rule set from a {@code CSSRule}. + * Initializes the rule set from a `CSSRule`. * - * @param {CSSRule} cssRule The {@code CSSRule} to initialize from. + * @param {CSSRule} cssRule The `CSSRule` to initialize from. * @return {boolean} True if initialization succeeded. We only support - * {@code CSSStyleRule} and {@code CSSFontFaceRule} objects. + * `CSSStyleRule` and `CSSFontFaceRule` objects. */ goog.cssom.iframe.style.CssRuleSet_.prototype.initializeFromCssRule = function( cssRule) { @@ -303,6 +302,8 @@ goog.cssom.iframe.style.makeColorRuleImportant_ = function(cssText) { * @private */ goog.cssom.iframe.style.CssSelector_ = function(opt_selectorString) { + /** @type {!Array|undefined} */ + this.parts; /** * Object to track ancestry matches to speed up repeatedly testing this @@ -574,7 +575,7 @@ goog.cssom.iframe.style.getRuleSetsFromDocument_ = function(doc) { * Static object to cache rulesets read from documents. Inspecting all * active css rules is an expensive operation, so its best to only do * it once and then cache the results. - * @type {Object} + * @const * @private */ goog.cssom.iframe.style.ruleSetCache_ = {}; @@ -582,10 +583,10 @@ goog.cssom.iframe.style.ruleSetCache_ = {}; /** * Cache of ruleset objects keyed by document unique ID. - * @type {Object} + * @const {!Object>} * @private */ -goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_ = {}; +goog.cssom.iframe.style.ruleSetCache_.cache_ = {}; /** @@ -595,7 +596,7 @@ goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_ = {}; */ goog.cssom.iframe.style.ruleSetCache_.loadRuleSetsForDocument = function(doc) { var docUid = goog.getUid(doc); - goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_[docUid] = + goog.cssom.iframe.style.ruleSetCache_.cache_[docUid] = goog.cssom.iframe.style.getRuleSetsFromDocument_(doc); }; @@ -609,7 +610,7 @@ goog.cssom.iframe.style.ruleSetCache_.loadRuleSetsForDocument = function(doc) { */ goog.cssom.iframe.style.ruleSetCache_.getRuleSetsForDocument = function(doc) { var docUid = goog.getUid(doc); - var cache = goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_; + var cache = goog.cssom.iframe.style.ruleSetCache_.cache_; if (!cache[docUid]) { goog.cssom.iframe.style.ruleSetCache_.loadRuleSetsForDocument(doc); } @@ -624,7 +625,6 @@ goog.cssom.iframe.style.ruleSetCache_.getRuleSetsForDocument = function(doc) { return ruleSetsCopy; }; - /** * Array of CSS properties that are inherited by child nodes, according to * the CSS 2.1 spec. Properties that may be set to relative values, such @@ -681,7 +681,7 @@ goog.cssom.iframe.style.textProperties_ = [ * @param {boolean=} opt_forceRuleSetCacheUpdate Flag to force the internal * cache of rulesets to refresh itself before we read the same. * @param {boolean=} opt_copyBackgroundContext Flag indicating that if the - * {@code element} has a transparent background, background rules + * `element` has a transparent background, background rules * from the nearest ancestor element(s) that have background-color * and/or background-image set should be copied. * @return {string} String containing all CSS rules present in the original @@ -892,6 +892,7 @@ goog.cssom.iframe.style.getBackgroundXYValues_ = function(styleObject) { goog.cssom.iframe.style.getBackgroundContext = function(element) { var propertyValues = {'backgroundImage': 'none'}; var ancestor = element; + /** @type {!Window|undefined} */ var currentIframeWindow; // Walk up the DOM tree to find the ancestor nodes whose backgrounds // may be visible underneath this element. Background-image and diff --git a/third_party/closure/goog/cssom/iframe/style_test_import.css b/third_party/closure/goog/cssom/iframe/style_test_import.css new file mode 100644 index 0000000000000..d2c603f0470e8 --- /dev/null +++ b/third_party/closure/goog/cssom/iframe/style_test_import.css @@ -0,0 +1,10 @@ +/* + * Copyright 2010 The Closure Library Authors. All Rights Reserved. + * + * Use of this source code is governed by the Apache License, Version 2.0. + * See the COPYING file for details. + */ + +div div strong { + font-style: italic; +} diff --git a/third_party/closure/goog/datasource/BUILD.bazel b/third_party/closure/goog/datasource/BUILD.bazel new file mode 100644 index 0000000000000..e0fe80eef0127 --- /dev/null +++ b/third_party/closure/goog/datasource/BUILD.bazel @@ -0,0 +1,124 @@ +# DO NOT EDIT -- bazel run //third_party/closure/goog:regenerate -- "$PWD" + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load("@rules_python//python:defs.bzl", "py_binary") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") + +closure_js_library( + name = "all_js", + exports = [ + ":datamanager", + ":datasource", + ":expr", + ":fastdatanode", + ":jsdatasource", + ":jsondatasource", + ":jsxmlhttpdatasource", + ":xmldatasource", + ], +) + +closure_js_library( + name = "datamanager", + srcs = ["datamanager.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/datasource:expr", + "//third_party/closure/goog/object", + "//third_party/closure/goog/string", + "//third_party/closure/goog/structs", + "//third_party/closure/goog/structs:map", + ], +) + +closure_js_library( + name = "datasource", + srcs = ["datasource.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/array", + "//third_party/closure/goog/log", + ], +) + +closure_js_library( + name = "expr", + srcs = ["expr.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/string", + ], +) + +closure_js_library( + name = "fastdatanode", + srcs = ["fastdatanode.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/datasource:datamanager", + "//third_party/closure/goog/string", + ], +) + +closure_js_library( + name = "jsdatasource", + srcs = ["jsdatasource.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/datasource:datamanager", + ], +) + +closure_js_library( + name = "jsondatasource", + srcs = ["jsondatasource.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/datasource:datamanager", + "//third_party/closure/goog/datasource:jsdatasource", + "//third_party/closure/goog/dom", + "//third_party/closure/goog/dom:safe", + "//third_party/closure/goog/dom:tagname", + "//third_party/closure/goog/log", + ], +) + +closure_js_library( + name = "jsxmlhttpdatasource", + srcs = ["jsxmlhttpdatasource.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/datasource:datamanager", + "//third_party/closure/goog/datasource:fastdatanode", + "//third_party/closure/goog/events", + "//third_party/closure/goog/log", + "//third_party/closure/goog/net:eventtype", + "//third_party/closure/goog/net:xhrio", + "//third_party/closure/goog/uri", + ], +) + +closure_js_library( + name = "xmldatasource", + srcs = ["xmldatasource.js"], + lenient = True, + deps = [ + "//third_party/closure/goog/datasource", + "//third_party/closure/goog/datasource:datamanager", + "//third_party/closure/goog/dom:nodetype", + "//third_party/closure/goog/dom:xml", + "//third_party/closure/goog/log", + "//third_party/closure/goog/net:xhrio", + "//third_party/closure/goog/string", + "//third_party/closure/goog/uri", + ], +) diff --git a/third_party/closure/goog/datasource/datamanager.js b/third_party/closure/goog/datasource/datamanager.js index 89fb498bd25ec..7adf2f336b18b 100644 --- a/third_party/closure/goog/datasource/datamanager.js +++ b/third_party/closure/goog/datasource/datamanager.js @@ -23,7 +23,6 @@ * * Implements DataNode to provide the top element in a data registry * Prepends '$' to top level data names in path to denote they are root object - * */ goog.provide('goog.ds.DataManager'); @@ -179,7 +178,7 @@ goog.ds.DataManager.prototype.get = function() { /** @override */ goog.ds.DataManager.prototype.set = function(value) { - throw Error('Can\'t set on DataManager'); + throw new Error('Can\'t set on DataManager'); }; @@ -496,7 +495,7 @@ goog.ds.DataManager.prototype.getListenerCount = function() { */ goog.ds.DataManager.prototype.runWithoutFiringDataChanges = function(callback) { if (this.disableFiring_) { - throw Error('Can not nest calls to runWithoutFiringDataChanges'); + throw new Error('Can not nest calls to runWithoutFiringDataChanges'); } this.disableFiring_ = true; diff --git a/third_party/closure/goog/datasource/datasource.js b/third_party/closure/goog/datasource/datasource.js index 0a73115c5e4ea..bb06499bd56ad 100644 --- a/third_party/closure/goog/datasource/datasource.js +++ b/third_party/closure/goog/datasource/datasource.js @@ -17,7 +17,6 @@ * * Abstraction for data sources that allows listening for changes at different * levels of the data tree and updating the data via XHR requests - * */ @@ -479,7 +478,7 @@ goog.inherits(goog.ds.EmptyNodeList, goog.ds.BasicNodeList); * @override */ goog.ds.EmptyNodeList.prototype.add = function(node) { - throw Error('Can\'t add to EmptyNodeList'); + throw new Error('Can\'t add to EmptyNodeList'); }; diff --git a/third_party/closure/goog/datasource/expr.js b/third_party/closure/goog/datasource/expr.js index bff1e6304ce4f..d487399840e40 100644 --- a/third_party/closure/goog/datasource/expr.js +++ b/third_party/closure/goog/datasource/expr.js @@ -28,7 +28,6 @@ * not enforced by the expression evaluation functions, instead it is * provided as a flag for client code which may ignore depending on usage * - If expression has [INDEX], will use getChildNodes().getByIndex(INDEX) - * */ diff --git a/third_party/closure/goog/datasource/fastdatanode.js b/third_party/closure/goog/datasource/fastdatanode.js index f37c3643cd1c4..5d9ce5a244ee6 100644 --- a/third_party/closure/goog/datasource/fastdatanode.js +++ b/third_party/closure/goog/datasource/fastdatanode.js @@ -32,7 +32,6 @@ * * FastDataNodes can be constructed from JSON-like objects via the function * goog.ds.FastDataNode.fromJs. - */ goog.provide('goog.ds.AbstractFastDataNode'); @@ -66,7 +65,7 @@ goog.require('goog.string'); // TODO(arv): Use interfaces when available. goog.ds.AbstractFastDataNode = function(dataName, opt_parent) { if (!dataName) { - throw Error('Cannot create a fast data node without a data name'); + throw new Error('Cannot create a fast data node without a data name'); } this['__dataName'] = dataName; this['__parent'] = opt_parent; @@ -190,7 +189,7 @@ goog.ds.FastDataNode.prototype.getChildNodes = function(opt_selector) { return child ? new goog.ds.FastListNode([child], '') : new goog.ds.EmptyNodeList(); } else { - throw Error('Unsupported selector: ' + opt_selector); + throw new Error('Unsupported selector: ' + opt_selector); } }; @@ -280,7 +279,7 @@ goog.ds.FastDataNode.prototype.isList = function() { /** * Returns a javascript object representation of this data node. You should * not modify the object returned by this function. - * @return {!Object} Javascript object representation of this data node. + * @return {!Object} JavaScript object representation of this data node. */ goog.ds.FastDataNode.prototype.getJsObject = function() { var result = {}; @@ -327,7 +326,7 @@ goog.ds.FastDataNode.prototype.add = function(value) { * @override */ goog.ds.FastDataNode.prototype.get = function(opt_key) { - if (!goog.isDef(opt_key)) { + if (opt_key === undefined) { // if there is no key, DataNode#get was called return this; } else { @@ -433,7 +432,7 @@ goog.ds.PrimitiveFastDataNode.prototype.get = function() { */ goog.ds.PrimitiveFastDataNode.prototype.set = function(value) { if (goog.isArray(value) || goog.isObject(value)) { - throw Error('can only set PrimitiveFastDataNode to primitive values'); + throw new Error('can only set PrimitiveFastDataNode to primitive values'); } this.value_ = value; goog.ds.DataManager.getInstance().fireDataChange(this.getDataPath()); @@ -480,7 +479,7 @@ goog.ds.PrimitiveFastDataNode.prototype.getChildNodeValue = function(name) { * @override */ goog.ds.PrimitiveFastDataNode.prototype.setChildNode = function(name, value) { - throw Error('Cannot set a child node for a PrimitiveFastDataNode'); + throw new Error('Cannot set a child node for a PrimitiveFastDataNode'); }; @@ -498,7 +497,7 @@ goog.ds.PrimitiveFastDataNode.prototype.isList = function() { /** * Returns a javascript object representation of this data node. You should * not modify the object returned by this function. - * @return {*} Javascript object representation of this data node. + * @return {*} JavaScript object representation of this data node. */ goog.ds.PrimitiveFastDataNode.prototype.getJsObject = function() { return this.value_; @@ -539,7 +538,7 @@ goog.inherits(goog.ds.FastListNode, goog.ds.AbstractFastDataNode); * @override */ goog.ds.FastListNode.prototype.set = function(value) { - throw Error('Cannot set a FastListNode to a new value'); + throw new Error('Cannot set a FastListNode to a new value'); }; @@ -627,7 +626,7 @@ goog.ds.FastListNode.prototype.setChildNode = function(key, value) { var index = this.getKeyAsNumber_(key); if (index != null) { if (index < 0 || index >= this.values_.length) { - throw Error('List index out of bounds: ' + index); + throw new Error('List index out of bounds: ' + index); } // NOTE: This code here appears to want to use "index" rather than // "key" here (which would be better for an array. However, changing @@ -685,7 +684,7 @@ goog.ds.FastListNode.prototype.isList = function() { /** * Returns a javascript object representation of this data node. You should * not modify the object returned by this function. - * @return {!Object} Javascript object representation of this data node. + * @return {!Object} JavaScript object representation of this data node. */ goog.ds.FastListNode.prototype.getJsObject = function() { var result = []; @@ -730,7 +729,7 @@ goog.ds.FastListNode.prototype.add = function(value) { */ goog.ds.FastListNode.prototype.get = function(opt_key) { // if there are no arguments, DataNode.get was called - if (!goog.isDef(opt_key)) { + if (opt_key === undefined) { return this.values_; } else { return this.getChildNode(opt_key); @@ -767,7 +766,8 @@ goog.ds.FastListNode.prototype.getCount = function() { * @override */ goog.ds.FastListNode.prototype.setNode = function(name, value) { - throw Error('Setting child nodes of a FastListNode is not implemented, yet'); + throw new Error( + 'Setting child nodes of a FastListNode is not implemented, yet'); }; @@ -817,7 +817,7 @@ goog.ds.FastListNode.prototype.indexOf = function(name) { index = this.map_[name]; } if (index == null) { - throw Error('Cannot determine index for: ' + name); + throw new Error('Cannot determine index for: ' + name); } return /** @type {number} */ (index); }; diff --git a/third_party/closure/goog/datasource/jsdatasource.js b/third_party/closure/goog/datasource/jsdatasource.js index 04fa8bdb7c6c6..267d3fb3f5d62 100644 --- a/third_party/closure/goog/datasource/jsdatasource.js +++ b/third_party/closure/goog/datasource/jsdatasource.js @@ -14,7 +14,6 @@ /** * @fileoverview An implementation of DataNode for wrapping JS data. - * */ @@ -99,7 +98,7 @@ goog.ds.JsDataSource.prototype.get = function() { */ goog.ds.JsDataSource.prototype.set = function(value) { if (value && goog.isObject(this.root_)) { - throw Error('Can\'t set group nodes to new values yet'); + throw new Error('Can\'t set group nodes to new values yet'); } if (this.parent_) { @@ -131,7 +130,7 @@ goog.ds.JsDataSource.prototype.getChildNodes = function(opt_selector) { return new goog.ds.EmptyNodeList(); } } else { - throw Error('Selector not supported yet (' + opt_selector + ')'); + throw new Error('Selector not supported yet (' + opt_selector + ')'); } }; diff --git a/third_party/closure/goog/datasource/jsondatasource.js b/third_party/closure/goog/datasource/jsondatasource.js index 5d043df0f9008..cffc952ee65a1 100644 --- a/third_party/closure/goog/datasource/jsondatasource.js +++ b/third_party/closure/goog/datasource/jsondatasource.js @@ -14,15 +14,14 @@ /** * @fileoverview Implementation of DataNode for wrapping JSON data. - * */ goog.provide('goog.ds.JsonDataSource'); -goog.require('goog.Uri'); goog.require('goog.dom'); goog.require('goog.dom.TagName'); +goog.require('goog.dom.safe'); goog.require('goog.ds.DataManager'); goog.require('goog.ds.JsDataSource'); goog.require('goog.ds.LoadState'); @@ -49,7 +48,7 @@ goog.require('goog.log'); * A URI of an empty string will mean that no request is made * and the data source will be a data source with no child nodes * - * @param {string|goog.Uri} uri URI for the request. + * @param {?goog.html.TrustedResourceUrl} uri URI for the request. * @param {string} name Name of the datasource. * @param {string=} opt_callbackParamName The parameter name that is used to * specify the callback. Defaults to 'callback'. @@ -60,11 +59,7 @@ goog.require('goog.log'); */ goog.ds.JsonDataSource = function(uri, name, opt_callbackParamName) { goog.ds.JsDataSource.call(this, null, name, null); - if (uri) { - this.uri_ = new goog.Uri(uri); - } else { - this.uri_ = null; - } + this.uri_ = uri; /** * This is the callback parameter name that is added to the uri. @@ -103,20 +98,21 @@ goog.ds.JsonDataSource.prototype.load = function() { // that it also doesn't get renamed and stops the compiler from complaining goog.ds.JsonDataSource['dataSources'][this.dataName_] = this; goog.log.info( - goog.ds.logger, 'Sending JS request for DataSource ' + - this.getDataName() + ' to ' + this.uri_); + goog.ds.logger, + 'Sending JS request for DataSource ' + this.getDataName() + ' to ' + + this.uri_.getTypedStringValue()); this.loadState_ = goog.ds.LoadState.LOADING; - var uriToCall = new goog.Uri(this.uri_); - uriToCall.setParameterValue( - this.callbackParamName_, 'JsonReceive.' + this.dataName_); + var params = {}; + params[this.callbackParamName_] = 'JsonReceive.' + this.dataName_; + var uriToCall = this.uri_.cloneWithParams(params); goog.global['JsonReceive'][this.dataName_] = goog.bind(this.receiveData, this); - var scriptEl = - goog.dom.createDom(goog.dom.TagName.SCRIPT, {'src': uriToCall}); + var scriptEl = goog.dom.createDom(goog.dom.TagName.SCRIPT); + goog.dom.safe.setScriptSrc(scriptEl, uriToCall); goog.dom.getElementsByTagNameAndClass(goog.dom.TagName.HEAD)[0].appendChild( scriptEl); } else { diff --git a/third_party/closure/goog/datasource/jsxmlhttpdatasource.js b/third_party/closure/goog/datasource/jsxmlhttpdatasource.js index d540468d2cbf9..84ded8e597a4e 100644 --- a/third_party/closure/goog/datasource/jsxmlhttpdatasource.js +++ b/third_party/closure/goog/datasource/jsxmlhttpdatasource.js @@ -19,7 +19,6 @@ * * Response can have unexecutable starting/ending text to prevent inclusion * using '); - } catch (e) { - // ignore - } - assertFalse(window.xssFiredInertDocument); -} - - -/** - * @suppress {accessControls} - */ -function testInertCustomElements() { - if (typeof HTMLTemplateElement != 'function' || !document.registerElement) { - return; // skip test - } - - var inertDoc = goog.html.sanitizer.CssSanitizer.createInertDocument_(); - var xFooConstructor = document.registerElement('x-foo'); - var xFooElem = - document.implementation.createHTMLDocument('').createElement('x-foo'); - assertTrue(xFooElem instanceof xFooConstructor); // sanity check - - var inertXFooElem = inertDoc.createElement('x-foo'); - assertFalse(inertXFooElem instanceof xFooConstructor); -} diff --git a/third_party/closure/goog/html/sanitizer/elementweakmap.js b/third_party/closure/goog/html/sanitizer/elementweakmap.js new file mode 100644 index 0000000000000..2e1c11f39a3d7 --- /dev/null +++ b/third_party/closure/goog/html/sanitizer/elementweakmap.js @@ -0,0 +1,109 @@ +// Copyright 2017 The Closure Library Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @package + * @supported IE 10+ and other browsers. IE 8 and IE 9 could be supported by + * by making anti-clobbering support optional. + */ + +goog.module('goog.html.sanitizer.ElementWeakMap'); +goog.module.declareLegacyNamespace(); + +var noclobber = goog.require('goog.html.sanitizer.noclobber'); + +// We also need to check if WeakMap has been polyfilled, because we want to use +// ElementWeakMap instead of the polyfill. +/** @const {boolean} */ +var NATIVE_WEAKMAP_SUPPORTED = typeof WeakMap != 'undefined' && + WeakMap.toString().indexOf('[native code]') != -1; + +/** @const {string} */ +var DATA_ATTRIBUTE_NAME_PREFIX = 'data-elementweakmap-index-'; + +// Increased every time a new ElementWeakMap is constructed, to guarantee +// that each weakmap uses a different attribute name. +var weakMapCount = 0; + +/** + * A weakmap-like implementation for browsers that don't support native WeakMap. + * It uses a data attribute on the key element for O(1) lookups. + * @template T + * @constructor + */ +var ElementWeakMap = function() { + /** @private {!Array} */ + this.keys_ = []; + + /** @private {!Array} */ + this.values_ = []; + + /** @private @const {string} */ + this.dataAttributeName_ = DATA_ATTRIBUTE_NAME_PREFIX + weakMapCount++; +}; + +/** + * Stores a `elementKey` -> `value` mapping. + * @param {!Element} elementKey + * @param {!T} value + * @return {!ElementWeakMap} + */ +ElementWeakMap.prototype.set = function(elementKey, value) { + if (noclobber.hasElementAttribute(elementKey, this.dataAttributeName_)) { + var itemIndex = parseInt( + noclobber.getElementAttribute(elementKey, this.dataAttributeName_), 10); + this.values_[itemIndex] = value; + } else { + var itemIndex = this.values_.push(value) - 1; + noclobber.setElementAttribute( + elementKey, this.dataAttributeName_, itemIndex.toString()); + this.keys_.push(elementKey); + } + return this; +}; + +/** + * Gets the value previously stored for `elementKey`, or undefined if no + * value was stored for such key. + * @param {!Element} elementKey + * @return {!Element|undefined} + */ +ElementWeakMap.prototype.get = function(elementKey) { + if (!noclobber.hasElementAttribute(elementKey, this.dataAttributeName_)) { + return undefined; + } + var itemIndex = parseInt( + noclobber.getElementAttribute(elementKey, this.dataAttributeName_), 10); + return this.values_[itemIndex]; +}; + +/** Clears the map. */ +ElementWeakMap.prototype.clear = function() { + this.keys_.forEach(function(el) { + noclobber.removeElementAttribute(el, this.dataAttributeName_); + }, this); + this.keys_ = []; + this.values_ = []; +}; + +/** + * Returns either this weakmap adapter or the native weakmap implmentation, if + * available. + * @return {!ElementWeakMap|!WeakMap} + */ +ElementWeakMap.newWeakMap = function() { + return NATIVE_WEAKMAP_SUPPORTED ? new WeakMap() : new ElementWeakMap(); +}; + +exports = ElementWeakMap; diff --git a/third_party/closure/goog/html/sanitizer/html_test_vectors.js b/third_party/closure/goog/html/sanitizer/html_test_vectors.js new file mode 100644 index 0000000000000..b18de7889840a --- /dev/null +++ b/third_party/closure/goog/html/sanitizer/html_test_vectors.js @@ -0,0 +1,27645 @@ +// Copyright 2019 The Closure Library Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// AUTOGENERATED. DO NOT EDIT. +// clang-format off + +goog.provide('goog.html.htmlTestVectors'); +goog.setTestOnly(); + +goog.html.htmlTestVectors.HTML_TEST_VECTORS = [ + {input: "", + acceptable: [ + "", + ], + name: "body_onload"}, + {input: "
", + acceptable: [ + "", + "
", + ], + name: "clobbering_children"}, + {input: "
", + acceptable: [ + "", + "
", + ], + name: "clobbering_firstchild"}, + {input: "
", + acceptable: [ + "", + "
", + ], + name: "clobbering_proto"}, + {input: "
", + acceptable: [ + "", + ], + name: "clobbering_tagname"}, + {input: "
", + acceptable: [ + "", + "
", + "
", + "
", + "
", + "
", + ], + name: "details"}, + {input: "", + ], + name: "iframe_src"}, + {input: "", + "", + "", + ], + name: "iframe_srcdoc"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + ], + name: "img"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + ], + name: "img_comment"}, + {input: "\">", + acceptable: [ + "">", + "">", + "\">", + "\">", + ], + name: "img_malformed"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + ], + name: "img_onerror"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + ], + name: "img_quot"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + "", + ], + name: "img_style"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + ], + name: "img_tab"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + ], + name: "input"}, + {input: "a>a>a>", + acceptable: [ + "a>a>", + "", + "a>a>", + "a>a>", + ], + name: "mess_of_anchors"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "nested_anchors"}, + {input: "", + acceptable: [ + "", + ], + name: "object"}, + {input: "javascript:/*-->", + acceptable: [ + "javascript:/*-->", + ], + name: "polygot"}, + {input: "javascript:x//*/javascript:javascript:\"/*'/*`/*-->*/script>alert()</script>", + ], + name: "script_inception"}, + {input: "", + acceptable: [ + "", + ], + name: "script_src"}, + {input: "", + acceptable: [ + "", + ], + name: "script_title"}, + {input: "", + acceptable: [ + "", + ], + name: "svg"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "", + ], + name: "unicode"}, + {input: "", + acceptable: [ + "", + "", + "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_html_plain"}, + {input: "", + acceptable: [ + "", + "", + "", + "
", + "", + "", + "", + "", + "", + "
", + "
", + "
", + ], + name: "contract_html_scriptinside"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_media"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_nonce"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_srcset"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_srcdoc"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_poster"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_autoplay"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_controls"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_formaction"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_formmethod"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_pattern"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_icon"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_html_select"}, + {input: "", + acceptable: [ + "", + "", + "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_head_plain"}, + {input: "", + acceptable: [ + "", + "", + "", + "
", + "", + "", + "", + "", + "", + "
", + "
", + "
", + ], + name: "contract_head_scriptinside"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_media"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_nonce"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_srcset"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_srcdoc"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_poster"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_autoplay"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_controls"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_formaction"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_formmethod"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_pattern"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_icon"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_head_select"}, + {input: "", + acceptable: [ + "", + "", + "<span></span>", + "<span />", + "", + ], + name: "contract_title_plain"}, + {input: "<title><script>alert()</script>", + acceptable: [ + "", + "", + "<span></span>", + "<span />", + "", + "<title><script>alert()</script>", + "<script>alert()</script>", + "<script>alert()</script>", + ], + name: "contract_title_scriptinside"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_media"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_nonce"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_srcset"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_srcdoc"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_poster"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_autoplay"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_controls"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_formaction"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_formmethod"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_pattern"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_icon"}, + {input: "", + acceptable: [ + "<title>", + "", + "<title/>", + "<title />", + "<table><title>
", + "</table>", + "<TITLE />", + "<TITLE>", + "", + "", + "", + "", + ], + name: "contract_title_select"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "contract_base_plain"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "contract_base_scriptinside"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_media"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_nonce"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_srcset"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_srcdoc"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_poster"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_autoplay"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_controls"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_formaction"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_formmethod"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_pattern"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_icon"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_base_select"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "contract_meta_plain"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "contract_meta_scriptinside"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_media"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_nonce"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_srcset"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_srcdoc"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_poster"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_autoplay"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_controls"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_formaction"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_formmethod"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_pattern"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_icon"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_meta_select"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "contract_style_plain"}, + {input: "", + acceptable: [ + "", + "", + "", + ], + name: "contract_style_scriptinside"}, + {input: "", + "", + "", + "", + "", + "", + "", + ], + name: "contract_style_srcset"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_srcdoc"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_poster"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_autoplay"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_controls"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_formaction"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_formmethod"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_pattern"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_icon"}, + {input: "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_style_select"}, + {input: "", + acceptable: [ + "", + "", + "", + "
", + "", + "", + "", + "", + "", + ], + name: "contract_body_plain"}, + {input: "", + acceptable: [ + "", + "", + "", + "
", + "", + "", + "", + "", + "", + "
", + "
", + "
", + ], + name: "contract_body_scriptinside"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_media"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_nonce"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_srcset"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_srcdoc"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_poster"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_autoplay"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_controls"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_formaction"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_formmethod"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_pattern"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_icon"}, + {input: "", + acceptable: [ + "", + "", + "", + "", + "
", + "
", + "", + "", + "", + "", + "", + "", + ], + name: "contract_body_select"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + ], + name: "contract_article_plain"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "
", + "
", + "
", + ], + name: "contract_article_scriptinside"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_media"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_nonce"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_srcset"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_srcdoc"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_poster"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_autoplay"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_controls"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_formaction"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_formmethod"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_pattern"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_icon"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_article_select"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + ], + name: "contract_section_plain"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "
", + "
", + "
", + ], + name: "contract_section_scriptinside"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_media"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_nonce"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_srcset"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_srcdoc"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_poster"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_autoplay"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_controls"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_formaction"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_formmethod"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_pattern"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_icon"}, + {input: "
", + acceptable: [ + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "
", + "", + "", + "", + "", + ], + name: "contract_section_select"}, + {input: "", + acceptable: [ + "