mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
ac8c134eb5
This is intended to give a reasonable number that scales with the amount of content in a website during page load, for scheduling purposes. This effectively counts the amount of text connected to a document that isn't likely to be inline style or script. Potential improvements: * Maybe have some more heuristics for hidden elements, like presence of the `hidden` attribute? * Maybe skip whitespace-only text? This does a pretty good job anyways because whitespace nodes are usually pretty small (like a couple newlines and spaces), so they don't add too much to the number. This could be done cheaply if looking at sSpaceSharedString / sTabSharedString. * Add some weight to some elements? Maybe images should have a fixed weight, for example. Though you don't want 0x0 images and such to count... Maybe we should add to this heuristic out of band when processing image loads or some such. * Handle shadow DOM and such better? Right now Shadow DOM and XBL are always assumed visible as long as they're connected. You _can_ in theory do something like stash a `<div>` inside a `<style>` element, attach a ShadowRoot and such, and append a bunch of stuff inside. But I don't think it's something we should be particularly worried about. * Probably add some check to CharacterData::AppendText as well? Otherwise this undercounts when loading big amount of text arrives via the network, for example, but also I'm not sure we're optimizing for log files and such so it might be ok. In any case, this gives us a heuristic that we can iterate on later. This does a pretty good job at representing the amount of content in the examples over here: * https://faraday.basschouten.com/mozilla/executionorder/ For example for: * https://faraday.basschouten.com/mozilla/executionorder/allinlinedual.html You get an output like the following if you print the heuristic after each bind operation (and de-duplicating them): ``` 0 3 // Some whitespace in <head> 4 // Some whitespace in the <body>. 5 6 7 8 9 10 65547 // Actual content injected by the first script. 65548 // Some more whitespace. 131085 // Actual content injected by the second script. 131087 // Some more whitespace. ``` I'm not a fan of what clang-format has done to my code btw :) Differential Revision: https://phabricator.services.mozilla.com/D34397 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.cargo | ||
.vscode | ||
accessible | ||
browser | ||
build | ||
caps | ||
chrome | ||
config | ||
devtools | ||
docshell | ||
dom | ||
editor | ||
extensions | ||
gfx | ||
gradle/wrapper | ||
hal | ||
image | ||
intl | ||
ipc | ||
js | ||
layout | ||
media | ||
memory | ||
mfbt | ||
mobile | ||
modules | ||
mozglue | ||
netwerk | ||
nsprpub | ||
other-licenses | ||
parser | ||
python | ||
remote | ||
security | ||
services | ||
servo | ||
startupcache | ||
storage | ||
taskcluster | ||
testing | ||
third_party | ||
toolkit | ||
tools | ||
uriloader | ||
view | ||
widget | ||
xpcom | ||
xpfe/appshell | ||
.arcconfig | ||
.clang-format | ||
.clang-format-ignore | ||
.cron.yml | ||
.eslintignore | ||
.eslintrc.js | ||
.flake8 | ||
.gdbinit | ||
.gdbinit_python | ||
.git-blame-ignore-revs | ||
.gitignore | ||
.hg-annotate-ignore-revs | ||
.hg-format-source | ||
.hgignore | ||
.hgtags | ||
.lldbinit | ||
.mailmap | ||
.prettierignore | ||
.prettierrc | ||
.taskcluster.yml | ||
.trackerignore | ||
.yamllint | ||
.ycm_extra_conf.py | ||
aclocal.m4 | ||
AUTHORS | ||
build.gradle | ||
Cargo.lock | ||
Cargo.toml | ||
client.mk | ||
client.py | ||
CLOBBER | ||
configure.in | ||
configure.py | ||
GNUmakefile | ||
gradle.properties | ||
gradlew | ||
gradlew.bat | ||
LEGAL | ||
LICENSE | ||
mach | ||
Makefile.in | ||
moz.build | ||
moz.configure | ||
mozilla-config.h.in | ||
old-configure.in | ||
package-lock.json | ||
package.json | ||
README.txt | ||
settings.gradle | ||
test.mozbuild |
An explanation of the Mozilla Source Code Directory Structure and links to project pages with documentation can be found at: https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure For information on how to build Mozilla from the source code, see: https://developer.mozilla.org/en/docs/Build_Documentation To have your bug fix / feature added to Mozilla, you should create a patch and submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at: https://developer.mozilla.org/en/docs/Creating_a_patch https://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree If you have a question about developing Mozilla, and can't find the solution on https://developer.mozilla.org, you can try asking your question in a mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups are accessible on Google Groups, or news.mozilla.org with a NNTP reader.] Nightly development builds can be downloaded from: https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/ - or - https://www.mozilla.org/firefox/channel/desktop/#nightly Keep in mind that nightly builds, which are used by Mozilla developers for testing, may be buggy.