mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-19 04:29:35 +00:00
commit
d868b15063
|
@ -2476,9 +2476,12 @@ function losslessDecodeURI(aURI) {
|
|||
// a sequence that survived decodeURI, i.e. one for:
|
||||
// ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '#'
|
||||
// (RFC 3987 section 3.2)
|
||||
// 2. Re-encode whitespace so that it doesn't get eaten away
|
||||
// by the location bar (bug 410726).
|
||||
.replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]/ig,
|
||||
// 2. Re-encode select whitespace so that it doesn't get eaten
|
||||
// away by the location bar (bug 410726). Re-encode all
|
||||
// adjacent whitespace, to prevent spoofing attempts where
|
||||
// invisible characters would push part of the URL to
|
||||
// overflow the location bar (bug 1395508).
|
||||
.replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]|\s(?=\s)|\s$/ig,
|
||||
encodeURIComponent);
|
||||
} catch (e) {}
|
||||
|
||||
|
|
|
@ -905,8 +905,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
this._value = this.inputField.value;
|
||||
gBrowser.userTypedValue = this.value;
|
||||
this.valueIsTyped = true;
|
||||
this.gotResultForCurrentQuery = false;
|
||||
this.mController.handleText();
|
||||
// Only wait for a result when we are sure to get one. In some
|
||||
// cases, like when pasting the same exact text, we may not fire
|
||||
// a new search and we won't get a result.
|
||||
if (this.mController.handleText()) {
|
||||
this.gotResultForCurrentQuery = false;
|
||||
}
|
||||
}
|
||||
this.resetActionType();
|
||||
]]></body>
|
||||
|
@ -955,7 +959,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
// a backspace on the text value instead of removing the result.
|
||||
if (this.popup.selectedIndex == 0 &&
|
||||
this.popup._isFirstResultHeuristic) {
|
||||
return this.mController.handleText();
|
||||
this.mController.handleText();
|
||||
return false;
|
||||
}
|
||||
return this.mController.handleDelete();
|
||||
]]></body>
|
||||
|
|
|
@ -1 +1 @@
|
|||
45.14.0
|
||||
45.15.0
|
||||
|
|
|
@ -1 +1 @@
|
|||
Feature Parity Release 5
|
||||
Feature Parity Release 6
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<!ENTITY community.creditsLink "Mozilla Community Credits">
|
||||
<!ENTITY community.end3 " working together to keep the Web open, public and accessible to all.">
|
||||
|
||||
<!ENTITY contribute.start "Project lead: Cameron Kaiser. Thanks to: Tobias Netzel, Ben Stuhl, Claudio Leite, Chris Trusch, David Kilbridge, David Fang, Chad Weider, Theo Waddell, Narcotix, PoLiYa, Edwin Smith and all our localizers. Powered by Mozilla Firefox: ">
|
||||
<!ENTITY contribute.start "Project lead: Cameron Kaiser. Thanks to: Tobias Netzel, Ben Stuhl, Claudio Leite, Chris Trusch, David Kilbridge, David Fang, Riccardo Mottola, Raphaël Guay, Ken Cunningham, Chad Weider, Narcotix, PoLiYa, Edwin Smith and our localizers. Powered by Mozilla Firefox: ">
|
||||
<!ENTITY contribute.end "">
|
||||
|
||||
<!ENTITY helpus.start "Want to help? ">
|
||||
|
@ -49,7 +49,7 @@
|
|||
<!ENTITY helpus.getInvolvedLink "get involved!">
|
||||
<!ENTITY helpus.end "">
|
||||
|
||||
<!ENTITY copyright.blurb "Copyright © 2010-2017 Contributors to TenFourFox. All rights reserved.">
|
||||
<!ENTITY copyright.blurb "Copyright © 2010-2018 Contributors to TenFourFox. All rights reserved.">
|
||||
|
||||
<!-- LOCALIZATION NOTE (bottomLinks.license): This is a link title that links to about:license. -->
|
||||
<!ENTITY bottomLinks.license "Licensing Information">
|
||||
|
|
|
@ -680,7 +680,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
nsAutoCString targetScheme;
|
||||
nsresult rv = targetBaseURI->GetScheme(targetScheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
//-- Some callers do not allow loading javascript:
|
||||
if ((aFlags & nsIScriptSecurityManager::DISALLOW_SCRIPT) &&
|
||||
targetScheme.EqualsLiteral("javascript"))
|
||||
|
@ -688,6 +688,235 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
// TenFourFox issue 469
|
||||
// determine if this is a script we want to block
|
||||
if (mIsTenFourFoxAdBlockEnabled &&
|
||||
(targetScheme.EqualsLiteral("http") || targetScheme.EqualsLiteral("https"))) {
|
||||
nsAutoCString hostname;
|
||||
if (NS_SUCCEEDED(targetBaseURI->GetHost(hostname))) {
|
||||
ToLowerCase(hostname);
|
||||
#define BLOK(q) hostname.EqualsLiteral(q)
|
||||
if (0 ||
|
||||
// This is used as a data source by a lot of UIs,
|
||||
// so we shouldn't block it (e.g., nytimes).
|
||||
// Probably also shouldn't block googletagmanager.com
|
||||
// for the same reasons.
|
||||
//BLOK("www.googletagservices.com") ||
|
||||
|
||||
// blocking zdbb.net seems to be problematic
|
||||
// https://github.com/AdguardTeam/AdguardFilters/issues/1278
|
||||
|
||||
BLOK("c.amazon-adsystem.com") ||
|
||||
|
||||
BLOK("google-analytics.com") ||
|
||||
BLOK("www.google-analytics.com") ||
|
||||
BLOK("ssl.google-analytics.com") ||
|
||||
|
||||
BLOK("tpc.googlesyndication.com") ||
|
||||
BLOK("pagead.googlesyndication.com") ||
|
||||
BLOK("pagead2.googlesyndication.com") ||
|
||||
|
||||
BLOK("adservice.google.com") ||
|
||||
|
||||
BLOK("www.googleadservices.com") ||
|
||||
|
||||
BLOK("adrta.com") ||
|
||||
BLOK("p.adrta.com") ||
|
||||
BLOK("q.adrta.com") ||
|
||||
BLOK("cdn.adrta.com") ||
|
||||
BLOK("ipv6.adrta.com") ||
|
||||
|
||||
BLOK("ib.adnxs.com") ||
|
||||
BLOK("acdn.adnxs.com") ||
|
||||
BLOK("secure.adnxs.com") ||
|
||||
BLOK("yj-a.p.adnxs.com") ||
|
||||
BLOK("sharethrough.adnxs.com") ||
|
||||
|
||||
BLOK("c2.taboola.com") ||
|
||||
BLOK("nr.taboola.com") ||
|
||||
BLOK("cdn.taboola.com") ||
|
||||
BLOK("trc.taboola.com") ||
|
||||
|
||||
BLOK("b.scorecardresearch.com") ||
|
||||
BLOK("sb.scorecardresearch.com") ||
|
||||
|
||||
BLOK("ad.doubleclick.net") ||
|
||||
BLOK("static.doubleclick.net") ||
|
||||
BLOK("stats.g.doubleclick.net") ||
|
||||
BLOK("googleads.g.doubleclick.net") ||
|
||||
BLOK("securepubads.g.doubleclick.net") ||
|
||||
|
||||
BLOK("at.atwola.com") ||
|
||||
|
||||
BLOK("pixel.advertising.com") ||
|
||||
BLOK("dtm.advertising.com") ||
|
||||
|
||||
BLOK("sp.analytics.yahoo.com") ||
|
||||
BLOK("ads.yap.yahoo.com") ||
|
||||
|
||||
BLOK("cdn.gotraffic.net") ||
|
||||
|
||||
BLOK("cdn.rta247.com") ||
|
||||
|
||||
BLOK("widget.perfectmarket.com") ||
|
||||
|
||||
BLOK("cdn.doubleverify.com") ||
|
||||
BLOK("rtb0.doubleverify.com") ||
|
||||
BLOK("rtbcdn.doubleverify.com") ||
|
||||
|
||||
BLOK("cdn.flashtalking.com") ||
|
||||
BLOK("servedby.flashtalking.com") ||
|
||||
|
||||
BLOK("a.postrelease.com") ||
|
||||
BLOK("jadserve.postrelease.com") ||
|
||||
|
||||
BLOK("native.sharethrough.com") ||
|
||||
|
||||
BLOK("static.chartbeat.com") ||
|
||||
|
||||
BLOK("edge.quantserve.com") ||
|
||||
BLOK("secure.quantserve.com") ||
|
||||
|
||||
BLOK("rules.quantcount.com") ||
|
||||
|
||||
BLOK("api.viglink.com") ||
|
||||
BLOK("cdn.viglink.com") ||
|
||||
|
||||
BLOK("xcp.go.sonobi.com") ||
|
||||
|
||||
BLOK("s.ntv.io") ||
|
||||
|
||||
BLOK("cdn.segment.com") ||
|
||||
|
||||
BLOK("cdn-gl.imrworldwide.com") ||
|
||||
BLOK("secure-dcr.imrworldwide.com") ||
|
||||
|
||||
BLOK("labs-cdn.revcontent.com") ||
|
||||
BLOK("trends.revcontent.com") ||
|
||||
BLOK("cdn.revcontent.com") ||
|
||||
|
||||
BLOK("cas.criteo.com") ||
|
||||
BLOK("static.criteo.net") ||
|
||||
|
||||
BLOK("jsc.idealmedia.com") ||
|
||||
BLOK("servicer.idealmedia.com") ||
|
||||
|
||||
BLOK("js-agent.newrelic.com") ||
|
||||
BLOK("bam.nr-data.net") ||
|
||||
|
||||
BLOK("widgets.outbrain.com") ||
|
||||
BLOK("amplify.outbrain.com") ||
|
||||
|
||||
BLOK("cdn.krxd.net") ||
|
||||
BLOK("beacon.krxd.net") ||
|
||||
|
||||
BLOK("scdn.cxense.com") ||
|
||||
BLOK("rscdn.cxense.com") ||
|
||||
|
||||
BLOK("z.moatads.com") ||
|
||||
BLOK("s-jsonp.moatads.com") ||
|
||||
|
||||
BLOK("static.yieldmo.com") ||
|
||||
|
||||
BLOK("ads.rubiconproject.com") ||
|
||||
|
||||
BLOK("cdn.engine.4dsply.com") ||
|
||||
|
||||
BLOK("as-sec.casalemedia.com") ||
|
||||
|
||||
BLOK("loadm.exelator.com") ||
|
||||
|
||||
BLOK("sdk.streamrail.com") ||
|
||||
|
||||
BLOK("cdn.lockerdome.com") ||
|
||||
BLOK("cdn2.lockerdome.com") ||
|
||||
|
||||
BLOK("pi.pardot.com") ||
|
||||
|
||||
BLOK("js-sec.indexww.com") ||
|
||||
|
||||
BLOK("tags.tiqcdn.com") ||
|
||||
|
||||
BLOK("tag.bounceexchange.com") ||
|
||||
BLOK("api.bounceexchange.com") ||
|
||||
|
||||
BLOK("www.npttech.com") ||
|
||||
|
||||
BLOK("cdn.adsafeprotected.com") ||
|
||||
|
||||
BLOK("aka-cdn.adtechus.com") ||
|
||||
BLOK("adserver.adtechus.com") ||
|
||||
|
||||
BLOK("r.skimresources.com") ||
|
||||
BLOK("s.skimresources.com") ||
|
||||
BLOK("t.skimresources.com") ||
|
||||
|
||||
BLOK("contextual.media.net") ||
|
||||
|
||||
BLOK("edge.simplereach.com") ||
|
||||
|
||||
BLOK("js.adsrvr.org") ||
|
||||
|
||||
BLOK("script.crazyegg.com") ||
|
||||
|
||||
BLOK("launch.newsinc.com") ||
|
||||
|
||||
BLOK("c.go-mpulse.net") ||
|
||||
|
||||
BLOK("cdn5.userzoom.com") ||
|
||||
|
||||
BLOK("dx.steelhousemedia.com") ||
|
||||
BLOK("px.steelhousemedia.com") ||
|
||||
BLOK("ww.steelhousemedia.com") ||
|
||||
|
||||
BLOK("nexus.ensighten.com") ||
|
||||
|
||||
BLOK("cdn.mediavoice.com") ||
|
||||
BLOK("plugin.mediavoice.com") ||
|
||||
|
||||
BLOK("segment-data.zqtk.net") ||
|
||||
|
||||
BLOK("d.turn.com") ||
|
||||
|
||||
BLOK("i.yldbt.com") ||
|
||||
BLOK("cdn.yldbt.com") ||
|
||||
|
||||
BLOK("pippio.com") ||
|
||||
|
||||
BLOK("cdn.quantummetric.com") ||
|
||||
|
||||
BLOK("cdn.blueconic.net") ||
|
||||
|
||||
BLOK("www.zergnet.com") ||
|
||||
|
||||
BLOK("f.monetate.net") ||
|
||||
BLOK("sb.monetate.net") ||
|
||||
BLOK("se.monetate.net") ||
|
||||
|
||||
BLOK("tags.crwdcntrl.net") ||
|
||||
|
||||
BLOK("cdn.nsstatic.net") ||
|
||||
|
||||
BLOK("tags.bkrtx.com") ||
|
||||
|
||||
BLOK("yads.c.yimg.jp") ||
|
||||
BLOK("yjtag.yahoo.co.jp") ||
|
||||
BLOK("yads.yjtag.yahoo.co.jp") ||
|
||||
|
||||
BLOK("px-ya.ladsp.com") ||
|
||||
0) {
|
||||
#undef BLOK
|
||||
// Yup.
|
||||
#ifndef DEBUG
|
||||
if (mIsTenFourFoxAdBlockLoggingEnabled)
|
||||
#endif
|
||||
fprintf(stderr, "Warning: TenFourFox basic adblock intercepted script from %s.\n",
|
||||
hostname.get());
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(errorTag, "CheckLoadURIError");
|
||||
bool reportErrors = !(aFlags & nsIScriptSecurityManager::DONT_REPORT_ERRORS);
|
||||
|
||||
|
@ -728,6 +957,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (hasFlags) {
|
||||
#if(0) // no B2G
|
||||
// Let apps load the whitelisted theme resources even if they don't
|
||||
// have the webapps-manage permission but have the themeable one.
|
||||
// Resources from the theme origin are also allowed to load from
|
||||
|
@ -744,6 +974,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
? NS_OK : NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// In this case, we allow opening only if the source and target URIS
|
||||
// are on the same domain, or the opening URI has the webapps
|
||||
// permision granted
|
||||
|
@ -1246,6 +1477,7 @@ static const char* kObservedPrefs[] = {
|
|||
sJSEnabledPrefName,
|
||||
sFileOriginPolicyPrefName,
|
||||
"capability.policy.",
|
||||
"tenfourfox.adblock.",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
@ -1264,6 +1496,8 @@ nsScriptSecurityManager::Observe(nsISupports* aObject, const char* aTopic,
|
|||
nsScriptSecurityManager::nsScriptSecurityManager(void)
|
||||
: mPrefInitialized(false)
|
||||
, mIsJavaScriptEnabled(false)
|
||||
, mIsTenFourFoxAdBlockEnabled(false)
|
||||
, mIsTenFourFoxAdBlockLoggingEnabled(false)
|
||||
{
|
||||
static_assert(sizeof(intptr_t) == sizeof(void*),
|
||||
"intptr_t and void* have different lengths on this platform. "
|
||||
|
@ -1400,6 +1634,10 @@ nsScriptSecurityManager::ScriptSecurityPrefChanged()
|
|||
Preferences::GetBool(sJSEnabledPrefName, mIsJavaScriptEnabled);
|
||||
sStrictFileOriginPolicy =
|
||||
Preferences::GetBool(sFileOriginPolicyPrefName, false);
|
||||
mIsTenFourFoxAdBlockEnabled =
|
||||
Preferences::GetBool("tenfourfox.adblock.enabled", mIsTenFourFoxAdBlockEnabled);
|
||||
mIsTenFourFoxAdBlockLoggingEnabled =
|
||||
Preferences::GetBool("tenfourfox.adblock.logging.enabled", mIsTenFourFoxAdBlockLoggingEnabled);
|
||||
|
||||
//
|
||||
// Rebuild the set of principals for which we allow file:// URI loads. This
|
||||
|
|
|
@ -123,6 +123,8 @@ private:
|
|||
nsCOMPtr<nsIPrincipal> mSystemPrincipal;
|
||||
bool mPrefInitialized;
|
||||
bool mIsJavaScriptEnabled;
|
||||
bool mIsTenFourFoxAdBlockEnabled;
|
||||
bool mIsTenFourFoxAdBlockLoggingEnabled;
|
||||
nsTArray<nsCOMPtr<nsIURI>> mFileURIWhitelist;
|
||||
|
||||
// This machinery controls new-style domain policies. The old-style
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
45.14.0
|
||||
45.15.0
|
||||
|
|
|
@ -6493,8 +6493,10 @@ nsDocShell::ScrollByPages(int32_t aNumPages)
|
|||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
|
||||
bool aMetaRefresh)
|
||||
nsDocShell::RefreshURI(nsIURI* aURI,
|
||||
int32_t aDelay, bool aRepeat,
|
||||
bool aMetaRefresh,
|
||||
nsIPrincipal* aPrincipal)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
|
@ -6529,6 +6531,7 @@ nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
|
|||
nsCOMPtr<nsISupports> dataRef = refreshTimer; // Get the ref count to 1
|
||||
|
||||
refreshTimer->mDocShell = this;
|
||||
refreshTimer->mPrincipal = aPrincipal;
|
||||
refreshTimer->mURI = aURI;
|
||||
refreshTimer->mDelay = aDelay;
|
||||
refreshTimer->mRepeat = aRepeat;
|
||||
|
@ -6560,7 +6563,8 @@ nsresult
|
|||
nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
|
||||
int32_t aDelay,
|
||||
bool aMetaRefresh,
|
||||
nsITimer* aTimer)
|
||||
nsITimer* aTimer,
|
||||
nsIPrincipal* aPrincipal)
|
||||
{
|
||||
NS_PRECONDITION(aTimer, "Must have a timer here");
|
||||
|
||||
|
@ -6578,7 +6582,7 @@ nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
|
|||
}
|
||||
}
|
||||
|
||||
return ForceRefreshURI(aURI, aDelay, aMetaRefresh);
|
||||
return ForceRefreshURI(aURI, aDelay, aMetaRefresh, aPrincipal);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -6608,7 +6612,7 @@ nsDocShell::DoAppRedirectIfNeeded(nsIURI* aURI,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh)
|
||||
nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh, nsIPrincipal* aPrincipal)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
|
@ -6656,11 +6660,18 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh)
|
|||
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
|
||||
}
|
||||
|
||||
// If the principal is null, the refresh will have a triggeringPrincipal
|
||||
// derived from the referrer URI, or will be set to the system principal
|
||||
// if there is no refererrer. See LoadURI()
|
||||
if (aPrincipal) {
|
||||
loadInfo->SetOwner(aPrincipal); // as called prior to bug 1286472
|
||||
}
|
||||
|
||||
/*
|
||||
* LoadURI(...) will cancel all refresh timers... This causes the
|
||||
* Timer and its refreshData instance to be released...
|
||||
*/
|
||||
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, true);
|
||||
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_OWNER, true); // XXX: LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6896,7 +6907,7 @@ nsDocShell::SetupRefreshURIFromHeader(nsIURI* aBaseURI,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = RefreshURI(uri, seconds * 1000, false, true);
|
||||
rv = RefreshURI(uri, seconds * 1000, false, true, aPrincipal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12974,7 +12985,7 @@ nsRefreshTimer::Notify(nsITimer* aTimer)
|
|||
// Get the delay count to determine load type
|
||||
uint32_t delay = 0;
|
||||
aTimer->GetDelay(&delay);
|
||||
mDocShell->ForceRefreshURIFromTimer(mURI, delay, mMetaRefresh, aTimer);
|
||||
mDocShell->ForceRefreshURIFromTimer(mURI, delay, mMetaRefresh, aTimer, mPrincipal);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
|
||||
RefPtr<nsDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
int32_t mDelay;
|
||||
bool mRepeat;
|
||||
bool mMetaRefresh;
|
||||
|
@ -244,7 +245,8 @@ public:
|
|||
// the timer involved out of mRefreshURIList if it's there.
|
||||
// aTimer must not be null.
|
||||
nsresult ForceRefreshURIFromTimer(nsIURI* aURI, int32_t aDelay,
|
||||
bool aMetaRefresh, nsITimer* aTimer);
|
||||
bool aMetaRefresh, nsITimer* aTimer,
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
friend class OnLinkClickEvent;
|
||||
|
||||
|
|
|
@ -18,23 +18,35 @@ interface nsIRefreshURI : nsISupports {
|
|||
* queued and executed when the current load finishes.
|
||||
*
|
||||
* @param aUri The uri to refresh.
|
||||
* @param aPrincipal The triggeringPrincipal for the refresh load
|
||||
* May be null, in which case a principal will be built based on the
|
||||
* referrer URI of the previous docshell load, or will use the system
|
||||
* principal when there is no referrer.
|
||||
* @param aMillis The number of milliseconds to wait.
|
||||
* @param aRepeat Flag to indicate if the uri is to be
|
||||
* repeatedly refreshed every aMillis milliseconds.
|
||||
* @param aMetaRefresh Flag to indicate if this is a Meta refresh.
|
||||
*/
|
||||
void refreshURI(in nsIURI aURI, in long aMillis, in boolean aRepeat,
|
||||
in boolean aMetaRefresh);
|
||||
void refreshURI(in nsIURI aURI,
|
||||
in long aMillis, in boolean aRepeat,
|
||||
in boolean aMetaRefresh,
|
||||
[optional] in nsIPrincipal aPrincipal);
|
||||
|
||||
/**
|
||||
* Loads a URI immediately as if it were a refresh.
|
||||
*
|
||||
* @param aURI The URI to refresh.
|
||||
* @param aPrincipal The triggeringPrincipal for the refresh load
|
||||
* May be null, in which case a principal will be built based on the
|
||||
* referrer URI of the previous docshell load, or will use the system
|
||||
* principal when there is no referrer.
|
||||
* @param aMillis The number of milliseconds by which this refresh would
|
||||
* be delayed if it were not being forced.
|
||||
* @param aMetaRefresh Flag to indicate if this is a meta refresh.
|
||||
*/
|
||||
void forceRefreshURI(in nsIURI aURI, in long aMillis, in boolean aMetaRefresh);
|
||||
void forceRefreshURI(in nsIURI aURI,
|
||||
in long aMillis, in boolean aMetaRefresh,
|
||||
[optional] in nsIPrincipal aPrincipal);
|
||||
|
||||
/**
|
||||
* Checks the passed in channel to see if there is a refresh header,
|
||||
|
@ -57,10 +69,15 @@ interface nsIRefreshURI : nsISupports {
|
|||
* the current page finishes loading.
|
||||
*
|
||||
* @param aBaseURI base URI to resolve refresh uri with.
|
||||
* @param principal the associated principal
|
||||
* @param aPrincipal The triggeringPrincipal for the refresh load
|
||||
* May be null, in which case a principal will be built based on the
|
||||
* referrer URI of the previous docshell load, or will use the system
|
||||
* principal when there is no referrer.
|
||||
* @param aHeader The meta refresh header string.
|
||||
*/
|
||||
void setupRefreshURIFromHeader(in nsIURI aBaseURI, in nsIPrincipal principal, in ACString aHeader);
|
||||
void setupRefreshURIFromHeader(in nsIURI aBaseURI,
|
||||
in nsIPrincipal principal,
|
||||
in ACString aHeader);
|
||||
|
||||
/**
|
||||
* Cancels all timer loads.
|
||||
|
|
|
@ -387,7 +387,7 @@ GetDirectionFromText(const nsTextFragment* aFrag,
|
|||
* know not to return it
|
||||
* @return the text node containing the character that determined the direction
|
||||
*/
|
||||
static nsINode*
|
||||
static nsTextNode*
|
||||
WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
|
||||
nsINode* aChangedNode = nullptr)
|
||||
{
|
||||
|
@ -413,7 +413,7 @@ WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
|
|||
// We found a descendant text node with strong directional characters.
|
||||
// Set the directionality of aElement to the corresponding value.
|
||||
aElement->SetDirectionality(textNodeDir, aNotify);
|
||||
return child;
|
||||
return static_cast<nsTextNode*>(child);
|
||||
}
|
||||
}
|
||||
child = child->GetNextNode(aElement);
|
||||
|
@ -436,7 +436,7 @@ class nsTextNodeDirectionalityMap
|
|||
|
||||
nsTextNodeDirectionalityMap* map =
|
||||
reinterpret_cast<nsTextNodeDirectionalityMap * >(aPropertyValue);
|
||||
map->EnsureMapIsClear(textNode);
|
||||
map->EnsureMapIsClear();
|
||||
delete map;
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ public:
|
|||
NS_RELEASE(textNode);
|
||||
}
|
||||
|
||||
void AddEntry(nsINode* aTextNode, Element* aElement)
|
||||
void AddEntry(nsTextNode* aTextNode, Element* aElement)
|
||||
{
|
||||
if (!mElements.Contains(aElement)) {
|
||||
mElements.Put(aElement);
|
||||
|
@ -482,7 +482,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveEntry(nsINode* aTextNode, Element* aElement)
|
||||
void RemoveEntry(nsTextNode* aTextNode, Element* aElement)
|
||||
{
|
||||
NS_ASSERTION(mElements.Contains(aElement),
|
||||
"element already removed from map");
|
||||
|
@ -542,7 +542,7 @@ private:
|
|||
static_cast<nsTextNodeDirectionalityMapAndElement*>(aData);
|
||||
nsINode* oldTextNode = data->mNode;
|
||||
Element* rootNode = aEntry->GetKey();
|
||||
nsINode* newTextNode = nullptr;
|
||||
nsTextNode* newTextNode = nullptr;
|
||||
if (rootNode->GetParentNode() && rootNode->HasDirAuto()) {
|
||||
newTextNode = WalkDescendantsSetDirectionFromText(rootNode, true,
|
||||
oldTextNode);
|
||||
|
@ -565,11 +565,12 @@ private:
|
|||
return OpRemove;
|
||||
}
|
||||
|
||||
static nsCheapSetOperator ClearEntry(nsPtrHashKey<Element>* aEntry, void* aData)
|
||||
static nsCheapSetOperator TakeEntries(nsPtrHashKey<Element>* aEntry, void* aData)
|
||||
{
|
||||
Element* rootNode = aEntry->GetKey();
|
||||
rootNode->ClearHasDirAutoSet();
|
||||
rootNode->DeleteProperty(nsGkAtoms::dirAutoSetBy);
|
||||
// TenFourFox lacks AutoTArray, so convert bug 1414452 to nsAutoTArray.
|
||||
nsAutoTArray<Element*, 8>* entries =
|
||||
static_cast<nsAutoTArray<Element*, 8>*>(aData);
|
||||
entries->AppendElement(aEntry->GetKey());
|
||||
return OpRemove;
|
||||
}
|
||||
|
||||
|
@ -585,22 +586,28 @@ public:
|
|||
mElements.EnumerateEntries(ResetNodeDirection, &data);
|
||||
}
|
||||
|
||||
void EnsureMapIsClear(nsINode* aTextNode)
|
||||
void EnsureMapIsClear()
|
||||
{
|
||||
AutoRestore<Element*> restore(mElementToBeRemoved);
|
||||
DebugOnly<uint32_t> clearedEntries =
|
||||
mElements.EnumerateEntries(ClearEntry, aTextNode);
|
||||
MOZ_ASSERT(clearedEntries == 0, "Map should be empty already");
|
||||
// As above.
|
||||
nsAutoTArray<Element*, 8> entries;
|
||||
mElements.EnumerateEntries(TakeEntries, &entries);
|
||||
uint32_t size = entries.Length();
|
||||
for(uint32_t i = 0; i < size; i++) {
|
||||
Element* el = entries.ElementAt(i);
|
||||
el->ClearHasDirAutoSet();
|
||||
el->DeleteProperty(nsGkAtoms::dirAutoSetBy);
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveElementFromMap(nsINode* aTextNode, Element* aElement)
|
||||
static void RemoveElementFromMap(nsTextNode* aTextNode, Element* aElement)
|
||||
{
|
||||
if (aTextNode->HasTextNodeDirectionalityMap()) {
|
||||
GetDirectionalityMap(aTextNode)->RemoveEntry(aTextNode, aElement);
|
||||
}
|
||||
}
|
||||
|
||||
static void AddEntryToMap(nsINode* aTextNode, Element* aElement)
|
||||
static void AddEntryToMap(nsTextNode* aTextNode, Element* aElement)
|
||||
{
|
||||
nsTextNodeDirectionalityMap* map = GetDirectionalityMap(aTextNode);
|
||||
if (!map) {
|
||||
|
@ -618,8 +625,8 @@ public:
|
|||
return GetDirectionalityMap(aTextNode)->UpdateAutoDirection(aDir);
|
||||
}
|
||||
|
||||
static void ResetTextNodeDirection(nsINode* aTextNode,
|
||||
nsINode* aChangedTextNode)
|
||||
static void ResetTextNodeDirection(nsTextNode* aTextNode,
|
||||
nsTextNode* aChangedTextNode)
|
||||
{
|
||||
MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(),
|
||||
"Map missing in ResetTextNodeDirection");
|
||||
|
@ -630,7 +637,7 @@ public:
|
|||
static void EnsureMapIsClearFor(nsINode* aTextNode)
|
||||
{
|
||||
if (aTextNode->HasTextNodeDirectionalityMap()) {
|
||||
GetDirectionalityMap(aTextNode)->EnsureMapIsClear(aTextNode);
|
||||
GetDirectionalityMap(aTextNode)->EnsureMapIsClear();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -694,7 +701,7 @@ SetDirectionalityOnDescendants(Element* aElement, Directionality aDir,
|
|||
void
|
||||
WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
|
||||
{
|
||||
nsINode* setByNode;
|
||||
nsTextNode* setByNode;
|
||||
Element* parent = aElement->GetParentElement();
|
||||
|
||||
while (parent && parent->NodeOrAncestorHasDirAuto()) {
|
||||
|
@ -704,7 +711,7 @@ WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
|
|||
// Remove it from the map and reset its direction by the downward
|
||||
// propagation algorithm
|
||||
setByNode =
|
||||
static_cast<nsINode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||
static_cast<nsTextNode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||
if (setByNode) {
|
||||
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, parent);
|
||||
}
|
||||
|
@ -730,11 +737,9 @@ WalkDescendantsResetAutoDirection(Element* aElement)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (child->HasTextNodeDirectionalityMap()) {
|
||||
nsTextNodeDirectionalityMap::ResetTextNodeDirection(child, nullptr);
|
||||
// Don't call nsTextNodeDirectionalityMap::EnsureMapIsClearFor(child)
|
||||
// since ResetTextNodeDirection may have kept elements in child's
|
||||
// DirectionalityMap.
|
||||
if (child->NodeType() == nsIDOMNode::TEXT_NODE &&
|
||||
child->HasTextNodeDirectionalityMap()) {
|
||||
nsTextNodeDirectionalityMap::ResetTextNodeDirection(static_cast<nsTextNode*>(child), nullptr);
|
||||
}
|
||||
child = child->GetNextNode(aElement);
|
||||
}
|
||||
|
@ -776,7 +781,7 @@ WalkDescendantsSetDirAuto(Element* aElement, bool aNotify)
|
|||
}
|
||||
}
|
||||
|
||||
nsINode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
|
||||
nsTextNode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
|
||||
if (textNode) {
|
||||
nsTextNodeDirectionalityMap::AddEntryToMap(textNode, aElement);
|
||||
}
|
||||
|
@ -797,7 +802,7 @@ WalkDescendantsClearAncestorDirAuto(Element* aElement)
|
|||
}
|
||||
}
|
||||
|
||||
void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
|
||||
void SetAncestorDirectionIfAuto(nsTextNode* aTextNode, Directionality aDir,
|
||||
bool aNotify = true)
|
||||
{
|
||||
MOZ_ASSERT(aTextNode->NodeType() == nsIDOMNode::TEXT_NODE,
|
||||
|
@ -811,8 +816,8 @@ void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
|
|||
|
||||
if (parent->HasDirAuto()) {
|
||||
bool resetDirection = false;
|
||||
nsINode* directionWasSetByTextNode =
|
||||
static_cast<nsINode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||
nsTextNode* directionWasSetByTextNode =
|
||||
static_cast<nsTextNode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||
|
||||
if (!parent->HasDirAutoSet()) {
|
||||
// Fast path if parent's direction is not yet set by any descendant
|
||||
|
@ -883,7 +888,7 @@ TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
|
|||
}
|
||||
|
||||
void
|
||||
TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
|
||||
TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
|
||||
bool aNotify)
|
||||
{
|
||||
Directionality newDir = GetDirectionFromText(aTextNode->GetText());
|
||||
|
@ -913,7 +918,7 @@ TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
|
|||
}
|
||||
|
||||
void
|
||||
SetDirectionFromNewTextNode(nsIContent* aTextNode)
|
||||
SetDirectionFromNewTextNode(nsTextNode* aTextNode)
|
||||
{
|
||||
if (!NodeAffectsDirAutoAncestor(aTextNode)) {
|
||||
return;
|
||||
|
@ -1000,8 +1005,8 @@ OnSetDirAttr(Element* aElement, const nsAttrValue* aNewValue,
|
|||
WalkDescendantsSetDirAuto(aElement, aNotify);
|
||||
} else {
|
||||
if (aElement->HasDirAutoSet()) {
|
||||
nsINode* setByNode =
|
||||
static_cast<nsINode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||
nsTextNode* setByNode =
|
||||
static_cast<nsTextNode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
|
||||
}
|
||||
SetDirectionalityOnDescendants(aElement,
|
||||
|
|
|
@ -89,14 +89,14 @@ bool TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
|
|||
* After the contents of a text node have changed, change the directionality
|
||||
* of any elements whose directionality is determined by that node
|
||||
*/
|
||||
void TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
|
||||
void TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
|
||||
bool aNotify);
|
||||
|
||||
/**
|
||||
* When a text node is appended to an element, find any ancestors with dir=auto
|
||||
* whose directionality will be determined by the text node
|
||||
*/
|
||||
void SetDirectionFromNewTextNode(nsIContent* aTextNode);
|
||||
void SetDirectionFromNewTextNode(nsTextNode* aTextNode);
|
||||
|
||||
/**
|
||||
* When a text node is removed from a document, find any ancestors whose
|
||||
|
|
70
dom/base/IdleDeadline.cpp
Normal file
70
dom/base/IdleDeadline.cpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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/. */
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/dom/IdleDeadline.h"
|
||||
#include "mozilla/dom/IdleDeadlineBinding.h"
|
||||
#include "nsPerformance.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(IdleDeadline, mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(IdleDeadline)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(IdleDeadline)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleDeadline)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
IdleDeadline::IdleDeadline(nsPIDOMWindow* aWindow, bool aDidTimeout,
|
||||
DOMHighResTimeStamp aDeadline)
|
||||
: mWindow(aWindow)
|
||||
, mDidTimeout(aDidTimeout)
|
||||
, mDeadline(aDeadline)
|
||||
{
|
||||
}
|
||||
|
||||
IdleDeadline::~IdleDeadline()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
IdleDeadline::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return IdleDeadlineBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp
|
||||
IdleDeadline::TimeRemaining()
|
||||
{
|
||||
if (mDidTimeout) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
RefPtr<nsPerformance> performance = mWindow->GetPerformance();
|
||||
if (!performance) {
|
||||
// If there is no performance object the window is partially torn
|
||||
// down, so we can safely say that there is no time remaining.
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return std::max(mDeadline - performance->Now(), 0.0);
|
||||
}
|
||||
|
||||
bool
|
||||
IdleDeadline::DidTimeout() const
|
||||
{
|
||||
return mDidTimeout;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
55
dom/base/IdleDeadline.h
Normal file
55
dom/base/IdleDeadline.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_IdleDeadline_h
|
||||
#define mozilla_dom_IdleDeadline_h
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class IdleDeadline final
|
||||
: public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
IdleDeadline(nsPIDOMWindow* aWindow, bool aDidTimeout,
|
||||
DOMHighResTimeStamp aDeadline);
|
||||
|
||||
nsPIDOMWindow* GetParentObject() const { return mWindow; }
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
DOMHighResTimeStamp TimeRemaining();
|
||||
bool DidTimeout() const;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IdleDeadline)
|
||||
|
||||
private:
|
||||
~IdleDeadline();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
const bool mDidTimeout;
|
||||
const DOMHighResTimeStamp mDeadline;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_IdleDeadline_h
|
|
@ -182,6 +182,7 @@ EXPORTS.mozilla.dom += [
|
|||
'FileReader.h',
|
||||
'FragmentOrElement.h',
|
||||
'FromParser.h',
|
||||
'IdleDeadline.h',
|
||||
'ImageEncoder.h',
|
||||
'ImportManager.h',
|
||||
'Link.h',
|
||||
|
@ -247,6 +248,7 @@ UNIFIED_SOURCES += [
|
|||
'FileList.cpp',
|
||||
'FileReader.cpp',
|
||||
'FragmentOrElement.cpp',
|
||||
'IdleDeadline.cpp',
|
||||
'ImageEncoder.cpp',
|
||||
'ImportManager.cpp',
|
||||
'Link.cpp',
|
||||
|
|
|
@ -371,7 +371,10 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
|
|||
}
|
||||
|
||||
if (dirAffectsAncestor) {
|
||||
TextNodeChangedDirection(this, oldDir, aNotify);
|
||||
// dirAffectsAncestor being true implies that we have a text node, see
|
||||
// above.
|
||||
MOZ_ASSERT(NodeType() == nsIDOMNode::TEXT_NODE);
|
||||
TextNodeChangedDirection(static_cast<nsTextNode*>(this), oldDir, aNotify);
|
||||
}
|
||||
|
||||
// Notify observers
|
||||
|
|
|
@ -1143,6 +1143,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
|||
mTimeoutsSuspendDepth(0),
|
||||
mFocusMethod(0),
|
||||
mSerial(0),
|
||||
mIdleRequestCallbackCounter(1),
|
||||
#ifdef DEBUG
|
||||
mSetOpenerWindowCalled(false),
|
||||
#endif
|
||||
|
@ -13858,3 +13859,35 @@ nsGlobalWindow::CreateImageBitmap(const ImageBitmapSource& aImage,
|
|||
{
|
||||
return ImageBitmap::Create(this, aImage, Some(gfx::IntRect(aSx, aSy, aSw, aSh)), aRv);
|
||||
}
|
||||
|
||||
/* Support for requestIdleCallback() from TenFourFox issue 463 */
|
||||
|
||||
uint32_t
|
||||
nsGlobalWindow::RequestIdleCallback(JSContext* aCx,
|
||||
IdleRequestCallback& aCallback,
|
||||
const IdleRequestOptions& aOptions,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(IsInnerWindow());
|
||||
AssertIsOnMainThread();
|
||||
|
||||
// uint32_t handle = ++mIdleRequestCallbackCounter;
|
||||
|
||||
fprintf(stderr, "::RequestIdleCallback() is not yet implemented\n");
|
||||
#if DEBUG
|
||||
MOZ_ASSERT(0);
|
||||
#endif
|
||||
return 0; // handle;
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::CancelIdleCallback(uint32_t aHandle)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(IsInnerWindow());
|
||||
|
||||
fprintf(stderr, "::CancelIdleCallback() is not yet implemented\n");
|
||||
#if DEBUG
|
||||
MOZ_ASSERT(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ class RequestOrUSVString;
|
|||
class Selection;
|
||||
class SpeechSynthesis;
|
||||
class WakeLock;
|
||||
class IdleRequestCallback;
|
||||
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
||||
class WindowOrientationObserver;
|
||||
#endif
|
||||
|
@ -1042,6 +1043,13 @@ public:
|
|||
int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
|
||||
mozilla::ErrorResult& aError);
|
||||
void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
|
||||
|
||||
uint32_t RequestIdleCallback(JSContext* aCx,
|
||||
mozilla::dom::IdleRequestCallback& aCallback,
|
||||
const mozilla::dom::IdleRequestOptions& aOptions,
|
||||
mozilla::ErrorResult& aError);
|
||||
void CancelIdleCallback(uint32_t aHandle);
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
mozilla::dom::SpeechSynthesis*
|
||||
GetSpeechSynthesis(mozilla::ErrorResult& aError);
|
||||
|
@ -1791,6 +1799,9 @@ protected:
|
|||
|
||||
uint32_t mSerial;
|
||||
|
||||
// requestIdleCallback() support
|
||||
uint32_t mIdleRequestCallbackCounter;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool mSetOpenerWindowCalled;
|
||||
nsCOMPtr<nsIURI> mLastOpenedURI;
|
||||
|
|
|
@ -1621,8 +1621,11 @@ public:
|
|||
"ClearHasTextNodeDirectionalityMap on non-text node");
|
||||
ClearBoolFlag(NodeHasTextNodeDirectionalityMap);
|
||||
}
|
||||
bool HasTextNodeDirectionalityMap() const
|
||||
{ return GetBoolFlag(NodeHasTextNodeDirectionalityMap); }
|
||||
bool HasTextNodeDirectionalityMap() const {
|
||||
MOZ_ASSERT(NodeType() == nsIDOMNode::TEXT_NODE,
|
||||
"HasTextNodeDirectionalityMap on non-text node");
|
||||
return GetBoolFlag(NodeHasTextNodeDirectionalityMap);
|
||||
}
|
||||
|
||||
void SetHasDirAuto() { SetBoolFlag(NodeHasDirAuto); }
|
||||
void ClearHasDirAuto() { ClearBoolFlag(NodeHasDirAuto); }
|
||||
|
|
|
@ -918,10 +918,10 @@ PerformanceBase::ClearResourceTimings()
|
|||
DOMHighResTimeStamp
|
||||
PerformanceBase::RoundTime(double aTime) const
|
||||
{
|
||||
// Round down to the nearest 5us, because if the timer is too accurate people
|
||||
// can do nasty timing attacks with it. See similar code in the worker
|
||||
// Performance implementation.
|
||||
const double maxResolutionMs = 0.005;
|
||||
// Round down to the nearest 20us, because if the timer is too accurate people
|
||||
// can do nasty timing attacks with it. See TenFourFox issue 459 and
|
||||
// bug 1427870.
|
||||
const double maxResolutionMs = 0.020;
|
||||
return floor(aTime / maxResolutionMs) * maxResolutionMs;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
using mozilla::dom::Text::GetParentElement;
|
||||
|
||||
// nsIDOMCharacterData
|
||||
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
||||
|
|
|
@ -1610,6 +1610,9 @@ DOMInterfaces = {
|
|||
'binaryNames': {
|
||||
'postMessage': 'postMessageMoz',
|
||||
},
|
||||
'implicitJSContext': [
|
||||
'requestIdleCallback'
|
||||
],
|
||||
},
|
||||
|
||||
'WindowProxy': {
|
||||
|
|
|
@ -1642,7 +1642,7 @@ class CGClassConstructor(CGAbstractStaticMethod):
|
|||
return ThrowConstructorWithoutNew(cx, "${ctorName}");
|
||||
}
|
||||
JS::Rooted<JSObject*> desiredProto(cx);
|
||||
if (!GetDesiredProto(cx, args, &desiredProto)) {
|
||||
if (MOZ_UNLIKELY(!GetDesiredProto(cx, args, &desiredProto))) {
|
||||
return false;
|
||||
}
|
||||
""",
|
||||
|
@ -2672,10 +2672,10 @@ class CGJsonifyAttributesMethod(CGAbstractMethod):
|
|||
"""
|
||||
{ // scope for "temp"
|
||||
JS::Rooted<JS::Value> temp(aCx);
|
||||
if (!get_${name}(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
|
||||
if (MOZ_UNLIKELY(!get_${name}(aCx, obj, self, JSJitGetterCallArgs(&temp)))) {
|
||||
return false;
|
||||
}
|
||||
if (!JS_DefineProperty(aCx, aResult, "${name}", temp, JSPROP_ENUMERATE)) {
|
||||
if (MOZ_UNLIKELY(!JS_DefineProperty(aCx, aResult, "${name}", temp, JSPROP_ENUMERATE))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3311,7 +3311,7 @@ def CreateBindingJSObject(descriptor, properties):
|
|||
"""
|
||||
creator.CreateProxyObject(aCx, &Class.mBase, DOMProxyHandler::getInstance(),
|
||||
proto, aObject, aReflector);
|
||||
if (!aReflector) {
|
||||
if (MOZ_UNLIKELY(!aReflector)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3326,7 +3326,7 @@ def CreateBindingJSObject(descriptor, properties):
|
|||
create = dedent(
|
||||
"""
|
||||
creator.CreateObject(aCx, Class.ToJSClass(), proto, aObject, aReflector);
|
||||
if (!aReflector) {
|
||||
if (MOZ_UNLIKELY(!aReflector)) {
|
||||
return false;
|
||||
}
|
||||
""")
|
||||
|
@ -3431,7 +3431,7 @@ def CopyUnforgeablePropertiesToInstance(descriptor, wrapperCache):
|
|||
"""
|
||||
JS::Rooted<JSObject*> expando(aCx,
|
||||
DOMProxyHandler::EnsureExpandoObject(aCx, aReflector));
|
||||
if (!expando) {
|
||||
if (MOZ_UNLIKELY(!expando)) {
|
||||
$*{cleanup}
|
||||
return false;
|
||||
}
|
||||
|
@ -3452,7 +3452,7 @@ def CopyUnforgeablePropertiesToInstance(descriptor, wrapperCache):
|
|||
"""
|
||||
JS::Rooted<JSObject*> unforgeableHolder(aCx,
|
||||
&js::GetReservedSlot(canonicalProto, DOM_INTERFACE_PROTO_SLOTS_BASE).toObject());
|
||||
if (!${copyFunc}(aCx, ${obj}, unforgeableHolder)) {
|
||||
if (MOZ_UNLIKELY(!${copyFunc}(aCx, ${obj}, unforgeableHolder))) {
|
||||
$*{cleanup}
|
||||
return false;
|
||||
}
|
||||
|
@ -3500,7 +3500,7 @@ def InitMemberSlots(descriptor, wrapperCache):
|
|||
clearWrapper = ""
|
||||
return fill(
|
||||
"""
|
||||
if (!UpdateMemberSlots(aCx, aReflector, aObject)) {
|
||||
if (MOZ_UNLIKELY(!UpdateMemberSlots(aCx, aReflector, aObject))) {
|
||||
$*{clearWrapper}
|
||||
return false;
|
||||
}
|
||||
|
@ -3515,7 +3515,7 @@ def DeclareProto():
|
|||
return dedent(
|
||||
"""
|
||||
JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx, global);
|
||||
if (!canonicalProto) {
|
||||
if (MOZ_UNLIKELY(!canonicalProto)) {
|
||||
return false;
|
||||
}
|
||||
JS::Rooted<JSObject*> proto(aCx);
|
||||
|
@ -3525,7 +3525,7 @@ def DeclareProto():
|
|||
// coming in, we changed compartments to that of "parent" so may need
|
||||
// to wrap the proto here.
|
||||
if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
|
||||
if (!JS_WrapObject(aCx, &proto)) {
|
||||
if (MOZ_UNLIKELY(!JS_WrapObject(aCx, &proto))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3573,7 +3573,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
|
|||
"nsISupports must be on our primary inheritance chain");
|
||||
|
||||
JS::Rooted<JSObject*> parent(aCx, WrapNativeParent(aCx, aObject->GetParentObject()));
|
||||
if (!parent) {
|
||||
if (MOZ_UNLIKELY(!parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3738,7 +3738,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
|||
aPrincipal,
|
||||
aInitStandardClasses,
|
||||
aReflector);
|
||||
if (!aReflector) {
|
||||
if (MOZ_UNLIKELY(!aReflector)) {
|
||||
return false;
|
||||
}
|
||||
$*{assertProto}
|
||||
|
@ -3747,7 +3747,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
|||
// before doing anything with it.
|
||||
JSAutoCompartment ac(aCx, aReflector);
|
||||
|
||||
if (!DefineProperties(aCx, aReflector, ${properties}, ${chromeProperties})) {
|
||||
if (MOZ_UNLIKELY(!DefineProperties(aCx, aReflector, ${properties}, ${chromeProperties}))) {
|
||||
return false;
|
||||
}
|
||||
$*{unforgeable}
|
||||
|
@ -3790,7 +3790,7 @@ class CGUpdateMemberSlotsMethod(CGAbstractStaticMethod):
|
|||
body += fill(
|
||||
"""
|
||||
|
||||
if (!get_${member}(aCx, aWrapper, aObject, args)) {
|
||||
if (MOZ_UNLIKELY(!get_${member}(aCx, aWrapper, aObject, args))) {
|
||||
return false;
|
||||
}
|
||||
// Getter handled setting our reserved slots
|
||||
|
@ -3832,7 +3832,7 @@ class CGClearCachedValueMethod(CGAbstractMethod):
|
|||
JS::Rooted<JS::Value> temp(aCx);
|
||||
JSJitGetterCallArgs args(&temp);
|
||||
JSAutoCompartment ac(aCx, obj);
|
||||
if (!get_${name}(aCx, obj, aObject, args)) {
|
||||
if (MOZ_UNLIKELY(!get_${name}(aCx, obj, aObject, args))) {
|
||||
js::SetReservedSlot(obj, ${slotIndex}, oldValue);
|
||||
return false;
|
||||
}
|
||||
|
@ -6026,7 +6026,7 @@ class CGArgumentConverter(CGThing):
|
|||
rooterDecl +
|
||||
dedent("""
|
||||
if (${argc} > ${index}) {
|
||||
if (!${declName}.SetCapacity(${argc} - ${index}, mozilla::fallible)) {
|
||||
if (MOZ_UNLIKELY(!${declName}.SetCapacity(${argc} - ${index}, mozilla::fallible))) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
|
@ -6912,7 +6912,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True):
|
|||
value = "JS::MutableHandle<JS::Value>::fromMarkedLocation(&%s)" % value
|
||||
else:
|
||||
value = "&" + value
|
||||
return CGGeneric("if (!JS_WrapValue(cx, %s)) {\n"
|
||||
return CGGeneric("if (MOZ_UNLIKELY(!JS_WrapValue(cx, %s))) {\n"
|
||||
" return false;\n"
|
||||
"}\n" % value)
|
||||
|
||||
|
@ -6921,7 +6921,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True):
|
|||
value = "JS::MutableHandle<JSObject*>::fromMarkedLocation(&%s)" % value
|
||||
else:
|
||||
value = "&" + value
|
||||
return CGGeneric("if (!JS_WrapObject(cx, %s)) {\n"
|
||||
return CGGeneric("if (MOZ_UNLIKELY(!JS_WrapObject(cx, %s))) {\n"
|
||||
" return false;\n"
|
||||
"}\n" % value)
|
||||
|
||||
|
@ -6929,7 +6929,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True):
|
|||
origValue = value
|
||||
if type.nullable():
|
||||
value = "%s.Value()" % value
|
||||
wrapCode = CGGeneric("if (!%s.WrapIntoNewCompartment(cx)) {\n"
|
||||
wrapCode = CGGeneric("if (MOZ_UNLIKELY(!%s.WrapIntoNewCompartment(cx))) {\n"
|
||||
" return false;\n"
|
||||
"}\n" % value)
|
||||
if type.nullable():
|
||||
|
@ -7131,7 +7131,7 @@ class CGPerSignatureCall(CGThing):
|
|||
cgThings.append(CGGeneric(fill(
|
||||
"""
|
||||
GlobalObject global(cx, ${obj});
|
||||
if (global.Failed()) {
|
||||
if (MOZ_UNLIKELY(global.Failed())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -7269,7 +7269,7 @@ class CGPerSignatureCall(CGThing):
|
|||
CGGeneric(fill(
|
||||
"""
|
||||
${obj} = js::CheckedUnwrap(${obj});
|
||||
if (!${obj}) {
|
||||
if (MOZ_UNLIKELY(!${obj})) {
|
||||
return false;
|
||||
}
|
||||
""",
|
||||
|
@ -7288,7 +7288,7 @@ class CGPerSignatureCall(CGThing):
|
|||
xraySteps.append(CGGeneric("ac.emplace(cx, obj);\n"))
|
||||
xraySteps.append(CGGeneric(dedent(
|
||||
"""
|
||||
if (!JS_WrapObject(cx, &desiredProto)) {
|
||||
if (MOZ_UNLIKELY(!JS_WrapObject(cx, &desiredProto))) {
|
||||
return false;
|
||||
}
|
||||
""")))
|
||||
|
@ -7384,7 +7384,7 @@ class CGPerSignatureCall(CGThing):
|
|||
assert self.idlNode.type.isSequence() or self.idlNode.type.isDictionary()
|
||||
freezeValue = CGGeneric(
|
||||
"JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());\n"
|
||||
"if (!JS_FreezeObject(cx, rvalObj)) {\n"
|
||||
"if (MOZ_UNLIKELY(!JS_FreezeObject(cx, rvalObj))) {\n"
|
||||
" return false;\n"
|
||||
"}\n")
|
||||
if self.idlNode.type.nullable():
|
||||
|
@ -8239,7 +8239,7 @@ class CGJsonifierMethod(CGSpecializedMethod):
|
|||
def definition_body(self):
|
||||
ret = dedent("""
|
||||
JS::Rooted<JSObject*> result(cx, JS_NewPlainObject(cx));
|
||||
if (!result) {
|
||||
if (MOZ_UNLIKELY(!result)) {
|
||||
return false;
|
||||
}
|
||||
""")
|
||||
|
@ -8256,7 +8256,7 @@ class CGJsonifierMethod(CGSpecializedMethod):
|
|||
for descriptor in jsonDescriptors[::-1]:
|
||||
ret += fill(
|
||||
"""
|
||||
if (!${parentclass}::JsonifyAttributes(cx, obj, self, result)) {
|
||||
if (MOZ_UNLIKELY(!${parentclass}::JsonifyAttributes(cx, obj, self, result))) {
|
||||
return false;
|
||||
}
|
||||
""",
|
||||
|
@ -8307,10 +8307,10 @@ class CGResolveHook(CGAbstractClassHook):
|
|||
def generate_code(self):
|
||||
return dedent("""
|
||||
JS::Rooted<JSPropertyDescriptor> desc(cx);
|
||||
if (!self->DoResolve(cx, obj, id, &desc)) {
|
||||
if (MOZ_UNLIKELY(!self->DoResolve(cx, obj, id, &desc))) {
|
||||
return false;
|
||||
}
|
||||
if (!desc.object()) {
|
||||
if (MOZ_UNLIKELY(!desc.object())) {
|
||||
return true;
|
||||
}
|
||||
// If desc.value() is undefined, then the DoResolve call
|
||||
|
@ -8318,7 +8318,7 @@ class CGResolveHook(CGAbstractClassHook):
|
|||
// define it.
|
||||
if (!desc.value().isUndefined()) {
|
||||
desc.attributesRef() |= JSPROP_RESOLVING;
|
||||
if (!JS_DefinePropertyById(cx, obj, id, desc)) {
|
||||
if (MOZ_UNLIKELY(!JS_DefinePropertyById(cx, obj, id, desc))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -8330,7 +8330,7 @@ class CGResolveHook(CGAbstractClassHook):
|
|||
if self.descriptor.isGlobal():
|
||||
# Resolve standard classes
|
||||
prefix = dedent("""
|
||||
if (!ResolveGlobal(cx, obj, id, resolvedp)) {
|
||||
if (MOZ_UNLIKELY(!ResolveGlobal(cx, obj, id, resolvedp))) {
|
||||
return false;
|
||||
}
|
||||
if (*resolvedp) {
|
||||
|
@ -8390,7 +8390,7 @@ class CGEnumerateHook(CGAbstractBindingMethod):
|
|||
nsAutoTArray<nsString, 8> names;
|
||||
ErrorResult rv;
|
||||
self->GetOwnPropertyNames(cx, names, rv);
|
||||
if (rv.MaybeSetPendingException(cx)) {
|
||||
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
|
||||
return false;
|
||||
}
|
||||
bool dummy;
|
||||
|
@ -8406,7 +8406,7 @@ class CGEnumerateHook(CGAbstractBindingMethod):
|
|||
if self.descriptor.isGlobal():
|
||||
# Enumerate standard classes
|
||||
prefix = dedent("""
|
||||
if (!EnumerateGlobal(cx, obj)) {
|
||||
if (MOZ_UNLIKELY(!EnumerateGlobal(cx, obj))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -8466,7 +8466,7 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
|||
name = "genericLenientGetter"
|
||||
unwrapFailureCode = dedent("""
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
if (!ReportLenientThisUnwrappingFailure(cx, &args.callee())) {
|
||||
if (MOZ_UNLIKELY(!ReportLenientThisUnwrappingFailure(cx, &args.callee()))) {
|
||||
return false;
|
||||
}
|
||||
args.rval().set(JS::UndefinedValue());
|
||||
|
@ -8597,7 +8597,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||
name = "genericLenientSetter"
|
||||
unwrapFailureCode = dedent("""
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
if (!ReportLenientThisUnwrappingFailure(cx, &args.callee())) {
|
||||
if (MOZ_UNLIKELY(!ReportLenientThisUnwrappingFailure(cx, &args.callee()))) {
|
||||
return false;
|
||||
}
|
||||
args.rval().set(JS::UndefinedValue());
|
||||
|
@ -8625,7 +8625,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||
const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(args.calleev());
|
||||
MOZ_ASSERT(info->type() == JSJitInfo::Setter);
|
||||
JSJitSetterOp setter = info->setter;
|
||||
if (!setter(cx, obj, self, JSJitSetterCallArgs(args))) {
|
||||
if (MOZ_UNLIKELY(!setter(cx, obj, self, JSJitSetterCallArgs(args)))) {
|
||||
return false;
|
||||
}
|
||||
args.rval().setUndefined();
|
||||
|
@ -8704,11 +8704,11 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter):
|
|||
return fill(
|
||||
"""
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!JS_GetProperty(cx, obj, "${attr}", &v)) {
|
||||
if (MOZ_UNLIKELY(!JS_GetProperty(cx, obj, "${attr}", &v))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!v.isObject()) {
|
||||
if (MOZ_UNLIKELY(!v.isObject())) {
|
||||
return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "${interface}.${attr}");
|
||||
}
|
||||
|
||||
|
@ -9204,7 +9204,7 @@ class CGEnumToJSValue(CGAbstractMethod):
|
|||
JSString* resultStr =
|
||||
JS_NewStringCopyN(aCx, ${strings}[uint32_t(aArgument)].value,
|
||||
${strings}[uint32_t(aArgument)].length);
|
||||
if (!resultStr) {
|
||||
if (MOZ_UNLIKELY(!resultStr)) {
|
||||
return false;
|
||||
}
|
||||
aValue.setString(resultStr);
|
||||
|
@ -9382,7 +9382,7 @@ def getUnionTypeTemplateVars(unionType, type, descriptorProvider,
|
|||
# but it keeps the code cleaner and lets us avoid rooting |obj| over the
|
||||
# call to CallerSubsumes().
|
||||
body = body + dedent("""
|
||||
if (passedToJSImpl && !CallerSubsumes(obj)) {
|
||||
if (MOZ_UNLIKELY(passedToJSImpl && !CallerSubsumes(obj))) {
|
||||
ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "%s");
|
||||
return false;
|
||||
}
|
||||
|
@ -10408,15 +10408,15 @@ class CGResolveOwnPropertyViaResolve(CGAbstractBindingMethod):
|
|||
// them.
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
JS::Rooted<JSPropertyDescriptor> objDesc(cx);
|
||||
if (!self->DoResolve(cx, obj, id, &objDesc)) {
|
||||
if (MOZ_UNLIKELY(!self->DoResolve(cx, obj, id, &objDesc))) {
|
||||
return false;
|
||||
}
|
||||
// If desc.value() is undefined, then the DoResolve call
|
||||
// has already defined the property on the object. Don't
|
||||
// try to also define it.
|
||||
if (objDesc.object() &&
|
||||
if (MOZ_UNLIKELY(objDesc.object() &&
|
||||
!objDesc.value().isUndefined() &&
|
||||
!JS_DefinePropertyById(cx, obj, id, objDesc)) {
|
||||
!JS_DefinePropertyById(cx, obj, id, objDesc))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -10717,7 +10717,7 @@ class CGProxyNamedOperation(CGProxySpecialOperation):
|
|||
"""
|
||||
$*{decls}
|
||||
bool isSymbol;
|
||||
if (!ConvertIdToString(cx, ${idName}, ${argName}, isSymbol)) {
|
||||
if (MOZ_UNLIKELY(!ConvertIdToString(cx, ${idName}, ${argName}, isSymbol))) {
|
||||
return false;
|
||||
}
|
||||
if (!isSymbol) {
|
||||
|
@ -10738,8 +10738,8 @@ class CGProxyNamedOperation(CGProxySpecialOperation):
|
|||
$*{decls}
|
||||
JS::Rooted<JS::Value> nameVal(cx, ${value});
|
||||
if (!nameVal.isSymbol()) {
|
||||
if (!ConvertJSValueToString(cx, nameVal, eStringify, eStringify,
|
||||
${argName})) {
|
||||
if (MOZ_UNLIKELY(!ConvertJSValueToString(cx, nameVal, eStringify, eStringify,
|
||||
${argName}))) {
|
||||
return false;
|
||||
}
|
||||
$*{main}
|
||||
|
@ -10890,7 +10890,7 @@ class CGDOMJSProxyHandler_getOwnPropDescriptor(ClassMethod):
|
|||
|
||||
computeCondition = dedent("""
|
||||
bool hasOnProto;
|
||||
if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
|
||||
if (MOZ_UNLIKELY(!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto))) {
|
||||
return false;
|
||||
}
|
||||
callNamedGetter = !hasOnProto;
|
||||
|
@ -10934,7 +10934,7 @@ class CGDOMJSProxyHandler_getOwnPropDescriptor(ClassMethod):
|
|||
$*{getIndexed}
|
||||
JS::Rooted<JSObject*> expando(cx);
|
||||
if (!isXray && (expando = GetExpandoObject(proxy))) {
|
||||
if (!JS_GetOwnPropertyDescriptorById(cx, expando, id, desc)) {
|
||||
if (MOZ_UNLIKELY(!JS_GetOwnPropertyDescriptorById(cx, expando, id, desc))) {
|
||||
return false;
|
||||
}
|
||||
if (desc.object()) {
|
||||
|
@ -11150,7 +11150,7 @@ class CGDOMJSProxyHandler_delete(ClassMethod):
|
|||
delete = fill(
|
||||
"""
|
||||
bool hasOnProto;
|
||||
if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
|
||||
if (MOZ_UNLIKELY(!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto))) {
|
||||
return false;
|
||||
}
|
||||
if (!hasOnProto) {
|
||||
|
@ -11185,7 +11185,7 @@ class CGDOMJSProxyHandler_ownPropNames(ClassMethod):
|
|||
uint32_t length = UnwrapProxy(proxy)->Length();
|
||||
MOZ_ASSERT(int32_t(length) >= 0);
|
||||
for (int32_t i = 0; i < int32_t(length); ++i) {
|
||||
if (!props.append(INT_TO_JSID(i))) {
|
||||
if (MOZ_UNLIKELY(!props.append(INT_TO_JSID(i)))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -11203,7 +11203,7 @@ class CGDOMJSProxyHandler_ownPropNames(ClassMethod):
|
|||
|
||||
nsTArray<nsString> names;
|
||||
UnwrapProxy(proxy)->GetSupportedNames(flags, names);
|
||||
if (!AppendNamedPropertyIds(cx, proxy, names, ${shadow}, props)) {
|
||||
if (MOZ_UNLIKELY(!AppendNamedPropertyIds(cx, proxy, names, ${shadow}, props))) {
|
||||
return false;
|
||||
}
|
||||
""",
|
||||
|
@ -11218,8 +11218,8 @@ class CGDOMJSProxyHandler_ownPropNames(ClassMethod):
|
|||
$*{addNames}
|
||||
|
||||
JS::Rooted<JSObject*> expando(cx);
|
||||
if (!isXray && (expando = DOMProxyHandler::GetExpandoObject(proxy)) &&
|
||||
!js::GetPropertyKeys(cx, expando, flags, &props)) {
|
||||
if (MOZ_UNLIKELY(!isXray && (expando = DOMProxyHandler::GetExpandoObject(proxy)) &&
|
||||
!js::GetPropertyKeys(cx, expando, flags, &props))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -11272,7 +11272,7 @@ class CGDOMJSProxyHandler_hasOwn(ClassMethod):
|
|||
named = fill(
|
||||
"""
|
||||
bool hasOnProto;
|
||||
if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
|
||||
if (MOZ_UNLIKELY(!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto))) {
|
||||
return false;
|
||||
}
|
||||
if (!hasOnProto) {
|
||||
|
@ -11328,7 +11328,7 @@ class CGDOMJSProxyHandler_get(ClassMethod):
|
|||
JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy));
|
||||
if (expando) {
|
||||
bool hasProp;
|
||||
if (!JS_HasPropertyById(cx, expando, id, &hasProp)) {
|
||||
if (MOZ_UNLIKELY(!JS_HasPropertyById(cx, expando, id, &hasProp))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -11370,7 +11370,7 @@ class CGDOMJSProxyHandler_get(ClassMethod):
|
|||
|
||||
getOnPrototype = dedent("""
|
||||
bool foundOnPrototype;
|
||||
if (!GetPropertyOnPrototype(cx, proxy, receiver, id, &foundOnPrototype, vp)) {
|
||||
if (MOZ_UNLIKELY(!GetPropertyOnPrototype(cx, proxy, receiver, id, &foundOnPrototype, vp))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -11544,7 +11544,7 @@ class CGDOMJSProxyHandler_getElements(ClassMethod):
|
|||
|
||||
if (end > ourEnd) {
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
if (!js::GetObjectProto(cx, proxy, &proto)) {
|
||||
if (MOZ_UNLIKELY(!js::GetObjectProto(cx, proxy, &proto))) {
|
||||
return false;
|
||||
}
|
||||
return js::GetElementsWithAdder(cx, proto, proxy, ourEnd, end, adder);
|
||||
|
@ -12101,7 +12101,7 @@ def initIdsClassMethod(identifiers, atomCacheName):
|
|||
|
||||
// Initialize these in reverse order so that any failure leaves the first one
|
||||
// uninitialized.
|
||||
if (${idinit}) {
|
||||
if (MOZ_UNLIKELY(${idinit})) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -12172,7 +12172,7 @@ class CGDictionary(CGThing):
|
|||
${dictName}Atoms* atomsCache = nullptr;
|
||||
if (cx) {
|
||||
atomsCache = GetAtomCache<${dictName}Atoms>(cx);
|
||||
if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
|
||||
if (MOZ_UNLIKELY(!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -12184,7 +12184,7 @@ class CGDictionary(CGThing):
|
|||
body += fill(
|
||||
"""
|
||||
// Per spec, we init the parent's members first
|
||||
if (!${dictName}::Init(cx, val)) {
|
||||
if (MOZ_UNLIKELY(!${dictName}::Init(cx, val))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -12195,7 +12195,7 @@ class CGDictionary(CGThing):
|
|||
"""
|
||||
{ // scope for isConvertible
|
||||
bool isConvertible;
|
||||
if (!IsConvertibleToDictionary(cx, val, &isConvertible)) {
|
||||
if (MOZ_UNLIKELY(!IsConvertibleToDictionary(cx, val, &isConvertible))) {
|
||||
return false;
|
||||
}
|
||||
if (!isConvertible) {
|
||||
|
@ -12264,7 +12264,7 @@ class CGDictionary(CGThing):
|
|||
body += fill(
|
||||
"""
|
||||
${dictName}Atoms* atomsCache = GetAtomCache<${dictName}Atoms>(cx);
|
||||
if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
|
||||
if (MOZ_UNLIKELY(!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -12275,7 +12275,7 @@ class CGDictionary(CGThing):
|
|||
body += fill(
|
||||
"""
|
||||
// Per spec, we define the parent's members first
|
||||
if (!${dictName}::ToObjectInternal(cx, rval)) {
|
||||
if (MOZ_UNLIKELY(!${dictName}::ToObjectInternal(cx, rval))) {
|
||||
return false;
|
||||
}
|
||||
JS::Rooted<JSObject*> obj(cx, &rval.toObject());
|
||||
|
@ -12286,7 +12286,7 @@ class CGDictionary(CGThing):
|
|||
body += dedent(
|
||||
"""
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
if (MOZ_UNLIKELY(!obj)) {
|
||||
return false;
|
||||
}
|
||||
rval.set(JS::ObjectValue(*obj));
|
||||
|
@ -14474,7 +14474,7 @@ class CGJSImplClass(CGBindingImplClass):
|
|||
// GlobalObject will go through wrappers as needed for us, and
|
||||
// is simpler than the right UnwrapArg incantation.
|
||||
GlobalObject global(cx, &args[0].toObject());
|
||||
if (global.Failed()) {
|
||||
if (MOZ_UNLIKELY(global.Failed())) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIGlobalObject> globalHolder = do_QueryInterface(global.GetAsSupports());
|
||||
|
@ -15413,7 +15413,7 @@ class CGMaplikeOrSetlikeMethodGenerator(CGThing):
|
|||
"""
|
||||
// TODO (Bug 1173651): Xrays currently cannot wrap iterators. Change
|
||||
// after bug 1023984 is fixed.
|
||||
if (xpc::WrapperFactory::IsXrayWrapper(obj)) {
|
||||
if (MOZ_UNLIKELY(xpc::WrapperFactory::IsXrayWrapper(obj))) {
|
||||
JS_ReportError(cx, "Xray wrapping of iterators not supported.");
|
||||
return false;
|
||||
}
|
||||
|
@ -15463,7 +15463,7 @@ class CGMaplikeOrSetlikeMethodGenerator(CGThing):
|
|||
"""
|
||||
// Create a wrapper function.
|
||||
JSFunction* func = js::NewFunctionWithReserved(cx, ForEachHandler, 3, 0, nullptr);
|
||||
if (!func) {
|
||||
if (MOZ_UNLIKELY(!func)) {
|
||||
return false;
|
||||
}
|
||||
JS::Rooted<JSObject*> funcObj(cx, JS_GetFunctionObject(func));
|
||||
|
|
|
@ -3900,12 +3900,15 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> targetContent = aTargetContent;
|
||||
nsCOMPtr<nsIContent> relatedContent = aRelatedContent;
|
||||
|
||||
nsAutoPtr<WidgetMouseEvent> dispatchEvent;
|
||||
CreateMouseOrPointerWidgetEvent(aMouseEvent, aMessage,
|
||||
aRelatedContent, dispatchEvent);
|
||||
relatedContent, dispatchEvent);
|
||||
|
||||
nsWeakFrame previousTarget = mCurrentTarget;
|
||||
mCurrentTargetContent = aTargetContent;
|
||||
mCurrentTargetContent = targetContent;
|
||||
|
||||
nsIFrame* targetFrame = nullptr;
|
||||
|
||||
|
@ -3915,23 +3918,23 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
|||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
ESMEventCB callback(aTargetContent);
|
||||
EventDispatcher::Dispatch(aTargetContent, mPresContext, dispatchEvent, nullptr,
|
||||
ESMEventCB callback(targetContent);
|
||||
EventDispatcher::Dispatch(targetContent, mPresContext, dispatchEvent, nullptr,
|
||||
&status, &callback);
|
||||
|
||||
if (mPresContext) {
|
||||
// Although the primary frame was checked in event callback, it may not be
|
||||
// the same object after event dispatch and handling, so refetch it.
|
||||
targetFrame = mPresContext->GetPrimaryFrameFor(aTargetContent);
|
||||
targetFrame = mPresContext->GetPrimaryFrameFor(targetContent);
|
||||
|
||||
// If we are entering/leaving remote content, dispatch a mouse enter/exit
|
||||
// event to the remote frame.
|
||||
if (IsRemoteTarget(aTargetContent)) {
|
||||
if (IsRemoteTarget(targetContent)) {
|
||||
if (aMessage == eMouseOut) {
|
||||
// For remote content, send a "top-level" widget mouse exit event.
|
||||
nsAutoPtr<WidgetMouseEvent> remoteEvent;
|
||||
CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseExitFromWidget,
|
||||
aRelatedContent, remoteEvent);
|
||||
relatedContent, remoteEvent);
|
||||
remoteEvent->exit = WidgetMouseEvent::eTopLevel;
|
||||
|
||||
// mCurrentTarget is set to the new target, so we must reset it to the
|
||||
|
@ -3943,7 +3946,7 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
|||
} else if (aMessage == eMouseOver) {
|
||||
nsAutoPtr<WidgetMouseEvent> remoteEvent;
|
||||
CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseEnterIntoWidget,
|
||||
aRelatedContent, remoteEvent);
|
||||
relatedContent, remoteEvent);
|
||||
HandleCrossProcessEvent(remoteEvent, &status);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3110,11 +3110,13 @@ public:
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
|
||||
if (MOZ_UNLIKELY(!mElement)) return; // bug 1419363
|
||||
|
||||
mElement->NotifyMediaStreamTracksAvailable(aStream);
|
||||
}
|
||||
|
||||
private:
|
||||
HTMLMediaElement* mElement;
|
||||
WeakPtr<HTMLMediaElement> mElement;
|
||||
};
|
||||
|
||||
class HTMLMediaElement::MediaStreamTrackListener :
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/TextTrackManager.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "MediaDecoder.h"
|
||||
#ifdef MOZ_EME
|
||||
#include "mozilla/dom/MediaKeys.h"
|
||||
|
@ -76,7 +77,8 @@ class HTMLMediaElement : public nsGenericHTMLElement,
|
|||
public nsIDOMHTMLMediaElement,
|
||||
public nsIObserver,
|
||||
public MediaDecoderOwner,
|
||||
public nsIAudioChannelAgentCallback
|
||||
public nsIAudioChannelAgentCallback,
|
||||
public SupportsWeakPtr<HTMLMediaElement>
|
||||
{
|
||||
friend AutoNotifyAudioChannelAgent;
|
||||
|
||||
|
@ -89,6 +91,8 @@ public:
|
|||
typedef mozilla::MediaDecoderOwner MediaDecoderOwner;
|
||||
typedef mozilla::MetadataTags MetadataTags;
|
||||
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(HTMLMediaElement)
|
||||
|
||||
CORSMode GetCORSMode() {
|
||||
return mCORSMode;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ MediaEngineDefaultVideoSource::Allocate(const dom::MediaTrackConstraints &aConst
|
|||
mOpts = aPrefs;
|
||||
mOpts.mWidth = mOpts.mWidth ? mOpts.mWidth : MediaEngine::DEFAULT_43_VIDEO_WIDTH;
|
||||
mOpts.mHeight = mOpts.mHeight ? mOpts.mHeight : MediaEngine::DEFAULT_43_VIDEO_HEIGHT;
|
||||
mOpts.mWidth = std::max(160, std::min(mOpts.mWidth, 4096));
|
||||
mOpts.mHeight = std::max(90, std::min(mOpts.mHeight, 2160));
|
||||
mState = kAllocated;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
15
dom/webidl/IdleDeadline.webidl
Normal file
15
dom/webidl/IdleDeadline.webidl
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*
|
||||
* The origin of this IDL file is:
|
||||
* https://w3c.github.io/requestidlecallback/
|
||||
*/
|
||||
|
||||
[Pref="dom.requestIdleCallback.enabled"]
|
||||
interface IdleDeadline {
|
||||
DOMHighResTimeStamp timeRemaining();
|
||||
readonly attribute boolean didTimeout;
|
||||
};
|
||||
|
|
@ -494,3 +494,17 @@ interface ChromeWindow {
|
|||
Window implements ChromeWindow;
|
||||
Window implements GlobalFetch;
|
||||
Window implements ImageBitmapFactories;
|
||||
|
||||
partial interface Window {
|
||||
[Throws, Pref="dom.requestIdleCallback.enabled"]
|
||||
unsigned long requestIdleCallback(IdleRequestCallback callback,
|
||||
optional IdleRequestOptions options);
|
||||
[Pref="dom.requestIdleCallback.enabled"]
|
||||
void cancelIdleCallback(unsigned long handle);
|
||||
};
|
||||
|
||||
dictionary IdleRequestOptions {
|
||||
unsigned long timeout;
|
||||
};
|
||||
|
||||
callback IdleRequestCallback = void (IdleDeadline deadline);
|
||||
|
|
|
@ -264,6 +264,7 @@ WEBIDL_FILES = [
|
|||
'IDBRequest.webidl',
|
||||
'IDBTransaction.webidl',
|
||||
'IDBVersionChangeEvent.webidl',
|
||||
'IdleDeadline.webidl',
|
||||
'ImageBitmap.webidl',
|
||||
'ImageCapture.webidl',
|
||||
'ImageData.webidl',
|
||||
|
|
|
@ -1929,7 +1929,7 @@ XMLHttpRequest::Open(const nsACString& aMethod, const nsAString& aUrl,
|
|||
|
||||
++mProxy->mOpenCount;
|
||||
if (!runnable->Dispatch(mWorkerPrivate->GetJSContext())) {
|
||||
if (!--mProxy->mOpenCount) {
|
||||
if (mProxy && !--mProxy->mOpenCount) {
|
||||
ReleaseProxy();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,99 +142,6 @@ static void inline this_CGContextSetBlendMode(CGContextRef cg, CompositionOp op)
|
|||
(CGBlendMode)(pcm - kPrivateCGBlendModesStartHere));
|
||||
}
|
||||
|
||||
// marked for DEATH
|
||||
PrivateCGCompositeMode ToOldBlendMode(CompositionOp op)
|
||||
{
|
||||
PrivateCGCompositeMode mode = kPrivateCGCompositeSourceOver;
|
||||
switch (op) {
|
||||
case CompositionOp::OP_OVER:
|
||||
mode = kPrivateCGBlendModeNormal; // ??? kPrivateCGCompositeSourceOver;
|
||||
break;
|
||||
case CompositionOp::OP_ADD:
|
||||
mode = kPrivateCGCompositePlusLighter;
|
||||
break;
|
||||
case CompositionOp::OP_ATOP:
|
||||
mode = kPrivateCGCompositeSourceAtop;
|
||||
break;
|
||||
case CompositionOp::OP_OUT:
|
||||
mode = kPrivateCGCompositeSourceOut;
|
||||
break;
|
||||
case CompositionOp::OP_IN:
|
||||
mode = kPrivateCGCompositeSourceIn;
|
||||
break;
|
||||
case CompositionOp::OP_SOURCE:
|
||||
mode = kPrivateCGCompositeCopy;
|
||||
break;
|
||||
case CompositionOp::OP_DEST_IN:
|
||||
mode = kPrivateCGCompositeDestinationIn;
|
||||
break;
|
||||
case CompositionOp::OP_DEST_OUT:
|
||||
mode = kPrivateCGCompositeDestinationOut;
|
||||
break;
|
||||
case CompositionOp::OP_DEST_OVER:
|
||||
mode = kPrivateCGCompositeDestinationOver;
|
||||
break;
|
||||
case CompositionOp::OP_DEST_ATOP:
|
||||
mode = kPrivateCGCompositeSourceAtop;
|
||||
break;
|
||||
case CompositionOp::OP_XOR:
|
||||
mode = kPrivateCGCompositeXOR;
|
||||
break;
|
||||
case CompositionOp::OP_MULTIPLY:
|
||||
mode = kPrivateCGBlendModeMultiply;
|
||||
break;
|
||||
case CompositionOp::OP_SCREEN:
|
||||
mode = kPrivateCGBlendModeScreen;
|
||||
break;
|
||||
case CompositionOp::OP_OVERLAY:
|
||||
mode = kPrivateCGBlendModeOverlay;
|
||||
break;
|
||||
case CompositionOp::OP_DARKEN:
|
||||
mode = kPrivateCGBlendModeDarken;
|
||||
break;
|
||||
case CompositionOp::OP_LIGHTEN:
|
||||
mode = kPrivateCGBlendModeLighten;
|
||||
break;
|
||||
case CompositionOp::OP_COLOR_DODGE:
|
||||
mode = kPrivateCGBlendModeColorDodge;
|
||||
break;
|
||||
case CompositionOp::OP_COLOR_BURN:
|
||||
mode = kPrivateCGBlendModeColorBurn;
|
||||
break;
|
||||
case CompositionOp::OP_HARD_LIGHT:
|
||||
mode = kPrivateCGBlendModeHardLight;
|
||||
break;
|
||||
case CompositionOp::OP_SOFT_LIGHT:
|
||||
mode = kPrivateCGBlendModeSoftLight;
|
||||
break;
|
||||
case CompositionOp::OP_DIFFERENCE:
|
||||
mode = kPrivateCGBlendModeDifference;
|
||||
break;
|
||||
case CompositionOp::OP_EXCLUSION:
|
||||
mode = kPrivateCGBlendModeExclusion;
|
||||
break;
|
||||
case CompositionOp::OP_HUE:
|
||||
mode = kPrivateCGBlendModeHue;
|
||||
break;
|
||||
case CompositionOp::OP_SATURATION:
|
||||
mode = kPrivateCGBlendModeSaturation;
|
||||
break;
|
||||
case CompositionOp::OP_COLOR:
|
||||
mode = kPrivateCGBlendModeColor;
|
||||
break;
|
||||
case CompositionOp::OP_LUMINOSITY:
|
||||
mode = kPrivateCGBlendModeLuminosity;
|
||||
break;
|
||||
/*
|
||||
case OP_CLEAR:
|
||||
mode = kPrivateCGCompositeClear;
|
||||
break;*/
|
||||
default:
|
||||
mode = kPrivateCGBlendModeNormal; // ??? kPrivateCGCompositeSourceOver;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void inline this_CGContextSetBlendMode(CGContextRef cg, CGBlendMode m) {
|
||||
|
@ -348,6 +255,25 @@ InterpolationQualityFromFilter(Filter aFilter)
|
|||
}
|
||||
}
|
||||
|
||||
// TenFourFox issue 453
|
||||
// There is no bounds-checking on CoreGraphics paths.
|
||||
// Also, Facebook can suck me.
|
||||
static inline bool this_CGContextAddPath(CGContextRef aContext, CGPathRef aPath)
|
||||
{
|
||||
// Empty paths are always acceptable (and shouldn't be added anyway).
|
||||
if (CGPathIsEmpty(aPath)) return true;
|
||||
|
||||
// Non-empty paths need to be bounds-checked.
|
||||
CGRect r = CGPathGetBoundingBox(aPath);
|
||||
if (MOZ_UNLIKELY(CGRectIsNull(r))) return true; // should have been caught above?
|
||||
if (MOZ_UNLIKELY(r.origin.x >= INT_MAX || r.origin.x <= INT_MIN)) return false;
|
||||
if (MOZ_UNLIKELY(r.origin.y >= INT_MAX || r.origin.y <= INT_MIN)) return false;
|
||||
if (MOZ_UNLIKELY(r.size.height >= INT_MAX)) return false;
|
||||
if (MOZ_UNLIKELY(r.size.width >= INT_MAX)) return false;
|
||||
|
||||
CGContextAddPath(aContext, aPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
DrawTargetCG::DrawTargetCG()
|
||||
: mColorSpace(nullptr)
|
||||
|
@ -1643,7 +1569,12 @@ DrawTargetCG::Stroke(const Path *aPath, const Pattern &aPattern, const StrokeOpt
|
|||
|
||||
//assert(aPath->GetBackendType() == BackendType::COREGRAPHICS);
|
||||
const PathCG *cgPath = static_cast<const PathCG*>(aPath);
|
||||
CGContextAddPath(cg, cgPath->GetPath());
|
||||
if (MOZ_UNLIKELY(!this_CGContextAddPath(cg, cgPath->GetPath()))) {
|
||||
fprintf(stderr, "Warning: TenFourFox DrawTargetCG::Stroke received an illegal path coordinate.\n");
|
||||
fixer.Fix(this);
|
||||
CGContextRestoreGState(mCg);
|
||||
return;
|
||||
}
|
||||
|
||||
SetStrokeOptions(cg, aStrokeOptions);
|
||||
|
||||
|
@ -1700,7 +1631,12 @@ DrawTargetCG::Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions
|
|||
CGContextClipToRect(mCg, CGRectZero);
|
||||
extents = CGRectZero;
|
||||
} else {
|
||||
CGContextAddPath(cg, cgPath->GetPath());
|
||||
if (MOZ_UNLIKELY(!this_CGContextAddPath(cg, cgPath->GetPath()))) {
|
||||
fprintf(stderr, "Warning: TenFourFox DrawTargetCG::Fill received an illegal path coordinate.\n");
|
||||
fixer.Fix(this);
|
||||
CGContextRestoreGState(mCg);
|
||||
return;
|
||||
}
|
||||
extents = CGContextGetPathBoundingBox(cg);
|
||||
if (cgPath->GetFillRule() == FillRule::FILL_EVEN_ODD)
|
||||
CGContextEOClip(mCg);
|
||||
|
@ -1710,7 +1646,12 @@ DrawTargetCG::Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions
|
|||
|
||||
DrawGradient(mColorSpace, cg, aPattern, extents);
|
||||
} else {
|
||||
CGContextAddPath(cg, cgPath->GetPath());
|
||||
if (MOZ_UNLIKELY(!this_CGContextAddPath(cg, cgPath->GetPath()))) {
|
||||
fprintf(stderr, "Warning: TenFourFox DrawTargetCG::Fill received an illegal path coordinate.\n");
|
||||
fixer.Fix(this);
|
||||
CGContextRestoreGState(mCg);
|
||||
return;
|
||||
}
|
||||
|
||||
SetFillFromPattern(cg, mColorSpace, aPattern);
|
||||
|
||||
|
@ -2050,10 +1991,10 @@ DrawTargetCG::Init(BackendType aType,
|
|||
{
|
||||
// XXX: we should come up with some consistent semantics for dealing
|
||||
// with zero area drawtargets
|
||||
if (aSize.width <= 0 ||
|
||||
if (MOZ_UNLIKELY(aSize.width <= 0 ||
|
||||
aSize.height <= 0 ||
|
||||
size_t(aSize.width) > GetMaxSurfaceSize() ||
|
||||
size_t(aSize.height) > GetMaxSurfaceSize())
|
||||
size_t(aSize.height) > GetMaxSurfaceSize()))
|
||||
{
|
||||
gfxWarning() << "Failed to Init() DrawTargetCG because of bad size.";
|
||||
mColorSpace = nullptr;
|
||||
|
@ -2128,7 +2069,7 @@ DrawTargetCG::Init(BackendType aType,
|
|||
}
|
||||
|
||||
//assert(mCg);
|
||||
if (!mCg) {
|
||||
if (MOZ_UNLIKELY(!mCg)) {
|
||||
gfxCriticalError() << "Failed to create CG context" << mSize << ", " << aStride;
|
||||
return false;
|
||||
}
|
||||
|
@ -2242,7 +2183,7 @@ DrawTargetCG::Init(CGContextRef cgContext, const IntSize &aSize)
|
|||
CGContextRetain(mCg);
|
||||
|
||||
//assert(mCg);
|
||||
if (!mCg) {
|
||||
if (MOZ_UNLIKELY(!mCg)) {
|
||||
gfxCriticalError() << "Invalid CG context at Init " << aSize;
|
||||
return false;
|
||||
}
|
||||
|
@ -2384,7 +2325,10 @@ DrawTargetCG::PushClip(const Path *aPath)
|
|||
* while we add the path. XXX: this could be improved if we keep
|
||||
* the CTM as resident state on the DrawTarget. */
|
||||
CGContextSaveGState(mCg);
|
||||
CGContextAddPath(mCg, cgPath->GetPath());
|
||||
if (MOZ_UNLIKELY(!this_CGContextAddPath(mCg, cgPath->GetPath()))) {
|
||||
fprintf(stderr, "Warning: TenFourFox DrawTargetCG::PushClip received an illegal coordinate.\n");
|
||||
return;
|
||||
}
|
||||
CGContextRestoreGState(mCg);
|
||||
|
||||
if (cgPath->GetFillRule() == FillRule::FILL_EVEN_ODD)
|
||||
|
|
|
@ -259,11 +259,17 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
|||
} else
|
||||
failed = true;
|
||||
if (failed ||
|
||||
spec.Equals("http://www.latimes.com/pb/resources/dist/la/latest/4dcd1b9d7833fcec708a/fonts/KisFBDisplay-Bold.woff") ||
|
||||
spec.Equals("http://www.latimes.com/pb/resources/dist/la/latest/4dcd1b9d7833fcec708a/fonts/KisFBDisplay-Bold.woff2") ||
|
||||
spec.Equals("http://www.latimes.com/pb/resources/dist/la/latest/4dcd1b9d7833fcec708a/fonts/KisFBDisplay-Roman.woff") ||
|
||||
spec.Equals("http://www.latimes.com/pb/resources/dist/la/latest/4dcd1b9d7833fcec708a/fonts/KisFBDisplay-Roman.woff2") ||
|
||||
spec.Equals("https://cdn-static-1.medium.com/_/fp/fonts/charter-nonlatin.b-nw7PXlIqmGHGmHvkDiTw.woff") ||
|
||||
spec.Equals("http://typeface.nytimes.com/fonts/nyt-cheltenham-200-normal.woff") ||
|
||||
spec.Equals("https://typeface.nyt.com/fonts/nyt-cheltenham-200-normal.woff") ||
|
||||
spec.Equals("http://typeface.nytimes.com/fonts/nyt-cheltenham-300-normal.woff") ||
|
||||
spec.Equals("https://typeface.nyt.com/fonts/nyt-cheltenham-300-normal.woff") ||
|
||||
spec.Equals("http://typeface.nytimes.com/fonts/nyt-cheltenham-400-normal.woff") ||
|
||||
spec.Equals("https://typeface.nyt.com/fonts/nyt-cheltenham-400-normal.woff") ||
|
||||
spec.Equals("http://fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Regular.woff") ||
|
||||
spec.Equals("http://fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Bold.woff") ||
|
||||
spec.Equals("http://fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Regular.otf") ||
|
||||
|
|
|
@ -607,6 +607,10 @@ public:
|
|||
void GetFamilyNameAndURIForLogging(nsACString& aFamilyName,
|
||||
nsACString& aURI);
|
||||
|
||||
#ifdef DEBUG
|
||||
gfxUserFontSet* GetUserFontSet() const { return mFontSet; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
const uint8_t* SanitizeOpenTypeData(const uint8_t* aData,
|
||||
uint32_t aLength,
|
||||
|
|
|
@ -17,14 +17,16 @@ UNIFIED_SOURCES += [
|
|||
'YCbCrUtils.cpp',
|
||||
'yuv_convert.cpp',
|
||||
'yuv_row_c.cpp',
|
||||
'yuv_row_table.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['TENFOURFOX_VMX']:
|
||||
SOURCES += ['yuv_convert_ppc.cpp']
|
||||
SOURCES['yuv_convert_ppc.cpp'].flags += ['-maltivec']
|
||||
# Use fast aligned version for VMX.
|
||||
UNIFIED_SOURCES += ['yuv_row_table16.cpp']
|
||||
else:
|
||||
UNIFIED_SOURCES += ['yuv_convert_ppc.cpp']
|
||||
UNIFIED_SOURCES += ['yuv_row_table.cpp']
|
||||
|
||||
if CONFIG['INTEL_ARCHITECTURE']:
|
||||
# These files use MMX and SSE2 intrinsics, so they need special compile flags
|
||||
|
|
|
@ -15,52 +15,50 @@ namespace gfx {
|
|||
// VMX version does 16 pixels at a time.
|
||||
void FilterRows_VMX(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr,
|
||||
int source_width, int source_y_fraction) {
|
||||
// splat the multiplicands. AltiVec makes this unnecessarily difficult.
|
||||
register vector unsigned short vector_zero = vec_splat_u16(0);
|
||||
register vector unsigned char r0, c0, c1;
|
||||
register vector unsigned short y0, y1, y2, y3;
|
||||
|
||||
uint8 *end = ybuf + source_width;
|
||||
|
||||
// Although you'd think using a version with vec_avg for 50% would
|
||||
// be profitable to write, in practice it doesn't seem to be used
|
||||
// much if at all, so this doesn't implement one.
|
||||
|
||||
// Splat the multiplicands. AltiVec makes this unnecessarily difficult.
|
||||
unsigned short __attribute__ ((aligned(16))) syf = source_y_fraction;
|
||||
unsigned short __attribute__ ((aligned(16))) syf2 = (256 - source_y_fraction);
|
||||
register vector unsigned short y1_fraction = vec_lde(0, &syf);
|
||||
y1_fraction = vec_splat(y1_fraction, 0);
|
||||
register vector unsigned short y0_fraction = vec_lde(0, &syf2);
|
||||
y0_fraction = vec_splat(y0_fraction, 0);
|
||||
|
||||
// Permute vector for combining shift and pack in one operation.
|
||||
// This effectively shifts each vector down by 8 bits and packs.
|
||||
register vector unsigned char vector_sh8pak =
|
||||
{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 };
|
||||
|
||||
register vector unsigned short vector_eight = vec_splat_u16(8);
|
||||
register vector unsigned short vector_zero = vec_splat_u16(0);
|
||||
register vector unsigned char vector_c_zero = vec_splat_u8(0);
|
||||
|
||||
uint8 *end = ybuf + source_width;
|
||||
|
||||
// Compute a weighted average.
|
||||
do {
|
||||
vector unsigned char r0;
|
||||
vector unsigned char c0 = vec_ld(0, y0_ptr);
|
||||
vector unsigned char c1 = vec_ld(0, y1_ptr);
|
||||
c0 = vec_ld(0, y0_ptr);
|
||||
c1 = vec_ld(0, y1_ptr);
|
||||
|
||||
// Compute a weighted average.
|
||||
// Quick trivial cases first:
|
||||
// If source_y_fraction is 0, then the result is y0, etc.
|
||||
if (source_y_fraction < 1) {
|
||||
r0 = c0;
|
||||
} else if (source_y_fraction > 255) {
|
||||
r0 = c1;
|
||||
// Sure would be nice to use vec_avg for 128, but it doesn't quite
|
||||
// work, so here's the long case for everything else.
|
||||
} else {
|
||||
// another VMX annoyance: unpackh/l are SIGNED. bastard Motorola.
|
||||
register vector unsigned short y0 = vec_mergeh(vector_c_zero, c0);
|
||||
register vector unsigned short y1 = vec_mergeh(vector_c_zero, c1);
|
||||
register vector unsigned short y2 = vec_mergel(vector_c_zero, c0);
|
||||
register vector unsigned short y3 = vec_mergel(vector_c_zero, c1);
|
||||
// Expand to short, since vec_mladd does not exist for char (damn).
|
||||
y0 = vec_mergeh((vector unsigned char)vector_zero, c0);
|
||||
y1 = vec_mergeh((vector unsigned char)vector_zero, c1);
|
||||
y2 = vec_mergel((vector unsigned char)vector_zero, c0);
|
||||
y3 = vec_mergel((vector unsigned char)vector_zero, c1);
|
||||
|
||||
// FUSED MULTIPLY ADD, BEYOTCHES! INTEL SUX!
|
||||
y1 = vec_mladd(y1, y1_fraction, vector_zero);
|
||||
y0 = vec_mladd(y0, y0_fraction, y1);
|
||||
y0 = vec_sr(y0, vector_eight);
|
||||
// FUSED MULTIPLY ADD, BEYOTCHES! INTEL SUX!
|
||||
// Interleave the operations.
|
||||
y1 = vec_mladd(y1, y1_fraction, vector_zero);
|
||||
y3 = vec_mladd(y3, y1_fraction, vector_zero);
|
||||
y0 = vec_mladd(y0, y0_fraction, y1);
|
||||
y2 = vec_mladd(y2, y0_fraction, y3);
|
||||
|
||||
y3 = vec_mladd(y3, y1_fraction, vector_zero);
|
||||
y2 = vec_mladd(y2, y0_fraction, y3);
|
||||
y2 = vec_sr(y2, vector_eight);
|
||||
// Turn vec_sr on y0/y2 and a vec_pack into a single op.
|
||||
r0 = vec_perm((vector unsigned char)y0, (vector unsigned char)y2, vector_sh8pak);
|
||||
|
||||
r0 = vec_pack(y0, y2);
|
||||
}
|
||||
vec_st(r0, 0, (unsigned char *)ybuf);
|
||||
ybuf += 16;
|
||||
y0_ptr += 16;
|
||||
|
|
|
@ -121,7 +121,12 @@ void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
|
|||
#else
|
||||
#define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
|
||||
#endif
|
||||
|
||||
#if TENFOURFOX_VMX
|
||||
extern SIMD_ALIGNED(int16 kCoefficientsRgbY[768][8]);
|
||||
#else
|
||||
extern SIMD_ALIGNED(int16 kCoefficientsRgbY[768][4]);
|
||||
#endif
|
||||
|
||||
// x64 uses MMX2 (SSE) so emms is not required.
|
||||
// Warning C4799: function has no EMMS instruction.
|
||||
|
|
|
@ -915,21 +915,10 @@ void FastConvertYUVToRGB32Row(const uint8 *y_buf,
|
|||
register vector unsigned char mergehalf =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 };
|
||||
|
||||
// damn Google, the table rows are only aligned to *8* bytes!
|
||||
// assume any arbitrary load is misaligned or we get too
|
||||
// branchy in this loop. fortunately, since we are only ever
|
||||
// loading eight bytes we only need to do a single load.
|
||||
#define LOADC(x, y, z) \
|
||||
mask = vec_lvsl(0, (unsigned char*)&(kCoefficientsRgbY[z+y])); \
|
||||
msq = vec_ld(0, (unsigned char*)&(kCoefficientsRgbY[z+y])); \
|
||||
x = (vector short)vec_perm(msq, msq, mask);
|
||||
#define LOADC(x,y,z) \
|
||||
x = (vector short)vec_ld(0, (unsigned char*)&(kCoefficientsRgbY[z+y]));
|
||||
|
||||
while(width >= 4) {
|
||||
// This is probably the best we can do with the table and
|
||||
// output stores aligned the way they are. Do two separate
|
||||
// unaligned loads and perm them into a single vector.
|
||||
// This also unrolls the loop as a side effect, which the PPC
|
||||
// prefers.
|
||||
uint8 u = u_buf[edi++];
|
||||
uint8 v = v_buf[esi++];
|
||||
uint8 y0 = y_buf[edx++];
|
||||
|
|
248
gfx/ycbcr/yuv_row_table16.cpp
Normal file
248
gfx/ycbcr/yuv_row_table16.cpp
Normal file
|
@ -0,0 +1,248 @@
|
|||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2018 Cameron Kaiser and Contributors to TenFourFox.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "yuv_row.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
// To make an optimized AltiVec load, emit everything twice for a full
|
||||
// 16 bytes even though we only make use of the first 64-bits.
|
||||
#define RGBY(i) { \
|
||||
static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \
|
||||
static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \
|
||||
static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \
|
||||
0, \
|
||||
static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \
|
||||
static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \
|
||||
static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \
|
||||
0 \
|
||||
}
|
||||
|
||||
#define RGBU(i) { \
|
||||
static_cast<int16>(2.018 * 64 * (i - 128) + 0.5), \
|
||||
static_cast<int16>(-0.391 * 64 * (i - 128) + 0.5), \
|
||||
0, \
|
||||
static_cast<int16>(256 * 64 - 1), \
|
||||
static_cast<int16>(2.018 * 64 * (i - 128) + 0.5), \
|
||||
static_cast<int16>(-0.391 * 64 * (i - 128) + 0.5), \
|
||||
0, \
|
||||
static_cast<int16>(256 * 64 - 1) \
|
||||
}
|
||||
|
||||
#define RGBV(i) { \
|
||||
0, \
|
||||
static_cast<int16>(-0.813 * 64 * (i - 128) + 0.5), \
|
||||
static_cast<int16>(1.596 * 64 * (i - 128) + 0.5), \
|
||||
0, \
|
||||
0, \
|
||||
static_cast<int16>(-0.813 * 64 * (i - 128) + 0.5), \
|
||||
static_cast<int16>(1.596 * 64 * (i - 128) + 0.5), \
|
||||
0 \
|
||||
}
|
||||
|
||||
SIMD_ALIGNED(int16 kCoefficientsRgbY[256 * 3][8]) = {
|
||||
RGBY(0x00), RGBY(0x01), RGBY(0x02), RGBY(0x03),
|
||||
RGBY(0x04), RGBY(0x05), RGBY(0x06), RGBY(0x07),
|
||||
RGBY(0x08), RGBY(0x09), RGBY(0x0A), RGBY(0x0B),
|
||||
RGBY(0x0C), RGBY(0x0D), RGBY(0x0E), RGBY(0x0F),
|
||||
RGBY(0x10), RGBY(0x11), RGBY(0x12), RGBY(0x13),
|
||||
RGBY(0x14), RGBY(0x15), RGBY(0x16), RGBY(0x17),
|
||||
RGBY(0x18), RGBY(0x19), RGBY(0x1A), RGBY(0x1B),
|
||||
RGBY(0x1C), RGBY(0x1D), RGBY(0x1E), RGBY(0x1F),
|
||||
RGBY(0x20), RGBY(0x21), RGBY(0x22), RGBY(0x23),
|
||||
RGBY(0x24), RGBY(0x25), RGBY(0x26), RGBY(0x27),
|
||||
RGBY(0x28), RGBY(0x29), RGBY(0x2A), RGBY(0x2B),
|
||||
RGBY(0x2C), RGBY(0x2D), RGBY(0x2E), RGBY(0x2F),
|
||||
RGBY(0x30), RGBY(0x31), RGBY(0x32), RGBY(0x33),
|
||||
RGBY(0x34), RGBY(0x35), RGBY(0x36), RGBY(0x37),
|
||||
RGBY(0x38), RGBY(0x39), RGBY(0x3A), RGBY(0x3B),
|
||||
RGBY(0x3C), RGBY(0x3D), RGBY(0x3E), RGBY(0x3F),
|
||||
RGBY(0x40), RGBY(0x41), RGBY(0x42), RGBY(0x43),
|
||||
RGBY(0x44), RGBY(0x45), RGBY(0x46), RGBY(0x47),
|
||||
RGBY(0x48), RGBY(0x49), RGBY(0x4A), RGBY(0x4B),
|
||||
RGBY(0x4C), RGBY(0x4D), RGBY(0x4E), RGBY(0x4F),
|
||||
RGBY(0x50), RGBY(0x51), RGBY(0x52), RGBY(0x53),
|
||||
RGBY(0x54), RGBY(0x55), RGBY(0x56), RGBY(0x57),
|
||||
RGBY(0x58), RGBY(0x59), RGBY(0x5A), RGBY(0x5B),
|
||||
RGBY(0x5C), RGBY(0x5D), RGBY(0x5E), RGBY(0x5F),
|
||||
RGBY(0x60), RGBY(0x61), RGBY(0x62), RGBY(0x63),
|
||||
RGBY(0x64), RGBY(0x65), RGBY(0x66), RGBY(0x67),
|
||||
RGBY(0x68), RGBY(0x69), RGBY(0x6A), RGBY(0x6B),
|
||||
RGBY(0x6C), RGBY(0x6D), RGBY(0x6E), RGBY(0x6F),
|
||||
RGBY(0x70), RGBY(0x71), RGBY(0x72), RGBY(0x73),
|
||||
RGBY(0x74), RGBY(0x75), RGBY(0x76), RGBY(0x77),
|
||||
RGBY(0x78), RGBY(0x79), RGBY(0x7A), RGBY(0x7B),
|
||||
RGBY(0x7C), RGBY(0x7D), RGBY(0x7E), RGBY(0x7F),
|
||||
RGBY(0x80), RGBY(0x81), RGBY(0x82), RGBY(0x83),
|
||||
RGBY(0x84), RGBY(0x85), RGBY(0x86), RGBY(0x87),
|
||||
RGBY(0x88), RGBY(0x89), RGBY(0x8A), RGBY(0x8B),
|
||||
RGBY(0x8C), RGBY(0x8D), RGBY(0x8E), RGBY(0x8F),
|
||||
RGBY(0x90), RGBY(0x91), RGBY(0x92), RGBY(0x93),
|
||||
RGBY(0x94), RGBY(0x95), RGBY(0x96), RGBY(0x97),
|
||||
RGBY(0x98), RGBY(0x99), RGBY(0x9A), RGBY(0x9B),
|
||||
RGBY(0x9C), RGBY(0x9D), RGBY(0x9E), RGBY(0x9F),
|
||||
RGBY(0xA0), RGBY(0xA1), RGBY(0xA2), RGBY(0xA3),
|
||||
RGBY(0xA4), RGBY(0xA5), RGBY(0xA6), RGBY(0xA7),
|
||||
RGBY(0xA8), RGBY(0xA9), RGBY(0xAA), RGBY(0xAB),
|
||||
RGBY(0xAC), RGBY(0xAD), RGBY(0xAE), RGBY(0xAF),
|
||||
RGBY(0xB0), RGBY(0xB1), RGBY(0xB2), RGBY(0xB3),
|
||||
RGBY(0xB4), RGBY(0xB5), RGBY(0xB6), RGBY(0xB7),
|
||||
RGBY(0xB8), RGBY(0xB9), RGBY(0xBA), RGBY(0xBB),
|
||||
RGBY(0xBC), RGBY(0xBD), RGBY(0xBE), RGBY(0xBF),
|
||||
RGBY(0xC0), RGBY(0xC1), RGBY(0xC2), RGBY(0xC3),
|
||||
RGBY(0xC4), RGBY(0xC5), RGBY(0xC6), RGBY(0xC7),
|
||||
RGBY(0xC8), RGBY(0xC9), RGBY(0xCA), RGBY(0xCB),
|
||||
RGBY(0xCC), RGBY(0xCD), RGBY(0xCE), RGBY(0xCF),
|
||||
RGBY(0xD0), RGBY(0xD1), RGBY(0xD2), RGBY(0xD3),
|
||||
RGBY(0xD4), RGBY(0xD5), RGBY(0xD6), RGBY(0xD7),
|
||||
RGBY(0xD8), RGBY(0xD9), RGBY(0xDA), RGBY(0xDB),
|
||||
RGBY(0xDC), RGBY(0xDD), RGBY(0xDE), RGBY(0xDF),
|
||||
RGBY(0xE0), RGBY(0xE1), RGBY(0xE2), RGBY(0xE3),
|
||||
RGBY(0xE4), RGBY(0xE5), RGBY(0xE6), RGBY(0xE7),
|
||||
RGBY(0xE8), RGBY(0xE9), RGBY(0xEA), RGBY(0xEB),
|
||||
RGBY(0xEC), RGBY(0xED), RGBY(0xEE), RGBY(0xEF),
|
||||
RGBY(0xF0), RGBY(0xF1), RGBY(0xF2), RGBY(0xF3),
|
||||
RGBY(0xF4), RGBY(0xF5), RGBY(0xF6), RGBY(0xF7),
|
||||
RGBY(0xF8), RGBY(0xF9), RGBY(0xFA), RGBY(0xFB),
|
||||
RGBY(0xFC), RGBY(0xFD), RGBY(0xFE), RGBY(0xFF),
|
||||
|
||||
// Chroma U table.
|
||||
RGBU(0x00), RGBU(0x01), RGBU(0x02), RGBU(0x03),
|
||||
RGBU(0x04), RGBU(0x05), RGBU(0x06), RGBU(0x07),
|
||||
RGBU(0x08), RGBU(0x09), RGBU(0x0A), RGBU(0x0B),
|
||||
RGBU(0x0C), RGBU(0x0D), RGBU(0x0E), RGBU(0x0F),
|
||||
RGBU(0x10), RGBU(0x11), RGBU(0x12), RGBU(0x13),
|
||||
RGBU(0x14), RGBU(0x15), RGBU(0x16), RGBU(0x17),
|
||||
RGBU(0x18), RGBU(0x19), RGBU(0x1A), RGBU(0x1B),
|
||||
RGBU(0x1C), RGBU(0x1D), RGBU(0x1E), RGBU(0x1F),
|
||||
RGBU(0x20), RGBU(0x21), RGBU(0x22), RGBU(0x23),
|
||||
RGBU(0x24), RGBU(0x25), RGBU(0x26), RGBU(0x27),
|
||||
RGBU(0x28), RGBU(0x29), RGBU(0x2A), RGBU(0x2B),
|
||||
RGBU(0x2C), RGBU(0x2D), RGBU(0x2E), RGBU(0x2F),
|
||||
RGBU(0x30), RGBU(0x31), RGBU(0x32), RGBU(0x33),
|
||||
RGBU(0x34), RGBU(0x35), RGBU(0x36), RGBU(0x37),
|
||||
RGBU(0x38), RGBU(0x39), RGBU(0x3A), RGBU(0x3B),
|
||||
RGBU(0x3C), RGBU(0x3D), RGBU(0x3E), RGBU(0x3F),
|
||||
RGBU(0x40), RGBU(0x41), RGBU(0x42), RGBU(0x43),
|
||||
RGBU(0x44), RGBU(0x45), RGBU(0x46), RGBU(0x47),
|
||||
RGBU(0x48), RGBU(0x49), RGBU(0x4A), RGBU(0x4B),
|
||||
RGBU(0x4C), RGBU(0x4D), RGBU(0x4E), RGBU(0x4F),
|
||||
RGBU(0x50), RGBU(0x51), RGBU(0x52), RGBU(0x53),
|
||||
RGBU(0x54), RGBU(0x55), RGBU(0x56), RGBU(0x57),
|
||||
RGBU(0x58), RGBU(0x59), RGBU(0x5A), RGBU(0x5B),
|
||||
RGBU(0x5C), RGBU(0x5D), RGBU(0x5E), RGBU(0x5F),
|
||||
RGBU(0x60), RGBU(0x61), RGBU(0x62), RGBU(0x63),
|
||||
RGBU(0x64), RGBU(0x65), RGBU(0x66), RGBU(0x67),
|
||||
RGBU(0x68), RGBU(0x69), RGBU(0x6A), RGBU(0x6B),
|
||||
RGBU(0x6C), RGBU(0x6D), RGBU(0x6E), RGBU(0x6F),
|
||||
RGBU(0x70), RGBU(0x71), RGBU(0x72), RGBU(0x73),
|
||||
RGBU(0x74), RGBU(0x75), RGBU(0x76), RGBU(0x77),
|
||||
RGBU(0x78), RGBU(0x79), RGBU(0x7A), RGBU(0x7B),
|
||||
RGBU(0x7C), RGBU(0x7D), RGBU(0x7E), RGBU(0x7F),
|
||||
RGBU(0x80), RGBU(0x81), RGBU(0x82), RGBU(0x83),
|
||||
RGBU(0x84), RGBU(0x85), RGBU(0x86), RGBU(0x87),
|
||||
RGBU(0x88), RGBU(0x89), RGBU(0x8A), RGBU(0x8B),
|
||||
RGBU(0x8C), RGBU(0x8D), RGBU(0x8E), RGBU(0x8F),
|
||||
RGBU(0x90), RGBU(0x91), RGBU(0x92), RGBU(0x93),
|
||||
RGBU(0x94), RGBU(0x95), RGBU(0x96), RGBU(0x97),
|
||||
RGBU(0x98), RGBU(0x99), RGBU(0x9A), RGBU(0x9B),
|
||||
RGBU(0x9C), RGBU(0x9D), RGBU(0x9E), RGBU(0x9F),
|
||||
RGBU(0xA0), RGBU(0xA1), RGBU(0xA2), RGBU(0xA3),
|
||||
RGBU(0xA4), RGBU(0xA5), RGBU(0xA6), RGBU(0xA7),
|
||||
RGBU(0xA8), RGBU(0xA9), RGBU(0xAA), RGBU(0xAB),
|
||||
RGBU(0xAC), RGBU(0xAD), RGBU(0xAE), RGBU(0xAF),
|
||||
RGBU(0xB0), RGBU(0xB1), RGBU(0xB2), RGBU(0xB3),
|
||||
RGBU(0xB4), RGBU(0xB5), RGBU(0xB6), RGBU(0xB7),
|
||||
RGBU(0xB8), RGBU(0xB9), RGBU(0xBA), RGBU(0xBB),
|
||||
RGBU(0xBC), RGBU(0xBD), RGBU(0xBE), RGBU(0xBF),
|
||||
RGBU(0xC0), RGBU(0xC1), RGBU(0xC2), RGBU(0xC3),
|
||||
RGBU(0xC4), RGBU(0xC5), RGBU(0xC6), RGBU(0xC7),
|
||||
RGBU(0xC8), RGBU(0xC9), RGBU(0xCA), RGBU(0xCB),
|
||||
RGBU(0xCC), RGBU(0xCD), RGBU(0xCE), RGBU(0xCF),
|
||||
RGBU(0xD0), RGBU(0xD1), RGBU(0xD2), RGBU(0xD3),
|
||||
RGBU(0xD4), RGBU(0xD5), RGBU(0xD6), RGBU(0xD7),
|
||||
RGBU(0xD8), RGBU(0xD9), RGBU(0xDA), RGBU(0xDB),
|
||||
RGBU(0xDC), RGBU(0xDD), RGBU(0xDE), RGBU(0xDF),
|
||||
RGBU(0xE0), RGBU(0xE1), RGBU(0xE2), RGBU(0xE3),
|
||||
RGBU(0xE4), RGBU(0xE5), RGBU(0xE6), RGBU(0xE7),
|
||||
RGBU(0xE8), RGBU(0xE9), RGBU(0xEA), RGBU(0xEB),
|
||||
RGBU(0xEC), RGBU(0xED), RGBU(0xEE), RGBU(0xEF),
|
||||
RGBU(0xF0), RGBU(0xF1), RGBU(0xF2), RGBU(0xF3),
|
||||
RGBU(0xF4), RGBU(0xF5), RGBU(0xF6), RGBU(0xF7),
|
||||
RGBU(0xF8), RGBU(0xF9), RGBU(0xFA), RGBU(0xFB),
|
||||
RGBU(0xFC), RGBU(0xFD), RGBU(0xFE), RGBU(0xFF),
|
||||
|
||||
// Chroma V table.
|
||||
RGBV(0x00), RGBV(0x01), RGBV(0x02), RGBV(0x03),
|
||||
RGBV(0x04), RGBV(0x05), RGBV(0x06), RGBV(0x07),
|
||||
RGBV(0x08), RGBV(0x09), RGBV(0x0A), RGBV(0x0B),
|
||||
RGBV(0x0C), RGBV(0x0D), RGBV(0x0E), RGBV(0x0F),
|
||||
RGBV(0x10), RGBV(0x11), RGBV(0x12), RGBV(0x13),
|
||||
RGBV(0x14), RGBV(0x15), RGBV(0x16), RGBV(0x17),
|
||||
RGBV(0x18), RGBV(0x19), RGBV(0x1A), RGBV(0x1B),
|
||||
RGBV(0x1C), RGBV(0x1D), RGBV(0x1E), RGBV(0x1F),
|
||||
RGBV(0x20), RGBV(0x21), RGBV(0x22), RGBV(0x23),
|
||||
RGBV(0x24), RGBV(0x25), RGBV(0x26), RGBV(0x27),
|
||||
RGBV(0x28), RGBV(0x29), RGBV(0x2A), RGBV(0x2B),
|
||||
RGBV(0x2C), RGBV(0x2D), RGBV(0x2E), RGBV(0x2F),
|
||||
RGBV(0x30), RGBV(0x31), RGBV(0x32), RGBV(0x33),
|
||||
RGBV(0x34), RGBV(0x35), RGBV(0x36), RGBV(0x37),
|
||||
RGBV(0x38), RGBV(0x39), RGBV(0x3A), RGBV(0x3B),
|
||||
RGBV(0x3C), RGBV(0x3D), RGBV(0x3E), RGBV(0x3F),
|
||||
RGBV(0x40), RGBV(0x41), RGBV(0x42), RGBV(0x43),
|
||||
RGBV(0x44), RGBV(0x45), RGBV(0x46), RGBV(0x47),
|
||||
RGBV(0x48), RGBV(0x49), RGBV(0x4A), RGBV(0x4B),
|
||||
RGBV(0x4C), RGBV(0x4D), RGBV(0x4E), RGBV(0x4F),
|
||||
RGBV(0x50), RGBV(0x51), RGBV(0x52), RGBV(0x53),
|
||||
RGBV(0x54), RGBV(0x55), RGBV(0x56), RGBV(0x57),
|
||||
RGBV(0x58), RGBV(0x59), RGBV(0x5A), RGBV(0x5B),
|
||||
RGBV(0x5C), RGBV(0x5D), RGBV(0x5E), RGBV(0x5F),
|
||||
RGBV(0x60), RGBV(0x61), RGBV(0x62), RGBV(0x63),
|
||||
RGBV(0x64), RGBV(0x65), RGBV(0x66), RGBV(0x67),
|
||||
RGBV(0x68), RGBV(0x69), RGBV(0x6A), RGBV(0x6B),
|
||||
RGBV(0x6C), RGBV(0x6D), RGBV(0x6E), RGBV(0x6F),
|
||||
RGBV(0x70), RGBV(0x71), RGBV(0x72), RGBV(0x73),
|
||||
RGBV(0x74), RGBV(0x75), RGBV(0x76), RGBV(0x77),
|
||||
RGBV(0x78), RGBV(0x79), RGBV(0x7A), RGBV(0x7B),
|
||||
RGBV(0x7C), RGBV(0x7D), RGBV(0x7E), RGBV(0x7F),
|
||||
RGBV(0x80), RGBV(0x81), RGBV(0x82), RGBV(0x83),
|
||||
RGBV(0x84), RGBV(0x85), RGBV(0x86), RGBV(0x87),
|
||||
RGBV(0x88), RGBV(0x89), RGBV(0x8A), RGBV(0x8B),
|
||||
RGBV(0x8C), RGBV(0x8D), RGBV(0x8E), RGBV(0x8F),
|
||||
RGBV(0x90), RGBV(0x91), RGBV(0x92), RGBV(0x93),
|
||||
RGBV(0x94), RGBV(0x95), RGBV(0x96), RGBV(0x97),
|
||||
RGBV(0x98), RGBV(0x99), RGBV(0x9A), RGBV(0x9B),
|
||||
RGBV(0x9C), RGBV(0x9D), RGBV(0x9E), RGBV(0x9F),
|
||||
RGBV(0xA0), RGBV(0xA1), RGBV(0xA2), RGBV(0xA3),
|
||||
RGBV(0xA4), RGBV(0xA5), RGBV(0xA6), RGBV(0xA7),
|
||||
RGBV(0xA8), RGBV(0xA9), RGBV(0xAA), RGBV(0xAB),
|
||||
RGBV(0xAC), RGBV(0xAD), RGBV(0xAE), RGBV(0xAF),
|
||||
RGBV(0xB0), RGBV(0xB1), RGBV(0xB2), RGBV(0xB3),
|
||||
RGBV(0xB4), RGBV(0xB5), RGBV(0xB6), RGBV(0xB7),
|
||||
RGBV(0xB8), RGBV(0xB9), RGBV(0xBA), RGBV(0xBB),
|
||||
RGBV(0xBC), RGBV(0xBD), RGBV(0xBE), RGBV(0xBF),
|
||||
RGBV(0xC0), RGBV(0xC1), RGBV(0xC2), RGBV(0xC3),
|
||||
RGBV(0xC4), RGBV(0xC5), RGBV(0xC6), RGBV(0xC7),
|
||||
RGBV(0xC8), RGBV(0xC9), RGBV(0xCA), RGBV(0xCB),
|
||||
RGBV(0xCC), RGBV(0xCD), RGBV(0xCE), RGBV(0xCF),
|
||||
RGBV(0xD0), RGBV(0xD1), RGBV(0xD2), RGBV(0xD3),
|
||||
RGBV(0xD4), RGBV(0xD5), RGBV(0xD6), RGBV(0xD7),
|
||||
RGBV(0xD8), RGBV(0xD9), RGBV(0xDA), RGBV(0xDB),
|
||||
RGBV(0xDC), RGBV(0xDD), RGBV(0xDE), RGBV(0xDF),
|
||||
RGBV(0xE0), RGBV(0xE1), RGBV(0xE2), RGBV(0xE3),
|
||||
RGBV(0xE4), RGBV(0xE5), RGBV(0xE6), RGBV(0xE7),
|
||||
RGBV(0xE8), RGBV(0xE9), RGBV(0xEA), RGBV(0xEB),
|
||||
RGBV(0xEC), RGBV(0xED), RGBV(0xEE), RGBV(0xEF),
|
||||
RGBV(0xF0), RGBV(0xF1), RGBV(0xF2), RGBV(0xF3),
|
||||
RGBV(0xF4), RGBV(0xF5), RGBV(0xF6), RGBV(0xF7),
|
||||
RGBV(0xF8), RGBV(0xF9), RGBV(0xFA), RGBV(0xFB),
|
||||
RGBV(0xFC), RGBV(0xFD), RGBV(0xFE), RGBV(0xFF),
|
||||
};
|
||||
|
||||
#undef RGBY
|
||||
#undef RGBU
|
||||
#undef RGBV
|
||||
|
||||
} // extern "C"
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "js/StructuredClone.h"
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
|
@ -1530,6 +1531,11 @@ JSStructuredCloneReader::readTypedArray(uint32_t arrayType, uint32_t nelems, Mut
|
|||
return false;
|
||||
byteOffset = n;
|
||||
}
|
||||
if (!v.isObject() || !v.toObject().is<ArrayBufferObjectMaybeShared>()) {
|
||||
JS_ReportErrorNumber(context(), GetErrorMessage, nullptr, JSMSG_SC_BAD_SERIALIZED_DATA,
|
||||
"typed array must be backed by an ArrayBuffer");
|
||||
return false;
|
||||
}
|
||||
RootedObject buffer(context(), &v.toObject());
|
||||
RootedObject obj(context(), nullptr);
|
||||
|
||||
|
@ -1587,6 +1593,11 @@ JSStructuredCloneReader::readDataView(uint32_t byteLength, MutableHandleValue vp
|
|||
RootedValue v(context());
|
||||
if (!startRead(&v))
|
||||
return false;
|
||||
if (!v.isObject() || !v.toObject().is<ArrayBufferObjectMaybeShared>()) {
|
||||
JS_ReportErrorNumber(context(), GetErrorMessage, nullptr, JSMSG_SC_BAD_SERIALIZED_DATA,
|
||||
"DataView must be backed by an ArrayBuffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read byteOffset.
|
||||
uint64_t n;
|
||||
|
@ -1625,10 +1636,23 @@ bool
|
|||
JSStructuredCloneReader::readV1ArrayBuffer(uint32_t arrayType, uint32_t nelems,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
MOZ_ASSERT(arrayType <= Scalar::Uint8Clamped);
|
||||
if (arrayType > Scalar::Uint8Clamped) {
|
||||
JS_ReportErrorNumber(context(), GetErrorMessage, nullptr, JSMSG_SC_BAD_SERIALIZED_DATA,
|
||||
"invalid TypedArray type");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t nbytes = nelems << TypedArrayShift(static_cast<Scalar::Type>(arrayType));
|
||||
JSObject* obj = ArrayBufferObject::create(context(), nbytes);
|
||||
mozilla::CheckedInt<size_t> nbytes =
|
||||
mozilla::CheckedInt<size_t>(nelems) *
|
||||
TypedArrayElemSize(static_cast<Scalar::Type>(arrayType));
|
||||
if (!nbytes.isValid() || nbytes.value() > UINT32_MAX) {
|
||||
JS_ReportErrorNumber(context(), GetErrorMessage, nullptr,
|
||||
JSMSG_SC_BAD_SERIALIZED_DATA,
|
||||
"invalid typed array size");
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject* obj = ArrayBufferObject::create(context(), nbytes.value());
|
||||
if (!obj)
|
||||
return false;
|
||||
vp.setObject(*obj);
|
||||
|
|
|
@ -677,14 +677,16 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
|
|||
{
|
||||
if (aEvent->originalTarget != mTextField) {
|
||||
// Move focus to our text field
|
||||
HTMLInputElement::FromContent(mTextField)->Focus();
|
||||
RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
|
||||
textField->Focus();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNumberControlFrame::HandleSelectCall()
|
||||
{
|
||||
return HTMLInputElement::FromContent(mTextField)->Select();
|
||||
RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
|
||||
return textField->Select();
|
||||
}
|
||||
|
||||
#define STYLES_DISABLING_NATIVE_THEMING \
|
||||
|
|
|
@ -623,6 +623,11 @@ FontFace::SetUserFontEntry(gfxUserFontEntry* aEntry)
|
|||
if (mUserFontEntry) {
|
||||
mUserFontEntry->mFontFaces.AppendElement(this);
|
||||
|
||||
MOZ_ASSERT(mUserFontEntry->GetUserFontSet() ==
|
||||
mFontFaceSet->GetUserFontSet(),
|
||||
"user font entry must be associated with the same user font set "
|
||||
"as the FontFace");
|
||||
|
||||
// Our newly assigned user font entry might be in the process of or
|
||||
// finished loading, so set our status accordingly. But only do so
|
||||
// if we're not going "backwards" in status, which could otherwise
|
||||
|
|
|
@ -90,6 +90,8 @@ public:
|
|||
void AddFontFaceSet(FontFaceSet* aFontFaceSet);
|
||||
void RemoveFontFaceSet(FontFaceSet* aFontFaceSet);
|
||||
|
||||
FontFaceSet* GetPrimaryFontFaceSet() const { return mFontFaceSet; }
|
||||
|
||||
/**
|
||||
* Gets the family name of the FontFace as a raw string (such as 'Times', as
|
||||
* opposed to GetFamily, which returns a CSS-escaped string, such as
|
||||
|
|
|
@ -953,7 +953,7 @@ FontFaceSet::InsertRuleFontFace(FontFace* aFontFace, SheetType aSheetType,
|
|||
mUserFontSet->AddUserFontEntry(fontfamily, entry);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxUserFontEntry>
|
||||
/* static */ already_AddRefed<gfxUserFontEntry>
|
||||
FontFaceSet::FindOrCreateUserFontEntryFromFontFace(FontFace* aFontFace)
|
||||
{
|
||||
nsAutoString fontfamily;
|
||||
|
@ -967,11 +967,13 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(FontFace* aFontFace)
|
|||
SheetType::Doc);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxUserFontEntry>
|
||||
/* static */ already_AddRefed<gfxUserFontEntry>
|
||||
FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
|
||||
FontFace* aFontFace,
|
||||
SheetType aSheetType)
|
||||
{
|
||||
FontFaceSet* set = aFontFace->GetPrimaryFontFaceSet();
|
||||
|
||||
nsCSSValue val;
|
||||
nsCSSUnit unit;
|
||||
|
||||
|
@ -1099,7 +1101,7 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
|
|||
face->mSourceType = gfxFontFaceSrc::eSourceType_URL;
|
||||
face->mURI = val.GetURLValue();
|
||||
face->mReferrer = val.GetURLStructValue()->mReferrer;
|
||||
face->mReferrerPolicy = mDocument->GetReferrerPolicy();
|
||||
face->mReferrerPolicy = set->mDocument->GetReferrerPolicy();
|
||||
face->mOriginPrincipal = val.GetURLStructValue()->mOriginPrincipal;
|
||||
NS_ASSERTION(face->mOriginPrincipal, "null origin principal in @font-face rule");
|
||||
|
||||
|
@ -1160,11 +1162,11 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
|
|||
}
|
||||
|
||||
RefPtr<gfxUserFontEntry> entry =
|
||||
mUserFontSet->FindOrCreateUserFontEntry(aFamilyName, srcArray, weight,
|
||||
stretch, italicStyle,
|
||||
featureSettings,
|
||||
languageOverride,
|
||||
unicodeRanges);
|
||||
set->mUserFontSet->FindOrCreateUserFontEntry(aFamilyName, srcArray, weight,
|
||||
stretch, italicStyle,
|
||||
featureSettings,
|
||||
languageOverride,
|
||||
unicodeRanges);
|
||||
return entry.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
* Finds an existing entry in the user font cache or creates a new user
|
||||
* font entry for the given FontFace object.
|
||||
*/
|
||||
already_AddRefed<gfxUserFontEntry>
|
||||
static already_AddRefed<gfxUserFontEntry>
|
||||
FindOrCreateUserFontEntryFromFontFace(FontFace* aFontFace);
|
||||
|
||||
/**
|
||||
|
@ -243,7 +243,7 @@ private:
|
|||
bool mLoadEventShouldFire;
|
||||
};
|
||||
|
||||
already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntryFromFontFace(
|
||||
static already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntryFromFontFace(
|
||||
const nsAString& aFamilyName,
|
||||
FontFace* aFontFace,
|
||||
SheetType aSheetType);
|
||||
|
|
|
@ -67,6 +67,7 @@ static bool sUnprefixingServiceGloballyWhitelisted;
|
|||
#endif
|
||||
static bool sMozGradientsEnabled;
|
||||
static bool sControlCharVisibility;
|
||||
static bool sMozDocumentEnabledInContent;
|
||||
|
||||
const uint32_t
|
||||
nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = {
|
||||
|
@ -3725,6 +3726,11 @@ CSSParserImpl::ParseMediaRule(RuleAppendFunc aAppendFunc, void* aData)
|
|||
bool
|
||||
CSSParserImpl::ParseMozDocumentRule(RuleAppendFunc aAppendFunc, void* aData)
|
||||
{
|
||||
if (mParsingMode == css::eAuthorSheetFeatures &&
|
||||
!sMozDocumentEnabledInContent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
css::DocumentRule::URL *urls = nullptr;
|
||||
css::DocumentRule::URL **next = &urls;
|
||||
|
||||
|
@ -16852,6 +16858,8 @@ nsCSSParser::Startup()
|
|||
"layout.css.prefixes.gradients");
|
||||
Preferences::AddBoolVarCache(&sControlCharVisibility,
|
||||
"layout.css.control-characters.visible");
|
||||
Preferences::AddBoolVarCache(&sMozDocumentEnabledInContent,
|
||||
"layout.css.moz-document.content.enabled");
|
||||
}
|
||||
|
||||
nsCSSParser::nsCSSParser(mozilla::css::Loader* aLoader,
|
||||
|
|
|
@ -210,8 +210,6 @@ ImportRule::~ImportRule()
|
|||
NS_IMPL_CYCLE_COLLECTING_ADDREF(ImportRule)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(ImportRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(ImportRule, mMedia, mChildSheet)
|
||||
|
||||
// QueryInterface implementation for ImportRule
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ImportRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)
|
||||
|
@ -222,6 +220,21 @@ NS_INTERFACE_MAP_END
|
|||
|
||||
IMPL_STYLE_RULE_INHERIT(ImportRule, Rule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(ImportRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ImportRule)
|
||||
if (tmp->mChildSheet) {
|
||||
tmp->mChildSheet->SetOwnerRule(nullptr);
|
||||
tmp->mChildSheet = nullptr;
|
||||
}
|
||||
tmp->mMedia = nullptr;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ImportRule)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMedia)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildSheet)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
ImportRule::List(FILE* out, int32_t aIndent) const
|
||||
|
@ -611,7 +624,7 @@ NS_IMPL_ADDREF_INHERITED(MediaRule, GroupRule)
|
|||
NS_IMPL_RELEASE_INHERITED(MediaRule, GroupRule)
|
||||
|
||||
// QueryInterface implementation for MediaRule
|
||||
NS_INTERFACE_MAP_BEGIN(MediaRule)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MediaRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSGroupingRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSConditionRule)
|
||||
|
@ -620,6 +633,19 @@ NS_INTERFACE_MAP_BEGIN(MediaRule)
|
|||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSMediaRule)
|
||||
NS_INTERFACE_MAP_END_INHERITING(GroupRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(MediaRule)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MediaRule, GroupRule)
|
||||
if (tmp->mMedia) {
|
||||
tmp->mMedia->SetStyleSheet(nullptr);
|
||||
tmp->mMedia = nullptr;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(MediaRule, GroupRule)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMedia)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
/* virtual */ void
|
||||
MediaRule::SetStyleSheet(CSSStyleSheet* aSheet)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ private:
|
|||
~MediaRule();
|
||||
public:
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaRule, GroupRule)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Rule methods
|
||||
|
|
|
@ -106,6 +106,12 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
|
|||
opus_int decisionDelay /* I */
|
||||
);
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef TENFOURFOX_G5
|
||||
/* work around issue 461 */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
void silk_NSQ_del_dec(
|
||||
const silk_encoder_state *psEncC, /* I/O Encoder State */
|
||||
silk_nsq_state *NSQ, /* I/O NSQ state */
|
||||
|
|
|
@ -1116,6 +1116,12 @@ void I422ToARGB4444Row_C(const uint8* src_y,
|
|||
}
|
||||
}
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef __ppc__
|
||||
/* work around issue 461 */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
void I422ToARGB1555Row_C(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
|
@ -1154,6 +1160,15 @@ void I422ToARGB1555Row_C(const uint8* src_y,
|
|||
}
|
||||
}
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef __ppc__
|
||||
#ifndef TENFOURFOX_G5
|
||||
/* Work around issue 461, 7450 only
|
||||
Safe to comment for a 7400 build */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
void I422ToRGB565Row_C(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
|
@ -1280,6 +1295,12 @@ void NV21ToARGBRow_C(const uint8* src_y,
|
|||
}
|
||||
}
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef __ppc__
|
||||
/* work around issue 461 */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
void NV12ToRGB565Row_C(const uint8* src_y,
|
||||
const uint8* usrc_v,
|
||||
uint8* dst_rgb565,
|
||||
|
@ -1315,6 +1336,12 @@ void NV12ToRGB565Row_C(const uint8* src_y,
|
|||
}
|
||||
}
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef __ppc__
|
||||
/* work around issue 461 */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
void NV21ToRGB565Row_C(const uint8* src_y,
|
||||
const uint8* vsrc_u,
|
||||
uint8* dst_rgb565,
|
||||
|
|
|
@ -88,6 +88,12 @@ void ScaleRowDown4_C(const uint8* src_ptr, ptrdiff_t src_stride,
|
|||
}
|
||||
}
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef TENFOURFOX_G5
|
||||
/* work around issue 461 */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
void ScaleRowDown4Box_C(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst, int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
|
|
|
@ -2997,12 +2997,11 @@ PeerConnectionImpl::IceGatheringStateChange(
|
|||
return;
|
||||
}
|
||||
WrappableJSErrorResult rv;
|
||||
RUN_ON_THREAD(mThread,
|
||||
WrapRunnable(pco,
|
||||
&PeerConnectionObserver::OnStateChange,
|
||||
PCObserverStateType::IceGatheringState,
|
||||
rv, static_cast<JSCompartment*>(nullptr)),
|
||||
NS_DISPATCH_NORMAL);
|
||||
mThread->Dispatch(WrapRunnable(pco,
|
||||
&PeerConnectionObserver::OnStateChange,
|
||||
PCObserverStateType::IceGatheringState,
|
||||
rv, static_cast<JSCompartment*>(nullptr)),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
if (mIceGatheringState == PCImplIceGatheringState::Complete) {
|
||||
SendLocalIceCandidateToContent(0, "", "");
|
||||
|
|
|
@ -385,7 +385,12 @@ int WebRtcIsac_DecodeSpec(Bitstr* streamdata, int16_t AvgPitchGain_Q12,
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 5)
|
||||
#ifdef TENFOURFOX_G5
|
||||
/* work around issue 461 */
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
#endif
|
||||
int WebRtcIsac_EncodeSpec(const int16_t* fr, const int16_t* fi,
|
||||
int16_t AvgPitchGain_Q12, enum ISACBand band,
|
||||
Bitstr* streamdata) {
|
||||
|
|
|
@ -1042,6 +1042,9 @@ pref("dom.disable_window_open_feature.status", true);
|
|||
|
||||
pref("dom.allow_scripts_to_close_windows", false);
|
||||
|
||||
// TenFourFox issue 463
|
||||
pref("dom.requestIdleCallback.enabled", false);
|
||||
|
||||
pref("dom.require_user_interaction_for_beforeunload", true);
|
||||
|
||||
pref("dom.disable_open_during_load", false);
|
||||
|
@ -2230,6 +2233,9 @@ pref("layout.css.report_errors", true);
|
|||
// Should the :visited selector ever match (otherwise :link matches instead)?
|
||||
pref("layout.css.visited_links_enabled", true);
|
||||
|
||||
// Pref to control whether @-moz-document rules are enabled in content pages.
|
||||
pref("layout.css.moz-document.content.enabled", true); // XXX: change in FPR6
|
||||
|
||||
// Override DPI. A value of -1 means use the maximum of 96 and the system DPI.
|
||||
// A value of 0 means use the system DPI. A positive value is used as the DPI.
|
||||
// This sets the physical size of a device pixel and thus controls the
|
||||
|
@ -5129,3 +5135,6 @@ pref("dom.mozKillSwitch.enabled", false);
|
|||
pref("toolkit.pageThumbs.screenSizeDivisor", 7);
|
||||
pref("toolkit.pageThumbs.minWidth", 0);
|
||||
pref("toolkit.pageThumbs.minHeight", 0);
|
||||
|
||||
pref("tenfourfox.adblock.enabled", false);
|
||||
pref("tenfourfox.adblock.logging.enabled", true);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define mozilla_net_AutoClose_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
namespace mozilla { namespace net {
|
||||
|
||||
|
@ -18,49 +19,48 @@ template <typename T>
|
|||
class AutoClose
|
||||
{
|
||||
public:
|
||||
AutoClose() { }
|
||||
AutoClose() : mMutex("net::AutoClose.mMutex") { }
|
||||
~AutoClose(){
|
||||
Close();
|
||||
CloseAndRelease();
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
explicit operator bool()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
already_AddRefed<T> forget()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
return mPtr.forget();
|
||||
}
|
||||
|
||||
void takeOver(nsCOMPtr<T> & rhs)
|
||||
{
|
||||
Close();
|
||||
mPtr = rhs.forget();
|
||||
}
|
||||
|
||||
void takeOver(AutoClose<T> & rhs)
|
||||
{
|
||||
Close();
|
||||
mPtr = rhs.mPtr.forget();
|
||||
already_AddRefed<T> other = rhs.forget();
|
||||
TakeOverInternal(&other);
|
||||
}
|
||||
|
||||
void CloseAndRelease()
|
||||
{
|
||||
Close();
|
||||
mPtr = nullptr;
|
||||
}
|
||||
|
||||
T* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN
|
||||
{
|
||||
return mPtr.operator->();
|
||||
TakeOverInternal(nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
void Close()
|
||||
void TakeOverInternal(already_AddRefed<T> *aOther)
|
||||
{
|
||||
if (mPtr) {
|
||||
mPtr->Close();
|
||||
nsCOMPtr<T> ptr;
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
ptr.swap(mPtr);
|
||||
if (aOther) {
|
||||
mPtr = *aOther;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr) {
|
||||
ptr->Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ private:
|
|||
AutoClose(const AutoClose<T> &) = delete;
|
||||
|
||||
nsCOMPtr<T> mPtr;
|
||||
Mutex mMutex;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -4061,8 +4061,9 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec)
|
|||
for (auto iter = mDBState->hostTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsCookieEntry* entry = iter.Get();
|
||||
|
||||
const nsCookieEntry::ArrayType &cookies = entry->GetCookies();
|
||||
for (nsCookieEntry::IndexType i = 0; i < cookies.Length(); ) {
|
||||
const nsCookieEntry::ArrayType& cookies = entry->GetCookies();
|
||||
auto length = cookies.Length();
|
||||
for (nsCookieEntry::IndexType i = 0; i < length; ) {
|
||||
nsListIter iter(entry, i);
|
||||
nsCookie* cookie = cookies[i];
|
||||
|
||||
|
@ -4071,9 +4072,12 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec)
|
|||
removedList->AppendElement(cookie, false);
|
||||
COOKIE_LOGEVICTED(cookie, "Cookie expired");
|
||||
|
||||
// remove from list; do not increment our iterator
|
||||
// remove from list; do not increment our iterator unless we're the last
|
||||
// in the list already.
|
||||
gCookieService->RemoveCookieFromList(iter, paramsArray);
|
||||
|
||||
if (i == --length) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// check if the cookie is over the age limit
|
||||
if (cookie->LastAccessed() <= purgeTime) {
|
||||
|
@ -4086,6 +4090,7 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec)
|
|||
|
||||
++i;
|
||||
}
|
||||
MOZ_ASSERT(length == cookies.Length());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3069,6 +3069,14 @@ HttpBaseChannel::GetPerformance()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// We only add to the document's performance object if it has the same
|
||||
// principal as the one triggering the load. This is to prevent navigations
|
||||
// triggered _by_ the iframe from showing up in the parent document's
|
||||
// performance entries if they have different origins.
|
||||
if (!mLoadInfo->TriggeringPrincipal()->Equals(loadingDocument->NodePrincipal())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> innerWindow = loadingDocument->GetInnerWindow();
|
||||
if (!innerWindow) {
|
||||
return nullptr;
|
||||
|
|
|
@ -1096,8 +1096,9 @@ nsHttpChannel::CallOnStartRequest()
|
|||
|
||||
LOG((" calling mListener->OnStartRequest\n"));
|
||||
if (mListener) {
|
||||
MOZ_ASSERT(!mOnStartRequestCalled,
|
||||
"We should not call OsStartRequest twice");
|
||||
NS_ASSERTION(!mOnStartRequestCalled,
|
||||
"We should not call OsStartRequest twice");
|
||||
if (mOnStartRequestCalled) return NS_OK;
|
||||
rv = mListener->OnStartRequest(this, mListenerContext);
|
||||
mOnStartRequestCalled = true;
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -761,6 +761,7 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
|||
{ "ct.search.yahoo.com", false, true, false, -1, &kPinset_yahoo },
|
||||
{ "de.search.yahoo.com", false, true, false, -1, &kPinset_yahoo },
|
||||
{ "dev.twitter.com", true, false, false, -1, &kPinset_twitterCom },
|
||||
{ "developer.android.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
{ "developers.facebook.com", true, false, false, -1, &kPinset_facebook },
|
||||
{ "dist.torproject.org", true, false, false, -1, &kPinset_tor },
|
||||
{ "dk.search.yahoo.com", false, true, false, -1, &kPinset_yahoo },
|
||||
|
@ -1031,6 +1032,7 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
|||
{ "gr.search.yahoo.com", false, true, false, -1, &kPinset_yahoo },
|
||||
{ "groups.google.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
{ "gstatic.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
{ "gvt1.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
{ "gvt2.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
{ "gvt3.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
{ "hangouts.google.com", true, false, false, -1, &kPinset_google_root_pems },
|
||||
|
@ -1176,8 +1178,8 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
|||
{ "zh.search.yahoo.com", false, true, false, -1, &kPinset_yahoo },
|
||||
};
|
||||
|
||||
// Pinning Preload List Length = 474;
|
||||
// Pinning Preload List Length = 476;
|
||||
|
||||
static const int32_t kUnknownId = -1;
|
||||
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1522005531140000);
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1524685607926000);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -738,6 +738,12 @@ StartupCacheWrapper* StartupCacheWrapper::gStartupCacheWrapper = nullptr;
|
|||
|
||||
NS_IMPL_ISUPPORTS(StartupCacheWrapper, nsIStartupCache)
|
||||
|
||||
StartupCacheWrapper::~StartupCacheWrapper()
|
||||
{
|
||||
MOZ_ASSERT(gStartupCacheWrapper == this);
|
||||
gStartupCacheWrapper = nullptr;
|
||||
}
|
||||
|
||||
StartupCacheWrapper* StartupCacheWrapper::GetSingleton()
|
||||
{
|
||||
if (!gStartupCacheWrapper)
|
||||
|
|
|
@ -214,7 +214,7 @@ class StartupCacheDebugOutputStream final
|
|||
class StartupCacheWrapper final
|
||||
: public nsIStartupCache
|
||||
{
|
||||
~StartupCacheWrapper() {}
|
||||
~StartupCacheWrapper();
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSISTARTUPCACHE
|
||||
|
|
|
@ -180,8 +180,9 @@ nsAutoCompleteController::StartSearch(const nsAString &aSearchString)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAutoCompleteController::HandleText()
|
||||
nsAutoCompleteController::HandleText(bool *_retval)
|
||||
{
|
||||
*_retval = false;
|
||||
// Note: the events occur in the following order when IME is used.
|
||||
// 1. a compositionstart event(HandleStartComposition)
|
||||
// 2. some input events (HandleText), eCompositionState_Composing
|
||||
|
@ -284,6 +285,7 @@ nsAutoCompleteController::HandleText()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = true;
|
||||
StartSearches();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -610,7 +612,8 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
|
|||
input->GetPopupOpen(&isOpen);
|
||||
if (!isOpen || mRowCount <= 0) {
|
||||
// Nothing left to delete, proceed as normal
|
||||
HandleText();
|
||||
bool unused = false;
|
||||
HandleText(&unused);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -621,7 +624,8 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
|
|||
popup->GetSelectedIndex(&index);
|
||||
if (index == -1) {
|
||||
// No row is selected in the list
|
||||
HandleText();
|
||||
bool unused = false;
|
||||
HandleText(&unused);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1185,7 +1189,7 @@ nsAutoCompleteController::StartSearch(uint16_t aSearchType)
|
|||
nsAutoString searchParam;
|
||||
nsresult rv = input->GetSearchParam(searchParam);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return rv;
|
||||
|
||||
// FormFill expects the searchParam to only contain the input element id,
|
||||
// other consumers may have other expectations, so this modifies it only
|
||||
|
@ -1547,9 +1551,9 @@ nsAutoCompleteController::ProcessResult(int32_t aSearchIndex, nsIAutoCompleteRes
|
|||
if (mResults.IndexOf(aResult) == -1) {
|
||||
nsIAutoCompleteResult* oldResult = mResults.SafeObjectAt(aSearchIndex);
|
||||
if (oldResult) {
|
||||
MOZ_ASSERT(false, "Passing new matches to OnSearchResult with a new "
|
||||
"nsIAutoCompleteResult every time is deprecated, please "
|
||||
"update the same result until the search is done");
|
||||
NS_ASSERTION(false, "Passing new matches to OnSearchResult with a new "
|
||||
"nsIAutoCompleteResult every time is deprecated, please "
|
||||
"update the same result until the search is done");
|
||||
// Build a new nsIAutocompleteSimpleResult and merge results into it.
|
||||
RefPtr<nsAutoCompleteSimpleResult> mergedResult =
|
||||
new nsAutoCompleteSimpleResult();
|
||||
|
|
|
@ -37,7 +37,7 @@ interface nsIAutoCompleteController : nsISupports
|
|||
*/
|
||||
void startSearch(in AString searchString);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Stop all asynchronous searches
|
||||
*/
|
||||
void stopSearch();
|
||||
|
@ -54,8 +54,10 @@ interface nsIAutoCompleteController : nsISupports
|
|||
* it's not in composing mode. DOM compositionend event is not good
|
||||
* timing for calling handleText(). DOM input event immediately after
|
||||
* DOM compositionend event is the best timing to call this.
|
||||
*
|
||||
* @return whether this handler started a new search.
|
||||
*/
|
||||
void handleText();
|
||||
boolean handleText();
|
||||
|
||||
/*
|
||||
* Notify the controller that the user wishes to enter the current text. If
|
||||
|
@ -63,14 +65,16 @@ interface nsIAutoCompleteController : nsISupports
|
|||
* fill this value into the input field before continuing. If false, just
|
||||
* use the current value of the input field.
|
||||
*
|
||||
* @return True if the controller wishes to prevent event propagation and default event
|
||||
* @return Whether the controller wishes to prevent event propagation and
|
||||
* default event.
|
||||
*/
|
||||
boolean handleEnter(in boolean aIsPopupSelection);
|
||||
|
||||
/*
|
||||
* Notify the controller that the user wishes to revert autocomplete
|
||||
*
|
||||
* @return True if the controller wishes to prevent event propagation and default event
|
||||
* @return Whether the controller wishes to prevent event propagation and
|
||||
* default event.
|
||||
*/
|
||||
boolean handleEscape();
|
||||
|
||||
|
@ -90,7 +94,7 @@ interface nsIAutoCompleteController : nsISupports
|
|||
*/
|
||||
void handleEndComposition();
|
||||
|
||||
/*
|
||||
/*
|
||||
* Handle tab. Just closes up.
|
||||
*/
|
||||
void handleTab();
|
||||
|
@ -99,16 +103,19 @@ interface nsIAutoCompleteController : nsISupports
|
|||
* Notify the controller of the following key navigation events:
|
||||
* up, down, left, right, page up, page down
|
||||
*
|
||||
* @return True if the controller wishes to prevent event propagation and default event
|
||||
* @return Whether the controller wishes to prevent event propagation and
|
||||
* default event
|
||||
*/
|
||||
boolean handleKeyNavigation(in unsigned long key);
|
||||
|
||||
/*
|
||||
* Notify the controller that the user chose to delete the current
|
||||
* auto-complete result.
|
||||
*
|
||||
* @return Whether the controller removed a result item.
|
||||
*/
|
||||
boolean handleDelete();
|
||||
|
||||
|
||||
/*
|
||||
* Get the value of the result at a given index in the last completed search
|
||||
*/
|
||||
|
|
|
@ -2574,7 +2574,16 @@ History::RegisterVisitedCallback(nsIURI* aURI,
|
|||
// assumes that aLink is non-nullptr, we will need to return now.
|
||||
if (NS_FAILED(rv) || !aLink) {
|
||||
// Remove our array from the hashtable so we don't keep it around.
|
||||
mObservers.RemoveEntry(aURI);
|
||||
// In some case calling RemoveEntry on the key obtained by PutEntry
|
||||
// crashes for currently unknown reasons. Our suspect is that something
|
||||
// between PutEntry and this call causes a nested loop that either removes
|
||||
// the entry or reallocs the hash.
|
||||
// TODO (Bug 1412647): we must figure the root cause for these issues and
|
||||
// remove this stop-gap crash fix.
|
||||
key = mObservers.GetEntry(aURI);
|
||||
if (key) {
|
||||
mObservers.RemoveEntry(key);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -501,7 +501,8 @@ NS_IMETHODIMP
|
|||
nsFormFillController::GetTextValue(nsAString & aTextValue)
|
||||
{
|
||||
if (mFocusedInput) {
|
||||
mFocusedInput->GetValue(aTextValue);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> input = mFocusedInput;
|
||||
input->GetValue(aTextValue);
|
||||
} else {
|
||||
aTextValue.Truncate();
|
||||
}
|
||||
|
@ -523,24 +524,30 @@ nsFormFillController::SetTextValue(const nsAString & aTextValue)
|
|||
NS_IMETHODIMP
|
||||
nsFormFillController::GetSelectionStart(int32_t *aSelectionStart)
|
||||
{
|
||||
if (mFocusedInput)
|
||||
mFocusedInput->GetSelectionStart(aSelectionStart);
|
||||
if (mFocusedInput) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> input = mFocusedInput;
|
||||
input->GetSelectionStart(aSelectionStart);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormFillController::GetSelectionEnd(int32_t *aSelectionEnd)
|
||||
{
|
||||
if (mFocusedInput)
|
||||
mFocusedInput->GetSelectionEnd(aSelectionEnd);
|
||||
if (mFocusedInput) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> input = mFocusedInput;
|
||||
input->GetSelectionEnd(aSelectionEnd);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormFillController::SelectTextRange(int32_t aStartIndex, int32_t aEndIndex)
|
||||
{
|
||||
if (mFocusedInput)
|
||||
mFocusedInput->SetSelectionRange(aStartIndex, aEndIndex, EmptyString());
|
||||
if (mFocusedInput) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> input = mFocusedInput;
|
||||
input->SetSelectionRange(aStartIndex, aEndIndex, EmptyString());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -814,8 +821,9 @@ nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return KeyPress(aEvent);
|
||||
}
|
||||
if (type.EqualsLiteral("input")) {
|
||||
bool unused = false;
|
||||
return (!mSuppressOnInput && mController && mFocusedInput) ?
|
||||
mController->HandleText() : NS_OK;
|
||||
mController->HandleText(&unused) : NS_OK;
|
||||
}
|
||||
if (type.EqualsLiteral("blur")) {
|
||||
if (mFocusedInput)
|
||||
|
@ -925,6 +933,7 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
bool cancel = false;
|
||||
bool unused = false;
|
||||
|
||||
uint32_t k;
|
||||
keyEvent->GetKeyCode(&k);
|
||||
|
@ -934,7 +943,7 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
|
|||
mController->HandleDelete(&cancel);
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
|
||||
mController->HandleText();
|
||||
mController->HandleText(&unused);
|
||||
break;
|
||||
#else
|
||||
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
|
||||
|
@ -942,10 +951,11 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
|
|||
bool isShift = false;
|
||||
keyEvent->GetShiftKey(&isShift);
|
||||
|
||||
if (isShift)
|
||||
if (isShift) {
|
||||
mController->HandleDelete(&cancel);
|
||||
else
|
||||
mController->HandleText();
|
||||
} else {
|
||||
mController->HandleText(&unused);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1055,7 +1065,8 @@ nsFormFillController::MouseDown(nsIDOMEvent* aEvent)
|
|||
if (value.Length() > 0) {
|
||||
// Show the popup with a filtered result set
|
||||
mController->SetSearchString(EmptyString());
|
||||
mController->HandleText();
|
||||
bool unused = false;
|
||||
mController->HandleText(&unused);
|
||||
} else {
|
||||
// Show the popup with the complete result set. Can't use HandleText()
|
||||
// because it doesn't display the popup if the input is blank.
|
||||
|
|
|
@ -3391,6 +3391,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
|
|||
// draw a focus ring
|
||||
if (eventState.HasState(NS_EVENT_STATE_FOCUS)) {
|
||||
NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
|
||||
if (MOZ_UNLIKELY(!savedContext)) break; // speculative fix issue 471
|
||||
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES]];
|
||||
CGContextSaveGState(cgContext);
|
||||
NSSetFocusRingStyle(NSFocusRingOnly);
|
||||
|
|
Loading…
Reference in New Issue
Block a user