Commit Graph

354 Commits

Author SHA1 Message Date
Nicholas Nethercote
67e80b725b Bug 1423840 - Rewrite the prefs parser. r=glandium,Manishearth
The prefs parser has two significant problems.

- It doesn't separate tokenizing from parsing.

- It is implemented as a loop around a big switch on a "current state"
  variable.

As a result, it is hard to understand and modify, slower than it could be, and
in obscure cases (involving comments and whitespace) it fails to parse what
should be valid input.

This patch replaces it with a recursive descent parser (albeit one without any
recursion!) that has separate tokenization. The new parser is easier to
understand and modify, more correct, and has better error messages. It doesn't
do error recovery, but that would be much easier to add than in the old parser.

The new parser also runs about 1.9x faster than the existing parser. (As
measured by parsing greprefs.js's contents from memory 1000 times in
succession, omitting the prefs hash table construction. If the table
construction is included, it's about 1.6x faster.)

The new parser is slightly stricter than the old parser in a few ways.

- Disconcertingly, the old parser allowed arbitrary junk between prefs
  (including at the start and end of the prefs file) so long as that junk
  didn't include any of the following chars: '/', '#', 'u', 's', 'p'. I.e.
  lines like these:

    !foo@bar&pref("prefname", true);
    ticky_pref("prefname", true);       // missing 's' at start
    User_pref("prefname", true);        // should be 'u' at start

  would all be treated the same as this:

    pref("prefname", true);

  The new parser disallows such junk because it isn't necessary and seems like
  an unintentional botch by the old parser.

- The old parser allowed character 0x1a (SUB) between tokens and treated it
  like '\n'.

  The new parser does not allow this character. SUB was used to indicate
  end-of-file (*not* end-of-line) in some old operating systems such as MS-DOS,
  but this doesn't seem necessary today.

- The old parser tolerated (with a warning) invalid escape sequences within
  string literals -- such as "\q" (not a valid escape) and "\x1" and "\u12"
  (both of which have insufficient hex digits) -- accepting them literally.

  The new parser does not tolerate invalid escape sequences because it doesn't
  seem necessary and would complicate things.

- The old parser tolerated character 0x00 (NUL) within string literals; this is
  dangerous because C++ code that manipulates string values with embedded NULs
  will almost certainly consider those chars as end-of-string markers.

  The new parser treats NUL chars as end-of-file, to avoid this danger and
  because it facilitates a significant optimization (described within the
  code).

- The old parser allowed integer literals to overflow, silently wrapping them.

  The new parser treats integer overflow as a parse error. This seems better,
  and it caught an existing overflow in testing/profiles/prefs_general.js, for
  places.database.lastMaintenance (see bug 1424030).

The first of these changes meant that a couple of existing prefs with ";;" at
the end had to be changed (done in the preceding patch).

The minor increase in strictness shouldn't be a problem for default pref files
such as greprefs.js within the application (which we can modify), nor for
app-written prefs files such as prefs.js. It could affect user-written prefs
files such as user.js; the experience above suggests that ";;" is the most
likely problem in practice. In my opinion, the risk here is acceptable.

The new parser also does a better job of tracking line numbers because it (a)
treats "\r\n" sequences as a single end-of-line marker, and (a) pays attention
to end-of-line sequences within string literals.

Finally, the patch adds thorough tests of both valid and invalid syntax.

MozReview-Commit-ID: 8EYWH7KxGG
* * *
[mq]: win-fix

MozReview-Commit-ID: 91Bxjfghqfw

--HG--
extra : rebase_source : a8773413e5d68c33e4329df6819b6e1f82c22b85
2017-12-03 00:26:36 +11:00
Kartikaya Gupta
063a144958 Bug 1433567 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: HpOX4MTdU9Z

--HG--
extra : rebase_source : c9da41ea1c96097fb51e55d5227cde66e5e6c47b
2018-01-30 10:22:30 -05:00
Bryce Van Dyk
d6fa7ea4fd Bug 1432869 - Update locks to reflect new cubeb-rs, and audioipc versions. r=rillian
MozReview-Commit-ID: Hj9rcfHnO1L

--HG--
extra : rebase_source : c2366103116f8882d029caa4582b500e212f1406
2018-01-25 17:18:08 -05:00
Dzmitry Malyshau
a8e2dce594 Bug 1433139 - Enable the WR capture feature in webrender_bindings. r=kats
MozReview-Commit-ID: 2dJMVMto5Ly
2018-01-25 14:49:36 -05:00
Narcis Beleuzu
9279994eae Merge inbound to mozilla-central. a=merge 2018-01-24 23:56:14 +02:00
Kartikaya Gupta
ecdb4869cb Bug 1431776 - Update Cargo lockfiles and re-vendor rust dependencies r=jrmuizel
MozReview-Commit-ID: CGFjsnpjrDe

--HG--
extra : rebase_source : 1aab040b85371a509632dbe6a511aa90ee3d050d
2018-01-24 09:16:36 -05:00
Henri Sivonen
733ced6d8d Bug 1431356 - Update encoding_rs to 0.7.2 and simd to 0.2.1. r=emk.
MozReview-Commit-ID: Lp3zyF2rLxN

--HG--
extra : rebase_source : 81b515206ca5d28623cbaead16244ef258da2088
2018-01-18 12:26:21 +02:00
Nika Layzell
94e3d3cb1b Bug 1293362 - Part 2: Add skeleton crates for xpcom bindings, r=froydnj
MozReview-Commit-ID: H5nxsk4cg2E
2018-01-23 17:27:23 -05:00
Dan Glastonbury
cd2eb5e8a4 Bug 1428952 - P4: Vendor rust crates. r=rillian
MozReview-Commit-ID: 7UQPozxpmC1

--HG--
extra : rebase_source : fc27016f0e51a9f4d1f09f842da7943f65070508
2017-11-06 16:26:30 +10:00
Emilio Cobos Álvarez
296aed21d6 Bug 1432134: Update bindgen. r=SimonSapin
On a CLOSED TREE.

MozReview-Commit-ID: GXHw7KcCLN9
2018-01-22 15:22:46 +01:00
Kartikaya Gupta
deb1387041 Bug 1430829 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: GbEO29Hy9h6

--HG--
extra : rebase_source : d54f0c8e0ebfdad071a62c555ad0b7e193592a84
2018-01-19 12:33:03 -05:00
Dan Glastonbury
a539d73ba3 Bug 1430996 - P1: Update cubeb-pulse-rs to commit cb7141e. r=kinetik
MozReview-Commit-ID: 2wrPNI9rvKF

--HG--
extra : rebase_source : 2a009c40dfdfd06a20b704ed033a47b93788edf4
2018-01-17 15:24:43 +10:00
Simon Sapin
62d00933f6 No bug - Servo bustage fix for PR 19751 r=bustage-fix
--HG--
extra : amend_source : 237b08796495230ecda24645e7a5b29fff95fe87
2018-01-13 02:17:37 +02:00
Franziskus Kiefer
a881c4a167 Bug 1403844 - Verify COSE signature on add-ons, r=keeler
Summary:
MozReview-Commit-ID: 6YorBs4mY8B

Check for COSE signatures in add-ons.

Reviewers: keeler

Bug #: 1403844

Differential Revision: https://phabricator.services.mozilla.com/D298

--HG--
rename : security/manager/ssl/tests/unit/test_signed_apps/cose_multiple_signed.zip => security/manager/ssl/tests/unit/test_signed_apps/cose_multiple_signed_with_pkcs7.zip
rename : security/manager/ssl/tests/unit/test_signed_apps/cose_signed.zip => security/manager/ssl/tests/unit/test_signed_apps/cose_signed_with_pkcs7.zip
rename : third_party/rust/cose/src/cbor/mod.rs => third_party/rust/moz_cbor/src/lib.rs
extra : rebase_source : 0494590eb222e2c936e353e4dd6cf9fac8d822f3
2018-01-08 11:46:51 +01:00
Kartikaya Gupta
68ad1f3785 Bug 1426116 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: Gz8YEswHQu0

--HG--
extra : rebase_source : 13c4d0a1cb492be3a3ea22989e7540370305787f
2018-01-08 09:19:27 -05:00
Kartikaya Gupta
b8fd9e90a8 Bug 1426116 - Update for changes in WR PR 2251. r=jrmuizel
MozReview-Commit-ID: RoLZCW1fs0

--HG--
extra : rebase_source : 427360ccb12c9160555943350c5e790282f3e8e7
2018-01-08 09:19:27 -05:00
Alfredo.Yang
3cf0d3b491 Bug 1423469 - update mp4 rust parser. r=kinetik
MozReview-Commit-ID: IMnqoNL2jay

--HG--
extra : rebase_source : 14bd23405f9dfdcbb8bae5a850439918aacec5e3
2018-01-05 11:11:06 +08:00
Matthew Gregan
86594ab667 Bug 1405877 - Update Rust deps for media/audioipc. r=kamidphish
--HG--
rename : third_party/rust/error-chain/src/quick_error.rs => third_party/rust/error-chain/src/impl_error_chain_kind.rs
2017-12-20 14:51:11 +13:00
Kartikaya Gupta
0fb09505ab Bug 1424280 - Update cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: 1G7oWr52koH
2017-12-10 13:49:02 -05:00
Kartikaya Gupta
071a573dc4 Bug 1424280 - Replace serde and serde_derive with Gankro's modified branch. r=jrmuizel
The branch is based off serde 1.0.23 and includes additional changes for faster
enum deserialization which we want for WebRender. The changes are in the process
of being upstreamed but will take a while.

MozReview-Commit-ID: 4xaPQpffzYL
2017-12-10 13:48:54 -05:00
Chris Manchester
3326b62c85 Bug 1423815 - Move symverscript for libxul from libxul.mk to GENERATED_FILES. r=ted
MozReview-Commit-ID: 5U7njSBlHMp

--HG--
extra : rebase_source : 6464c6870d13f6a2bd801975c617167a6a223370
2017-12-08 12:39:10 -08:00
Kartikaya Gupta
7476fde1a0 Bug 1423203 - Update Cargo lockfiles and revendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: GeZjG8GFL2M

--HG--
extra : rebase_source : 04002c57ccc2c96ac61f425ca17b62a2bd7263bb
2017-12-08 13:44:48 -05:00
Matt Brubeck
38b5279634 Bug 1424096 - Fix merge errors. r=me
MozReview-Commit-ID: 2yOAlJaSryj

--HG--
extra : rebase_source : f37145228404126abcd679ef262ff82512c8aa86
2017-12-08 10:36:59 -08:00
Matt Brubeck
c61db3912d Bug 1424096 - Consolidate on a single version of each vendored Rust crate r=rillian
MozReview-Commit-ID: GSGQpjXLuVR

--HG--
rename : third_party/rust/gcc-0.3.42/LICENSE-APACHE => third_party/rust/bitflags-1.0.0/LICENSE-APACHE
rename : third_party/rust/libc-0.2.24/LICENSE-MIT => third_party/rust/bitflags-1.0.0/LICENSE-MIT
rename : third_party/rust/bitflags/tests/conflicting_trait_impls.rs => third_party/rust/bitflags-1.0.0/tests/conflicting_trait_impls.rs
rename : third_party/rust/bitflags/tests/external.rs => third_party/rust/bitflags-1.0.0/tests/external.rs
rename : third_party/rust/bitflags/tests/external_no_std.rs => third_party/rust/bitflags-1.0.0/tests/external_no_std.rs
rename : third_party/rust/bitflags/tests/i128_bitflags.rs => third_party/rust/bitflags-1.0.0/tests/i128_bitflags.rs
rename : third_party/rust/gcc-0.3.42/LICENSE-APACHE => third_party/rust/lazy_static-0.2.11/LICENSE-APACHE
rename : third_party/rust/lazy_static-0.2.8/LICENSE-MIT => third_party/rust/lazy_static-0.2.11/LICENSE-MIT
rename : third_party/rust/lazy_static-0.2.9/README.md => third_party/rust/lazy_static-0.2.11/README.md
rename : third_party/rust/lazy_static-0.2.8/tests/no_std.rs => third_party/rust/lazy_static-0.2.11/tests/no_std.rs
extra : rebase_source : 0a199bf892c53b56c739f18577c28f69df7e65e1
2017-12-08 10:24:40 -08:00
Servo VCS Sync
d6368e66de No bug - Revendor rust dependencies
--HG--
rename : third_party/rust/euclid/src/scale_factor.rs => third_party/rust/euclid-0.15.5/src/scale_factor.rs
2017-12-08 14:52:43 +00:00
Emilio Cobos Álvarez
fc0d2c8a68 No bug - Revendor rust dependencies manually on a CLOSED TREE. r=me
MozReview-Commit-ID: C0KKGL9FbRd
2017-12-08 01:17:46 +01:00
Matt Brubeck
7f726d3cbb Bug 1424081 - Update parking_lot_core Rust crate to 0.2.7 r=SimonSapin
MozReview-Commit-ID: G8C94Vt2RVx

--HG--
extra : rebase_source : e13d4b40761171a16fd99d29fccabe5c5d942d58
2017-12-07 14:37:31 -08:00
Emilio Cobos Álvarez
0a75dbc139 No bug - Revendor rust dependencies again since vcs-sync clobbered the previous revendor on a CLOSED TREE. r=me
MozReview-Commit-ID: 5RNiODURfIb
2017-12-07 16:07:29 +01:00
Servo VCS Sync
b336233de0 No bug - Revendor rust dependencies 2017-12-07 14:58:58 +00:00
Emilio Cobos Álvarez
67fa60dbe5 No bug - Revendor rust dependencies with cargo-vendor 0.1.13 on a CLOSED TREE. r=me
MozReview-Commit-ID: Ak6gGAvm6O8
2017-12-07 15:51:38 +01:00
Emilio Cobos Álvarez
b09f446f9f No bug - Revendor rust dependencies. r=me
MozReview-Commit-ID: FtV6k7zirv1
2017-12-07 15:11:51 +01:00
Kartikaya Gupta
4a847e9671 Bug 1423236 - Rerun mach vendor rust. r=ttaubert
This contains the generated changes from running `mach vendor rust` on the
previous commit, and eliminates the redundant copy of libudev-sys we have
sitting in third_party/rust/

MozReview-Commit-ID: IXTI14beFMi

--HG--
extra : rebase_source : 0b4d3d991738e3a371bb467219b8a91a792158d3
2017-12-06 15:43:11 -05:00
Kartikaya Gupta
5d419cb4f2 Bug 1423236 - Use patch instead of replace to eliminate redundant vendored copy of libudev-sys. r=ttaubert
MozReview-Commit-ID: 529N231rvgY

--HG--
extra : rebase_source : ac3456c456da0c0cefa1be723f97a6c96c438a5b
2017-12-06 15:42:25 -05:00
Servo VCS Sync
19850eeb3c No bug - Revendor rust dependencies 2017-12-05 20:50:20 +00:00
Kartikaya Gupta
87d4b4ac8b Bug 1422317 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: LjxHjFxeUDH

--HG--
extra : rebase_source : 5f5dbee01a3939cacd1499950d2edff002cd1867
2017-12-05 11:52:18 -05:00
Servo VCS Sync
10ffde4a6a No bug - Revendor rust dependencies 2017-12-05 17:34:00 +00:00
Emilio Cobos Álvarez
09688ccbd8 No bug - Revendor rust dependencies on a CLOSED TREE. r=bustage
MozReview-Commit-ID: 3xbP1u17UTn


--HG--
rename : third_party/rust/smallvec/.cargo-checksum.json => third_party/rust/smallvec-0.4.3/.cargo-checksum.json
rename : third_party/rust/smallvec/Cargo.toml => third_party/rust/smallvec-0.4.3/Cargo.toml
rename : third_party/rust/smallvec/README.md => third_party/rust/smallvec-0.4.3/README.md
rename : third_party/rust/smallvec/lib.rs => third_party/rust/smallvec-0.4.3/lib.rs
2017-12-05 12:36:20 +01:00
Kartikaya Gupta
fee87ce9f1 Bug 1421275 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: Jaty3RGfffU

--HG--
rename : third_party/rust/byteorder-1.0.0/COPYING => third_party/rust/byteorder-1.1.0/COPYING
rename : third_party/rust/byteorder-1.0.0/LICENSE-MIT => third_party/rust/byteorder-1.1.0/LICENSE-MIT
rename : third_party/rust/byteorder-1.0.0/README.md => third_party/rust/byteorder-1.1.0/README.md
rename : third_party/rust/byteorder-1.0.0/UNLICENSE => third_party/rust/byteorder-1.1.0/UNLICENSE
extra : rebase_source : 0668fbfe5d8ba288a0e530de3650bd013924b4ce
2017-12-01 09:50:52 -05:00
Tim Taubert
c5eda6e272 Bug 1406462 - Web Authentication - Add support for authenticator selection criteria and attachment types r=jcj,smaug
Reviewers: jcj, smaug

Reviewed By: jcj, smaug

Bug #: 1406462

Differential Revision: https://phabricator.services.mozilla.com/D278
2017-11-29 13:58:33 +01:00
Emilio Cobos Álvarez
d431af965c Bug 1420301: Update clang-sys to work around a compiler bug. r=rillian
See: https://github.com/rust-lang/rust/issues/46239

MozReview-Commit-ID: EiHsSK0xJ5c
2017-11-25 19:51:48 +01:00
Dzmitry Malyshau
f32ca3183a Bug 1419440 - Update for API changes in WR PR 2050. r=kats
MozReview-Commit-ID: 4TFZB8XpY6l

--HG--
extra : rebase_source : 31be31fa926dd9144378146fe8c1a3e47cb389aa
2017-11-23 09:39:42 -05:00
Cosmin Sabou
a5d613086a Merge mozilla-inbound to mozilla-central r=merge a=merge 2017-11-23 11:42:46 +02:00
Franziskus Kiefer
7b10164f9f Bug 1403840 - add cose rust lib with a test, r=keeler,ttaubert
Summary:
This adds the COSE rust library from https://github.com/franziskuskiefer/cose-rust with its C API from https://github.com/franziskuskiefer/cose-c-api to gecko with a basic test.
The COSE library will be used for verifying add-on signatures in future.

Reviewers: keeler, ttaubert

Reviewed By: keeler

Bug #: 1403840

Differential Revision: https://phabricator.services.mozilla.com/D232

--HG--
extra : rebase_source : 433ca6894d88ccda333bfac53507eba4e84924fb
2017-11-22 16:37:15 +01:00
Matthew Gregan
e88ffe59d1 Bug 1419627 - Update mp4parse-rust to cbindgen version. r=rillian
MozReview-Commit-ID: CJwg8isx8Jk

--HG--
extra : rebase_source : 74086f8e6a40f3a3d2e5f75407c06dfa03e6736d
2017-11-22 15:18:00 +13:00
Kartikaya Gupta
a687e9315b Bug 1418315 - Update Cargo lockfiles to go with webrender update. r=nical
MozReview-Commit-ID: J5or7x9s66n

--HG--
extra : rebase_source : dee38b3a54bf3414059bdc96d7dab3ce1c5ba616
2017-11-21 10:41:47 -05:00
Servo VCS Sync
6b645f9f38 No bug - Revendor rust dependencies 2017-11-16 05:54:20 +00:00
Kartikaya Gupta
9e0fc459e6 Bug 1416258 - Update webrender to commit 8a39cf24f493e894a66c2465dd310a2b2923e558. r=jrmuizel
MozReview-Commit-ID: IjTJa62Op9b

--HG--
extra : rebase_source : 2de0202e76d7ffd58b01ad9f90b8a9660a2022cf
2017-11-14 09:19:11 -05:00
Kartikaya Gupta
85e4613d73 Bug 1415150 - Update Cargo lockfiles and re-vendor rust dependencies. r=jrmuizel
MozReview-Commit-ID: 3U2Ve2XOv6

--HG--
extra : rebase_source : 12a1bb6732e0cf63fee035a820df5ef3cfe1fa7d
2017-11-10 10:55:12 -05:00
Sebastian Hengst
f5e52adeea merge mozilla-inbound to mozilla-central. r=merge a=merge 2017-11-07 12:43:06 +02:00
Lee Salzman
826eee8b2a Bug 1403198 - support WR font descriptors on Mac. r=jrmuizel
MozReview-Commit-ID: BqN51yY88oJ
2017-11-06 20:21:06 -05:00