servo/tests/unit/script
Jon Leighton 32f781234a Disallow mutating the internals of TextInput
The TextInput::assert_ok_selection() method is meant to ensure that we
are not getting into a state where a selection refers to a location in
the control's contents which doesn't exist.

However, before this change we could have a situation where the
internals of the TextInput are changed by another part of the code,
without using its public API. This could lead to us having an invalid
selection.

I did manage to trigger such a situation (see the test added in this
commit) although it is quite contrived. There may be others that I
didn't think of, and it's also possible that future changes could
introduce new cases. (Including ones which trigger panics, if indexing
is used on the assumption that the selection indices are always valid.)

The current HTML specification doesn't explicitly say that
selectionStart/End must remain within the length of the content, but
that does seems to be the consensus reached in a discussion of this:

https://github.com/whatwg/html/issues/2424

The test case I've added here is currently undefined in the spec which
is why I've added it in tests/wpt/mozilla.
2018-02-16 11:24:12 +01:00
..
Cargo.toml Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender 2017-12-08 14:32:28 +01:00
headers.rs Introduce a script::test module to expose the APIs needed for unit tests. 2016-12-22 15:58:53 +01:00
htmlareaelement.rs Refactor HTMLImageElement::handle_event to be idiomatic 2017-07-07 21:07:12 +04:00
htmlimageelement.rs Parse srcset attribute 2017-10-03 13:18:01 +02:00
lib.rs Replace compiletest suite by doc-tests with compile_fail 2017-11-22 16:25:17 +01:00
origin.rs Add ImmutableOrigin to allow for serializing origins 2017-02-22 11:11:59 -06:00
size_of.rs Track custom element state 2017-08-09 14:36:22 -06:00
textinput.rs Disallow mutating the internals of TextInput 2018-02-16 11:24:12 +01:00