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
Go to file
Emilio Cobos Álvarez ac8c134eb5 Bug 1555133 - Add some heuristics about visible content in a document. r=bzbarsky
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
2019-06-11 10:00:46 +00:00
.cargo
.vscode
accessible Bug 1556561 - Remove <children> usage from autocomplete binding. r=dao,surkov 2019-06-08 08:16:18 +00:00
browser Bug 1554158 - Always consume the enter key in UrlbarInput. r=mak 2019-06-11 09:27:51 +00:00
build Bug 1556646 part 2 - Rename JS_POSIX_NSPR to JS_WITHOUT_NSPR and remove --enable-posix-nspr-emulation configure flag. r=sfink,glandium 2019-06-08 09:10:59 +00:00
caps Bug 1508939 - cpp serialization r=ckerschb,mccr8,mikedeboer 2019-06-03 12:37:12 +00:00
chrome
config Bug 1557229 - Add -d16 as a target_feature along +neon for rust code. r=nalexander 2019-06-07 00:47:03 +00:00
devtools Backed out changeset de1dc8a5ce54 (bug 1552458) for xpcshell failures on service-worker-registration on a CLOSED TREE 2019-06-11 12:10:59 +03:00
docshell Bug 1555753 - Always enable Browsing Context preservation in fission windows, r=farre 2019-06-10 13:06:46 +00:00
dom Bug 1555133 - Add some heuristics about visible content in a document. r=bzbarsky 2019-06-11 10:00:46 +00:00
editor Bug 1557996 - Make HTMLEditor::GetSelectedElement() not treat an element as selected when it's followed by a <br> element r=m_kato 2019-06-11 07:59:07 +00:00
extensions Bug 1557231. Stop using [array] in nsIInlineSpellChecker. r=masayuki 2019-06-06 06:59:37 +00:00
gfx Bug 1555655 - Box the TileCache in PicturePrimitive. r=gw 2019-06-10 19:54:13 +00:00
gradle/wrapper
hal
image Bug 1557225. Make MakeInputStream MOZ_MUST_USE. r=aosmond 2019-06-06 10:31:02 +00:00
intl Bug 1552121 - Suppress auto-hyphenation of words with any internal capital letters. r=mats 2019-06-10 11:51:30 +00:00
ipc Bug 1554559 - P1. Test for invalid arguments. r=kershaw 2019-06-11 06:29:23 +00:00
js Bug 1558131 permit PersistentRooted::init() with RootingContext r=sfink 2019-06-11 00:41:32 +00:00
layout Bug 1558357 - Should update layout when the hypothetical display of an element changes, even though the final computed display doesn't. r=dbaron 2019-06-11 09:12:10 +00:00
media Backed out changeset 9e968a4d00bc (bug 1553011) for gtest crashes. CLOSED TREE 2019-06-11 10:32:25 +03:00
memory Bug 997353 - Make powerpc not use static page sizes in mozjemalloc. r=njn 2019-06-06 05:25:59 +00:00
mfbt Bug 1558272: Add Windows 10 May 2019 Update to WindowsVersion.h; r=dmajor 2019-06-10 18:52:38 +00:00
mobile Bug 1557035 - Changing android hardcoded system principal session to fix tests. r=JanH 2019-06-07 15:42:29 +00:00
modules Bug 1554334 - P2. Assert that Once StaticPrefs setter is never called once initialized. r=njn 2019-06-11 06:32:59 +00:00
mozglue Bug 1558350: Add TestNativeNt to cppunittest.ini; r=mhowell 2019-06-11 00:11:58 +00:00
netwerk Bug 1545523 - Set mRaceCacheWithNetwork to true if mCacheOpenFunc is assigned r=michal 2019-06-10 13:37:04 +00:00
nsprpub
other-licenses
parser Bug 1539714 - Trigger initial localization even if layout started. r=bzbarsky 2019-06-10 20:06:08 +00:00
python Bug 1520001 - dependency cloudabi is BSD-2 and must appear in about:license;r=mhoye 2019-06-10 13:22:58 +00:00
remote
security Backed out changeset ce509bb0895a (bug 1557161) for Windows 2012 AArch64 build bustages. CLOSED TREE 2019-06-10 21:45:55 +03:00
services No Bug, mozilla-central repo-update HSTS HPKP blocklist remote-settings - a=repo-update r=RyanVM 2019-06-10 13:57:19 +00:00
servo Bug 1557430 - Add memory reporters for SVG mapped attribute declarations. r=njn,heycam 2019-06-08 18:58:57 +00:00
startupcache
storage Bug 1516333 - Part 1: Move group and origin re-escaping from QuotaManager::GetQuotaObject to GetQuotaObjectFromNameAndParameters in TelemetryVFS.cpp; r=janv,asuth 2019-06-07 08:04:57 +02:00
taskcluster Bug 1557204 - remove unused check_uptake support, r=mtabara 2019-06-07 15:50:04 +00:00
testing Bug 1558357 - Should update layout when the hypothetical display of an element changes, even though the final computed display doesn't. r=dbaron 2019-06-11 09:12:10 +00:00
third_party Backed out changeset ce509bb0895a (bug 1557161) for Windows 2012 AArch64 build bustages. CLOSED TREE 2019-06-10 21:45:55 +03:00
toolkit Bug 1558370 - Correct disabling of test_arrowpanel.xul which redisables toolkit chrome tests on Android. r=emilio 2019-06-11 09:50:26 +00:00
tools Bug 1558271 - Update mozilla/browsertime snapshot to b8c1becaee74970a6f6e4222a64d1e2e18f20cd6 r=nalexander 2019-06-10 21:03:22 +00:00
uriloader Bug 1555374. Use StaticPrefs accessors for various prefs that moved to StaticPrefs recently. r=edgar 2019-06-01 02:29:26 +00:00
view
widget Bug 1557266 - [Wayland] Use widget.wayland_dmabuf_backend.enabled preference to enable wayland dmabuf backend, r=jhorak 2019-06-10 12:37:06 +00:00
xpcom Bug 1555891 - Merge PVideoDecoderManager into PRemoteDecoderManager. r=jya,jld 2019-06-11 02:01:34 +00:00
xpfe/appshell
.arcconfig
.clang-format
.clang-format-ignore Bug 1554063 - Move decimal to mozglue. r=jwalden 2019-05-29 06:57:28 +00:00
.cron.yml Bug 1554608 Schedule raptor fennec v64 tests in CI r=dustin,tomprince 2019-06-03 13:59:18 +00:00
.eslintignore Bug 1556013 - Add prettier to the top-level eslint config, r=Standard8 2019-06-07 14:20:09 +00:00
.eslintrc.js Bug 1554224 - Enable some ESLint rules for more of layout/. r=dholbert 2019-05-29 10:50:49 +00:00
.flake8
.gdbinit
.gdbinit_python
.git-blame-ignore-revs
.gitignore Bug 1558271 - Update mozilla/browsertime snapshot to b8c1becaee74970a6f6e4222a64d1e2e18f20cd6 r=nalexander 2019-06-10 21:03:22 +00:00
.hg-annotate-ignore-revs
.hg-format-source
.hgignore Bug 1558271 - Add browsertime-results to hgignore r=nalexander 2019-06-10 19:43:22 +00:00
.hgtags
.lldbinit
.mailmap
.prettierignore Bug 1556013 - Add prettier to the top-level eslint config, r=Standard8 2019-06-07 14:20:09 +00:00
.prettierrc
.taskcluster.yml
.trackerignore
.yamllint
.ycm_extra_conf.py
aclocal.m4
AUTHORS
build.gradle
Cargo.lock Backed out changeset 9e968a4d00bc (bug 1553011) for gtest crashes. CLOSED TREE 2019-06-11 10:32:25 +03:00
Cargo.toml
client.mk
client.py
CLOBBER Bug 1555661 - Fix client code inclusion in Google urls. r=daleharvey 2019-05-31 12:56:59 +00:00
configure.in
configure.py
GNUmakefile
gradle.properties
gradlew
gradlew.bat
LEGAL
LICENSE
mach
Makefile.in Bug 1551639 - Always update buildid but avoid rebuilding libxul. r=nalexander 2019-06-06 04:35:02 +00:00
moz.build
moz.configure
mozilla-config.h.in
old-configure.in bug 1555110 - Backed out changeset a187487af38a to disable cert_storage on non-nightly builds r=jcj,froydnj 2019-05-29 00:11:53 +00:00
package-lock.json Bug 1553926 - Add fetch-options eslint plugin to mozilla central r=Standard8 2019-06-06 11:31:20 +00:00
package.json Bug 1553926 - Add fetch-options eslint plugin to mozilla central r=Standard8 2019-06-06 11:31:20 +00:00
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.