Commit Graph

12 Commits

Author SHA1 Message Date
Joey Parrish 493438cce5 Infer a missing URI scheme
Uses location to determine what the scheme should be if unspecified.
This is important because it allows us to use URIs that work for
either HTTP or HTTPS hosted apps without mixed content warnings.

Some special sauce was needed to make it testable, since we generally
can't mock location in tests.

Change-Id: I294ac532f1bba80977597e11addd7f585d1e9b79
2016-02-10 19:00:23 +00:00
Joey Parrish 82e5654636 No optional args in NetworkingEngine.makeRequest
The optional arguments in this convenience function really only help
in the tests.  To avoid some component in the library accidentally
making a request with default retry parameters instead of those
configured by the user, I'm making the retry parameters required.

The optional argument for method is only used once.  To avoid the
temptation to add more positional arguments for other seldom-used
fields, I'm dropping the method argument completely.

Change-Id: Ib0afb5766f68c5505f11372e3b004fc8eaca1223
2016-01-25 12:12:06 -08:00
Jacob Trimble 3cc1a43b8d Added some networking utility functions.
This adds some utility functions to NetworkingEngine for common
actions.  This also cleans up the related unit tests.

Change-Id: I1105b77b6dac3637d566c1a4e2f77004ad705e8b
2016-01-25 09:27:38 -08:00
Donato Borrello 13e21f805d Fix typo, rename registerPlugin to registerScheme
This is a simple change to an out of date comment
2016-01-08 14:22:15 -08:00
Joey Parrish 3bb8f06b7d Require assertion messages
This will enforce messages on assertions, which should make console
logs more useful.

Change-Id: I2cff9e20f630d1d4d46192e2ee317b1942cc7188
2016-01-08 13:29:56 -08:00
Joey Parrish f2ca3a5b53 Move externally-used record types to externs
This is important to avoid renaming properties during compilation so
that applications can inject these types without compiling their code.

This also migrates record typedefs to the new documentation format.
Each record will be annotated with 'property' for each field in the
record.  This results in better output from jsdoc.

Change-Id: Ia877b1e2b333ef7020a85f16bc2469a20879bf94
2016-01-06 12:10:47 -08:00
Jacob Trimble 0b4ba1f8f8 Unified naming of variables about URIs.
Renamed variables to only use URI instead of URL.  Also made variable
names plural when referring to an array of choices.

Change-Id: I7bfd5022606d77a3153575d8f13dd1e040331901
2015-12-16 16:37:04 -08:00
Joey Parrish c934f426d8 Add new error type
This error type will be used for all internal errors, and will rely
on numeric error codes which can be easily checked by the application.

This also changes PSSH parsing to throw on errors instead of retaining
partial data.

Issue #201
b/25306826

Change-Id: I19d23d99d4ee72cb31fe5f233bac57a3a9cfc283
2015-12-04 10:26:08 -08:00
Joey Parrish fff5dd7ee7 Audit exports
This changes namespace exports to the more targetted exportDoc,
adds exports where they are needed and removes them where they are
not.  Exporting of Uint8Array and String utils should be re-evaluated
later.

Change-Id: I9298e73a0a5ef026b6f2b1854488d2c359be10c1
2015-12-01 13:56:37 -08:00
Joey Parrish c68ef2f8f7 Fix NetworkingEngine.destroy() behavior
Previously, destroy() would reject as soon as any in-progress request
failed.  Now, destroy() waits for all requests to end regardless of
their ultimate state.

Also adds tests to cover destroy() behavior and drops unused test
util code from 1.x.  Line coverage for NetworkingEngine is now 100%.

Change-Id: I0e39e494d8f28c6dc595725a46094d10e3a58e93
2015-11-25 12:14:05 -08:00
Jacob Trimble 667aee63ae Added URI argument to NetworkingEngine plugin.
b/25296248

Change-Id: I66ecb7aed9baf53cbafda3be9550dd03908226ce
2015-11-25 12:14:05 -08:00
Jacob Trimble ab127e6a04 Added NetworkingEngine.
b/25296248

Change-Id: I5cb64d47dd47624715a691a12243696932f2d5dd
2015-11-25 12:14:05 -08:00