mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-19 19:29:32 +00:00
Compare commits
186 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cdc8b5a989 | ||
|
7b778396a7 | ||
|
656875dfeb | ||
|
b1c0b3e0c7 | ||
|
d43821e1f8 | ||
|
92acf7d037 | ||
|
09a64c8b51 | ||
|
55284dd803 | ||
|
17b23692fe | ||
|
2f7da4e25a | ||
|
c51a503edb | ||
|
c889bc5ce1 | ||
|
2488fabc48 | ||
|
fb91afbb46 | ||
|
28b4c08821 | ||
|
9197c15057 | ||
|
7c9617ab51 | ||
|
2521b95408 | ||
|
de1b50053f | ||
|
7a3073423e | ||
|
bc6daa0aea | ||
|
16f6279617 | ||
|
c47bef11f0 | ||
|
fbd13e3c86 | ||
|
700da3e996 | ||
|
0a9d355bee | ||
|
6cae6ac238 | ||
|
b5e7c95469 | ||
|
5e969c18d9 | ||
|
861ae8f628 | ||
|
fd2b82f13a | ||
|
03ffdeadba | ||
|
f98a834454 | ||
|
0da0ec9f95 | ||
|
fe1675378f | ||
|
1603b00d03 | ||
|
d7c93b6cfc | ||
|
f091debf61 | ||
|
c6eb388ae4 | ||
|
d61e438569 | ||
|
4821d63d26 | ||
|
7363964adb | ||
|
a3a4a114b6 | ||
|
0f33324c85 | ||
|
7e26521144 | ||
|
80ab2a7137 | ||
|
1db2c6188a | ||
|
0136f8aca9 | ||
|
4f70dd5c95 | ||
|
36ee9cc9c8 | ||
|
6374793402 | ||
|
8c52b1a328 | ||
|
5261bd155f | ||
|
c6fd33982a | ||
|
fcfba098e5 | ||
|
a750ff0843 | ||
|
3e8ae43a5b | ||
|
355d707412 | ||
|
7b403249b0 | ||
|
83a100c423 | ||
|
7b55a0cc47 | ||
|
93249a1ede | ||
|
b7ad30596e | ||
|
0897c8df93 | ||
|
ef55596e77 | ||
|
0bb76284cd | ||
|
7b437c98d9 | ||
|
91eee6dc1f | ||
|
c32eff9f87 | ||
|
011118c385 | ||
|
1eab6170b1 | ||
|
c1a28532cf | ||
|
2c61821e49 | ||
|
438bdb7265 | ||
|
82cb3b59e5 | ||
|
d87db7e160 | ||
|
29dcb592a6 | ||
|
ececaa9729 | ||
|
7a7bba46e7 | ||
|
bc7189521a | ||
|
7a010018da | ||
|
f8a8156e87 | ||
|
1d72924e69 | ||
|
53381bf934 | ||
|
06bbc2e34c | ||
|
81c8a93b94 | ||
|
61f16fc359 | ||
|
dd9a07bbe8 | ||
|
3e4ed08e59 | ||
|
1387da73f5 | ||
|
ab37a30176 | ||
|
16c85bb334 | ||
|
bc184b4c4d | ||
|
819a494138 | ||
|
9d3a836029 | ||
|
191db31e60 | ||
|
f8a60dfea9 | ||
|
0abd0fc5d5 | ||
|
2373458b58 | ||
|
81acd2b99d | ||
|
92be8e3bec | ||
|
b6b1905d52 | ||
|
ab5c5eb231 | ||
|
6653696993 | ||
|
07f2b0d73c | ||
|
fc50954e6f | ||
|
105bc95fcb | ||
|
291688840b | ||
|
cceb528dd0 | ||
|
7c24b77e7b | ||
|
cbcbd24be8 | ||
|
c2d4942155 | ||
|
af9a8236e8 | ||
|
bf39401a52 | ||
|
cb0f39c2f2 | ||
|
3a4915434f | ||
|
da10af1b07 | ||
|
f37f6f5e8b | ||
|
f25d7f7a72 | ||
|
5ec6460efb | ||
|
6e4dd2257a | ||
|
55572f5ec1 | ||
|
31ccb2ec86 | ||
|
fee8edf77c | ||
|
9e33379e78 | ||
|
9f41a2b397 | ||
|
8034a1e5a8 | ||
|
c530265a00 | ||
|
420d67c3c1 | ||
|
2b07a7a8db | ||
|
67c0562596 | ||
|
6ad5c12dab | ||
|
0c828a96e6 | ||
|
80ece6a151 | ||
|
7850b17a7d | ||
|
689819e12b | ||
|
f187b2dfeb | ||
|
256479e9fc | ||
|
5748c75132 | ||
|
3f33f8a6e5 | ||
|
f17e5274c9 | ||
|
8304421b75 | ||
|
0d0dc62a8a | ||
|
a7d2c071de | ||
|
17da05f15c | ||
|
a7f14df010 | ||
|
5785a7c366 | ||
|
a5a4a7ecf9 | ||
|
7ec5e33967 | ||
|
2d99b19d79 | ||
|
03e03bd13c | ||
|
5bb1c76487 | ||
|
692e730faa | ||
|
cce50271ab | ||
|
6428efdd0e | ||
|
2fa4af8eb2 | ||
|
877eef6d59 | ||
|
70020aae35 | ||
|
98aa66e3aa | ||
|
444a1c1fc2 | ||
|
72ed78afdf | ||
|
f1303f04c9 | ||
|
85161d5736 | ||
|
114bbdfd03 | ||
|
11a28b361d | ||
|
d0b344ece9 | ||
|
d7c27ac739 | ||
|
2777050abd | ||
|
ce38568dfb | ||
|
c96c477b11 | ||
|
e2317e41ef | ||
|
38794a041f | ||
|
6dc231866c | ||
|
e901c0a71e | ||
|
67706e1f63 | ||
|
1cdef889be | ||
|
1f3d8fcbe3 | ||
|
ddd1b9aab2 | ||
|
2eb5ba7f62 | ||
|
bbc9a12a5d | ||
|
cfb43390a9 | ||
|
fae264c819 | ||
|
91d1dfb59b | ||
|
c15b86c495 | ||
|
2b0ed5adbb | ||
|
cfb4b1e08a |
|
@ -10,7 +10,7 @@ print <<'EOF';
|
||||||
/* nsSiteSecurityService.cpp, you shouldn't be #including it. */
|
/* nsSiteSecurityService.cpp, you shouldn't be #including it. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* imported from ESR68 by TenFourFox conversion script */
|
/* imported from ESR102 by TenFourFox conversion script */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
EOF
|
EOF
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/perl -s
|
#!/usr/bin/perl -s
|
||||||
|
|
||||||
$source ||= "../esr60/security/manager/ssl/nsSTSPreloadList.inc";
|
|
||||||
open(W, $source) || die("unable to open $source: $!\nspecify -source=/path ?\n");
|
|
||||||
print <<'EOF';
|
print <<'EOF';
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
@ -12,13 +10,13 @@ print <<'EOF';
|
||||||
/* nsSiteSecurityService.cpp, you shouldn't be #including it. */
|
/* nsSiteSecurityService.cpp, you shouldn't be #including it. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* imported from ESR60 by TenFourFox conversion script */
|
/* imported from ESR115 by TenFourFox conversion script */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# let's have a little paranoia.
|
# let's have a little paranoia.
|
||||||
while(<W>) {
|
while(<>) {
|
||||||
if (/^const PRTime gPreloadListExpirationTime = INT64_C/) {
|
if (/^const PRTime gPreloadListExpirationTime = INT64_C/) {
|
||||||
print;
|
print;
|
||||||
$got_time = 1;
|
$got_time = 1;
|
||||||
|
@ -41,7 +39,7 @@ class nsSTSPreload
|
||||||
static const nsSTSPreload kSTSPreloadList[] = {
|
static const nsSTSPreload kSTSPreloadList[] = {
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
while(<W>) {
|
while(<>) {
|
||||||
chomp;
|
chomp;
|
||||||
last if (/%%/);
|
last if (/%%/);
|
||||||
($host, $subd, $crap) = split(/, /, $_, 3);
|
($host, $subd, $crap) = split(/, /, $_, 3);
|
|
@ -390,7 +390,14 @@ if (!defined($json_ref->{'license'}) ||
|
||||||
|
|
||||||
select(STDOUT); $|++;
|
select(STDOUT); $|++;
|
||||||
%dupedupe = ();
|
%dupedupe = ();
|
||||||
foreach $a (@{ $json_ref->{'categories'}->{'Cryptomining'} }) {
|
&emit('Cryptomining');
|
||||||
|
&emit('FingerprintingInvasive');
|
||||||
|
# considering
|
||||||
|
#&emit('Analytics');
|
||||||
|
|
||||||
|
sub emit {
|
||||||
|
my $cat = shift(@_);
|
||||||
|
foreach $a (@{ $json_ref->{'categories'}->{$cat} }) {
|
||||||
foreach $b (keys(%{ $a })) {
|
foreach $b (keys(%{ $a })) {
|
||||||
die("illegal newline: $b\n") if ($b =~ /[\r\n]/s);
|
die("illegal newline: $b\n") if ($b =~ /[\r\n]/s);
|
||||||
print "// $b\n";
|
print "// $b\n";
|
||||||
|
@ -404,8 +411,15 @@ foreach $a (@{ $json_ref->{'categories'}->{'Cryptomining'} }) {
|
||||||
die("illegal quote: $d\n") if ($d =~ /"/);
|
die("illegal quote: $d\n") if ($d =~ /"/);
|
||||||
next if ($dupedupe{$d}++);
|
next if ($dupedupe{$d}++);
|
||||||
|
|
||||||
|
# whitelist (with regrets)
|
||||||
|
next if (0 ||
|
||||||
|
$d eq 'ibm.com' ||
|
||||||
|
$d eq 'godaddy.com' ||
|
||||||
|
0);
|
||||||
print " BLOK(\"$d\") ||\n";
|
print " BLOK(\"$d\") ||\n";
|
||||||
|
print " BLOKD(\".$d\") ||\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ endif
|
||||||
# if we update NSS, we need to remove that patch (TenFourFox issue 512).
|
# if we update NSS, we need to remove that patch (TenFourFox issue 512).
|
||||||
|
|
||||||
set verbose
|
set verbose
|
||||||
set release_url=https://hg.mozilla.org/releases/mozilla-esr68/raw-file/tip/
|
set release_url=https://hg.mozilla.org/releases/mozilla-esr115/raw-file/tip/
|
||||||
|
|
||||||
# self test to ensure certificates and encryption methods are correct
|
# self test to ensure certificates and encryption methods are correct
|
||||||
curl ${release_url}/config/milestone.txt || exit
|
curl ${release_url}/config/milestone.txt || exit
|
||||||
|
@ -18,6 +18,6 @@ curl ${release_url}/config/milestone.txt || exit
|
||||||
curl ${release_url}/security/manager/ssl/StaticHPKPins.h > security/manager/ssl/StaticHPKPins.h
|
curl ${release_url}/security/manager/ssl/StaticHPKPins.h > security/manager/ssl/StaticHPKPins.h
|
||||||
curl ${release_url}/security/nss/lib/ckfw/builtins/certdata.txt > security/nss/lib/ckfw/builtins/certdata.txt
|
curl ${release_url}/security/nss/lib/ckfw/builtins/certdata.txt > security/nss/lib/ckfw/builtins/certdata.txt
|
||||||
curl ${release_url}/netwerk/dns/effective_tld_names.dat > netwerk/dns/effective_tld_names.dat
|
curl ${release_url}/netwerk/dns/effective_tld_names.dat > netwerk/dns/effective_tld_names.dat
|
||||||
curl ${release_url}/security/manager/ssl/nsSTSPreloadList.inc | perl ./104fx_import_esr68_stspreload.pl > security/manager/ssl/nsSTSPreloadList.inc
|
curl ${release_url}/security/manager/ssl/nsSTSPreloadList.inc | perl ./104fx_import_esr102_stspreload.pl > security/manager/ssl/nsSTSPreloadList.inc
|
||||||
perl ./104fx_import_shavar_cryptominers.pl > caps/shavar-blocklist.h
|
perl ./104fx_import_shavar_cryptominers.pl > caps/shavar-blocklist.h
|
||||||
|
|
||||||
|
|
12
104fx_uptzdata.sh
Executable file
12
104fx_uptzdata.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/csh -f
|
||||||
|
|
||||||
|
set root=https://raw.githubusercontent.com/unicode-org/icu/master/icu4c/source/data/misc
|
||||||
|
set verbose
|
||||||
|
cd intl/icu/source/data/misc || exit
|
||||||
|
|
||||||
|
curl -L ${root}/metaZones.txt > metaZones.txt
|
||||||
|
curl -L ${root}/timezoneTypes.txt > timezoneTypes.txt
|
||||||
|
curl -L ${root}/windowsZones.txt > windowsZones.txt
|
||||||
|
curl -L ${root}/zoneinfo64.txt > zoneinfo64.txt
|
||||||
|
|
||||||
|
|
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
||||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||||
# don't change CLOBBER for WebIDL changes any more.
|
# don't change CLOBBER for WebIDL changes any more.
|
||||||
|
|
||||||
Merge day clobber
|
Rebuild for 115ESR base
|
||||||
|
|
|
@ -4,9 +4,9 @@ A fork of Firefox to maintain support for the Power Mac, supporting Mac OS X 10.
|
||||||
|
|
||||||
This project is specifically for Mac OS X 10.4+. If you're looking for a browser for Mac OS 8.6-10.3, look at our sister project, [Classilla](http://www.classilla.org/).
|
This project is specifically for Mac OS X 10.4+. If you're looking for a browser for Mac OS 8.6-10.3, look at our sister project, [Classilla](http://www.classilla.org/).
|
||||||
|
|
||||||
Our Github project site houses our source code, [documentation wiki](https://github.com/classilla/tenfourfox/wiki) and [issues list](https://github.com/classilla/tenfourfox/issues). For downloads and archived versions, visit our [SourceForge download repository](https://sourceforge.net/projects/tenfourfox/files/). **The most current downloads are always linked on [the main TenFourFox home page](http://www.tenfourfox.com/).**
|
**TenFourFox is a "hobby" project: you build it yourself, with no guarantees on updates, update frequency, security or stability.** Our Github project site houses our source code, [documentation wiki](https://github.com/classilla/tenfourfox/wiki) with complete build instructions, and [the current worklist](https://github.com/classilla/tenfourfox/issues). For archived downloads, language packs and contributed tools, visit our [SourceForge download repository](https://sourceforge.net/projects/tenfourfox/files/). **There is no support for any version of TenFourFox.** The current update source is Firefox 115ESR.
|
||||||
|
|
||||||
**If you are an end-user, or otherwise not an official contributor, do _not_ file issues on Github.** Please visit [our Tenderapp support site](http://tenfourfox.tenderapp.com/) and one of our helpful volunteers will assist. Issues opened by end users may be closed as invalid if they have not been adequately vetted.
|
**If you file a Github issue without a patch, or without declaring your intention to file a pull request addressing that issue, it may be summarily closed or deleted at the maintainer's sole discretion.** The issue list is an active worklist, and if no work will occur on an issue, even if the issue is real and verifiable, it will be closed. There are lots of acknowledged deficiencies in TenFourFox and not everyone is going to prioritize a deficiency the way you might. If you are not willing or able to fix your most important issues yourself, you may not want to use this browser.
|
||||||
|
|
||||||
The `wiki/` branch contains old documentation and release notes from our former Google Code wiki. They are no longer updated or maintained. Take care as links in those documents have probably rotted.
|
The `wiki/` branch contains old documentation and release notes from our former Google Code wiki. They are no longer updated or maintained. Take care as links in those documents have probably rotted.
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.or
|
||||||
pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
|
pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
|
||||||
|
|
||||||
// Blocklist preferences
|
// Blocklist preferences
|
||||||
pref("extensions.blocklist.enabled", true);
|
pref("extensions.blocklist.enabled", false);
|
||||||
// OneCRL freshness checking depends on this value, so if you change it,
|
// OneCRL freshness checking depends on this value, so if you change it,
|
||||||
// please also update security.onecrl.maximum_staleness_in_seconds.
|
// please also update security.onecrl.maximum_staleness_in_seconds.
|
||||||
pref("extensions.blocklist.interval", 86400);
|
pref("extensions.blocklist.interval", 86400);
|
||||||
|
@ -86,7 +86,7 @@ pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/f
|
||||||
|
|
||||||
// At startup, should we check to see if the installation
|
// At startup, should we check to see if the installation
|
||||||
// date is older than some threshold
|
// date is older than some threshold
|
||||||
pref("app.update.checkInstallTime", true);
|
pref("app.update.checkInstallTime", false);
|
||||||
|
|
||||||
// The number of days a binary is permitted to be old without checking is defined in
|
// The number of days a binary is permitted to be old without checking is defined in
|
||||||
// firefox-branding.js (app.update.checkInstallTime.days)
|
// firefox-branding.js (app.update.checkInstallTime.days)
|
||||||
|
@ -122,18 +122,18 @@ pref("app.update.cert.requireBuiltIn", false);
|
||||||
pref("app.update.cert.checkAttributes", false);
|
pref("app.update.cert.checkAttributes", false);
|
||||||
|
|
||||||
// Whether or not app updates are enabled
|
// Whether or not app updates are enabled
|
||||||
pref("app.update.enabled", true);
|
pref("app.update.enabled", false);
|
||||||
|
|
||||||
// This preference turns on app.update.mode and allows automatic download and
|
// This preference turns on app.update.mode and allows automatic download and
|
||||||
// install to take place. We use a separate boolean toggle for this to make
|
// install to take place. We use a separate boolean toggle for this to make
|
||||||
// the UI easier to construct.
|
// the UI easier to construct.
|
||||||
pref("app.update.auto", true);
|
pref("app.update.auto", false);
|
||||||
|
|
||||||
// See chart in nsUpdateService.js source for more details
|
// See chart in nsUpdateService.js source for more details
|
||||||
pref("app.update.mode", 2);
|
pref("app.update.mode", 2);
|
||||||
|
|
||||||
// If set to true, the Update Service will present no UI for any event.
|
// If set to true, the Update Service will present no UI for any event.
|
||||||
pref("app.update.silent", false);
|
pref("app.update.silent", true);
|
||||||
|
|
||||||
// If set to true, the hamburger button will show badges for update events.
|
// If set to true, the hamburger button will show badges for update events.
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
|
@ -177,7 +177,7 @@ pref("app.update.incompatible.mode", 0);
|
||||||
|
|
||||||
// Whether or not to attempt using the service for updates.
|
// Whether or not to attempt using the service for updates.
|
||||||
#ifdef MOZ_MAINTENANCE_SERVICE
|
#ifdef MOZ_MAINTENANCE_SERVICE
|
||||||
pref("app.update.service.enabled", true);
|
pref("app.update.service.enabled", false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Symmetric (can be overridden by individual extensions) update preferences.
|
// Symmetric (can be overridden by individual extensions) update preferences.
|
||||||
|
@ -290,11 +290,11 @@ pref("browser.urlbar.matchBehavior", 1);
|
||||||
pref("browser.urlbar.filter.javascript", true);
|
pref("browser.urlbar.filter.javascript", true);
|
||||||
|
|
||||||
// the maximum number of results to show in autocomplete when doing richResults
|
// the maximum number of results to show in autocomplete when doing richResults
|
||||||
pref("browser.urlbar.maxRichResults", 12);
|
pref("browser.urlbar.maxRichResults", 6);
|
||||||
// The amount of time (ms) to wait after the user has stopped typing
|
// The amount of time (ms) to wait after the user has stopped typing
|
||||||
// before starting to perform autocomplete. 50 is the default set in
|
// before starting to perform autocomplete. 50 is the default set in
|
||||||
// autocomplete.xml.
|
// autocomplete.xml.
|
||||||
pref("browser.urlbar.delay", 50);
|
pref("browser.urlbar.delay", 250);
|
||||||
|
|
||||||
// The special characters below can be typed into the urlbar to either restrict
|
// The special characters below can be typed into the urlbar to either restrict
|
||||||
// the search to visited history, bookmarked, tagged pages; or force a match on
|
// the search to visited history, bookmarked, tagged pages; or force a match on
|
||||||
|
@ -1622,6 +1622,8 @@ pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
|
||||||
pref("browser.pocket.useLocaleList", true);
|
pref("browser.pocket.useLocaleList", true);
|
||||||
pref("browser.pocket.enabledLocales", "cs de en-GB en-US en-ZA es-ES es-MX fr hu it ja ja-JP-mac ko nl pl pt-BR pt-PT ru zh-CN zh-TW");
|
pref("browser.pocket.enabledLocales", "cs de en-GB en-US en-ZA es-ES es-MX fr hu it ja ja-JP-mac ko nl pl pt-BR pt-PT ru zh-CN zh-TW");
|
||||||
|
|
||||||
|
pref("signon.privateBrowsingCapture.enabled", true);
|
||||||
|
|
||||||
pref("view_source.tab", true);
|
pref("view_source.tab", true);
|
||||||
|
|
||||||
pref("dom.webnotifications.serviceworker.enabled", true);
|
pref("dom.webnotifications.serviceworker.enabled", true);
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
stopaccesskey="&helpSafeMode.stop.accesskey;"
|
stopaccesskey="&helpSafeMode.stop.accesskey;"
|
||||||
stoplabel="&helpSafeMode.stop.label;"
|
stoplabel="&helpSafeMode.stop.label;"
|
||||||
oncommand="safeModeRestart();"/>
|
oncommand="safeModeRestart();"/>
|
||||||
|
#ifdef NO_MORE_OFFICIAL_BUILDS
|
||||||
<menuseparator id="updateSeparator"/>
|
<menuseparator id="updateSeparator"/>
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
#ifdef MOZ_UPDATER
|
#ifdef MOZ_UPDATER
|
||||||
|
@ -92,6 +93,7 @@
|
||||||
class="menuitem-iconic"
|
class="menuitem-iconic"
|
||||||
oncommand="checkForUpdates();"/>
|
oncommand="checkForUpdates();"/>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
<menuseparator id="aboutSeparator"/>
|
<menuseparator id="aboutSeparator"/>
|
||||||
<menuitem id="aboutName"
|
<menuitem id="aboutName"
|
||||||
|
|
|
@ -58,6 +58,9 @@
|
||||||
label="&openLinkCmdInTab.label;"
|
label="&openLinkCmdInTab.label;"
|
||||||
accesskey="&openLinkCmdInTab.accesskey;"
|
accesskey="&openLinkCmdInTab.accesskey;"
|
||||||
oncommand="gContextMenu.openLinkInTab();"/>
|
oncommand="gContextMenu.openLinkInTab();"/>
|
||||||
|
<menuitem id="context-openlinkintabreaderview"
|
||||||
|
label="&openLinkCmdInTab.label;"
|
||||||
|
oncommand="gContextMenu.openLinkInTabReaderView();"/>
|
||||||
<menuitem id="context-openlink"
|
<menuitem id="context-openlink"
|
||||||
label="&openLinkCmd.label;"
|
label="&openLinkCmd.label;"
|
||||||
accesskey="&openLinkCmd.accesskey;"
|
accesskey="&openLinkCmd.accesskey;"
|
||||||
|
@ -115,27 +118,33 @@
|
||||||
<menu id="context-media-playbackrate" label="&mediaPlaybackRate.label;" accesskey="&mediaPlaybackRate.accesskey;">
|
<menu id="context-media-playbackrate" label="&mediaPlaybackRate.label;" accesskey="&mediaPlaybackRate.accesskey;">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem id="context-media-playbackrate-050x"
|
<menuitem id="context-media-playbackrate-050x"
|
||||||
label="&mediaPlaybackRate050x.label;"
|
label="&mediaPlaybackRate050x2.label;"
|
||||||
accesskey="&mediaPlaybackRate050x.accesskey;"
|
accesskey="&mediaPlaybackRate050x2.accesskey;"
|
||||||
type="radio"
|
type="radio"
|
||||||
name="playbackrate"
|
name="playbackrate"
|
||||||
oncommand="gContextMenu.mediaCommand('playbackRate', 0.5);"/>
|
oncommand="gContextMenu.mediaCommand('playbackRate', 0.5);"/>
|
||||||
<menuitem id="context-media-playbackrate-100x"
|
<menuitem id="context-media-playbackrate-100x"
|
||||||
label="&mediaPlaybackRate100x.label;"
|
label="&mediaPlaybackRate100x2.label;"
|
||||||
accesskey="&mediaPlaybackRate100x.accesskey;"
|
accesskey="&mediaPlaybackRate100x2.accesskey;"
|
||||||
type="radio"
|
type="radio"
|
||||||
name="playbackrate"
|
name="playbackrate"
|
||||||
checked="true"
|
checked="true"
|
||||||
oncommand="gContextMenu.mediaCommand('playbackRate', 1.0);"/>
|
oncommand="gContextMenu.mediaCommand('playbackRate', 1.0);"/>
|
||||||
|
<menuitem id="context-media-playbackrate-125x"
|
||||||
|
label="&mediaPlaybackRate125x2.label;"
|
||||||
|
accesskey="&mediaPlaybackRate125x2.accesskey;"
|
||||||
|
type="radio"
|
||||||
|
name="playbackrate"
|
||||||
|
oncommand="gContextMenu.mediaCommand('playbackRate', 1.25);"/>
|
||||||
<menuitem id="context-media-playbackrate-150x"
|
<menuitem id="context-media-playbackrate-150x"
|
||||||
label="&mediaPlaybackRate150x.label;"
|
label="&mediaPlaybackRate150x2.label;"
|
||||||
accesskey="&mediaPlaybackRate150x.accesskey;"
|
accesskey="&mediaPlaybackRate150x2.accesskey;"
|
||||||
type="radio"
|
type="radio"
|
||||||
name="playbackrate"
|
name="playbackrate"
|
||||||
oncommand="gContextMenu.mediaCommand('playbackRate', 1.5);"/>
|
oncommand="gContextMenu.mediaCommand('playbackRate', 1.5);"/>
|
||||||
<menuitem id="context-media-playbackrate-200x"
|
<menuitem id="context-media-playbackrate-200x"
|
||||||
label="&mediaPlaybackRate200x.label;"
|
label="&mediaPlaybackRate200x2.label;"
|
||||||
accesskey="&mediaPlaybackRate200x.accesskey;"
|
accesskey="&mediaPlaybackRate200x2.accesskey;"
|
||||||
type="radio"
|
type="radio"
|
||||||
name="playbackrate"
|
name="playbackrate"
|
||||||
oncommand="gContextMenu.mediaCommand('playbackRate', 2.0);"/>
|
oncommand="gContextMenu.mediaCommand('playbackRate', 2.0);"/>
|
||||||
|
|
|
@ -322,8 +322,10 @@
|
||||||
observes="View:FullScreen"/>
|
observes="View:FullScreen"/>
|
||||||
#endif
|
#endif
|
||||||
<menuitem id="menu_readerModeItem"
|
<menuitem id="menu_readerModeItem"
|
||||||
|
hidden="true"
|
||||||
observes="View:ReaderView"
|
observes="View:ReaderView"
|
||||||
hidden="true"/>
|
key="key_toggleReaderMode"
|
||||||
|
label="&toggleReaderMode.label;"/>
|
||||||
<menuitem id="menu_showAllTabs"
|
<menuitem id="menu_showAllTabs"
|
||||||
hidden="true"
|
hidden="true"
|
||||||
accesskey="&showAllTabsCmd.accesskey;"
|
accesskey="&showAllTabsCmd.accesskey;"
|
||||||
|
@ -482,7 +484,8 @@
|
||||||
<menu id="tools-menu"
|
<menu id="tools-menu"
|
||||||
label="&toolsMenu.label;"
|
label="&toolsMenu.label;"
|
||||||
accesskey="&toolsMenu.accesskey;"
|
accesskey="&toolsMenu.accesskey;"
|
||||||
onpopupshowing="mirrorShow(this)">
|
onpopupshowing="mirrorShow(this);
|
||||||
|
jsToggle.updateMenu();">
|
||||||
<menupopup id="menu_ToolsPopup"
|
<menupopup id="menu_ToolsPopup"
|
||||||
# We have to use setTimeout() here to avoid a flickering menu bar when opening
|
# We have to use setTimeout() here to avoid a flickering menu bar when opening
|
||||||
# the Tools menu, see bug 970769. This can be removed once we got rid of the
|
# the Tools menu, see bug 970769. This can be removed once we got rid of the
|
||||||
|
@ -516,6 +519,12 @@
|
||||||
accesskey="&syncReAuthItem.accesskey;"
|
accesskey="&syncReAuthItem.accesskey;"
|
||||||
observes="sync-reauth-state"
|
observes="sync-reauth-state"
|
||||||
oncommand="gSyncUI.openSignInAgainPage('menubar');"/>
|
oncommand="gSyncUI.openSignInAgainPage('menubar');"/>
|
||||||
|
<menuseparator/>
|
||||||
|
<menuitem id="toggle_javascript"
|
||||||
|
label="&JavascriptToggleCmd.label;"
|
||||||
|
type="checkbox"
|
||||||
|
command="cmd_toggleJavascript"
|
||||||
|
checked="true"/>
|
||||||
<menuseparator id="devToolsSeparator"/>
|
<menuseparator id="devToolsSeparator"/>
|
||||||
<menu id="webDeveloperMenu"
|
<menu id="webDeveloperMenu"
|
||||||
label="&webDeveloperMenu.label;"
|
label="&webDeveloperMenu.label;"
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
|
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
|
||||||
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
|
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
|
||||||
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
|
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
|
||||||
|
<command id="cmd_toggleJavascript" oncommand="jsToggle.toggle();"/>
|
||||||
<command id="cmd_gestureRotateLeft" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
|
<command id="cmd_gestureRotateLeft" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
|
||||||
<command id="cmd_gestureRotateRight" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
|
<command id="cmd_gestureRotateRight" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
|
||||||
<command id="cmd_gestureRotateEnd" oncommand="gGestureSupport.rotateEnd()"/>
|
<command id="cmd_gestureRotateEnd" oncommand="gGestureSupport.rotateEnd()"/>
|
||||||
|
@ -366,6 +367,7 @@
|
||||||
<key id="key_fullScreen_old" key="&fullScreenCmd.macCommandKey;" command="View:FullScreen" modifiers="accel,shift"/>
|
<key id="key_fullScreen_old" key="&fullScreenCmd.macCommandKey;" command="View:FullScreen" modifiers="accel,shift"/>
|
||||||
<key keycode="VK_F11" command="View:FullScreen"/>
|
<key keycode="VK_F11" command="View:FullScreen"/>
|
||||||
#endif
|
#endif
|
||||||
|
<key id="key_toggleReaderMode" key="&toggleReaderMode.key;" command="View:ReaderView" modifiers="accel,alt" disabled="true"/>
|
||||||
<key key="&reloadCmd.commandkey;" command="Browser:Reload" modifiers="accel" id="key_reload"/>
|
<key key="&reloadCmd.commandkey;" command="Browser:Reload" modifiers="accel" id="key_reload"/>
|
||||||
<key key="&reloadCmd.commandkey;" command="Browser:ReloadSkipCache" modifiers="accel,shift"/>
|
<key key="&reloadCmd.commandkey;" command="Browser:ReloadSkipCache" modifiers="accel,shift"/>
|
||||||
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
|
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
|
||||||
|
|
|
@ -5414,6 +5414,7 @@ const nodeToTooltipMap = {
|
||||||
"tabs-newtab-button": "newTabButton.tooltip",
|
"tabs-newtab-button": "newTabButton.tooltip",
|
||||||
"fullscreen-button": "fullscreenButton.tooltip",
|
"fullscreen-button": "fullscreenButton.tooltip",
|
||||||
"downloads-button": "downloads.tooltip",
|
"downloads-button": "downloads.tooltip",
|
||||||
|
"reader-mode-button": "reader-mode-button.tooltip",
|
||||||
};
|
};
|
||||||
const nodeToShortcutMap = {
|
const nodeToShortcutMap = {
|
||||||
"bookmarks-menu-button": "manBookmarkKb",
|
"bookmarks-menu-button": "manBookmarkKb",
|
||||||
|
@ -5421,7 +5422,8 @@ const nodeToShortcutMap = {
|
||||||
"new-tab-button": "key_newNavigatorTab",
|
"new-tab-button": "key_newNavigatorTab",
|
||||||
"tabs-newtab-button": "key_newNavigatorTab",
|
"tabs-newtab-button": "key_newNavigatorTab",
|
||||||
"fullscreen-button": "key_fullScreen",
|
"fullscreen-button": "key_fullScreen",
|
||||||
"downloads-button": "key_openDownloads"
|
"downloads-button": "key_openDownloads",
|
||||||
|
"reader-mode-button": "key_toggleReaderMode",
|
||||||
};
|
};
|
||||||
|
|
||||||
//if (AppConstants.platform == "macosx") {
|
//if (AppConstants.platform == "macosx") {
|
||||||
|
|
|
@ -733,6 +733,7 @@
|
||||||
onclick="gPopupBlockerObserver.onReportButtonClick(event);"/>
|
onclick="gPopupBlockerObserver.onReportButtonClick(event);"/>
|
||||||
<image id="reader-mode-button"
|
<image id="reader-mode-button"
|
||||||
class="urlbar-icon"
|
class="urlbar-icon"
|
||||||
|
tooltip="dynamic-shortcut-tooltip"
|
||||||
hidden="true"
|
hidden="true"
|
||||||
onclick="ReaderParent.buttonClick(event);"/>
|
onclick="ReaderParent.buttonClick(event);"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
<script type="application/javascript" src="chrome://global/content/printUtils.js"/>
|
<script type="application/javascript" src="chrome://global/content/printUtils.js"/>
|
||||||
<script type="application/javascript" src="chrome://global/content/viewZoomOverlay.js"/>
|
<script type="application/javascript" src="chrome://global/content/viewZoomOverlay.js"/>
|
||||||
|
<script type="application/javascript" src="chrome://global/content/jsToggle.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/places/browserPlacesViews.js"/>
|
<script type="application/javascript" src="chrome://browser/content/places/browserPlacesViews.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/downloads/downloads.js"/>
|
<script type="application/javascript" src="chrome://browser/content/downloads/downloads.js"/>
|
||||||
|
|
|
@ -10,6 +10,9 @@ Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
|
||||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
// TenFourFox issue 620
|
||||||
|
const gReaderBundle =
|
||||||
|
Services.strings.createBundle("chrome://global/locale/aboutReader.properties");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
||||||
"resource:///modules/CustomizableUI.jsm");
|
"resource:///modules/CustomizableUI.jsm");
|
||||||
|
@ -150,6 +153,24 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-openlink", shouldShow && !isWindowPrivate);
|
this.showItem("context-openlink", shouldShow && !isWindowPrivate);
|
||||||
this.showItem("context-openlinkprivate", shouldShow);
|
this.showItem("context-openlinkprivate", shouldShow);
|
||||||
this.showItem("context-openlinkintab", shouldShow);
|
this.showItem("context-openlinkintab", shouldShow);
|
||||||
|
|
||||||
|
// TenFourFox issue 620
|
||||||
|
if (shouldShow && this.linkURI && gReaderBundle &&
|
||||||
|
!this.linkURI.spec.startsWith("about:reader") &&
|
||||||
|
this.linkURI.spec.startsWith("http")) {
|
||||||
|
let k = document.getElementById("context-openlinkintabreaderview");
|
||||||
|
// This is a hack to create a new locale string out of existing ones.
|
||||||
|
// Unfortunately one string is in a DTD and the other is a property,
|
||||||
|
// so we need this silly little song and dance to not keep adding the
|
||||||
|
// string over and over every time the context menu opens.
|
||||||
|
let l = gReaderBundle.GetStringFromName("readerView.enter");
|
||||||
|
if (k.getAttribute("label").indexOf(l) == -1)
|
||||||
|
k.setAttribute("label", k.getAttribute("label") + ", " + l);
|
||||||
|
this.showItem("context-openlinkintabreaderview", true);
|
||||||
|
} else {
|
||||||
|
this.showItem("context-openlinkintabreaderview", false);
|
||||||
|
}
|
||||||
|
|
||||||
this.showItem("context-openlinkincurrent", this.onPlainTextLink);
|
this.showItem("context-openlinkincurrent", this.onPlainTextLink);
|
||||||
this.showItem("context-sep-open", shouldShow);
|
this.showItem("context-sep-open", shouldShow);
|
||||||
},
|
},
|
||||||
|
@ -223,6 +244,7 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
initPocketItems: function CM_initPocketItems() {
|
initPocketItems: function CM_initPocketItems() {
|
||||||
|
/*
|
||||||
var showSaveCurrentPageToPocket = !(this.onTextInput || this.onLink ||
|
var showSaveCurrentPageToPocket = !(this.onTextInput || this.onLink ||
|
||||||
this.isContentSelected || this.onImage ||
|
this.isContentSelected || this.onImage ||
|
||||||
this.onCanvas || this.onVideo || this.onAudio);
|
this.onCanvas || this.onVideo || this.onAudio);
|
||||||
|
@ -237,6 +259,10 @@ nsContextMenu.prototype = {
|
||||||
let showSaveLinkToPocket = canPocket && !showSaveCurrentPageToPocket &&
|
let showSaveLinkToPocket = canPocket && !showSaveCurrentPageToPocket &&
|
||||||
(this.onSaveableLink || this.onPlainTextLink);
|
(this.onSaveableLink || this.onPlainTextLink);
|
||||||
this.showItem("context-savelinktopocket", showSaveLinkToPocket);
|
this.showItem("context-savelinktopocket", showSaveLinkToPocket);
|
||||||
|
*/
|
||||||
|
// Nothing in my pocketses! Or yours!
|
||||||
|
this.showItem("context-pocket", false);
|
||||||
|
this.showItem("context-savelinktopocket", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
initViewItems: function CM_initViewItems() {
|
initViewItems: function CM_initViewItems() {
|
||||||
|
@ -499,6 +525,7 @@ nsContextMenu.prototype = {
|
||||||
if (onMedia) {
|
if (onMedia) {
|
||||||
this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5);
|
this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5);
|
||||||
this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0);
|
this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0);
|
||||||
|
this.setItemAttr("context-media-playbackrate-125x", "checked", this.target.playbackRate == 1.25);
|
||||||
this.setItemAttr("context-media-playbackrate-150x", "checked", this.target.playbackRate == 1.5);
|
this.setItemAttr("context-media-playbackrate-150x", "checked", this.target.playbackRate == 1.5);
|
||||||
this.setItemAttr("context-media-playbackrate-200x", "checked", this.target.playbackRate == 2.0);
|
this.setItemAttr("context-media-playbackrate-200x", "checked", this.target.playbackRate == 2.0);
|
||||||
var hasError = this.target.error != null ||
|
var hasError = this.target.error != null ||
|
||||||
|
@ -510,6 +537,7 @@ nsContextMenu.prototype = {
|
||||||
this.setItemAttr("context-media-playbackrate", "disabled", hasError);
|
this.setItemAttr("context-media-playbackrate", "disabled", hasError);
|
||||||
this.setItemAttr("context-media-playbackrate-050x", "disabled", hasError);
|
this.setItemAttr("context-media-playbackrate-050x", "disabled", hasError);
|
||||||
this.setItemAttr("context-media-playbackrate-100x", "disabled", hasError);
|
this.setItemAttr("context-media-playbackrate-100x", "disabled", hasError);
|
||||||
|
this.setItemAttr("context-media-playbackrate-125x", "disabled", hasError);
|
||||||
this.setItemAttr("context-media-playbackrate-150x", "disabled", hasError);
|
this.setItemAttr("context-media-playbackrate-150x", "disabled", hasError);
|
||||||
this.setItemAttr("context-media-playbackrate-200x", "disabled", hasError);
|
this.setItemAttr("context-media-playbackrate-200x", "disabled", hasError);
|
||||||
this.setItemAttr("context-media-showcontrols", "disabled", hasError);
|
this.setItemAttr("context-media-showcontrols", "disabled", hasError);
|
||||||
|
@ -977,6 +1005,40 @@ nsContextMenu.prototype = {
|
||||||
this._openLinkInParameters({ private: true }));
|
this._openLinkInParameters({ private: true }));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Open linked-to URL in a new tab starting Reader View immediately.
|
||||||
|
// TenFourFox issue 620
|
||||||
|
openLinkInTabReaderView: function() {
|
||||||
|
urlSecurityCheck(this.linkURL, this.principal);
|
||||||
|
let referrerURI = gContextMenuContentData.documentURIObject;
|
||||||
|
|
||||||
|
// if the mixedContentChannel is present and the referring URI passes
|
||||||
|
// a same origin check with the target URI, we can preserve the users
|
||||||
|
// decision of disabling MCB on a page for it's child tabs.
|
||||||
|
let persistAllowMixedContentInChildTab = false;
|
||||||
|
|
||||||
|
if (this.browser.docShell && this.browser.docShell.mixedContentChannel) {
|
||||||
|
const sm = Services.scriptSecurityManager;
|
||||||
|
try {
|
||||||
|
let targetURI = this.linkURI;
|
||||||
|
sm.checkSameOriginURI(referrerURI, targetURI, false);
|
||||||
|
persistAllowMixedContentInChildTab = true;
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
let doInBackground = false;
|
||||||
|
try {
|
||||||
|
doInBackground = Services.prefs.getBoolPref("tenfourfox.reader.sticky.tabs.loadInBackground");
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
let params = this._openLinkInParameters({
|
||||||
|
allowMixedContent: persistAllowMixedContentInChildTab,
|
||||||
|
inBackground: doInBackground,
|
||||||
|
});
|
||||||
|
openLinkIn("about:reader?url="+encodeURIComponent(this.linkURL),
|
||||||
|
"tab", params);
|
||||||
|
},
|
||||||
|
|
||||||
// Open linked-to URL in a new tab.
|
// Open linked-to URL in a new tab.
|
||||||
openLinkInTab: function() {
|
openLinkInTab: function() {
|
||||||
urlSecurityCheck(this.linkURL, this.principal);
|
urlSecurityCheck(this.linkURL, this.principal);
|
||||||
|
@ -1859,10 +1921,12 @@ nsContextMenu.prototype = {
|
||||||
return JSON.stringify(rv);
|
return JSON.stringify(rv);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
_checkTelemetryForMenu: function(aXulMenu) {
|
_checkTelemetryForMenu: function(aXulMenu) {
|
||||||
this._telemetryClickID = null;
|
this._telemetryClickID = null;
|
||||||
this._telemetryPageContext = this._getTelemetryPageContextInfo();
|
this._telemetryPageContext = this._getTelemetryPageContextInfo();
|
||||||
this._telemetryHadCustomItems = this.hasPageMenu;
|
this._telemetryHadCustomItems = this.hasPageMenu;
|
||||||
this._getTelemetryClickInfo(aXulMenu);
|
this._getTelemetryClickInfo(aXulMenu);
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,6 +90,9 @@ var security = {
|
||||||
case nsISSLStatus.TLS_VERSION_1_2:
|
case nsISSLStatus.TLS_VERSION_1_2:
|
||||||
retval.version = "TLS 1.2"
|
retval.version = "TLS 1.2"
|
||||||
break;
|
break;
|
||||||
|
case nsISSLStatus.TLS_VERSION_1_3:
|
||||||
|
retval.version = "TLS 1.3"
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -12,6 +12,9 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/ExtensionContent.jsm");
|
Cu.import("resource://gre/modules/ExtensionContent.jsm");
|
||||||
|
|
||||||
const g104FxForcePref = "tenfourfox.reader.force-enable"; // TenFourFox issue 583
|
const g104FxForcePref = "tenfourfox.reader.force-enable"; // TenFourFox issue 583
|
||||||
|
const g104FxStickyPref = "tenfourfox.reader.sticky"; // TenFourFox issue 620
|
||||||
|
const g104FxAutoPref = "tenfourfox.reader.auto."; // TenFourFox issue 636
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
|
||||||
|
@ -260,6 +263,8 @@ var AboutReaderListener = {
|
||||||
|
|
||||||
_articlePromise: null,
|
_articlePromise: null,
|
||||||
_alwaysAllowReaderMode: true, // TenFourFox issue 583
|
_alwaysAllowReaderMode: true, // TenFourFox issue 583
|
||||||
|
_stickyReaderMode: true, // TenFourFox issue 620
|
||||||
|
_currentURISpec: null, // TenFourFox issue 636
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
addEventListener("AboutReaderContentLoaded", this, false, true);
|
addEventListener("AboutReaderContentLoaded", this, false, true);
|
||||||
|
@ -269,15 +274,73 @@ var AboutReaderListener = {
|
||||||
addMessageListener("Reader:ParseDocument", this);
|
addMessageListener("Reader:ParseDocument", this);
|
||||||
addMessageListener("Reader:PushState", this);
|
addMessageListener("Reader:PushState", this);
|
||||||
Services.prefs.addObserver(g104FxForcePref, this, false);
|
Services.prefs.addObserver(g104FxForcePref, this, false);
|
||||||
|
Services.prefs.addObserver(g104FxStickyPref, this, false);
|
||||||
|
Services.obs.addObserver(this, "AboutReader:Ready", false);
|
||||||
|
/* content-document-global-created seems to NS_ASSERT */
|
||||||
|
Services.obs.addObserver(this, "document-element-inserted", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TenFourFox issue 583
|
// TenFourFox issue 583 + 636
|
||||||
uninit: function() {
|
uninit: function() {
|
||||||
Services.prefs.removeObserver(g104FxForcePref, this, false);
|
Services.prefs.removeObserver(g104FxForcePref, this, false);
|
||||||
|
Services.obs.removeObserver(this, "AboutReader:Ready");
|
||||||
|
Services.obs.removeObserver(this, "document-element-inserted");
|
||||||
},
|
},
|
||||||
observe: function(subject, topic, data) { // jshint ignore:line
|
observe: function(subject, topic, data) { // jshint ignore:line
|
||||||
if (topic === "nsPref:changed") {
|
if (topic === "nsPref:changed") {
|
||||||
this._alwaysAllowReaderMode = Preferences.get(g104FxForcePref, true);
|
this._alwaysAllowReaderMode = Preferences.get(g104FxForcePref, true);
|
||||||
|
this._stickyReaderMode = Preferences.get(g104FxStickyPref, true);
|
||||||
|
}
|
||||||
|
if (topic === "AboutReader:Ready") {
|
||||||
|
this.stickyReaderLinks();
|
||||||
|
}
|
||||||
|
if (topic === "document-element-inserted") { // TenFourFox issue 636
|
||||||
|
this.doAutoReaderView();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// TenFourFox issue 636
|
||||||
|
doAutoReaderView: function() {
|
||||||
|
if (!content || this.isAboutReader)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!content.document.documentURI.startsWith("http:") &&
|
||||||
|
!content.document.documentURI.startsWith("https")) {
|
||||||
|
/* could be another about: page, could be ftp, ... */
|
||||||
|
this._currentURISpec = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we ended up back here because we explicitly exited Reader View on
|
||||||
|
the same URL, then honour what the user probably wants. */
|
||||||
|
let loc = content.document.location;
|
||||||
|
if (this._currentURISpec == loc.href) return;
|
||||||
|
this._currentURISpec = loc.href;
|
||||||
|
|
||||||
|
/* process into an nsIURI. this gives us a reliable host *and* spec w/o ref */
|
||||||
|
let uri = Services.io.newURI(loc.href, null, null);
|
||||||
|
if (uri && uri.host && uri.host.length && uri.host.length > 0) {
|
||||||
|
let w = null;
|
||||||
|
try {
|
||||||
|
w = Services.prefs.getCharPref(g104FxAutoPref + uri.host);
|
||||||
|
} catch(e) { }
|
||||||
|
if (w && w.length && w.length > 0) {
|
||||||
|
if (w == "y") {
|
||||||
|
this._currentURISpec = uri.specIgnoringRef; // might change
|
||||||
|
loc.replace("about:reader?url="+encodeURIComponent(uri.specIgnoringRef));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (w == "s") {
|
||||||
|
if (uri.path && uri.path.length && uri.path != "" && uri.path != "/"
|
||||||
|
&& !uri.path.startsWith("/?")
|
||||||
|
&& !uri.path.toLowerCase().startsWith("/index.")
|
||||||
|
) {
|
||||||
|
this._currentURISpec = uri.specIgnoringRef; // might change
|
||||||
|
loc.replace("about:reader?url="+encodeURIComponent(uri.specIgnoringRef));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -333,6 +396,24 @@ var AboutReaderListener = {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "DOMContentLoaded":
|
case "DOMContentLoaded":
|
||||||
|
// Post-load fixups can go here.
|
||||||
|
|
||||||
|
// TenFourFox issue 654: defeat lozad.js lazy image loading.
|
||||||
|
Array.forEach(content.document.getElementsByTagName('img'),
|
||||||
|
function(i) {
|
||||||
|
let j;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Convert data-src to src.
|
||||||
|
j = i.getAttribute("data-src");
|
||||||
|
if (j) {
|
||||||
|
i.src = j;
|
||||||
|
i.setAttribute("data-loaded") = "true";
|
||||||
|
}
|
||||||
|
} catch(e) { }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Do this last.
|
||||||
this.updateReaderButton();
|
this.updateReaderButton();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -355,6 +436,24 @@ var AboutReaderListener = {
|
||||||
this.scheduleReadabilityCheckPostPaint(forceNonArticle);
|
this.scheduleReadabilityCheckPostPaint(forceNonArticle);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
stickyReaderLinks: function() { /* TenFourFox issue 620 */
|
||||||
|
if (!this.isAboutReader || !this._stickyReaderMode) return;
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
let ls = content.document.links;
|
||||||
|
if (!ls || !ls.length || ls.length == 0) return;
|
||||||
|
|
||||||
|
for (i=0; i<ls.length; i++) {
|
||||||
|
if (ls[i].href && ls[i].href.startsWith("http"))
|
||||||
|
ls[i].href = "about:reader?url=" + encodeURIComponent(ls[i].href);
|
||||||
|
/*
|
||||||
|
ls[i].onclick = function() {
|
||||||
|
this.href='about:reader?url='+encodeURIComponent(this.href);
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
cancelPotentialPendingReadabilityCheck: function() {
|
cancelPotentialPendingReadabilityCheck: function() {
|
||||||
if (this._pendingReadabilityCheck) {
|
if (this._pendingReadabilityCheck) {
|
||||||
removeEventListener("MozAfterPaint", this._pendingReadabilityCheck);
|
removeEventListener("MozAfterPaint", this._pendingReadabilityCheck);
|
||||||
|
|
|
@ -173,6 +173,7 @@ function runTest(testNum) {
|
||||||
"context-media-playbackrate", null,
|
"context-media-playbackrate", null,
|
||||||
["context-media-playbackrate-050x", true,
|
["context-media-playbackrate-050x", true,
|
||||||
"context-media-playbackrate-100x", true,
|
"context-media-playbackrate-100x", true,
|
||||||
|
"context-media-playbackrate-125x", true,
|
||||||
"context-media-playbackrate-150x", true,
|
"context-media-playbackrate-150x", true,
|
||||||
"context-media-playbackrate-200x", true], null,
|
"context-media-playbackrate-200x", true], null,
|
||||||
"context-media-hidecontrols", true,
|
"context-media-hidecontrols", true,
|
||||||
|
@ -199,6 +200,7 @@ function runTest(testNum) {
|
||||||
"context-media-playbackrate", null,
|
"context-media-playbackrate", null,
|
||||||
["context-media-playbackrate-050x", true,
|
["context-media-playbackrate-050x", true,
|
||||||
"context-media-playbackrate-100x", true,
|
"context-media-playbackrate-100x", true,
|
||||||
|
"context-media-playbackrate-125x", true,
|
||||||
"context-media-playbackrate-150x", true,
|
"context-media-playbackrate-150x", true,
|
||||||
"context-media-playbackrate-200x", true], null,
|
"context-media-playbackrate-200x", true], null,
|
||||||
"context-media-showcontrols", true,
|
"context-media-showcontrols", true,
|
||||||
|
@ -219,6 +221,7 @@ function runTest(testNum) {
|
||||||
"context-media-playbackrate", null,
|
"context-media-playbackrate", null,
|
||||||
["context-media-playbackrate-050x", false,
|
["context-media-playbackrate-050x", false,
|
||||||
"context-media-playbackrate-100x", false,
|
"context-media-playbackrate-100x", false,
|
||||||
|
"context-media-playbackrate-125x", false,
|
||||||
"context-media-playbackrate-150x", false,
|
"context-media-playbackrate-150x", false,
|
||||||
"context-media-playbackrate-200x", false], null,
|
"context-media-playbackrate-200x", false], null,
|
||||||
"context-media-hidecontrols", false,
|
"context-media-hidecontrols", false,
|
||||||
|
@ -245,6 +248,7 @@ function runTest(testNum) {
|
||||||
"context-media-playbackrate", null,
|
"context-media-playbackrate", null,
|
||||||
["context-media-playbackrate-050x", false,
|
["context-media-playbackrate-050x", false,
|
||||||
"context-media-playbackrate-100x", false,
|
"context-media-playbackrate-100x", false,
|
||||||
|
"context-media-playbackrate-125x", false,
|
||||||
"context-media-playbackrate-150x", false,
|
"context-media-playbackrate-150x", false,
|
||||||
"context-media-playbackrate-200x", false], null,
|
"context-media-playbackrate-200x", false], null,
|
||||||
"context-media-hidecontrols", false,
|
"context-media-hidecontrols", false,
|
||||||
|
@ -305,6 +309,7 @@ function runTest(testNum) {
|
||||||
"context-media-playbackrate", null,
|
"context-media-playbackrate", null,
|
||||||
["context-media-playbackrate-050x", true,
|
["context-media-playbackrate-050x", true,
|
||||||
"context-media-playbackrate-100x", true,
|
"context-media-playbackrate-100x", true,
|
||||||
|
"context-media-playbackrate-125x", true,
|
||||||
"context-media-playbackrate-150x", true,
|
"context-media-playbackrate-150x", true,
|
||||||
"context-media-playbackrate-200x", true], null,
|
"context-media-playbackrate-200x", true], null,
|
||||||
"context-media-hidecontrols", true,
|
"context-media-hidecontrols", true,
|
||||||
|
|
|
@ -670,7 +670,8 @@ function setupCheckForUpdates(checkForUpdates, aStringBundle)
|
||||||
// Disable the UI if the update enabled pref has been locked by the
|
// Disable the UI if the update enabled pref has been locked by the
|
||||||
// administrator or if we cannot update for some other reason
|
// administrator or if we cannot update for some other reason
|
||||||
var canCheckForUpdates = updates.canCheckForUpdates;
|
var canCheckForUpdates = updates.canCheckForUpdates;
|
||||||
checkForUpdates.setAttribute("disabled", !canCheckForUpdates);
|
try { checkForUpdates.setAttribute("disabled", !canCheckForUpdates); }
|
||||||
|
catch(e) { return; }
|
||||||
if (!canCheckForUpdates)
|
if (!canCheckForUpdates)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ pref("startup.homepage_override_url", "");
|
||||||
pref("startup.homepage_welcome_url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/firstrun/");
|
pref("startup.homepage_welcome_url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/firstrun/");
|
||||||
pref("startup.homepage_welcome_url.additional", "");
|
pref("startup.homepage_welcome_url.additional", "");
|
||||||
// The time interval between checks for a new version (in seconds)
|
// The time interval between checks for a new version (in seconds)
|
||||||
pref("app.update.interval", 28800); // 8 hours
|
pref("app.update.interval", 0);
|
||||||
// The time interval between the downloading of mar file chunks in the
|
// The time interval between the downloading of mar file chunks in the
|
||||||
// background (in seconds)
|
// background (in seconds)
|
||||||
// 0 means "download everything at once"
|
// 0 means "download everything at once"
|
||||||
|
|
|
@ -6,7 +6,7 @@ pref("startup.homepage_override_url","http://www.tenfourfox.com/start/%LOCALE%/%
|
||||||
pref("startup.homepage_welcome_url","http://www.tenfourfox.com/start/%LOCALE%/%APP%/%VERSION%/firstrun/");
|
pref("startup.homepage_welcome_url","http://www.tenfourfox.com/start/%LOCALE%/%APP%/%VERSION%/firstrun/");
|
||||||
pref("startup.homepage_welcome_url.additional", "");
|
pref("startup.homepage_welcome_url.additional", "");
|
||||||
// The time interval between checks for a new version (in seconds)
|
// The time interval between checks for a new version (in seconds)
|
||||||
pref("app.update.interval", 86400); // 24 hours
|
pref("app.update.interval", 0);
|
||||||
// The time interval between the downloading of mar file chunks in the
|
// The time interval between the downloading of mar file chunks in the
|
||||||
// background (in seconds)
|
// background (in seconds)
|
||||||
// 0 means "download everything at once"
|
// 0 means "download everything at once"
|
||||||
|
|
|
@ -6,7 +6,7 @@ pref("startup.homepage_override_url","http://www.tenfourfox.com/start/%LOCALE%/%
|
||||||
pref("startup.homepage_welcome_url","http://www.tenfourfox.com/start/%LOCALE%/%APP%/%VERSION%/firstrun/");
|
pref("startup.homepage_welcome_url","http://www.tenfourfox.com/start/%LOCALE%/%APP%/%VERSION%/firstrun/");
|
||||||
pref("startup.homepage_welcome_url.additional", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/firstrun/learnmore/");
|
pref("startup.homepage_welcome_url.additional", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/firstrun/learnmore/");
|
||||||
// Interval: Time between checks for a new version (in seconds)
|
// Interval: Time between checks for a new version (in seconds)
|
||||||
pref("app.update.interval", 43200); // 12 hours
|
pref("app.update.interval", 0);
|
||||||
// The time interval between the downloading of mar file chunks in the
|
// The time interval between the downloading of mar file chunks in the
|
||||||
// background (in seconds)
|
// background (in seconds)
|
||||||
pref("app.update.download.backgroundInterval", 60);
|
pref("app.update.download.backgroundInterval", 60);
|
||||||
|
|
|
@ -6,7 +6,7 @@ pref("startup.homepage_override_url","http://www.tenfourfox.com/start/%LOCALE%/%
|
||||||
pref("startup.homepage_welcome_url","http://www.tenfourfox.com/start/%LOCALE%/%APP%/%VERSION%/firstrun/");
|
pref("startup.homepage_welcome_url","http://www.tenfourfox.com/start/%LOCALE%/%APP%/%VERSION%/firstrun/");
|
||||||
pref("startup.homepage_welcome_url.additional", "");
|
pref("startup.homepage_welcome_url.additional", "");
|
||||||
// The time interval between checks for a new version (in seconds)
|
// The time interval between checks for a new version (in seconds)
|
||||||
pref("app.update.interval", 86400); // 24 hours
|
pref("app.update.interval", 0);
|
||||||
// The time interval between the downloading of mar file chunks in the
|
// The time interval between the downloading of mar file chunks in the
|
||||||
// background (in seconds)
|
// background (in seconds)
|
||||||
pref("app.update.download.backgroundInterval", 60);
|
pref("app.update.download.backgroundInterval", 60);
|
||||||
|
|
|
@ -219,7 +219,8 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let referrer = this.download.source.referrer || this.download.source.url;
|
let referrer = this.download.source.referrer || this.download.source.url;
|
||||||
let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer);
|
//let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer);
|
||||||
|
let [displayHost, fullHost] = DownloadUtils.getURIHost(this.download.source.url);
|
||||||
|
|
||||||
let date = new Date(this.download.endTime);
|
let date = new Date(this.download.endTime);
|
||||||
let [displayDate, fullDate] = DownloadUtils.getReadableDates(date);
|
let [displayDate, fullDate] = DownloadUtils.getReadableDates(date);
|
||||||
|
|
|
@ -834,7 +834,7 @@ BrowserGlue.prototype = {
|
||||||
webrtcUI.init();
|
webrtcUI.init();
|
||||||
AboutHome.init();
|
AboutHome.init();
|
||||||
|
|
||||||
DirectoryLinksProvider.init();
|
//DirectoryLinksProvider.init(); // disabled
|
||||||
NewTabUtils.init();
|
NewTabUtils.init();
|
||||||
NewTabUtils.links.addProvider(DirectoryLinksProvider);
|
NewTabUtils.links.addProvider(DirectoryLinksProvider);
|
||||||
AboutNewTab.init();
|
AboutNewTab.init();
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
const TEST_LIST = "test-track-simple";
|
const BASE_LIST_ID = "base";
|
||||||
|
const CONTENT_LIST_ID = "content";
|
||||||
const TRACK_SUFFIX = "-track-digest256";
|
const TRACK_SUFFIX = "-track-digest256";
|
||||||
const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
|
const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
|
||||||
const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
|
const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
|
||||||
|
@ -132,7 +133,12 @@ var gBlocklistManager = {
|
||||||
shouldProceed = !cancelQuit.data;
|
shouldProceed = !cancelQuit.data;
|
||||||
|
|
||||||
if (shouldProceed) {
|
if (shouldProceed) {
|
||||||
let trackingTable = TEST_LIST + "," + selected.id + TRACK_SUFFIX;
|
let trackingTable = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
|
||||||
|
if (selected.id != CONTENT_LIST_ID) {
|
||||||
|
trackingTable = trackingTable.replace("," + CONTENT_LIST_ID + TRACK_SUFFIX, "");
|
||||||
|
} else {
|
||||||
|
trackingTable += "," + CONTENT_LIST_ID + TRACK_SUFFIX;
|
||||||
|
}
|
||||||
Services.prefs.setCharPref(TRACKING_TABLE_PREF, trackingTable);
|
Services.prefs.setCharPref(TRACKING_TABLE_PREF, trackingTable);
|
||||||
Services.prefs.setCharPref(UPDATE_TIME_PREF, 42);
|
Services.prefs.setCharPref(UPDATE_TIME_PREF, 42);
|
||||||
|
|
||||||
|
@ -193,11 +199,8 @@ var gBlocklistManager = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_getActiveList: function () {
|
_getActiveList: function () {
|
||||||
let activeList = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
|
let trackingTable = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
|
||||||
activeList = activeList.replace(TEST_LIST, "");
|
return trackingTable.includes(CONTENT_LIST_ID) ? CONTENT_LIST_ID : BASE_LIST_ID;
|
||||||
activeList = activeList.replace(",", "");
|
|
||||||
activeList = activeList.replace(TRACK_SUFFIX, "");
|
|
||||||
return activeList.trim();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -99,23 +99,15 @@ var gSecurityPane = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables/disables the Exceptions button used to configure sites where
|
* Enables/disables the Exceptions button used to configure sites where
|
||||||
* passwords are never saved. When browser is set to start in Private
|
* passwords are never saved.
|
||||||
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
|
|
||||||
*/
|
*/
|
||||||
readSavePasswords: function ()
|
readSavePasswords: function ()
|
||||||
{
|
{
|
||||||
var pref = document.getElementById("signon.rememberSignons");
|
var prefValue = document.getElementById("signon.rememberSignons").value;
|
||||||
var excepts = document.getElementById("passwordExceptions");
|
document.getElementById("passwordExceptions").disabled = !prefValue;
|
||||||
|
|
||||||
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
// don't override pref value in UI
|
||||||
document.getElementById("savePasswords").disabled = true;
|
return undefined;
|
||||||
excepts.disabled = true;
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
excepts.disabled = !pref.value;
|
|
||||||
// don't override pref value in UI
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,17 +11,44 @@ var gTenFourFoxPane = {
|
||||||
|
|
||||||
init: function ()
|
init: function ()
|
||||||
{
|
{
|
||||||
function setEventListener(aId, aEventType, aCallback) /* future expansion */
|
function setEventListener(aId, aEventType, aCallback)
|
||||||
{
|
{
|
||||||
document.getElementById(aId)
|
document.getElementById(aId)
|
||||||
.addEventListener(aEventType, aCallback.bind(gTenFourFoxPane));
|
.addEventListener(aEventType, aCallback.bind(gTenFourFoxPane));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setEventListener("historyDontRememberClear", "click", function () {
|
setEventListener("siteSpecificUAs", "command", gTenFourFoxPane.showSSUAs);
|
||||||
gPrivacyPane.clearPrivateDataNow(true);
|
setEventListener("autoReaderView", "command", gTenFourFoxPane.showAutoRV);
|
||||||
return false;
|
|
||||||
}); */
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showSSUAs: function ()
|
||||||
|
{
|
||||||
|
let bundle = document.getElementById("tenFourFoxBundle");
|
||||||
|
let params = { blockVisible : true,
|
||||||
|
sessionVisible : true,
|
||||||
|
allowVisible : true,
|
||||||
|
prefilledHost : "",
|
||||||
|
type : "ssua",
|
||||||
|
windowTitle : bundle.getString("TFFsiteSpecificUAs.title"),
|
||||||
|
introText : bundle.getString("TFFsiteSpecificUAs.prompt") };
|
||||||
|
gSubDialog.open("chrome://browser/content/preferences/tenfourfox-ssua.xul",
|
||||||
|
null, params);
|
||||||
|
},
|
||||||
|
|
||||||
|
showAutoRV: function ()
|
||||||
|
{
|
||||||
|
let bundle = document.getElementById("tenFourFoxBundle");
|
||||||
|
let params = { blockVisible : true,
|
||||||
|
sessionVisible : true,
|
||||||
|
allowVisible : true,
|
||||||
|
prefilledHost : "",
|
||||||
|
type : "autorv",
|
||||||
|
windowTitle : bundle.getString("TFFautoReaderView.title"),
|
||||||
|
introText : bundle.getString("TFFautoReaderView.prompt") };
|
||||||
|
gSubDialog.open("chrome://browser/content/preferences/tenfourfox-autorv.xul",
|
||||||
|
null, params);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
// We have to invert the sense for the pdfjs.disabled pref, since true equals DISabled.
|
// We have to invert the sense for the pdfjs.disabled pref, since true equals DISabled.
|
||||||
|
|
||||||
|
@ -37,17 +64,20 @@ var gTenFourFoxPane = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Find and set the appropriate UA string based on the UA template.
|
// Find and set the appropriate UA string based on the UA template.
|
||||||
|
// Keep in sync with tenfourfox-ssua.xul and tenfourfox.xul
|
||||||
validUA : {
|
validUA : {
|
||||||
"fx" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Firefox/52.0",
|
"fx" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Firefox/52.0",
|
||||||
"fx60" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Firefox/60.0",
|
"fx60" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Firefox/60.0",
|
||||||
"fx68" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Firefox/68.0",
|
"fx68" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Firefox/68.0",
|
||||||
|
"fx78" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0",
|
||||||
|
"fx91" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0",
|
||||||
|
"fx102" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0",
|
||||||
"classilla" : "NokiaN90-1/3.0545.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 (en-US; rv:9.3.3) Clecko/20141026 Classilla/CFM",
|
"classilla" : "NokiaN90-1/3.0545.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 (en-US; rv:9.3.3) Clecko/20141026 Classilla/CFM",
|
||||||
"ie8" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)",
|
"ie8" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)",
|
||||||
"ie11" : "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
"ie11" : "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
||||||
"android" : "Mozilla/5.0 (Linux; Android 8.1.0; Pixel XL Build/OPM1.171019.021) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36",
|
"android" : "Mozilla/5.0 (Linux; Android 8.1.0; Pixel XL Build/OPM1.171019.021) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36",
|
||||||
"ipad" : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0 Mobile/15D100 Safari/604.1"
|
"ipad" : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0 Mobile/15D100 Safari/604.1"
|
||||||
},
|
},
|
||||||
_prefSvc: Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch),
|
|
||||||
readUA: function ()
|
readUA: function ()
|
||||||
{
|
{
|
||||||
var pref = document.getElementById("tenfourfox.ua.template");
|
var pref = document.getElementById("tenfourfox.ua.template");
|
||||||
|
@ -56,7 +86,7 @@ var gTenFourFoxPane = {
|
||||||
// Synchronize the pref on entry in case it's stale.
|
// Synchronize the pref on entry in case it's stale.
|
||||||
pref = pref.value;
|
pref = pref.value;
|
||||||
if (this.validUA[pref]) {
|
if (this.validUA[pref]) {
|
||||||
this._prefSvc.setCharPref("general.useragent.override", this.validUA[pref]);
|
Services.prefs.setCharPref("general.useragent.override", this.validUA[pref]);
|
||||||
return pref;
|
return pref;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -65,10 +95,10 @@ var gTenFourFoxPane = {
|
||||||
{
|
{
|
||||||
var nupref = document.getElementById("uaBox").value;
|
var nupref = document.getElementById("uaBox").value;
|
||||||
if (this.validUA[nupref]) {
|
if (this.validUA[nupref]) {
|
||||||
this._prefSvc.setCharPref("general.useragent.override", this.validUA[nupref]);
|
Services.prefs.setCharPref("general.useragent.override", this.validUA[nupref]);
|
||||||
return nupref;
|
return nupref;
|
||||||
}
|
}
|
||||||
this._prefSvc.clearUserPref("general.useragent.override");
|
Services.prefs.clearUserPref("general.useragent.override");
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
</preferences>
|
</preferences>
|
||||||
|
|
||||||
|
<stringbundle id="tenFourFoxBundle"
|
||||||
|
src="chrome://browser/locale/TenFourFox.properties"/>
|
||||||
|
|
||||||
<hbox id="header-tenfourfox"
|
<hbox id="header-tenfourfox"
|
||||||
class="header"
|
class="header"
|
||||||
hidden="true"
|
hidden="true"
|
||||||
|
@ -63,6 +66,9 @@
|
||||||
preference="tenfourfox.ua.template">
|
preference="tenfourfox.ua.template">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem label="&TFFuserAgent.default;" value=""/>
|
<menuitem label="&TFFuserAgent.default;" value=""/>
|
||||||
|
<menuitem label="Firefox 102ESR (Intel)" value="fx102"/>
|
||||||
|
<menuitem label="Firefox 91ESR (Intel)" value="fx91"/>
|
||||||
|
<menuitem label="Firefox 78ESR (Intel)" value="fx78"/>
|
||||||
<menuitem label="Firefox 68ESR (Intel)" value="fx68"/>
|
<menuitem label="Firefox 68ESR (Intel)" value="fx68"/>
|
||||||
<menuitem label="Firefox 60ESR (Intel)" value="fx60"/>
|
<menuitem label="Firefox 60ESR (Intel)" value="fx60"/>
|
||||||
<menuitem label="Firefox 52ESR (Intel)" value="fx"/>
|
<menuitem label="Firefox 52ESR (Intel)" value="fx"/>
|
||||||
|
@ -73,6 +79,8 @@
|
||||||
<menuitem label="iOS Safari (iPad)" value="ipad"/>
|
<menuitem label="iOS Safari (iPad)" value="ipad"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menulist>
|
</menulist>
|
||||||
|
<spacer flex="1"/>
|
||||||
|
<button id="siteSpecificUAs" label="&TFFsiteSpecificUAs.label;"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
|
@ -84,3 +92,10 @@
|
||||||
preference="tenfourfox.adblock.enabled"/>
|
preference="tenfourfox.adblock.enabled"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
|
<groupbox id="autoRVGroup" data-category="paneTenFourFox" hidden="true">
|
||||||
|
<caption><label>&TFFautoReaderView.title;</label></caption>
|
||||||
|
<hbox>
|
||||||
|
<button id="autoReaderView" label="&TFFautoReaderView.label;"/>
|
||||||
|
</hbox>
|
||||||
|
</groupbox>
|
||||||
|
|
|
@ -24,5 +24,9 @@ browser.jar:
|
||||||
content/browser/preferences/sanitize.js
|
content/browser/preferences/sanitize.js
|
||||||
content/browser/preferences/selectBookmark.xul
|
content/browser/preferences/selectBookmark.xul
|
||||||
content/browser/preferences/selectBookmark.js
|
content/browser/preferences/selectBookmark.js
|
||||||
|
content/browser/preferences/tenfourfox-autorv.xul
|
||||||
|
* content/browser/preferences/tenfourfox-autorv.js
|
||||||
|
content/browser/preferences/tenfourfox-ssua.xul
|
||||||
|
* content/browser/preferences/tenfourfox-ssua.js
|
||||||
content/browser/preferences/translation.xul
|
content/browser/preferences/translation.xul
|
||||||
content/browser/preferences/translation.js
|
content/browser/preferences/translation.js
|
||||||
|
|
344
browser/components/preferences/tenfourfox-autorv.js
Normal file
344
browser/components/preferences/tenfourfox-autorv.js
Normal file
|
@ -0,0 +1,344 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
const AUTORV_PREF_BRANCH = "tenfourfox.reader.auto.";
|
||||||
|
|
||||||
|
function AutoRV(domain, mode)
|
||||||
|
{
|
||||||
|
this.domain = domain;
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
var gTenFourFoxAutoRVManager = {
|
||||||
|
_type : "",
|
||||||
|
_AutoRVs : [],
|
||||||
|
_AutoRVsToAdd : new Map(), // also includes changes, necessarily
|
||||||
|
_AutoRVsToDelete : new Map(),
|
||||||
|
_bundle : null,
|
||||||
|
_pbundle : null,
|
||||||
|
_tree : null,
|
||||||
|
_prefBranch : null,
|
||||||
|
|
||||||
|
_allpText : null,
|
||||||
|
_subpText : null,
|
||||||
|
_modeToString : function(mode) {
|
||||||
|
if (!this._allpText)
|
||||||
|
this._allpText = document.getElementById("rvmodey").label;
|
||||||
|
if (!this._subpText)
|
||||||
|
this._subpText = document.getElementById("rvmodes").label;
|
||||||
|
|
||||||
|
return (mode == "s") ? this._subpText : this._allpText;
|
||||||
|
},
|
||||||
|
|
||||||
|
_view: {
|
||||||
|
_rowCount: 0,
|
||||||
|
get rowCount()
|
||||||
|
{
|
||||||
|
return this._rowCount;
|
||||||
|
},
|
||||||
|
getCellText: function (aRow, aColumn)
|
||||||
|
{
|
||||||
|
if (aColumn.id == "domainCol")
|
||||||
|
return gTenFourFoxAutoRVManager._AutoRVs[aRow].domain;
|
||||||
|
else if (aColumn.id == "modeCol")
|
||||||
|
return gTenFourFoxAutoRVManager._modeToString(gTenFourFoxAutoRVManager._AutoRVs[aRow].mode);
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
|
||||||
|
isSeparator: function(aIndex) { return false; },
|
||||||
|
isSorted: function() { return false; },
|
||||||
|
isContainer: function(aIndex) { return false; },
|
||||||
|
setTree: function(aTree){},
|
||||||
|
getImageSrc: function(aRow, aColumn) {},
|
||||||
|
getProgressMode: function(aRow, aColumn) {},
|
||||||
|
getCellValue: function(aRow, aColumn) {},
|
||||||
|
cycleHeader: function(column) {},
|
||||||
|
getRowProperties: function(row){ return ""; },
|
||||||
|
getColumnProperties: function(column){ return ""; },
|
||||||
|
getCellProperties: function(row,column){
|
||||||
|
if (column.element.getAttribute("id") == "domainCol")
|
||||||
|
return "ltr";
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
addAutoRV: function ()
|
||||||
|
{
|
||||||
|
var textbox = document.getElementById("domain");
|
||||||
|
var input_dom = textbox.value.replace(/^\s*/, ""); // trim any leading space
|
||||||
|
input_dom = input_dom.replace(/\s*$/,"");
|
||||||
|
input_dom = input_dom.replace("http://", "");
|
||||||
|
input_dom = input_dom.replace("https://", "");
|
||||||
|
input_dom = input_dom.replace(/\//g, "");
|
||||||
|
|
||||||
|
var modebox = document.getElementById("mode");
|
||||||
|
var mode = modebox.value;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Block things like hostname:port by making a URL and seeing if it rejects it.
|
||||||
|
let uri = Services.io.newURI("http://"+input_dom+":80/", null, null);
|
||||||
|
if (!uri.host) throw "as if";
|
||||||
|
} catch(ex) {
|
||||||
|
var message = this._pbundle.getString("invalidURI");
|
||||||
|
var title = this._pbundle.getString("invalidURITitle");
|
||||||
|
Services.prompt.alert(window, title, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether the entry already exists, and if not, add it
|
||||||
|
let already = false;
|
||||||
|
for (var i = 0; i < this._AutoRVs.length; ++i) {
|
||||||
|
if (this._AutoRVs[i].domain == input_dom) {
|
||||||
|
already = true;
|
||||||
|
this._AutoRVs[i].mode = mode;
|
||||||
|
this._AutoRVsToAdd.set(input_dom, mode); // can go through same path
|
||||||
|
this._resortAutoRVs();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!already) {
|
||||||
|
this._AutoRVsToAdd.set(input_dom, mode);
|
||||||
|
this._addAutoRVToList(input_dom, mode);
|
||||||
|
++this._view._rowCount;
|
||||||
|
this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, 1);
|
||||||
|
this._resortAutoRVs();
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox.value = "";
|
||||||
|
modebox.value = "";
|
||||||
|
textbox.focus();
|
||||||
|
|
||||||
|
// covers a case where the site exists already, so the buttons don't disable
|
||||||
|
this.onHostInput(textbox);
|
||||||
|
|
||||||
|
// enable "remove all" button as needed
|
||||||
|
document.getElementById("removeAllAutoRVs").disabled = this._AutoRVs.length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_removeAutoRV: function(autorv)
|
||||||
|
{
|
||||||
|
for (let i = 0; i < this._AutoRVs.length; ++i) {
|
||||||
|
if (this._AutoRVs[i].domain == autorv.domain) {
|
||||||
|
this._AutoRVs.splice(i, 1);
|
||||||
|
this._view._rowCount--;
|
||||||
|
this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, -1);
|
||||||
|
this._tree.treeBoxObject.invalidate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this was added during this session, let's remove
|
||||||
|
// it from the pending adds list to prevent extra work.
|
||||||
|
let isnew = this._AutoRVsToAdd.delete(autorv.domain);
|
||||||
|
if (!isnew) {
|
||||||
|
this._AutoRVsToDelete.set(autorv.domain, autorv);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_resortAutoRVs: function()
|
||||||
|
{
|
||||||
|
gTreeUtils.sort(this._tree, this._view, this._AutoRVs,
|
||||||
|
this._lastAutoRVsortColumn,
|
||||||
|
this._AutoRVsComparator,
|
||||||
|
this._lastAutoRVsortColumn,
|
||||||
|
!this._lastAutoRVsortAscending); // keep sort direction
|
||||||
|
this._tree.treeBoxObject.invalidate();
|
||||||
|
},
|
||||||
|
|
||||||
|
onHostInput: function ()
|
||||||
|
{
|
||||||
|
let w = document.getElementById("domain").value;
|
||||||
|
let x = document.getElementById("mode").value;
|
||||||
|
document.getElementById("btnAdd").disabled = !w || !x || !w.length || !x.length
|
||||||
|
|| w.length == 0 || x.length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
onWindowKeyPress: function (aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
|
||||||
|
window.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
onHostKeyPress: function (aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||||
|
document.getElementById("btnAdd").click();
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad: function ()
|
||||||
|
{
|
||||||
|
this._bundle = document.getElementById("tenFourFoxPreferences");
|
||||||
|
this._pbundle = document.getElementById("bundlePreferences");
|
||||||
|
var params = window.arguments[0];
|
||||||
|
this.init(params);
|
||||||
|
},
|
||||||
|
|
||||||
|
init: function (aParams)
|
||||||
|
{
|
||||||
|
if (this._type) {
|
||||||
|
// reusing an open dialog, clear the old observer
|
||||||
|
this.uninit();
|
||||||
|
}
|
||||||
|
this._type = aParams.type;
|
||||||
|
_prefBranch = Services.prefs.getBranch(AUTORV_PREF_BRANCH);
|
||||||
|
|
||||||
|
var AutoRVsText = document.getElementById("autorvText");
|
||||||
|
while (AutoRVsText.hasChildNodes())
|
||||||
|
AutoRVsText.removeChild(AutoRVsText.firstChild);
|
||||||
|
AutoRVsText.appendChild(document.createTextNode(aParams.introText));
|
||||||
|
|
||||||
|
document.title = aParams.windowTitle;
|
||||||
|
|
||||||
|
this.onHostInput();
|
||||||
|
|
||||||
|
let treecols = document.getElementsByTagName("treecols")[0];
|
||||||
|
treecols.addEventListener("click", event => {
|
||||||
|
if (event.target.nodeName != "treecol" || event.button != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sortField = event.target.getAttribute("data-field-name");
|
||||||
|
if (!sortField) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gTenFourFoxAutoRVManager.onAutoRVsort(sortField);
|
||||||
|
});
|
||||||
|
|
||||||
|
this._loadAutoRVs();
|
||||||
|
_prefBranch.addObserver("", this._loadAutoRVs, false); // XXX: make this better
|
||||||
|
|
||||||
|
document.getElementById("domain").focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
uninit: function ()
|
||||||
|
{
|
||||||
|
_prefBranch.removeObserver("", this._loadAutoRVs); // XXX
|
||||||
|
this._type = "";
|
||||||
|
},
|
||||||
|
|
||||||
|
onAutoRVselected: function ()
|
||||||
|
{
|
||||||
|
var hasSelection = this._tree.view.selection.count > 0;
|
||||||
|
var hasRows = this._tree.view.rowCount > 0;
|
||||||
|
document.getElementById("removeAutoRV").disabled = !hasRows || !hasSelection;
|
||||||
|
document.getElementById("removeAllAutoRVs").disabled = !hasRows;
|
||||||
|
},
|
||||||
|
|
||||||
|
onAutoRVDeleted: function ()
|
||||||
|
{
|
||||||
|
if (!this._view.rowCount)
|
||||||
|
return;
|
||||||
|
var removedAutoRVs = [];
|
||||||
|
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._AutoRVs, removedAutoRVs);
|
||||||
|
for (var i = 0; i < removedAutoRVs.length; ++i) {
|
||||||
|
var p = removedAutoRVs[i];
|
||||||
|
this._removeAutoRV(p);
|
||||||
|
}
|
||||||
|
document.getElementById("removeAutoRV").disabled = !this._AutoRVs.length;
|
||||||
|
document.getElementById("removeAllAutoRVs").disabled = !this._AutoRVs.length;
|
||||||
|
},
|
||||||
|
|
||||||
|
onAllAutoRVsDeleted: function ()
|
||||||
|
{
|
||||||
|
if (!this._view.rowCount)
|
||||||
|
return;
|
||||||
|
var removedAutoRVs = [];
|
||||||
|
gTreeUtils.deleteAll(this._tree, this._view, this._AutoRVs, removedAutoRVs);
|
||||||
|
for (var i = 0; i < removedAutoRVs.length; ++i) {
|
||||||
|
var p = removedAutoRVs[i];
|
||||||
|
this._removeAutoRV(p);
|
||||||
|
}
|
||||||
|
document.getElementById("removeAutoRV").disabled = true;
|
||||||
|
document.getElementById("removeAllAutoRVs").disabled = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
onAutoRVKeyPress: function (aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
|| aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
this.onAutoRVDeleted();
|
||||||
|
},
|
||||||
|
|
||||||
|
_lastAutoRVsortColumn: "",
|
||||||
|
_lastAutoRVsortAscending: false,
|
||||||
|
_AutoRVsComparator : function (a, b)
|
||||||
|
{
|
||||||
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
onAutoRVsort: function (aColumn)
|
||||||
|
{
|
||||||
|
this._lastAutoRVsortAscending = gTreeUtils.sort(this._tree,
|
||||||
|
this._view,
|
||||||
|
this._AutoRVs,
|
||||||
|
aColumn,
|
||||||
|
this._AutoRVsComparator,
|
||||||
|
this._lastAutoRVsortColumn,
|
||||||
|
this._lastAutoRVsortAscending);
|
||||||
|
this._lastAutoRVsortColumn = aColumn;
|
||||||
|
},
|
||||||
|
|
||||||
|
onApplyChanges: function()
|
||||||
|
{
|
||||||
|
// Stop observing changes since we are about
|
||||||
|
// to write out the pending adds/deletes and don't need
|
||||||
|
// to update the UI.
|
||||||
|
this.uninit();
|
||||||
|
|
||||||
|
// Create and clear prefs out of whole cloth; don't use the
|
||||||
|
// pref branch because it may not exist yet.
|
||||||
|
for (let i of this._AutoRVsToAdd.keys()) {
|
||||||
|
Services.prefs.setCharPref(AUTORV_PREF_BRANCH+i, this._AutoRVsToAdd.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of this._AutoRVsToDelete.keys()) {
|
||||||
|
Services.prefs.clearUserPref(AUTORV_PREF_BRANCH+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
_loadAutoRVs: function ()
|
||||||
|
{
|
||||||
|
this._tree = document.getElementById("AutoRVsTree");
|
||||||
|
this._AutoRVs = [];
|
||||||
|
|
||||||
|
// load AutoRVs into a table
|
||||||
|
let count = 0;
|
||||||
|
let domains = _prefBranch.getChildList("");
|
||||||
|
for (let domain of domains) {
|
||||||
|
this._addAutoRVToList(domain, _prefBranch.getCharPref(domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._view._rowCount = this._AutoRVs.length;
|
||||||
|
|
||||||
|
// sort and display the table
|
||||||
|
this._tree.view = this._view;
|
||||||
|
this.onAutoRVsort("domain");
|
||||||
|
|
||||||
|
// disable "remove all" button if there are none
|
||||||
|
document.getElementById("removeAllAutoRVs").disabled = this._AutoRVs.length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_addAutoRVToList: function (domain, mode)
|
||||||
|
{
|
||||||
|
var p = new AutoRV(domain, mode);
|
||||||
|
this._AutoRVs.push(p);
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function initWithParams(aParams)
|
||||||
|
{
|
||||||
|
gTenFourFoxAutoRVManager.init(aParams);
|
||||||
|
}
|
111
browser/components/preferences/tenfourfox-autorv.xul
Normal file
111
browser/components/preferences/tenfourfox-autorv.xul
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
|
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
|
||||||
|
|
||||||
|
<!DOCTYPE dialog [
|
||||||
|
<!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd" >
|
||||||
|
<!ENTITY % tenFourFoxDTD SYSTEM "chrome://browser/locale/TenFourFox.dtd" >
|
||||||
|
%permissionsDTD;
|
||||||
|
%tenFourFoxDTD;
|
||||||
|
]>
|
||||||
|
|
||||||
|
<window id="TenFourFoxAutoRVDialog" class="windowDialog"
|
||||||
|
windowtype="Browser:TenFourFoxAutoRV"
|
||||||
|
title="&TFFautoReaderView.title;"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
|
style="width: &window.width;;"
|
||||||
|
onload="gTenFourFoxAutoRVManager.onLoad();"
|
||||||
|
onunload="gTenFourFoxAutoRVManager.uninit();"
|
||||||
|
persist="screenX screenY width height"
|
||||||
|
onkeypress="gTenFourFoxAutoRVManager.onWindowKeyPress(event);">
|
||||||
|
|
||||||
|
<script src="chrome://global/content/treeUtils.js"/>
|
||||||
|
<script src="chrome://browser/content/preferences/tenfourfox-autorv.js"/>
|
||||||
|
<script src="chrome://browser/content/preferences/in-content/tenfourfox.js"/>
|
||||||
|
|
||||||
|
<stringbundle id="bundlePreferences"
|
||||||
|
src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||||
|
<stringbundle id="tenFourFoxPreferences"
|
||||||
|
src="chrome://browser/locale/TenFourFox.properties"/>
|
||||||
|
<keyset>
|
||||||
|
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
|
||||||
|
</keyset>
|
||||||
|
|
||||||
|
<vbox class="contentPane largeDialogContainer" flex="1">
|
||||||
|
<description id="autorvText" control="domain"/>
|
||||||
|
<separator class="thin"/>
|
||||||
|
<grid>
|
||||||
|
<columns>
|
||||||
|
<column/>
|
||||||
|
<column flex="1"/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row align="baseline">
|
||||||
|
<hbox pack="end">
|
||||||
|
<label id="domainLabel" control="domain"
|
||||||
|
value="&TFFsiteSpecificUAs.domain.l;" accesskey="&address.accesskey;"/>
|
||||||
|
</hbox>
|
||||||
|
<textbox id="domain" flex="1"
|
||||||
|
oninput="gTenFourFoxAutoRVManager.onHostInput();"
|
||||||
|
onkeypress="gTenFourFoxAutoRVManager.onHostKeyPress(event);"/>
|
||||||
|
</row>
|
||||||
|
<row align="baseline">
|
||||||
|
<hbox pack="end">
|
||||||
|
<label>&TFFautoReaderView.mode.l;</label>
|
||||||
|
</hbox>
|
||||||
|
<menulist id="mode" crop="end" flex="1"
|
||||||
|
oncommand="gTenFourFoxAutoRVManager.onHostInput();">
|
||||||
|
<menupopup>
|
||||||
|
<menuitem label="" value=""/>
|
||||||
|
<menuitem label="&TFFautoReaderView.mode.all;" value="y" id="rvmodey"/>
|
||||||
|
<menuitem label="&TFFautoReaderView.mode.sub;" value="s" id="rvmodes"/>
|
||||||
|
</menupopup>
|
||||||
|
</menulist>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<hbox pack="end">
|
||||||
|
<button id="btnAdd" disabled="true" label="&TFFsiteSpecificUAs.add;" default="true" accesskey="&allow.accesskey;"
|
||||||
|
oncommand="gTenFourFoxAutoRVManager.addAutoRV();"/>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
|
<separator class="thin"/>
|
||||||
|
<tree id="AutoRVsTree" flex="1" style="height: 18em;"
|
||||||
|
hidecolumnpicker="true"
|
||||||
|
onkeypress="gTenFourFoxAutoRVManager.onAutoRVKeyPress(event)"
|
||||||
|
onselect="gTenFourFoxAutoRVManager.onAutoRVselected();">
|
||||||
|
<treecols>
|
||||||
|
<treecol id="domainCol" label="&TFFsiteSpecificUAs.domain;" flex="2"
|
||||||
|
data-field-name="domain" persist="width"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol id="modeCol" label="&TFFautoReaderView.mode;" flex="1"
|
||||||
|
data-field-name="mode" persist="width"/>
|
||||||
|
</treecols>
|
||||||
|
<treechildren/>
|
||||||
|
</tree>
|
||||||
|
|
||||||
|
<hbox class="actionButtons" align="left" flex="1">
|
||||||
|
<button id="removeAutoRV" disabled="true"
|
||||||
|
accesskey="&removepermission.accesskey;"
|
||||||
|
icon="remove" label="&removepermission.label;"
|
||||||
|
oncommand="gTenFourFoxAutoRVManager.onAutoRVDeleted();"/>
|
||||||
|
<button id="removeAllAutoRVs" disabled="true"
|
||||||
|
icon="clear" label="&removeallpermissions.label;"
|
||||||
|
accesskey="&removeallpermissions.accesskey;"
|
||||||
|
oncommand="gTenFourFoxAutoRVManager.onAllAutoRVsDeleted();"/>
|
||||||
|
</hbox>
|
||||||
|
<spacer flex="1"/>
|
||||||
|
<hbox class="actionButtons" align="right" flex="1">
|
||||||
|
<button oncommand="close();" icon="close"
|
||||||
|
label="&button.cancel.label;" accesskey="&button.cancel.accesskey;" />
|
||||||
|
<button id="btnApplyChanges" oncommand="gTenFourFoxAutoRVManager.onApplyChanges();" icon="save"
|
||||||
|
label="&button.ok.label;" accesskey="&button.ok.accesskey;"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
</window>
|
343
browser/components/preferences/tenfourfox-ssua.js
Normal file
343
browser/components/preferences/tenfourfox-ssua.js
Normal file
|
@ -0,0 +1,343 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
const UA_PREF_BRANCH = "general.useragent.override.";
|
||||||
|
|
||||||
|
function SSUA(domain, ua)
|
||||||
|
{
|
||||||
|
this.domain = domain;
|
||||||
|
this.ua = ua;
|
||||||
|
}
|
||||||
|
|
||||||
|
var gTenFourFoxSSUAManager = {
|
||||||
|
_type : "",
|
||||||
|
_SSUAs : [],
|
||||||
|
_SSUAsToAdd : new Map(), // also includes changes, necessarily
|
||||||
|
_SSUAsToDelete : new Map(),
|
||||||
|
_bundle : null,
|
||||||
|
_pbundle : null,
|
||||||
|
_tree : null,
|
||||||
|
_prefBranch : null,
|
||||||
|
|
||||||
|
_view: {
|
||||||
|
_rowCount: 0,
|
||||||
|
get rowCount()
|
||||||
|
{
|
||||||
|
return this._rowCount;
|
||||||
|
},
|
||||||
|
getCellText: function (aRow, aColumn)
|
||||||
|
{
|
||||||
|
if (aColumn.id == "domainCol")
|
||||||
|
return gTenFourFoxSSUAManager._SSUAs[aRow].domain;
|
||||||
|
else if (aColumn.id == "uaCol")
|
||||||
|
return gTenFourFoxSSUAManager._SSUAs[aRow].ua;
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
|
||||||
|
isSeparator: function(aIndex) { return false; },
|
||||||
|
isSorted: function() { return false; },
|
||||||
|
isContainer: function(aIndex) { return false; },
|
||||||
|
setTree: function(aTree){},
|
||||||
|
getImageSrc: function(aRow, aColumn) {},
|
||||||
|
getProgressMode: function(aRow, aColumn) {},
|
||||||
|
getCellValue: function(aRow, aColumn) {},
|
||||||
|
cycleHeader: function(column) {},
|
||||||
|
getRowProperties: function(row){ return ""; },
|
||||||
|
getColumnProperties: function(column){ return ""; },
|
||||||
|
getCellProperties: function(row,column){
|
||||||
|
if (column.element.getAttribute("id") == "domainCol")
|
||||||
|
return "ltr";
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
addSSUA: function ()
|
||||||
|
{
|
||||||
|
var textbox = document.getElementById("domain");
|
||||||
|
var uabox = document.getElementById("ua");
|
||||||
|
var input_dom = textbox.value.replace(/^\s*/, ""); // trim any leading space
|
||||||
|
input_dom = input_dom.replace(/\s*$/,"");
|
||||||
|
input_dom = input_dom.replace("http://", "");
|
||||||
|
input_dom = input_dom.replace("https://", "");
|
||||||
|
input_dom = input_dom.replace(/\//g, "");
|
||||||
|
|
||||||
|
var ua = uabox.value.replace(/^\s*/, "");
|
||||||
|
ua = ua.replace(/\s*$/, "");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Block things like hostname:port by making a URL and seeing if it rejects it.
|
||||||
|
let uri = Services.io.newURI("http://"+input_dom+":80/", null, null);
|
||||||
|
if (!uri.host) throw "as if";
|
||||||
|
} catch(ex) {
|
||||||
|
var message = this._pbundle.getString("invalidURI");
|
||||||
|
var title = this._pbundle.getString("invalidURITitle");
|
||||||
|
Services.prompt.alert(window, title, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether the entry already exists, and if not, add it
|
||||||
|
let already = false;
|
||||||
|
for (var i = 0; i < this._SSUAs.length; ++i) {
|
||||||
|
if (this._SSUAs[i].domain == input_dom) {
|
||||||
|
already = true;
|
||||||
|
this._SSUAs[i].ua = ua;
|
||||||
|
this._SSUAsToAdd.set(input_dom, ua); // can go through same path
|
||||||
|
this._resortSSUAs();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!already) {
|
||||||
|
this._SSUAsToAdd.set(input_dom, ua);
|
||||||
|
this._addSSUAToList(input_dom, ua);
|
||||||
|
++this._view._rowCount;
|
||||||
|
this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, 1);
|
||||||
|
this._resortSSUAs();
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox.value = "";
|
||||||
|
uabox.value = "";
|
||||||
|
textbox.focus();
|
||||||
|
|
||||||
|
// covers a case where the site exists already, so the buttons don't disable
|
||||||
|
this.onHostInput(textbox);
|
||||||
|
|
||||||
|
// enable "remove all" button as needed
|
||||||
|
document.getElementById("removeAllSSUAs").disabled = this._SSUAs.length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_removeSSUA: function(ssua)
|
||||||
|
{
|
||||||
|
for (let i = 0; i < this._SSUAs.length; ++i) {
|
||||||
|
if (this._SSUAs[i].domain == ssua.domain) {
|
||||||
|
this._SSUAs.splice(i, 1);
|
||||||
|
this._view._rowCount--;
|
||||||
|
this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, -1);
|
||||||
|
this._tree.treeBoxObject.invalidate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this was added during this session, let's remove
|
||||||
|
// it from the pending adds list to prevent extra work.
|
||||||
|
let isnew = this._SSUAsToAdd.delete(ssua.domain);
|
||||||
|
if (!isnew) {
|
||||||
|
this._SSUAsToDelete.set(ssua.domain, ssua);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_resortSSUAs: function()
|
||||||
|
{
|
||||||
|
gTreeUtils.sort(this._tree, this._view, this._SSUAs,
|
||||||
|
this._lastSSUAsortColumn,
|
||||||
|
this._SSUAsComparator,
|
||||||
|
this._lastSSUAsortColumn,
|
||||||
|
!this._lastSSUAsortAscending); // keep sort direction
|
||||||
|
this._tree.treeBoxObject.invalidate();
|
||||||
|
},
|
||||||
|
|
||||||
|
onHostInput: function ()
|
||||||
|
{
|
||||||
|
let w = document.getElementById("domain").value;
|
||||||
|
let x = document.getElementById("ua").value;
|
||||||
|
document.getElementById("btnAdd").disabled = !w || !x || !w.length || !x.length
|
||||||
|
|| w.length == 0 || x.length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
onWindowKeyPress: function (aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
|
||||||
|
window.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
onHostKeyPress: function (aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||||
|
document.getElementById("btnAdd").click();
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad: function ()
|
||||||
|
{
|
||||||
|
this._bundle = document.getElementById("tenFourFoxPreferences");
|
||||||
|
this._pbundle = document.getElementById("bundlePreferences");
|
||||||
|
var params = window.arguments[0];
|
||||||
|
this.init(params);
|
||||||
|
},
|
||||||
|
|
||||||
|
init: function (aParams)
|
||||||
|
{
|
||||||
|
if (this._type) {
|
||||||
|
// reusing an open dialog, clear the old observer
|
||||||
|
this.uninit();
|
||||||
|
}
|
||||||
|
this._type = aParams.type;
|
||||||
|
_prefBranch = Services.prefs.getBranch(UA_PREF_BRANCH);
|
||||||
|
|
||||||
|
var SSUAsText = document.getElementById("ssuaText");
|
||||||
|
while (SSUAsText.hasChildNodes())
|
||||||
|
SSUAsText.removeChild(SSUAsText.firstChild);
|
||||||
|
SSUAsText.appendChild(document.createTextNode(aParams.introText));
|
||||||
|
|
||||||
|
document.title = aParams.windowTitle;
|
||||||
|
|
||||||
|
this.onHostInput();
|
||||||
|
|
||||||
|
let treecols = document.getElementsByTagName("treecols")[0];
|
||||||
|
treecols.addEventListener("click", event => {
|
||||||
|
if (event.target.nodeName != "treecol" || event.button != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sortField = event.target.getAttribute("data-field-name");
|
||||||
|
if (!sortField) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gTenFourFoxSSUAManager.onSSUAsort(sortField);
|
||||||
|
});
|
||||||
|
|
||||||
|
this._loadSSUAs();
|
||||||
|
_prefBranch.addObserver("", this._loadSSUAs, false); // XXX: make this better
|
||||||
|
|
||||||
|
document.getElementById("domain").focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
uninit: function ()
|
||||||
|
{
|
||||||
|
_prefBranch.removeObserver("", this._loadSSUAs); // XXX
|
||||||
|
this._type = "";
|
||||||
|
},
|
||||||
|
|
||||||
|
onSSUAselected: function ()
|
||||||
|
{
|
||||||
|
var hasSelection = this._tree.view.selection.count > 0;
|
||||||
|
var hasRows = this._tree.view.rowCount > 0;
|
||||||
|
document.getElementById("removeSSUA").disabled = !hasRows || !hasSelection;
|
||||||
|
document.getElementById("removeAllSSUAs").disabled = !hasRows;
|
||||||
|
},
|
||||||
|
|
||||||
|
onSSUADeleted: function ()
|
||||||
|
{
|
||||||
|
if (!this._view.rowCount)
|
||||||
|
return;
|
||||||
|
var removedSSUAs = [];
|
||||||
|
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._SSUAs, removedSSUAs);
|
||||||
|
for (var i = 0; i < removedSSUAs.length; ++i) {
|
||||||
|
var p = removedSSUAs[i];
|
||||||
|
this._removeSSUA(p);
|
||||||
|
}
|
||||||
|
document.getElementById("removeSSUA").disabled = !this._SSUAs.length;
|
||||||
|
document.getElementById("removeAllSSUAs").disabled = !this._SSUAs.length;
|
||||||
|
},
|
||||||
|
|
||||||
|
onAllSSUAsDeleted: function ()
|
||||||
|
{
|
||||||
|
if (!this._view.rowCount)
|
||||||
|
return;
|
||||||
|
var removedSSUAs = [];
|
||||||
|
gTreeUtils.deleteAll(this._tree, this._view, this._SSUAs, removedSSUAs);
|
||||||
|
for (var i = 0; i < removedSSUAs.length; ++i) {
|
||||||
|
var p = removedSSUAs[i];
|
||||||
|
this._removeSSUA(p);
|
||||||
|
}
|
||||||
|
document.getElementById("removeSSUA").disabled = true;
|
||||||
|
document.getElementById("removeAllSSUAs").disabled = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
onSSUAKeyPress: function (aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
|| aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
this.onSSUADeleted();
|
||||||
|
},
|
||||||
|
|
||||||
|
_lastSSUAsortColumn: "",
|
||||||
|
_lastSSUAsortAscending: false,
|
||||||
|
_SSUAsComparator : function (a, b)
|
||||||
|
{
|
||||||
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
onSSUAsort: function (aColumn)
|
||||||
|
{
|
||||||
|
this._lastSSUAsortAscending = gTreeUtils.sort(this._tree,
|
||||||
|
this._view,
|
||||||
|
this._SSUAs,
|
||||||
|
aColumn,
|
||||||
|
this._SSUAsComparator,
|
||||||
|
this._lastSSUAsortColumn,
|
||||||
|
this._lastSSUAsortAscending);
|
||||||
|
this._lastSSUAsortColumn = aColumn;
|
||||||
|
},
|
||||||
|
|
||||||
|
onApplyChanges: function()
|
||||||
|
{
|
||||||
|
// Stop observing changes since we are about
|
||||||
|
// to write out the pending adds/deletes and don't need
|
||||||
|
// to update the UI.
|
||||||
|
this.uninit();
|
||||||
|
|
||||||
|
// Create and clear prefs out of whole cloth; don't use the
|
||||||
|
// pref branch because it may not exist yet.
|
||||||
|
for (let i of this._SSUAsToAdd.keys()) {
|
||||||
|
Services.prefs.setCharPref(UA_PREF_BRANCH+i, this._SSUAsToAdd.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of this._SSUAsToDelete.keys()) {
|
||||||
|
Services.prefs.clearUserPref(UA_PREF_BRANCH+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
fillUA: function(popup)
|
||||||
|
{
|
||||||
|
if (popup.value == "")
|
||||||
|
document.getElementById("ua").value = "";
|
||||||
|
else
|
||||||
|
document.getElementById("ua").value = gTenFourFoxPane.validUA[popup.value];
|
||||||
|
this.onHostInput();
|
||||||
|
},
|
||||||
|
|
||||||
|
_loadSSUAs: function ()
|
||||||
|
{
|
||||||
|
this._tree = document.getElementById("SSUAsTree");
|
||||||
|
this._SSUAs = [];
|
||||||
|
|
||||||
|
// load SSUAs into a table
|
||||||
|
let count = 0;
|
||||||
|
let domains = _prefBranch.getChildList("");
|
||||||
|
for (let domain of domains) {
|
||||||
|
this._addSSUAToList(domain, _prefBranch.getCharPref(domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._view._rowCount = this._SSUAs.length;
|
||||||
|
|
||||||
|
// sort and display the table
|
||||||
|
this._tree.view = this._view;
|
||||||
|
this.onSSUAsort("domain");
|
||||||
|
|
||||||
|
// disable "remove all" button if there are none
|
||||||
|
document.getElementById("removeAllSSUAs").disabled = this._SSUAs.length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_addSSUAToList: function (domain, ua)
|
||||||
|
{
|
||||||
|
var p = new SSUA(domain, ua);
|
||||||
|
this._SSUAs.push(p);
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function initWithParams(aParams)
|
||||||
|
{
|
||||||
|
gTenFourFoxSSUAManager.init(aParams);
|
||||||
|
}
|
128
browser/components/preferences/tenfourfox-ssua.xul
Normal file
128
browser/components/preferences/tenfourfox-ssua.xul
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
|
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
|
||||||
|
|
||||||
|
<!DOCTYPE dialog [
|
||||||
|
<!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd" >
|
||||||
|
<!ENTITY % tenFourFoxDTD SYSTEM "chrome://browser/locale/TenFourFox.dtd" >
|
||||||
|
%permissionsDTD;
|
||||||
|
%tenFourFoxDTD;
|
||||||
|
]>
|
||||||
|
|
||||||
|
<window id="TenFourFoxSSUADialog" class="windowDialog"
|
||||||
|
windowtype="Browser:TenFourFoxSSUA"
|
||||||
|
title="&TFFsiteSpecificUAs.title;"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
|
style="width: &window.width;;"
|
||||||
|
onload="gTenFourFoxSSUAManager.onLoad();"
|
||||||
|
onunload="gTenFourFoxSSUAManager.uninit();"
|
||||||
|
persist="screenX screenY width height"
|
||||||
|
onkeypress="gTenFourFoxSSUAManager.onWindowKeyPress(event);">
|
||||||
|
|
||||||
|
<script src="chrome://global/content/treeUtils.js"/>
|
||||||
|
<script src="chrome://browser/content/preferences/tenfourfox-ssua.js"/>
|
||||||
|
<script src="chrome://browser/content/preferences/in-content/tenfourfox.js"/>
|
||||||
|
|
||||||
|
<stringbundle id="bundlePreferences"
|
||||||
|
src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||||
|
<stringbundle id="tenFourFoxPreferences"
|
||||||
|
src="chrome://browser/locale/TenFourFox.properties"/>
|
||||||
|
<keyset>
|
||||||
|
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
|
||||||
|
</keyset>
|
||||||
|
|
||||||
|
<vbox class="contentPane largeDialogContainer" flex="1">
|
||||||
|
<description id="ssuaText" control="domain"/>
|
||||||
|
<separator class="thin"/>
|
||||||
|
<grid>
|
||||||
|
<columns>
|
||||||
|
<column/>
|
||||||
|
<column flex="1"/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row align="baseline">
|
||||||
|
<hbox pack="end">
|
||||||
|
<label id="domainLabel" control="domain"
|
||||||
|
value="&TFFsiteSpecificUAs.domain.l;" accesskey="&address.accesskey;"/>
|
||||||
|
</hbox>
|
||||||
|
<textbox id="domain" flex="1"
|
||||||
|
oninput="gTenFourFoxSSUAManager.onHostInput();"
|
||||||
|
onkeypress="gTenFourFoxSSUAManager.onHostKeyPress(event);"/>
|
||||||
|
</row>
|
||||||
|
<row align="baseline">
|
||||||
|
<hbox pack="end">
|
||||||
|
<label>&TFFsiteSpecificUAs.preua;</label>
|
||||||
|
</hbox>
|
||||||
|
<menulist id="uaBox" crop="end" flex="1"
|
||||||
|
oncommand="gTenFourFoxSSUAManager.fillUA(event.target);">
|
||||||
|
<menupopup>
|
||||||
|
<menuitem label="" value=""/>
|
||||||
|
<menuitem label="Firefox 102ESR (Intel)" value="fx102"/>
|
||||||
|
<menuitem label="Firefox 91ESR (Intel)" value="fx91"/>
|
||||||
|
<menuitem label="Firefox 78ESR (Intel)" value="fx78"/>
|
||||||
|
<menuitem label="Firefox 68ESR (Intel)" value="fx68"/>
|
||||||
|
<menuitem label="Firefox 60ESR (Intel)" value="fx60"/>
|
||||||
|
<menuitem label="Firefox 52ESR (Intel)" value="fx"/>
|
||||||
|
<menuitem label="Classilla 9.3.x" value="classilla"/>
|
||||||
|
<menuitem label="Internet Explorer 8" value="ie8"/>
|
||||||
|
<menuitem label="Internet Explorer 11" value="ie11"/>
|
||||||
|
<menuitem label="Android Chrome" value="android"/>
|
||||||
|
<menuitem label="iOS Safari (iPad)" value="ipad"/>
|
||||||
|
</menupopup>
|
||||||
|
</menulist>
|
||||||
|
</row>
|
||||||
|
<row align="baseline">
|
||||||
|
<hbox pack="end">
|
||||||
|
<label id="uaLabel" control="ua" value="&TFFsiteSpecificUAs.ua.l;"/>
|
||||||
|
</hbox>
|
||||||
|
<textbox id="ua" flex="1"
|
||||||
|
oninput="gTenFourFoxSSUAManager.onHostInput();"
|
||||||
|
onkeypress="gTenFourFoxSSUAManager.onHostKeyPress(event);"/>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<hbox pack="end">
|
||||||
|
<button id="btnAdd" disabled="true" label="&TFFsiteSpecificUAs.add;" default="true" accesskey="&allow.accesskey;"
|
||||||
|
oncommand="gTenFourFoxSSUAManager.addSSUA();"/>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
|
<separator class="thin"/>
|
||||||
|
<tree id="SSUAsTree" flex="1" style="height: 18em;"
|
||||||
|
hidecolumnpicker="true"
|
||||||
|
onkeypress="gTenFourFoxSSUAManager.onSSUAKeyPress(event)"
|
||||||
|
onselect="gTenFourFoxSSUAManager.onSSUAselected();">
|
||||||
|
<treecols>
|
||||||
|
<treecol id="domainCol" label="&TFFsiteSpecificUAs.domain;" flex="1"
|
||||||
|
data-field-name="domain" persist="width"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol id="uaCol" label="&TFFsiteSpecificUAs.ua;" flex="3"
|
||||||
|
data-field-name="ua" persist="width"/>
|
||||||
|
</treecols>
|
||||||
|
<treechildren/>
|
||||||
|
</tree>
|
||||||
|
|
||||||
|
<hbox class="actionButtons" align="left" flex="1">
|
||||||
|
<button id="removeSSUA" disabled="true"
|
||||||
|
accesskey="&removepermission.accesskey;"
|
||||||
|
icon="remove" label="&removepermission.label;"
|
||||||
|
oncommand="gTenFourFoxSSUAManager.onSSUADeleted();"/>
|
||||||
|
<button id="removeAllSSUAs" disabled="true"
|
||||||
|
icon="clear" label="&removeallpermissions.label;"
|
||||||
|
accesskey="&removeallpermissions.accesskey;"
|
||||||
|
oncommand="gTenFourFoxSSUAManager.onAllSSUAsDeleted();"/>
|
||||||
|
</hbox>
|
||||||
|
<spacer flex="1"/>
|
||||||
|
<hbox class="actionButtons" align="right" flex="1">
|
||||||
|
<button oncommand="close();" icon="close"
|
||||||
|
label="&button.cancel.label;" accesskey="&button.cancel.accesskey;" />
|
||||||
|
<button id="btnApplyChanges" oncommand="gTenFourFoxSSUAManager.onApplyChanges();" icon="save"
|
||||||
|
label="&button.ok.label;" accesskey="&button.ok.accesskey;"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
</window>
|
|
@ -1 +1 @@
|
||||||
45.28.0
|
45.41.6
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Feature Parity Release 19
|
Rolling Release
|
||||||
|
|
|
@ -362,7 +362,7 @@ ChromeActions.prototype = {
|
||||||
supportsDocumentFonts: function() {
|
supportsDocumentFonts: function() {
|
||||||
var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
|
var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
|
||||||
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
|
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
|
||||||
return (!!prefBrowser && prefGfx);
|
return (!!prefBrowser && prefGfx && getBoolPref('pdfjs.display.use_document_fonts', true));
|
||||||
},
|
},
|
||||||
supportsDocumentColors: function() {
|
supportsDocumentColors: function() {
|
||||||
if (getIntPref('browser.display.document_color_use', 0) === 2 ||
|
if (getIntPref('browser.display.document_color_use', 0) === 2 ||
|
||||||
|
|
|
@ -104,6 +104,7 @@ var NetworkManager = (function NetworkManagerClosure() {
|
||||||
var rangeStr = args.begin + '-' + (args.end - 1);
|
var rangeStr = args.begin + '-' + (args.end - 1);
|
||||||
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
||||||
pendingRequest.expectedStatus = 206;
|
pendingRequest.expectedStatus = 206;
|
||||||
|
xhr.channel.QueryInterface(Ci.nsIHttpChannel).redirectionLimit = 0;
|
||||||
} else {
|
} else {
|
||||||
pendingRequest.expectedStatus = 200;
|
pendingRequest.expectedStatus = 200;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,3 +11,20 @@
|
||||||
|
|
||||||
<!ENTITY TFFmseMode.title "MediaSource">
|
<!ENTITY TFFmseMode.title "MediaSource">
|
||||||
<!ENTITY TFFmseMode.prompt "Enable MSE/media quality options (slower, if available)">
|
<!ENTITY TFFmseMode.prompt "Enable MSE/media quality options (slower, if available)">
|
||||||
|
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.label "Site Specific…">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.title "Site Specific User Agents">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.add "Add">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.domain "Domain">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.domain.l "Domain:">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.ua "User agent">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.ua.l "User agent string:">
|
||||||
|
<!ENTITY TFFsiteSpecificUAs.preua "Common user agents:">
|
||||||
|
|
||||||
|
<!ENTITY TFFautoReaderView.label "Auto Reader View…">
|
||||||
|
<!ENTITY TFFautoReaderView.title "Site Specific Auto Reader View">
|
||||||
|
<!-- also uses domain and add from above -->
|
||||||
|
<!ENTITY TFFautoReaderView.mode "Mode">
|
||||||
|
<!ENTITY TFFautoReaderView.mode.l "Mode:">
|
||||||
|
<!ENTITY TFFautoReaderView.mode.all "All pages">
|
||||||
|
<!ENTITY TFFautoReaderView.mode.sub "Only subpages">
|
||||||
|
|
|
@ -12,3 +12,8 @@ TFFpdfViewMode.prompt.p = Use built-in PDF viewer (slower but safer)
|
||||||
TFFmseMode.title.p = MediaSource
|
TFFmseMode.title.p = MediaSource
|
||||||
TFFmseMode.prompt.p = Enable MSE/media quality options (slower, if available)
|
TFFmseMode.prompt.p = Enable MSE/media quality options (slower, if available)
|
||||||
|
|
||||||
|
TFFsiteSpecificUAs.title = Site Specific User Agents
|
||||||
|
TFFsiteSpecificUAs.prompt = This is for advanced users to use a custom user agent for particular domains automatically. Enter a domain and a user agent string, or select a predefined one.
|
||||||
|
|
||||||
|
TFFautoReaderView.title = Site Specific Auto Reader View
|
||||||
|
TFFautoReaderView.prompt = Enter domain names that will automatically switch to the simpler Reader View for all pages, or for subpages only.
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<!ENTITY helpus.getInvolvedLink "get involved!">
|
<!ENTITY helpus.getInvolvedLink "get involved!">
|
||||||
<!ENTITY helpus.end "">
|
<!ENTITY helpus.end "">
|
||||||
|
|
||||||
<!ENTITY copyright.blurb "Copyright © 2010-2020 Contributors to TenFourFox. All rights reserved.">
|
<!ENTITY copyright.blurb "Copyright © 2010-2023 Contributors to TenFourFox. All rights reserved.">
|
||||||
|
|
||||||
<!-- LOCALIZATION NOTE (bottomLinks.license): This is a link title that links to about:license. -->
|
<!-- LOCALIZATION NOTE (bottomLinks.license): This is a link title that links to about:license. -->
|
||||||
<!ENTITY bottomLinks.license "Licensing Information">
|
<!ENTITY bottomLinks.license "Licensing Information">
|
||||||
|
|
|
@ -105,6 +105,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
||||||
<!ENTITY fullScreenCmd.macCommandKey "f">
|
<!ENTITY fullScreenCmd.macCommandKey "f">
|
||||||
<!ENTITY showAllTabsCmd.label "Show All Tabs">
|
<!ENTITY showAllTabsCmd.label "Show All Tabs">
|
||||||
<!ENTITY showAllTabsCmd.accesskey "A">
|
<!ENTITY showAllTabsCmd.accesskey "A">
|
||||||
|
<!ENTITY toggleReaderMode.label "Toggle Reader Mode">
|
||||||
|
<!ENTITY toggleReaderMode.key "R">
|
||||||
|
|
||||||
<!ENTITY fxaSignIn.label "Sign in to &syncBrand.shortName.label;">
|
<!ENTITY fxaSignIn.label "Sign in to &syncBrand.shortName.label;">
|
||||||
<!ENTITY fxaSignedIn.tooltip "Open &syncBrand.shortName.label; preferences">
|
<!ENTITY fxaSignedIn.tooltip "Open &syncBrand.shortName.label; preferences">
|
||||||
|
@ -255,6 +257,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
||||||
<!ENTITY loopMenuItem.label "Start a conversation…">
|
<!ENTITY loopMenuItem.label "Start a conversation…">
|
||||||
<!ENTITY loopMenuItem.accesskey "t">
|
<!ENTITY loopMenuItem.accesskey "t">
|
||||||
|
|
||||||
|
<!ENTITY JavascriptToggleCmd.label "Enable JavaScript">
|
||||||
|
|
||||||
<!ENTITY webDeveloperMenu.label "Web Developer">
|
<!ENTITY webDeveloperMenu.label "Web Developer">
|
||||||
<!ENTITY webDeveloperMenu.accesskey "W">
|
<!ENTITY webDeveloperMenu.accesskey "W">
|
||||||
|
|
||||||
|
@ -631,17 +635,19 @@ items are mutually exclusive. -->
|
||||||
<!ENTITY mediaUnmute.accesskey "m">
|
<!ENTITY mediaUnmute.accesskey "m">
|
||||||
<!ENTITY mediaPlaybackRate.label "Play Speed">
|
<!ENTITY mediaPlaybackRate.label "Play Speed">
|
||||||
<!ENTITY mediaPlaybackRate.accesskey "l">
|
<!ENTITY mediaPlaybackRate.accesskey "l">
|
||||||
<!ENTITY mediaPlaybackRate050x.label "Slow Motion (0.5×)">
|
<!ENTITY mediaPlaybackRate050x2.label "Slow (0.5×)">
|
||||||
<!ENTITY mediaPlaybackRate050x.accesskey "S">
|
<!ENTITY mediaPlaybackRate050x2.accesskey "S">
|
||||||
<!ENTITY mediaPlaybackRate100x.label "Normal Speed">
|
<!ENTITY mediaPlaybackRate100x2.label "Normal">
|
||||||
<!ENTITY mediaPlaybackRate100x.accesskey "N">
|
<!ENTITY mediaPlaybackRate100x2.accesskey "N">
|
||||||
<!ENTITY mediaPlaybackRate150x.label "High Speed (1.5×)">
|
<!ENTITY mediaPlaybackRate125x2.label "Fast (1.25×)">
|
||||||
<!ENTITY mediaPlaybackRate150x.accesskey "H">
|
<!ENTITY mediaPlaybackRate125x2.accesskey "F">
|
||||||
<!-- LOCALIZATION NOTE: "Ludicrous Speed" is a reference to the
|
<!ENTITY mediaPlaybackRate150x2.label "Faster (1.5×)">
|
||||||
|
<!ENTITY mediaPlaybackRate150x2.accesskey "a">
|
||||||
|
<!-- LOCALIZATION NOTE: "Ludicrous" is a reference to the
|
||||||
movie "Space Balls" and is meant to say that this speed is very
|
movie "Space Balls" and is meant to say that this speed is very
|
||||||
fast. -->
|
fast. -->
|
||||||
<!ENTITY mediaPlaybackRate200x.label "Ludicrous Speed (2×)">
|
<!ENTITY mediaPlaybackRate200x2.label "Ludicrous (2×)">
|
||||||
<!ENTITY mediaPlaybackRate200x.accesskey "L">
|
<!ENTITY mediaPlaybackRate200x2.accesskey "L">
|
||||||
<!-- LOCALIZATION NOTE: The access keys for "Show Controls" and
|
<!-- LOCALIZATION NOTE: The access keys for "Show Controls" and
|
||||||
"Hide Controls" are the same because the two context-menu
|
"Hide Controls" are the same because the two context-menu
|
||||||
items are mutually exclusive. -->
|
items are mutually exclusive. -->
|
||||||
|
|
|
@ -291,6 +291,10 @@ tabHistory.goForward=Go forward to this page
|
||||||
# URL Bar
|
# URL Bar
|
||||||
pasteAndGo.label=Paste & Go
|
pasteAndGo.label=Paste & Go
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (reader-mode-button.tooltip):
|
||||||
|
# %S is the keyboard shortcut for entering/exiting reader view
|
||||||
|
reader-mode-button.tooltip=Toggle Reader View (%S)
|
||||||
|
|
||||||
# Block autorefresh
|
# Block autorefresh
|
||||||
refreshBlocked.goButton=Allow
|
refreshBlocked.goButton=Allow
|
||||||
refreshBlocked.goButton.accesskey=A
|
refreshBlocked.goButton.accesskey=A
|
||||||
|
|
|
@ -661,7 +661,7 @@ this.BrowserUITelemetry = {
|
||||||
"marklinkMenu", "copyemail", "copylink", "media-play", "media-pause",
|
"marklinkMenu", "copyemail", "copylink", "media-play", "media-pause",
|
||||||
"media-mute", "media-unmute", "media-playbackrate",
|
"media-mute", "media-unmute", "media-playbackrate",
|
||||||
"media-playbackrate-050x", "media-playbackrate-100x",
|
"media-playbackrate-050x", "media-playbackrate-100x",
|
||||||
"media-playbackrate-150x", "media-playbackrate-200x",
|
"media-playbackrate-125x", "media-playbackrate-150x", "media-playbackrate-200x",
|
||||||
"media-showcontrols", "media-hidecontrols", "video-showstats",
|
"media-showcontrols", "media-hidecontrols", "video-showstats",
|
||||||
"video-hidestats", "video-fullscreen", "leave-dom-fullscreen",
|
"video-hidestats", "video-fullscreen", "leave-dom-fullscreen",
|
||||||
"reloadimage", "viewimage", "viewvideo", "copyimage-contents", "copyimage",
|
"reloadimage", "viewimage", "viewvideo", "copyimage-contents", "copyimage",
|
||||||
|
|
|
@ -139,22 +139,23 @@ var ReaderParent = {
|
||||||
|
|
||||||
let button = win.document.getElementById("reader-mode-button");
|
let button = win.document.getElementById("reader-mode-button");
|
||||||
let command = win.document.getElementById("View:ReaderView");
|
let command = win.document.getElementById("View:ReaderView");
|
||||||
|
let key = win.document.getElementById("key_toggleReaderMode");
|
||||||
if (browser.currentURI.spec.startsWith("about:reader")) {
|
if (browser.currentURI.spec.startsWith("about:reader")) {
|
||||||
button.setAttribute("readeractive", true);
|
button.setAttribute("readeractive", true);
|
||||||
button.hidden = false;
|
button.hidden = false;
|
||||||
let closeText = gStringBundle.GetStringFromName("readerView.close");
|
let closeText = gStringBundle.GetStringFromName("readerView.close");
|
||||||
button.setAttribute("tooltiptext", closeText);
|
|
||||||
command.setAttribute("label", closeText);
|
command.setAttribute("label", closeText);
|
||||||
command.setAttribute("hidden", false);
|
command.setAttribute("hidden", false);
|
||||||
command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.close.accesskey"));
|
command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.close.accesskey"));
|
||||||
|
key.setAttribute("disabled", false);
|
||||||
} else {
|
} else {
|
||||||
button.removeAttribute("readeractive");
|
button.removeAttribute("readeractive");
|
||||||
button.hidden = !browser.isArticle;
|
button.hidden = !browser.isArticle;
|
||||||
let enterText = gStringBundle.GetStringFromName("readerView.enter");
|
let enterText = gStringBundle.GetStringFromName("readerView.enter");
|
||||||
button.setAttribute("tooltiptext", enterText);
|
|
||||||
command.setAttribute("label", enterText);
|
command.setAttribute("label", enterText);
|
||||||
command.setAttribute("hidden", !browser.isArticle);
|
command.setAttribute("hidden", !browser.isArticle);
|
||||||
command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.enter.accesskey"));
|
command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.enter.accesskey"));
|
||||||
|
key.setAttribute("disabled", !browser.isArticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentUriHost = browser.currentURI && browser.currentURI.asciiHost;
|
let currentUriHost = browser.currentURI && browser.currentURI.asciiHost;
|
||||||
|
|
|
@ -688,6 +688,48 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
return NS_ERROR_DOM_BAD_URI;
|
return NS_ERROR_DOM_BAD_URI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See TenFourFox issue 607
|
||||||
|
// determine if this is a script we want to block
|
||||||
|
// Scripts that somehow hit hard limits should go in here
|
||||||
|
if (!mIsTenFourFoxTroublesomeJsAllowed &&
|
||||||
|
(targetScheme.EqualsLiteral("http") || targetScheme.EqualsLiteral("https"))) {
|
||||||
|
nsAutoCString hostname, url;
|
||||||
|
if (MOZ_LIKELY(NS_SUCCEEDED(targetBaseURI->GetHost(hostname)) &&
|
||||||
|
NS_SUCCEEDED(targetBaseURI->GetAsciiSpec(url)))) {
|
||||||
|
ToLowerCase(hostname);
|
||||||
|
#define BLOC(q) hostname.EqualsLiteral(q)
|
||||||
|
#define BLOCU(q) url.EqualsLiteral(q)
|
||||||
|
#define BLOCS(q) (StringBeginsWith(url, NS_LITERAL_CSTRING(q)))
|
||||||
|
#define BLOCE(q) (StringEndsWith(url, NS_LITERAL_CSTRING(q)))
|
||||||
|
|
||||||
|
if (0 ||
|
||||||
|
|
||||||
|
#ifdef __ppc__
|
||||||
|
// wallpapers for issue 621
|
||||||
|
BLOC("static-exp1.licdn.com") ||
|
||||||
|
(
|
||||||
|
BLOC("communities.apple.com") &&
|
||||||
|
BLOCE("/public/scripts/tldr/index.js")
|
||||||
|
) ||
|
||||||
|
#endif // __ppc__
|
||||||
|
BLOCS("https://developer.mozilla.org/static/js/main.") ||
|
||||||
|
|
||||||
|
0) {
|
||||||
|
#undef BLOC
|
||||||
|
#undef BLOCU
|
||||||
|
#undef BLOCS
|
||||||
|
#undef BLOCE
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
if (mIsTenFourFoxTroublesomeJsLoggingEnabled)
|
||||||
|
#endif
|
||||||
|
fprintf(stderr, "Warning: TenFourFox blocking problematic script from %s.\n",
|
||||||
|
hostname.get());
|
||||||
|
return NS_ERROR_DOM_BAD_URI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TenFourFox issue 469
|
// TenFourFox issue 469
|
||||||
// determine if this is a script we want to block
|
// determine if this is a script we want to block
|
||||||
if (mIsTenFourFoxAdBlockEnabled &&
|
if (mIsTenFourFoxAdBlockEnabled &&
|
||||||
|
@ -696,6 +738,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
if (MOZ_LIKELY(NS_SUCCEEDED(targetBaseURI->GetHost(hostname)))) {
|
if (MOZ_LIKELY(NS_SUCCEEDED(targetBaseURI->GetHost(hostname)))) {
|
||||||
ToLowerCase(hostname);
|
ToLowerCase(hostname);
|
||||||
#define BLOK(q) hostname.EqualsLiteral(q)
|
#define BLOK(q) hostname.EqualsLiteral(q)
|
||||||
|
#define BLOKD(q) (StringEndsWith(hostname, NS_LITERAL_CSTRING(q)))
|
||||||
if (0 ||
|
if (0 ||
|
||||||
// This is used as a data source by a lot of UIs,
|
// This is used as a data source by a lot of UIs,
|
||||||
// so we shouldn't block it (e.g., nytimes).
|
// so we shouldn't block it (e.g., nytimes).
|
||||||
|
@ -846,7 +889,9 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
BLOK("static.yieldmo.com") ||
|
BLOK("static.yieldmo.com") ||
|
||||||
|
|
||||||
BLOK("ads.rubiconproject.com") ||
|
BLOK("ads.rubiconproject.com") ||
|
||||||
|
BLOK("eus.rubiconproject.com") ||
|
||||||
BLOK("fastlane.rubiconproject.com") ||
|
BLOK("fastlane.rubiconproject.com") ||
|
||||||
|
BLOK("optimized-by.rubiconproject.com") ||
|
||||||
|
|
||||||
BLOK("cdn.engine.4dsply.com") ||
|
BLOK("cdn.engine.4dsply.com") ||
|
||||||
|
|
||||||
|
@ -990,6 +1035,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
BLOK("c.fqtag.com") ||
|
BLOK("c.fqtag.com") ||
|
||||||
BLOK("new.fqtag.com") ||
|
BLOK("new.fqtag.com") ||
|
||||||
|
|
||||||
|
BLOK("tag.1rx.io") ||
|
||||||
BLOK("a-nj.1rx.io") ||
|
BLOK("a-nj.1rx.io") ||
|
||||||
BLOK("rxcdn.1rx.io") ||
|
BLOK("rxcdn.1rx.io") ||
|
||||||
|
|
||||||
|
@ -1111,6 +1157,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
BLOK("js.gumgum.com") ||
|
BLOK("js.gumgum.com") ||
|
||||||
|
|
||||||
BLOK("cdn.digitru.st") ||
|
BLOK("cdn.digitru.st") ||
|
||||||
|
BLOK("prebid.digitru.st") ||
|
||||||
|
|
||||||
BLOK("collector.cint.com") ||
|
BLOK("collector.cint.com") ||
|
||||||
|
|
||||||
|
@ -1185,9 +1232,49 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||||
|
|
||||||
BLOK("tag.crsspxl.com") ||
|
BLOK("tag.crsspxl.com") ||
|
||||||
|
|
||||||
|
BLOK("a.pub.network") ||
|
||||||
|
BLOK("a.publir.com") ||
|
||||||
|
|
||||||
|
BLOK("eb.proper.io") ||
|
||||||
|
BLOK("s2s.proper.io") ||
|
||||||
|
BLOK("bids.proper.io") ||
|
||||||
|
BLOK("events.proper.io") ||
|
||||||
|
BLOK("global.proper.io") ||
|
||||||
|
BLOK("propermedia-d.openx.net") ||
|
||||||
|
|
||||||
|
BLOK("stat.media") ||
|
||||||
|
|
||||||
|
BLOK("c.jsrdn.com") ||
|
||||||
|
BLOK("s.jsrdn.com") ||
|
||||||
|
|
||||||
|
BLOK("hb.emxdgt.com") ||
|
||||||
|
|
||||||
|
BLOK("lockerdome.com") ||
|
||||||
|
|
||||||
|
BLOK("get.s-onetag.com") ||
|
||||||
|
BLOK("beacon.s-onetag.com") ||
|
||||||
|
|
||||||
|
BLOK("cdn.boomtrain.com") ||
|
||||||
|
|
||||||
|
BLOK("w.usabilla.com") ||
|
||||||
|
|
||||||
|
BLOK("beacon.sojern.com") ||
|
||||||
|
|
||||||
|
BLOK("s3.buysellads.com") ||
|
||||||
|
BLOK("srv.buysellads.com") ||
|
||||||
|
|
||||||
|
BLOK("ads.intentiq.com") ||
|
||||||
|
|
||||||
|
BLOK("tag.durationmedia.net") ||
|
||||||
|
|
||||||
|
BLOK("www.datadoghq-browser-agent.com") ||
|
||||||
|
|
||||||
|
BLOK("ext.chtbl.com") ||
|
||||||
|
|
||||||
#include "shavar-blocklist.h"
|
#include "shavar-blocklist.h"
|
||||||
|
|
||||||
0) {
|
0) {
|
||||||
|
#undef BLOKD
|
||||||
#undef BLOK
|
#undef BLOK
|
||||||
// Yup.
|
// Yup.
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
|
@ -1769,6 +1856,7 @@ static const char* kObservedPrefs[] = {
|
||||||
sFileOriginPolicyPrefName,
|
sFileOriginPolicyPrefName,
|
||||||
"capability.policy.",
|
"capability.policy.",
|
||||||
"tenfourfox.adblock.",
|
"tenfourfox.adblock.",
|
||||||
|
"tenfourfox.troublesome-js.",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1789,6 +1877,8 @@ nsScriptSecurityManager::nsScriptSecurityManager(void)
|
||||||
, mIsJavaScriptEnabled(false)
|
, mIsJavaScriptEnabled(false)
|
||||||
, mIsTenFourFoxAdBlockEnabled(false)
|
, mIsTenFourFoxAdBlockEnabled(false)
|
||||||
, mIsTenFourFoxAdBlockLoggingEnabled(false)
|
, mIsTenFourFoxAdBlockLoggingEnabled(false)
|
||||||
|
, mIsTenFourFoxTroublesomeJsAllowed(false)
|
||||||
|
, mIsTenFourFoxTroublesomeJsLoggingEnabled(false)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(intptr_t) == sizeof(void*),
|
static_assert(sizeof(intptr_t) == sizeof(void*),
|
||||||
"intptr_t and void* have different lengths on this platform. "
|
"intptr_t and void* have different lengths on this platform. "
|
||||||
|
@ -1929,6 +2019,12 @@ nsScriptSecurityManager::ScriptSecurityPrefChanged()
|
||||||
Preferences::GetBool("tenfourfox.adblock.enabled", mIsTenFourFoxAdBlockEnabled);
|
Preferences::GetBool("tenfourfox.adblock.enabled", mIsTenFourFoxAdBlockEnabled);
|
||||||
mIsTenFourFoxAdBlockLoggingEnabled =
|
mIsTenFourFoxAdBlockLoggingEnabled =
|
||||||
Preferences::GetBool("tenfourfox.adblock.logging.enabled", mIsTenFourFoxAdBlockLoggingEnabled);
|
Preferences::GetBool("tenfourfox.adblock.logging.enabled", mIsTenFourFoxAdBlockLoggingEnabled);
|
||||||
|
mIsTenFourFoxTroublesomeJsAllowed =
|
||||||
|
Preferences::GetBool("tenfourfox.troublesome-js.allow",
|
||||||
|
mIsTenFourFoxTroublesomeJsAllowed);
|
||||||
|
mIsTenFourFoxTroublesomeJsLoggingEnabled =
|
||||||
|
Preferences::GetBool("tenfourfox.troublesome-js.logging.enabled",
|
||||||
|
mIsTenFourFoxTroublesomeJsLoggingEnabled);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rebuild the set of principals for which we allow file:// URI loads. This
|
// Rebuild the set of principals for which we allow file:// URI loads. This
|
||||||
|
|
|
@ -125,6 +125,8 @@ private:
|
||||||
bool mIsJavaScriptEnabled;
|
bool mIsJavaScriptEnabled;
|
||||||
bool mIsTenFourFoxAdBlockEnabled;
|
bool mIsTenFourFoxAdBlockEnabled;
|
||||||
bool mIsTenFourFoxAdBlockLoggingEnabled;
|
bool mIsTenFourFoxAdBlockLoggingEnabled;
|
||||||
|
bool mIsTenFourFoxTroublesomeJsAllowed;
|
||||||
|
bool mIsTenFourFoxTroublesomeJsLoggingEnabled;
|
||||||
nsTArray<nsCOMPtr<nsIURI>> mFileURIWhitelist;
|
nsTArray<nsCOMPtr<nsIURI>> mFileURIWhitelist;
|
||||||
|
|
||||||
// This machinery controls new-style domain policies. The old-style
|
// This machinery controls new-style domain policies. The old-style
|
||||||
|
|
|
@ -1,105 +1,568 @@
|
||||||
// a.js
|
// a.js
|
||||||
// http://zymerget.bid
|
// http://zymerget.bid
|
||||||
BLOK("alflying.date") ||
|
BLOK("alflying.date") ||
|
||||||
|
BLOKD(".alflying.date") ||
|
||||||
BLOK("alflying.win") ||
|
BLOK("alflying.win") ||
|
||||||
|
BLOKD(".alflying.win") ||
|
||||||
BLOK("anybest.site") ||
|
BLOK("anybest.site") ||
|
||||||
|
BLOKD(".anybest.site") ||
|
||||||
BLOK("flightsy.bid") ||
|
BLOK("flightsy.bid") ||
|
||||||
|
BLOKD(".flightsy.bid") ||
|
||||||
BLOK("flightsy.win") ||
|
BLOK("flightsy.win") ||
|
||||||
|
BLOKD(".flightsy.win") ||
|
||||||
BLOK("flightzy.bid") ||
|
BLOK("flightzy.bid") ||
|
||||||
|
BLOKD(".flightzy.bid") ||
|
||||||
BLOK("flightzy.date") ||
|
BLOK("flightzy.date") ||
|
||||||
|
BLOKD(".flightzy.date") ||
|
||||||
BLOK("flightzy.win") ||
|
BLOK("flightzy.win") ||
|
||||||
|
BLOKD(".flightzy.win") ||
|
||||||
BLOK("zymerget.bid") ||
|
BLOK("zymerget.bid") ||
|
||||||
|
BLOKD(".zymerget.bid") ||
|
||||||
BLOK("zymerget.faith") ||
|
BLOK("zymerget.faith") ||
|
||||||
|
BLOKD(".zymerget.faith") ||
|
||||||
// CashBeet
|
// CashBeet
|
||||||
// http://cashbeet.com
|
// http://cashbeet.com
|
||||||
BLOK("cashbeet.com") ||
|
BLOK("cashbeet.com") ||
|
||||||
|
BLOKD(".cashbeet.com") ||
|
||||||
BLOK("serv1swork.com") ||
|
BLOK("serv1swork.com") ||
|
||||||
|
BLOKD(".serv1swork.com") ||
|
||||||
// CoinHive
|
// CoinHive
|
||||||
// https://coinhive.com
|
// https://coinhive.com
|
||||||
BLOK("ad-miner.com") ||
|
BLOK("ad-miner.com") ||
|
||||||
|
BLOKD(".ad-miner.com") ||
|
||||||
BLOK("authedmine.com") ||
|
BLOK("authedmine.com") ||
|
||||||
|
BLOKD(".authedmine.com") ||
|
||||||
BLOK("bmst.pw") ||
|
BLOK("bmst.pw") ||
|
||||||
|
BLOKD(".bmst.pw") ||
|
||||||
BLOK("cnhv.co") ||
|
BLOK("cnhv.co") ||
|
||||||
|
BLOKD(".cnhv.co") ||
|
||||||
BLOK("coin-hive.com") ||
|
BLOK("coin-hive.com") ||
|
||||||
|
BLOKD(".coin-hive.com") ||
|
||||||
BLOK("coinhive.com") ||
|
BLOK("coinhive.com") ||
|
||||||
|
BLOKD(".coinhive.com") ||
|
||||||
BLOK("wsservices.org") ||
|
BLOK("wsservices.org") ||
|
||||||
|
BLOKD(".wsservices.org") ||
|
||||||
// CoinPot
|
// CoinPot
|
||||||
// http://coinpot.co
|
// http://coinpot.co
|
||||||
BLOK("coinpot.co") ||
|
BLOK("coinpot.co") ||
|
||||||
|
BLOKD(".coinpot.co") ||
|
||||||
// CryptoLoot
|
// CryptoLoot
|
||||||
// https://crypto-loot.com
|
// https://crypto-loot.com
|
||||||
BLOK("cryptaloot.pro") ||
|
BLOK("cryptaloot.pro") ||
|
||||||
|
BLOKD(".cryptaloot.pro") ||
|
||||||
BLOK("crypto-loot.com") ||
|
BLOK("crypto-loot.com") ||
|
||||||
|
BLOKD(".crypto-loot.com") ||
|
||||||
BLOK("cryptolootminer.com") ||
|
BLOK("cryptolootminer.com") ||
|
||||||
|
BLOKD(".cryptolootminer.com") ||
|
||||||
BLOK("flashx.pw") ||
|
BLOK("flashx.pw") ||
|
||||||
|
BLOKD(".flashx.pw") ||
|
||||||
BLOK("gitgrub.pro") ||
|
BLOK("gitgrub.pro") ||
|
||||||
|
BLOKD(".gitgrub.pro") ||
|
||||||
BLOK("reauthenticator.com") ||
|
BLOK("reauthenticator.com") ||
|
||||||
|
BLOKD(".reauthenticator.com") ||
|
||||||
BLOK("statdynamic.com") ||
|
BLOK("statdynamic.com") ||
|
||||||
|
BLOKD(".statdynamic.com") ||
|
||||||
BLOK("webmine.pro") ||
|
BLOK("webmine.pro") ||
|
||||||
|
BLOKD(".webmine.pro") ||
|
||||||
// CryptoWebMiner
|
// CryptoWebMiner
|
||||||
// https://www.crypto-webminer.com
|
// https://www.crypto-webminer.com
|
||||||
BLOK("bitcoin-pay.eu") ||
|
BLOK("bitcoin-pay.eu") ||
|
||||||
|
BLOKD(".bitcoin-pay.eu") ||
|
||||||
BLOK("crypto-webminer.com") ||
|
BLOK("crypto-webminer.com") ||
|
||||||
|
BLOKD(".crypto-webminer.com") ||
|
||||||
BLOK("ethpocket.de") ||
|
BLOK("ethpocket.de") ||
|
||||||
|
BLOKD(".ethpocket.de") ||
|
||||||
BLOK("ethtrader.de") ||
|
BLOK("ethtrader.de") ||
|
||||||
|
BLOKD(".ethtrader.de") ||
|
||||||
// Gridcash
|
// Gridcash
|
||||||
// https://www.gridcash.net/
|
// https://www.gridcash.net/
|
||||||
BLOK("adless.io") ||
|
BLOK("adless.io") ||
|
||||||
|
BLOKD(".adless.io") ||
|
||||||
BLOK("gridcash.net") ||
|
BLOK("gridcash.net") ||
|
||||||
|
BLOKD(".gridcash.net") ||
|
||||||
// JSE
|
// JSE
|
||||||
// http://jsecoin.com
|
// http://jsecoin.com
|
||||||
BLOK("freecontent.bid") ||
|
BLOK("freecontent.bid") ||
|
||||||
|
BLOKD(".freecontent.bid") ||
|
||||||
BLOK("freecontent.date") ||
|
BLOK("freecontent.date") ||
|
||||||
|
BLOKD(".freecontent.date") ||
|
||||||
BLOK("freecontent.stream") ||
|
BLOK("freecontent.stream") ||
|
||||||
|
BLOKD(".freecontent.stream") ||
|
||||||
BLOK("hashing.win") ||
|
BLOK("hashing.win") ||
|
||||||
|
BLOKD(".hashing.win") ||
|
||||||
BLOK("hostingcloud.racing") ||
|
BLOK("hostingcloud.racing") ||
|
||||||
|
BLOKD(".hostingcloud.racing") ||
|
||||||
BLOK("hostingcloud.science") ||
|
BLOK("hostingcloud.science") ||
|
||||||
|
BLOKD(".hostingcloud.science") ||
|
||||||
BLOK("jsecoin.com") ||
|
BLOK("jsecoin.com") ||
|
||||||
|
BLOKD(".jsecoin.com") ||
|
||||||
// MinerAlt
|
// MinerAlt
|
||||||
// http://mineralt.io
|
// http://mineralt.io
|
||||||
BLOK("1q2w3.website") ||
|
BLOK("1q2w3.website") ||
|
||||||
|
BLOKD(".1q2w3.website") ||
|
||||||
BLOK("analytics.blue") ||
|
BLOK("analytics.blue") ||
|
||||||
|
BLOKD(".analytics.blue") ||
|
||||||
BLOK("aster18cdn.nl") ||
|
BLOK("aster18cdn.nl") ||
|
||||||
|
BLOKD(".aster18cdn.nl") ||
|
||||||
BLOK("belicimo.pw") ||
|
BLOK("belicimo.pw") ||
|
||||||
|
BLOKD(".belicimo.pw") ||
|
||||||
BLOK("besstahete.info") ||
|
BLOK("besstahete.info") ||
|
||||||
|
BLOKD(".besstahete.info") ||
|
||||||
BLOK("dinorslick.icu") ||
|
BLOK("dinorslick.icu") ||
|
||||||
|
BLOKD(".dinorslick.icu") ||
|
||||||
BLOK("feesocrald.com") ||
|
BLOK("feesocrald.com") ||
|
||||||
|
BLOKD(".feesocrald.com") ||
|
||||||
BLOK("gramombird.com") ||
|
BLOK("gramombird.com") ||
|
||||||
|
BLOKD(".gramombird.com") ||
|
||||||
BLOK("istlandoll.com") ||
|
BLOK("istlandoll.com") ||
|
||||||
|
BLOKD(".istlandoll.com") ||
|
||||||
BLOK("mepirtedic.com") ||
|
BLOK("mepirtedic.com") ||
|
||||||
|
BLOKD(".mepirtedic.com") ||
|
||||||
BLOK("mineralt.io") ||
|
BLOK("mineralt.io") ||
|
||||||
|
BLOKD(".mineralt.io") ||
|
||||||
BLOK("pampopholf.com") ||
|
BLOK("pampopholf.com") ||
|
||||||
|
BLOKD(".pampopholf.com") ||
|
||||||
BLOK("tercabilis.info") ||
|
BLOK("tercabilis.info") ||
|
||||||
|
BLOKD(".tercabilis.info") ||
|
||||||
BLOK("tulip18.com") ||
|
BLOK("tulip18.com") ||
|
||||||
|
BLOKD(".tulip18.com") ||
|
||||||
BLOK("vidzi.tv") ||
|
BLOK("vidzi.tv") ||
|
||||||
|
BLOKD(".vidzi.tv") ||
|
||||||
BLOK("yololike.space") ||
|
BLOK("yololike.space") ||
|
||||||
|
BLOKD(".yololike.space") ||
|
||||||
// Minescripts
|
// Minescripts
|
||||||
// http://minescripts.info
|
// http://minescripts.info
|
||||||
BLOK("minescripts.info") ||
|
BLOK("minescripts.info") ||
|
||||||
|
BLOKD(".minescripts.info") ||
|
||||||
BLOK("sslverify.info") ||
|
BLOK("sslverify.info") ||
|
||||||
|
BLOKD(".sslverify.info") ||
|
||||||
// MineXMR
|
// MineXMR
|
||||||
// http://minexmr.stream
|
// http://minexmr.stream
|
||||||
BLOK("minexmr.stream") ||
|
BLOK("minexmr.stream") ||
|
||||||
|
BLOKD(".minexmr.stream") ||
|
||||||
// NeroHut
|
// NeroHut
|
||||||
// https://nerohut.com
|
// https://nerohut.com
|
||||||
BLOK("nerohut.com") ||
|
BLOK("nerohut.com") ||
|
||||||
|
BLOKD(".nerohut.com") ||
|
||||||
BLOK("nhsrv.cf") ||
|
BLOK("nhsrv.cf") ||
|
||||||
|
BLOKD(".nhsrv.cf") ||
|
||||||
// Service4refresh
|
// Service4refresh
|
||||||
// https://service4refresh.info
|
// https://service4refresh.info
|
||||||
BLOK("service4refresh.info") ||
|
BLOK("service4refresh.info") ||
|
||||||
|
BLOKD(".service4refresh.info") ||
|
||||||
// SpareChange
|
// SpareChange
|
||||||
// http://sparechange.io
|
// http://sparechange.io
|
||||||
BLOK("sparechange.io") ||
|
BLOK("sparechange.io") ||
|
||||||
|
BLOKD(".sparechange.io") ||
|
||||||
// SwiftMining
|
// SwiftMining
|
||||||
// https://swiftmining.win/
|
// https://swiftmining.win/
|
||||||
BLOK("swiftmining.win") ||
|
BLOK("swiftmining.win") ||
|
||||||
|
BLOKD(".swiftmining.win") ||
|
||||||
// Webmine
|
// Webmine
|
||||||
// https://webmine.cz/
|
// https://webmine.cz/
|
||||||
BLOK("authedwebmine.cz") ||
|
BLOK("authedwebmine.cz") ||
|
||||||
|
BLOKD(".authedwebmine.cz") ||
|
||||||
BLOK("webmine.cz") ||
|
BLOK("webmine.cz") ||
|
||||||
|
BLOKD(".webmine.cz") ||
|
||||||
// WebminePool
|
// WebminePool
|
||||||
// http://webminepool.com
|
// http://webminepool.com
|
||||||
BLOK("webminepool.com") ||
|
BLOK("webminepool.com") ||
|
||||||
|
BLOKD(".webminepool.com") ||
|
||||||
// Webmining
|
// Webmining
|
||||||
// https://webmining.co/
|
// https://webmining.co/
|
||||||
BLOK("webmining.co") ||
|
BLOK("webmining.co") ||
|
||||||
|
BLOKD(".webmining.co") ||
|
||||||
|
// Adbot
|
||||||
|
// https://adbot.tw/
|
||||||
|
BLOK("adbot.tw") ||
|
||||||
|
BLOKD(".adbot.tw") ||
|
||||||
|
// AdCash
|
||||||
|
// https://adcash.com
|
||||||
|
BLOK("ufpcdn.com") ||
|
||||||
|
BLOKD(".ufpcdn.com") ||
|
||||||
|
// AdMaven
|
||||||
|
// https://ad-maven.com/
|
||||||
|
BLOK("ad-maven.com") ||
|
||||||
|
BLOKD(".ad-maven.com") ||
|
||||||
|
BLOK("wrethicap.info") ||
|
||||||
|
BLOKD(".wrethicap.info") ||
|
||||||
|
// Admicro
|
||||||
|
// http://www.admicro.vn/
|
||||||
|
BLOK("admicro.vn") ||
|
||||||
|
BLOKD(".admicro.vn") ||
|
||||||
|
BLOK("vcmedia.vn") ||
|
||||||
|
BLOKD(".vcmedia.vn") ||
|
||||||
|
// Adnium
|
||||||
|
// https://adnium.com
|
||||||
|
BLOK("adnium.com") ||
|
||||||
|
BLOKD(".adnium.com") ||
|
||||||
|
BLOK("montwam.top") ||
|
||||||
|
BLOKD(".montwam.top") ||
|
||||||
|
// AdScore
|
||||||
|
// http://www.adscoremarketing.com/
|
||||||
|
BLOK("adsco.re") ||
|
||||||
|
BLOKD(".adsco.re") ||
|
||||||
|
// AdxSpace
|
||||||
|
// https://adx.space
|
||||||
|
BLOK("00px.net") ||
|
||||||
|
BLOKD(".00px.net") ||
|
||||||
|
// AivaLabs
|
||||||
|
// https://aivalabs.com
|
||||||
|
BLOK("aivalabs.com") ||
|
||||||
|
BLOKD(".aivalabs.com") ||
|
||||||
|
// AuditedMedia
|
||||||
|
// https://auditedmedia.com/
|
||||||
|
BLOK("aamapi.com") ||
|
||||||
|
BLOKD(".aamapi.com") ||
|
||||||
|
BLOK("aamsitecertifier.com") ||
|
||||||
|
BLOKD(".aamsitecertifier.com") ||
|
||||||
|
BLOK("auditedmedia.com") ||
|
||||||
|
BLOKD(".auditedmedia.com") ||
|
||||||
|
// Azet
|
||||||
|
// http://mediaimpact.sk/
|
||||||
|
BLOK("rsz.sk") ||
|
||||||
|
BLOKD(".rsz.sk") ||
|
||||||
|
// BetssonPalantir
|
||||||
|
// https://betssonpalantir.com/
|
||||||
|
BLOK("betssonpalantir.com") ||
|
||||||
|
BLOKD(".betssonpalantir.com") ||
|
||||||
|
// BitMedia
|
||||||
|
// https://bitmedia.io/
|
||||||
|
BLOK("bitmedia.io") ||
|
||||||
|
BLOKD(".bitmedia.io") ||
|
||||||
|
// BlueCava
|
||||||
|
// http://www.bluecava.com/
|
||||||
|
BLOK("bluecava.com") ||
|
||||||
|
BLOKD(".bluecava.com") ||
|
||||||
|
// BoostBox
|
||||||
|
// https://www.boostbox.com.br/
|
||||||
|
BLOK("boostbox.com.br") ||
|
||||||
|
BLOKD(".boostbox.com.br") ||
|
||||||
|
// Bouncex
|
||||||
|
// https://www.bouncex.com/
|
||||||
|
BLOK("bounceexchange.com") ||
|
||||||
|
BLOKD(".bounceexchange.com") ||
|
||||||
|
BLOK("bouncex.com") ||
|
||||||
|
BLOKD(".bouncex.com") ||
|
||||||
|
BLOK("bouncex.net") ||
|
||||||
|
BLOKD(".bouncex.net") ||
|
||||||
|
// Brandcrumb
|
||||||
|
// http://www.brandcrumb.com
|
||||||
|
BLOK("brandcrumb.com") ||
|
||||||
|
BLOKD(".brandcrumb.com") ||
|
||||||
|
// BreakTime
|
||||||
|
// https://www.breaktime.com.tw/
|
||||||
|
BLOK("breaktime.com.tw") ||
|
||||||
|
BLOKD(".breaktime.com.tw") ||
|
||||||
|
// BrightEdge
|
||||||
|
// http://www.brightedge.com/
|
||||||
|
BLOK("b0e8.com") ||
|
||||||
|
BLOKD(".b0e8.com") ||
|
||||||
|
// C3 Metrics
|
||||||
|
// http://c3metrics.com/
|
||||||
|
BLOK("c3metrics.com") ||
|
||||||
|
BLOKD(".c3metrics.com") ||
|
||||||
|
BLOK("c3tag.com") ||
|
||||||
|
BLOKD(".c3tag.com") ||
|
||||||
|
// CallSource
|
||||||
|
// https://www.callsource.com/
|
||||||
|
BLOK("leadtrackingdata.com") ||
|
||||||
|
BLOKD(".leadtrackingdata.com") ||
|
||||||
|
// CartsGuru
|
||||||
|
// https://carts.guru/
|
||||||
|
BLOK("carts.guru") ||
|
||||||
|
BLOKD(".carts.guru") ||
|
||||||
|
// ClearLink
|
||||||
|
// https://www.clearlink.com/
|
||||||
|
BLOK("clearlink.com") ||
|
||||||
|
BLOKD(".clearlink.com") ||
|
||||||
|
// Clickayab
|
||||||
|
// http://www.clickyab.com
|
||||||
|
BLOK("clickyab.com") ||
|
||||||
|
BLOKD(".clickyab.com") ||
|
||||||
|
// ClickFrog
|
||||||
|
// https://clickfrog.ru/
|
||||||
|
BLOK("bashirian.biz") ||
|
||||||
|
BLOKD(".bashirian.biz") ||
|
||||||
|
BLOK("buckridge.link") ||
|
||||||
|
BLOKD(".buckridge.link") ||
|
||||||
|
BLOK("franecki.net") ||
|
||||||
|
BLOKD(".franecki.net") ||
|
||||||
|
BLOK("quitzon.net") ||
|
||||||
|
BLOKD(".quitzon.net") ||
|
||||||
|
BLOK("reichelcormier.bid") ||
|
||||||
|
BLOKD(".reichelcormier.bid") ||
|
||||||
|
BLOK("wisokykulas.bid") ||
|
||||||
|
BLOKD(".wisokykulas.bid") ||
|
||||||
|
// ClickGuard
|
||||||
|
// https://www.clickguard.com/
|
||||||
|
BLOK("clickguard.com") ||
|
||||||
|
BLOKD(".clickguard.com") ||
|
||||||
|
// Clixtell
|
||||||
|
// https://www.clixtell.com/
|
||||||
|
BLOK("clixtell.com") ||
|
||||||
|
BLOKD(".clixtell.com") ||
|
||||||
|
// Cloudflare
|
||||||
|
// https://cloudflare.com
|
||||||
|
BLOK("hcaptcha.com") ||
|
||||||
|
BLOKD(".hcaptcha.com") ||
|
||||||
|
// dmpxs
|
||||||
|
// http://bob.dmpxs.com
|
||||||
|
BLOK("dmpxs.com") ||
|
||||||
|
BLOKD(".dmpxs.com") ||
|
||||||
|
// EroAdvertising
|
||||||
|
// http://www.ero-advertising.com/
|
||||||
|
BLOK("ero-advertising.com") ||
|
||||||
|
BLOKD(".ero-advertising.com") ||
|
||||||
|
// Foresee
|
||||||
|
// https://www.foresee.com
|
||||||
|
BLOK("answerscloud.com") ||
|
||||||
|
BLOKD(".answerscloud.com") ||
|
||||||
|
BLOK("foresee.com") ||
|
||||||
|
BLOKD(".foresee.com") ||
|
||||||
|
// Friends2Follow
|
||||||
|
// https://friends2follow.com/
|
||||||
|
BLOK("antifraudjs.friends2follow.com") ||
|
||||||
|
BLOKD(".antifraudjs.friends2follow.com") ||
|
||||||
|
// Gleam
|
||||||
|
// https://gleam.io/
|
||||||
|
BLOK("fraudjs.io") ||
|
||||||
|
BLOKD(".fraudjs.io") ||
|
||||||
|
// GrapheneMedia
|
||||||
|
// http://graphenemedia.in/
|
||||||
|
BLOK("graphenedigitalanalytics.in") ||
|
||||||
|
BLOKD(".graphenedigitalanalytics.in") ||
|
||||||
|
// HilltopAds
|
||||||
|
// https://hilltopads.com/
|
||||||
|
BLOK("hilltopads.net") ||
|
||||||
|
BLOKD(".hilltopads.net") ||
|
||||||
|
// HotelChamp
|
||||||
|
// https://www.hotelchamp.com
|
||||||
|
BLOK("hotelchamp.com") ||
|
||||||
|
BLOKD(".hotelchamp.com") ||
|
||||||
|
// HumanSecurity
|
||||||
|
// https://www.humansecurity.com/
|
||||||
|
BLOK("perimeterx.net") ||
|
||||||
|
BLOKD(".perimeterx.net") ||
|
||||||
|
// iMedia
|
||||||
|
// http://www.imedia.cz
|
||||||
|
BLOK("imedia.cz") ||
|
||||||
|
BLOKD(".imedia.cz") ||
|
||||||
|
// Impact
|
||||||
|
// https://impact.com/
|
||||||
|
BLOK("fqtag.com") ||
|
||||||
|
BLOKD(".fqtag.com") ||
|
||||||
|
// Integral Ad Science
|
||||||
|
// https://integralads.com/
|
||||||
|
BLOK("adsafeprotected.com") ||
|
||||||
|
BLOKD(".adsafeprotected.com") ||
|
||||||
|
// iShumei
|
||||||
|
// https://www.ishumei.com/
|
||||||
|
BLOK("fengkongcloud.com") ||
|
||||||
|
BLOKD(".fengkongcloud.com") ||
|
||||||
|
// IslayTech
|
||||||
|
// http://islay.tech
|
||||||
|
BLOK("islay.tech") ||
|
||||||
|
BLOKD(".islay.tech") ||
|
||||||
|
// ismatlab.com
|
||||||
|
// http://ismatlab.com
|
||||||
|
BLOK("ismatlab.com") ||
|
||||||
|
BLOKD(".ismatlab.com") ||
|
||||||
|
// Itch
|
||||||
|
// https://itch.io/
|
||||||
|
BLOK("itch.io") ||
|
||||||
|
BLOKD(".itch.io") ||
|
||||||
|
// Kitewheel
|
||||||
|
// https://kitewheel.com/
|
||||||
|
BLOK("kitewheel.com") ||
|
||||||
|
BLOKD(".kitewheel.com") ||
|
||||||
|
// Konduto
|
||||||
|
// http://konduto.com
|
||||||
|
BLOK("k-analytix.com") ||
|
||||||
|
BLOKD(".k-analytix.com") ||
|
||||||
|
BLOK("konduto.com") ||
|
||||||
|
BLOKD(".konduto.com") ||
|
||||||
|
// LeadsHub
|
||||||
|
// https://ztsrv.com/
|
||||||
|
BLOK("ztsrv.com") ||
|
||||||
|
BLOKD(".ztsrv.com") ||
|
||||||
|
// lptracker
|
||||||
|
// https://lptracker.io/
|
||||||
|
BLOK("lptracker.io") ||
|
||||||
|
BLOKD(".lptracker.io") ||
|
||||||
|
// MaxMind
|
||||||
|
// https://www.maxmind.com/en/home
|
||||||
|
BLOK("maxmind.com") ||
|
||||||
|
BLOKD(".maxmind.com") ||
|
||||||
|
BLOK("mmapiws.com") ||
|
||||||
|
BLOKD(".mmapiws.com") ||
|
||||||
|
// Mercadopago
|
||||||
|
// https://www.mercadopago.com/
|
||||||
|
BLOK("mercadopago.com") ||
|
||||||
|
BLOKD(".mercadopago.com") ||
|
||||||
|
// Mobials
|
||||||
|
// http://mobials.com
|
||||||
|
BLOK("mobials.com") ||
|
||||||
|
BLOKD(".mobials.com") ||
|
||||||
|
// Negishim
|
||||||
|
// http://www.negishim.org
|
||||||
|
BLOK("negishim.org") ||
|
||||||
|
BLOKD(".negishim.org") ||
|
||||||
|
// OneAd
|
||||||
|
// https://www.onead.com.tw/
|
||||||
|
BLOK("guoshipartners.com") ||
|
||||||
|
BLOKD(".guoshipartners.com") ||
|
||||||
|
BLOK("onevision.com.tw") ||
|
||||||
|
BLOKD(".onevision.com.tw") ||
|
||||||
|
// OnlineMetrix
|
||||||
|
// http://h.online-metrix.net
|
||||||
|
BLOK("online-metrix.net") ||
|
||||||
|
BLOKD(".online-metrix.net") ||
|
||||||
|
// Outbrain
|
||||||
|
// http://www.outbrain.com/
|
||||||
|
BLOK("ligatus.com") ||
|
||||||
|
BLOKD(".ligatus.com") ||
|
||||||
|
// PartyPoker
|
||||||
|
// https://www.partypoker.com/
|
||||||
|
BLOK("iivt.com") ||
|
||||||
|
BLOKD(".iivt.com") ||
|
||||||
|
// Paypal
|
||||||
|
// https://www.paypal.com
|
||||||
|
BLOK("simility.com") ||
|
||||||
|
BLOKD(".simility.com") ||
|
||||||
|
// PixAnalytics
|
||||||
|
// https://pixanalytics.com/
|
||||||
|
BLOK("pixanalytics.com") ||
|
||||||
|
BLOKD(".pixanalytics.com") ||
|
||||||
|
// Pixlee
|
||||||
|
// https://www.pixlee.com/
|
||||||
|
BLOK("pixlee.com") ||
|
||||||
|
BLOKD(".pixlee.com") ||
|
||||||
|
// PPCProtect
|
||||||
|
// https://ppcprotect.com
|
||||||
|
BLOK("ppcprotect.com") ||
|
||||||
|
BLOKD(".ppcprotect.com") ||
|
||||||
|
// PrometheusIntelligenceTechnology
|
||||||
|
// https://prometheusintelligencetechnology.com/
|
||||||
|
BLOK("prometheusintelligencetechnology.com") ||
|
||||||
|
BLOKD(".prometheusintelligencetechnology.com") ||
|
||||||
|
// Protected Media
|
||||||
|
// http://www.protected.media/
|
||||||
|
BLOK("ad-score.com") ||
|
||||||
|
BLOKD(".ad-score.com") ||
|
||||||
|
// Radware
|
||||||
|
// https://www.radware.com/
|
||||||
|
BLOK("perfdrive.com") ||
|
||||||
|
BLOKD(".perfdrive.com") ||
|
||||||
|
// RazorPay
|
||||||
|
// https://razorpay.com
|
||||||
|
BLOK("thirdwatch.ai") ||
|
||||||
|
BLOKD(".thirdwatch.ai") ||
|
||||||
|
// Rollick
|
||||||
|
// https://gorollick.com
|
||||||
|
BLOK("rollick.io") ||
|
||||||
|
BLOKD(".rollick.io") ||
|
||||||
|
// Selectable Media
|
||||||
|
// http://selectablemedia.com/
|
||||||
|
BLOK("selectablemedia.com") ||
|
||||||
|
BLOKD(".selectablemedia.com") ||
|
||||||
|
// Semantiqo
|
||||||
|
// http://semantiqo.com/
|
||||||
|
BLOK("semantiqo.com") ||
|
||||||
|
BLOKD(".semantiqo.com") ||
|
||||||
|
// SendPulse
|
||||||
|
// https://sendpulse.com/
|
||||||
|
BLOK("sendpulse.com") ||
|
||||||
|
BLOKD(".sendpulse.com") ||
|
||||||
|
// ShaftTraffic
|
||||||
|
// https://shafttraffic.com
|
||||||
|
BLOK("libertystmedia.com") ||
|
||||||
|
BLOKD(".libertystmedia.com") ||
|
||||||
|
// Shixiseng
|
||||||
|
// https://www.shixiseng.com/
|
||||||
|
BLOK("xiaoyuanzhao.com") ||
|
||||||
|
BLOKD(".xiaoyuanzhao.com") ||
|
||||||
|
// Shortest
|
||||||
|
// http://shorte.st/
|
||||||
|
BLOK("shorte.st") ||
|
||||||
|
BLOKD(".shorte.st") ||
|
||||||
|
// SiftScience
|
||||||
|
// https://sift.com/
|
||||||
|
BLOK("siftscience.com") ||
|
||||||
|
BLOKD(".siftscience.com") ||
|
||||||
|
// Signifyd
|
||||||
|
// https://www.signifyd.com/
|
||||||
|
BLOK("signifyd.com") ||
|
||||||
|
BLOKD(".signifyd.com") ||
|
||||||
|
// SmarterClick
|
||||||
|
// https://smarterclick.com/privacy-policy/
|
||||||
|
BLOK("smct.io") ||
|
||||||
|
BLOKD(".smct.io") ||
|
||||||
|
// Smi
|
||||||
|
// http://24smi.net
|
||||||
|
BLOK("24smi.net") ||
|
||||||
|
BLOKD(".24smi.net") ||
|
||||||
|
// Storeland
|
||||||
|
// https://storeland.ru/
|
||||||
|
BLOK("storeland.ru") ||
|
||||||
|
BLOKD(".storeland.ru") ||
|
||||||
|
// Stripchat
|
||||||
|
// https://stripchat.com/
|
||||||
|
BLOK("stripst.com") ||
|
||||||
|
BLOKD(".stripst.com") ||
|
||||||
|
// Stripe
|
||||||
|
// https://stripe.com
|
||||||
|
BLOK("stripe.network") ||
|
||||||
|
BLOKD(".stripe.network") ||
|
||||||
|
// TechSolutions
|
||||||
|
// https://www.techsolutions.com.tw/
|
||||||
|
BLOK("techsolutions.com.tw") ||
|
||||||
|
BLOKD(".techsolutions.com.tw") ||
|
||||||
|
// tongdun.cn
|
||||||
|
// https://www.tongdun.cn/?lan=EN
|
||||||
|
BLOK("fraudmetrix.cn") ||
|
||||||
|
BLOKD(".fraudmetrix.cn") ||
|
||||||
|
BLOK("tongdun.net") ||
|
||||||
|
BLOKD(".tongdun.net") ||
|
||||||
|
// Trendemon
|
||||||
|
// https://trendemon.com/
|
||||||
|
BLOK("trendemon.com") ||
|
||||||
|
BLOKD(".trendemon.com") ||
|
||||||
|
// Upland
|
||||||
|
// https://uplandsoftware.com/
|
||||||
|
BLOK("leadlander.com") ||
|
||||||
|
BLOKD(".leadlander.com") ||
|
||||||
|
BLOK("sf14g.com") ||
|
||||||
|
BLOKD(".sf14g.com") ||
|
||||||
|
// VerticalHealth
|
||||||
|
// https://www.verticalhealth.com/
|
||||||
|
BLOK("verticalhealth.net") ||
|
||||||
|
BLOKD(".verticalhealth.net") ||
|
||||||
|
// Warumbistdusoarm
|
||||||
|
// https://warumbistdusoarm.space
|
||||||
|
BLOK("warumbistdusoarm.space") ||
|
||||||
|
BLOKD(".warumbistdusoarm.space") ||
|
||||||
|
// Webmecanik
|
||||||
|
// https://www.webmecanik.com/
|
||||||
|
BLOK("webmecanik.com") ||
|
||||||
|
BLOKD(".webmecanik.com") ||
|
||||||
|
// WideOrbit
|
||||||
|
// https://www.wideorbit.com/
|
||||||
|
BLOK("dep-x.com") ||
|
||||||
|
BLOKD(".dep-x.com") ||
|
||||||
|
// Yandex
|
||||||
|
// http://www.yandex.com/
|
||||||
|
BLOK("mc.yandex.ru") ||
|
||||||
|
BLOKD(".mc.yandex.ru") ||
|
||||||
|
// ZafulAffiliate
|
||||||
|
// https://affiliate.zaful.com/
|
||||||
|
BLOK("affasi.com") ||
|
||||||
|
BLOKD(".affasi.com") ||
|
||||||
|
BLOK("gw-ec.com") ||
|
||||||
|
BLOKD(".gw-ec.com") ||
|
||||||
|
BLOK("zaful.com") ||
|
||||||
|
BLOKD(".zaful.com") ||
|
||||||
|
// Zip
|
||||||
|
// https://zip.co
|
||||||
|
BLOK("zipmoney.com.au") ||
|
||||||
|
BLOKD(".zipmoney.com.au") ||
|
||||||
|
|
|
@ -57,7 +57,7 @@ endif
|
||||||
|
|
||||||
# try to find autoconf 2.13 - discard errors from 'which'
|
# try to find autoconf 2.13 - discard errors from 'which'
|
||||||
# MacOS X 10.4 sends "no autoconf*" errors to stdout, discard those via grep
|
# MacOS X 10.4 sends "no autoconf*" errors to stdout, discard those via grep
|
||||||
AUTOCONF ?= $(shell which autoconf-2.13 autoconf2.13 autoconf213 2>/dev/null | grep -v '^no autoconf' | head -1)
|
AUTOCONF ?= $(shell /usr/bin/which autoconf-2.13 autoconf2.13 autoconf213 2>/dev/null | grep -v '^no autoconf' | head -1)
|
||||||
|
|
||||||
# See if the autoconf package was installed through fink
|
# See if the autoconf package was installed through fink
|
||||||
ifeq (,$(strip $(AUTOCONF)))
|
ifeq (,$(strip $(AUTOCONF)))
|
||||||
|
|
12
config/external/nss/Makefile.in
vendored
12
config/external/nss/Makefile.in
vendored
|
@ -10,6 +10,17 @@ CXX_WRAPPER =
|
||||||
|
|
||||||
default::
|
default::
|
||||||
|
|
||||||
|
ifeq (86,$(findstring 86,$(OS_TEST)))
|
||||||
|
# TenFourFox Intel fix
|
||||||
|
# TO DO - pass the compiler in as an environment variable
|
||||||
|
CC=clang-mp-3.4
|
||||||
|
CC += -arch i386
|
||||||
|
CC += -O3
|
||||||
|
CCC=clang++-mp-3.4
|
||||||
|
CCC += -arch i386
|
||||||
|
CCC += -O3
|
||||||
|
endif
|
||||||
|
|
||||||
include $(topsrcdir)/config/makefiles/functions.mk
|
include $(topsrcdir)/config/makefiles/functions.mk
|
||||||
|
|
||||||
NSS_LIBS = \
|
NSS_LIBS = \
|
||||||
|
@ -122,6 +133,7 @@ DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR)
|
||||||
DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1
|
DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1
|
||||||
DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1
|
DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1
|
||||||
DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1
|
DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1
|
||||||
|
DEFAULT_GMAKE_FLAGS += NSS_ENABLE_TLS_1_3=1
|
||||||
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1)
|
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1)
|
||||||
DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' NSPR31_LIB_PREFIX=lib
|
DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' NSPR31_LIB_PREFIX=lib
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -10,4 +10,4 @@
|
||||||
# hardcoded milestones in the tree from these two files.
|
# hardcoded milestones in the tree from these two files.
|
||||||
#--------------------------------------------------------
|
#--------------------------------------------------------
|
||||||
|
|
||||||
45.28.0
|
45.41.6
|
||||||
|
|
|
@ -63,6 +63,18 @@ this.Curl = {
|
||||||
let utils = CurlUtils;
|
let utils = CurlUtils;
|
||||||
|
|
||||||
let command = ["curl"];
|
let command = ["curl"];
|
||||||
|
|
||||||
|
// Make sure to use the following helpers to sanitize arguments before execution.
|
||||||
|
const addParam = value => {
|
||||||
|
const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
|
||||||
|
command.push(safe);
|
||||||
|
};
|
||||||
|
|
||||||
|
const addPostData = value => {
|
||||||
|
const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
|
||||||
|
data.push(safe);
|
||||||
|
};
|
||||||
|
|
||||||
let ignoredHeaders = new Set();
|
let ignoredHeaders = new Set();
|
||||||
|
|
||||||
// The cURL command is expected to run on the same platform that Firefox runs
|
// The cURL command is expected to run on the same platform that Firefox runs
|
||||||
|
@ -71,7 +83,7 @@ this.Curl = {
|
||||||
utils.escapeStringWin : utils.escapeStringPosix;
|
utils.escapeStringWin : utils.escapeStringPosix;
|
||||||
|
|
||||||
// Add URL.
|
// Add URL.
|
||||||
command.push(escapeString(aData.url));
|
addParam(aData.url);
|
||||||
|
|
||||||
let postDataText = null;
|
let postDataText = null;
|
||||||
let multipartRequest = utils.isMultipartRequest(aData);
|
let multipartRequest = utils.isMultipartRequest(aData);
|
||||||
|
@ -80,15 +92,18 @@ this.Curl = {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (utils.isUrlEncodedRequest(aData) || aData.method == "PUT") {
|
if (utils.isUrlEncodedRequest(aData) || aData.method == "PUT") {
|
||||||
postDataText = aData.postDataText;
|
postDataText = aData.postDataText;
|
||||||
data.push("--data");
|
// Irony: curl that comes with Tiger doesn't support this option.
|
||||||
data.push(escapeString(utils.writePostDataTextParams(postDataText)));
|
// But if you are l33t enough to use this, you should know that.
|
||||||
|
// -- Cameron
|
||||||
|
addPostData("--data-raw");
|
||||||
|
addPostData(utils.writePostDataTextParams(postDataText));
|
||||||
ignoredHeaders.add("Content-Length");
|
ignoredHeaders.add("Content-Length");
|
||||||
} else if (multipartRequest) {
|
} else if (multipartRequest) {
|
||||||
postDataText = aData.postDataText;
|
postDataText = aData.postDataText;
|
||||||
data.push("--data-binary");
|
addPostData("--data-binary");
|
||||||
let boundary = utils.getMultipartBoundary(aData);
|
let boundary = utils.getMultipartBoundary(aData);
|
||||||
let text = utils.removeBinaryDataFromMultipartText(postDataText, boundary);
|
let text = utils.removeBinaryDataFromMultipartText(postDataText, boundary);
|
||||||
data.push(escapeString(text));
|
addPostData(text);
|
||||||
ignoredHeaders.add("Content-Length");
|
ignoredHeaders.add("Content-Length");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,20 +111,20 @@ this.Curl = {
|
||||||
// For GET and POST requests this is not necessary as GET is the
|
// For GET and POST requests this is not necessary as GET is the
|
||||||
// default. If --data or --binary is added POST is the default.
|
// default. If --data or --binary is added POST is the default.
|
||||||
if (!(aData.method == "GET" || aData.method == "POST")) {
|
if (!(aData.method == "GET" || aData.method == "POST")) {
|
||||||
command.push("-X");
|
addParam("-X");
|
||||||
command.push(aData.method);
|
addParam(aData.method);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add -I (HEAD)
|
// Add -I (HEAD)
|
||||||
// For servers that supports HEAD.
|
// For servers that supports HEAD.
|
||||||
// This will fetch the header of a document only.
|
// This will fetch the header of a document only.
|
||||||
if (aData.method == "HEAD") {
|
if (aData.method == "HEAD") {
|
||||||
command.push("-I");
|
addParam("-I");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add http version.
|
// Add http version.
|
||||||
if (aData.httpVersion && aData.httpVersion != DEFAULT_HTTP_VERSION) {
|
if (aData.httpVersion && aData.httpVersion != DEFAULT_HTTP_VERSION) {
|
||||||
command.push("--" + aData.httpVersion.split("/")[1]);
|
addParam("--" + aData.httpVersion.split("/")[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add request headers.
|
// Add request headers.
|
||||||
|
@ -121,14 +136,14 @@ this.Curl = {
|
||||||
for (let i = 0; i < headers.length; i++) {
|
for (let i = 0; i < headers.length; i++) {
|
||||||
let header = headers[i];
|
let header = headers[i];
|
||||||
if (header.name === "Accept-Encoding"){
|
if (header.name === "Accept-Encoding"){
|
||||||
command.push("--compressed");
|
addParam("--compressed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ignoredHeaders.has(header.name)) {
|
if (ignoredHeaders.has(header.name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
command.push("-H");
|
addParam("-H");
|
||||||
command.push(escapeString(header.name + ": " + header.value));
|
addParam(header.name + ": " + header.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add post data.
|
// Add post data.
|
||||||
|
|
|
@ -529,7 +529,7 @@ var NetworkHelper = {
|
||||||
* If state == broken:
|
* If state == broken:
|
||||||
* - errorMessage: full error message from nsITransportSecurityInfo.
|
* - errorMessage: full error message from nsITransportSecurityInfo.
|
||||||
* If state == secure:
|
* If state == secure:
|
||||||
* - protocolVersion: one of TLSv1, TLSv1.1, TLSv1.2.
|
* - protocolVersion: one of TLSv1, TLSv1.1, TLSv1.2, TLSv1.3.
|
||||||
* - cipherSuite: the cipher suite used in this connection.
|
* - cipherSuite: the cipher suite used in this connection.
|
||||||
* - cert: information about certificate used in this connection.
|
* - cert: information about certificate used in this connection.
|
||||||
* See parseCertificateInfo for the contents.
|
* See parseCertificateInfo for the contents.
|
||||||
|
@ -712,7 +712,7 @@ var NetworkHelper = {
|
||||||
* @param Number version
|
* @param Number version
|
||||||
* One of nsISSLStatus version constants.
|
* One of nsISSLStatus version constants.
|
||||||
* @return string
|
* @return string
|
||||||
* One of TLSv1, TLSv1.1, TLSv1.2 if @param version is valid,
|
* One of TLSv1, TLSv1.1, TLSv1.2, TLSv1.3 if @param version is valid,
|
||||||
* Unknown otherwise.
|
* Unknown otherwise.
|
||||||
*/
|
*/
|
||||||
formatSecurityProtocol: function NH_formatSecurityProtocol(version) {
|
formatSecurityProtocol: function NH_formatSecurityProtocol(version) {
|
||||||
|
@ -723,6 +723,8 @@ var NetworkHelper = {
|
||||||
return "TLSv1.1";
|
return "TLSv1.1";
|
||||||
case Ci.nsISSLStatus.TLS_VERSION_1_2:
|
case Ci.nsISSLStatus.TLS_VERSION_1_2:
|
||||||
return "TLSv1.2";
|
return "TLSv1.2";
|
||||||
|
case Ci.nsISSLStatus.TLS_VERSION_1_3:
|
||||||
|
return "TLSv1.3";
|
||||||
default:
|
default:
|
||||||
DevToolsUtils.reportException("NetworkHelper.formatSecurityProtocol",
|
DevToolsUtils.reportException("NetworkHelper.formatSecurityProtocol",
|
||||||
"protocolVersion " + version + " is unknown.");
|
"protocolVersion " + version + " is unknown.");
|
||||||
|
|
|
@ -856,6 +856,12 @@ nsDocShell::~nsDocShell()
|
||||||
shPrivate->SetRootDocShell(nullptr);
|
shPrivate->SetRootDocShell(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mContentViewer) {
|
||||||
|
mContentViewer->Close(nullptr);
|
||||||
|
mContentViewer->Destroy();
|
||||||
|
mContentViewer = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (--gDocShellCount == 0) {
|
if (--gDocShellCount == 0) {
|
||||||
NS_IF_RELEASE(sURIFixup);
|
NS_IF_RELEASE(sURIFixup);
|
||||||
}
|
}
|
||||||
|
@ -5379,11 +5385,19 @@ nsDocShell::Stop(uint32_t aStopFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
|
if (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
|
||||||
// Stop the document loading
|
// Stop the document loading and animations
|
||||||
if (mContentViewer) {
|
if (mContentViewer) {
|
||||||
nsCOMPtr<nsIContentViewer> cv = mContentViewer;
|
nsCOMPtr<nsIContentViewer> cv = mContentViewer;
|
||||||
cv->Stop();
|
cv->Stop();
|
||||||
}
|
}
|
||||||
|
} else if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {
|
||||||
|
// Stop the document loading only
|
||||||
|
if (mContentViewer) {
|
||||||
|
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
|
||||||
|
if (doc) {
|
||||||
|
doc->StopDocumentLoad();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {
|
if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {
|
||||||
|
@ -9205,7 +9219,11 @@ nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
|
||||||
mContentViewer->SetNavigationTiming(mTiming);
|
mContentViewer->SetNavigationTiming(mTiming);
|
||||||
|
|
||||||
if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
|
if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
|
||||||
|
nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
|
||||||
|
viewer->Close(nullptr);
|
||||||
|
viewer->Destroy();
|
||||||
mContentViewer = nullptr;
|
mContentViewer = nullptr;
|
||||||
|
mCurrentURI = nullptr;
|
||||||
NS_WARNING("ContentViewer Initialization failed");
|
NS_WARNING("ContentViewer Initialization failed");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1145,8 +1145,7 @@ BeaconStreamListener::OnStartRequest(nsIRequest *aRequest,
|
||||||
// release the loadgroup first
|
// release the loadgroup first
|
||||||
mLoadGroup = nullptr;
|
mLoadGroup = nullptr;
|
||||||
|
|
||||||
aRequest->Cancel(NS_ERROR_NET_INTERRUPT);
|
return NS_ERROR_ABORT;
|
||||||
return NS_BINDING_ABORTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -4855,6 +4855,12 @@ nsContentUtils::TriggerLink(nsIContent *aContent,
|
||||||
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sanitize fileNames containing null characters by replacing them with
|
||||||
|
// underscores.
|
||||||
|
if (!fileName.IsVoid()) {
|
||||||
|
fileName.ReplaceChar(char16_t(0), '_');
|
||||||
|
}
|
||||||
|
|
||||||
nsDocShell::Cast(docShell)->OnLinkClick(aContent, aLinkURI,
|
nsDocShell::Cast(docShell)->OnLinkClick(aContent, aLinkURI,
|
||||||
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
||||||
fileName, nullptr, nullptr, aIsTrusted);
|
fileName, nullptr, nullptr, aIsTrusted);
|
||||||
|
@ -8801,10 +8807,6 @@ ShouldEscape(nsIContent* aParent)
|
||||||
nsGkAtoms::style, nsGkAtoms::script, nsGkAtoms::xmp,
|
nsGkAtoms::style, nsGkAtoms::script, nsGkAtoms::xmp,
|
||||||
nsGkAtoms::iframe, nsGkAtoms::noembed, nsGkAtoms::noframes,
|
nsGkAtoms::iframe, nsGkAtoms::noembed, nsGkAtoms::noframes,
|
||||||
nsGkAtoms::plaintext,
|
nsGkAtoms::plaintext,
|
||||||
// Per the current spec noscript should be escaped in case
|
|
||||||
// scripts are disabled or if document doesn't have
|
|
||||||
// browsing context. However the latter seems to be a spec bug
|
|
||||||
// and Gecko hasn't traditionally done the former.
|
|
||||||
nsGkAtoms::noscript
|
nsGkAtoms::noscript
|
||||||
};
|
};
|
||||||
static mozilla::BloomFilter<12, nsIAtom> sFilter;
|
static mozilla::BloomFilter<12, nsIAtom> sFilter;
|
||||||
|
@ -8820,6 +8822,10 @@ ShouldEscape(nsIContent* aParent)
|
||||||
if (sFilter.mightContain(tag)) {
|
if (sFilter.mightContain(tag)) {
|
||||||
for (uint32_t i = 0; i < ArrayLength(nonEscapingElements); ++i) {
|
for (uint32_t i = 0; i < ArrayLength(nonEscapingElements); ++i) {
|
||||||
if (tag == nonEscapingElements[i]) {
|
if (tag == nonEscapingElements[i]) {
|
||||||
|
if (MOZ_UNLIKELY(tag == nsGkAtoms::noscript) &&
|
||||||
|
MOZ_UNLIKELY(!aParent->OwnerDoc()->IsScriptEnabled())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8293,7 +8293,7 @@ nsDocument::IsScriptEnabled()
|
||||||
{
|
{
|
||||||
// If this document is sandboxed without 'allow-scripts'
|
// If this document is sandboxed without 'allow-scripts'
|
||||||
// script is not enabled
|
// script is not enabled
|
||||||
if (mSandboxFlags & SANDBOXED_SCRIPTS) {
|
if (HasScriptsBlockedBySandbox()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13044,6 +13044,12 @@ nsIDocument::InlineScriptAllowedByCSP()
|
||||||
return allowsInlineScript;
|
return allowsInlineScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsIDocument::HasScriptsBlockedBySandbox()
|
||||||
|
{
|
||||||
|
return mSandboxFlags & SANDBOXED_SCRIPTS;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
MightBeAboutOrChromeScheme(nsIURI* aURI)
|
MightBeAboutOrChromeScheme(nsIURI* aURI)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2057,6 +2057,10 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
|
||||||
nsresult
|
nsresult
|
||||||
nsFrameLoader::GetWindowDimensions(nsIntRect& aRect)
|
nsFrameLoader::GetWindowDimensions(nsIntRect& aRect)
|
||||||
{
|
{
|
||||||
|
if (!mOwnerContent) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Need to get outer window position here
|
// Need to get outer window position here
|
||||||
nsIDocument* doc = mOwnerContent->GetComposedDoc();
|
nsIDocument* doc = mOwnerContent->GetComposedDoc();
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
|
|
|
@ -10005,36 +10005,12 @@ nsGlobalWindow::GetComputedStyleHelperOuter(Element& aElt,
|
||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
||||||
|
|
||||||
if (!mDocShell) {
|
if (!mDoc) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
|
|
||||||
|
|
||||||
if (!presShell) {
|
|
||||||
// Try flushing frames on our parent in case there's a pending
|
|
||||||
// style change that will create the presshell.
|
|
||||||
nsGlobalWindow *parent =
|
|
||||||
static_cast<nsGlobalWindow *>(GetPrivateParent());
|
|
||||||
if (!parent) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent->FlushPendingNotifications(Flush_Frames);
|
|
||||||
|
|
||||||
// Might have killed mDocShell
|
|
||||||
if (!mDocShell) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
presShell = mDocShell->GetPresShell();
|
|
||||||
if (!presShell) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsComputedDOMStyle> compStyle =
|
RefPtr<nsComputedDOMStyle> compStyle =
|
||||||
NS_NewComputedDOMStyle(&aElt, aPseudoElt, presShell,
|
NS_NewComputedDOMStyle(&aElt, aPseudoElt, mDoc,
|
||||||
aDefaultStylesOnly ? nsComputedDOMStyle::eDefaultOnly :
|
aDefaultStylesOnly ? nsComputedDOMStyle::eDefaultOnly :
|
||||||
nsComputedDOMStyle::eAll);
|
nsComputedDOMStyle::eAll);
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
|
||||||
if (ns == kNameSpaceID_XHTML &&
|
if (ns == kNameSpaceID_XHTML &&
|
||||||
(name == nsGkAtoms::script ||
|
(name == nsGkAtoms::script ||
|
||||||
name == nsGkAtoms::style ||
|
name == nsGkAtoms::style ||
|
||||||
name == nsGkAtoms::noscript ||
|
(name == nsGkAtoms::noscript && aElement->OwnerDoc()->IsScriptEnabled()) ||
|
||||||
name == nsGkAtoms::noframes)) {
|
name == nsGkAtoms::noframes)) {
|
||||||
++mDisableEntityEncoding;
|
++mDisableEntityEncoding;
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
|
||||||
if (ns == kNameSpaceID_XHTML &&
|
if (ns == kNameSpaceID_XHTML &&
|
||||||
(name == nsGkAtoms::script ||
|
(name == nsGkAtoms::script ||
|
||||||
name == nsGkAtoms::style ||
|
name == nsGkAtoms::style ||
|
||||||
name == nsGkAtoms::noscript ||
|
(name == nsGkAtoms::noscript && aElement->OwnerDoc()->IsScriptEnabled()) ||
|
||||||
name == nsGkAtoms::noframes)) {
|
name == nsGkAtoms::noframes)) {
|
||||||
--mDisableEntityEncoding;
|
--mDisableEntityEncoding;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2678,6 +2678,8 @@ public:
|
||||||
return mUserHasInteracted;
|
return mUserHasInteracted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasScriptsBlockedBySandbox();
|
||||||
|
|
||||||
bool InlineScriptAllowedByCSP();
|
bool InlineScriptAllowedByCSP();
|
||||||
|
|
||||||
void SetLinkHandlingEnabled(bool aValue) { mLinksEnabled = aValue; }
|
void SetLinkHandlingEnabled(bool aValue) { mLinksEnabled = aValue; }
|
||||||
|
|
|
@ -60,7 +60,7 @@ interface nsIImageLoadingContent : imgINotificationObserver
|
||||||
* the image was blocked. This status always refers to the
|
* the image was blocked. This status always refers to the
|
||||||
* CURRENT_REQUEST load.
|
* CURRENT_REQUEST load.
|
||||||
*/
|
*/
|
||||||
readonly attribute short imageBlockingStatus;
|
[infallible] readonly attribute short imageBlockingStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to register an image decoder observer. Typically, this will
|
* Used to register an image decoder observer. Typically, this will
|
||||||
|
|
|
@ -272,7 +272,7 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType,
|
||||||
bool aScriptFromHead)
|
bool aScriptFromHead)
|
||||||
{
|
{
|
||||||
// If this document is sandboxed without 'allow-scripts', abort.
|
// If this document is sandboxed without 'allow-scripts', abort.
|
||||||
if (mDocument->GetSandboxFlags() & SANDBOXED_SCRIPTS) {
|
if (mDocument->HasScriptsBlockedBySandbox()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||||
|
|
||||||
// inline script
|
// inline script
|
||||||
// Is this document sandboxed without 'allow-scripts'?
|
// Is this document sandboxed without 'allow-scripts'?
|
||||||
if (mDocument->GetSandboxFlags() & SANDBOXED_SCRIPTS) {
|
if (mDocument->HasScriptsBlockedBySandbox()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,10 @@ nsStructuredCloneContainer::GetDataAsBase64(nsAString &aOut)
|
||||||
if (!DataLength()) {
|
if (!DataLength()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
CheckedInt<nsAutoCString::size_type> sizeCheck(DataLength());
|
||||||
|
if (MOZ_UNLIKELY(!sizeCheck.isValid())) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (HasClonedDOMObjects()) {
|
if (HasClonedDOMObjects()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -209,6 +209,11 @@ FirstNon8Bit(const char16_t *str, const char16_t *end)
|
||||||
bool
|
bool
|
||||||
nsTextFragment::SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi)
|
nsTextFragment::SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi)
|
||||||
{
|
{
|
||||||
|
if (MOZ_UNLIKELY(aLength < 0 || static_cast<uint32_t>(aLength) >
|
||||||
|
NS_MAX_TEXT_FRAGMENT_LENGTH)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ReleaseText();
|
ReleaseText();
|
||||||
|
|
||||||
if (aLength == 0) {
|
if (aLength == 0) {
|
||||||
|
@ -337,9 +342,16 @@ nsTextFragment::CopyTo(char16_t *aDest, int32_t aOffset, int32_t aCount)
|
||||||
bool
|
bool
|
||||||
nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBidi)
|
nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBidi)
|
||||||
{
|
{
|
||||||
|
if (!aLength) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// This is a common case because some callsites create a textnode
|
// This is a common case because some callsites create a textnode
|
||||||
// with a value by creating the node and then calling AppendData.
|
// with a value by creating the node and then calling AppendData.
|
||||||
if (mState.mLength == 0) {
|
if (mState.mLength == 0) {
|
||||||
|
if (MOZ_UNLIKELY(aLength > INT32_MAX)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return SetTo(aBuffer, aLength, aUpdateBidi);
|
return SetTo(aBuffer, aLength, aUpdateBidi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1317,7 +1317,13 @@ nsXMLHttpRequest::IsSafeHeader(const nsACString& header, nsIHttpChannel* httpCha
|
||||||
if (!NS_IsValidHTTPToken(token)) {
|
if (!NS_IsValidHTTPToken(token)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (header.Equals(token, nsCaseInsensitiveCStringComparator())) {
|
|
||||||
|
if (token.EqualsLiteral("*") &&
|
||||||
|
(mState & XML_HTTP_REQUEST_AC_WITH_CREDENTIALS) !=
|
||||||
|
XML_HTTP_REQUEST_AC_WITH_CREDENTIALS /* See this->SetWithCredentials */)
|
||||||
|
{
|
||||||
|
isSafe = true;
|
||||||
|
} else if (header.Equals(token, nsCaseInsensitiveCStringComparator())) {
|
||||||
isSafe = true;
|
isSafe = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2290,6 +2290,12 @@ ConstructJSImplementation(JSContext* aCx, const char* aContractId,
|
||||||
{
|
{
|
||||||
AutoNoJSAPI nojsapi;
|
AutoNoJSAPI nojsapi;
|
||||||
|
|
||||||
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal);
|
||||||
|
if (!window->IsCurrentInnerWindow()) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the XPCOM component containing the JS implementation.
|
// Get the XPCOM component containing the JS implementation.
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
|
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
|
||||||
|
@ -2304,7 +2310,6 @@ ConstructJSImplementation(JSContext* aCx, const char* aContractId,
|
||||||
// and our global is a window.
|
// and our global is a window.
|
||||||
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
|
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
|
||||||
do_QueryInterface(implISupports);
|
do_QueryInterface(implISupports);
|
||||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal);
|
|
||||||
if (gpi) {
|
if (gpi) {
|
||||||
JS::Rooted<JS::Value> initReturn(aCx);
|
JS::Rooted<JS::Value> initReturn(aCx);
|
||||||
rv = gpi->Init(window, &initReturn);
|
rv = gpi->Init(window, &initReturn);
|
||||||
|
|
|
@ -117,7 +117,7 @@ ToJSValue(JSContext* aCx,
|
||||||
// Make sure we're called in a compartment
|
// Make sure we're called in a compartment
|
||||||
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
|
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
|
||||||
|
|
||||||
aValue.setNumber(aArgument);
|
aValue.set(JS_NumberValue(aArgument));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
35
dom/cache/Manager.cpp
vendored
35
dom/cache/Manager.cpp
vendored
|
@ -253,6 +253,12 @@ public:
|
||||||
MOZ_ASSERT(!sFactory->mManagerList.IsEmpty());
|
MOZ_ASSERT(!sFactory->mManagerList.IsEmpty());
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// Note that we are synchronously calling abort code here. If any
|
||||||
|
// of the shutdown code synchronously decides to delete the Factory
|
||||||
|
// we need to delay that delete until the end of this method.
|
||||||
|
AutoRestore<bool> restore(sFactory->mInSyncAbortOrShutdown);
|
||||||
|
sFactory->mInSyncAbortOrShutdown = true;
|
||||||
|
|
||||||
ManagerList::ForwardIterator iter(sFactory->mManagerList);
|
ManagerList::ForwardIterator iter(sFactory->mManagerList);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
RefPtr<Manager> manager = iter.GetNext();
|
RefPtr<Manager> manager = iter.GetNext();
|
||||||
|
@ -262,6 +268,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaybeDestroyInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -279,8 +287,8 @@ public:
|
||||||
// Note that we are synchronously calling shutdown code here. If any
|
// Note that we are synchronously calling shutdown code here. If any
|
||||||
// of the shutdown code synchronously decides to delete the Factory
|
// of the shutdown code synchronously decides to delete the Factory
|
||||||
// we need to delay that delete until the end of this method.
|
// we need to delay that delete until the end of this method.
|
||||||
AutoRestore<bool> restore(sFactory->mInSyncShutdown);
|
AutoRestore<bool> restore(sFactory->mInSyncAbortOrShutdown);
|
||||||
sFactory->mInSyncShutdown = true;
|
sFactory->mInSyncAbortOrShutdown = true;
|
||||||
|
|
||||||
ManagerList::ForwardIterator iter(sFactory->mManagerList);
|
ManagerList::ForwardIterator iter(sFactory->mManagerList);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
|
@ -300,17 +308,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Factory()
|
Factory() : mInSyncAbortOrShutdown(false) {
|
||||||
: mInSyncShutdown(false)
|
|
||||||
{
|
|
||||||
MOZ_COUNT_CTOR(cache::Manager::Factory);
|
MOZ_COUNT_CTOR(cache::Manager::Factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Factory()
|
~Factory() {
|
||||||
{
|
|
||||||
MOZ_COUNT_DTOR(cache::Manager::Factory);
|
MOZ_COUNT_DTOR(cache::Manager::Factory);
|
||||||
MOZ_ASSERT(mManagerList.IsEmpty());
|
MOZ_DIAGNOSTIC_ASSERT(mManagerList.IsEmpty());
|
||||||
MOZ_ASSERT(!mInSyncShutdown);
|
MOZ_DIAGNOSTIC_ASSERT(!mInSyncAbortOrShutdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
|
@ -353,9 +358,9 @@ private:
|
||||||
|
|
||||||
// If the factory is is still in use then we cannot delete yet. This
|
// If the factory is is still in use then we cannot delete yet. This
|
||||||
// could be due to managers still existing or because we are in the
|
// could be due to managers still existing or because we are in the
|
||||||
// middle of shutting down. We need to be careful not to delete ourself
|
// middle of aborting or shutting down. We need to be careful not to delete
|
||||||
// synchronously during shutdown.
|
// ourself synchronously during shutdown.
|
||||||
if (!sFactory->mManagerList.IsEmpty() || sFactory->mInSyncShutdown) {
|
if (!sFactory->mManagerList.IsEmpty() || sFactory->mInSyncAbortOrShutdown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,10 +385,10 @@ private:
|
||||||
typedef nsTObserverArray<Manager*> ManagerList;
|
typedef nsTObserverArray<Manager*> ManagerList;
|
||||||
ManagerList mManagerList;
|
ManagerList mManagerList;
|
||||||
|
|
||||||
// This flag is set when we are looping through the list and calling
|
// This flag is set when we are looping through the list and calling Abort()
|
||||||
// Shutdown() on each Manager. We need to be careful not to synchronously
|
// or Shutdown() on each Manager. We need to be careful not to synchronously
|
||||||
// trigger the deletion of the factory while still executing this loop.
|
// trigger the deletion of the factory while still executing this loop.
|
||||||
bool mInSyncShutdown;
|
bool mInSyncAbortOrShutdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
10
dom/cache/StreamList.cpp
vendored
10
dom/cache/StreamList.cpp
vendored
|
@ -138,7 +138,15 @@ StreamList::CloseAll()
|
||||||
{
|
{
|
||||||
NS_ASSERT_OWNINGTHREAD(StreamList);
|
NS_ASSERT_OWNINGTHREAD(StreamList);
|
||||||
if (mStreamControl) {
|
if (mStreamControl) {
|
||||||
mStreamControl->CloseAll();
|
auto streamControl = mStreamControl;
|
||||||
|
mStreamControl = nullptr;
|
||||||
|
|
||||||
|
streamControl->CloseAll();
|
||||||
|
|
||||||
|
mStreamControl = streamControl;
|
||||||
|
streamControl = nullptr;
|
||||||
|
|
||||||
|
mStreamControl->Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4030,29 +4030,41 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
||||||
|
|
||||||
gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
||||||
{
|
{
|
||||||
// use lazy initilization for the font group since it's rather expensive
|
// Use lazy (re)initialization for the fontGroup since it's rather expensive.
|
||||||
if (!CurrentState().fontGroup) {
|
|
||||||
|
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||||
|
gfxTextPerfMetrics* tp = nullptr;
|
||||||
|
if (presShell && !presShell->IsDestroying()) {
|
||||||
|
tp = presShell->GetPresContext()->GetTextPerfMetrics();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have a cached fontGroup, check that it is valid for the current
|
||||||
|
// prescontext; if not, we need to discard and re-create it.
|
||||||
|
RefPtr<gfxFontGroup>& fontGroup = CurrentState().fontGroup;
|
||||||
|
if (fontGroup && fontGroup->GetTextPerfMetrics() != tp)
|
||||||
|
fontGroup = nullptr;
|
||||||
|
|
||||||
|
if (!fontGroup) {
|
||||||
ErrorResult err;
|
ErrorResult err;
|
||||||
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
||||||
static float kDefaultFontSize = 10.0;
|
static float kDefaultFontSize = 10.0;
|
||||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
// If the font has already been set, we're re-creating the fontGroup
|
||||||
bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
|
// and should re-use the existing font attribute; if not, we initialize
|
||||||
|
// it to the canvas default.
|
||||||
|
const nsString& currentFont = CurrentState().font;
|
||||||
|
bool fontUpdated = SetFontInternal(
|
||||||
|
currentFont.IsEmpty() ? kDefaultFontStyle : currentFont, err);
|
||||||
if (err.Failed() || !fontUpdated) {
|
if (err.Failed() || !fontUpdated) {
|
||||||
err.SuppressException();
|
err.SuppressException();
|
||||||
gfxFontStyle style;
|
gfxFontStyle style;
|
||||||
style.size = kDefaultFontSize;
|
style.size = kDefaultFontSize;
|
||||||
gfxTextPerfMetrics* tp = nullptr;
|
|
||||||
if (presShell && !presShell->IsDestroying()) {
|
|
||||||
tp = presShell->GetPresContext()->GetTextPerfMetrics();
|
|
||||||
}
|
|
||||||
int32_t perDevPixel, perCSSPixel;
|
int32_t perDevPixel, perCSSPixel;
|
||||||
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
||||||
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
||||||
CurrentState().fontGroup =
|
fontGroup = gfxPlatform::GetPlatform()->CreateFontGroup(FontFamilyList(eFamily_sans_serif),
|
||||||
gfxPlatform::GetPlatform()->CreateFontGroup(FontFamilyList(eFamily_sans_serif),
|
|
||||||
&style, tp,
|
&style, tp,
|
||||||
nullptr, devToCssSize);
|
nullptr, devToCssSize);
|
||||||
if (CurrentState().fontGroup) {
|
if (fontGroup) {
|
||||||
CurrentState().font = kDefaultFontStyle;
|
CurrentState().font = kDefaultFontStyle;
|
||||||
} else {
|
} else {
|
||||||
NS_ERROR("Default canvas font is invalid");
|
NS_ERROR("Default canvas font is invalid");
|
||||||
|
@ -4060,7 +4072,7 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CurrentState().fontGroup;
|
return fontGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -5217,6 +5229,16 @@ CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
|
||||||
return imageData.forget();
|
return imageData.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IntRect ClipImageDataTransfer(IntRect& aSrc, const IntPoint& aDestOffset,
|
||||||
|
const IntSize& aDestBounds) {
|
||||||
|
IntRect dest = aSrc;
|
||||||
|
dest.SafeMoveBy(aDestOffset);
|
||||||
|
dest = IntRect(IntPoint(0, 0), aDestBounds).SafeIntersect(dest);
|
||||||
|
|
||||||
|
aSrc = aSrc.SafeIntersect(dest - aDestOffset);
|
||||||
|
return aSrc + aDestOffset;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
||||||
int32_t aX,
|
int32_t aX,
|
||||||
|
@ -5232,7 +5254,7 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
||||||
MOZ_ASSERT(aWidth && aHeight);
|
MOZ_ASSERT(aWidth && aHeight);
|
||||||
|
|
||||||
CheckedInt<uint32_t> len = CheckedInt<uint32_t>(aWidth) * aHeight * 4;
|
CheckedInt<uint32_t> len = CheckedInt<uint32_t>(aWidth) * aHeight * 4;
|
||||||
if (!len.isValid()) {
|
if (!len.isValid() || len.value() > INT32_MAX) {
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5254,8 +5276,9 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
||||||
}
|
}
|
||||||
|
|
||||||
IntRect srcRect(0, 0, mWidth, mHeight);
|
IntRect srcRect(0, 0, mWidth, mHeight);
|
||||||
IntRect destRect(aX, aY, aWidth, aHeight);
|
IntRect dstWriteRect(0, 0, aWidth, aHeight);
|
||||||
IntRect srcReadRect = srcRect.Intersect(destRect);
|
IntRect srcReadRect = ClipImageDataTransfer(dstWriteRect, IntPoint(aX, aY),
|
||||||
|
IntSize(mWidth, mHeight));
|
||||||
RefPtr<DataSourceSurface> readback;
|
RefPtr<DataSourceSurface> readback;
|
||||||
DataSourceSurface::MappedSurface rawData;
|
DataSourceSurface::MappedSurface rawData;
|
||||||
if (!srcReadRect.IsEmpty()) {
|
if (!srcReadRect.IsEmpty()) {
|
||||||
|
@ -5268,9 +5291,6 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntRect dstWriteRect = srcReadRect;
|
|
||||||
dstWriteRect.MoveBy(-aX, -aY);
|
|
||||||
|
|
||||||
uint8_t* src;
|
uint8_t* src;
|
||||||
uint32_t srcStride;
|
uint32_t srcStride;
|
||||||
|
|
||||||
|
@ -5455,10 +5475,10 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w
|
||||||
dirtyRect = imageDataRect;
|
dirtyRect = imageDataRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
dirtyRect.MoveBy(IntPoint(x, y));
|
IntRect srcRect = dirtyRect;
|
||||||
dirtyRect = IntRect(0, 0, mWidth, mHeight).Intersect(dirtyRect);
|
dirtyRect = ClipImageDataTransfer(srcRect, IntPoint(x, y),
|
||||||
|
IntSize(mWidth, mHeight));
|
||||||
if (dirtyRect.Width() <= 0 || dirtyRect.Height() <= 0) {
|
if (dirtyRect.IsEmpty()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5551,7 +5571,7 @@ CreateImageData(JSContext* cx, CanvasRenderingContext2D* context,
|
||||||
h = 1;
|
h = 1;
|
||||||
|
|
||||||
CheckedInt<uint32_t> len = CheckedInt<uint32_t>(w) * h * 4;
|
CheckedInt<uint32_t> len = CheckedInt<uint32_t>(w) * h * 4;
|
||||||
if (!len.isValid()) {
|
if (!len.isValid() || len.value() > INT32_MAX) {
|
||||||
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/Event.h"
|
#include "mozilla/dom/Event.h"
|
||||||
#include "mozilla/dom/EventTargetBinding.h"
|
#include "mozilla/dom/EventTargetBinding.h"
|
||||||
|
#include "mozilla/ScopeExit.h"
|
||||||
#include "mozilla/TimelineConsumers.h"
|
#include "mozilla/TimelineConsumers.h"
|
||||||
#include "mozilla/EventTimelineMarker.h"
|
#include "mozilla/EventTimelineMarker.h"
|
||||||
|
|
||||||
|
@ -712,6 +713,8 @@ EventListenerManager::SetEventHandler(nsIAtom* aName,
|
||||||
bool aPermitUntrustedEvents,
|
bool aPermitUntrustedEvents,
|
||||||
Element* aElement)
|
Element* aElement)
|
||||||
{
|
{
|
||||||
|
auto removeEventHandler = MakeScopeExit([&] { RemoveEventHandler(aName, EmptyString()); });
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> doc;
|
nsCOMPtr<nsIDocument> doc;
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global =
|
nsCOMPtr<nsIScriptGlobalObject> global =
|
||||||
GetScriptGlobalAndDocument(getter_AddRefs(doc));
|
GetScriptGlobalAndDocument(getter_AddRefs(doc));
|
||||||
|
@ -735,7 +738,7 @@ EventListenerManager::SetEventHandler(nsIAtom* aName,
|
||||||
if (doc) {
|
if (doc) {
|
||||||
// Don't allow adding an event listener if the document is sandboxed
|
// Don't allow adding an event listener if the document is sandboxed
|
||||||
// without 'allow-scripts'.
|
// without 'allow-scripts'.
|
||||||
if (doc->GetSandboxFlags() & SANDBOXED_SCRIPTS) {
|
if (doc->HasScriptsBlockedBySandbox()) {
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,6 +789,8 @@ EventListenerManager::SetEventHandler(nsIAtom* aName,
|
||||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||||
NS_ENSURE_STATE(global->GetGlobalJSObject());
|
NS_ENSURE_STATE(global->GetGlobalJSObject());
|
||||||
|
|
||||||
|
removeEventHandler.release();
|
||||||
|
|
||||||
Listener* listener = SetEventHandlerInternal(aName,
|
Listener* listener = SetEventHandlerInternal(aName,
|
||||||
EmptyString(),
|
EmptyString(),
|
||||||
TypedEventHandler(),
|
TypedEventHandler(),
|
||||||
|
|
|
@ -491,7 +491,8 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
||||||
nsAutoCString statusText;
|
nsAutoCString statusText;
|
||||||
httpChannel->GetResponseStatusText(statusText);
|
httpChannel->GetResponseStatusText(statusText);
|
||||||
|
|
||||||
response = new InternalResponse(responseStatus, statusText);
|
response = new InternalResponse(responseStatus, statusText,
|
||||||
|
mRequest->GetCredentialsMode());
|
||||||
|
|
||||||
RefPtr<FillResponseHeaders> visitor = new FillResponseHeaders(response);
|
RefPtr<FillResponseHeaders> visitor = new FillResponseHeaders(response);
|
||||||
rv = httpChannel->VisitResponseHeaders(visitor);
|
rv = httpChannel->VisitResponseHeaders(visitor);
|
||||||
|
@ -511,7 +512,8 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
||||||
result);
|
result);
|
||||||
MOZ_ASSERT(!result.Failed());
|
MOZ_ASSERT(!result.Failed());
|
||||||
} else {
|
} else {
|
||||||
response = new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
|
response = new InternalResponse(200, NS_LITERAL_CSTRING("OK"),
|
||||||
|
mRequest->GetCredentialsMode());
|
||||||
|
|
||||||
ErrorResult result;
|
ErrorResult result;
|
||||||
nsAutoCString contentType;
|
nsAutoCString contentType;
|
||||||
|
@ -615,9 +617,12 @@ FetchDriver::OnDataAvailable(nsIRequest* aRequest,
|
||||||
// NB: This can be called on any thread! But we're guaranteed that it is
|
// NB: This can be called on any thread! But we're guaranteed that it is
|
||||||
// called between OnStartRequest and OnStopRequest, so we don't need to worry
|
// called between OnStartRequest and OnStopRequest, so we don't need to worry
|
||||||
// about races.
|
// about races.
|
||||||
|
if (!mResponse) {
|
||||||
|
MOZ_ASSERT(false);
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t aRead;
|
uint32_t aRead = 0;
|
||||||
MOZ_ASSERT(mResponse);
|
|
||||||
MOZ_ASSERT(mPipeOutputStream);
|
MOZ_ASSERT(mPipeOutputStream);
|
||||||
|
|
||||||
nsresult rv = aInputStream->ReadSegments(NS_CopySegmentToStream,
|
nsresult rv = aInputStream->ReadSegments(NS_CopySegmentToStream,
|
||||||
|
|
|
@ -300,7 +300,8 @@ InternalHeaders::BasicHeaders(InternalHeaders* aHeaders)
|
||||||
|
|
||||||
// static
|
// static
|
||||||
already_AddRefed<InternalHeaders>
|
already_AddRefed<InternalHeaders>
|
||||||
InternalHeaders::CORSHeaders(InternalHeaders* aHeaders)
|
InternalHeaders::CORSHeaders(InternalHeaders* aHeaders,
|
||||||
|
RequestCredentials aCredentialsMode)
|
||||||
{
|
{
|
||||||
RefPtr<InternalHeaders> cors = new InternalHeaders(aHeaders->mGuard);
|
RefPtr<InternalHeaders> cors = new InternalHeaders(aHeaders->mGuard);
|
||||||
ErrorResult result;
|
ErrorResult result;
|
||||||
|
@ -309,6 +310,7 @@ InternalHeaders::CORSHeaders(InternalHeaders* aHeaders)
|
||||||
aHeaders->Get(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"), acExposedNames, result);
|
aHeaders->Get(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"), acExposedNames, result);
|
||||||
MOZ_ASSERT(!result.Failed());
|
MOZ_ASSERT(!result.Failed());
|
||||||
|
|
||||||
|
bool allowAllHeaders = false;
|
||||||
nsAutoTArray<nsCString, 5> exposeNamesArray;
|
nsAutoTArray<nsCString, 5> exposeNamesArray;
|
||||||
nsCCharSeparatedTokenizer exposeTokens(acExposedNames, ',');
|
nsCCharSeparatedTokenizer exposeTokens(acExposedNames, ',');
|
||||||
while (exposeTokens.hasMoreTokens()) {
|
while (exposeTokens.hasMoreTokens()) {
|
||||||
|
@ -324,19 +326,27 @@ InternalHeaders::CORSHeaders(InternalHeaders* aHeaders)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (token.EqualsLiteral("*") &&
|
||||||
|
aCredentialsMode != RequestCredentials::Include) {
|
||||||
|
allowAllHeaders = true;
|
||||||
|
}
|
||||||
|
|
||||||
exposeNamesArray.AppendElement(token);
|
exposeNamesArray.AppendElement(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCaseInsensitiveCStringArrayComparator comp;
|
nsCaseInsensitiveCStringArrayComparator comp;
|
||||||
for (uint32_t i = 0; i < aHeaders->mList.Length(); ++i) {
|
for (uint32_t i = 0; i < aHeaders->mList.Length(); ++i) {
|
||||||
const Entry& entry = aHeaders->mList[i];
|
const Entry& entry = aHeaders->mList[i];
|
||||||
if (entry.mName.EqualsASCII("cache-control") ||
|
if (allowAllHeaders) {
|
||||||
entry.mName.EqualsASCII("content-language") ||
|
cors->Append(entry.mName, entry.mValue, result);
|
||||||
entry.mName.EqualsASCII("content-type") ||
|
MOZ_ASSERT(!result.Failed());
|
||||||
entry.mName.EqualsASCII("expires") ||
|
} else if (entry.mName.EqualsASCII("cache-control") ||
|
||||||
entry.mName.EqualsASCII("last-modified") ||
|
entry.mName.EqualsASCII("content-language") ||
|
||||||
entry.mName.EqualsASCII("pragma") ||
|
entry.mName.EqualsASCII("content-type") ||
|
||||||
exposeNamesArray.Contains(entry.mName, comp)) {
|
entry.mName.EqualsASCII("expires") ||
|
||||||
|
entry.mName.EqualsASCII("last-modified") ||
|
||||||
|
entry.mName.EqualsASCII("pragma") ||
|
||||||
|
exposeNamesArray.Contains(entry.mName, comp)) {
|
||||||
cors->Append(entry.mName, entry.mValue, result);
|
cors->Append(entry.mName, entry.mValue, result);
|
||||||
MOZ_ASSERT(!result.Failed());
|
MOZ_ASSERT(!result.Failed());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
// needed for HeadersGuardEnum.
|
// needed for HeadersGuardEnum.
|
||||||
#include "mozilla/dom/HeadersBinding.h"
|
#include "mozilla/dom/HeadersBinding.h"
|
||||||
|
#include "mozilla/dom/RequestBinding.h"
|
||||||
#include "mozilla/dom/UnionTypes.h"
|
#include "mozilla/dom/UnionTypes.h"
|
||||||
|
|
||||||
#include "nsClassHashtable.h"
|
#include "nsClassHashtable.h"
|
||||||
|
@ -103,7 +104,8 @@ public:
|
||||||
BasicHeaders(InternalHeaders* aHeaders);
|
BasicHeaders(InternalHeaders* aHeaders);
|
||||||
|
|
||||||
static already_AddRefed<InternalHeaders>
|
static already_AddRefed<InternalHeaders>
|
||||||
CORSHeaders(InternalHeaders* aHeaders);
|
CORSHeaders(InternalHeaders* aHeaders,
|
||||||
|
RequestCredentials mCredentialsMode = RequestCredentials::Omit);
|
||||||
|
|
||||||
void
|
void
|
||||||
GetEntries(nsTArray<InternalHeaders::Entry>& aEntries) const;
|
GetEntries(nsTArray<InternalHeaders::Entry>& aEntries) const;
|
||||||
|
|
|
@ -16,11 +16,14 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
InternalResponse::InternalResponse(uint16_t aStatus, const nsACString& aStatusText)
|
InternalResponse::InternalResponse(uint16_t aStatus,
|
||||||
|
const nsACString& aStatusText,
|
||||||
|
RequestCredentials aCredentialsMode)
|
||||||
: mType(ResponseType::Default)
|
: mType(ResponseType::Default)
|
||||||
, mStatus(aStatus)
|
, mStatus(aStatus)
|
||||||
, mStatusText(aStatusText)
|
, mStatusText(aStatusText)
|
||||||
, mHeaders(new InternalHeaders(HeadersGuardEnum::Response))
|
, mHeaders(new InternalHeaders(HeadersGuardEnum::Response))
|
||||||
|
, mCredentialsMode(aCredentialsMode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +79,7 @@ InternalResponse::CORSResponse()
|
||||||
MOZ_ASSERT(!mWrappedResponse, "Can't CORSResponse a already wrapped response");
|
MOZ_ASSERT(!mWrappedResponse, "Can't CORSResponse a already wrapped response");
|
||||||
RefPtr<InternalResponse> cors = CreateIncompleteCopy();
|
RefPtr<InternalResponse> cors = CreateIncompleteCopy();
|
||||||
cors->mType = ResponseType::Cors;
|
cors->mType = ResponseType::Cors;
|
||||||
cors->mHeaders = InternalHeaders::CORSHeaders(Headers());
|
cors->mHeaders = InternalHeaders::CORSHeaders(Headers(), mCredentialsMode);
|
||||||
cors->mWrappedResponse = this;
|
cors->mWrappedResponse = this;
|
||||||
return cors.forget();
|
return cors.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
#include "nsIInputStream.h"
|
#include "nsIInputStream.h"
|
||||||
#include "nsISupportsImpl.h"
|
#include "nsISupportsImpl.h"
|
||||||
|
|
||||||
|
#include "mozilla/dom/InternalHeaders.h"
|
||||||
#include "mozilla/dom/ResponseBinding.h"
|
#include "mozilla/dom/ResponseBinding.h"
|
||||||
|
#include "mozilla/dom/RequestBinding.h"
|
||||||
#include "mozilla/dom/ChannelInfo.h"
|
#include "mozilla/dom/ChannelInfo.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
||||||
|
@ -30,7 +32,8 @@ class InternalResponse final
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(InternalResponse)
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(InternalResponse)
|
||||||
|
|
||||||
InternalResponse(uint16_t aStatus, const nsACString& aStatusText);
|
InternalResponse(uint16_t aStatus, const nsACString& aStatusText,
|
||||||
|
RequestCredentials aCredentialsMode = RequestCredentials::Omit);
|
||||||
|
|
||||||
already_AddRefed<InternalResponse> Clone();
|
already_AddRefed<InternalResponse> Clone();
|
||||||
|
|
||||||
|
@ -241,6 +244,7 @@ private:
|
||||||
nsCOMPtr<nsIInputStream> mBody;
|
nsCOMPtr<nsIInputStream> mBody;
|
||||||
ChannelInfo mChannelInfo;
|
ChannelInfo mChannelInfo;
|
||||||
UniquePtr<mozilla::ipc::PrincipalInfo> mPrincipalInfo;
|
UniquePtr<mozilla::ipc::PrincipalInfo> mPrincipalInfo;
|
||||||
|
RequestCredentials mCredentialsMode;
|
||||||
|
|
||||||
// For filtered responses.
|
// For filtered responses.
|
||||||
// Cache, and SW interception should always serialize/access the underlying
|
// Cache, and SW interception should always serialize/access the underlying
|
||||||
|
|
|
@ -275,7 +275,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||||
|
|
||||||
request->SetURL(NS_ConvertUTF16toUTF8(requestURL));
|
request->SetURL(NS_ConvertUTF16toUTF8(requestURL));
|
||||||
fallbackMode = RequestMode::Cors;
|
fallbackMode = RequestMode::Cors;
|
||||||
fallbackCredentials = RequestCredentials::Omit;
|
fallbackCredentials = RequestCredentials::Same_origin;
|
||||||
fallbackCache = RequestCache::Default;
|
fallbackCache = RequestCache::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,8 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aInit.mBody.WasPassed() || temporaryBody) {
|
if ((aInit.mBody.WasPassed() && !aInit.mBody.Value().IsNull()) ||
|
||||||
|
temporaryBody) {
|
||||||
// HEAD and GET are not allowed to have a body.
|
// HEAD and GET are not allowed to have a body.
|
||||||
nsAutoCString method;
|
nsAutoCString method;
|
||||||
request->GetMethod(method);
|
request->GetMethod(method);
|
||||||
|
@ -377,29 +378,34 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aInit.mBody.WasPassed()) {
|
if (aInit.mBody.WasPassed()) {
|
||||||
const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& bodyInit = aInit.mBody.Value();
|
const Nullable<OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>& bodyInitNullable =
|
||||||
nsCOMPtr<nsIInputStream> stream;
|
aInit.mBody.Value();
|
||||||
nsAutoCString contentType;
|
if (!bodyInitNullable.IsNull()) {
|
||||||
aRv = ExtractByteStreamFromBody(bodyInit,
|
const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& bodyInit =
|
||||||
getter_AddRefs(stream), contentType);
|
bodyInitNullable.Value();
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
nsCOMPtr<nsIInputStream> stream;
|
||||||
return nullptr;
|
nsAutoCString contentType;
|
||||||
|
aRv = ExtractByteStreamFromBody(bodyInit,
|
||||||
|
getter_AddRefs(stream), contentType);
|
||||||
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
temporaryBody = stream;
|
||||||
|
|
||||||
|
if (!contentType.IsVoid() &&
|
||||||
|
!requestHeaders->Has(NS_LITERAL_CSTRING("Content-Type"), aRv)) {
|
||||||
|
requestHeaders->Append(NS_LITERAL_CSTRING("Content-Type"),
|
||||||
|
contentType, aRv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
request->ClearCreatedByFetchEvent();
|
||||||
|
request->SetBody(temporaryBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
temporaryBody = stream;
|
|
||||||
|
|
||||||
if (!contentType.IsVoid() &&
|
|
||||||
!requestHeaders->Has(NS_LITERAL_CSTRING("Content-Type"), aRv)) {
|
|
||||||
requestHeaders->Append(NS_LITERAL_CSTRING("Content-Type"),
|
|
||||||
contentType, aRv);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
request->ClearCreatedByFetchEvent();
|
|
||||||
request->SetBody(temporaryBody);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Request> domRequest = new Request(global, request);
|
RefPtr<Request> domRequest = new Request(global, request);
|
||||||
|
|
|
@ -545,17 +545,23 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
|
||||||
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
|
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
|
||||||
dest->mOriginalCanvas = this;
|
dest->mOriginalCanvas = this;
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> cxt;
|
// We make sure that the canvas is not zero sized since that would cause
|
||||||
dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
|
// the DrawImage call below to return an error, which would cause printing
|
||||||
RefPtr<CanvasRenderingContext2D> context2d =
|
// to fail.
|
||||||
static_cast<CanvasRenderingContext2D*>(cxt.get());
|
nsIntSize size = GetWidthHeight();
|
||||||
if (context2d && !mPrintCallback) {
|
if (size.height > 0 && size.width > 0) {
|
||||||
CanvasImageSource source;
|
nsCOMPtr<nsISupports> cxt;
|
||||||
source.SetAsHTMLCanvasElement() = this;
|
dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
|
||||||
ErrorResult err;
|
RefPtr<CanvasRenderingContext2D> context2d =
|
||||||
context2d->DrawImage(source,
|
static_cast<CanvasRenderingContext2D*>(cxt.get());
|
||||||
0.0, 0.0, err);
|
if (context2d && !mPrintCallback) {
|
||||||
rv = err.StealNSResult();
|
CanvasImageSource source;
|
||||||
|
source.SetAsHTMLCanvasElement() = this;
|
||||||
|
ErrorResult err;
|
||||||
|
context2d->DrawImage(source,
|
||||||
|
0.0, 0.0, err);
|
||||||
|
rv = err.StealNSResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -193,7 +193,12 @@ HTMLSharedObjectElement::SetAttr(int32_t aNameSpaceID, nsIAtom *aName,
|
||||||
// attributes before inserting the node into the document.
|
// attributes before inserting the node into the document.
|
||||||
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
|
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
|
||||||
aNameSpaceID == kNameSpaceID_None && aName == URIAttrName()) {
|
aNameSpaceID == kNameSpaceID_None && aName == URIAttrName()) {
|
||||||
return LoadObject(aNotify, true);
|
nsContentUtils::AddScriptRunner(NS_NewRunnableFunction(
|
||||||
|
[self = RefPtr<HTMLSharedObjectElement>(this), aNotify]() {
|
||||||
|
if (self->IsInComposedDoc()) {
|
||||||
|
self->LoadObject(aNotify, true);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -397,6 +397,7 @@ NS_IMETHODIMP
|
||||||
nsTextInputSelectionImpl::SetCaretReadOnly(bool aReadOnly)
|
nsTextInputSelectionImpl::SetCaretReadOnly(bool aReadOnly)
|
||||||
{
|
{
|
||||||
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
if (!mFrameSelection) return NS_ERROR_FAILURE;
|
||||||
nsresult result;
|
nsresult result;
|
||||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
||||||
if (shell)
|
if (shell)
|
||||||
|
|
|
@ -107,7 +107,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
||||||
// step 4 substep 1: check for .length on a String value.
|
// step 4 substep 1: check for .length on a String value.
|
||||||
if (currentVal.isString() && !tokenizer.hasMoreTokens() &&
|
if (currentVal.isString() && !tokenizer.hasMoreTokens() &&
|
||||||
token.EqualsLiteral("length") && aOptions == DoNotCreateProperties) {
|
token.EqualsLiteral("length") && aOptions == DoNotCreateProperties) {
|
||||||
aKeyJSVal->setNumber(double(JS_GetStringLength(currentVal.toString())));
|
aKeyJSVal->setNumber(uint32_t(JS_GetStringLength(currentVal.toString())));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
|
||||||
// Sandboxed document check: javascript: URI's are disabled
|
// Sandboxed document check: javascript: URI's are disabled
|
||||||
// in a sandboxed document unless 'allow-scripts' was specified.
|
// in a sandboxed document unless 'allow-scripts' was specified.
|
||||||
nsIDocument* doc = aOriginalInnerWindow->GetExtantDoc();
|
nsIDocument* doc = aOriginalInnerWindow->GetExtantDoc();
|
||||||
if (doc && (doc->GetSandboxFlags() & SANDBOXED_SCRIPTS)) {
|
if (doc && !doc->IsScriptEnabled()) {
|
||||||
return NS_ERROR_DOM_RETVAL_UNDEFINED;
|
return NS_ERROR_DOM_RETVAL_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -852,8 +852,9 @@ ADTSTrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize)
|
||||||
|
|
||||||
const int64_t streamLen = StreamLength();
|
const int64_t streamLen = StreamLength();
|
||||||
if (mInfo && streamLen > 0) {
|
if (mInfo && streamLen > 0) {
|
||||||
|
int64_t max = streamLen > aOffset ? streamLen - aOffset : 0;
|
||||||
// Prevent blocking reads after successful initialization.
|
// Prevent blocking reads after successful initialization.
|
||||||
aSize = std::min<int64_t>(aSize, streamLen - aOffset);
|
aSize = std::min<int64_t>(aSize, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read = 0;
|
uint32_t read = 0;
|
||||||
|
|
|
@ -157,7 +157,6 @@ MP3TrackDemuxer::SeekPosition() const {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_TESTS
|
|
||||||
const FrameParser::Frame&
|
const FrameParser::Frame&
|
||||||
MP3TrackDemuxer::LastFrame() const {
|
MP3TrackDemuxer::LastFrame() const {
|
||||||
return mParser.PrevFrame();
|
return mParser.PrevFrame();
|
||||||
|
@ -167,7 +166,6 @@ RefPtr<MediaRawData>
|
||||||
MP3TrackDemuxer::DemuxSample() {
|
MP3TrackDemuxer::DemuxSample() {
|
||||||
return GetNextFrame(FindNextFrame());
|
return GetNextFrame(FindNextFrame());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
const ID3Parser::ID3Header&
|
const ID3Parser::ID3Header&
|
||||||
MP3TrackDemuxer::ID3Header() const {
|
MP3TrackDemuxer::ID3Header() const {
|
||||||
|
@ -204,7 +202,7 @@ MP3TrackDemuxer::FastSeek(const TimeUnit& aTime) {
|
||||||
if (!aTime.ToMicroseconds()) {
|
if (!aTime.ToMicroseconds()) {
|
||||||
// Quick seek to the beginning of the stream.
|
// Quick seek to the beginning of the stream.
|
||||||
mFrameIndex = 0;
|
mFrameIndex = 0;
|
||||||
} else if (vbr.IsTOCPresent()) {
|
} else if (vbr.IsTOCPresent() && Duration().ToMicroseconds() > 0) {
|
||||||
// Use TOC for more precise seeking.
|
// Use TOC for more precise seeking.
|
||||||
const float durationFrac = static_cast<float>(aTime.ToMicroseconds()) /
|
const float durationFrac = static_cast<float>(aTime.ToMicroseconds()) /
|
||||||
Duration().ToMicroseconds();
|
Duration().ToMicroseconds();
|
||||||
|
@ -347,7 +345,7 @@ MP3TrackDemuxer::Duration() const {
|
||||||
|
|
||||||
int64_t numFrames = 0;
|
int64_t numFrames = 0;
|
||||||
const auto numAudioFrames = mParser.VBRInfo().NumAudioFrames();
|
const auto numAudioFrames = mParser.VBRInfo().NumAudioFrames();
|
||||||
if (numAudioFrames) {
|
if (mParser.VBRInfo().IsValid() && numAudioFrames.valueOr(0) + 1 > 1) {
|
||||||
// VBR headers don't include the VBR header frame.
|
// VBR headers don't include the VBR header frame.
|
||||||
numFrames = numAudioFrames.value() + 1;
|
numFrames = numAudioFrames.value() + 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -356,7 +354,9 @@ MP3TrackDemuxer::Duration() const {
|
||||||
// Unknown length, we can't estimate duration.
|
// Unknown length, we can't estimate duration.
|
||||||
return TimeUnit::FromMicroseconds(-1);
|
return TimeUnit::FromMicroseconds(-1);
|
||||||
}
|
}
|
||||||
numFrames = (streamLen - mFirstFrameOffset) / AverageFrameLength();
|
if (AverageFrameLength() > 0) {
|
||||||
|
numFrames = (streamLen - mFirstFrameOffset) / AverageFrameLength();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Duration(numFrames);
|
return Duration(numFrames);
|
||||||
}
|
}
|
||||||
|
@ -371,6 +371,55 @@ MP3TrackDemuxer::Duration(int64_t aNumFrames) const {
|
||||||
return TimeUnit::FromMicroseconds(aNumFrames * usPerFrame);
|
return TimeUnit::FromMicroseconds(aNumFrames * usPerFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MediaByteRange
|
||||||
|
MP3TrackDemuxer::FindFirstFrame() {
|
||||||
|
// Get engough successive frames to avoid invalid frame from cut stream.
|
||||||
|
// However, some website use very short mp3 file so using the same value as Chrome.
|
||||||
|
static const int MIN_SUCCESSIVE_FRAMES = 3;
|
||||||
|
|
||||||
|
MediaByteRange candidateFrame = FindNextFrame();
|
||||||
|
int numSuccFrames = candidateFrame.Length() > 0;
|
||||||
|
MediaByteRange currentFrame = candidateFrame;
|
||||||
|
MP3LOGV("FindFirst() first candidate frame: mOffset=%" PRIu64 " Length()=%" PRIu64,
|
||||||
|
candidateFrame.mStart, candidateFrame.Length());
|
||||||
|
|
||||||
|
while (candidateFrame.Length() && numSuccFrames < MIN_SUCCESSIVE_FRAMES) {
|
||||||
|
mParser.EndFrameSession();
|
||||||
|
mOffset = currentFrame.mEnd;
|
||||||
|
const MediaByteRange prevFrame = currentFrame;
|
||||||
|
|
||||||
|
// FindNextFrame() here will only return frames consistent with our candidate frame.
|
||||||
|
currentFrame = FindNextFrame();
|
||||||
|
numSuccFrames += currentFrame.Length() > 0;
|
||||||
|
// Multiple successive false positives, which wouldn't be caught by the consistency
|
||||||
|
// checks alone, can be detected by wrong alignment (non-zero gap between frames).
|
||||||
|
const int64_t frameSeparation = currentFrame.mStart - prevFrame.mEnd;
|
||||||
|
|
||||||
|
if (!currentFrame.Length() || frameSeparation != 0) {
|
||||||
|
MP3LOGV("FindFirst() not enough successive frames detected, "
|
||||||
|
"rejecting candidate frame: successiveFrames=%d, last Length()=%" PRIu64
|
||||||
|
", last frameSeparation=%" PRId64, numSuccFrames, currentFrame.Length(),
|
||||||
|
frameSeparation);
|
||||||
|
|
||||||
|
mParser.ResetFrameData();
|
||||||
|
mOffset = candidateFrame.mStart + 1;
|
||||||
|
candidateFrame = FindNextFrame();
|
||||||
|
numSuccFrames = candidateFrame.Length() > 0;
|
||||||
|
currentFrame = candidateFrame;
|
||||||
|
MP3LOGV("FindFirst() new candidate frame: mOffset=%" PRIu64 " Length()=%" PRIu64,
|
||||||
|
candidateFrame.mStart, candidateFrame.Length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numSuccFrames >= MIN_SUCCESSIVE_FRAMES) {
|
||||||
|
MP3LOG("FindFirst() accepting candidate frame: "
|
||||||
|
"successiveFrames=%d", numSuccFrames);
|
||||||
|
} else {
|
||||||
|
MP3LOG("FindFirst() no suitable first frame found");
|
||||||
|
}
|
||||||
|
return candidateFrame;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
VerifyFrameConsistency(
|
VerifyFrameConsistency(
|
||||||
const FrameParser::Frame& aFrame1, const FrameParser::Frame& aFrame2) {
|
const FrameParser::Frame& aFrame1, const FrameParser::Frame& aFrame2) {
|
||||||
|
@ -511,7 +560,6 @@ MP3TrackDemuxer::GetNextFrame(const MediaByteRange& aRange) {
|
||||||
|
|
||||||
if (mNumParsedFrames == 1) {
|
if (mNumParsedFrames == 1) {
|
||||||
// First frame parsed, let's read VBR info if available.
|
// First frame parsed, let's read VBR info if available.
|
||||||
// TODO: read info that helps with seeking (bug 1163667).
|
|
||||||
ByteReader reader(frame->Data(), frame->Size());
|
ByteReader reader(frame->Data(), frame->Size());
|
||||||
mParser.ParseVBRHeader(&reader);
|
mParser.ParseVBRHeader(&reader);
|
||||||
reader.DiscardRemaining();
|
reader.DiscardRemaining();
|
||||||
|
@ -532,7 +580,7 @@ MP3TrackDemuxer::OffsetFromFrameIndex(int64_t aFrameIndex) const {
|
||||||
int64_t offset = 0;
|
int64_t offset = 0;
|
||||||
const auto& vbr = mParser.VBRInfo();
|
const auto& vbr = mParser.VBRInfo();
|
||||||
|
|
||||||
if (vbr.NumBytes() && vbr.NumAudioFrames()) {
|
if (vbr.IsComplete()) {
|
||||||
offset = mFirstFrameOffset + aFrameIndex * vbr.NumBytes().value() /
|
offset = mFirstFrameOffset + aFrameIndex * vbr.NumBytes().value() /
|
||||||
vbr.NumAudioFrames().value();
|
vbr.NumAudioFrames().value();
|
||||||
} else if (AverageFrameLength() > 0) {
|
} else if (AverageFrameLength() > 0) {
|
||||||
|
@ -548,7 +596,7 @@ MP3TrackDemuxer::FrameIndexFromOffset(int64_t aOffset) const {
|
||||||
int64_t frameIndex = 0;
|
int64_t frameIndex = 0;
|
||||||
const auto& vbr = mParser.VBRInfo();
|
const auto& vbr = mParser.VBRInfo();
|
||||||
|
|
||||||
if (vbr.NumBytes() && vbr.NumAudioFrames()) {
|
if (vbr.IsComplete()) {
|
||||||
frameIndex = static_cast<float>(aOffset - mFirstFrameOffset) /
|
frameIndex = static_cast<float>(aOffset - mFirstFrameOffset) /
|
||||||
vbr.NumBytes().value() * vbr.NumAudioFrames().value();
|
vbr.NumBytes().value() * vbr.NumAudioFrames().value();
|
||||||
frameIndex = std::min<int64_t>(vbr.NumAudioFrames().value(), frameIndex);
|
frameIndex = std::min<int64_t>(vbr.NumAudioFrames().value(), frameIndex);
|
||||||
|
@ -607,7 +655,8 @@ MP3TrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) {
|
||||||
const int64_t streamLen = StreamLength();
|
const int64_t streamLen = StreamLength();
|
||||||
if (mInfo && streamLen > 0) {
|
if (mInfo && streamLen > 0) {
|
||||||
// Prevent blocking reads after successful initialization.
|
// Prevent blocking reads after successful initialization.
|
||||||
aSize = std::min<int64_t>(aSize, streamLen - aOffset);
|
uint64_t max = streamLen > aOffset ? streamLen - aOffset : 0;
|
||||||
|
aSize = std::min<int64_t>(aSize, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read = 0;
|
uint32_t read = 0;
|
||||||
|
@ -624,7 +673,7 @@ MP3TrackDemuxer::AverageFrameLength() const {
|
||||||
return static_cast<double>(mTotalFrameLen) / mNumParsedFrames;
|
return static_cast<double>(mTotalFrameLen) / mNumParsedFrames;
|
||||||
}
|
}
|
||||||
const auto& vbr = mParser.VBRInfo();
|
const auto& vbr = mParser.VBRInfo();
|
||||||
if (vbr.NumBytes() && vbr.NumAudioFrames()) {
|
if (vbr.IsComplete() && vbr.NumAudioFrames().value() + 1) {
|
||||||
return static_cast<double>(vbr.NumBytes().value()) /
|
return static_cast<double>(vbr.NumBytes().value()) /
|
||||||
(vbr.NumAudioFrames().value() + 1);
|
(vbr.NumAudioFrames().value() + 1);
|
||||||
}
|
}
|
||||||
|
@ -651,15 +700,20 @@ FrameParser::Reset() {
|
||||||
mFrame.Reset();
|
mFrame.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FrameParser::ResetFrameData() {
|
||||||
|
mFrame.Reset();
|
||||||
|
mFirstFrame.Reset();
|
||||||
|
mPrevFrame.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FrameParser::EndFrameSession() {
|
FrameParser::EndFrameSession() {
|
||||||
if (!mID3Parser.Header().IsValid()) {
|
if (!mID3Parser.Header().IsValid()) {
|
||||||
// Reset ID3 tags only if we have not parsed a valid ID3 header yet.
|
// Reset ID3 tags only if we have not parsed a valid ID3 header yet.
|
||||||
mID3Parser.Reset();
|
mID3Parser.Reset();
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_TESTS
|
|
||||||
mPrevFrame = mFrame;
|
mPrevFrame = mFrame;
|
||||||
#endif
|
|
||||||
mFrame.Reset();
|
mFrame.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,12 +722,10 @@ FrameParser::CurrentFrame() const {
|
||||||
return mFrame;
|
return mFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_TESTS
|
|
||||||
const FrameParser::Frame&
|
const FrameParser::Frame&
|
||||||
FrameParser::PrevFrame() const {
|
FrameParser::PrevFrame() const {
|
||||||
return mPrevFrame;
|
return mPrevFrame;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
const FrameParser::Frame&
|
const FrameParser::Frame&
|
||||||
FrameParser::FirstFrame() const {
|
FrameParser::FirstFrame() const {
|
||||||
|
@ -960,6 +1012,21 @@ FrameParser::VBRHeader::IsTOCPresent() const {
|
||||||
return mTOC.size() == vbr_header::TOC_SIZE;
|
return mTOC.size() == vbr_header::TOC_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
FrameParser::VBRHeader::IsValid() const {
|
||||||
|
return mType != NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
FrameParser::VBRHeader::IsComplete() const {
|
||||||
|
return IsValid() &&
|
||||||
|
mNumAudioFrames.valueOr(0) > 0 &&
|
||||||
|
mNumBytes.valueOr(0) > 0 &&
|
||||||
|
// We don't care about the scale for any computations here.
|
||||||
|
// mScale < 101 &&
|
||||||
|
true;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
FrameParser::VBRHeader::Offset(float aDurationFac) const {
|
FrameParser::VBRHeader::Offset(float aDurationFac) const {
|
||||||
if (!IsTOCPresent()) {
|
if (!IsTOCPresent()) {
|
||||||
|
@ -1047,7 +1114,7 @@ FrameParser::VBRHeader::ParseVBRI(ByteReader* aReader) {
|
||||||
MOZ_ASSERT(aReader);
|
MOZ_ASSERT(aReader);
|
||||||
// ParseVBRI assumes that the ByteReader offset points to the beginning of a frame,
|
// ParseVBRI assumes that the ByteReader offset points to the beginning of a frame,
|
||||||
// therefore as a simple check, we look for the presence of a frame sync at that position.
|
// therefore as a simple check, we look for the presence of a frame sync at that position.
|
||||||
MOZ_ASSERT(aReader->PeekU16() & 0xFFE0);
|
MOZ_ASSERT((aReader->PeekU16() & 0xFFE0) == 0xFFE0);
|
||||||
const size_t prevReaderOffset = aReader->Offset();
|
const size_t prevReaderOffset = aReader->Offset();
|
||||||
|
|
||||||
// VBRI have a fixed relative position, so let's check for it there.
|
// VBRI have a fixed relative position, so let's check for it there.
|
||||||
|
|
|
@ -232,6 +232,12 @@ public:
|
||||||
// Returns true iff Xing/Info TOC (table of contents) is present.
|
// Returns true iff Xing/Info TOC (table of contents) is present.
|
||||||
bool IsTOCPresent() const;
|
bool IsTOCPresent() const;
|
||||||
|
|
||||||
|
// Returns whether the header is valid (type XING or VBRI).
|
||||||
|
bool IsValid() const;
|
||||||
|
|
||||||
|
// Returns whether the header is valid and contains reasonable non-zero field values.
|
||||||
|
bool IsComplete() const;
|
||||||
|
|
||||||
// Returns the byte offset for the given duration percentage as a factor
|
// Returns the byte offset for the given duration percentage as a factor
|
||||||
// (0: begin, 1.0: end).
|
// (0: begin, 1.0: end).
|
||||||
int64_t Offset(float aDurationFac) const;
|
int64_t Offset(float aDurationFac) const;
|
||||||
|
@ -298,10 +304,8 @@ public:
|
||||||
// Returns the currently parsed frame. Reset via Reset or EndFrameSession.
|
// Returns the currently parsed frame. Reset via Reset or EndFrameSession.
|
||||||
const Frame& CurrentFrame() const;
|
const Frame& CurrentFrame() const;
|
||||||
|
|
||||||
#ifdef ENABLE_TESTS
|
|
||||||
// Returns the previously parsed frame. Reset via Reset.
|
// Returns the previously parsed frame. Reset via Reset.
|
||||||
const Frame& PrevFrame() const;
|
const Frame& PrevFrame() const;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Returns the first parsed frame. Reset via Reset.
|
// Returns the first parsed frame. Reset via Reset.
|
||||||
const Frame& FirstFrame() const;
|
const Frame& FirstFrame() const;
|
||||||
|
@ -312,9 +316,13 @@ public:
|
||||||
// Returns the parsed VBR header info. Note: check for validity by type.
|
// Returns the parsed VBR header info. Note: check for validity by type.
|
||||||
const VBRHeader& VBRInfo() const;
|
const VBRHeader& VBRInfo() const;
|
||||||
|
|
||||||
// Resets the parser. Don't use between frames as first frame data is reset.
|
// Resets the parser.
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
// Resets all frame data, but not the ID3Header.
|
||||||
|
// Don't use between frames as first frame data is reset.
|
||||||
|
void ResetFrameData();
|
||||||
|
|
||||||
// Clear the last parsed frame to allow for next frame parsing, i.e.:
|
// Clear the last parsed frame to allow for next frame parsing, i.e.:
|
||||||
// - sets PrevFrame to CurrentFrame
|
// - sets PrevFrame to CurrentFrame
|
||||||
// - resets the CurrentFrame
|
// - resets the CurrentFrame
|
||||||
|
@ -344,9 +352,7 @@ private:
|
||||||
// previously parsed frame for debugging and the currently parsed frame.
|
// previously parsed frame for debugging and the currently parsed frame.
|
||||||
Frame mFirstFrame;
|
Frame mFirstFrame;
|
||||||
Frame mFrame;
|
Frame mFrame;
|
||||||
#ifdef ENABLE_TESTS
|
|
||||||
Frame mPrevFrame;
|
Frame mPrevFrame;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The MP3 demuxer used to extract MPEG frames and side information out of
|
// The MP3 demuxer used to extract MPEG frames and side information out of
|
||||||
|
@ -373,10 +379,8 @@ public:
|
||||||
// Returns the estimated current seek position time.
|
// Returns the estimated current seek position time.
|
||||||
media::TimeUnit SeekPosition() const;
|
media::TimeUnit SeekPosition() const;
|
||||||
|
|
||||||
#ifdef ENABLE_TESTS
|
|
||||||
const FrameParser::Frame& LastFrame() const;
|
const FrameParser::Frame& LastFrame() const;
|
||||||
RefPtr<MediaRawData> DemuxSample();
|
RefPtr<MediaRawData> DemuxSample();
|
||||||
#endif
|
|
||||||
|
|
||||||
const ID3Parser::ID3Header& ID3Header() const;
|
const ID3Parser::ID3Header& ID3Header() const;
|
||||||
const FrameParser::VBRHeader& VBRInfo() const;
|
const FrameParser::VBRHeader& VBRInfo() const;
|
||||||
|
@ -401,7 +405,12 @@ private:
|
||||||
// Seeks by scanning the stream up to the given time for more accurate results.
|
// Seeks by scanning the stream up to the given time for more accurate results.
|
||||||
media::TimeUnit ScanUntil(const media::TimeUnit& aTime);
|
media::TimeUnit ScanUntil(const media::TimeUnit& aTime);
|
||||||
|
|
||||||
// Finds the next valid frame and returns its byte range.
|
// Finds the first valid frame and returns its byte range if found
|
||||||
|
// or a null-byte range otherwise.
|
||||||
|
MediaByteRange FindFirstFrame();
|
||||||
|
|
||||||
|
// Finds the next valid frame and returns its byte range if found
|
||||||
|
// or a null-byte range otherwise.
|
||||||
MediaByteRange FindNextFrame();
|
MediaByteRange FindNextFrame();
|
||||||
|
|
||||||
// Skips the next frame given the provided byte range.
|
// Skips the next frame given the provided byte range.
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
#include "FFmpegLog.h"
|
#include "FFmpegLog.h"
|
||||||
#include "FFmpegDataDecoder.h"
|
#include "FFmpegDataDecoder.h"
|
||||||
|
@ -41,6 +42,7 @@ FFmpegDataDecoder<LIBAV_VER>::FFmpegDataDecoder(FlushableTaskQueue* aTaskQueue,
|
||||||
, mMonitor("FFMpegaDataDecoder")
|
, mMonitor("FFMpegaDataDecoder")
|
||||||
, mIsFlushing(false)
|
, mIsFlushing(false)
|
||||||
, mCodecParser(nullptr)
|
, mCodecParser(nullptr)
|
||||||
|
, mHQ(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(FFmpegDataDecoder);
|
MOZ_COUNT_CTOR(FFmpegDataDecoder);
|
||||||
}
|
}
|
||||||
|
@ -108,10 +110,27 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
|
||||||
// FFmpeg will call back to this to negotiate a video pixel format.
|
// FFmpeg will call back to this to negotiate a video pixel format.
|
||||||
mCodecContext->get_format = ChoosePixelFormat;
|
mCodecContext->get_format = ChoosePixelFormat;
|
||||||
|
|
||||||
mCodecContext->thread_count = PR_GetNumberOfProcessors();
|
//mCodecContext->thread_count = PR_GetNumberOfProcessors();
|
||||||
|
// PR_GetNumberOfProcessors() lies on TenFourFox. Get from sysctl().
|
||||||
|
// TenFourFox issue 599.
|
||||||
|
int mib[2] = { CTL_HW, HW_NCPU };
|
||||||
|
size_t len = sizeof(mCodecContext->thread_count);
|
||||||
|
if (sysctl(mib, 2, &(mCodecContext->thread_count), &len, NULL, 0) == -1)
|
||||||
|
mCodecContext->thread_count = 1;
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr, "FFmpeg using %d CPUs.\n", mCodecContext->thread_count);
|
||||||
|
#endif
|
||||||
mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;
|
mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;
|
||||||
mCodecContext->thread_safe_callbacks = false;
|
mCodecContext->thread_safe_callbacks = false;
|
||||||
|
|
||||||
|
if (!mHQ) {
|
||||||
|
// Enable skipping the loop filter and FFmpeg's lightly documented
|
||||||
|
// non-spec-compliant mode. TenFourFox issue 599. This is pushed here
|
||||||
|
// because this is not on the main thread, so we assert.
|
||||||
|
mCodecContext->flags2 |= CODEC_FLAG2_FAST;
|
||||||
|
mCodecContext->skip_loop_filter = AVDISCARD_ALL;
|
||||||
|
}
|
||||||
|
|
||||||
if (mExtraData) {
|
if (mExtraData) {
|
||||||
mCodecContext->extradata_size = mExtraData->Length();
|
mCodecContext->extradata_size = mExtraData->Length();
|
||||||
// FFmpeg may use SIMD instructions to access the data which reads the
|
// FFmpeg may use SIMD instructions to access the data which reads the
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
|
|
||||||
static AVCodec* FindAVCodec(AVCodecID aCodec);
|
static AVCodec* FindAVCodec(AVCodecID aCodec);
|
||||||
|
|
||||||
|
bool mHQ; // TenFourFox high quality mode (issue 599)
|
||||||
protected:
|
protected:
|
||||||
// Flush and Drain operation, always run
|
// Flush and Drain operation, always run
|
||||||
virtual void ProcessFlush();
|
virtual void ProcessFlush();
|
||||||
|
|
|
@ -19,14 +19,14 @@ class FFmpegDecoderModule : public PlatformDecoderModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static already_AddRefed<PlatformDecoderModule>
|
static already_AddRefed<PlatformDecoderModule>
|
||||||
Create()
|
Create(bool hq)
|
||||||
{
|
{
|
||||||
RefPtr<PlatformDecoderModule> pdm = new FFmpegDecoderModule();
|
RefPtr<PlatformDecoderModule> pdm = new FFmpegDecoderModule(hq);
|
||||||
|
|
||||||
return pdm.forget();
|
return pdm.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
FFmpegDecoderModule() {}
|
FFmpegDecoderModule(bool hq) : mHQ(hq) {}
|
||||||
virtual ~FFmpegDecoderModule() {}
|
virtual ~FFmpegDecoderModule() {}
|
||||||
|
|
||||||
already_AddRefed<MediaDataDecoder>
|
already_AddRefed<MediaDataDecoder>
|
||||||
|
@ -75,6 +75,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mHQ; // TenFourFox high quality mode (issue 599).
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -35,6 +35,7 @@ FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::PtsCorrectionContext()
|
||||||
// PRIntervalTime is insufficient since the timeout length may be
|
// PRIntervalTime is insufficient since the timeout length may be
|
||||||
// many seconds.
|
// many seconds.
|
||||||
static PRTime sLockOutDueToOOM = 0L;
|
static PRTime sLockOutDueToOOM = 0L;
|
||||||
|
static bool sIsLockedOut = false;
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::GuessCorrectPts(int64_t aPts, int64_t aDts)
|
FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::GuessCorrectPts(int64_t aPts, int64_t aDts)
|
||||||
|
@ -99,11 +100,14 @@ FFmpegH264Decoder<LIBAV_VER>::DecodeResult
|
||||||
FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample)
|
FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
|
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
|
||||||
if (PR_Now() < sLockOutDueToOOM) {
|
if (MOZ_UNLIKELY(sIsLockedOut)) {
|
||||||
// Halt further allocations.
|
if (PR_Now() < sLockOutDueToOOM) {
|
||||||
NS_WARNING("** FFMPEG LOCKED OUT DUE TO OUT OF MEMORY **");
|
// Halt further allocations.
|
||||||
mCallback->Error();
|
NS_WARNING("** FFMPEG LOCKED OUT DUE TO OUT OF MEMORY **");
|
||||||
return DecodeResult::DECODE_ERROR;
|
mCallback->Error();
|
||||||
|
return DecodeResult::DECODE_ERROR;
|
||||||
|
}
|
||||||
|
sIsLockedOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* inputData = const_cast<uint8_t*>(aSample->Data());
|
uint8_t* inputData = const_cast<uint8_t*>(aSample->Data());
|
||||||
|
@ -152,11 +156,14 @@ FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample,
|
||||||
uint8_t* aData, int aSize)
|
uint8_t* aData, int aSize)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
|
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
|
||||||
if (PR_Now() < sLockOutDueToOOM) {
|
if (MOZ_UNLIKELY(sIsLockedOut)) {
|
||||||
// Halt further allocations.
|
if (PR_Now() < sLockOutDueToOOM) {
|
||||||
NS_WARNING("** FFMPEG LOCKED OUT DUE TO OUT OF MEMORY **");
|
// Halt further allocations.
|
||||||
mCallback->Error();
|
NS_WARNING("** FFMPEG LOCKED OUT DUE TO OUT OF MEMORY **");
|
||||||
return DecodeResult::DECODE_ERROR;
|
mCallback->Error();
|
||||||
|
return DecodeResult::DECODE_ERROR;
|
||||||
|
}
|
||||||
|
sIsLockedOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVPacket packet;
|
AVPacket packet;
|
||||||
|
@ -254,6 +261,7 @@ FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample,
|
||||||
if (!v) {
|
if (!v) {
|
||||||
int32_t lockout = 3; /* XXX: make a pref */
|
int32_t lockout = 3; /* XXX: make a pref */
|
||||||
fprintf(stderr, "Warning: TenFourFox ran out of memory trying to decode H.264 video.\nAny H.264 video on any page playing in the next %i seconds will be blocked.\n", lockout);
|
fprintf(stderr, "Warning: TenFourFox ran out of memory trying to decode H.264 video.\nAny H.264 video on any page playing in the next %i seconds will be blocked.\n", lockout);
|
||||||
|
sIsLockedOut = true;
|
||||||
sLockOutDueToOOM = PR_Now() + ( PR_USEC_PER_SEC * lockout );
|
sLockOutDueToOOM = PR_Now() + ( PR_USEC_PER_SEC * lockout );
|
||||||
mCallback->Error();
|
mCallback->Error();
|
||||||
return DecodeResult::DECODE_ERROR;
|
return DecodeResult::DECODE_ERROR;
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif /* XP_DARWIN */
|
#endif /* XP_DARWIN */
|
||||||
|
|
||||||
|
/* TenFourFox issue 599 */
|
||||||
|
static bool sHQ = false;
|
||||||
|
|
||||||
namespace mozilla
|
namespace mozilla
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -26,7 +29,7 @@ FFmpegRuntimeLinker::LinkStatus FFmpegRuntimeLinker::sLinkStatus =
|
||||||
template <int V> class FFmpegDecoderModule
|
template <int V> class FFmpegDecoderModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static already_AddRefed<PlatformDecoderModule> Create();
|
static already_AddRefed<PlatformDecoderModule> Create(bool hq);
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* sLibs[] = {
|
static const char* sLibs[] = {
|
||||||
|
@ -175,6 +178,9 @@ FFmpegRuntimeLinker::Bind(const char* aLibName)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is the only safe place to get preferences. TenFourFox issue 599. */
|
||||||
|
sHQ = Preferences::GetBool("tenfourfox.mp4.high_quality", false);
|
||||||
|
|
||||||
int version;
|
int version;
|
||||||
switch (major) {
|
switch (major) {
|
||||||
case 53:
|
case 53:
|
||||||
|
@ -243,11 +249,11 @@ FFmpegRuntimeLinker::CreateDecoderModule()
|
||||||
|
|
||||||
RefPtr<PlatformDecoderModule> module;
|
RefPtr<PlatformDecoderModule> module;
|
||||||
switch (major) {
|
switch (major) {
|
||||||
case 53: module = FFmpegDecoderModule<53>::Create(); break;
|
case 53: module = FFmpegDecoderModule<53>::Create(sHQ); break;
|
||||||
case 54: module = FFmpegDecoderModule<54>::Create(); break;
|
case 54: module = FFmpegDecoderModule<54>::Create(sHQ); break;
|
||||||
case 55:
|
case 55:
|
||||||
case 56: module = FFmpegDecoderModule<55>::Create(); break;
|
case 56: module = FFmpegDecoderModule<55>::Create(sHQ); break;
|
||||||
case 57: module = FFmpegDecoderModule<57>::Create(); break;
|
case 57: module = FFmpegDecoderModule<57>::Create(sHQ); break;
|
||||||
default: module = nullptr;
|
default: module = nullptr;
|
||||||
}
|
}
|
||||||
return module.forget();
|
return module.forget();
|
||||||
|
|
|
@ -673,32 +673,52 @@ nsCSPContext::logToConsole(const char16_t* aName,
|
||||||
* Strip URI for reporting according to:
|
* Strip URI for reporting according to:
|
||||||
* http://www.w3.org/TR/CSP/#violation-reports
|
* http://www.w3.org/TR/CSP/#violation-reports
|
||||||
*
|
*
|
||||||
|
* @param aSelfURI
|
||||||
|
* The URI of the CSP policy. Used for cross-origin checks.
|
||||||
* @param aURI
|
* @param aURI
|
||||||
* The uri to be stripped for reporting
|
* The uri to be stripped for reporting
|
||||||
* @param aProtectedResourcePrincipal
|
* @param aProtectedResourcePrincipal
|
||||||
* The loadingPrincipal of the protected resource
|
* The loadingPrincipal of the protected resource
|
||||||
* which is needed to enforce the SOP.
|
* which is needed to enforce the SOP.
|
||||||
|
* @param aEffectiveDirective
|
||||||
|
* The effective directive that triggered this report
|
||||||
* @return ASCII serialization of the uri to be reported.
|
* @return ASCII serialization of the uri to be reported.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
StripURIForReporting(nsIURI* aURI,
|
StripURIForReporting(nsIURI* aSelfURI, nsIURI* aURI,
|
||||||
nsIPrincipal* aProtectedResourcePrincipal,
|
nsIPrincipal* aProtectedResourcePrincipal,
|
||||||
|
const nsAString& aEffectiveDirective,
|
||||||
nsACString& outStrippedURI)
|
nsACString& outStrippedURI)
|
||||||
{
|
{
|
||||||
// 1) If the origin of uri is a globally unique identifier (for example,
|
// 1) If the origin of uri is a globally unique identifier (for example,
|
||||||
// aURI has a scheme of data, blob, or filesystem), then return the
|
// aURI has a scheme of data, blob, or filesystem), then return the
|
||||||
// ASCII serialization of uri’s scheme.
|
// ASCII serialization of uri’s scheme.
|
||||||
bool isHttp =
|
bool isHttpFtpOrWs =
|
||||||
(NS_SUCCEEDED(aURI->SchemeIs("http", &isHttp)) && isHttp) ||
|
(NS_SUCCEEDED(aURI->SchemeIs("https", &isHttpFtpOrWs)) && isHttpFtpOrWs) ||
|
||||||
(NS_SUCCEEDED(aURI->SchemeIs("https", &isHttp)) && isHttp);
|
(NS_SUCCEEDED(aURI->SchemeIs("http", &isHttpFtpOrWs)) && isHttpFtpOrWs) ||
|
||||||
if (!isHttp) {
|
(NS_SUCCEEDED(aURI->SchemeIs("wss", &isHttpFtpOrWs)) && isHttpFtpOrWs) ||
|
||||||
|
(NS_SUCCEEDED(aURI->SchemeIs("ws", &isHttpFtpOrWs)) && isHttpFtpOrWs) ||
|
||||||
|
(NS_SUCCEEDED(aURI->SchemeIs("ftp", &isHttpFtpOrWs)) && isHttpFtpOrWs);
|
||||||
|
if (!isHttpFtpOrWs) {
|
||||||
// not strictly spec compliant, but what we really care about is
|
// not strictly spec compliant, but what we really care about is
|
||||||
// http/https. If it's not http/https, then treat aURI as if
|
// http/https and also ftp. If it's not http/https or ftp, then treat aURI
|
||||||
// it's a globally unique identifier and just return the scheme.
|
// as if it's a globally unique identifier and just return the scheme.
|
||||||
aURI->GetScheme(outStrippedURI);
|
aURI->GetScheme(outStrippedURI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For cross-origin URIs in frame-src also strip the path.
|
||||||
|
// This prevents detailed tracking of pages loaded into an iframe
|
||||||
|
// by the embedding page using a report-only policy.
|
||||||
|
if (aEffectiveDirective.EqualsLiteral("frame-src") ||
|
||||||
|
aEffectiveDirective.EqualsLiteral("object-src")) {
|
||||||
|
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||||
|
if (NS_FAILED(ssm->CheckSameOriginURI(aSelfURI, aURI, false))) {
|
||||||
|
aURI->GetPrePath(outStrippedURI);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 2) If the origin of uri is not the same as the origin of the protected
|
// 2) If the origin of uri is not the same as the origin of the protected
|
||||||
// resource, then return the ASCII serialization of uri’s origin.
|
// resource, then return the ASCII serialization of uri’s origin.
|
||||||
bool sameOrigin =
|
bool sameOrigin =
|
||||||
|
@ -740,6 +760,11 @@ nsCSPContext::SendReports(nsISupports* aBlockedContentSource,
|
||||||
nsAString& aScriptSample,
|
nsAString& aScriptSample,
|
||||||
uint32_t aLineNum)
|
uint32_t aLineNum)
|
||||||
{
|
{
|
||||||
|
/* Due to unclear vulnerabilities in bug 1542194 and others, just don't.
|
||||||
|
We probably don't do it right anymore anyway. -- Cameron */
|
||||||
|
if (!Preferences::GetBool("security.csp.sendreports", false))
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
NS_ENSURE_ARG_MAX(aViolatedPolicyIndex, mPolicies.Length() - 1);
|
NS_ENSURE_ARG_MAX(aViolatedPolicyIndex, mPolicies.Length() - 1);
|
||||||
|
|
||||||
#ifdef MOZ_B2G
|
#ifdef MOZ_B2G
|
||||||
|
@ -760,7 +785,8 @@ nsCSPContext::SendReports(nsISupports* aBlockedContentSource,
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(aBlockedContentSource);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(aBlockedContentSource);
|
||||||
// could be a string or URI
|
// could be a string or URI
|
||||||
if (uri) {
|
if (uri) {
|
||||||
StripURIForReporting(uri, mLoadingPrincipal, reportBlockedURI);
|
StripURIForReporting(mSelfURI, uri, mLoadingPrincipal, aViolatedDirective,
|
||||||
|
reportBlockedURI);
|
||||||
} else {
|
} else {
|
||||||
nsCOMPtr<nsISupportsCString> cstr = do_QueryInterface(aBlockedContentSource);
|
nsCOMPtr<nsISupportsCString> cstr = do_QueryInterface(aBlockedContentSource);
|
||||||
if (cstr) {
|
if (cstr) {
|
||||||
|
@ -777,7 +803,8 @@ nsCSPContext::SendReports(nsISupports* aBlockedContentSource,
|
||||||
|
|
||||||
// document-uri
|
// document-uri
|
||||||
nsAutoCString reportDocumentURI;
|
nsAutoCString reportDocumentURI;
|
||||||
StripURIForReporting(mSelfURI, mLoadingPrincipal, reportDocumentURI);
|
StripURIForReporting(mSelfURI, mSelfURI, mLoadingPrincipal,
|
||||||
|
aViolatedDirective, reportDocumentURI);
|
||||||
report.mCsp_report.mDocument_uri = NS_ConvertUTF8toUTF16(reportDocumentURI);
|
report.mCsp_report.mDocument_uri = NS_ConvertUTF8toUTF16(reportDocumentURI);
|
||||||
|
|
||||||
// original-policy
|
// original-policy
|
||||||
|
|
|
@ -574,7 +574,8 @@ nsCSPParser::keywordSource()
|
||||||
// Special case handling for 'self' which is not stored internally as a keyword,
|
// Special case handling for 'self' which is not stored internally as a keyword,
|
||||||
// but rather creates a nsCSPHostSrc using the selfURI
|
// but rather creates a nsCSPHostSrc using the selfURI
|
||||||
if (CSP_IsKeyword(mCurToken, CSP_SELF)) {
|
if (CSP_IsKeyword(mCurToken, CSP_SELF)) {
|
||||||
return CSP_CreateHostSrcFromURI(mSelfURI);
|
// TenFourFox issue 602
|
||||||
|
return CSP_CreateHostSrcFromURI(mSelfURI, /* aIsSelf */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CSP_IsKeyword(mCurToken, CSP_UNSAFE_INLINE)) {
|
if (CSP_IsKeyword(mCurToken, CSP_UNSAFE_INLINE)) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ CSP_ContentTypeToDirective(nsContentPolicyType aType)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCSPHostSrc*
|
nsCSPHostSrc*
|
||||||
CSP_CreateHostSrcFromURI(nsIURI* aURI)
|
CSP_CreateHostSrcFromURI(nsIURI* aURI, bool aIsSelf)
|
||||||
{
|
{
|
||||||
// Create the host first
|
// Create the host first
|
||||||
nsCString host;
|
nsCString host;
|
||||||
|
@ -211,6 +211,10 @@ CSP_CreateHostSrcFromURI(nsIURI* aURI)
|
||||||
portStr.AppendInt(port);
|
portStr.AppendInt(port);
|
||||||
hostsrc->setPort(portStr);
|
hostsrc->setPort(portStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark if this came from 'self' originally (TenFourFox issue 602).
|
||||||
|
hostsrc->setCameFromSelf(aIsSelf);
|
||||||
|
|
||||||
return hostsrc;
|
return hostsrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +307,14 @@ permitsScheme(const nsAString& aEnforcementScheme,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TenFourFox issue 602: allow loading wss if the enforcement scheme is TLS,
|
||||||
|
// or if we are promised an upgrade of ws.
|
||||||
|
if (aEnforcementScheme.EqualsASCII("https") &&
|
||||||
|
(scheme.EqualsASCII("wss") ||
|
||||||
|
(aUpgradeInsecure && !aReportOnly && scheme.EqualsASCII("ws")))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Allow the load when enforcing upgrade-insecure-requests with the
|
// Allow the load when enforcing upgrade-insecure-requests with the
|
||||||
// promise the request gets upgraded from http to https and ws to wss.
|
// promise the request gets upgraded from http to https and ws to wss.
|
||||||
// See nsHttpChannel::Connect() and also WebSocket.cpp. Please note,
|
// See nsHttpChannel::Connect() and also WebSocket.cpp. Please note,
|
||||||
|
@ -316,6 +328,7 @@ permitsScheme(const nsAString& aEnforcementScheme,
|
||||||
/* ===== nsCSPSrc ============================ */
|
/* ===== nsCSPSrc ============================ */
|
||||||
|
|
||||||
nsCSPBaseSrc::nsCSPBaseSrc()
|
nsCSPBaseSrc::nsCSPBaseSrc()
|
||||||
|
: mCameFromSelf(false) // TenFourFox issue 602
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +336,18 @@ nsCSPBaseSrc::~nsCSPBaseSrc()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TenFourFox issue 602 */
|
||||||
|
bool
|
||||||
|
nsCSPBaseSrc::getCameFromSelf() const
|
||||||
|
{
|
||||||
|
return mCameFromSelf;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
nsCSPBaseSrc::setCameFromSelf(bool aIsSelf)
|
||||||
|
{
|
||||||
|
mCameFromSelf = aIsSelf;
|
||||||
|
}
|
||||||
|
|
||||||
// ::permits is only called for external load requests, therefore:
|
// ::permits is only called for external load requests, therefore:
|
||||||
// nsCSPKeywordSrc and nsCSPHashSource fall back to this base class
|
// nsCSPKeywordSrc and nsCSPHashSource fall back to this base class
|
||||||
// implementation which will never allow the load.
|
// implementation which will never allow the load.
|
||||||
|
@ -338,8 +363,7 @@ nsCSPBaseSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ::allows is only called for inlined loads, therefore:
|
// ::allows is only called for inlined loads, therefore externals fall back
|
||||||
// nsCSPSchemeSrc, nsCSPHostSrc fall back
|
|
||||||
// to this base class implementation which will never allow the load.
|
// to this base class implementation which will never allow the load.
|
||||||
bool
|
bool
|
||||||
nsCSPBaseSrc::allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce) const
|
nsCSPBaseSrc::allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce) const
|
||||||
|
@ -534,6 +558,13 @@ nsCSPHostSrc::permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TenFourFox issue 602. Called for inlined loads only.
|
||||||
|
bool
|
||||||
|
nsCSPHostSrc::allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce) const
|
||||||
|
{
|
||||||
|
return getCameFromSelf();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsCSPHostSrc::toString(nsAString& outStr) const
|
nsCSPHostSrc::toString(nsAString& outStr) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,7 +169,8 @@ inline CSPKeyword CSP_KeywordToEnum(const nsAString& aKey)
|
||||||
|
|
||||||
class nsCSPHostSrc;
|
class nsCSPHostSrc;
|
||||||
|
|
||||||
nsCSPHostSrc* CSP_CreateHostSrcFromURI(nsIURI* aURI);
|
// TenFourFox issue 602
|
||||||
|
nsCSPHostSrc* CSP_CreateHostSrcFromURI(nsIURI* aURI, bool aIsSelf = false);
|
||||||
bool CSP_IsValidDirective(const nsAString& aDir);
|
bool CSP_IsValidDirective(const nsAString& aDir);
|
||||||
bool CSP_IsDirective(const nsAString& aValue, CSPDirective aDir);
|
bool CSP_IsDirective(const nsAString& aValue, CSPDirective aDir);
|
||||||
bool CSP_IsKeyword(const nsAString& aValue, enum CSPKeyword aKey);
|
bool CSP_IsKeyword(const nsAString& aValue, enum CSPKeyword aKey);
|
||||||
|
@ -188,6 +189,12 @@ class nsCSPBaseSrc {
|
||||||
bool aReportOnly, bool aUpgradeInsecure) const;
|
bool aReportOnly, bool aUpgradeInsecure) const;
|
||||||
virtual bool allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce) const;
|
virtual bool allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce) const;
|
||||||
virtual void toString(nsAString& outStr) const = 0;
|
virtual void toString(nsAString& outStr) const = 0;
|
||||||
|
|
||||||
|
/* TenFourFox issue 602 */
|
||||||
|
bool getCameFromSelf() const;
|
||||||
|
void setCameFromSelf(bool isSelf);
|
||||||
|
private:
|
||||||
|
bool mCameFromSelf;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* =============== nsCSPSchemeSrc ============ */
|
/* =============== nsCSPSchemeSrc ============ */
|
||||||
|
@ -214,6 +221,9 @@ class nsCSPHostSrc : public nsCSPBaseSrc {
|
||||||
|
|
||||||
bool permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected,
|
bool permits(nsIURI* aUri, const nsAString& aNonce, bool aWasRedirected,
|
||||||
bool aReportOnly, bool aUpgradeInsecure) const;
|
bool aReportOnly, bool aUpgradeInsecure) const;
|
||||||
|
/* TenFourFox issue 602 */
|
||||||
|
bool allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce) const;
|
||||||
|
|
||||||
void toString(nsAString& outStr) const;
|
void toString(nsAString& outStr) const;
|
||||||
|
|
||||||
void setScheme(const nsAString& aScheme);
|
void setScheme(const nsAString& aScheme);
|
||||||
|
|
|
@ -38,14 +38,8 @@ GetCSSComputedValue(Element* aElem,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPresShell* shell = doc->GetShell();
|
|
||||||
if (!shell) {
|
|
||||||
NS_WARNING("Unable to look up computed style -- no pres shell");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsComputedDOMStyle> computedStyle =
|
RefPtr<nsComputedDOMStyle> computedStyle =
|
||||||
NS_NewComputedDOMStyle(aElem, EmptyString(), shell);
|
NS_NewComputedDOMStyle(aElem, EmptyString(), doc);
|
||||||
|
|
||||||
computedStyle->GetPropertyValue(aPropID, aResult);
|
computedStyle->GetPropertyValue(aPropID, aResult);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -18,4 +18,12 @@ interface CSSStyleSheet : StyleSheet {
|
||||||
unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
|
unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
|
||||||
[Throws]
|
[Throws]
|
||||||
void deleteRule(unsigned long index);
|
void deleteRule(unsigned long index);
|
||||||
|
|
||||||
|
// Non-standard WebKit things, see https://github.com/w3c/csswg-drafts/pull/3900.
|
||||||
|
[Throws, BinaryName="cssRules"]
|
||||||
|
readonly attribute CSSRuleList rules;
|
||||||
|
[Throws, BinaryName="deleteRule"]
|
||||||
|
void removeRule(optional unsigned long index = 0);
|
||||||
|
[Throws]
|
||||||
|
long addRule(optional DOMString selector = "undefined", optional DOMString style = "undefined", optional unsigned long index);
|
||||||
};
|
};
|
||||||
|
|
|
@ -403,6 +403,12 @@ partial interface Document {
|
||||||
[ChromeOnly] readonly attribute boolean userHasInteracted;
|
[ChromeOnly] readonly attribute boolean userHasInteracted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Extension to give chrome and XBL JS the ability to determine whether
|
||||||
|
// the document is sandboxed without permission to run scripts.
|
||||||
|
partial interface Document {
|
||||||
|
[Func="IsChromeOrXBL"] readonly attribute boolean hasScriptsBlockedBySandbox;
|
||||||
|
};
|
||||||
|
|
||||||
// Extension to give chrome and XBL JS the ability to determine whether
|
// Extension to give chrome and XBL JS the ability to determine whether
|
||||||
// inline scripts are blocked by the document's CSP.
|
// inline scripts are blocked by the document's CSP.
|
||||||
partial interface Document {
|
partial interface Document {
|
||||||
|
|
|
@ -38,7 +38,7 @@ Request implements Body;
|
||||||
dictionary RequestInit {
|
dictionary RequestInit {
|
||||||
ByteString method;
|
ByteString method;
|
||||||
HeadersInit headers;
|
HeadersInit headers;
|
||||||
BodyInit body;
|
BodyInit? body;
|
||||||
RequestMode mode;
|
RequestMode mode;
|
||||||
RequestCredentials credentials;
|
RequestCredentials credentials;
|
||||||
RequestCache cache;
|
RequestCache cache;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user