This PR passes all current tests for this feature, and implements the "prefers-color-scheme" media query as an enumerated keyword that is controlled by an integer preference.
Currently, the possible options are 0 to see a website's fallback code and essentially behave like this isn't implemented (our current behavior), 1 to express a preference for a light theme (the default for spec reasons), and 2 to express a preference for a dark theme. Over time, this list may expand to include other preferences like a preference for a sepia theme or something, and this leaves us prepared for that future.
Mostly making parts conditional and removing blocks that are no longer
applicable, and a few minor edits otherwise to update links and text.
Resolves#1722
- Use some pointer voodoo and instead of stringbuffer append()
- Use a lookup table instead of char comparisons for chr < 256
- Stop using a Hashtable/MovableCellHasher for JSON CycleDetector
This had been initially dealt with in issue #1699's commits, but one of them
was in the end reverted, which caused this problem (this change should have
been done there).
Defining _POSIX_C_SOURCE to 199309L on FreeBSD causes compile errors, because of
an obscure interaction between system wrappers and libc++ headers. The source
doesn't seem to need it at all, which tests confirm.
I bet that this is not needed either on other modern systems (even those based
on glibc), and that the define could probably be entirely removed. Not trying
it because I can't test it myself.
New FreeBSD versions have introduced RTLD_DEEPBIND (see dlopen(3)), which
triggers a provoked build error to be on the "safe" side.
Indeed, improper use of RTLD_DEEPBIND could cause malloc interposing not to
work on specific libraries. This would happen for libraries that provide their
own malloc/free and exchange pointers with other libraries or the main program,
one allocating an area and another one deallocating it.
It seems it happened for glibc, which is not a concern on FreeBSD, and for the
Flash Player (not a concern either, there is no native Flash Player). Moreover,
there is only a single reference to RTLD_DEEPBIND in the whole platform
currently, namely in the WebRTC code, but the corresponding code chunk is
compiled-in only on Linux (and this library doesn't seem to redefine malloc
functions anyway). So I don't see how a problem could happen. Additionally,
Pale Moon, which is my focus, doesn't use WebRTC.
Corresponding Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=493541
Including <cstdlib> must never trigger inclusion of "mozalloc.h", because the
first thing this one does is precisely to include <cstdlib>.
It is now the case that, in libc++ 9 and beyond, <cstdlib> includes <math.h>
which then tries to include <type_traits>, which the STL wrapper intercepts,
trying to load "mozalloc.h". Same problem happens with <limits>.
Fix pulled from: https://bugzilla.mozilla.org/show_bug.cgi?id=1594027.
This change makes unicode line and paragraph separators allowed in JS strings,
removing the only quirk of the JS string definition that made JSON not a valid
subset of JS.
Resolves#1732