merge mozilla-central to autoland. r=merge a=merge

This commit is contained in:
Sebastian Hengst 2017-10-23 23:52:54 +02:00
Родитель 35e575e16b 364d36fab2
Коммит af53b8aad8
55 изменённых файлов: 1199 добавлений и 427 удалений

Просмотреть файл

@ -263,9 +263,16 @@ case "$target" in
AC_MSG_ERROR([You must install the Android tools. Try |mach bootstrap|. (Looked for $android_tools)])
fi
MOZ_PATH_PROG(EMULATOR, emulator, :, [$android_tools])
dnl Android Tools 26 changes emulator path.
dnl Although android_sdk_root/tools still has emulator command,
dnl it doesn't work correctly
MOZ_PATH_PROG(EMULATOR, emulator, :, [$android_sdk_root/emulator])
if test -z "$EMULATOR" -o "$EMULATOR" = ":"; then
AC_MSG_ERROR([The program emulator was not found. Try |mach bootstrap|.])
dnl old emulator path until Android Tools 25.x
MOZ_PATH_PROG(EMULATOR, emulator, :, [$android_tools])
if test -z "$EMULATOR" -o "$EMULATOR" = ":"; then
AC_MSG_ERROR([The program emulator was not found. Try |mach bootstrap|.])
fi
fi
# `compileSdkVersion ANDROID_COMPILE_SDK_VERSION` is Gradle-only,

Просмотреть файл

@ -600,13 +600,8 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
JS::MutableHandle<JS::Value> aRetval,
bool aIsSync)
{
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) {
NS_LossyConvertUTF16toASCII messageNameCStr(aMessageName);
AUTO_PROFILER_LABEL_DYNAMIC("nsFrameMessageManager::SendMessage", EVENTS,
messageNameCStr.get());
}
#endif
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsFrameMessageManager::SendMessage", EVENTS, aMessageName);
NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!IsBroadcaster(), "Should not call SendSyncMessage in chrome");
@ -1541,14 +1536,8 @@ void
nsMessageManagerScriptExecutor::LoadScriptInternal(const nsAString& aURL,
bool aRunInGlobalScope)
{
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) {
NS_LossyConvertUTF16toASCII urlCStr(aURL);
AUTO_PROFILER_LABEL_DYNAMIC(
"nsMessageManagerScriptExecutor::LoadScriptInternal", OTHER,
urlCStr.get());
}
#endif
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsMessageManagerScriptExecutor::LoadScriptInternal", OTHER, aURL);
if (!mGlobal || !sCachedScripts) {
return;

Просмотреть файл

@ -1169,8 +1169,8 @@ nsJSContext::GarbageCollectNow(JS::gcreason::Reason aReason,
IsShrinking aShrinking,
int64_t aSliceMillis)
{
AUTO_PROFILER_LABEL_DYNAMIC("nsJSContext::GarbageCollectNow", GC,
JS::gcreason::ExplainReason(aReason));
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("nsJSContext::GarbageCollectNow", GC,
JS::gcreason::ExplainReason(aReason));
MOZ_ASSERT_IF(aSliceMillis, aIncremental == IncrementalGC);

Просмотреть файл

@ -1273,10 +1273,8 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
// do this extra work when we're not profiling.
nsAutoString typeStr;
(*aDOMEvent)->GetType(typeStr);
NS_LossyConvertUTF16toASCII typeCStr(typeStr);
AUTO_PROFILER_LABEL_DYNAMIC(
"EventListenerManager::HandleEventInternal", EVENTS,
typeCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"EventListenerManager::HandleEventInternal", EVENTS, typeStr);
TimeStamp startTime = TimeStamp::Now();
rv = HandleEventSubType(listener, *aDOMEvent, aCurrentTarget);

Просмотреть файл

@ -2508,9 +2508,8 @@ ContentChild::RecvAsyncMessage(const nsString& aMsg,
const IPC::Principal& aPrincipal,
const ClonedMessageData& aData)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
AUTO_PROFILER_LABEL_DYNAMIC("ContentChild::RecvAsyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"ContentChild::RecvAsyncMessage", EVENTS, aMsg);
CrossProcessCpowHolder cpows(this, aCpows);
RefPtr<nsFrameMessageManager> cpm =

Просмотреть файл

@ -2409,9 +2409,8 @@ TabChild::RecvAsyncMessage(const nsString& aMessage,
const IPC::Principal& aPrincipal,
const ClonedMessageData& aData)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMessage);
AUTO_PROFILER_LABEL_DYNAMIC("TabChild::RecvAsyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"TabChild::RecvAsyncMessage", EVENTS, aMessage);
CrossProcessCpowHolder cpows(Manager(), aCpows);
if (!mTabChildGlobal) {

Просмотреть файл

@ -1707,9 +1707,8 @@ TabParent::RecvSyncMessage(const nsString& aMessage,
const IPC::Principal& aPrincipal,
nsTArray<StructuredCloneData>* aRetVal)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMessage);
AUTO_PROFILER_LABEL_DYNAMIC("TabParent::RecvSyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"TabParent::RecvSyncMessage", EVENTS, aMessage);
StructuredCloneData data;
ipc::UnpackClonedMessageDataForParent(aData, data);
@ -1728,9 +1727,8 @@ TabParent::RecvRpcMessage(const nsString& aMessage,
const IPC::Principal& aPrincipal,
nsTArray<StructuredCloneData>* aRetVal)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMessage);
AUTO_PROFILER_LABEL_DYNAMIC("TabParent::RecvRpcMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"TabParent::RecvRpcMessage", EVENTS, aMessage);
StructuredCloneData data;
ipc::UnpackClonedMessageDataForParent(aData, data);
@ -1748,9 +1746,8 @@ TabParent::RecvAsyncMessage(const nsString& aMessage,
const IPC::Principal& aPrincipal,
const ClonedMessageData& aData)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMessage);
AUTO_PROFILER_LABEL_DYNAMIC("TabParent::RecvAsyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"TabParent::RecvAsyncMessage", EVENTS, aMessage);
StructuredCloneData data;
ipc::UnpackClonedMessageDataForParent(aData, data);

Просмотреть файл

@ -172,9 +172,8 @@ nsIContentChild::RecvAsyncMessage(const nsString& aMsg,
const IPC::Principal& aPrincipal,
const ClonedMessageData& aData)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentChild::RecvAsyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsIContentChild::RecvAsyncMessage", EVENTS, aMsg);
CrossProcessCpowHolder cpows(this, aCpows);
RefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::GetChildProcessManager();

Просмотреть файл

@ -247,9 +247,8 @@ nsIContentParent::RecvSyncMessage(const nsString& aMsg,
const IPC::Principal& aPrincipal,
nsTArray<ipc::StructuredCloneData>* aRetvals)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentParent::RecvSyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsIContentParent::RecvSyncMessage", EVENTS, aMsg);
CrossProcessCpowHolder cpows(this, aCpows);
RefPtr<nsFrameMessageManager> ppm = mMessageManager;
@ -270,9 +269,8 @@ nsIContentParent::RecvRpcMessage(const nsString& aMsg,
const IPC::Principal& aPrincipal,
nsTArray<ipc::StructuredCloneData>* aRetvals)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentParent::RecvRpcMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsIContentParent::RecvRpcMessage", EVENTS, aMsg);
CrossProcessCpowHolder cpows(this, aCpows);
RefPtr<nsFrameMessageManager> ppm = mMessageManager;
@ -331,9 +329,8 @@ nsIContentParent::RecvAsyncMessage(const nsString& aMsg,
const IPC::Principal& aPrincipal,
const ClonedMessageData& aData)
{
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentParent::RecvAsyncMessage", EVENTS,
messageNameCStr.get());
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsIContentParent::RecvAsyncMessage", EVENTS, aMsg);
CrossProcessCpowHolder cpows(this, aCpows);
RefPtr<nsFrameMessageManager> ppm = mMessageManager;

Просмотреть файл

@ -32,11 +32,16 @@ support-files =
webaudio.js
[test_analyserNode.html]
skip-if = !asan || toolkit != android
[test_analyserScale.html]
skip-if = !asan || toolkit != android
[test_analyserNodeOutput.html]
skip-if = !asan || toolkit != android
[test_analyserNodePassThrough.html]
[test_analyserNodeWithGain.html]
skip-if = !asan || toolkit != android
[test_analyserNodeMinimum.html]
skip-if = !asan || toolkit != android
[test_AudioBuffer.html]
[test_audioBufferSourceNode.html]
[test_audioBufferSourceNodeEnded.html]

Просмотреть файл

@ -319,8 +319,8 @@ DecodePool::SyncRunIfPreferred(IDecodingTask* aTask, const nsCString& aURI)
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aTask);
AUTO_PROFILER_LABEL_DYNAMIC("DecodePool::SyncRunIfPreferred", GRAPHICS,
aURI.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"DecodePool::SyncRunIfPreferred", GRAPHICS, aURI);
if (aTask->ShouldPreferSyncRun()) {
aTask->Run();
@ -337,8 +337,8 @@ DecodePool::SyncRunIfPossible(IDecodingTask* aTask, const nsCString& aURI)
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aTask);
AUTO_PROFILER_LABEL_DYNAMIC("DecodePool::SyncRunIfPossible", GRAPHICS,
aURI.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"DecodePool::SyncRunIfPossible", GRAPHICS, aURI);
aTask->Run();
}

Просмотреть файл

@ -369,8 +369,8 @@ mozJSComponentLoader::LoadModule(FileLocation& aFile)
return nullptr;
}
AUTO_PROFILER_LABEL_DYNAMIC("mozJSComponentLoader::LoadModule", OTHER,
spec.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"mozJSComponentLoader::LoadModule", OTHER, spec);
ModuleEntry* mod;
if (mModules.Get(spec, &mod))

Просмотреть файл

@ -641,10 +641,9 @@ mozJSSubScriptLoader::DoLoadSubScriptWithOptions(const nsAString& url,
return NS_OK;
}
const nsCString& asciiUrl = NS_LossyConvertUTF16toASCII(url);
AUTO_PROFILER_LABEL_DYNAMIC(
"mozJSSubScriptLoader::DoLoadSubScriptWithOptions", OTHER,
asciiUrl.get());
NS_LossyConvertUTF16toASCII asciiUrl(url);
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"mozJSSubScriptLoader::DoLoadSubScriptWithOptions", OTHER, asciiUrl);
// Make sure to explicitly create the URI, since we'll need the
// canonicalized spec.

Просмотреть файл

@ -2313,11 +2313,8 @@ nsXPCComponents_Utils::Import(const nsACString& registryLocation,
RefPtr<mozJSComponentLoader> moduleloader = mozJSComponentLoader::Get();
MOZ_ASSERT(moduleloader);
#ifdef MOZ_GECKO_PROFILER
const nsCString& flatLocation = PromiseFlatCString(registryLocation);
AUTO_PROFILER_LABEL_DYNAMIC("nsXPCComponents_Utils::Import", OTHER,
flatLocation.get());
#endif
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"nsXPCComponents_Utils::Import", OTHER, registryLocation);
return moduleloader->Import(registryLocation, targetObj, cx, optionalArgc, retval);
}

Просмотреть файл

@ -4095,8 +4095,8 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
"Layout",
"Display"
};
AUTO_PROFILER_LABEL_DYNAMIC("PresShell::DoFlushPendingNotifications",
GRAPHICS, flushTypeNames[flushType]);
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("PresShell::DoFlushPendingNotifications",
GRAPHICS, flushTypeNames[flushType]);
#endif
#ifdef ACCESSIBILITY
@ -6314,13 +6314,16 @@ PresShell::Paint(nsView* aViewToPaint,
const nsRegion& aDirtyRegion,
uint32_t aFlags)
{
#ifdef MOZ_GECKO_PROFILER
nsIURI* uri = mDocument->GetDocumentURI();
nsIDocument* contentRoot = GetPrimaryContentDocument();
if (contentRoot) {
uri = contentRoot->GetDocumentURI();
}
nsCString uriString = uri ? uri->GetSpecOrDefault() : NS_LITERAL_CSTRING("N/A");
AUTO_PROFILER_LABEL_DYNAMIC("PresShell::Paint", GRAPHICS, uriString.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"PresShell::Paint", GRAPHICS,
uri ? uri->GetSpecOrDefault() : NS_LITERAL_CSTRING("N/A"));
#endif
Maybe<js::AutoAssertNoContentJS> nojs;
@ -8889,9 +8892,12 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
// schedule a similar paint when a frame is deleted.
target->SchedulePaint(nsIFrame::PAINT_DEFAULT, false);
#ifdef MOZ_GECKO_PROFILER
nsIURI* uri = mDocument->GetDocumentURI();
nsCString uriString = uri ? uri->GetSpecOrDefault() : NS_LITERAL_CSTRING("N/A");
AUTO_PROFILER_LABEL_DYNAMIC("PresShell::DoReflow", GRAPHICS, uriString.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"PresShell::DoReflow", GRAPHICS,
uri ? uri->GetSpecOrDefault() : NS_LITERAL_CSTRING("N/A"));
#endif
nsDocShell* docShell = static_cast<nsDocShell*>(GetPresContext()->GetDocShell());
RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();

Просмотреть файл

@ -116,8 +116,8 @@ RestyleTracker::DoProcessRestyles()
docURL = uri->GetSpecOrDefault();
}
}
AUTO_PROFILER_LABEL_DYNAMIC("RestyleTracker::DoProcessRestyles", CSS,
docURL.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"RestyleTracker::DoProcessRestyles", CSS, docURL);
#endif
// Create a AnimationsWithDestroyedFrame during restyling process to

Просмотреть файл

@ -5988,8 +5988,8 @@ FrameLayerBuilder::PaintItems(nsTArray<ClippedDisplayItem>& aItems,
continue;
#ifdef MOZ_DUMP_PAINTING
AUTO_PROFILER_LABEL_DYNAMIC("FrameLayerBuilder::PaintItems", GRAPHICS,
cdi->mItem->Name());
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("FrameLayerBuilder::PaintItems", GRAPHICS,
cdi->mItem->Name());
#else
AUTO_PROFILER_LABEL("FrameLayerBuilder::PaintItems", GRAPHICS);
#endif

Просмотреть файл

@ -0,0 +1,8 @@
[package]
name = "netwerk_helper"
version = "0.0.1"
authors = ["Jeff Hemphill <jthemphill@mozilla.com>"]
[dependencies]
nserror = { path = "../../../xpcom/rust/nserror" }
nsstring = { path = "../../../xpcom/rust/nsstring" }

Просмотреть файл

@ -0,0 +1,14 @@
#ifndef RUST_NS_NET_HELPER
#define RUST_NS_NET_HELPER
#include "nsError.h"
#include "nsString.h"
extern "C" {
nsresult
rust_prepare_accept_languages(const nsACString* i_accept_languages,
nsACString* o_accept_languages);
}
#endif // RUST_NS_NET_HELPER

Просмотреть файл

@ -0,0 +1,143 @@
use std::ascii::AsciiExt;
extern crate nserror;
use self::nserror::*;
extern crate nsstring;
use self::nsstring::nsACString;
/// HTTP leading whitespace, defined in netwerk/protocol/http/nsHttp.h
static HTTP_LWS: &'static [u8] = &[' ' as u8, '\t' as u8];
/// Trim leading whitespace, trailing whitespace, and quality-value
/// from a token.
fn trim_token(token: &[u8]) -> &[u8] {
// Trim left whitespace
let ltrim = token.iter()
.take_while(|c| HTTP_LWS.iter().any(|ws| &ws == c))
.count();
// Trim right whitespace
// remove "; q=..." if present
let rtrim = token[ltrim..]
.iter()
.take_while(|c| **c != (';' as u8) && HTTP_LWS.iter().all(|ws| ws != *c))
.count();
&token[ltrim..ltrim + rtrim]
}
#[no_mangle]
#[allow(non_snake_case)]
/// Allocates an nsACString that contains a ISO 639 language list
/// notated with HTTP "q" values for output with an HTTP Accept-Language
/// header. Previous q values will be stripped because the order of
/// the langs implies the q value. The q values are calculated by dividing
/// 1.0 amongst the number of languages present.
///
/// Ex: passing: "en, ja"
/// returns: "en,ja;q=0.5"
///
/// passing: "en, ja, fr_CA"
/// returns: "en,ja;q=0.7,fr_CA;q=0.3"
pub extern "C" fn rust_prepare_accept_languages<'a, 'b>(i_accept_languages: &'a nsACString,
o_accept_languages: &'b mut nsACString)
-> nsresult {
if i_accept_languages.is_empty() {
return NS_OK;
}
let make_tokens = || {
i_accept_languages.split(|c| *c == (',' as u8))
.map(|token| trim_token(token))
.filter(|token| token.len() != 0)
};
let n = make_tokens().count();
for (count_n, i_token) in make_tokens().enumerate() {
// delimiter if not first item
if count_n != 0 {
o_accept_languages.append(",");
}
let token_pos = o_accept_languages.len();
o_accept_languages.append(&i_token as &[u8]);
{
let o_token = o_accept_languages.to_mut();
canonicalize_language_tag(&mut o_token[token_pos..]);
}
// Divide the quality-values evenly among the languages.
let q = 1.0 - count_n as f32 / n as f32;
let u: u32 = ((q + 0.005) * 100.0) as u32;
// Only display q-value if less than 1.00.
if u < 100 {
// With a small number of languages, one decimal place is
// enough to prevent duplicate q-values.
// Also, trailing zeroes do not add any information, so
// they can be removed.
if n < 10 || u % 10 == 0 {
let u = (u + 5) / 10;
o_accept_languages.append(&format!(";q=0.{}", u));
} else {
// Values below 10 require zero padding.
o_accept_languages.append(&format!(";q=0.{:02}", u));
}
}
}
NS_OK
}
/// Defines a consistent capitalization for a given language string.
///
/// # Arguments
/// * `token` - a narrow char slice describing a language.
///
/// Valid language tags are of the form
/// "*", "fr", "en-US", "es-419", "az-Arab", "x-pig-latin", "man-Nkoo-GN"
///
/// Language tags are defined in the
/// [rfc5646](https://tools.ietf.org/html/rfc5646) spec. According to
/// the spec:
///
/// > At all times, language tags and their subtags, including private
/// > use and extensions, are to be treated as case insensitive: there
/// > exist conventions for the capitalization of some of the subtags,
/// > but these MUST NOT be taken to carry meaning.
///
/// So why is this code even here? See bug 1108183, I guess.
fn canonicalize_language_tag(token: &mut [u8]) {
for c in token.iter_mut() {
*c = AsciiExt::to_ascii_lowercase(c);
}
let sub_tags = token.split_mut(|c| *c == ('-' as u8));
for (i, mut sub_tag) in sub_tags.enumerate() {
if i == 0 {
// ISO 639-1 language code, like the "en" in "en-US"
continue;
}
match sub_tag.len() {
// Singleton tag, like "x" or "i". These signify a
// non-standard language, so we stop capitalizing after
// these.
1 => break,
// ISO 3166-1 Country code, like "US"
2 => {
sub_tag[0] = AsciiExt::to_ascii_uppercase(&sub_tag[0]);
sub_tag[1] = AsciiExt::to_ascii_uppercase(&sub_tag[1]);
},
// ISO 15924 script code, like "Nkoo"
4 => {
sub_tag[0] = AsciiExt::to_ascii_uppercase(&sub_tag[0]);
},
_ => {},
};
}
}

Просмотреть файл

@ -9,6 +9,7 @@
#include "prsystem.h"
#include "nsError.h"
#include "nsHttp.h"
#include "nsHttpHandler.h"
#include "nsHttpChannel.h"
@ -58,6 +59,7 @@
#include "nsIXULRuntime.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsRFPService.h"
#include "rust-helper/src/helper.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/net/NeckoParent.h"
@ -1908,51 +1910,6 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
#undef MULTI_PREF_CHANGED
}
/**
* Currently, only regularizes the case of subtags.
*/
static void
CanonicalizeLanguageTag(char *languageTag)
{
char *s = languageTag;
while (*s != '\0') {
*s = nsCRT::ToLower(*s);
s++;
}
s = languageTag;
bool isFirst = true;
bool seenSingleton = false;
while (*s != '\0') {
char *subTagEnd = strchr(s, '-');
if (subTagEnd == nullptr) {
subTagEnd = strchr(s, '\0');
}
if (isFirst) {
isFirst = false;
} else if (seenSingleton) {
// Do nothing
} else {
size_t subTagLength = subTagEnd - s;
if (subTagLength == 1) {
seenSingleton = true;
} else if (subTagLength == 2) {
*s = nsCRT::ToUpper(*s);
*(s + 1) = nsCRT::ToUpper(*(s + 1));
} else if (subTagLength == 4) {
*s = nsCRT::ToUpper(*s);
}
}
s = subTagEnd;
if (*s != '\0') {
s++;
}
}
}
/**
* Allocates a C string into that contains a ISO 639 language list
* notated with HTTP "q" values for output with a HTTP Accept-Language
@ -1972,78 +1929,9 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
if (!i_AcceptLanguages)
return NS_OK;
uint32_t n, count_n, size, wrote;
double q, dec;
char *p, *p2, *token, *q_Accept, *o_Accept;
const char *comma;
int32_t available;
o_Accept = strdup(i_AcceptLanguages);
if (!o_Accept)
return NS_ERROR_OUT_OF_MEMORY;
for (p = o_Accept, n = size = 0; '\0' != *p; p++) {
if (*p == ',') n++;
size++;
}
available = size + ++n * 11 + 1;
q_Accept = new char[available];
if (!q_Accept) {
free(o_Accept);
return NS_ERROR_OUT_OF_MEMORY;
}
*q_Accept = '\0';
q = 1.0;
dec = q / (double) n;
count_n = 0;
p2 = q_Accept;
for (token = nsCRT::strtok(o_Accept, ",", &p);
token != nullptr;
token = nsCRT::strtok(p, ",", &p))
{
token = net_FindCharNotInSet(token, HTTP_LWS);
char* trim;
trim = net_FindCharInSet(token, ";" HTTP_LWS);
if (trim != nullptr) // remove "; q=..." if present
*trim = '\0';
if (*token != '\0') {
CanonicalizeLanguageTag(token);
comma = count_n++ != 0 ? "," : ""; // delimiter if not first item
uint32_t u = QVAL_TO_UINT(q);
// Only display q-value if less than 1.00.
if (u < 100) {
const char *qval_str;
// With a small number of languages, one decimal place is enough to prevent duplicate q-values.
// Also, trailing zeroes do not add any information, so they can be removed.
if ((n < 10) || ((u % 10) == 0)) {
u = (u + 5) / 10;
qval_str = "%s%s;q=0.%u";
} else {
// Values below 10 require zero padding.
qval_str = "%s%s;q=0.%02u";
}
wrote = snprintf(p2, available, qval_str, comma, token, u);
} else {
wrote = snprintf(p2, available, "%s%s", comma, token);
}
q -= dec;
p2 += wrote;
available -= wrote;
MOZ_ASSERT(available > 0, "allocated string not long enough");
}
}
free(o_Accept);
o_AcceptLanguages.Assign((const char *) q_Accept);
delete [] q_Accept;
return NS_OK;
const nsAutoCString ns_accept_languages(i_AcceptLanguages);
return rust_prepare_accept_languages(&ns_accept_languages,
&o_AcceptLanguages);
}
nsresult

Просмотреть файл

@ -22,6 +22,8 @@ function run_test() {
["de,en-us,en", "de,en-US;q=0.7,en;q=0.3"],
["en-US, en", "en-US,en;q=0.5"],
["EN-US;q=0.2, EN", "en-US,en;q=0.5"],
["en ;q=0.8, de ", "en,de;q=0.5"],
[",en,", "en"],
];
for (let i = 0; i < testData.length; i++) {

Просмотреть файл

@ -291,9 +291,8 @@ public final class AttributeName
* whether to check ncnameness
* @return an <code>AttributeName</code> corresponding to the argument data
*/
@Inline static AttributeName nameByBuffer(@NoLength char[] buf, int offset,
int length
, Interner interner) {
@Inline static AttributeName nameByBuffer(@NoLength char[] buf,
int length, Interner interner) {
// XXX deal with offset
@Unsigned int hash = AttributeName.bufToHash(buf, length);
int[] hashes;
@ -304,7 +303,7 @@ public final class AttributeName
}
AttributeName attributeName = AttributeName.ATTRIBUTE_NAMES[index];
@Local String name = attributeName.getLocal(0);
if (!Portability.localEqualsBuffer(name, buf, offset, length)) {
if (!Portability.localEqualsBuffer(name, buf, length)) {
return null;
}
return attributeName;

Просмотреть файл

@ -158,7 +158,7 @@ public final class ElementName
}
@Inline static ElementName elementNameByBuffer(@NoLength char[] buf,
int offset, int length, Interner interner) {
int length, Interner interner) {
@Unsigned int hash = ElementName.bufToHash(buf, length);
int[] hashes;
hashes = ElementName.ELEMENT_HASHES;
@ -168,7 +168,7 @@ public final class ElementName
} else {
ElementName elementName = ElementName.ELEMENT_NAMES[index];
@Local String name = elementName.name;
if (!Portability.localEqualsBuffer(name, buf, offset, length)) {
if (!Portability.localEqualsBuffer(name, buf, length)) {
return null;
}
return elementName;

Просмотреть файл

@ -35,8 +35,8 @@ public final class Portability {
* Allocates a new local name object. In C++, the refcount must be set up in such a way that
* calling <code>releaseLocal</code> on the return value balances the refcount set by this method.
*/
public static @Local String newLocalNameFromBuffer(@NoLength char[] buf, int offset, int length, Interner interner) {
return new String(buf, offset, length).intern();
public static @Local String newLocalNameFromBuffer(@NoLength char[] buf, int length, Interner interner) {
return new String(buf, 0, length).intern();
}
public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length
@ -78,12 +78,12 @@ public final class Portability {
// Comparison methods
public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int offset, int length) {
public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int length) {
if (local.length() != length) {
return false;
}
for (int i = 0; i < length; i++) {
if (local.charAt(i) != buf[offset + i]) {
if (local.charAt(i) != buf[i]) {
return false;
}
}

Просмотреть файл

@ -712,7 +712,7 @@ public class Tokenizer implements Locator {
return;
}
@Auto char[] asArray = Portability.newCharArrayFromLocal(endTagExpectation);
this.endTagExpectation = ElementName.elementNameByBuffer(asArray, 0,
this.endTagExpectation = ElementName.elementNameByBuffer(asArray,
asArray.length, interner);
assert this.endTagExpectation != null;
endTagExpectationToArray();
@ -910,8 +910,7 @@ public class Tokenizer implements Locator {
* @return the buffer as local name
*/
private void strBufToDoctypeName() {
doctypeName = Portability.newLocalNameFromBuffer(strBuf, 0, strBufLen,
interner);
doctypeName = Portability.newLocalNameFromBuffer(strBuf, strBufLen, interner);
clearStrBufAfterUse();
}
@ -1116,20 +1115,19 @@ public class Tokenizer implements Locator {
if (containsHyphen) {
// We've got a custom element or annotation-xml.
@Local String annotationName = ElementName.ANNOTATION_XML.getName();
if (Portability.localEqualsBuffer(annotationName, strBuf, 0, strBufLen)) {
if (Portability.localEqualsBuffer(annotationName, strBuf, strBufLen)) {
tagName = ElementName.ANNOTATION_XML;
} else {
nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, 0, strBufLen,
nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, strBufLen,
interner)
// CPPONLY: , true
);
tagName = nonInternedTagName;
}
} else {
tagName = ElementName.elementNameByBuffer(strBuf, 0, strBufLen,
interner);
tagName = ElementName.elementNameByBuffer(strBuf, strBufLen, interner);
if (tagName == null) {
nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, 0, strBufLen,
nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, strBufLen,
interner)
// CPPONLY: , false
);
@ -1183,11 +1181,11 @@ public class Tokenizer implements Locator {
}
private void attributeNameComplete() throws SAXException {
attributeName = AttributeName.nameByBuffer(strBuf, 0, strBufLen, interner);
attributeName = AttributeName.nameByBuffer(strBuf, strBufLen, interner);
if (attributeName == null) {
// [NOCPP[
attributeName = AttributeName.createAttributeName(
Portability.newLocalNameFromBuffer(strBuf, 0, strBufLen,
Portability.newLocalNameFromBuffer(strBuf, strBufLen,
interner),
namePolicy != XmlViolationPolicy.ALLOW);
// ]NOCPP]

Просмотреть файл

@ -93,7 +93,6 @@ class nsHtml5AttributeName
}
inline static nsHtml5AttributeName* nameByBuffer(char16_t* buf,
int32_t offset,
int32_t length,
nsHtml5AtomTable* interner)
{
@ -107,7 +106,7 @@ class nsHtml5AttributeName
nsHtml5AttributeName* attributeName =
nsHtml5AttributeName::ATTRIBUTE_NAMES[index];
nsAtom* name = attributeName->getLocal(0);
if (!nsHtml5Portability::localEqualsBuffer(name, buf, offset, length)) {
if (!nsHtml5Portability::localEqualsBuffer(name, buf, length)) {
return nullptr;
}
return attributeName;

Просмотреть файл

@ -127,7 +127,6 @@ public:
inline static nsHtml5ElementName* elementNameByBuffer(
char16_t* buf,
int32_t offset,
int32_t length,
nsHtml5AtomTable* interner)
{
@ -141,7 +140,7 @@ public:
nsHtml5ElementName* elementName =
nsHtml5ElementName::ELEMENT_NAMES[index];
nsAtom* name = elementName->name;
if (!nsHtml5Portability::localEqualsBuffer(name, buf, offset, length)) {
if (!nsHtml5Portability::localEqualsBuffer(name, buf, length)) {
return nullptr;
}
return elementName;

Просмотреть файл

@ -9,9 +9,8 @@
#include "nsHtml5TreeBuilder.h"
nsAtom*
nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf, int32_t length, nsHtml5AtomTable* interner)
{
NS_ASSERTION(!offset, "The offset should always be zero here.");
NS_ASSERTION(interner, "Didn't get an atom service.");
return interner->GetAtom(nsDependentSubstring(buf, buf + length));
}
@ -97,9 +96,9 @@ nsHtml5Portability::newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner)
}
bool
nsHtml5Portability::localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t offset, int32_t length)
nsHtml5Portability::localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length)
{
return local->Equals(buf + offset, length);
return local->Equals(buf, length);
}
bool

Просмотреть файл

@ -57,7 +57,7 @@ class nsHtml5StateSnapshot;
class nsHtml5Portability
{
public:
static nsAtom* newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner);
static nsAtom* newLocalNameFromBuffer(char16_t* buf, int32_t length, nsHtml5AtomTable* interner);
static nsHtml5String newStringFromBuffer(char16_t* buf,
int32_t offset,
int32_t length,
@ -70,7 +70,7 @@ class nsHtml5Portability
static jArray<char16_t, int32_t> newCharArrayFromString(
nsHtml5String string);
static nsAtom* newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner);
static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t offset, int32_t length);
static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length);
static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);

Просмотреть файл

@ -138,7 +138,7 @@ nsHtml5Tokenizer::setStateAndEndTagExpectation(int32_t specialTokenizerState, ns
return;
}
autoJArray<char16_t,int32_t> asArray = nsHtml5Portability::newCharArrayFromLocal(endTagExpectation);
this->endTagExpectation = nsHtml5ElementName::elementNameByBuffer(asArray, 0, asArray.length, interner);
this->endTagExpectation = nsHtml5ElementName::elementNameByBuffer(asArray, asArray.length, interner);
MOZ_ASSERT(!!this->endTagExpectation);
endTagExpectationToArray();
}
@ -245,7 +245,7 @@ nsHtml5Tokenizer::strBufToString()
void
nsHtml5Tokenizer::strBufToDoctypeName()
{
doctypeName = nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner);
doctypeName = nsHtml5Portability::newLocalNameFromBuffer(strBuf, strBufLen, interner);
clearStrBufAfterUse();
}
@ -295,23 +295,21 @@ nsHtml5Tokenizer::strBufToElementNameString()
if (containsHyphen) {
nsAtom* annotationName = nsHtml5ElementName::ELT_ANNOTATION_XML->getName();
if (nsHtml5Portability::localEqualsBuffer(
annotationName, strBuf, 0, strBufLen)) {
annotationName, strBuf, strBufLen)) {
tagName = nsHtml5ElementName::ELT_ANNOTATION_XML;
} else {
nonInternedTagName->setNameForNonInterned(
nsHtml5Portability::newLocalNameFromBuffer(
strBuf, 0, strBufLen, interner),
true);
strBuf, strBufLen, interner), true);
tagName = nonInternedTagName;
}
} else {
tagName =
nsHtml5ElementName::elementNameByBuffer(strBuf, 0, strBufLen, interner);
nsHtml5ElementName::elementNameByBuffer(strBuf, strBufLen, interner);
if (!tagName) {
nonInternedTagName->setNameForNonInterned(
nsHtml5Portability::newLocalNameFromBuffer(
strBuf, 0, strBufLen, interner),
false);
strBuf, strBufLen, interner), false);
tagName = nonInternedTagName;
}
}
@ -356,11 +354,10 @@ nsHtml5Tokenizer::emitCurrentTagToken(bool selfClosing, int32_t pos)
void
nsHtml5Tokenizer::attributeNameComplete()
{
attributeName = nsHtml5AttributeName::nameByBuffer(strBuf, 0, strBufLen, interner);
attributeName = nsHtml5AttributeName::nameByBuffer(strBuf, strBufLen, interner);
if (!attributeName) {
nonInternedAttributeName->setNameForNonInterned(
nsHtml5Portability::newLocalNameFromBuffer(
strBuf, 0, strBufLen, interner));
nsHtml5Portability::newLocalNameFromBuffer(strBuf, strBufLen, interner));
attributeName = nonInternedAttributeName;
}
clearStrBufAfterUse();

Просмотреть файл

@ -1158,4 +1158,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
static const int32_t kUnknownId = -1;
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1517163607010000);
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1517249900834000);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -8,7 +8,7 @@
/*****************************************************************************/
#include <stdint.h>
const PRTime gPreloadListExpirationTime = INT64_C(1519582794511000);
const PRTime gPreloadListExpirationTime = INT64_C(1519669088079000);
%%
0.me.uk, 1
00001.am, 1
@ -179,7 +179,6 @@ const PRTime gPreloadListExpirationTime = INT64_C(1519582794511000);
1whw.co.uk, 1
1wirelog.de, 1
1wl.uk, 1
2-cpu.de, 1
2.wtf, 1
2048-spiel.de, 1
2048game.co.uk, 1
@ -259,7 +258,6 @@ const PRTime gPreloadListExpirationTime = INT64_C(1519582794511000);
38888msc.com, 1
393335.ml, 1
398.info, 1
3ags.de, 1
3bakayottu.com, 1
3bigking.com, 1
3c-d.de, 1
@ -411,7 +409,6 @@ const PRTime gPreloadListExpirationTime = INT64_C(1519582794511000);
888sport.it, 1
88laohu.cc, 1
88laohu.com, 1
899699.com, 0
8ack.de, 1
8ackprotect.com, 1
8azino777.ru, 1
@ -885,7 +882,6 @@ agrarking.de, 1
agrarshop4u.de, 1
agrekov.ru, 1
agreor.com, 1
agrias.com.br, 1
agridir.site, 1
agrios.de, 1
agroglass.com.br, 1
@ -1552,6 +1548,7 @@ answers-online.ru, 1
antama.nl, 1
antarcti.co, 1
antcas.com, 1
antenasmundosat.com.br, 1
anthedesign.fr, 1
anthony-rouanet.com, 1
anthonyaires.com, 1
@ -2182,7 +2179,6 @@ autimatisering.nl, 1
auto-anleitung.de, 1
autoauctionsohio.com, 1
autoauctionsvirginia.com, 1
autobedarf.net, 1
autoclean-plus.ch, 1
autocmall.com, 1
autocorner.com, 1
@ -3204,6 +3200,7 @@ bizeau.ch, 1
bizedge.co.nz, 1
bizniskatalog.mk, 1
biznpro.ru, 1
bizpare.com, 1
biztera.com, 1
biztok.eu, 1
bizzartech.com, 1
@ -4699,6 +4696,7 @@ chennien.com, 1
chentianyi.cn, 1
chenzhekl.me, 1
cherevoiture.com, 1
cherrett.digital, 1
cherryonit.com, 1
cherrywoodtech.com, 1
chesspoint.ch, 1
@ -5043,6 +5041,7 @@ cliniko.com, 1
clintonlibrary.gov, 1
clintonplasticsurgery.com, 1
clip.mx, 0
clip.ovh, 1
clipclip.com, 1
clmde.de, 1
clnet.com.au, 1
@ -5428,9 +5427,9 @@ comunidadmontepinar.es, 1
comw.cc, 1
comyuno.com, 1
conaudisa.com, 0
concentrade.de, 1
concept-web.ch, 1
conceptatelier.de, 1
conception.sk, 1
concertengine.com, 1
concerto.amsterdam, 1
conciliumnotaire.ca, 1
@ -5732,7 +5731,6 @@ creations-edita.com, 1
creative-coder.de, 1
creative-wave.fr, 1
creativeapple.ltd, 1
creativeartifice.com, 1
creativebites.de, 1
creativecaptiv.es, 1
creativecommons.cl, 1
@ -6656,6 +6654,7 @@ derrickemery.com, 1
dersix.com, 1
dersoundhunter.de, 1
derstulle.de, 1
des-hommes-et-des-clous.com, 1
desagaz.com, 1
desarrollowp.com, 1
descartes-finance.com, 1
@ -6811,6 +6810,7 @@ diamondpkg.org, 1
diamorphine.com, 1
diamsmedia.ch, 1
dianefriedli.ch, 1
dianurse.com, 1
diare-na-miru.cz, 1
diario-egipto.com, 1
diasdasemana.com, 1
@ -7414,7 +7414,6 @@ drjacquesmalan.com, 1
drjoe.ca, 1
drjuanitacollier.com, 1
drkhsh.at, 1
drkmtrx.xyz, 1
drlangsdon.com, 1
drlazarina.net, 1
drms.us, 1
@ -7550,7 +7549,7 @@ dutchrank.nl, 1
dutchwanderers.nl, 1
dutchweballiance.nl, 1
dutyfreeonboard.com, 1
duyao.de, 1
duyao.de, 0
dvbris.co.uk, 1
dvbris.com, 1
dvdland.com.au, 1
@ -7650,7 +7649,7 @@ eam-gmbh.com, 1
eames-clayton.us, 1
eapestudioweb.com, 1
earl.org.uk, 1
earlyyearshub.com, 0
earlyyearshub.com, 1
earmarks.gov, 1
earth-people.org, 1
earticleblog.com, 1
@ -8132,7 +8131,6 @@ emultiagent.pl, 1
emupedia.net, 1
emw3.com, 1
emyr.net, 1
en-booster.jp, 1
en-crypt.me, 1
en-maktoob.search.yahoo.com, 0
en4rab.co.uk, 1
@ -8824,7 +8822,6 @@ fads-center.online, 1
faehler.de, 1
faeriecakes.be, 1
fafatiger.com, 1
fahmed.de, 1
fahrenwal.de, 1
fahrenwalde.de, 1
fail.coach, 1
@ -8908,6 +8905,7 @@ faretravel.co.uk, 1
farfallapets.com.br, 1
farfetchos.com, 1
fargtorget.se, 1
farhadexchange.com, 1
farhood.org, 1
farid.is, 1
farkas.bz, 1
@ -9297,7 +9295,6 @@ flagfic.com, 1
flagshop.jp, 1
flagspot.net, 1
flair.co, 1
flajshans.cz, 1
flam.io, 1
flamer-scene.com, 0
flamingcow.tv, 1
@ -9501,7 +9498,6 @@ foreclosureattorneyhouston.com, 1
foregroundweb.com, 1
forellenpark.com, 1
forento.be, 1
forestfinance.fr, 1
forestraven.net, 1
foreverssl.com, 1
forex.ee, 1
@ -10294,7 +10290,6 @@ get-asterisk.ru, 1
get-erp.ru, 1
get-link.info, 1
get-on.bid, 1
get-refer.com, 1
get4x.com, 1
geta.pub, 1
getbox.me, 1
@ -10319,7 +10314,6 @@ getgeek.io, 1
getgeek.no, 1
getgeek.nu, 1
getgeek.pl, 1
getgeek.se, 1
gethow.org, 1
gethttpsforfree.com, 1
geti2p.com, 1
@ -10381,8 +10375,6 @@ ghcif.de, 1
ghi.gov, 1
ghislainphu.fr, 1
ghostblog.info, 1
ghrelinblocker.info, 1
ghrelinblocker.org, 1
giacomodrago.com, 1
giacomodrago.it, 1
giacomopelagatti.it, 1
@ -10418,7 +10410,6 @@ gilmoreid.com.au, 1
gilnet.be, 1
gilroywestwood.org, 1
gina-architektur.design, 1
gincher.net, 1
ginionusedcars.be, 1
ginja.co.th, 1
ginkel.com, 1
@ -10651,7 +10642,6 @@ gosuland.org, 1
gotech.com.eg, 0
gothamlimo.com, 1
gothic.dating, 1
gotirupati.com, 1
goto.google.com, 1
goto.world, 1
gotomi.info, 1
@ -10933,7 +10923,6 @@ guides-peche64.com, 1
guidetoiceland.is, 0
guildgearscore.cf, 0
guildofmusicsupervisors.co.uk, 1
guillaume-leduc.fr, 1
guillaumecote.me, 1
guillaumeperrin.io, 1
guillemaud.me, 1
@ -10944,7 +10933,6 @@ guineapigmustach.es, 1
gulenbase.no, 1
gulfstream.ru, 1
gulleyperformancecenter.com, 1
gummibande.noip.me, 1
gunhunter.com, 1
guniram.com, 1
gunwatch.co.uk, 1
@ -11219,7 +11207,6 @@ hashnode.com, 1
hashplex.com, 1
hashru.nl, 1
hashworks.net, 1
hasinase.de, 1
haskovec.com, 1
hasselbach-dellwig.de, 1
hatarisecurity.co.ke, 1
@ -11810,7 +11797,6 @@ hostma.ma, 1
hostme.co.il, 1
hostmijnpagina.nl, 1
hostmodern.com.au, 1
hosts.cf, 1
hostserv.org, 1
hostworkz.com, 1
hosyaku.gr.jp, 1
@ -12243,6 +12229,7 @@ igorw.org, 1
igotoffer.com, 0
igrivi.com, 1
igsmgmt.com, 1
iguana.com.ec, 0
ih8sn0w.com, 1
ihacklabs.com, 1
ihatethissh.it, 1
@ -12257,7 +12244,6 @@ iideaz.org, 1
iilin.com, 1
iiong.com, 1
iirii.com, 1
ijoda.com, 1
ijohan.nl, 1
ijsclubtilburg.nl, 1
ikachalife.com, 1
@ -12567,7 +12553,6 @@ inovatec.com, 1
inoxio.de, 1
ins1gn1a.com, 1
insane.zone, 1
insblauehinein.nl, 1
inschrijfformulier.com, 1
inscript.pl, 1
insertcoins.net, 1
@ -12962,6 +12947,7 @@ itfaq.nl, 1
itfh.eu, 1
itfix.cz, 1
itforge.nl, 1
ithenrik.com, 1
itilo.de, 1
itiomassagem.com.br, 1
itis.gov, 1
@ -13531,7 +13517,6 @@ jonathandowning.uk, 0
jonathanmassacand.ch, 1
jonathansanchez.pro, 1
jonathanwisdom.com, 1
jondarby.com, 1
jondevin.com, 1
jonesborostatebank.com, 0
jonferwerda.net, 1
@ -13661,7 +13646,6 @@ juergenspecht.de, 1
jugendsuenden.info, 1
juhakoho.com, 1
juice.codes, 1
juka.pp.ua, 1
juku-info.top, 1
julegoerke.de, 1
julian-weigle.de, 1
@ -14230,7 +14214,6 @@ kissgyms.com, 1
kisskiss.ch, 1
kisstube.tv, 1
kisun.co.jp, 0
kita.id, 1
kitbag.com.au, 1
kitchen-profi.by, 1
kitchen-profi.com.ua, 1
@ -14698,6 +14681,7 @@ la-cave-a-nodo.fr, 1
la-ganiere.com, 1
la-maison.ch, 1
la-maison.eu, 1
la-petite-entreprise.com, 1
la-serendipite.fr, 1
la-tourmaline.ch, 1
laatikko.io, 1
@ -15393,7 +15377,6 @@ linx.net, 1
linzgau.de, 1
lionlyrics.com, 1
lipex.com, 1
lipo.lol, 1
lipoabaltimore.org, 1
liqd.net, 1
liquid.cz, 1
@ -16110,6 +16093,8 @@ management-companie.ro, 1
management-ethics.com, 1
managementboek.nl, 1
managementfeedback.com, 1
manageprojects.com, 0
manager-efficacement.com, 1
manager.linode.com, 0
managewp.org, 1
manatees.net, 1
@ -16551,6 +16536,7 @@ mdcloudps.com, 1
mdek.at, 1
mdewendt.de, 1
mdf-bis.com, 1
mdkr.nl, 1
mdma.net, 1
mdmed.clinic, 1
mdosch.de, 1
@ -17372,6 +17358,8 @@ moondrop.org, 1
moonmelo.com, 1
moonraptor.co.uk, 1
moonraptor.com, 1
moonrhythm.info, 1
moonrhythm.io, 1
moonshyne.org, 1
moonvpn.org, 1
moorparkelectrical.com, 1
@ -17901,7 +17889,6 @@ mytripcar.es, 1
mytripcar.fr, 1
mytruecare.org, 1
mytty.net, 1
mytweeps.com, 1
myulog.net, 1
myupdatestar.com, 1
myupdatestudio.com, 1
@ -17918,6 +17905,7 @@ myworth.com.au, 1
myzina.cz, 0
mz-mz.net, 1
mziulu.me, 0
mzlog.win, 1
mzorn.photography, 1
n-m.lu, 1
n-pix.com, 0
@ -18534,7 +18522,6 @@ nikklassen.ca, 1
nikksno.io, 1
niklas.pw, 1
niklasbabel.com, 1
nikobradshaw.com, 1
nikolaichik.photo, 1
nikolasbradshaw.com, 1
nikolasgrottendieck.com, 1
@ -18856,6 +18843,7 @@ nutri-spec.me, 1
nutrienti.eu, 0
nutripedia.gr, 1
nutrivisa.com.br, 1
nuttyveg.com, 1
nuvechtdal.nl, 1
nuvini.com, 1
nuxer.fr, 1
@ -19861,7 +19849,6 @@ pdfconvert.me, 1
pdfmint.com, 1
pdfresizer.com, 1
pdthings.net, 1
pe-bank.co.jp, 1
pe-kyousai.jp, 1
pe.search.yahoo.com, 0
peaksloth.com, 1
@ -20785,6 +20772,7 @@ printexpress.cloud, 1
printf.de, 1
printmet.com, 1
prior-it.be, 1
priorite-education.com, 1
priorityelectric.net, 1
prioritynissannewportnewsparts.com, 1
prism-communication.com, 1
@ -20978,6 +20966,7 @@ prvikvadrat.hr, 1
pryspry.com, 1
prytkov.com, 1
przemas.pl, 1
ps-provider.co.jp, 1
ps-qa.com, 1
ps-w.ru, 1
ps-x.ru, 1
@ -21564,7 +21553,6 @@ recyclingpromotions.us, 1
red-t-shirt.ru, 1
redable.hosting, 1
redable.nl, 1
redair.es, 1
redb.cz, 1
redballoonsecurity.com, 1
redburn.com, 1
@ -22618,6 +22606,7 @@ sapience.com, 1
saposute-s.jp, 1
sapporobeer.com, 1
sapprendre.ch, 1
sapuncheta.com, 1
sarahbeckettharpist.com, 1
sarahlicity.co.uk, 0
sarahlicity.me.uk, 1
@ -23134,6 +23123,7 @@ senarius.de, 1
sendai-sisters.com, 1
sendinvoice.nl, 1
sendonce.io, 1
sendthisfile.com, 1
sendway.com, 1
sendya.me, 1
sengokulife.com, 1
@ -23474,7 +23464,6 @@ shopsouthafrican.com, 1
shoptec.sk, 1
shorebreaksecurity.com, 1
shortdiary.me, 1
shorten.ninja, 1
shortpath.com, 1
shortr.li, 1
shoshin-aikido.de, 1
@ -24360,7 +24349,6 @@ spiritual.dating, 1
spiritualife.net, 1
spiritualregression.com.au, 1
spisbilligt.dk, 1
spitefultowel.com, 1
spitfireuav.com, 1
splendidspoon.com, 1
splikity.com, 1
@ -24950,7 +24938,6 @@ sundaycooks.com, 1
sundayfundayjapan.com, 1
suneilpatel.com, 1
sunfireshop.com.br, 1
sunflyer.cn, 0
sunfox.cz, 1
sunfulong.me, 1
sungo.wtf, 1
@ -25177,7 +25164,6 @@ systemreboot.net, 1
systoolbox.net, 1
sysystems.cz, 1
syt3.net, 1
syy.hk, 1
syy.im, 1
syzygy-tables.info, 1
szagun.net, 1
@ -26180,6 +26166,7 @@ tkn.tokyo, 1
tkts.cl, 1
tkusano.jp, 1
tkw01536.de, 1
tlach.cz, 1
tlca.org, 1
tlcnet.info, 1
tlehseasyads.com, 1
@ -26460,6 +26447,7 @@ touchscreentills.com, 1
tougetu.com, 1
touha.me, 0
touhou.cc, 1
toujours-actif.com, 1
tounyou-raku.com, 1
touray-enterprise.ch, 1
tourismwithme.com, 1
@ -26911,6 +26899,7 @@ txdivorce.org, 1
txi.su, 1
txm.pl, 1
tyche.io, 1
tyil.nl, 1
tyil.work, 1
tykoon.com, 1
tyl.io, 1
@ -26946,6 +26935,7 @@ tyuo-keibi.co.jp, 1
tzifas.com, 1
tzwe.com, 1
u-tokyo.club, 1
u.nu, 1
u03.fr, 1
u1100.com, 1
u1144.com, 1
@ -27036,7 +27026,6 @@ ullah.se, 1
ullamodaintima.com.br, 1
ulmer-schneesport.de, 0
ulrik.moe, 1
ulti.gq, 1
ultimateanu.com, 1
ultimatemafia.net, 1
ultratechlp.com, 1
@ -27224,6 +27213,7 @@ urbanietz-immobilien.de, 1
urbanmelbourne.info, 1
urbannewsservice.com, 1
urbansparrow.in, 1
urbanstylestaging.com, 1
urbanwildlifealliance.org, 1
urbexdk.nl, 1
urcentral.com, 1
@ -27236,7 +27226,6 @@ url.cab, 1
url.fi, 1
url.fm, 1
url.rw, 1
url0.eu, 1
urlachershop.com.br, 1
urlaub-leitner.at, 1
urlscan.io, 1
@ -27449,6 +27438,7 @@ vayaport.com, 1
vaygren.com, 1
vazue.com, 1
vbazile.com, 1
vbcdn.com, 1
vbh2o.com, 1
vc.gg, 1
vcam.org, 1
@ -27474,6 +27464,7 @@ vdrpro.com, 1
ve.search.yahoo.com, 0
ve3oat.ca, 1
vea.re, 1
veblr.com, 0
vecozo.nl, 1
vectorwish.com, 1
veg-leiden.nl, 1
@ -28043,6 +28034,7 @@ watermonitor.gov, 1
watersb.org, 1
watertrails.io, 1
watsonwork.me, 1
wattechweb.com, 1
wave-ola.es, 1
wavesboardshop.com, 1
wavesoftime.com, 1
@ -28354,7 +28346,6 @@ wf-trial-hrd.appspot.com, 1
wfh.ovh, 1
wfh.se, 1
wg-tools.de, 1
wg3k.us, 1
wgom.org, 1
wh-guide.de, 1
whanau.org, 1
@ -28621,7 +28612,6 @@ wmfusercontent.org, 1
wmkowa.de, 1
wmoda.com.br, 1
wmustore.com, 1
wnnc.co.uk, 1
wnu.com, 1
wo-ist-elvira.net, 1
wo2forum.nl, 0
@ -29245,6 +29235,7 @@ ybti.net, 1
ycaaz.com, 1
ych.art, 1
yclan.net, 1
yd.io, 1
yecl.net, 1
yeesker.com, 1
yellowcar.website, 1
@ -29548,7 +29539,6 @@ zappbuildapps.com, 1
zaratan.fr, 1
zarmarket.org, 1
zarpo.com.br, 1
zary.me, 1
zaufanatrzeciastrona.pl, 1
zavec.com.ec, 1
zavetaji.lv, 1
@ -29588,6 +29578,7 @@ zelfrijdendeautos.com, 1
zellari.ru, 1
zeloz.xyz, 1
zemlova.cz, 1
zen-diez.de, 1
zen-ume.com, 1
zenfusion.fr, 1
zenghx.tk, 0

Просмотреть файл

@ -380093,6 +380093,36 @@
{}
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html",
{}
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html",
{}
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html",
{}
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html",
{}
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html",
{}
]
],
"webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html": [
[
"/webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html",
@ -631579,7 +631609,7 @@
"support"
],
"webaudio/js/helpers.js": [
"c5d44cf8101c50b59c366ed1971205193f32e1bf",
"dff18a7e57adb3847b70fa7f1f3752b591b38d6e",
"support"
],
"webaudio/js/lodash.js": [
@ -631606,6 +631636,26 @@
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html": [
"c3f5f5969ed0ab58a9df332196e138aef8e693f3",
"testharness"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html": [
"cfbeb7283e7375974943ccf689cca73942e6259f",
"testharness"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-output.html": [
"f27d081b9b3df8af7449f130a455b90c6e93ca7b",
"testharness"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html": [
"1909a2970f0529ad0433c8e6e75733695d44d3e0",
"testharness"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html": [
"8478aa405a4641a9c47554529762e85a37d7593a",
"testharness"
],
"webaudio/the-audio-api/the-audiobuffer-interface/.gitkeep": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"

Просмотреть файл

@ -21,3 +21,198 @@ function trimEmptyElements(array) {
}
return array.subarray(start, end);
}
function fuzzyCompare(a, b) {
return Math.abs(a - b) < 9e-3;
}
function compareChannels(buf1, buf2,
/*optional*/ length,
/*optional*/ sourceOffset,
/*optional*/ destOffset,
/*optional*/ skipLengthCheck) {
if (!skipLengthCheck) {
assert_equals(buf1.length, buf2.length, "Channels must have the same length");
}
sourceOffset = sourceOffset || 0;
destOffset = destOffset || 0;
if (length == undefined) {
length = buf1.length - sourceOffset;
}
var difference = 0;
var maxDifference = 0;
var firstBadIndex = -1;
for (var i = 0; i < length; ++i) {
if (!fuzzyCompare(buf1[i + sourceOffset], buf2[i + destOffset])) {
difference++;
maxDifference = Math.max(maxDifference, Math.abs(buf1[i + sourceOffset] - buf2[i + destOffset]));
if (firstBadIndex == -1) {
firstBadIndex = i;
}
}
};
assert_equals(difference, 0, "maxDifference: " + maxDifference +
", first bad index: " + firstBadIndex + " with test-data offset " +
sourceOffset + " and expected-data offset " + destOffset +
"; corresponding values " + buf1[firstBadIndex + sourceOffset] + " and " +
buf2[firstBadIndex + destOffset] + " --- differences");
}
function compareBuffers(got, expected) {
if (got.numberOfChannels != expected.numberOfChannels) {
assert_equals(got.numberOfChannels, expected.numberOfChannels,
"Correct number of buffer channels");
return;
}
if (got.length != expected.length) {
assert_equals(got.length, expected.length,
"Correct buffer length");
return;
}
if (got.sampleRate != expected.sampleRate) {
assert_equals(got.sampleRate, expected.sampleRate,
"Correct sample rate");
return;
}
for (var i = 0; i < got.numberOfChannels; ++i) {
compareChannels(got.getChannelData(i), expected.getChannelData(i),
got.length, 0, 0, true);
}
}
/**
* This function assumes that the test is a "single page test" [0], and defines a
* single gTest variable with the following properties and methods:
*
* + numberOfChannels: optional property which specifies the number of channels
* in the output. The default value is 2.
* + createGraph: mandatory method which takes a context object and does
* everything needed in order to set up the Web Audio graph.
* This function returns the node to be inspected.
* + createGraphAsync: async version of createGraph. This function takes
* a callback which should be called with an argument
* set to the node to be inspected when the callee is
* ready to proceed with the test. Either this function
* or createGraph must be provided.
* + createExpectedBuffers: optional method which takes a context object and
* returns either one expected buffer or an array of
* them, designating what is expected to be observed
* in the output. If omitted, the output is expected
* to be silence. All buffers must have the same
* length, which must be a bufferSize supported by
* ScriptProcessorNode. This function is guaranteed
* to be called before createGraph.
* + length: property equal to the total number of frames which we are waiting
* to see in the output, mandatory if createExpectedBuffers is not
* provided, in which case it must be a bufferSize supported by
* ScriptProcessorNode (256, 512, 1024, 2048, 4096, 8192, or 16384).
* If createExpectedBuffers is provided then this must be equal to
* the number of expected buffers * the expected buffer length.
*
* + skipOfflineContextTests: optional. when true, skips running tests on an offline
* context by circumventing testOnOfflineContext.
*
* [0]: http://web-platform-tests.org/writing-tests/testharness-api.html#single-page-tests
*/
function runTest(name)
{
function runTestFunction () {
if (!gTest.numberOfChannels) {
gTest.numberOfChannels = 2; // default
}
var testLength;
function runTestOnContext(context, callback, testOutput) {
if (!gTest.createExpectedBuffers) {
// Assume that the output is silence
var expectedBuffers = getEmptyBuffer(context, gTest.length);
} else {
var expectedBuffers = gTest.createExpectedBuffers(context);
}
if (!(expectedBuffers instanceof Array)) {
expectedBuffers = [expectedBuffers];
}
var expectedFrames = 0;
for (var i = 0; i < expectedBuffers.length; ++i) {
assert_equals(expectedBuffers[i].numberOfChannels, gTest.numberOfChannels,
"Correct number of channels for expected buffer " + i);
expectedFrames += expectedBuffers[i].length;
}
if (gTest.length && gTest.createExpectedBuffers) {
assert_equals(expectedFrames,
gTest.length, "Correct number of expected frames");
}
if (gTest.createGraphAsync) {
gTest.createGraphAsync(context, function(nodeToInspect) {
testOutput(nodeToInspect, expectedBuffers, callback);
});
} else {
testOutput(gTest.createGraph(context), expectedBuffers, callback);
}
}
function testOnNormalContext(callback) {
function testOutput(nodeToInspect, expectedBuffers, callback) {
testLength = 0;
var sp = context.createScriptProcessor(expectedBuffers[0].length, gTest.numberOfChannels, 0);
nodeToInspect.connect(sp);
sp.onaudioprocess = function(e) {
var expectedBuffer = expectedBuffers.shift();
testLength += expectedBuffer.length;
compareBuffers(e.inputBuffer, expectedBuffer);
if (expectedBuffers.length == 0) {
sp.onaudioprocess = null;
callback();
}
};
}
var context = new AudioContext();
runTestOnContext(context, callback, testOutput);
}
function testOnOfflineContext(callback, sampleRate) {
function testOutput(nodeToInspect, expectedBuffers, callback) {
nodeToInspect.connect(context.destination);
context.oncomplete = function(e) {
var samplesSeen = 0;
while (expectedBuffers.length) {
var expectedBuffer = expectedBuffers.shift();
assert_equals(e.renderedBuffer.numberOfChannels, expectedBuffer.numberOfChannels,
"Correct number of input buffer channels");
for (var i = 0; i < e.renderedBuffer.numberOfChannels; ++i) {
compareChannels(e.renderedBuffer.getChannelData(i),
expectedBuffer.getChannelData(i),
expectedBuffer.length,
samplesSeen,
undefined,
true);
}
samplesSeen += expectedBuffer.length;
}
callback();
};
context.startRendering();
}
var context = new OfflineAudioContext(gTest.numberOfChannels, testLength, sampleRate);
runTestOnContext(context, callback, testOutput);
}
testOnNormalContext(function() {
if (!gTest.skipOfflineContextTests) {
testOnOfflineContext(function() {
testOnOfflineContext(done, 44100);
}, 48000);
} else {
done();
}
});
};
runTestFunction();
}

Просмотреть файл

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function() {
// fftSize <= bufferSize so that the time domain data is full of input after
// processing the buffer.
const fftSize = 32;
const bufferSize = 128;
var context = new OfflineAudioContext(1, bufferSize, 48000);
var analyser1 = context.createAnalyser();
analyser1.fftSize = fftSize;
analyser1.connect(context.destination);
var analyser2 = context.createAnalyser();
analyser2.fftSize = fftSize;
var gain = context.createGain();
gain.gain.value = 2.0;
gain.connect(analyser1);
gain.connect(analyser2);
// Create a DC input to make getFloatTimeDomainData() output consistent at
// any time.
var buffer = context.createBuffer(1, 1, context.sampleRate);
buffer.getChannelData(0)[0] = 1.0 / gain.gain.value;
var source = context.createBufferSource();
source.buffer = buffer;
source.loop = true;
source.connect(gain);
source.start();
return context.startRendering().then(function(buffer) {
assert_equals(buffer.getChannelData(0)[0], 1.0, "analyser1 output");
var data = new Float32Array(1);
analyser1.getFloatTimeDomainData(data);
assert_equals(data[0], 1.0, "analyser1 time domain data");
analyser2.getFloatTimeDomainData(data);
assert_equals(data[0], 1.0, "analyser2 time domain data");
});
}, "Test effect of AnalyserNode on GainNode output");
</script>
</head>
</body>
</html>

Просмотреть файл

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test AnalyserNode when the input is silent</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var ac = new AudioContext();
var analyser = ac.createAnalyser();
var constant = ac.createConstantSource();
var sp = ac.createScriptProcessor(2048, 1, 0);
constant.offset.value = 0.0;
constant.connect(analyser).connect(ac.destination);
constant.connect(sp);
var buf = new Float32Array(analyser.frequencyBinCount);
var iteration_count = 10;
sp.onaudioprocess = function() {
analyser.getFloatFrequencyData(buf);
var correct = true;
for (var i = 0; i < buf.length; i++) {
correct &= buf[i] == -Infinity;
}
assert_true(!!correct, "silent input process -Infinity in decibel bins");
if (!iteration_count--) {
sp.onaudioprocess = null;
constant.stop();
ac.close();
done();
}
};
constant.start();
</script>
</head>
</body>
</html>

Просмотреть файл

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AnalyserNode output</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/js/helpers.js"></script>
<script>
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var analyser = context.createAnalyser();
source.buffer = this.buffer;
source.connect(analyser);
source.start(0);
return analyser;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(
440 * 2 * Math.PI * i / context.sampleRate
);
}
return [this.buffer];
}
};
runTest("AnalyserNode output");
</script>
</head>
</body>
</html>

Просмотреть файл

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test AnalyserNode when the input is scaled</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var context = new AudioContext();
var gain = context.createGain();
var analyser = context.createAnalyser();
var osc = context.createOscillator();
osc.connect(gain);
gain.connect(analyser);
osc.start();
var array = new Uint8Array(analyser.frequencyBinCount);
function getAnalyserData() {
gain.gain.setValueAtTime(currentGain, context.currentTime);
analyser.getByteTimeDomainData(array);
var inrange = true;
var max = -1;
for (var i = 0; i < array.length; i++) {
if (array[i] > max) {
max = Math.abs(array[i] - 128);
}
}
if (max <= currentGain * 128) {
assert_true(true, "Analyser got scaled data for " + currentGain);
currentGain = tests.shift();
if (currentGain == undefined) {
done();
return;
}
}
requestAnimationFrame(getAnalyserData);
}
var tests = [1.0, 0.5, 0.0];
var currentGain = tests.shift();
requestAnimationFrame(getAnalyserData);
</script>
</head>
</body>
</html>

Просмотреть файл

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function testNode() {
var context = new AudioContext();
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(
440 * 2 * Math.PI * i / context.sampleRate
);
}
var destination = context.destination;
var source = context.createBufferSource();
var analyser = context.createAnalyser();
source.buffer = buffer;
source.connect(analyser);
analyser.connect(destination);
assert_equals(
analyser.channelCount,
1,
"analyser node has 1 input channels by default"
);
assert_equals(
analyser.channelCountMode,
"max",
"Correct channelCountMode for the analyser node"
);
assert_equals(
analyser.channelInterpretation,
"speakers",
"Correct channelCountInterpretation for the analyser node"
);
assert_equals(
analyser.fftSize,
2048,
"Correct default value for fftSize"
);
assert_equals(
analyser.frequencyBinCount,
1024,
"Correct default value for frequencyBinCount"
);
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 0;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 1;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 8;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 100;
}); // non-power of two
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 2049;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 4097;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 8193;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 16385;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 32769;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.fftSize = 65536;
});
analyser.fftSize = 1024;
assert_equals(
analyser.frequencyBinCount,
512,
"Correct new value for frequencyBinCount"
);
assert_equals(
analyser.minDecibels,
-100,
"Correct default value for minDecibels"
);
assert_equals(
analyser.maxDecibels,
-30,
"Correct default value for maxDecibels"
);
assert_throws("INDEX_SIZE_ERR", function() {
analyser.minDecibels = -30;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.minDecibels = -29;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.maxDecibels = -100;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.maxDecibels = -101;
});
assert_true(
Math.abs(analyser.smoothingTimeConstant - 0.8) < 0.001,
"Correct default value for smoothingTimeConstant"
);
assert_throws("INDEX_SIZE_ERR", function() {
analyser.smoothingTimeConstant = -0.1;
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser.smoothingTimeConstant = 1.1;
});
analyser.smoothingTimeConstant = 0;
analyser.smoothingTimeConstant = 1;
}
function testConstructor() {
var context = new AudioContext();
var analyser = new AnalyserNode(context);
assert_equals(
analyser.channelCount,
1,
"analyser node has 1 input channels by default"
);
assert_equals(
analyser.channelCountMode,
"max",
"Correct channelCountMode for the analyser node"
);
assert_equals(
analyser.channelInterpretation,
"speakers",
"Correct channelCountInterpretation for the analyser node"
);
assert_equals(
analyser.fftSize,
2048,
"Correct default value for fftSize"
);
assert_equals(
analyser.frequencyBinCount,
1024,
"Correct default value for frequencyBinCount"
);
assert_equals(
analyser.minDecibels,
-100,
"Correct default value for minDecibels"
);
assert_equals(
analyser.maxDecibels,
-30,
"Correct default value for maxDecibels"
);
assert_true(
Math.abs(analyser.smoothingTimeConstant - 0.8) < 0.001,
"Correct default value for smoothingTimeConstant"
);
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 0 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 1 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 8 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 100 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 2049 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 4097 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 8193 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 16385 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 32769 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { fftSize: 65536 });
});
analyser = new AnalyserNode(context, { fftSize: 1024 });
assert_equals(
analyser.frequencyBinCount,
512,
"Correct new value for frequencyBinCount"
);
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { minDecibels: -30 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { minDecibels: -29 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { maxDecibels: -100 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { maxDecibels: -101 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { smoothingTimeConstant: -0.1 });
});
assert_throws("INDEX_SIZE_ERR", function() {
analyser = new AnalyserNode(context, { smoothingTimeConstant: -1.1 });
});
analyser = new AnalyserNode(context, { smoothingTimeConstant: 0 });
analyser = new AnalyserNode(context, { smoothingTimeConstant: 1 });
}
test(testNode, "Test AnalyserNode API");
test(testConstructor, "Test AnalyserNode's ctor API");
</script>
</head>
</body>
</html>

Просмотреть файл

@ -4,14 +4,16 @@
Cu.import("resource://gre/modules/PlacesSearchAutocompleteProvider.jsm");
function run_test() {
// Tell the search service we are running in the US. This also has the
// desired side-effect of preventing our geoip lookup.
Services.prefs.setBoolPref("browser.search.isUS", true);
Services.prefs.setCharPref("browser.search.countryCode", "US");
Services.prefs.setBoolPref("browser.search.geoSpecificDefaults", false);
run_next_test();
}
add_task(async function() {
// Tell the search service we are running in the US. This also has the
// desired side-effect of preventing our geoip lookup.
Services.prefs.setBoolPref("browser.search.isUS", true);
Services.prefs.setCharPref("browser.search.countryCode", "US");
Services.prefs.setBoolPref("browser.search.geoSpecificDefaults", false);
Services.search.restoreDefaultEngines();
Services.search.resetToOriginalDefaultEngine();
});
add_task(async function search_engine_match() {
let engine = await promiseDefaultSearchEngine();

Просмотреть файл

@ -24,6 +24,9 @@ async function cleanUpSuggestions() {
}
add_task(async function setup() {
Services.prefs.setCharPref("browser.urlbar.matchBuckets", "general:5,suggestion:Infinity");
Services.prefs.setBoolPref("browser.urlbar.geoSpecificDefaults", false);
// Set up a server that provides some suggestions by appending strings onto
// the search query.
let server = makeTestServer(SERVER_PORT);
@ -559,13 +562,14 @@ add_task(async function mixup_frecency() {
],
});
Services.prefs.clearUserPref("browser.urlbar.matchBuckets");
Services.prefs.setCharPref("browser.urlbar.matchBuckets", "general:5,suggestion:Infinity");
Services.prefs.clearUserPref("browser.urlbar.matchBucketsSearch");
await cleanUpSuggestions();
});
add_task(async function prohibit_suggestions() {
Services.prefs.setBoolPref(SUGGEST_PREF, true);
Services.prefs.setBoolPref("browser.fixup.domainwhitelist.localhost", false);
await check_autocomplete({
search: "localhost",
@ -598,7 +602,7 @@ add_task(async function prohibit_suggestions() {
});
Services.prefs.setBoolPref("browser.fixup.domainwhitelist.localhost", true);
do_register_cleanup(() => {
Services.prefs.clearUserPref("browser.fixup.domainwhitelist.localhost");
Services.prefs.setBoolPref("browser.fixup.domainwhitelist.localhost", false);
});
await check_autocomplete({
search: "localhost",
@ -642,7 +646,7 @@ add_task(async function prohibit_suggestions() {
// Clear the whitelist for localhost, and try preferring DNS for any single
// word instead:
Services.prefs.clearUserPref("browser.fixup.domainwhitelist.localhost");
Services.prefs.setBoolPref("browser.fixup.domainwhitelist.localhost", false);
Services.prefs.setBoolPref("browser.fixup.dns_first_for_single_words", true);
do_register_cleanup(() => {
Services.prefs.clearUserPref("browser.fixup.dns_first_for_single_words");

Просмотреть файл

@ -1,6 +1,7 @@
[DEFAULT]
head = head_autocomplete.js
skip-if = toolkit == 'android'
firefox-appdir = browser
support-files =
data/engine-rel-searchform.xml
data/engine-suggestions.xml
@ -12,6 +13,7 @@ support-files =
[test_418257.js]
[test_422277.js]
[test_autocomplete_functional.js]
[test_autocomplete_stopSearch_no_throw.js]
[test_autofill_default_behavior.js]
[test_avoid_middle_complete.js]
[test_avoid_stripping_to_empty_tokens.js]
@ -24,12 +26,14 @@ support-files =
[test_encoded_urls.js]
[test_escape_self.js]
[test_extension_matches.js]
[test_history_autocomplete_tags.js]
[test_ignore_protocol.js]
[test_keyword_search.js]
[test_keyword_search_actions.js]
[test_keywords.js]
[test_match_beginning.js]
[test_multi_word_search.js]
[test_PlacesSearchAutocompleteProvider.js]
[test_preloaded_sites.js]
[test_query_url.js]
[test_remote_tab_matches.js]

Просмотреть файл

@ -60,7 +60,6 @@ skip-if = os == "linux"
[test_async_in_batchmode.js]
[test_async_transactions.js]
skip-if = (os == "win" && os_version == "5.1") # Bug 1158887
[test_autocomplete_stopSearch_no_throw.js]
[test_bookmark_catobs.js]
[test_bookmarks_json.js]
[test_bookmarks_html.js]
@ -83,7 +82,6 @@ skip-if = (os == "win" && os_version == "5.1") # Bug 1158887
[test_getChildIndex.js]
[test_hash.js]
[test_history.js]
[test_history_autocomplete_tags.js]
[test_history_catobs.js]
[test_history_clear.js]
[test_history_notifications.js]
@ -108,7 +106,6 @@ skip-if = true
[test_pageGuid_bookmarkGuid.js]
[test_frecency_observers.js]
[test_placeURIs.js]
[test_PlacesSearchAutocompleteProvider.js]
[test_PlacesUtils_invalidateCachedGuidFor.js]
[test_preventive_maintenance.js]
[test_preventive_maintenance_checkAndFixDatabase.js]

9
toolkit/library/gtest/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -579,6 +579,7 @@ dependencies = [
"geckoservo 0.0.1",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse_capi 0.8.0",
"netwerk_helper 0.0.1",
"nserror 0.1.0",
"nsstring 0.1.0",
"rust_url_capi 0.0.1",
@ -865,6 +866,14 @@ dependencies = [
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "netwerk_helper"
version = "0.0.1"
dependencies = [
"nserror 0.1.0",
"nsstring 0.1.0",
]
[[package]]
name = "nodrop"
version = "0.1.9"

9
toolkit/library/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -578,6 +578,7 @@ dependencies = [
"geckoservo 0.0.1",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse_capi 0.8.0",
"netwerk_helper 0.0.1",
"nserror 0.1.0",
"nsstring 0.1.0",
"rust_url_capi 0.0.1",
@ -860,6 +861,14 @@ dependencies = [
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "netwerk_helper"
version = "0.0.1"
dependencies = [
"nserror 0.1.0",
"nsstring 0.1.0",
]
[[package]]
name = "nodrop"
version = "0.1.9"

Просмотреть файл

@ -10,6 +10,7 @@ geckoservo = { path = "../../../../servo/ports/geckolib", optional = true }
mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
nserror = { path = "../../../../xpcom/rust/nserror" }
netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }
rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" }
webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true }
cubeb-pulse = { path = "../../../../media/libcubeb/cubeb-pulse-rs", optional = true, features=["pulse-dlopen"] }

Просмотреть файл

@ -9,6 +9,7 @@ extern crate mp4parse_capi;
extern crate nsstring;
extern crate nserror;
extern crate rust_url_capi;
extern crate netwerk_helper;
#[cfg(feature = "quantum_render")]
extern crate webrender_bindings;
#[cfg(feature = "cubeb_pulse_rust")]

Просмотреть файл

@ -38,7 +38,9 @@
#define PROFILER_CLEAR_JS_CONTEXT()
#define AUTO_PROFILER_LABEL(label, category)
#define AUTO_PROFILER_LABEL_DYNAMIC(label, category, dynamicStr)
#define AUTO_PROFILER_LABEL_DYNAMIC_CSTR(label, category, cStr)
#define AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(label, category, nsCStr)
#define AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(label, category, nsStr)
#define PROFILER_ADD_MARKER(markerName)
@ -379,22 +381,25 @@ PseudoStack* profiler_get_pseudo_stack();
// Insert an RAII object in this scope to enter a pseudo stack frame. Any
// samples collected in this scope will contain this label in their pseudo
// stack. The label argument must be a string literal. It is usually of the
// stack. The label argument must be a static C string. It is usually of the
// form "ClassName::FunctionName". (Ideally we'd use the compiler to provide
// that for us, but __func__ gives us the function name without the class
// name.) If the label applies to only part of a function, you can qualify it
// like this: "ClassName::FunctionName:PartName".
//
// Use AUTO_PROFILER_LABEL_DYNAMIC if you want to add additional / dynamic
// Use AUTO_PROFILER_LABEL_DYNAMIC_* if you want to add additional / dynamic
// information to the pseudo stack frame.
#define AUTO_PROFILER_LABEL(label, category) \
mozilla::AutoProfilerLabel PROFILER_RAII(label, nullptr, __LINE__, \
js::ProfileEntry::Category::category)
// Similar to AUTO_PROFILER_LABEL, but with an additional string. The inserted
// RAII object stores the dynamicStr pointer in a field; it does not copy the
// string. This means that the string you pass to this macro needs to live at
// least until the end of the current scope.
// RAII object stores the cStr pointer in a field; it does not copy the string.
//
// WARNING: This means that the string you pass to this macro needs to live at
// least until the end of the current scope. Be careful using this macro with
// ns[C]String; the other AUTO_PROFILER_LABEL_DYNAMIC_* macros below are
// preferred because they avoid this problem.
//
// If the profiler samples the current thread and walks the pseudo stack while
// this RAII object is on the stack, it will copy the supplied string into the
@ -406,10 +411,43 @@ PseudoStack* profiler_get_pseudo_stack();
// AUTO_PROFILER_LABEL are sampled, no string copy needs to be made because the
// profile buffer can just store the raw pointers to the literal strings.
// Consequently, AUTO_PROFILER_LABEL frames take up considerably less space in
// the profile buffer than AUTO_PROFILER_LABEL_DYNAMIC frames.
#define AUTO_PROFILER_LABEL_DYNAMIC(label, category, dynamicStr) \
mozilla::AutoProfilerLabel PROFILER_RAII(label, dynamicStr, __LINE__, \
js::ProfileEntry::Category::category)
// the profile buffer than AUTO_PROFILER_LABEL_DYNAMIC_* frames.
#define AUTO_PROFILER_LABEL_DYNAMIC_CSTR(label, category, cStr) \
mozilla::AutoProfilerLabel \
PROFILER_RAII(label, cStr, __LINE__, js::ProfileEntry::Category::category)
// Similar to AUTO_PROFILER_LABEL_DYNAMIC_CSTR, but takes an nsACString.
//
// Note: The use of the Maybe<>s ensures the scopes for the dynamic string and
// the AutoProfilerLabel are appropriate, while also not incurring the runtime
// cost of the string assignment unless the profiler is active. Therefore,
// unlike AUTO_PROFILER_LABEL and AUTO_PROFILER_LABEL_DYNAMIC_CSTR, this macro
// doesn't push/pop a label when the profiler is inactive.
#define AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(label, category, nsCStr) \
mozilla::Maybe<nsAutoCString> autoCStr; \
mozilla::Maybe<AutoProfilerLabel> raiiObjectNsCString; \
if (profiler_is_active()) { \
autoCStr.emplace(nsCStr); \
raiiObjectNsCString.emplace(label, autoCStr->get(), __LINE__, \
js::ProfileEntry::Category::category); \
}
// Similar to AUTO_PROFILER_LABEL_DYNAMIC_CSTR, but takes an nsString that is
// is lossily converted to an ASCII string.
//
// Note: The use of the Maybe<>s ensures the scopes for the converted dynamic
// string and the AutoProfilerLabel are appropriate, while also not incurring
// the runtime cost of the string conversion unless the profiler is active.
// Therefore, unlike AUTO_PROFILER_LABEL and AUTO_PROFILER_LABEL_DYNAMIC_CSTR,
// this macro doesn't push/pop a label when the profiler is inactive.
#define AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(label, category, nsStr) \
mozilla::Maybe<NS_LossyConvertUTF16toASCII> asciiStr; \
mozilla::Maybe<AutoProfilerLabel> raiiObjectLossyNsString; \
if (profiler_is_active()) { \
asciiStr.emplace(nsStr); \
raiiObjectLossyNsString.emplace(label, asciiStr->get(), __LINE__, \
js::ProfileEntry::Category::category); \
}
// Insert a marker in the profile timeline. This is useful to delimit something
// important happening such as the first paint. Unlike labels, which are only

Просмотреть файл

@ -495,9 +495,9 @@ TEST(GeckoProfiler, Markers)
okstr1[kMax - 1] = '\0';
okstr2[kMax - 1] = '\0';
longstr[kMax] = '\0';
AUTO_PROFILER_LABEL_DYNAMIC("", CSS, okstr1.get());
AUTO_PROFILER_LABEL_DYNAMIC("okstr2", CSS, okstr2.get());
AUTO_PROFILER_LABEL_DYNAMIC("", CSS, longstr.get());
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("", CSS, okstr1.get());
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("okstr2", CSS, okstr2.get());
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("", CSS, longstr.get());
// Sleep briefly to ensure a sample is taken and the pending markers are
// processed.
@ -698,7 +698,11 @@ TEST(GeckoProfiler, PseudoStack)
UniqueFreePtr<char> dynamic(strdup("dynamic"));
{
AUTO_PROFILER_LABEL_DYNAMIC("A::C", JS, dynamic.get());
AUTO_PROFILER_LABEL_DYNAMIC_CSTR("A::C", JS, dynamic.get());
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING(
"A::C2", JS, nsDependentCString(dynamic.get()));
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"A::C3", JS, NS_ConvertUTF8toUTF16(dynamic.get()));
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
features, filters, MOZ_ARRAY_LENGTH(filters));

Просмотреть файл

@ -288,8 +288,8 @@ NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports* aSubject,
mozilla::TimeStamp start = TimeStamp::Now();
AUTO_PROFILER_LABEL_DYNAMIC("nsObserverService::NotifyObservers", OTHER,
aTopic);
AUTO_PROFILER_LABEL_DYNAMIC_CSTR(
"nsObserverService::NotifyObservers", OTHER, aTopic);
nsObserverList* observerList = mObserverTopicTable.GetEntry(aTopic);
if (observerList) {

Просмотреть файл

@ -45,7 +45,9 @@ nsILabelableRunnable::SchedulerGroupSet::Put(mozilla::SchedulerGroup* aGroup)
if (mSingle) {
MOZ_ASSERT(mMulti.isNothing());
mMulti.emplace();
mMulti.ref().PutEntry(mSingle);
auto& multi = mMulti.ref();
multi.PutEntry(mSingle);
multi.PutEntry(aGroup);
mSingle = nullptr;
return;
}