https://github.com/mozilla/gecko-dev
Revision eca7db5dd9f5d9b4bf5d6899355d74cacabbb933 authored by Jan-Niklas Jaeschke on 04 April 2024, 14:39:32 UTC, committed by Jan-Niklas Jaeschke on 04 April 2024, 14:39:32 UTC
This patch provides functions to extract the fragment directive from a url / a hash
into an array of `TextDirective`s
as well as to create a fragment directive string from given text directives.

The algorithms are implemented as a rust crate.
Interface functions and data structures which are accessible from C++
are provided in `lib.rs`.
The actual implementation (using pure rust types)
lives in `fragment_directive_impl.rs`, tests live in `test.rs`.

The implementation currently only supports text directives.
Other future directive types are not considered and will be ignored.

The main function, `parse_fragment_directive()` takes a url / a url hash
as parameter and returns (as out parameter) a struct which contains the stripped input url,
the fragment directive string, and an array of parsed text directive objects.

Additionally, there are functions that create a full fragment directive string
from a list of text directives as well as a function that creates
a single text directive string from a text directive.

The `TextDirective` class, which is shared with C++, contains four
string elements for the prefix, start, end and suffix elements.
These strings are percent-decoded and do not contain identifiers
(like the `-` that indicates it being a prefix or suffix).
All elements besides `start` can be empty.

The implemented algorithms are used in the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D195685
1 parent 64a2d39
History
Tip revision: eca7db5dd9f5d9b4bf5d6899355d74cacabbb933 authored by Jan-Niklas Jaeschke on 04 April 2024, 14:39:32 UTC
Bug 1867939, part 2: Implement Fragment Directive parser. r=hsivonen,dom-core
Tip revision: eca7db5
File Mode Size
.cargo
.github
.vscode
accessible
browser
build
caps
chrome
config
devtools
docs
docshell
dom
editor
extensions
gfx
gradle
hal
image
intl
ipc
js
layout
media
memory
mfbt
mobile
modules
mozglue
netwerk
nsprpub
other-licenses
parser
python
remote
security
services
servo
startupcache
storage
supply-chain
taskcluster
testing
third_party
toolkit
tools
uriloader
view
widget
xpcom
xpfe
.arcconfig -rw-r--r-- 143 bytes
.babel-eslint.rc.js -rw-r--r-- 292 bytes
.clang-format -rw-r--r-- 1.1 KB
.clang-format-ignore -rw-r--r-- 6.7 KB
.cron.yml -rw-r--r-- 11.6 KB
.eslintignore -rw-r--r-- 12.0 KB
.eslintrc-test-paths.js -rw-r--r-- 15.4 KB
.eslintrc.js -rw-r--r-- 137.3 KB
.git-blame-ignore-revs -rw-r--r-- 159.7 KB
.gitattributes -rw-r--r-- 77 bytes
.gitignore -rw-r--r-- 9.7 KB
.hg-annotate-ignore-revs -rw-r--r-- 62.9 KB
.hg-format-source -rw-r--r-- 11.6 KB
.hgignore -rw-r--r-- 9.8 KB
.hgtags -rw-r--r-- 17.9 KB
.lando.ini -rw-r--r-- 760 bytes
.lldbinit -rw-r--r-- 1.5 KB
.mailmap -rw-r--r-- 109 bytes
.prettierignore -rw-r--r-- 66.2 KB
.prettierrc.js -rw-r--r-- 351 bytes
.stylelintignore -rw-r--r-- 3.7 KB
.stylelintrc.js -rw-r--r-- 8.8 KB
.taskcluster.yml -rw-r--r-- 17.6 KB
.trackerignore -rw-r--r-- 0 bytes
.yamllint -rw-r--r-- 118 bytes
.ycm_extra_conf.py -rw-r--r-- 2.0 KB
AUTHORS -rw-r--r-- 125 bytes
CLOBBER -rw-r--r-- 1.1 KB
Cargo.lock -rw-r--r-- 146.0 KB
Cargo.toml -rw-r--r-- 9.6 KB
GNUmakefile -rw-r--r-- 261 bytes
LICENSE -rw-r--r-- 389 bytes
Makefile.in -rw-r--r-- 7.6 KB
README.txt -rw-r--r-- 963 bytes
aclocal.m4 -rw-r--r-- 1.0 KB
build.gradle -rw-r--r-- 16.8 KB
client.mk -rw-r--r-- 2.4 KB
client.py -rwxr-xr-x 5.6 KB
configure -rwxr-xr-x 329 bytes
configure.py -rw-r--r-- 12.4 KB
gradle.properties -rw-r--r-- 338 bytes
gradlew -rwxr-xr-x 8.5 KB
gradlew.bat -rw-r--r-- 2.8 KB
mach -rwxr-xr-x 7.1 KB
mach.cmd -rw-r--r-- 139 bytes
mach.ps1 -rw-r--r-- 1.3 KB
mots.yaml -rw-r--r-- 98.9 KB
moz.build -rw-r--r-- 6.0 KB
moz.configure -rwxr-xr-x 28.4 KB
mozilla-config.h.in -rw-r--r-- 1.9 KB
old-configure.in -rw-r--r-- 35.1 KB
package-lock.json -rw-r--r-- 214.4 KB
package.json -rw-r--r-- 1.2 KB
pyproject.toml -rw-r--r-- 4.8 KB
settings.gradle -rw-r--r-- 3.7 KB
substitute-local-geckoview.gradle -rw-r--r-- 8.3 KB
test.mozbuild -rw-r--r-- 429 bytes

README.txt

back to top