Merge inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2014-02-06 16:17:59 -05:00
commit 413cc1965c
83 changed files with 693 additions and 215 deletions

View File

@ -205,3 +205,10 @@ https://www2.w3c-test.org:443
https://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:443
https://xn--lve-6lad.w3c-test.org:443
http://test.w3.org:80
# Hosts for testing TLD-based fallback encoding
http://example.tw:80 privileged
http://example.cn:80 privileged
http://example.co.jp:80 privileged
http://example.fi:80 privileged

View File

@ -435,6 +435,66 @@ nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
}
}
void
nsHTMLDocument::TryTLD(int32_t& aCharsetSource, nsACString& aCharset)
{
if (aCharsetSource >= kCharsetFromTopLevelDomain) {
return;
}
if (!FallbackEncoding::sGuessFallbackFromTopLevelDomain) {
return;
}
if (!mDocumentURI) {
return;
}
nsAutoCString host;
mDocumentURI->GetAsciiHost(host);
if (host.IsEmpty()) {
return;
}
// First let's see if the host is DNS-absolute and ends with a dot and
// get rid of that one.
if (host.Last() == '.') {
host.SetLength(host.Length() - 1);
if (host.IsEmpty()) {
return;
}
}
// If we still have a dot, the host is weird, so let's continue only
// if we have something other than a dot now.
if (host.Last() == '.') {
return;
}
int32_t index = host.RFindChar('.');
if (index == kNotFound) {
// We have an intranet host, Gecko-internal URL or an IPv6 address.
return;
}
// Since the string didn't end with a dot and we found a dot,
// there is at least one character between the dot and the end of
// the string, so taking the substring below is safe.
nsAutoCString tld;
ToLowerCase(Substring(host, index + 1, host.Length() - (index + 1)), tld);
// Reject generic TLDs and country TLDs that need more research
if (!FallbackEncoding::IsParticipatingTopLevelDomain(tld)) {
return;
}
// Check if we have an IPv4 address
bool seenNonDigit = false;
for (size_t i = 0; i < tld.Length(); ++i) {
char c = tld.CharAt(i);
if (c < '0' || c > '9') {
seenNonDigit = true;
break;
}
}
if (!seenNonDigit) {
return;
}
aCharsetSource = kCharsetFromTopLevelDomain;
FallbackEncoding::FromTopLevelDomain(tld, aCharset);
}
void
nsHTMLDocument::TryFallback(int32_t& aCharsetSource, nsACString& aCharset)
{
@ -661,6 +721,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
TryCacheCharset(cachingChan, charsetSource, charset);
}
TryTLD(charsetSource, charset);
TryFallback(charsetSource, charset);
if (wyciwygChannel) {

View File

@ -313,6 +313,7 @@ protected:
nsACString& aCharset);
void TryParentCharset(nsIDocShell* aDocShell,
int32_t& charsetSource, nsACString& aCharset);
void TryTLD(int32_t& aCharsetSource, nsACString& aCharset);
static void TryFallback(int32_t& aCharsetSource, nsACString& aCharset);
// Override so we can munge the charset on our wyciwyg channel as needed.

View File

@ -39,7 +39,7 @@ load 878407.html
load 878478.html
load 877527.html
load 880129.html
skip-if(B2G) test-pref(media.webaudio.enabled,true) load 880202.html # load failed, bug 908306 for B2G
skip-if(B2G) load 880202.html # load failed, bug 908306 for B2G
load 880342-1.html
load 880342-2.html
load 880384.html

View File

@ -10,7 +10,6 @@
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
#include "EnableWebAudioCheck.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "AudioContext.h"
@ -31,8 +30,7 @@ class AudioContext;
* are Float32Arrays, or in mSharedChannels if the mJSChannels objects have
* been neutered.
*/
class AudioBuffer MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
class AudioBuffer MOZ_FINAL : public nsWrapperCache
{
public:
AudioBuffer(AudioContext* aContext, uint32_t aLength,

View File

@ -8,7 +8,6 @@
#define AudioContext_h_
#include "mozilla/dom/AudioChannelBinding.h"
#include "EnableWebAudioCheck.h"
#include "MediaBufferDecoder.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/TypedArray.h"
@ -64,8 +63,7 @@ class WaveShaperNode;
class PeriodicWave;
class AudioContext MOZ_FINAL : public nsDOMEventTargetHelper,
public nsIMemoryReporter,
public EnableWebAudioCheck
public nsIMemoryReporter
{
AudioContext(nsPIDOMWindow* aParentWindow,
bool aIsOffline,

View File

@ -10,7 +10,6 @@
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
#include "EnableWebAudioCheck.h"
#include "nsAutoPtr.h"
#include "ThreeDPoint.h"
#include "AudioContext.h"
@ -23,8 +22,7 @@ namespace mozilla {
namespace dom {
class AudioListener MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
class AudioListener MOZ_FINAL : public nsWrapperCache
{
public:
explicit AudioListener(AudioContext* aContext);

View File

@ -10,7 +10,6 @@
#include "nsDOMEventTargetHelper.h"
#include "mozilla/dom/AudioNodeBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "EnableWebAudioCheck.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "AudioContext.h"
@ -82,8 +81,7 @@ private:
* still alive, and will still be alive when it receives a message from the
* engine.
*/
class AudioNode : public nsDOMEventTargetHelper,
public EnableWebAudioCheck
class AudioNode : public nsDOMEventTargetHelper
{
protected:
// You can only use refcounting to delete this object

View File

@ -10,7 +10,6 @@
#include "AudioParamTimeline.h"
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "EnableWebAudioCheck.h"
#include "nsAutoPtr.h"
#include "AudioNode.h"
#include "mozilla/dom/TypedArray.h"
@ -22,7 +21,6 @@ namespace mozilla {
namespace dom {
class AudioParam MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck,
public AudioParamTimeline
{
public:

View File

@ -14,8 +14,7 @@
namespace mozilla {
namespace dom {
class AudioProcessingEvent : public nsDOMEvent,
public EnableWebAudioCheck
class AudioProcessingEvent : public nsDOMEvent
{
public:
AudioProcessingEvent(ScriptProcessorNode* aOwner,

View File

@ -1,32 +0,0 @@
/* -*- 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 "EnableWebAudioCheck.h"
#include "mozilla/Preferences.h"
namespace {
bool gPrefInitialized = false;
bool gWebAudioEnabled = false;
}
namespace mozilla {
namespace dom {
/* static */ bool
EnableWebAudioCheck::PrefEnabled()
{
if (!gPrefInitialized) {
Preferences::AddBoolVarCache(&gWebAudioEnabled, "media.webaudio.enabled");
gPrefInitialized = true;
}
return gWebAudioEnabled;
}
}
}

View File

@ -1,24 +0,0 @@
/* -*- 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 EnableWebAudioCheck_h_
#define EnableWebAudioCheck_h_
namespace mozilla {
namespace dom {
// This is a helper class which enables Web Audio to be enabled or disabled
// as whole. Individual Web Audio object classes should inherit from this.
class EnableWebAudioCheck {
public:
static bool PrefEnabled();
};
}
}
#endif

View File

@ -15,8 +15,7 @@ namespace dom {
class AudioContext;
class OfflineAudioCompletionEvent : public nsDOMEvent,
public EnableWebAudioCheck
class OfflineAudioCompletionEvent : public nsDOMEvent
{
public:
OfflineAudioCompletionEvent(AudioContext* aOwner,

View File

@ -10,7 +10,6 @@
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
#include "EnableWebAudioCheck.h"
#include "AudioContext.h"
#include "AudioNodeEngine.h"
#include "nsAutoPtr.h"
@ -19,8 +18,7 @@ namespace mozilla {
namespace dom {
class PeriodicWave MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
class PeriodicWave MOZ_FINAL : public nsWrapperCache
{
public:
PeriodicWave(AudioContext* aContext,

View File

@ -36,7 +36,6 @@ EXPORTS.mozilla.dom += [
'ConvolverNode.h',
'DelayNode.h',
'DynamicsCompressorNode.h',
'EnableWebAudioCheck.h',
'GainNode.h',
'MediaElementAudioSourceNode.h',
'MediaStreamAudioDestinationNode.h',
@ -66,7 +65,6 @@ UNIFIED_SOURCES += [
'DelayNode.cpp',
'DelayProcessor.cpp',
'DynamicsCompressorNode.cpp',
'EnableWebAudioCheck.cpp',
'FFTBlock.cpp',
'GainNode.cpp',
'MediaBufferDecoder.cpp',

View File

@ -1994,6 +1994,10 @@ nsDocShell::GatherCharsetMenuTelemetry()
int32_t charsetSource = doc->GetDocumentCharacterSetSource();
switch (charsetSource) {
case kCharsetFromTopLevelDomain:
// Unlabeled doc on a domain that we map to a fallback encoding
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 7);
break;
case kCharsetFromFallback:
case kCharsetFromDocTypeDefault:
case kCharsetFromCache:

View File

@ -17,7 +17,16 @@ static const char* localesFallbacks[][3] = {
#include "localesfallbacks.properties.h"
};
static const char* domainsFallbacks[][3] = {
#include "domainsfallbacks.properties.h"
};
static const char* nonParticipatingDomains[][3] = {
#include "nonparticipatingdomains.properties.h"
};
FallbackEncoding* FallbackEncoding::sInstance = nullptr;
bool FallbackEncoding::sGuessFallbackFromTopLevelDomain = true;
FallbackEncoding::FallbackEncoding()
{
@ -121,6 +130,8 @@ FallbackEncoding::Initialize()
Preferences::RegisterCallback(FallbackEncoding::PrefChanged,
"general.useragent.locale",
nullptr);
Preferences::AddBoolVarCache(&sGuessFallbackFromTopLevelDomain,
"intl.charset.fallback.tld");
}
void
@ -132,5 +143,26 @@ FallbackEncoding::Shutdown()
FallbackEncoding::sInstance = nullptr;
}
bool
FallbackEncoding::IsParticipatingTopLevelDomain(const nsACString& aTLD)
{
nsAutoCString dummy;
return NS_FAILED(nsUConvPropertySearch::SearchPropertyValue(
nonParticipatingDomains,
ArrayLength(nonParticipatingDomains),
aTLD,
dummy));
}
void
FallbackEncoding::FromTopLevelDomain(const nsACString& aTLD,
nsACString& aFallback)
{
if (NS_FAILED(nsUConvPropertySearch::SearchPropertyValue(
domainsFallbacks, ArrayLength(domainsFallbacks), aTLD, aFallback))) {
aFallback.AssignLiteral("windows-1252");
}
}
} // namespace dom
} // namespace mozilla

View File

@ -14,6 +14,11 @@ class FallbackEncoding
{
public:
/**
* Whether FromTopLevelDomain() should be used.
*/
static bool sGuessFallbackFromTopLevelDomain;
/**
* Gets the locale-dependent fallback encoding for legacy HTML and plain
* text content.
@ -22,6 +27,23 @@ public:
*/
static void FromLocale(nsACString& aFallback);
/**
* Checks if it is appropriate to call FromTopLevelDomain() for a given TLD.
*
* @param aTLD the top-level domain (in Punycode)
* @return true if OK to call FromTopLevelDomain()
*/
static bool IsParticipatingTopLevelDomain(const nsACString& aTLD);
/**
* Gets a top-level domain-depedendent fallback encoding for legacy HTML
* and plain text content
*
* @param aTLD the top-level domain (in Punycode)
* @param aFallback the outparam for the fallback encoding
*/
static void FromTopLevelDomain(const nsACString& aTLD, nsACString& aFallback);
// public API ends here!
/**

View File

@ -9,3 +9,7 @@ labelsencodings.properties.h: $(PROPS2ARRAYS) labelsencodings.properties
$(PYTHON) $^ $@
localesfallbacks.properties.h: $(PROPS2ARRAYS) localesfallbacks.properties
$(PYTHON) $^ $@
domainsfallbacks.properties.h: $(PROPS2ARRAYS) domainsfallbacks.properties
$(PYTHON) $^ $@
nonparticipatingdomains.properties.h: $(PROPS2ARRAYS) nonparticipatingdomains.properties
$(PYTHON) $^ $@

View File

@ -0,0 +1,167 @@
# 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/.
# This file contains educated guesses about which top-level domains are
# likely to host legacy content that assumes a non-windows-1252 encoding.
# Punycode TLDs are included on the theory that legacy content might appear
# behind those relatively new TLDs if DNS just points to a legacy server.
#
# Encodings for which a confident-enough educated guess is missing are
# listed in nonparticipatingdomains.properties. Domains that are listed
# neither there nor here get windows-1252 as the associated fallback.
#
# The list below includes Arabic-script TLDs not on IANA list but on the
# ICANN list:
# http://www.icann.org/en/resources/idn/fast-track/string-evaluation-completion
# Otherwise, the list includes non-windows-1252-affilited country TLDs from
# https://data.iana.org/TLD/tlds-alpha-by-domain.txt
#
# The guesses are assigned as follows:
# * If the country has a dominant country-affiliated language and that language
# is part of the languages to fallbacks mapping, use the encoding for that
# language from that mapping.
# * Use windows-1256 for countries that have a dominant Arabic-script
# language or whose all languages are Arabic-script languages.
# * Use windows-1251 likewise but for Cyrillic script.
ae=windows-1256
xn--mgbaam7a8h=windows-1256
af=windows-1256
bg=windows-1251
bh=windows-1256
by=windows-1251
cn=gbk
xn--fiqs8s=gbk
# Assume that Traditional Chinese TLD is meant to work if URL input happens to
# be in the traditional mode. Expect content to be simplified anyway.
xn--fiqz9s=gbk
cz=windows-1250
dz=windows-1256
xn--lgbbat1ad8j=windows-1256
ee=windows-1257
eg=windows-1256
xn--wgbh1c=windows-1256
gr=ISO-8859-7
hk=Big5-HKSCS
xn--j6w193g=Big5-HKSCS
hr=windows-1250
hu=ISO-8859-2
iq=windows-1256
ir=windows-1256
xn--mgba3a4f16a=windows-1256
jo=windows-1256
xn--mgbayh7gpa=windows-1256
jp=Shift_JIS
kg=windows-1251
kp=EUC-KR
kr=EUC-KR
xn--3e0b707e=EUC-KR
kw=windows-1256
kz=windows-1251
xn--80ao21a=windows-1251
lb=windows-1256
lt=windows-1257
lv=windows-1257
ma=windows-1256
xn--mgbc0a9azcg=windows-1256
mk=windows-1251
mn=windows-1251
xn--l1acc=windows-1251
mo=Big5
# my
xn--mgbx4cd0ab=windows-1256
om=windows-1256
xn--mgb9awbf=windows-1256
#pk
xn--mgbai9azgqp6j=windows-1256
pl=ISO-8859-2
ps=windows-1256
xn--ygbi2ammx=windows-1256
qa=windows-1256
xn--wgbl6a=windows-1256
rs=windows-1251
xn--90a3ac=windows-1251
ru=windows-1251
xn--p1ai=windows-1251
sa=windows-1256
xn--mgberp4a5d4ar=windows-1256
sd=windows-1256
xn--mgbpl2fh=windows-1256
sg=gbk
xn--yfro4i67o=gbk
si=ISO-8859-2
sk=windows-1250
su=windows-1251
sy=windows-1256
xn--mgbtf8fl=windows-1256
th=windows-874
xn--o3cw4h=windows-874
tj=windows-1251
tn=windows-1256
xn--pgbs0dh=windows-1256
tr=windows-1254
tw=Big5
# Assume that the Simplified Chinese TLD is meant to work when URL input
# happens in the simplified mode. Assume content is tradition anyway.
xn--kprw13d=Big5
xn--kpry57d=Big5
ua=windows-1251
xn--j1amh=windows-1251
uz=windows-1251
vn=windows-1258
ye=windows-1256
xn--mgb2ddes=windows-1256

View File

@ -28,6 +28,8 @@ LOCAL_INCLUDES += [
]
GENERATED_FILES += [
'domainsfallbacks.properties.h',
'labelsencodings.properties.h',
'localesfallbacks.properties.h',
'nonparticipatingdomains.properties.h',
]

View File

@ -0,0 +1,51 @@
# 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/.
# Top-level domains listed here do not participate in TLD-based guessing.
#
# We should do Web crawls to see if domains listed here can migrate to
# domainsfallbacks.properties.
#
# The value to the right of the = sign is ignored and serves as a placeholder.
# Generic
com=windows-1252
net=windows-1252
org=windows-1252
# No Firefox localization for Azeri
az=windows-1254
# windows-1251 or windows-1250?
ba=???
# ISO-8859-7 or windows-1254?
cy=???
# Is there enough unlabeled windows-1256 content for a windows-1255 to break
# too much?
il=windows-1255
# Out-of-country English use
ly=windows-1256
# Out-of-country English use
# md=windows-1250
# Out-of-country English use
# me=windows-1251
# Malaysia has an Arabic-script TLD, official script is latin, possibly Chinese-script publications
my=???
# No Firefox localization for Urdu; potential for minority-language sites
# relying on windows-1252 hacks.
pk=windows-1256
# The Romanian localization says windows-1252, even though the Windows legacy
# differs.
ro=windows-1250
tm=windows-1250

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<script>
function report() {
window.parent.postMessage(document.characterSet, "*");
}
</script>
<body onload="report();">

View File

@ -7,6 +7,7 @@ support-files =
file_utf16_le_bom.js
file_utf16_le_bom.xhtml
file_utf16_le_nobom.xhtml
file_TLD.html
worker_helper.js
[test_BOMEncoding.js]
@ -16,4 +17,5 @@ support-files =
[test_TextEncoder.js]
[test_stringencoding.html]
[test_submit_euckr.html]
[test_TLD.html]
[test_utf16_files.html]

View File

@ -0,0 +1,57 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=910211
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 910211</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 910211 **/
SimpleTest.waitForExplicitFinish();
var tlds = [
{'tld': 'tw', 'encoding': 'Big5'},
{'tld': 'cn', 'encoding': 'gbk'},
{'tld': 'co.jp', 'encoding': 'Shift_JIS'},
{'tld': 'fi', 'encoding': 'windows-1252'},
];
var iframe = null;
var current = null;
function runTest() {
iframe = document.getElementsByTagName("iframe")[0];
window.addEventListener("message", next);
next(null);
}
function next(event) {
if (event) {
is(event.data, current['encoding'], "Got bad encoding for " + current["tld"]);
}
current = tlds.shift();
if (!current) {
SimpleTest.finish();
return;
}
iframe.src = "http://example." + current["tld"] + "/tests/dom/encoding/test/file_TLD.html";
}
</script>
</head>
<body onload="runTest();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=910211">Mozilla Bug 910211</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe></iframe>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AnalyserNode : AudioNode {
// Real-time frequency-domain data

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioBuffer {
readonly attribute float sampleRate;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioBufferSourceNode : AudioNode {
attribute AudioBuffer? buffer;
@ -34,7 +33,6 @@ interface AudioBufferSourceNode : AudioNode {
* The origin of this IDL file is
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
*/
[PrefControlled]
partial interface AudioBufferSourceNode {
// Same as start()
[Throws,Pref="media.webaudio.legacy.AudioBufferSourceNode"]

View File

@ -13,7 +13,7 @@
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void ();
[Constructor, PrefControlled]
[Constructor]
interface AudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
@ -78,7 +78,6 @@ interface AudioContext : EventTarget {
* The origin of this IDL file is
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
*/
[PrefControlled]
partial interface AudioContext {
[NewObject, Throws]
AudioBuffer? createBuffer(ArrayBuffer buffer, boolean mixToMono);

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioDestinationNode : AudioNode {
readonly attribute unsigned long maxChannelCount;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioListener {
// same as OpenAL (default 1)

View File

@ -21,7 +21,6 @@ enum ChannelInterpretation {
"discrete"
};
[PrefControlled]
interface AudioNode : EventTarget {
[Throws]

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioParam {
attribute float value;
@ -43,7 +42,6 @@ interface AudioParam {
* The origin of this IDL file is
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
*/
[PrefControlled]
partial interface AudioParam {
// Same as setTargetAtTime()
[Throws,Pref="media.webaudio.legacy.AudioParam"]

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioProcessingEvent : Event {
readonly attribute double playbackTime;

View File

@ -24,7 +24,6 @@ enum BiquadFilterType {
"allpass"
};
[PrefControlled]
interface BiquadFilterNode : AudioNode {
attribute BiquadFilterType type;
@ -43,7 +42,6 @@ interface BiquadFilterNode : AudioNode {
* The origin of this IDL file is
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
*/
[PrefControlled]
partial interface BiquadFilterNode {
[Pref="media.webaudio.legacy.BiquadFilterNode"]
const unsigned short LOWPASS = 0;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface ChannelMergerNode : AudioNode {
};

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface ChannelSplitterNode : AudioNode {
};

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface ConvolverNode : AudioNode {
[SetterThrows]

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface DelayNode : AudioNode {
readonly attribute AudioParam delayTime;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface DynamicsCompressorNode : AudioNode {
readonly attribute AudioParam threshold; // in Decibels

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface GainNode : AudioNode {
readonly attribute AudioParam gain;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface MediaElementAudioSourceNode : AudioNode {
};

View File

@ -10,9 +10,8 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface MediaStreamAudioDestinationNode : AudioNode {
readonly attribute MediaStream stream;
};
};

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface OfflineAudioCompletionEvent : Event {
readonly attribute AudioBuffer renderedBuffer;

View File

@ -12,8 +12,7 @@
callback OfflineRenderSuccessCallback = void (AudioBuffer renderedData);
[Constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate),
PrefControlled]
[Constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate)]
interface OfflineAudioContext : AudioContext {
[Throws]

View File

@ -21,7 +21,6 @@ enum OscillatorType {
"custom"
};
[PrefControlled]
interface OscillatorNode : AudioNode {
[SetterThrows]

View File

@ -27,7 +27,6 @@ enum DistanceModelType {
"exponential"
};
[PrefControlled]
interface PannerNode : AudioNode {
// Default for stereo is HRTF
@ -55,7 +54,6 @@ interface PannerNode : AudioNode {
* The origin of this IDL file is
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
*/
[PrefControlled]
partial interface PannerNode {
[Pref="media.webaudio.legacy.PannerNode"]
const unsigned short EQUALPOWER = 0;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface PeriodicWave {
};

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface ScriptProcessorNode : AudioNode {
attribute EventHandler onaudioprocess;

View File

@ -16,7 +16,6 @@ enum OverSampleType {
"4x"
};
[PrefControlled]
interface WaveShaperNode : AudioNode {
attribute Float32Array? curve;

View File

@ -275,6 +275,30 @@ GetWorkerPref(const nsACString& aPref,
return result;
}
// This function creates a key for a SharedWorker composed by "name|scriptSpec".
// If the name contains a '|', this will be replaced by '||'.
void
GenerateSharedWorkerKey(const nsACString& aScriptSpec, const nsACString& aName,
nsCString& aKey)
{
aKey.Truncate();
aKey.SetCapacity(aScriptSpec.Length() + aName.Length() + 1);
nsACString::const_iterator start, end;
aName.BeginReading(start);
aName.EndReading(end);
for (; start != end; ++start) {
if (*start == '|') {
aKey.AppendASCII("||");
} else {
aKey.Append(*start);
}
}
aKey.Append('|');
aKey.Append(aScriptSpec);
}
void
LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
{
@ -1257,7 +1281,7 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
bool isSharedWorker = aWorkerPrivate->IsSharedWorker();
const nsString& sharedWorkerName = aWorkerPrivate->SharedWorkerName();
const nsCString& sharedWorkerName = aWorkerPrivate->SharedWorkerName();
nsCString sharedWorkerScriptSpec;
if (isSharedWorker) {
@ -1306,13 +1330,14 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
}
if (isSharedWorker) {
MOZ_ASSERT(!domainInfo->mSharedWorkerInfos.Get(sharedWorkerScriptSpec));
nsAutoCString key;
GenerateSharedWorkerKey(sharedWorkerScriptSpec, sharedWorkerName, key);
MOZ_ASSERT(!domainInfo->mSharedWorkerInfos.Get(key));
SharedWorkerInfo* sharedWorkerInfo =
new SharedWorkerInfo(aWorkerPrivate, sharedWorkerScriptSpec,
sharedWorkerName);
domainInfo->mSharedWorkerInfos.Put(sharedWorkerScriptSpec,
sharedWorkerInfo);
domainInfo->mSharedWorkerInfos.Put(key, sharedWorkerInfo);
}
}
@ -1402,8 +1427,10 @@ RuntimeService::UnregisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
&match);
if (match.mSharedWorkerInfo) {
domainInfo->mSharedWorkerInfos.Remove(
match.mSharedWorkerInfo->mScriptSpec);
nsAutoCString key;
GenerateSharedWorkerKey(match.mSharedWorkerInfo->mScriptSpec,
match.mSharedWorkerInfo->mName, key);
domainInfo->mSharedWorkerInfos.Remove(key);
}
}
@ -2051,7 +2078,7 @@ RuntimeService::ResumeWorkersForWindow(nsPIDOMWindow* aWindow)
nsresult
RuntimeService::CreateSharedWorker(const GlobalObject& aGlobal,
const nsAString& aScriptURL,
const nsAString& aName,
const nsACString& aName,
SharedWorker** aSharedWorker)
{
AssertIsOnMainThread();
@ -2079,9 +2106,11 @@ RuntimeService::CreateSharedWorker(const GlobalObject& aGlobal,
WorkerDomainInfo* domainInfo;
SharedWorkerInfo* sharedWorkerInfo;
nsAutoCString key;
GenerateSharedWorkerKey(scriptSpec, aName, key);
if (mDomainMap.Get(loadInfo.mDomain, &domainInfo) &&
domainInfo->mSharedWorkerInfos.Get(scriptSpec, &sharedWorkerInfo) &&
sharedWorkerInfo->mName == aName) {
domainInfo->mSharedWorkerInfos.Get(key, &sharedWorkerInfo)) {
workerPrivate = sharedWorkerInfo->mWorkerPrivate;
}
}
@ -2144,8 +2173,10 @@ RuntimeService::ForgetSharedWorker(WorkerPrivate* aWorkerPrivate)
&match);
if (match.mSharedWorkerInfo) {
domainInfo->mSharedWorkerInfos.Remove(
match.mSharedWorkerInfo->mScriptSpec);
nsAutoCString key;
GenerateSharedWorkerKey(match.mSharedWorkerInfo->mScriptSpec,
match.mSharedWorkerInfo->mName, key);
domainInfo->mSharedWorkerInfos.Remove(key);
}
}
}

View File

@ -37,11 +37,11 @@ private:
{
WorkerPrivate* mWorkerPrivate;
nsCString mScriptSpec;
nsString mName;
nsCString mName;
SharedWorkerInfo(WorkerPrivate* aWorkerPrivate,
const nsACString& aScriptSpec,
const nsAString& aName)
const nsACString& aName)
: mWorkerPrivate(aWorkerPrivate), mScriptSpec(aScriptSpec), mName(aName)
{ }
};
@ -144,7 +144,7 @@ public:
nsresult
CreateSharedWorker(const GlobalObject& aGlobal,
const nsAString& aScriptURL,
const nsAString& aName,
const nsACString& aName,
SharedWorker** aSharedWorker);
void

View File

@ -72,9 +72,9 @@ SharedWorker::Constructor(const GlobalObject& aGlobal, JSContext* aCx,
return nullptr;
}
nsString name;
nsCString name;
if (aName.WasPassed()) {
name = aName.Value();
name = NS_ConvertUTF16toUTF8(aName.Value());
}
nsRefPtr<SharedWorker> sharedWorker;

View File

@ -2092,13 +2092,13 @@ typename WorkerPrivateParent<Derived>::cycleCollection
template <class Derived>
WorkerPrivateParent<Derived>::WorkerPrivateParent(
JSContext* aCx,
WorkerPrivate* aParent,
const nsAString& aScriptURL,
bool aIsChromeWorker,
WorkerType aWorkerType,
const nsAString& aSharedWorkerName,
LoadInfo& aLoadInfo)
JSContext* aCx,
WorkerPrivate* aParent,
const nsAString& aScriptURL,
bool aIsChromeWorker,
WorkerType aWorkerType,
const nsACString& aSharedWorkerName,
LoadInfo& aLoadInfo)
: mMutex("WorkerPrivateParent Mutex"),
mCondVar(mMutex, "WorkerPrivateParent CondVar"),
mMemoryReportCondVar(mMutex, "WorkerPrivateParent Memory Report CondVar"),
@ -3523,7 +3523,7 @@ WorkerPrivate::WorkerPrivate(JSContext* aCx,
WorkerPrivate* aParent,
const nsAString& aScriptURL,
bool aIsChromeWorker, WorkerType aWorkerType,
const nsAString& aSharedWorkerName,
const nsACString& aSharedWorkerName,
LoadInfo& aLoadInfo)
: WorkerPrivateParent<WorkerPrivate>(aCx, aParent, aScriptURL,
aIsChromeWorker, aWorkerType,
@ -3563,8 +3563,9 @@ WorkerPrivate::Constructor(const GlobalObject& aGlobal,
const nsAString& aScriptURL,
ErrorResult& aRv)
{
return WorkerPrivate::Constructor(aGlobal, aScriptURL, false, WorkerTypeDedicated,
EmptyString(), nullptr, aRv);
return WorkerPrivate::Constructor(aGlobal, aScriptURL, false,
WorkerTypeDedicated, EmptyCString(),
nullptr, aRv);
}
// static
@ -3591,8 +3592,10 @@ ChromeWorkerPrivate::Constructor(const GlobalObject& aGlobal,
const nsAString& aScriptURL,
ErrorResult& aRv)
{
return WorkerPrivate::Constructor(aGlobal, aScriptURL, true, WorkerTypeDedicated,
EmptyString(), nullptr, aRv).downcast<ChromeWorkerPrivate>();
return WorkerPrivate::Constructor(aGlobal, aScriptURL, true,
WorkerTypeDedicated, EmptyCString(),
nullptr, aRv)
.downcast<ChromeWorkerPrivate>();
}
// static
@ -3609,7 +3612,7 @@ already_AddRefed<WorkerPrivate>
WorkerPrivate::Constructor(const GlobalObject& aGlobal,
const nsAString& aScriptURL,
bool aIsChromeWorker, WorkerType aWorkerType,
const nsAString& aSharedWorkerName,
const nsACString& aSharedWorkerName,
LoadInfo* aLoadInfo, ErrorResult& aRv)
{
WorkerPrivate* parent = NS_IsMainThread() ?

View File

@ -214,7 +214,7 @@ protected:
private:
WorkerPrivate* mParent;
nsString mScriptURL;
nsString mSharedWorkerName;
nsCString mSharedWorkerName;
LocationInfo mLocationInfo;
// The lifetime of these objects within LoadInfo is managed explicitly;
// they do not need to be cycle collected.
@ -251,7 +251,8 @@ protected:
WorkerPrivateParent(JSContext* aCx, WorkerPrivate* aParent,
const nsAString& aScriptURL, bool aIsChromeWorker,
WorkerType aWorkerType,
const nsAString& aSharedWorkerName, LoadInfo& aLoadInfo);
const nsACString& aSharedWorkerName,
LoadInfo& aLoadInfo);
~WorkerPrivateParent();
@ -648,7 +649,7 @@ public:
return mWorkerType == WorkerTypeShared;
}
const nsString&
const nsCString&
SharedWorkerName() const
{
return mSharedWorkerName;
@ -788,7 +789,7 @@ public:
static already_AddRefed<WorkerPrivate>
Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL,
bool aIsChromeWorker, WorkerType aWorkerType,
const nsAString& aSharedWorkerName,
const nsACString& aSharedWorkerName,
LoadInfo* aLoadInfo, ErrorResult& aRv);
static bool
@ -1042,7 +1043,7 @@ public:
private:
WorkerPrivate(JSContext* aCx, WorkerPrivate* aParent,
const nsAString& aScriptURL, bool aIsChromeWorker,
WorkerType aWorkerType, const nsAString& aSharedWorkerName,
WorkerType aWorkerType, const nsACString& aSharedWorkerName,
LoadInfo& aLoadInfo);
void

View File

@ -311,7 +311,7 @@ DedicatedWorkerGlobalScope::PostMessage(JSContext* aCx,
}
SharedWorkerGlobalScope::SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
const nsString& aName)
const nsCString& aName)
: WorkerGlobalScope(aWorkerPrivate), mName(aName)
{
}

View File

@ -138,12 +138,13 @@ public:
class SharedWorkerGlobalScope MOZ_FINAL : public WorkerGlobalScope
{
const nsString mName;
const nsCString mName;
~SharedWorkerGlobalScope() { }
public:
SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate, const nsString& aName);
SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
const nsCString& aName);
static bool
Visible(JSContext* aCx, JSObject* aObj);
@ -152,7 +153,7 @@ public:
WrapGlobalObject(JSContext* aCx) MOZ_OVERRIDE;
void GetName(DOMString& aName) const {
aName.AsAString() = mName;
aName.AsAString() = NS_ConvertUTF8toUTF16(mName);
}
IMPL_EVENT_HANDLER(connect)

View File

@ -71,6 +71,7 @@ support-files =
[test_atob.html]
[test_blobConstructor.html]
[test_blobWorkers.html]
[test_bug949946.html]
[test_chromeWorker.html]
[test_clearTimeouts.html]
[test_close.html]

View File

@ -0,0 +1,31 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bug 949946</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<script class="testbody" type="text/javascript">
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
new SharedWorker('sharedWorker_sharedWorker.js');
new SharedWorker('sharedWorker_sharedWorker.js', ':');
new SharedWorker('sharedWorker_sharedWorker.js', '|||');
ok(true, "3 SharedWorkers created!");
SimpleTest.finish();
});
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

View File

@ -293,9 +293,11 @@ ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
aDidSelfCopy);
MOZ_ASSERT(mTextureClient);
mForwarder->UseTexture(this, mTextureClient);
if (mTextureClientOnWhite) {
mForwarder->UseTexture(this, mTextureClientOnWhite);
mForwarder->UseComponentAlphaTextures(this, mTextureClient,
mTextureClientOnWhite);
} else {
mForwarder->UseTexture(this, mTextureClient);
}
mForwarder->UpdateTextureRegion(this,
ThebesBufferData(BufferRect(),

View File

@ -109,6 +109,7 @@ public:
// call before and after painting into this content client
virtual void BeginPaint() {}
virtual void EndPaint() {}
};
/**

View File

@ -48,6 +48,17 @@ CompositableHost::UseTextureHost(TextureHost* aTexture)
aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
void
CompositableHost::UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
TextureHost* aTextureOnWhite)
{
MOZ_ASSERT(aTextureOnBlack && aTextureOnWhite);
aTextureOnBlack->SetCompositor(GetCompositor());
aTextureOnBlack->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
aTextureOnWhite->SetCompositor(GetCompositor());
aTextureOnWhite->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
void
CompositableHost::SetCompositor(Compositor* aCompositor)
{

View File

@ -288,6 +288,8 @@ public:
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) { }
virtual void UseTextureHost(TextureHost* aTexture);
virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
TextureHost* aTextureOnWhite);
protected:
TextureInfo mTextureInfo;

View File

@ -220,13 +220,18 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
void
ContentHostBase::UseTextureHost(TextureHost* aTexture)
{
if (aTexture->GetFlags() & TEXTURE_ON_WHITE) {
mTextureHostOnWhite = aTexture;
mTextureHostOnWhite->SetCompositor(GetCompositor());
} else {
mTextureHost = aTexture;
mTextureHost->SetCompositor(GetCompositor());
}
mTextureHost = aTexture;
mTextureHostOnWhite = nullptr;
mTextureHost->SetCompositor(GetCompositor());
}
void
ContentHostBase::UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
TextureHost* aTextureOnWhite)
{
CompositableHost::UseComponentAlphaTextures(aTextureOnBlack, aTextureOnWhite);
mTextureHost = aTextureOnBlack;
mTextureHostOnWhite = aTextureOnWhite;
}
void

View File

@ -116,6 +116,8 @@ public:
virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE;
virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
TextureHost* aTextureOnWhite) MOZ_OVERRIDE;
virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }

View File

@ -190,6 +190,9 @@ public:
*/
virtual void UseTexture(CompositableClient* aCompositable,
TextureClient* aClient) = 0;
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) = 0;
/**
* Tell the compositor side that the shared data has been modified so that

View File

@ -233,6 +233,20 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
}
break;
}
case CompositableOperation::TOpUseComponentAlphaTextures: {
const OpUseComponentAlphaTextures& op = aEdit.get_OpUseComponentAlphaTextures();
CompositableHost* compositable = AsCompositable(op);
RefPtr<TextureHost> texOnBlack = TextureHost::AsTextureHost(op.textureOnBlackParent());
RefPtr<TextureHost> texOnWhite = TextureHost::AsTextureHost(op.textureOnWhiteParent());
MOZ_ASSERT(texOnBlack && texOnWhite);
compositable->UseComponentAlphaTextures(texOnBlack, texOnWhite);
if (IsAsync()) {
ScheduleComposition(op);
}
break;
}
case CompositableOperation::TOpUpdateTexture: {
const OpUpdateTexture& op = aEdit.get_OpUpdateTexture();
RefPtr<TextureHost> texture = TextureHost::AsTextureHost(op.textureParent());

View File

@ -114,6 +114,16 @@ ImageBridgeChild::UseTexture(CompositableClient* aCompositable,
nullptr, aTexture->GetIPDLActor()));
}
void
ImageBridgeChild::UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aTextureOnBlack,
TextureClient* aTextureOnWhite)
{
mTxn->AddNoSwapEdit(OpUseComponentAlphaTextures(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTextureOnBlack->GetIPDLActor(),
nullptr, aTextureOnWhite->GetIPDLActor()));
}
void
ImageBridgeChild::UpdatedTexture(CompositableClient* aCompositable,
TextureClient* aTexture,

View File

@ -271,6 +271,9 @@ public:
*/
virtual void UseTexture(CompositableClient* aCompositable,
TextureClient* aClient) MOZ_OVERRIDE;
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) MOZ_OVERRIDE;
virtual void RemoveTexture(TextureClient* aTexture) MOZ_OVERRIDE;

View File

@ -312,6 +312,12 @@ struct OpUseTexture {
PTexture texture;
};
struct OpUseComponentAlphaTextures {
PCompositable compositable;
PTexture textureOnBlack;
PTexture textureOnWhite;
};
union MaybeRegion {
nsIntRegion;
null_t;
@ -338,6 +344,7 @@ union CompositableOperation {
OpUpdateTexture;
OpUseTexture;
OpUseComponentAlphaTextures;
};
// A unit of a changeset; a set of these comprise a changeset

View File

@ -435,6 +435,16 @@ ShadowLayerForwarder::UseTexture(CompositableClient* aCompositable,
nullptr, aTexture->GetIPDLActor()));
}
void
ShadowLayerForwarder::UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aTextureOnBlack,
TextureClient* aTextureOnWhite)
{
mTxn->AddEdit(OpUseComponentAlphaTextures(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTextureOnBlack->GetIPDLActor(),
nullptr, aTextureOnWhite->GetIPDLActor()));
}
void
ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
{

View File

@ -321,6 +321,9 @@ public:
*/
virtual void UseTexture(CompositableClient* aCompositable,
TextureClient* aClient) MOZ_OVERRIDE;
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) MOZ_OVERRIDE;
/**
* End the current transaction and forward it to LayerManagerComposite.

View File

@ -331,12 +331,22 @@ def _autoptrForget(expr):
def _cxxArrayType(basetype, const=0, ref=0):
return Type('InfallibleTArray', T=basetype, const=const, ref=ref)
def _cxxFallibleArrayType(basetype, const=0, ref=0):
return Type('FallibleTArray', T=basetype, const=const, ref=ref)
def _callCxxArrayLength(arr):
return ExprCall(ExprSelect(arr, '.', 'Length'))
def _callCxxArraySetLength(arr, lenexpr, sel='.'):
return ExprCall(ExprSelect(arr, sel, 'SetLength'),
args=[ lenexpr ])
def _callCxxCheckedArraySetLength(arr, lenexpr, sel='.'):
ifbad = StmtIf(ExprNot(ExprCall(ExprSelect(arr, sel, 'SetLength'),
args=[ lenexpr ])))
ifbad.addifstmt(_fatalError('Error setting the array length'))
ifbad.addifstmt(StmtReturn.FALSE)
return ifbad
def _callCxxSwapArrayElements(arr1, arr2, sel='.'):
return ExprCall(ExprSelect(arr1, sel, 'SwapElements'),
args=[ arr2 ])
def _callCxxArrayInsertSorted(arr, elt):
return ExprCall(ExprSelect(arr, '.', 'InsertElementSorted'),
@ -4459,26 +4469,26 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
])
read = MethodDefn(self.readMethodDecl(outtype, var))
avar = ExprVar('a')
favar = ExprVar('fa')
forread = StmtFor(init=ExprAssn(Decl(Type.UINT32, ivar.name),
ExprLiteral.ZERO),
cond=ExprBinary(ivar, '<', lenvar),
update=ExprPrefixUnop(ivar, '++'))
forread.addstmt(
self.checkedRead(eltipdltype, ExprAddrOf(ExprIndex(avar, ivar)),
self.checkedRead(eltipdltype, ExprAddrOf(ExprIndex(favar, ivar)),
msgvar, itervar, errfnRead,
eltipdltype.name() + '[i]'))
read.addstmts([
StmtDecl(Decl(_cxxRefType(arraytype, self.side), avar.name),
init=ExprDeref(var)),
StmtDecl(Decl(_cxxFallibleArrayType(_cxxBareType(arraytype.basetype, self.side)), favar.name)),
StmtDecl(Decl(Type.UINT32, lenvar.name)),
self.checkedRead(None, ExprAddrOf(lenvar),
msgvar, itervar, errfnRead,
'length\' (' + Type.UINT32.name + ') of \'' +
arraytype.name()),
Whitespace.NL,
StmtExpr(_callCxxArraySetLength(var, lenvar, '->')),
_callCxxCheckedArraySetLength(favar, lenvar),
forread,
StmtExpr(_callCxxSwapArrayElements(var, favar, '->')),
StmtReturn.TRUE
])

View File

@ -59,9 +59,10 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
, mBlockDelta(0)
, mReflowDepth(0)
{
NS_PRECONDITION(aPresContext, "no pres context");
NS_PRECONDITION(aRenderingContext, "no rendering context");
NS_PRECONDITION(aFrame, "no frame");
MOZ_ASSERT(aPresContext, "no pres context");
MOZ_ASSERT(aFrame, "no frame");
MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
parentReflowState = nullptr;
AvailableWidth() = aAvailableSpace.width;
AvailableHeight() = aAvailableSpace.height;
@ -159,8 +160,9 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
, mReflowDepth(aParentReflowState.mReflowDepth + 1)
, mFlags(aParentReflowState.mFlags)
{
NS_PRECONDITION(aPresContext, "no pres context");
NS_PRECONDITION(aFrame, "no frame");
MOZ_ASSERT(aPresContext, "no pres context");
MOZ_ASSERT(aFrame, "no frame");
MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
NS_PRECONDITION((aContainingBlockWidth == -1) ==
(aContainingBlockHeight == -1),
"cb width and height should only be non-default together");

View File

@ -282,9 +282,6 @@ pref("media.encoder.webm.enabled", true);
pref("media.encoder.omx.enabled", true);
#endif
// Whether to enable Web Audio support
pref("media.webaudio.enabled", true);
// Whether to autostart a media element with an |autoplay| attribute
pref("media.autoplay.enabled", true);
@ -1392,6 +1389,7 @@ pref("intl.charsetmenu.composer.cache", "");
pref("intl.charsetmenu.browser.cache.size", 5);
pref("intl.charset.detector", "chrome://global/locale/intl.properties");
pref("intl.charset.fallback.override", "");
pref("intl.charset.fallback.tld", true);
pref("intl.ellipsis", "chrome://global-platform/locale/intl.properties");
pref("intl.locale.matchOS", false);
// fallback charset list for Unicode conversion (converting from Unicode)

View File

@ -8,18 +8,19 @@
// note: the value order defines the priority; higher numbers take priority
#define kCharsetUninitialized 0
#define kCharsetFromFallback 1
#define kCharsetFromDocTypeDefault 2 // This and up confident for XHR
#define kCharsetFromCache 3
#define kCharsetFromParentFrame 4
#define kCharsetFromAutoDetection 5
#define kCharsetFromHintPrevDoc 6
#define kCharsetFromMetaPrescan 7 // this one and smaller: HTML5 Tentative
#define kCharsetFromMetaTag 8 // this one and greater: HTML5 Confident
#define kCharsetFromIrreversibleAutoDetection 9
#define kCharsetFromChannel 10
#define kCharsetFromOtherComponent 11
#define kCharsetFromParentForced 12 // propagates to child frames
#define kCharsetFromUserForced 13 // propagates to child frames
#define kCharsetFromByteOrderMark 14
#define kCharsetFromTopLevelDomain 2
#define kCharsetFromDocTypeDefault 3 // This and up confident for XHR
#define kCharsetFromCache 4
#define kCharsetFromParentFrame 5
#define kCharsetFromAutoDetection 6
#define kCharsetFromHintPrevDoc 7
#define kCharsetFromMetaPrescan 8 // this one and smaller: HTML5 Tentative
#define kCharsetFromMetaTag 9 // this one and greater: HTML5 Confident
#define kCharsetFromIrreversibleAutoDetection 10
#define kCharsetFromChannel 11
#define kCharsetFromOtherComponent 12
#define kCharsetFromParentForced 13 // propagates to child frames
#define kCharsetFromUserForced 14 // propagates to child frames
#define kCharsetFromByteOrderMark 15
#endif /* nsCharsetSource_h_ */

View File

@ -506,8 +506,6 @@ CreateCertErrorRunnable(CertVerifier& certVerifier,
return nullptr;
}
SECStatus srv;
PLArenaPool* log_arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
PLArenaPoolCleanerFalseParam log_arena_cleaner(log_arena);
if (!log_arena) {
@ -523,17 +521,17 @@ CreateCertErrorRunnable(CertVerifier& certVerifier,
CERTVerifyLogContentsCleaner verify_log_cleaner(verify_log);
verify_log->arena = log_arena;
// XXX TODO: convert to VerifySSLServerCert
// XXX TODO: get rid of error log
srv = certVerifier.VerifyCert(cert, stapledOCSPResponse,
certificateUsageSSLServer, now,
infoObject, 0, nullptr, nullptr, verify_log);
// We ignore the result code of the cert verification.
// We ignore the result code of the cert verification (i.e. VerifyCert's rv)
// Either it is a failure, which is expected, and we'll process the
// verify log below.
// Or it is a success, then a domain mismatch is the only
// possible failure.
// XXX TODO: convert to VerifySSLServerCert
// XXX TODO: get rid of error log
certVerifier.VerifyCert(cert, stapledOCSPResponse,
certificateUsageSSLServer, now,
infoObject, 0, nullptr, nullptr, verify_log);
PRErrorCode errorCodeMismatch = 0;
PRErrorCode errorCodeTrust = 0;

View File

@ -90,6 +90,8 @@ UNIFIED_SOURCES += [
'md4.c',
]
FAIL_ON_WARNINGS = True
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [

View File

@ -823,17 +823,16 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain)
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting chain for \"%s\"\n", mCert->nickname));
::insanity::pkix::ScopedCERTCertList nssChain;
SECStatus srv;
RefPtr<SharedCertVerifier> certVerifier(GetDefaultCertVerifier());
NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED);
// We want to test all usages, but we start with server because most of the
// time Firefox users care about server certs.
srv = certVerifier->VerifyCert(mCert.get(), nullptr,
certificateUsageSSLServer, PR_Now(),
nullptr, /*XXX fixme*/
CertVerifier::FLAG_LOCAL_ONLY,
&nssChain);
certVerifier->VerifyCert(mCert.get(), nullptr,
certificateUsageSSLServer, PR_Now(),
nullptr, /*XXX fixme*/
CertVerifier::FLAG_LOCAL_ONLY,
&nssChain);
// This is the whitelist of all non-SSLServer usages that are supported by
// verifycert.
const int otherUsagesToTest = certificateUsageSSLClient |
@ -851,11 +850,11 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain)
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
("pipnss: PKIX attempting chain(%d) for '%s'\n",
usage, mCert->nickname));
srv = certVerifier->VerifyCert(mCert.get(), nullptr,
usage, PR_Now(),
nullptr, /*XXX fixme*/
CertVerifier::FLAG_LOCAL_ONLY,
&nssChain);
certVerifier->VerifyCert(mCert.get(), nullptr,
usage, PR_Now(),
nullptr, /*XXX fixme*/
CertVerifier::FLAG_LOCAL_ONLY,
&nssChain);
}
if (!nssChain) {

View File

@ -132,7 +132,6 @@ nsUsageArrayHelper::check(uint32_t previousCheckResult,
PRErrorCode error = PR_GetError();
const char * errorString = PR_ErrorToName(error);
uint32_t result = nsIX509Cert::NOT_VERIFIED_UNKNOWN;
verifyFailed(&result, error);
@ -145,7 +144,7 @@ nsUsageArrayHelper::check(uint32_t previousCheckResult,
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
("error validating certificate for usage %s: %s (%d) -> %ud \n",
typestr.get(), errorString, (int) error, (int) result));
typestr.get(), PR_ErrorToName(error), (int) error, (int) result));
return result;
}

View File

@ -28,6 +28,8 @@ MOZBASE_PACKAGES = \
MOZBASE_EXTRAS = \
setup_development.py \
test.py \
test-manifest.ini \
$(NULL)
_DEST_DIR = $(DEPTH)/_tests/mozbase

View File

@ -130,9 +130,6 @@ user_pref("network.http.bypass-cachelock-threshold", 200000);
user_pref("dom.gamepad.enabled", true);
user_pref("dom.gamepad.non_standard_events.enabled", true);
// Enable Web Audio
user_pref("media.webaudio.enabled", true);
// Enable Web Audio legacy APIs
user_pref("media.webaudio.legacy.AudioBufferSourceNode", true);
user_pref("media.webaudio.legacy.AudioContext", true);

View File

@ -162,14 +162,27 @@ InlineSpellChecker.prototype = {
curlang = spellchecker.GetCurrentDictionary();
} catch(e) {}
var sortedList = [];
for (var i = 0; i < list.length; i ++) {
this.mDictionaryNames.push(list[i]);
sortedList.push({"id": list[i],
"label": this.getDictionaryDisplayName(list[i])});
}
sortedList.sort(function(a, b) {
if (a.label < b.label)
return -1;
if (a.label > b.label)
return 1;
return 0;
});
for (var i = 0; i < sortedList.length; i ++) {
this.mDictionaryNames.push(sortedList[i].id);
var item = menu.ownerDocument.createElement("menuitem");
item.setAttribute("id", "spell-check-dictionary-" + list[i]);
item.setAttribute("label", this.getDictionaryDisplayName(list[i]));
item.setAttribute("id", "spell-check-dictionary-" + sortedList[i].id);
item.setAttribute("label", sortedList[i].label);
item.setAttribute("type", "radio");
this.mDictionaryItems.push(item);
if (curlang == list[i]) {
if (curlang == sortedList[i].id) {
item.setAttribute("checked", "true");
} else {
var callback = function(me, val) { return function(evt) { me.selectDictionary(val); } };