зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
Коммит
5c90a99952
|
@ -32,7 +32,6 @@ builtin(include, build/autoconf/clang-plugin.m4)dnl
|
|||
builtin(include, build/autoconf/alloc.m4)dnl
|
||||
builtin(include, build/autoconf/ios.m4)dnl
|
||||
builtin(include, build/autoconf/jemalloc.m4)dnl
|
||||
builtin(include, build/autoconf/rust.m4)dnl
|
||||
|
||||
MOZ_PROG_CHECKMSYS()
|
||||
|
||||
|
|
|
@ -215,17 +215,6 @@ int main(int argc, _CONST char* argv[])
|
|||
(void)setsid();
|
||||
#endif
|
||||
|
||||
int gotCounters;
|
||||
#if defined(XP_UNIX)
|
||||
struct rusage initialRUsage;
|
||||
gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
|
||||
#elif defined(XP_WIN)
|
||||
IO_COUNTERS ioCounters;
|
||||
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
|
||||
#else
|
||||
#error "Unknown platform" // having this here keeps cppcheck happy
|
||||
#endif
|
||||
|
||||
#ifdef HAS_DLL_BLOCKLIST
|
||||
DllBlocklist_Initialize();
|
||||
#endif
|
||||
|
@ -251,32 +240,6 @@ int main(int argc, _CONST char* argv[])
|
|||
return 255;
|
||||
}
|
||||
|
||||
if (gotCounters) {
|
||||
#if defined(XP_WIN)
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
|
||||
int(ioCounters.ReadOperationCount));
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
|
||||
int(ioCounters.ReadTransferCount / 1024));
|
||||
IO_COUNTERS newIoCounters;
|
||||
if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
|
||||
int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
|
||||
int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
|
||||
}
|
||||
#elif defined(XP_UNIX)
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
|
||||
int(initialRUsage.ru_majflt));
|
||||
struct rusage newRUsage;
|
||||
if (!getrusage(RUSAGE_SELF, &newRUsage)) {
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
|
||||
int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
|
||||
}
|
||||
#else
|
||||
#error "Unknown platform" // having this here keeps cppcheck happy
|
||||
#endif
|
||||
}
|
||||
|
||||
int result;
|
||||
{
|
||||
ScopedLogging log;
|
||||
|
|
|
@ -362,17 +362,6 @@ int main(int argc, char* argv[], char* envp[])
|
|||
TriggerQuirks();
|
||||
#endif
|
||||
|
||||
int gotCounters;
|
||||
#if defined(XP_UNIX)
|
||||
struct rusage initialRUsage;
|
||||
gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
|
||||
#elif defined(XP_WIN)
|
||||
IO_COUNTERS ioCounters;
|
||||
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
|
||||
#else
|
||||
#error "Unknown platform" // having this here keeps cppcheck happy
|
||||
#endif
|
||||
|
||||
nsIFile *xreDirectory;
|
||||
|
||||
#ifdef HAS_DLL_BLOCKLIST
|
||||
|
@ -394,32 +383,6 @@ int main(int argc, char* argv[], char* envp[])
|
|||
|
||||
XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start);
|
||||
|
||||
if (gotCounters) {
|
||||
#if defined(XP_WIN)
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
|
||||
int(ioCounters.ReadOperationCount));
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
|
||||
int(ioCounters.ReadTransferCount / 1024));
|
||||
IO_COUNTERS newIoCounters;
|
||||
if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
|
||||
int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
|
||||
int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
|
||||
}
|
||||
#elif defined(XP_UNIX)
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
|
||||
int(initialRUsage.ru_majflt));
|
||||
struct rusage newRUsage;
|
||||
if (!getrusage(RUSAGE_SELF, &newRUsage)) {
|
||||
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
|
||||
int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
|
||||
}
|
||||
#else
|
||||
#error "Unknown platform" // having this here keeps cppcheck happy
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
|
||||
XRE_EnableSameExecutableForContentProc();
|
||||
#endif
|
||||
|
|
|
@ -987,7 +987,6 @@ var gHistorySwipeAnimation = {
|
|||
|
||||
let canvas = null;
|
||||
|
||||
TelemetryStopwatch.start("FX_GESTURE_TAKE_SNAPSHOT_OF_PAGE");
|
||||
try {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
let r = browser.getBoundingClientRect();
|
||||
|
@ -1006,7 +1005,6 @@ var gHistorySwipeAnimation = {
|
|||
ctx.DRAWWINDOW_ASYNC_DECODE_IMAGES |
|
||||
ctx.DRAWWINDOW_USE_WIDGET_LAYERS);
|
||||
} finally {
|
||||
TelemetryStopwatch.finish("FX_GESTURE_TAKE_SNAPSHOT_OF_PAGE");
|
||||
}
|
||||
|
||||
TelemetryStopwatch.start("FX_GESTURE_INSTALL_SNAPSHOT_OF_PAGE");
|
||||
|
|
|
@ -5625,10 +5625,6 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Services.telemetry.getHistogramById(aTab.closing ?
|
||||
"FX_TAB_ANIM_CLOSE_MS" :
|
||||
"FX_TAB_ANIM_OPEN_MS")
|
||||
.add(Date.now() - aTab._animStartTime);
|
||||
aTab._animStartTime = 0;
|
||||
|
||||
// Handle tab animation smoothness telemetry/logging of frame intervals and paint times
|
||||
|
|
|
@ -344,25 +344,29 @@ var Agent = {
|
|||
let exn = null;
|
||||
|
||||
let iterator = new File.DirectoryIterator(path);
|
||||
if (!iterator.exists()) {
|
||||
return;
|
||||
}
|
||||
for (let entry in iterator) {
|
||||
if (entry.isDir) {
|
||||
continue;
|
||||
try {
|
||||
if (!iterator.exists()) {
|
||||
return;
|
||||
}
|
||||
if (!prefix || entry.name.startsWith(prefix)) {
|
||||
try {
|
||||
File.remove(entry.path);
|
||||
} catch (ex) {
|
||||
// Don't stop immediately
|
||||
exn = exn || ex;
|
||||
for (let entry in iterator) {
|
||||
if (entry.isDir) {
|
||||
continue;
|
||||
}
|
||||
if (!prefix || entry.name.startsWith(prefix)) {
|
||||
try {
|
||||
File.remove(entry.path);
|
||||
} catch (ex) {
|
||||
// Don't stop immediately
|
||||
exn = exn || ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exn) {
|
||||
throw exn;
|
||||
if (exn) {
|
||||
throw exn;
|
||||
}
|
||||
} finally {
|
||||
iterator.close();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
NO_CACHE=1
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
|
||||
ac_add_options --enable-artifact-builds
|
||||
unset CC
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
#customization-palette,
|
||||
#customization-empty {
|
||||
padding: 0 25px 25px;
|
||||
padding: 5px 25px 25px;
|
||||
}
|
||||
|
||||
#customization-header {
|
||||
|
@ -281,10 +281,13 @@ toolbarpaletteitem[place="toolbar"]:not([mousedown="true"]):-moz-focusring {
|
|||
/* Delay adding the focusring back until after the transform transition completes. */
|
||||
transition: outline-width .01s linear var(--drag-drop-transition-duration);
|
||||
outline: 1px dotted rgba(0,0,0,.5);
|
||||
outline-offset: -5px;
|
||||
-moz-outline-radius: 2.5px;
|
||||
}
|
||||
|
||||
toolbarpaletteitem[place="toolbar"]:not([mousedown="true"]):-moz-focusring {
|
||||
outline-offset: -5px;
|
||||
}
|
||||
|
||||
#wrapper-edit-controls[place="palette"] > #edit-controls > toolbarbutton,
|
||||
#wrapper-edit-controls[place="palette"] > #edit-controls > separator,
|
||||
#wrapper-zoom-controls[place="palette"] > #zoom-controls > toolbarbutton,
|
||||
|
|
|
@ -95,7 +95,9 @@ AC_DEFUN([MOZ_ANDROID_STLPORT],
|
|||
|
||||
if test "$OS_TARGET" = "Android"; then
|
||||
cpu_arch_dir="$ANDROID_CPU_ARCH"
|
||||
if test "$MOZ_THUMB2" = 1; then
|
||||
# NDK r12 removed the arm/thumb library split and just made everything
|
||||
# thumb by default. Attempt to compensate.
|
||||
if test "$MOZ_THUMB2" = 1 -a -d "$cpu_arch_dir/thumb"; then
|
||||
cpu_arch_dir="$cpu_arch_dir/thumb"
|
||||
fi
|
||||
|
||||
|
@ -129,6 +131,12 @@ if test "$OS_TARGET" = "Android"; then
|
|||
fi
|
||||
|
||||
STLPORT_LIBS="-L$cxx_libs -lc++_static"
|
||||
# NDK r12 split the libc++ runtime libraries into pieces.
|
||||
for lib in c++abi unwind android_support; do
|
||||
if test -e "$cxx_libs/lib${lib}.a"; then
|
||||
STLPORT_LIBS="$STLPORT_LIBS -l${lib}"
|
||||
fi
|
||||
done
|
||||
# Add android/support/include/ for prototyping long double math
|
||||
# functions, locale-specific C library functions, multibyte support,
|
||||
# etc.
|
||||
|
|
|
@ -37,6 +37,12 @@ if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
|
|||
for var in AS CC CXX CPP LD AR RANLIB STRIP; do
|
||||
ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
|
||||
done
|
||||
old_cflags="$CFLAGS"
|
||||
# The libffi sources (especially the ARM ones) are written expecting gas
|
||||
# syntax, and clang's integrated assembler doesn't handle all of gas syntax.
|
||||
if test -n "$CLANG_CC" -a "$CPU_ARCH" = arm; then
|
||||
CFLAGS="-no-integrated-as $CFLAGS"
|
||||
fi
|
||||
if test "$CROSS_COMPILE"; then
|
||||
export CPPFLAGS CFLAGS LDFLAGS
|
||||
fi
|
||||
|
@ -77,6 +83,7 @@ if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
|
|||
AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi)
|
||||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||
CONFIG_FILES=$old_config_files
|
||||
CFLAGS="$old_cflags"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -228,7 +228,6 @@ def old_configure_options(*options):
|
|||
'--enable-reflow-perf',
|
||||
'--enable-release',
|
||||
'--enable-require-all-d3dc-versions',
|
||||
'--enable-rust',
|
||||
'--enable-safe-browsing',
|
||||
'--enable-sandbox',
|
||||
'--enable-signmar',
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
option('--enable-rust', help='Include Rust language sources')
|
||||
|
||||
@depends('--enable-rust')
|
||||
def rust_compiler_names(value):
|
||||
if value:
|
||||
return ['rustc']
|
||||
|
||||
rustc = check_prog('RUSTC', rust_compiler_names, allow_missing=True)
|
||||
|
||||
@depends_if(rustc)
|
||||
@checking('rustc version')
|
||||
@imports('subprocess')
|
||||
def rustc_version(rustc):
|
||||
try:
|
||||
# TODO: We should run `rustc --version -v` and parse that output instead.
|
||||
version = Version(subprocess.check_output(
|
||||
[rustc, '--version']
|
||||
).splitlines()[0].split()[1])
|
||||
return version
|
||||
except subprocess.CalledProcessError as e:
|
||||
die('Failed to get rustc version: %s', e.message)
|
||||
|
||||
@depends('--enable-rust', rustc, rustc_version)
|
||||
@imports(_from='textwrap', _import='dedent')
|
||||
def rust_compiler(value, rustc, rustc_version):
|
||||
if value:
|
||||
if not rustc:
|
||||
die(dedent('''\
|
||||
Rust compiler not found.
|
||||
To compile rust language sources, you must have 'rustc' in your path.
|
||||
See http://www.rust-lang.org/ for more information.
|
||||
'''))
|
||||
if rustc_version < '1.5':
|
||||
die(dedent('''\
|
||||
Rust compiler {} is too old.
|
||||
To compile Rust language sources please install at least
|
||||
version 1.5 of the 'rustc' toolchain and make sure it is
|
||||
first in your path.
|
||||
You can verify this by typing 'rustc --version'.
|
||||
'''.format(rustc_version)))
|
||||
return True
|
||||
|
||||
set_config('MOZ_RUST', rust_compiler)
|
||||
|
||||
@depends(rust_compiler, rustc, target, cross_compiling)
|
||||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
@imports(_from='tempfile', _import='mkstemp')
|
||||
def rust_target(rust_compiler, rustc, target, cross_compiling):
|
||||
if rust_compiler:
|
||||
# Rust's --target options are similar to, but not exactly the same
|
||||
# as, the autoconf-derived targets we use. An example would be that
|
||||
# Rust uses distinct target triples for targetting the GNU C++ ABI
|
||||
# and the MSVC C++ ABI on Win32, whereas autoconf has a single
|
||||
# triple and relies on the user to ensure that everything is
|
||||
# compiled for the appropriate ABI. We need to perform appropriate
|
||||
# munging to get the correct option to rustc.
|
||||
#
|
||||
# The canonical list of targets supported can be derived from:
|
||||
#
|
||||
# https://github.com/rust-lang/rust/tree/master/mk/cfg
|
||||
|
||||
# Avoid having to write out os+kernel for all the platforms where
|
||||
# they don't differ.
|
||||
os_or_kernel = target.kernel if target.kernel == 'Linux' and target.os != 'Android' else target.os
|
||||
rustc_target = {
|
||||
# DragonFly
|
||||
('x86_64', 'Dragonfly'): 'x86_64-unknown-dragonfly',
|
||||
# FreeBSD, GNU/kFreeBSD
|
||||
('x86', 'FreeBSD'): 'i686-unknown-freebsd',
|
||||
('x86_64', 'FreeBSD'): 'x86_64-unknown-freebsd',
|
||||
# NetBSD
|
||||
('x86_64', 'NetBSD'): 'x86_64-unknown-netbsd',
|
||||
# OpenBSD
|
||||
('x86_64', 'OpenBSD'): 'x86_64-unknown-openbsd',
|
||||
# Linux
|
||||
('x86', 'Linux'): 'i686-unknown-linux-gnu',
|
||||
# Linux
|
||||
('x86_64', 'Linux'): 'x86_64-unknown-linux-gnu',
|
||||
# OS X and iOS
|
||||
('x86', 'OSX'): 'i686-apple-darwin',
|
||||
('x86', 'iOS'): 'i386-apple-ios',
|
||||
('x86_64', 'OSX'): 'x86_64-apple-darwin',
|
||||
# Android
|
||||
('x86', 'Android'): 'i686-linux-android',
|
||||
('arm', 'Android'): 'arm-linux-androideabi',
|
||||
# Windows
|
||||
# XXX better detection of CXX needed here, to figure out whether
|
||||
# we need i686-pc-windows-gnu instead, since mingw32 builds work.
|
||||
('x86', 'WINNT'): 'i686-pc-windows-msvc',
|
||||
('x86_64', 'WINNT'): 'x86_64-pc-windows-msvc',
|
||||
}.get((target.cpu, os_or_kernel), None)
|
||||
|
||||
if rustc_target is None:
|
||||
if cross_compiling:
|
||||
die("Don't know how to translate {} for rustc".format(target.alias))
|
||||
# Fall back to implicit (native) target when not cross-compiling
|
||||
return None
|
||||
|
||||
# Check to see whether our rustc has a reasonably functional stdlib
|
||||
# for our chosen target.
|
||||
target_arg = '--target=' + rustc_target
|
||||
in_fd, in_path = mkstemp(prefix='conftest', suffix='.rs')
|
||||
out_fd, out_path = mkstemp(prefix='conftest', suffix='.rlib')
|
||||
os.close(out_fd)
|
||||
try:
|
||||
source = 'pub extern fn hello() { println!("Hello world"); }'
|
||||
log.debug('Creating `%s` with content:', in_path)
|
||||
with LineIO(lambda l: log.debug('| %s', l)) as out:
|
||||
out.write(source)
|
||||
|
||||
os.write(in_fd, source)
|
||||
os.close(in_fd)
|
||||
|
||||
cmd = [
|
||||
rustc,
|
||||
'--crate-type', 'staticlib',
|
||||
target_arg,
|
||||
'-o', out_path,
|
||||
in_path,
|
||||
]
|
||||
def failed():
|
||||
die('Cannot compile for {} with {}'.format(target.alias, rustc))
|
||||
check_cmd_output(*cmd, onerror=failed)
|
||||
if not os.path.exists(out_path) or os.path.getsize(out_path) == 0:
|
||||
failed()
|
||||
finally:
|
||||
os.remove(in_path)
|
||||
os.remove(out_path)
|
||||
# This target is usable.
|
||||
return target_arg
|
||||
|
||||
set_config('RUST_TARGET', rust_target)
|
||||
|
||||
# Until we remove all the other Rust checks in old-configure.
|
||||
add_old_configure_assignment('MOZ_RUST', rust_compiler)
|
||||
add_old_configure_assignment('RUSTC', rustc)
|
||||
add_old_configure_assignment('RUST_TARGET', rust_target)
|
|
@ -640,3 +640,5 @@ def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags):
|
|||
|
||||
set_config('MOZ_DEBUG_FLAGS', debug_flags)
|
||||
add_old_configure_assignment('MOZ_DEBUG_FLAGS', debug_flags)
|
||||
|
||||
include('rust.configure')
|
||||
|
|
|
@ -70,9 +70,10 @@ def normsep(path):
|
|||
@imports('itertools')
|
||||
@imports(_from='os', _import='pathsep')
|
||||
def find_program(file, paths=None):
|
||||
if is_absolute_or_relative(file):
|
||||
return os.path.abspath(file) if os.path.isfile(file) else None
|
||||
try:
|
||||
if is_absolute_or_relative(file):
|
||||
return normsep(which(os.path.basename(file),
|
||||
[os.path.dirname(file)]))
|
||||
if paths:
|
||||
if not isinstance(paths, (list, tuple)):
|
||||
die("Paths provided to find_program must be a list of strings, "
|
||||
|
|
|
@ -919,11 +919,11 @@ ifdef MOZ_RUST
|
|||
# in the target's LIBS.
|
||||
$(RSOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(RUSTC) $(RUSTFLAGS) --crate-type rlib --emit dep-info=$(MDDEPDIR)/$(call mk_libname,$<).pp,link=$(call mk_libname,$<) $(_VPATH_SRCS)
|
||||
$(RUSTC) $(RUST_TARGET) $(RUSTFLAGS) --crate-type rlib --emit dep-info=$(MDDEPDIR)/$(call mk_libname,$<).pp,link=$(call mk_libname,$<) $(_VPATH_SRCS)
|
||||
|
||||
$(RS_STATICLIB_CRATE_OBJ):
|
||||
$(REPORT_BUILD)
|
||||
$(RUSTC) $(RUSTFLAGS) --crate-type staticlib $(RLIB_EXTERN_CRATE_OPTIONS) --emit dep-info=$(MDDEPDIR)/$(call mk_global_crate_libname,$(RS_STATICLIB_CRATE_SRC)).pp,link=$@ $(RS_STATICLIB_CRATE_SRC)
|
||||
$(RUSTC) $(RUST_TARGET) $(RUSTFLAGS) --crate-type staticlib $(RLIB_EXTERN_CRATE_OPTIONS) --emit dep-info=$(MDDEPDIR)/$(call mk_global_crate_libname,$(RS_STATICLIB_CRATE_SRC)).pp,link=$@ $(RS_STATICLIB_CRATE_SRC)
|
||||
endif
|
||||
|
||||
$(SOBJS):
|
||||
|
|
|
@ -5,7 +5,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_
|
|||
|
||||
// Because we need to gather stats for the period of time that a tool has been
|
||||
// opened we make use of setTimeout() to create tool active times.
|
||||
const TOOL_DELAY = 200;
|
||||
const TOOL_DELAY = 1000;
|
||||
|
||||
add_task(function* () {
|
||||
info("Activating the storage inspector");
|
||||
|
|
541
dom/base/URL.cpp
541
dom/base/URL.cpp
|
@ -1,541 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 "URL.h"
|
||||
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "DOMMediaStream.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "mozilla/dom/URLBinding.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(URL, mParent, mSearchParams)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(URL)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(URL)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(URL)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
URL::URL(nsISupports* aParent, already_AddRefed<nsIURI> aURI)
|
||||
: mParent(aParent)
|
||||
, mURI(aURI)
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
URL::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return URLBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<URL>
|
||||
URL::Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
URL& aBase, ErrorResult& aRv)
|
||||
{
|
||||
return Constructor(aGlobal.GetAsSupports(), aUrl, aBase.GetURI(), aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<URL>
|
||||
URL::Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
const Optional<nsAString>& aBase, ErrorResult& aRv)
|
||||
{
|
||||
if (aBase.WasPassed()) {
|
||||
return Constructor(aGlobal.GetAsSupports(), aUrl, aBase.Value(), aRv);
|
||||
}
|
||||
|
||||
return Constructor(aGlobal.GetAsSupports(), aUrl, nullptr, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<URL>
|
||||
URL::Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
const nsAString& aBase, ErrorResult& aRv)
|
||||
{
|
||||
return Constructor(aGlobal.GetAsSupports(), aUrl, aBase, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<URL>
|
||||
URL::Constructor(nsISupports* aParent, const nsAString& aUrl,
|
||||
const nsAString& aBase, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIURI> baseUri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(baseUri), aBase, nullptr, nullptr,
|
||||
nsContentUtils::GetIOService());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aBase);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Constructor(aParent, aUrl, baseUri, aRv);
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<URL>
|
||||
URL::Constructor(nsISupports* aParent, const nsAString& aUrl, nsIURI* aBase,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUrl, nullptr, aBase,
|
||||
nsContentUtils::GetIOService());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aUrl);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<URL> url = new URL(aParent, uri.forget());
|
||||
return url.forget();
|
||||
}
|
||||
|
||||
void
|
||||
URL::CreateObjectURL(const GlobalObject& aGlobal,
|
||||
Blob& aBlob,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
CreateObjectURLInternal(aGlobal, aBlob.Impl(),
|
||||
NS_LITERAL_CSTRING(BLOBURI_SCHEME), aOptions, aResult,
|
||||
aError);
|
||||
}
|
||||
|
||||
void
|
||||
URL::CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
|
||||
const mozilla::dom::objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
CreateObjectURLInternal(aGlobal, &aStream,
|
||||
NS_LITERAL_CSTRING(MEDIASTREAMURI_SCHEME), aOptions,
|
||||
aResult, aError);
|
||||
}
|
||||
|
||||
void
|
||||
URL::CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> principal = nsContentUtils::ObjectPrincipal(aGlobal.Get());
|
||||
|
||||
nsCString url;
|
||||
nsresult rv = nsHostObjectProtocolHandler::
|
||||
AddDataEntry(NS_LITERAL_CSTRING(MEDIASOURCEURI_SCHEME),
|
||||
&aSource, principal, url);
|
||||
if (NS_FAILED(rv)) {
|
||||
aError.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> revocation = NS_NewRunnableFunction(
|
||||
[url] {
|
||||
nsHostObjectProtocolHandler::RemoveDataEntry(url);
|
||||
});
|
||||
|
||||
nsContentUtils::RunInStableState(revocation.forget());
|
||||
|
||||
CopyASCIItoUTF16(url, aResult);
|
||||
}
|
||||
|
||||
void
|
||||
URL::CreateObjectURLInternal(const GlobalObject& aGlobal, nsISupports* aObject,
|
||||
const nsACString& aScheme,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal = nsContentUtils::ObjectPrincipal(aGlobal.Get());
|
||||
|
||||
nsAutoCString url;
|
||||
nsresult rv = nsHostObjectProtocolHandler::AddDataEntry(aScheme, aObject,
|
||||
principal, url);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
global->RegisterHostObjectURI(url);
|
||||
CopyASCIItoUTF16(url, aResult);
|
||||
}
|
||||
|
||||
void
|
||||
URL::RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
nsIPrincipal* principal = nsContentUtils::ObjectPrincipal(aGlobal.Get());
|
||||
|
||||
NS_LossyConvertUTF16toASCII asciiurl(aURL);
|
||||
|
||||
nsIPrincipal* urlPrincipal =
|
||||
nsHostObjectProtocolHandler::GetDataEntryPrincipal(asciiurl);
|
||||
|
||||
if (urlPrincipal && principal->Subsumes(urlPrincipal)) {
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
global->UnregisterHostObjectURI(asciiurl);
|
||||
nsHostObjectProtocolHandler::RemoveDataEntry(asciiurl);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetHref(nsAString& aHref) const
|
||||
{
|
||||
aHref.Truncate();
|
||||
|
||||
nsAutoCString href;
|
||||
nsresult rv = mURI->GetSpec(href);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF8toUTF16(href, aHref);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetHref(const nsAString& aHref, ErrorResult& aRv)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 href(aHref);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = ioService->NewURI(href, nullptr, nullptr, getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aHref);
|
||||
return;
|
||||
}
|
||||
|
||||
mURI = uri;
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetOrigin(nsAString& aOrigin) const
|
||||
{
|
||||
nsContentUtils::GetUTFOrigin(mURI, aOrigin);
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetProtocol(nsAString& aProtocol) const
|
||||
{
|
||||
nsAutoCString protocol;
|
||||
if (NS_SUCCEEDED(mURI->GetScheme(protocol))) {
|
||||
aProtocol.Truncate();
|
||||
}
|
||||
|
||||
CopyASCIItoUTF16(protocol, aProtocol);
|
||||
aProtocol.Append(char16_t(':'));
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetProtocol(const nsAString& aProtocol)
|
||||
{
|
||||
nsAString::const_iterator start, end;
|
||||
aProtocol.BeginReading(start);
|
||||
aProtocol.EndReading(end);
|
||||
nsAString::const_iterator iter(start);
|
||||
|
||||
FindCharInReadable(':', iter, end);
|
||||
|
||||
// Changing the protocol of a URL, changes the "nature" of the URI
|
||||
// implementation. In order to do this properly, we have to serialize the
|
||||
// existing URL and reparse it in a new object.
|
||||
nsCOMPtr<nsIURI> clone;
|
||||
nsresult rv = mURI->Clone(getter_AddRefs(clone));
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || !clone) {
|
||||
return;
|
||||
}
|
||||
|
||||
rv = clone->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString href;
|
||||
rv = clone->GetSpec(href);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), href);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
||||
mURI = uri;
|
||||
}
|
||||
|
||||
#define URL_GETTER( value, func ) \
|
||||
value.Truncate(); \
|
||||
nsAutoCString tmp; \
|
||||
nsresult rv = mURI->func(tmp); \
|
||||
if (NS_SUCCEEDED(rv)) { \
|
||||
CopyUTF8toUTF16(tmp, value); \
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetUsername(nsAString& aUsername) const
|
||||
{
|
||||
URL_GETTER(aUsername, GetUsername);
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetUsername(const nsAString& aUsername)
|
||||
{
|
||||
mURI->SetUsername(NS_ConvertUTF16toUTF8(aUsername));
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetPassword(nsAString& aPassword) const
|
||||
{
|
||||
URL_GETTER(aPassword, GetPassword);
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetPassword(const nsAString& aPassword)
|
||||
{
|
||||
mURI->SetPassword(NS_ConvertUTF16toUTF8(aPassword));
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetHost(nsAString& aHost) const
|
||||
{
|
||||
URL_GETTER(aHost, GetHostPort);
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetHost(const nsAString& aHost)
|
||||
{
|
||||
mURI->SetHostPort(NS_ConvertUTF16toUTF8(aHost));
|
||||
}
|
||||
|
||||
void
|
||||
URL::URLSearchParamsUpdated(URLSearchParams* aSearchParams)
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
MOZ_ASSERT(mSearchParams == aSearchParams);
|
||||
|
||||
nsAutoString search;
|
||||
mSearchParams->Serialize(search);
|
||||
SetSearchInternal(search);
|
||||
}
|
||||
|
||||
void
|
||||
URL::UpdateURLSearchParams()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString search;
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
if (url) {
|
||||
nsresult rv = url->GetQuery(search);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to get the query from a nsIURL.");
|
||||
}
|
||||
}
|
||||
|
||||
mSearchParams->ParseInput(search);
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetHostname(nsAString& aHostname) const
|
||||
{
|
||||
aHostname.Truncate();
|
||||
nsContentUtils::GetHostOrIPv6WithBrackets(mURI, aHostname);
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetHostname(const nsAString& aHostname)
|
||||
{
|
||||
// nsStandardURL returns NS_ERROR_UNEXPECTED for an empty hostname
|
||||
// The return code is silently ignored
|
||||
mURI->SetHost(NS_ConvertUTF16toUTF8(aHostname));
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetPort(nsAString& aPort) const
|
||||
{
|
||||
aPort.Truncate();
|
||||
|
||||
int32_t port;
|
||||
nsresult rv = mURI->GetPort(&port);
|
||||
if (NS_SUCCEEDED(rv) && port != -1) {
|
||||
nsAutoString portStr;
|
||||
portStr.AppendInt(port, 10);
|
||||
aPort.Assign(portStr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetPort(const nsAString& aPort)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoString portStr(aPort);
|
||||
int32_t port = -1;
|
||||
|
||||
// nsIURI uses -1 as default value.
|
||||
if (!portStr.IsEmpty()) {
|
||||
port = portStr.ToInteger(&rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mURI->SetPort(port);
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetPathname(nsAString& aPathname) const
|
||||
{
|
||||
aPathname.Truncate();
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
if (!url) {
|
||||
nsAutoCString path;
|
||||
nsresult rv = mURI->GetPath(path);
|
||||
if (NS_FAILED(rv)){
|
||||
// Do not throw! Not having a valid URI or URL should result in an empty
|
||||
// string.
|
||||
return;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(path, aPathname);
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString file;
|
||||
nsresult rv = url->GetFilePath(file);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF8toUTF16(file, aPathname);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetPathname(const nsAString& aPathname)
|
||||
{
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
if (!url) {
|
||||
// Ignore failures to be compatible with NS4.
|
||||
return;
|
||||
}
|
||||
|
||||
url->SetFilePath(NS_ConvertUTF16toUTF8(aPathname));
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetSearch(nsAString& aSearch) const
|
||||
{
|
||||
aSearch.Truncate();
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
if (!url) {
|
||||
// Do not throw! Not having a valid URI or URL should result in an empty
|
||||
// string.
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString search;
|
||||
nsresult rv = url->GetQuery(search);
|
||||
if (NS_SUCCEEDED(rv) && !search.IsEmpty()) {
|
||||
CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, aSearch);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetSearch(const nsAString& aSearch)
|
||||
{
|
||||
SetSearchInternal(aSearch);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetSearchInternal(const nsAString& aSearch)
|
||||
{
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
if (!url) {
|
||||
// Ignore failures to be compatible with NS4.
|
||||
return;
|
||||
}
|
||||
|
||||
url->SetQuery(NS_ConvertUTF16toUTF8(aSearch));
|
||||
}
|
||||
|
||||
URLSearchParams*
|
||||
URL::SearchParams()
|
||||
{
|
||||
CreateSearchParamsIfNeeded();
|
||||
return mSearchParams;
|
||||
}
|
||||
|
||||
void
|
||||
URL::GetHash(nsAString& aHash) const
|
||||
{
|
||||
aHash.Truncate();
|
||||
|
||||
nsAutoCString ref;
|
||||
nsresult rv = mURI->GetRef(ref);
|
||||
if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) {
|
||||
aHash.Assign(char16_t('#'));
|
||||
if (nsContentUtils::GettersDecodeURLHash()) {
|
||||
NS_UnescapeURL(ref); // XXX may result in random non-ASCII bytes!
|
||||
}
|
||||
AppendUTF8toUTF16(ref, aHash);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URL::SetHash(const nsAString& aHash)
|
||||
{
|
||||
mURI->SetRef(NS_ConvertUTF16toUTF8(aHash));
|
||||
}
|
||||
|
||||
bool IsChromeURI(nsIURI* aURI)
|
||||
{
|
||||
bool isChrome = false;
|
||||
if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)))
|
||||
return isChrome;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
URL::CreateSearchParamsIfNeeded()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
mSearchParams = new URLSearchParams(mParent, this);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
173
dom/base/URL.h
173
dom/base/URL.h
|
@ -1,173 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 URL_h___
|
||||
#define URL_h___
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsISupports;
|
||||
class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
class DOMMediaStream;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Blob;
|
||||
class MediaSource;
|
||||
class GlobalObject;
|
||||
struct objectURLOptions;
|
||||
|
||||
namespace workers {
|
||||
class URLProxy;
|
||||
} // namespace workers
|
||||
|
||||
class URL final : public URLSearchParamsObserver
|
||||
, public nsWrapperCache
|
||||
{
|
||||
~URL() {}
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(URL)
|
||||
|
||||
URL(nsISupports* aParent, already_AddRefed<nsIURI> aURI);
|
||||
|
||||
// WebIDL methods
|
||||
nsISupports* GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
static already_AddRefed<URL>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
URL& aBase, ErrorResult& aRv);
|
||||
static already_AddRefed<URL>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
const Optional<nsAString>& aBase, ErrorResult& aRv);
|
||||
// Versions of Constructor that we can share with workers and other code.
|
||||
static already_AddRefed<URL>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
const nsAString& aBase, ErrorResult& aRv);
|
||||
static already_AddRefed<URL>
|
||||
Constructor(nsISupports* aParent, const nsAString& aUrl,
|
||||
const nsAString& aBase, ErrorResult& aRv);
|
||||
static already_AddRefed<URL>
|
||||
Constructor(nsISupports* aParent, const nsAString& aUrl,
|
||||
nsIURI* aBase, ErrorResult& aRv);
|
||||
|
||||
static void CreateObjectURL(const GlobalObject& aGlobal,
|
||||
Blob& aBlob,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError);
|
||||
static void CreateObjectURL(const GlobalObject& aGlobal,
|
||||
DOMMediaStream& aStream,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError);
|
||||
static void CreateObjectURL(const GlobalObject& aGlobal,
|
||||
MediaSource& aSource,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError);
|
||||
static void RevokeObjectURL(const GlobalObject& aGlobal,
|
||||
const nsAString& aURL,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void GetHref(nsAString& aHref) const;
|
||||
|
||||
void SetHref(const nsAString& aHref, ErrorResult& aRv);
|
||||
|
||||
void GetOrigin(nsAString& aOrigin) const;
|
||||
|
||||
void GetProtocol(nsAString& aProtocol) const;
|
||||
|
||||
void SetProtocol(const nsAString& aProtocol);
|
||||
|
||||
void GetUsername(nsAString& aUsername) const;
|
||||
|
||||
void SetUsername(const nsAString& aUsername);
|
||||
|
||||
void GetPassword(nsAString& aPassword) const;
|
||||
|
||||
void SetPassword(const nsAString& aPassword);
|
||||
|
||||
void GetHost(nsAString& aHost) const;
|
||||
|
||||
void SetHost(const nsAString& aHost);
|
||||
|
||||
void GetHostname(nsAString& aHostname) const;
|
||||
|
||||
void SetHostname(const nsAString& aHostname);
|
||||
|
||||
void GetPort(nsAString& aPort) const;
|
||||
|
||||
void SetPort(const nsAString& aPort);
|
||||
|
||||
void GetPathname(nsAString& aPathname) const;
|
||||
|
||||
void SetPathname(const nsAString& aPathname);
|
||||
|
||||
void GetSearch(nsAString& aRetval) const;
|
||||
|
||||
void SetSearch(const nsAString& aArg);
|
||||
|
||||
URLSearchParams* SearchParams();
|
||||
|
||||
void GetHash(nsAString& aRetval) const;
|
||||
|
||||
void SetHash(const nsAString& aArg);
|
||||
|
||||
void Stringify(nsAString& aRetval) const
|
||||
{
|
||||
GetHref(aRetval);
|
||||
}
|
||||
|
||||
// URLSearchParamsObserver
|
||||
void URLSearchParamsUpdated(URLSearchParams* aSearchParams) override;
|
||||
|
||||
private:
|
||||
nsIURI* GetURI() const
|
||||
{
|
||||
return mURI;
|
||||
}
|
||||
|
||||
void CreateSearchParamsIfNeeded();
|
||||
|
||||
void SetSearchInternal(const nsAString& aSearch);
|
||||
|
||||
void UpdateURLSearchParams();
|
||||
|
||||
static void CreateObjectURLInternal(const GlobalObject& aGlobal,
|
||||
nsISupports* aObject,
|
||||
const nsACString& aScheme,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult,
|
||||
ErrorResult& aError);
|
||||
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
RefPtr<URLSearchParams> mSearchParams;
|
||||
|
||||
friend class mozilla::dom::workers::URLProxy;
|
||||
};
|
||||
|
||||
bool IsChromeURI(nsIURI* aURI);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* URL_h___ */
|
|
@ -200,8 +200,6 @@ EXPORTS.mozilla.dom += [
|
|||
'SubtleCrypto.h',
|
||||
'Text.h',
|
||||
'TreeWalker.h',
|
||||
'URL.h',
|
||||
'URLSearchParams.h',
|
||||
'WebKitCSSMatrix.h',
|
||||
'WebSocket.h',
|
||||
'WindowOrientationObserver.h',
|
||||
|
@ -336,8 +334,6 @@ UNIFIED_SOURCES += [
|
|||
'TextInputProcessor.cpp',
|
||||
'ThirdPartyUtil.cpp',
|
||||
'TreeWalker.cpp',
|
||||
'URL.cpp',
|
||||
'URLSearchParams.cpp',
|
||||
'WebKitCSSMatrix.cpp',
|
||||
'WebSocket.cpp',
|
||||
'WindowNamedPropertiesHandler.cpp',
|
||||
|
|
|
@ -1914,6 +1914,9 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
|||
case QUERY_CHARACTER_AT_POINT:
|
||||
message = eQueryCharacterAtPoint;
|
||||
break;
|
||||
case QUERY_TEXT_RECT_ARRAY:
|
||||
message = eQueryTextRectArray;
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
@ -2031,6 +2034,9 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
|||
case eQuerySelectedText:
|
||||
queryEvent.InitForQuerySelectedText(selectionType, options);
|
||||
break;
|
||||
case eQueryTextRectArray:
|
||||
queryEvent.InitForQueryTextRectArray(aOffset, aLength, options);
|
||||
break;
|
||||
default:
|
||||
queryEvent.Init(options);
|
||||
break;
|
||||
|
|
|
@ -284,7 +284,6 @@ static bool gMouseDown = false;
|
|||
static bool gDragServiceDisabled = false;
|
||||
static FILE *gDumpFile = nullptr;
|
||||
static uint32_t gSerialCounter = 0;
|
||||
static uint32_t gTimeoutsRecentlySet = 0;
|
||||
static TimeStamp gLastRecordedRecentTimeouts;
|
||||
#define STATISTICS_INTERVAL (30 * PR_MSEC_PER_SEC)
|
||||
|
||||
|
@ -9236,8 +9235,6 @@ nsGlobalWindow::ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgumen
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(Telemetry::DOM_WINDOW_SHOWMODALDIALOG_USED, true);
|
||||
|
||||
RefPtr<DialogValueHolder> argHolder =
|
||||
new DialogValueHolder(nsContentUtils::SubjectPrincipal(), aArgument);
|
||||
|
||||
|
@ -12076,7 +12073,6 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
|
|||
timeout->mPrincipal = ourPrincipal;
|
||||
}
|
||||
|
||||
++gTimeoutsRecentlySet;
|
||||
TimeDuration delta = TimeDuration::FromMilliseconds(realInterval);
|
||||
|
||||
if (!IsFrozen() && !mTimeoutsSuspendDepth) {
|
||||
|
@ -12459,9 +12455,6 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
|||
TimeDuration recordingInterval = TimeDuration::FromMilliseconds(STATISTICS_INTERVAL);
|
||||
if (gLastRecordedRecentTimeouts.IsNull() ||
|
||||
now - gLastRecordedRecentTimeouts > recordingInterval) {
|
||||
uint32_t count = gTimeoutsRecentlySet;
|
||||
gTimeoutsRecentlySet = 0;
|
||||
Telemetry::Accumulate(Telemetry::DOM_TIMERS_RECENTLY_SET, count);
|
||||
gLastRecordedRecentTimeouts = now;
|
||||
}
|
||||
|
||||
|
@ -12481,8 +12474,6 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
|||
// the logic in ResetTimersForNonBackgroundWindow will need to change.
|
||||
mTimeoutInsertionPoint = dummy_timeout;
|
||||
|
||||
Telemetry::AutoCounter<Telemetry::DOM_TIMERS_FIRED_PER_NATIVE_TIMEOUT> timeoutsRan;
|
||||
|
||||
for (nsTimeout *timeout = mTimeouts.getFirst();
|
||||
timeout != dummy_timeout && !IsFrozen();
|
||||
timeout = nextTimeout) {
|
||||
|
@ -12516,7 +12507,6 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
|||
}
|
||||
|
||||
// This timeout is good to run
|
||||
++timeoutsRan;
|
||||
bool timeout_was_cleared = RunTimeoutHandler(timeout, scx);
|
||||
|
||||
if (timeout_was_cleared) {
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
* 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 "nsQueryContentEventResult.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -199,9 +200,30 @@ nsQueryContentEventResult::GetTentativeCaretOffsetNotFound(bool* aNotFound)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsQueryContentEventResult::GetCharacterRect(int32_t aOffset,
|
||||
int32_t* aLeft, int32_t* aTop,
|
||||
int32_t* aWidth, int32_t* aHeight)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
|
||||
NS_ENSURE_TRUE(mEventMessage == eQueryTextRectArray,
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
if (NS_WARN_IF(mRectArray.Length() <= static_cast<uint32_t>(aOffset))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aLeft = mRectArray[aOffset].x;
|
||||
*aTop = mRectArray[aOffset].y;
|
||||
*aWidth = mRectArray[aOffset].width;
|
||||
*aHeight = mRectArray[aOffset].height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
|
||||
const WidgetQueryContentEvent &aEvent)
|
||||
WidgetQueryContentEvent &aEvent)
|
||||
{
|
||||
mEventMessage = aEvent.mMessage;
|
||||
mSucceeded = aEvent.mSucceeded;
|
||||
|
@ -210,6 +232,9 @@ nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
|
|||
mOffset = aEvent.mReply.mOffset;
|
||||
mTentativeCaretOffset = aEvent.mReply.mTentativeCaretOffset;
|
||||
mString = aEvent.mReply.mString;
|
||||
mRectArray = mozilla::Move(aEvent.mReply.mRectArray);
|
||||
// Mark as result that is longer used.
|
||||
aEvent.mSucceeded = false;
|
||||
|
||||
if (!IsRectRelatedPropertyAvailable(mEventMessage) ||
|
||||
!aWidget || !mSucceeded) {
|
||||
|
@ -225,4 +250,7 @@ nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
|
|||
LayoutDeviceIntPoint offset =
|
||||
aWidget->WidgetToScreenOffset() - topWidget->WidgetToScreenOffset();
|
||||
mRect.MoveBy(-offset);
|
||||
for (size_t i = 0; i < mRectArray.Length(); i++) {
|
||||
mRectArray[i].MoveBy(-offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
NS_DECL_NSIQUERYCONTENTEVENTRESULT
|
||||
|
||||
void SetEventResult(nsIWidget* aWidget,
|
||||
const mozilla::WidgetQueryContentEvent &aEvent);
|
||||
mozilla::WidgetQueryContentEvent& aEvent);
|
||||
|
||||
protected:
|
||||
~nsQueryContentEventResult();
|
||||
|
@ -35,6 +35,7 @@ protected:
|
|||
uint32_t mTentativeCaretOffset;
|
||||
nsString mString;
|
||||
mozilla::LayoutDeviceIntRect mRect;
|
||||
nsTArray<mozilla::LayoutDeviceIntRect> mRectArray;
|
||||
|
||||
bool mSucceeded;
|
||||
bool mReversed;
|
||||
|
|
|
@ -240,9 +240,6 @@ nsRange::~nsRange()
|
|||
{
|
||||
NS_ASSERTION(!IsInSelection(), "deleting nsRange that is in use");
|
||||
|
||||
// Maybe we can remove Detach() -- bug 702948.
|
||||
Telemetry::Accumulate(Telemetry::DOM_RANGE_DETACHED, mIsDetached);
|
||||
|
||||
// we want the side effects (releases and list removals)
|
||||
DoSetRange(nullptr, 0, nullptr, 0, nullptr);
|
||||
}
|
||||
|
@ -252,7 +249,6 @@ nsRange::nsRange(nsINode* aNode)
|
|||
, mStartOffset(0)
|
||||
, mEndOffset(0)
|
||||
, mIsPositioned(false)
|
||||
, mIsDetached(false)
|
||||
, mMaySpanAnonymousSubtrees(false)
|
||||
, mIsGenerated(false)
|
||||
, mStartOffsetWasIncremented(false)
|
||||
|
@ -2824,8 +2820,6 @@ nsRange::ToString(nsAString& aReturn)
|
|||
NS_IMETHODIMP
|
||||
nsRange::Detach()
|
||||
{
|
||||
// No-op, but still set mIsDetached for telemetry (bug 702948)
|
||||
mIsDetached = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,6 @@ protected:
|
|||
int32_t mEndOffset;
|
||||
|
||||
bool mIsPositioned : 1;
|
||||
bool mIsDetached : 1;
|
||||
bool mMaySpanAnonymousSubtrees : 1;
|
||||
bool mIsGenerated : 1;
|
||||
bool mStartOffsetWasIncremented : 1;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
file_url.jsm
|
||||
file_empty.html
|
||||
file_bug945152.jar
|
||||
file_bug945152_worker.js
|
||||
|
@ -11,7 +10,6 @@ support-files =
|
|||
[test_bug715041.xul]
|
||||
[test_bug715041_removal.xul]
|
||||
[test_domrequesthelper.xul]
|
||||
[test_url.xul]
|
||||
[test_navigator_resolve_identity_xrays.xul]
|
||||
support-files = file_navigator_resolve_identity_xrays.xul
|
||||
[test_sendQueryContentAndSelectionSetEvent.html]
|
||||
|
|
|
@ -794,15 +794,6 @@ skip-if = e10s || buildapp == 'b2g' # Bug 1156489.
|
|||
[test_textnode_split_in_selection.html]
|
||||
[test_title.html]
|
||||
[test_treewalker_nextsibling.xml]
|
||||
[test_unknown_url_origin.html]
|
||||
[test_url.html]
|
||||
[test_url_data.html]
|
||||
[test_url_empty_port.html]
|
||||
[test_url_malformedHost.html]
|
||||
[test_urlExceptions.html]
|
||||
[test_urlSearchParams.html]
|
||||
[test_urlSearchParams_utf8.html]
|
||||
[test_urlutils_stringify.html]
|
||||
[test_user_select.html]
|
||||
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_viewport_scroll.html]
|
||||
|
|
|
@ -117,6 +117,32 @@ function runTests()
|
|||
is(result.width, textRectNative.width,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT) should return same width as calling with QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK");
|
||||
|
||||
// QueryTextRectArray
|
||||
var textRectArray = gUtils.sendQueryContentEvent(gUtils.QUERY_TEXT_RECT_ARRAY, 1, 2, 0, 0);
|
||||
ok(textRectArray.succeeded,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should succeed");
|
||||
var textRect = gUtils.sendQueryContentEvent(gUtils.QUERY_TEXT_RECT, 1, 2, 0, 0);
|
||||
ok(textRect.succeeded,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT) should succeed");
|
||||
var left = {};
|
||||
var top = {};
|
||||
var width = {};
|
||||
var height = {};
|
||||
var left2 = {};
|
||||
var top2 = {};
|
||||
var width2 = {};
|
||||
var height2 = {};
|
||||
textRectArray.getCharacterRect(0, left, top, width, height);
|
||||
ok(textRect.top, top.value,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same top that returns QUERY_TEXT_RECT");
|
||||
ok(textRect.left, left.value,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same left that returns QUERY_TEXT_RECT");
|
||||
textRectArray.getCharacterRect(1, left2, top2, width2, height2);
|
||||
ok(textRect.width, width.value + width2.value,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same width that QUERY_TEXT_RECT is returned for offset 1 and 2");
|
||||
ok(textRect.height, height.value,
|
||||
"sendQueryContentEvent(QUERY_TEXT_RECT_ARRAY) should return same height that returns QUERY_TEXT_RECT");
|
||||
|
||||
// QueryCharacterAtOffset
|
||||
result = gUtils.sendQueryContentEvent(gUtils.QUERY_CHARACTER_AT_POINT, 0, 0, textRectNative.left + 1, textRectNative.top + 1,
|
||||
gUtils.QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
|
||||
|
|
|
@ -185,10 +185,6 @@ IsDOMObject(JSObject* obj)
|
|||
mozilla::dom::UnwrapObject<mozilla::dom::prototypes::id::Interface, \
|
||||
mozilla::dom::Interface##Binding::NativeType>(obj, value)
|
||||
|
||||
#define UNWRAP_WORKER_OBJECT(Interface, obj, value) \
|
||||
UnwrapObject<prototypes::id::Interface##_workers, \
|
||||
mozilla::dom::Interface##Binding_workers::NativeType>(obj, value)
|
||||
|
||||
// Some callers don't want to set an exception when unwrapping fails
|
||||
// (for example, overload resolution uses unwrapping to tell what sort
|
||||
// of thing it's looking at).
|
||||
|
|
|
@ -364,7 +364,6 @@ DOMInterfaces = {
|
|||
|
||||
'DedicatedWorkerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'workers': True,
|
||||
},
|
||||
|
||||
'DeviceAcceleration': {
|
||||
|
@ -434,12 +433,6 @@ DOMInterfaces = {
|
|||
'register': False,
|
||||
},
|
||||
|
||||
'DummyInterfaceWorkers': {
|
||||
'skipGen': True,
|
||||
'register': False,
|
||||
'workers': True
|
||||
},
|
||||
|
||||
'DynamicsCompressorNode': {
|
||||
'binaryNames': {
|
||||
'release': 'getRelease'
|
||||
|
@ -965,7 +958,6 @@ DOMInterfaces = {
|
|||
|
||||
'ServiceWorkerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'workers': True,
|
||||
},
|
||||
|
||||
'ServiceWorkerRegistration': {
|
||||
|
@ -980,7 +972,6 @@ DOMInterfaces = {
|
|||
|
||||
'SharedWorkerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'workers': True,
|
||||
},
|
||||
|
||||
'Storage': {
|
||||
|
@ -1281,11 +1272,6 @@ DOMInterfaces = {
|
|||
'implicitJSContext' : [ 'undo', 'redo', 'transact' ],
|
||||
},
|
||||
|
||||
'URL' : [{},
|
||||
{
|
||||
'workers': True,
|
||||
}],
|
||||
|
||||
'VRDevice': {
|
||||
'concrete': False
|
||||
},
|
||||
|
@ -1557,7 +1543,6 @@ DOMInterfaces = {
|
|||
|
||||
'WorkerDebuggerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'nativeType': 'mozilla::dom::workers::WorkerDebuggerGlobalScope',
|
||||
'implicitJSContext': [
|
||||
'dump', 'global', 'reportError', 'setConsoleEventHandler',
|
||||
],
|
||||
|
@ -1565,7 +1550,6 @@ DOMInterfaces = {
|
|||
|
||||
'WorkerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'workers': True,
|
||||
'concrete': False,
|
||||
'implicitJSContext': [
|
||||
'close',
|
||||
|
|
|
@ -116,8 +116,7 @@ class Configuration:
|
|||
(mainCallbacks, mainDictionaries) = findCallbacksAndDictionaries(mainTypes)
|
||||
|
||||
workerTypes = set()
|
||||
for descriptor in ([self.getDescriptor("DummyInterfaceWorkers", workers=True)] +
|
||||
self.getDescriptors(workers=True, isExternal=False, skipGen=False)):
|
||||
for descriptor in (self.getDescriptors(workers=True, isExternal=False, skipGen=False)):
|
||||
workerTypes |= set(getFlatTypes(getTypesFromDescriptor(descriptor)))
|
||||
(workerCallbacks, workerDictionaries) = findCallbacksAndDictionaries(workerTypes)
|
||||
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
interface DummyInterface {};
|
||||
interface DummyInterfaceWorkers {};
|
||||
|
|
|
@ -1199,6 +1199,8 @@ ContentEventHandler::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
|
|||
return OnQueryCaretRect(aEvent);
|
||||
case eQueryTextRect:
|
||||
return OnQueryTextRect(aEvent);
|
||||
case eQueryTextRectArray:
|
||||
return OnQueryTextRectArray(aEvent);
|
||||
case eQueryEditorRect:
|
||||
return OnQueryEditorRect(aEvent);
|
||||
case eQueryContentState:
|
||||
|
@ -1393,6 +1395,85 @@ static nsINode* AdjustTextRectNode(nsINode* aNode,
|
|||
return node;
|
||||
}
|
||||
|
||||
static
|
||||
nsIFrame*
|
||||
GetFirstFrameInRange(nsRange* aRange)
|
||||
{
|
||||
// used to iterate over all contents and their frames
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewContentIterator();
|
||||
iter->Init(aRange);
|
||||
|
||||
// get the starting frame
|
||||
int32_t nodeOffset = aRange->StartOffset();
|
||||
nsINode* node = iter->GetCurrentNode();
|
||||
if (!node) {
|
||||
node = AdjustTextRectNode(aRange->GetStartParent(), nodeOffset);
|
||||
}
|
||||
nsIFrame* firstFrame = nullptr;
|
||||
GetFrameForTextRect(node, nodeOffset, true, &firstFrame);
|
||||
return firstFrame;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ContentEventHandler::OnQueryTextRectArray(WidgetQueryContentEvent* aEvent)
|
||||
{
|
||||
nsresult rv = Init(aEvent);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
LineBreakType lineBreakType = GetLineBreakType(aEvent);
|
||||
RefPtr<nsRange> range = new nsRange(mRootContent);
|
||||
uint32_t offset = aEvent->mInput.mOffset;
|
||||
|
||||
LayoutDeviceIntRect rect;
|
||||
WritingMode writingMode;
|
||||
while (aEvent->mInput.mLength > aEvent->mReply.mRectArray.Length()) {
|
||||
rv = SetRangeFromFlatTextOffset(range, offset, 1, lineBreakType, true,
|
||||
nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// get the starting frame
|
||||
nsIFrame* firstFrame = GetFirstFrameInRange(range);
|
||||
if (NS_WARN_IF(!firstFrame)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// get the starting frame rect
|
||||
nsRect frameRect(nsPoint(0, 0), firstFrame->GetRect().Size());
|
||||
rv = ConvertToRootRelativeOffset(firstFrame, frameRect);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
int32_t nodeOffset = range->StartOffset();
|
||||
AutoTArray<nsRect, 16> charRects;
|
||||
rv = firstFrame->GetCharacterRectsInRange(
|
||||
nodeOffset,
|
||||
aEvent->mInput.mLength - aEvent->mReply.mRectArray.Length(),
|
||||
charRects);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < charRects.Length(); i++) {
|
||||
nsRect charRect = charRects[i];
|
||||
charRect.x += frameRect.x;
|
||||
charRect.y += frameRect.y;
|
||||
|
||||
rect = LayoutDeviceIntRect::FromUnknownRect(
|
||||
charRect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
|
||||
|
||||
aEvent->mReply.mRectArray.AppendElement(rect);
|
||||
}
|
||||
offset += charRects.Length();
|
||||
}
|
||||
aEvent->mSucceeded = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ContentEventHandler::OnQueryTextRect(WidgetQueryContentEvent* aEvent)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
nsresult OnQueryCaretRect(WidgetQueryContentEvent* aEvent);
|
||||
// eQueryTextRect event handler
|
||||
nsresult OnQueryTextRect(WidgetQueryContentEvent* aEvent);
|
||||
// eQueryTextRectArray event handler
|
||||
nsresult OnQueryTextRectArray(WidgetQueryContentEvent* aEvent);
|
||||
// eQueryEditorRect event handler
|
||||
nsresult OnQueryEditorRect(WidgetQueryContentEvent* aEvent);
|
||||
// eQueryContentState event handler
|
||||
|
@ -299,6 +301,9 @@ protected:
|
|||
FontRangeArray& aFontRanges,
|
||||
uint32_t& aLength,
|
||||
LineBreakType aLineBreakType);
|
||||
nsresult QueryTextRectByRange(nsRange* aRange,
|
||||
LayoutDeviceIntRect& aRect,
|
||||
WritingMode& aWritingMode);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -860,6 +860,7 @@ EventStateManager::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
|
|||
case eQuerySelectionAsTransferable:
|
||||
case eQueryCharacterAtPoint:
|
||||
case eQueryDOMWidgetHittest:
|
||||
case eQueryTextRectArray:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/URL.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/workers/bindings/URL.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#include "WorkerPrivate.h"
|
||||
|
@ -174,7 +173,7 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
|||
CopyUTF8toUTF16(spec, aRequestURL);
|
||||
}
|
||||
|
||||
already_AddRefed<workers::URL>
|
||||
already_AddRefed<URL>
|
||||
ParseURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
@ -183,8 +182,7 @@ ParseURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
|||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
NS_ConvertUTF8toUTF16 baseURL(worker->GetLocationInfo().mHref);
|
||||
RefPtr<workers::URL> url =
|
||||
workers::URL::Constructor(aGlobal, aInput, baseURL, aRv);
|
||||
RefPtr<URL> url = URL::WorkerConstructor(aGlobal, aInput, baseURL, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
|
||||
}
|
||||
|
@ -195,7 +193,7 @@ void
|
|||
GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
nsAString& aRequestURL, ErrorResult& aRv)
|
||||
{
|
||||
RefPtr<workers::URL> url = ParseURLFromWorker(aGlobal, aInput, aRv);
|
||||
RefPtr<URL> url = ParseURLFromWorker(aGlobal, aInput, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
@ -379,7 +377,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
RefPtr<workers::URL> url = ParseURLFromWorker(aGlobal, referrer, aRv);
|
||||
RefPtr<URL> url = ParseURLFromWorker(aGlobal, referrer, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
|
||||
return nullptr;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "mozilla/dom/Headers.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/URL.h"
|
||||
#include "mozilla/dom/workers/bindings/URL.h"
|
||||
|
||||
#include "nsDOMString.h"
|
||||
|
||||
|
@ -88,8 +87,7 @@ Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
|
|||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
NS_ConvertUTF8toUTF16 baseURL(worker->GetLocationInfo().mHref);
|
||||
RefPtr<workers::URL> url =
|
||||
workers::URL::Constructor(aGlobal, aUrl, baseURL, aRv);
|
||||
RefPtr<URL> url = URL::WorkerConstructor(aGlobal, aUrl, baseURL, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1780,6 +1780,10 @@ HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
container->RadioRequiredWillChange(name, !!aValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (aName == nsGkAtoms::webkitdirectory) {
|
||||
Telemetry::Accumulate(Telemetry::WEBKIT_DIRECTORY_USED, true);
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
||||
|
@ -8379,6 +8383,7 @@ HTMLInputElement::UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrD
|
|||
void
|
||||
HTMLInputElement::GetWebkitEntries(nsTArray<RefPtr<Entry>>& aSequence)
|
||||
{
|
||||
Telemetry::Accumulate(Telemetry::BLINK_FILESYSTEM_USED, true);
|
||||
aSequence.AppendElements(mEntries);
|
||||
}
|
||||
|
||||
|
|
|
@ -230,6 +230,7 @@ TextTrackManager::UpdateCueDisplay()
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIContent> overlay = videoFrame->GetCaptionOverlay();
|
||||
nsCOMPtr<nsIContent> controls = videoFrame->GetVideoControls();
|
||||
if (!overlay) {
|
||||
return;
|
||||
}
|
||||
|
@ -247,7 +248,7 @@ TextTrackManager::UpdateCueDisplay()
|
|||
|
||||
nsPIDOMWindowInner* window = mMediaElement->OwnerDoc()->GetInnerWindow();
|
||||
if (window) {
|
||||
sParserWrapper->ProcessCues(window, jsCues, overlay);
|
||||
sParserWrapper->ProcessCues(window, jsCues, overlay, controls);
|
||||
}
|
||||
} else if (overlay->Length() > 0) {
|
||||
nsContentUtils::SetNodeTextContent(overlay, EmptyString(), true);
|
||||
|
@ -296,6 +297,10 @@ TextTrackManager::AddListeners()
|
|||
if (mMediaElement) {
|
||||
mMediaElement->AddEventListener(NS_LITERAL_STRING("resizevideocontrols"),
|
||||
this, false, false);
|
||||
mMediaElement->AddEventListener(NS_LITERAL_STRING("seeked"),
|
||||
this, false, false);
|
||||
mMediaElement->AddEventListener(NS_LITERAL_STRING("controlbarchange"),
|
||||
this, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,11 +410,17 @@ TextTrackManager::HandleEvent(nsIDOMEvent* aEvent)
|
|||
|
||||
nsAutoString type;
|
||||
aEvent->GetType(type);
|
||||
if (type.EqualsLiteral("resizevideocontrols")) {
|
||||
if (type.EqualsLiteral("resizevideocontrols") ||
|
||||
type.EqualsLiteral("seeked")) {
|
||||
for (uint32_t i = 0; i< mTextTracks->Length(); i++) {
|
||||
((*mTextTracks)[i])->SetCuesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
if (type.EqualsLiteral("controlbarchange")) {
|
||||
UpdateCueDisplay();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ namespace {
|
|||
nsresult
|
||||
GetKeyFromJSVal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
Key& aKey,
|
||||
bool aAllowUnset = false)
|
||||
Key& aKey)
|
||||
{
|
||||
nsresult rv = aKey.SetFromJSVal(aCx, aVal);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -31,7 +30,7 @@ GetKeyFromJSVal(JSContext* aCx,
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (aKey.IsUnset() && !aAllowUnset) {
|
||||
if (aKey.IsUnset()) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
||||
}
|
||||
|
||||
|
@ -347,39 +346,38 @@ IDBKeyRange::Includes(JSContext* aCx,
|
|||
return false;
|
||||
}
|
||||
|
||||
switch (Key::CompareKeys(Lower(), key)) {
|
||||
case 1:
|
||||
return false;
|
||||
case 0:
|
||||
// Identical keys.
|
||||
if (LowerOpen()) {
|
||||
MOZ_ASSERT(!(Lower().IsUnset() && Upper().IsUnset()));
|
||||
MOZ_ASSERT_IF(IsOnly(),
|
||||
!Lower().IsUnset() && !LowerOpen() &&
|
||||
Lower() == Upper() && LowerOpen() == UpperOpen());
|
||||
|
||||
if (!Lower().IsUnset()) {
|
||||
switch (Key::CompareKeys(Lower(), key)) {
|
||||
case 1:
|
||||
return false;
|
||||
case 0:
|
||||
// Identical keys.
|
||||
return !LowerOpen();
|
||||
case -1:
|
||||
if (IsOnly()) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
if (IsOnly()) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
if (!IsOnly()) {
|
||||
if (!Upper().IsUnset()) {
|
||||
switch (Key::CompareKeys(key, Upper())) {
|
||||
case 1:
|
||||
return false;
|
||||
case 0:
|
||||
// Identical keys.
|
||||
if (UpperOpen()) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
return !UpperOpen();
|
||||
case -1:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(key == Lower());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1213,6 +1213,17 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
*/
|
||||
const unsigned long QUERY_CHARACTER_AT_POINT = 3208;
|
||||
|
||||
/**
|
||||
* QUERY_TEXT_RECT_ARRAY queries the rects per character
|
||||
*
|
||||
* @param aOffset The first character's offset. 0 is the first character.
|
||||
* @param aLength The length of getting text. If the aLength is too long,
|
||||
* the extra length is ignored.
|
||||
* @param aX Not used.
|
||||
* @param aY Not used.
|
||||
*/
|
||||
const unsigned long QUERY_TEXT_RECT_ARRAY = 3209;
|
||||
|
||||
/**
|
||||
* Called when the remote child frame has changed its fullscreen state,
|
||||
* when entering fullscreen, and when the origin which is fullscreen changes.
|
||||
|
|
|
@ -24,6 +24,10 @@ interface nsIQueryContentEventResult : nsISupports
|
|||
readonly attribute long height;
|
||||
readonly attribute AString text;
|
||||
|
||||
void getCharacterRect(in long offset,
|
||||
out long left, out long top,
|
||||
out long width, out long height);
|
||||
|
||||
readonly attribute boolean succeeded;
|
||||
readonly attribute boolean notFound;
|
||||
readonly attribute boolean tentativeCaretOffsetNotFound;
|
||||
|
|
|
@ -340,7 +340,7 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
|
|||
// Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING.
|
||||
for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) {
|
||||
NS_DispatchToMainThread(
|
||||
new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, NS_LITERAL_STRING("cenc")));
|
||||
new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, crypto->mInitDatas[i].mType));
|
||||
}
|
||||
#endif // MOZ_EME
|
||||
mInfo.mCrypto = *crypto;
|
||||
|
|
|
@ -18,8 +18,13 @@ QueueObject::~QueueObject() {}
|
|||
void
|
||||
QueueObject::Dispatch(nsIRunnable* aRunnable)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable = aRunnable;
|
||||
mThread->Dispatch(runnable.forget());
|
||||
Dispatch(do_AddRef(aRunnable));
|
||||
}
|
||||
|
||||
void
|
||||
QueueObject::Dispatch(already_AddRefed<nsIRunnable> aRunnable)
|
||||
{
|
||||
mThread->Dispatch(Move(aRunnable));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
explicit QueueObject(RefPtr<AbstractThread> aThread);
|
||||
~QueueObject();
|
||||
void Dispatch(nsIRunnable* aRunnable);
|
||||
void Dispatch(already_AddRefed<nsIRunnable> aRunnable);
|
||||
bool OnThread();
|
||||
AbstractThread* Thread();
|
||||
|
||||
|
|
|
@ -490,4 +490,41 @@ IsAACContentType(const nsAString& aContentType)
|
|||
});
|
||||
}
|
||||
|
||||
bool
|
||||
IsVorbisContentType(const nsAString& aContentType)
|
||||
{
|
||||
return CheckContentType(aContentType,
|
||||
[](const nsAString& type) {
|
||||
return type.EqualsLiteral("audio/webm") ||
|
||||
type.EqualsLiteral("audio/ogg");
|
||||
},
|
||||
[](const nsAString& codec) {
|
||||
return codec.EqualsLiteral("vorbis");
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
IsVP8ContentType(const nsAString& aContentType)
|
||||
{
|
||||
return CheckContentType(aContentType,
|
||||
[](const nsAString& type) {
|
||||
return type.EqualsLiteral("video/webm");
|
||||
},
|
||||
[](const nsAString& codec) {
|
||||
return codec.EqualsLiteral("vp8");
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
IsVP9ContentType(const nsAString& aContentType)
|
||||
{
|
||||
return CheckContentType(aContentType,
|
||||
[](const nsAString& type) {
|
||||
return type.EqualsLiteral("video/webm");
|
||||
},
|
||||
[](const nsAString& codec) {
|
||||
return codec.EqualsLiteral("vp9");
|
||||
});
|
||||
}
|
||||
|
||||
} // end namespace mozilla
|
||||
|
|
|
@ -447,6 +447,15 @@ StringListContains(const ListString& aList, const ItemString& aItem)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
IsVorbisContentType(const nsAString& aContentType);
|
||||
|
||||
bool
|
||||
IsVP8ContentType(const nsAString& aContentType);
|
||||
|
||||
bool
|
||||
IsVP9ContentType(const nsAString& aContentType);
|
||||
|
||||
} // end namespace mozilla
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "gmp-audio-decode.h"
|
||||
#include "gmp-video-decode.h"
|
||||
#include "DecoderDoctorDiagnostics.h"
|
||||
#include "WebMDecoder.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -411,15 +412,72 @@ GMPDecryptsAndGeckoDecodesAAC(mozIGeckoMediaPluginService* aGMPService,
|
|||
return MP4Decoder::CanHandleMediaType(aContentType, aDiagnostics);
|
||||
}
|
||||
|
||||
static bool
|
||||
GMPDecryptsAndGeckoDecodesVorbis(mozIGeckoMediaPluginService* aGMPService,
|
||||
const nsAString& aKeySystem,
|
||||
const nsAString& aContentType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics)
|
||||
{
|
||||
MOZ_ASSERT(HaveGMPFor(aGMPService,
|
||||
NS_ConvertUTF16toUTF8(aKeySystem),
|
||||
NS_LITERAL_CSTRING(GMP_API_DECRYPTOR)));
|
||||
MOZ_ASSERT(IsVorbisContentType(aContentType));
|
||||
return !HaveGMPFor(aGMPService,
|
||||
NS_ConvertUTF16toUTF8(aKeySystem),
|
||||
NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER),
|
||||
NS_LITERAL_CSTRING("vorbis")) &&
|
||||
WebMDecoder::CanHandleMediaType(aContentType);
|
||||
}
|
||||
|
||||
static bool
|
||||
GMPDecryptsAndGeckoDecodesVP8(mozIGeckoMediaPluginService* aGMPService,
|
||||
const nsAString& aKeySystem,
|
||||
const nsAString& aContentType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics)
|
||||
{
|
||||
MOZ_ASSERT(HaveGMPFor(aGMPService,
|
||||
NS_ConvertUTF16toUTF8(aKeySystem),
|
||||
NS_LITERAL_CSTRING(GMP_API_DECRYPTOR)));
|
||||
MOZ_ASSERT(IsVP8ContentType(aContentType));
|
||||
return !HaveGMPFor(aGMPService,
|
||||
NS_ConvertUTF16toUTF8(aKeySystem),
|
||||
NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER),
|
||||
NS_LITERAL_CSTRING("vp8")) &&
|
||||
WebMDecoder::CanHandleMediaType(aContentType);
|
||||
}
|
||||
|
||||
static bool
|
||||
GMPDecryptsAndGeckoDecodesVP9(mozIGeckoMediaPluginService* aGMPService,
|
||||
const nsAString& aKeySystem,
|
||||
const nsAString& aContentType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics)
|
||||
{
|
||||
MOZ_ASSERT(HaveGMPFor(aGMPService,
|
||||
NS_ConvertUTF16toUTF8(aKeySystem),
|
||||
NS_LITERAL_CSTRING(GMP_API_DECRYPTOR)));
|
||||
MOZ_ASSERT(IsVP9ContentType(aContentType));
|
||||
return !HaveGMPFor(aGMPService,
|
||||
NS_ConvertUTF16toUTF8(aKeySystem),
|
||||
NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER),
|
||||
NS_LITERAL_CSTRING("vp9")) &&
|
||||
WebMDecoder::CanHandleMediaType(aContentType);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsSupportedAudio(mozIGeckoMediaPluginService* aGMPService,
|
||||
const nsAString& aKeySystem,
|
||||
const nsAString& aAudioType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics)
|
||||
{
|
||||
return IsAACContentType(aAudioType) &&
|
||||
(GMPDecryptsAndDecodesAAC(aGMPService, aKeySystem, aDiagnostics) ||
|
||||
GMPDecryptsAndGeckoDecodesAAC(aGMPService, aKeySystem, aAudioType, aDiagnostics));
|
||||
if (IsAACContentType(aAudioType)) {
|
||||
return GMPDecryptsAndDecodesAAC(aGMPService, aKeySystem, aDiagnostics) ||
|
||||
GMPDecryptsAndGeckoDecodesAAC(aGMPService, aKeySystem, aAudioType, aDiagnostics);
|
||||
}
|
||||
if (IsVorbisContentType(aAudioType) && aKeySystem.EqualsLiteral("org.w3.clearkey")) {
|
||||
// GMP does not decode Vorbis, so don't bother checking
|
||||
return GMPDecryptsAndGeckoDecodesVorbis(aGMPService, aKeySystem, aAudioType, aDiagnostics);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -428,9 +486,17 @@ IsSupportedVideo(mozIGeckoMediaPluginService* aGMPService,
|
|||
const nsAString& aVideoType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics)
|
||||
{
|
||||
return IsH264ContentType(aVideoType) &&
|
||||
(GMPDecryptsAndDecodesH264(aGMPService, aKeySystem, aDiagnostics) ||
|
||||
GMPDecryptsAndGeckoDecodesH264(aGMPService, aKeySystem, aVideoType, aDiagnostics));
|
||||
if (IsH264ContentType(aVideoType)) {
|
||||
return GMPDecryptsAndDecodesH264(aGMPService, aKeySystem, aDiagnostics) ||
|
||||
GMPDecryptsAndGeckoDecodesH264(aGMPService, aKeySystem, aVideoType, aDiagnostics);
|
||||
}
|
||||
if (IsVP8ContentType(aVideoType) && aKeySystem.EqualsLiteral("org.w3.clearkey")) {
|
||||
return GMPDecryptsAndGeckoDecodesVP8(aGMPService, aKeySystem, aVideoType, aDiagnostics);
|
||||
}
|
||||
if (IsVP9ContentType(aVideoType) && aKeySystem.EqualsLiteral("org.w3.clearkey")) {
|
||||
return GMPDecryptsAndGeckoDecodesVP9(aGMPService, aKeySystem, aVideoType, aDiagnostics);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -474,7 +540,7 @@ IsSupportedInitDataType(const nsString& aCandidate, const nsAString& aKeySystem)
|
|||
|| aKeySystem.EqualsLiteral("com.widevine.alpha")
|
||||
#endif
|
||||
) &&
|
||||
(aCandidate.EqualsLiteral("keyids") || aCandidate.EqualsLiteral("webm)")));
|
||||
(aCandidate.EqualsLiteral("keyids") || aCandidate.EqualsLiteral("webm")));
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -1050,7 +1050,8 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
|
|||
// Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING.
|
||||
for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) {
|
||||
NS_DispatchToMainThread(
|
||||
new DispatchKeyNeededEvent(mParentDecoder, crypto->mInitDatas[i].mInitData, NS_LITERAL_STRING("cenc")));
|
||||
new DispatchKeyNeededEvent(mParentDecoder, crypto->mInitDatas[i].mInitData,
|
||||
crypto->mInitDatas[i].mType));
|
||||
}
|
||||
#endif // MOZ_EME
|
||||
info.mCrypto = *crypto;
|
||||
|
|
Двоичный файл не отображается.
|
@ -0,0 +1 @@
|
|||
Cache-Control: no-store
|
Двоичный файл не отображается.
|
@ -0,0 +1 @@
|
|||
Cache-Control: no-store
|
Двоичный файл не отображается.
|
@ -0,0 +1 @@
|
|||
Cache-Control: no-store
|
|
@ -419,6 +419,7 @@ function SetupEMEPref(callback) {
|
|||
var prefs = [
|
||||
[ "media.mediasource.enabled", true ],
|
||||
[ "media.eme.apiVisible", true ],
|
||||
[ "media.mediasource.webm.enabled", true ],
|
||||
];
|
||||
|
||||
if (SpecialPowers.Services.appinfo.name == "B2G" ||
|
||||
|
|
|
@ -1349,6 +1349,56 @@ var gEMETests = [
|
|||
sessionCount:3,
|
||||
duration:1.60,
|
||||
},
|
||||
{
|
||||
name: "WebM vorbis audio & vp8 video clearkey",
|
||||
tracks: [
|
||||
{
|
||||
name:"audio",
|
||||
type:"audio/webm; codecs=\"vorbis\"",
|
||||
fragments:[ "bipbop_360w_253kbps-clearkey-audio.webm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"video",
|
||||
type:"video/webm; codecs=\"vp8\"",
|
||||
fragments:[ "bipbop_360w_253kbps-clearkey-video-vp8.webm",
|
||||
],
|
||||
},
|
||||
],
|
||||
keys: {
|
||||
// "keyid" : "key"
|
||||
"f1f3ee1790527e9de47217d43835f76a" : "97b9ddc459c8d5ff23c1f2754c95abe8",
|
||||
"8b5df745ad84145b5617c33116e35a67" : "bddfd35dd9be033ee73bc18bc1885056",
|
||||
},
|
||||
sessionType:"temporary",
|
||||
sessionCount:2,
|
||||
duration:1.60,
|
||||
},
|
||||
{
|
||||
name: "WebM vorbis audio & vp9 video clearkey",
|
||||
tracks: [
|
||||
{
|
||||
name:"audio",
|
||||
type:"audio/webm; codecs=\"vorbis\"",
|
||||
fragments:[ "bipbop_360w_253kbps-clearkey-audio.webm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"video",
|
||||
type:"video/webm; codecs=\"vp9\"",
|
||||
fragments:[ "bipbop_360w_253kbps-clearkey-video-vp9.webm",
|
||||
],
|
||||
},
|
||||
],
|
||||
keys: {
|
||||
// "keyid" : "key"
|
||||
"f1f3ee1790527e9de47217d43835f76a" : "97b9ddc459c8d5ff23c1f2754c95abe8",
|
||||
"eedf63a94fa7c398ee094f123a4ee709" : "973b679a746c82f3acdb856b30e9378e",
|
||||
},
|
||||
sessionType:"temporary",
|
||||
sessionCount:2,
|
||||
duration:1.60,
|
||||
},
|
||||
];
|
||||
|
||||
var gEMENonMSEFailTests = [
|
||||
|
|
|
@ -182,6 +182,12 @@ support-files =
|
|||
bipbop_360w_253kbps-cenc-video-key2-1.m4s^headers^
|
||||
bipbop_360w_253kbps-cenc-video-key2-init.mp4
|
||||
bipbop_360w_253kbps-cenc-video-key2-init.mp4^headers^
|
||||
bipbop_360w_253kbps-clearkey-audio.webm
|
||||
bipbop_360w_253kbps-clearkey-audio.webm^headers^
|
||||
bipbop_360w_253kbps-clearkey-video-vp8.webm
|
||||
bipbop_360w_253kbps-clearkey-video-vp8.webm^headers^
|
||||
bipbop_360w_253kbps-clearkey-video-vp9.webm
|
||||
bipbop_360w_253kbps-clearkey-video-vp9.webm^headers^
|
||||
bipbop_480_624kbps-cenc-audio-key1-1.m4s
|
||||
bipbop_480_624kbps-cenc-audio-key1-1.m4s^headers^
|
||||
bipbop_480_624kbps-cenc-audio-key1-2.m4s
|
||||
|
|
|
@ -390,12 +390,84 @@ var tests = [
|
|||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: 'WebM CLEARKEY_ID not supported',
|
||||
name: 'Basic WebM video',
|
||||
keySystem: CLEARKEY_ID,
|
||||
options: [
|
||||
{
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm'}],
|
||||
}
|
||||
],
|
||||
expectedConfig: {
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm'}],
|
||||
},
|
||||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: 'Basic WebM audio',
|
||||
keySystem: CLEARKEY_ID,
|
||||
options: [
|
||||
{
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
audioCapabilities: [{contentType: 'audio/webm'}],
|
||||
}
|
||||
],
|
||||
expectedConfig: {
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
audioCapabilities: [{contentType: 'audio/webm'}],
|
||||
},
|
||||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: 'Webm with Vorbis audio and VP8 video.',
|
||||
keySystem: CLEARKEY_ID,
|
||||
options: [
|
||||
{
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm;codecs="vp8"'}],
|
||||
audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
|
||||
}
|
||||
],
|
||||
expectedConfig: {
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm;codecs="vp8"'}],
|
||||
audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
|
||||
},
|
||||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: 'Webm with Vorbis audio and VP9 video.',
|
||||
keySystem: CLEARKEY_ID,
|
||||
options: [
|
||||
{
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm;codecs="vp9"'}],
|
||||
audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
|
||||
}
|
||||
],
|
||||
expectedConfig: {
|
||||
label: SUPPORTED_LABEL,
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm;codecs="vp9"'}],
|
||||
audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
|
||||
},
|
||||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: 'Webm with bogus video.',
|
||||
keySystem: CLEARKEY_ID,
|
||||
options: [
|
||||
{
|
||||
initDataTypes: ['webm'],
|
||||
videoCapabilities: [{contentType: 'video/webm'}],
|
||||
videoCapabilities: [{contentType: 'video/webm;codecs="bogus"'}],
|
||||
}
|
||||
],
|
||||
shouldPass: false,
|
||||
|
|
|
@ -54,9 +54,9 @@ WebVTTParserWrapper.prototype =
|
|||
return WebVTT.convertCueToDOMTree(window, cue.text);
|
||||
},
|
||||
|
||||
processCues: function(window, cues, overlay)
|
||||
processCues: function(window, cues, overlay, controls)
|
||||
{
|
||||
WebVTT.processCues(window, cues, overlay);
|
||||
WebVTT.processCues(window, cues, overlay, controls);
|
||||
},
|
||||
|
||||
classDescription: "Wrapper for the JS WebVTT implementation (vtt.js)",
|
||||
|
|
|
@ -77,9 +77,10 @@ interface nsIWebVTTParserWrapper : nsISupports
|
|||
* @param cues An array of VTTCues who need there display state to be
|
||||
* computed.
|
||||
* @param overlay The HTMLElement that the cues will be displayed within.
|
||||
* @param controls The video control element that will affect cues position.
|
||||
*/
|
||||
void processCues(in mozIDOMWindow window, in nsIVariant cues,
|
||||
in nsISupports overlay);
|
||||
in nsISupports overlay, in nsISupports controls);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -1120,7 +1120,9 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
|
|||
// Runs the processing model over the cues and regions passed to it.
|
||||
// @param overlay A block level element (usually a div) that the computed cues
|
||||
// and regions will be placed into.
|
||||
WebVTT.processCues = function(window, cues, overlay) {
|
||||
// @param controls A Control bar element. Cues' position will be
|
||||
// affected and repositioned according to it.
|
||||
WebVTT.processCues = function(window, cues, overlay, controls) {
|
||||
if (!window || !cues || !overlay) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1130,6 +1132,15 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
|
|||
overlay.removeChild(overlay.firstChild);
|
||||
}
|
||||
|
||||
var controlBar;
|
||||
var controlBarShown;
|
||||
|
||||
if (controls) {
|
||||
controlBar = controls.ownerDocument.getAnonymousElementByAttribute(
|
||||
controls, "class", "controlBar");
|
||||
controlBarShown = controlBar ? !!controlBar.clientHeight : false;
|
||||
}
|
||||
|
||||
var paddedOverlay = window.document.createElement("div");
|
||||
paddedOverlay.style.position = "absolute";
|
||||
paddedOverlay.style.left = "0";
|
||||
|
@ -1143,6 +1154,10 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
|
|||
// be the case if a cue's state has been changed since the last computation or
|
||||
// if it has not been computed yet.
|
||||
function shouldCompute(cues) {
|
||||
if (controlBarShown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (var i = 0; i < cues.length; i++) {
|
||||
if (cues[i].hasBeenReset || !cues[i].displayState) {
|
||||
return true;
|
||||
|
@ -1169,6 +1184,11 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
|
|||
(function() {
|
||||
var styleBox, cue;
|
||||
|
||||
if (controlBarShown) {
|
||||
// Add an empty output box that cover the same region as video control bar.
|
||||
boxPositions.push(BoxPosition.getSimpleBoxPosition(controlBar));
|
||||
}
|
||||
|
||||
for (var i = 0; i < cues.length; i++) {
|
||||
cue = cues[i];
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ DIRS += [
|
|||
'smil',
|
||||
'telephony',
|
||||
'tv',
|
||||
'url',
|
||||
'voicemail',
|
||||
'inputmethod',
|
||||
'webidl',
|
||||
|
|
|
@ -1037,7 +1037,7 @@ Notification::Constructor(const GlobalObject& aGlobal,
|
|||
{
|
||||
// FIXME(nsm): If the sticky flag is set, throw an error.
|
||||
ServiceWorkerGlobalScope* scope = nullptr;
|
||||
UNWRAP_WORKER_OBJECT(ServiceWorkerGlobalScope, aGlobal.Get(), scope);
|
||||
UNWRAP_OBJECT(ServiceWorkerGlobalScope, aGlobal.Get(), scope);
|
||||
if (scope) {
|
||||
aRv.ThrowTypeError<MSG_NOTIFICATION_NO_CONSTRUCTOR_IN_SERVICEWORKER>();
|
||||
return nullptr;
|
||||
|
|
|
@ -153,7 +153,7 @@ public:
|
|||
nsTArray<uint8_t>&& aRawP256dhKey,
|
||||
nsTArray<uint8_t>&& aAuthSecret,
|
||||
nsTArray<uint8_t>&& aAppServerKey)
|
||||
: WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount)
|
||||
: WorkerRunnable(aWorkerPrivate)
|
||||
, mProxy(Move(aProxy))
|
||||
, mStatus(aStatus)
|
||||
, mEndpoint(aEndpoint)
|
||||
|
@ -360,7 +360,7 @@ public:
|
|||
PermissionResultRunnable(PromiseWorkerProxy *aProxy,
|
||||
nsresult aStatus,
|
||||
PushPermissionState aState)
|
||||
: WorkerRunnable(aProxy->GetWorkerPrivate(), WorkerThreadModifyBusyCount)
|
||||
: WorkerRunnable(aProxy->GetWorkerPrivate())
|
||||
, mProxy(aProxy)
|
||||
, mStatus(aStatus)
|
||||
, mState(aState)
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
already_AddRefed<PromiseWorkerProxy>&& aProxy,
|
||||
nsresult aStatus,
|
||||
bool aSuccess)
|
||||
: WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount)
|
||||
: WorkerRunnable(aWorkerPrivate)
|
||||
, mProxy(Move(aProxy))
|
||||
, mStatus(aStatus)
|
||||
, mSuccess(aSuccess)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCSPParser.h"
|
||||
#include "nsCSPUtils.h"
|
||||
|
@ -120,6 +121,7 @@ nsCSPTokenizer::tokenizeCSPPolicy(const nsAString &aPolicyString,
|
|||
}
|
||||
|
||||
/* ===== nsCSPParser ==================== */
|
||||
bool nsCSPParser::sCSPExperimentalEnabled = false;
|
||||
|
||||
nsCSPParser::nsCSPParser(cspTokens& aTokens,
|
||||
nsIURI* aSelfURI,
|
||||
|
@ -137,6 +139,11 @@ nsCSPParser::nsCSPParser(cspTokens& aTokens,
|
|||
, mCSPContext(aCSPContext)
|
||||
, mDeliveredViaMetaTag(aDeliveredViaMetaTag)
|
||||
{
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
Preferences::AddBoolVarCache(&sCSPExperimentalEnabled, "security.csp.experimentalEnabled");
|
||||
}
|
||||
CSPPARSERLOG(("nsCSPParser::nsCSPParser"));
|
||||
}
|
||||
|
||||
|
@ -1007,13 +1014,6 @@ nsCSPParser::directiveValue(nsTArray<nsCSPBaseSrc*>& outSrcs)
|
|||
return;
|
||||
}
|
||||
|
||||
// special case handling of the require-sri-for directive (since it doesn't
|
||||
// contain a source lists but rather types, e.g., style or script)
|
||||
if (CSP_IsDirective(mCurDir[0], nsIContentSecurityPolicy::REQUIRE_SRI_FOR)) {
|
||||
// handled in directive()
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise just forward to sourceList
|
||||
sourceList(outSrcs);
|
||||
}
|
||||
|
@ -1027,7 +1027,9 @@ nsCSPParser::directiveName()
|
|||
NS_ConvertUTF16toUTF8(mCurValue).get()));
|
||||
|
||||
// Check if it is a valid directive
|
||||
if (!CSP_IsValidDirective(mCurToken)) {
|
||||
if (!CSP_IsValidDirective(mCurToken) ||
|
||||
(!sCSPExperimentalEnabled &&
|
||||
CSP_IsDirective(mCurToken, nsIContentSecurityPolicy::REQUIRE_SRI_FOR))) {
|
||||
const char16_t* params[] = { mCurToken.get() };
|
||||
logWarningErrorToConsole(nsIScriptError::warningFlag, "couldNotProcessUnknownDirective",
|
||||
params, ArrayLength(params));
|
||||
|
|
|
@ -111,6 +111,8 @@ class nsCSPParser {
|
|||
nsCSPContext* aCSPContext,
|
||||
bool aDeliveredViaMetaTag);
|
||||
|
||||
static bool sCSPExperimentalEnabled;
|
||||
|
||||
~nsCSPParser();
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ template<class T> class nsReadingIterator;
|
|||
#include "TestHarness.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/dom/nsCSPContext.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
#ifndef MOZILLA_INTERNAL_API
|
||||
#undef nsString_h___
|
||||
|
@ -166,10 +168,23 @@ nsresult runTestSuite(const PolicyTest* aPolicies,
|
|||
uint32_t aPolicyCount,
|
||||
uint32_t aExpectedPolicyCount) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
bool experimentalEnabledCache = false;
|
||||
if (prefs)
|
||||
{
|
||||
prefs->GetBoolPref("security.csp.experimentalEnabled", &experimentalEnabledCache);
|
||||
prefs->SetBoolPref("security.csp.experimentalEnabled", true);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < aPolicyCount; i++) {
|
||||
rv = runTest(aExpectedPolicyCount, aPolicies[i].policy, aPolicies[i].expectedResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (prefs) {
|
||||
prefs->SetBoolPref("security.csp.experimentalEnabled", experimentalEnabledCache);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,3 +37,4 @@ support-files =
|
|||
[test_style_crossdomain.html]
|
||||
[test_style_sameorigin.html]
|
||||
[test_require-sri-for_csp_directive.html]
|
||||
[test_require-sri-for_csp_directive_disabled.html]
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<iframe style="width:200px;height:200px;" id="test_frame"></iframe>
|
||||
</body>
|
||||
<script type="application/javascript">
|
||||
SpecialPowers.setBoolPref("security.csp.experimentalEnabled", true);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function handler(event) {
|
||||
switch (event.data) {
|
||||
|
@ -29,11 +30,12 @@
|
|||
case 'finish':
|
||||
var blackText = frame.contentDocument.getElementById('black-text');
|
||||
var blackTextColor = frame.contentWindow.getComputedStyle(blackText, null).getPropertyValue('color');
|
||||
ok(blackTextColor == 'rgb(0, 0, 0)', "The second part should still be black.");
|
||||
ok(blackTextColor == 'rgb(0, 0, 0)', "The second part should not be black.");
|
||||
removeEventListener('message', handler);
|
||||
SimpleTest.finish();
|
||||
break;
|
||||
default:
|
||||
ok(false, 'Something is wrong here');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for diabled SRI require-sri-for CSP directive</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1265318">Mozilla Bug 1265318</a>
|
||||
<iframe style="width:200px;height:200px;" id="test_frame"></iframe>
|
||||
</body>
|
||||
<script type="application/javascript">
|
||||
SpecialPowers.setBoolPref("security.csp.experimentalEnabled", false);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function handler(event) {
|
||||
switch (event.data) {
|
||||
case 'good_sriLoaded':
|
||||
ok(true, "Eligible SRI resources was correctly loaded.");
|
||||
break;
|
||||
case 'bad_nonsriLoaded':
|
||||
ok(true, "Eligible non-SRI resource should be blocked by the CSP!");
|
||||
break;
|
||||
case 'good_nonsriBlocked':
|
||||
ok(false, "Eligible non-SRI resources was correctly blocked by the CSP.");
|
||||
break;
|
||||
case 'finish':
|
||||
var blackText = frame.contentDocument.getElementById('black-text');
|
||||
var blackTextColor = frame.contentWindow.getComputedStyle(blackText, null).getPropertyValue('color');
|
||||
ok(blackTextColor != 'rgb(0, 0, 0)', "The second part should still be black.");
|
||||
removeEventListener('message', handler);
|
||||
SimpleTest.finish();
|
||||
break;
|
||||
default:
|
||||
ok(false, 'Something is wrong here');
|
||||
break;
|
||||
}
|
||||
}
|
||||
addEventListener("message", handler);
|
||||
var frame = document.getElementById("test_frame");
|
||||
frame.src = "iframe_require-sri-for_main.html";
|
||||
</script>
|
||||
</html>
|
|
@ -112,13 +112,6 @@ DOMStorage::SetItem(const nsAString& aKey, const nsAString& aData,
|
|||
return;
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(GetType() == LocalStorage
|
||||
? Telemetry::LOCALDOMSTORAGE_KEY_SIZE_BYTES
|
||||
: Telemetry::SESSIONDOMSTORAGE_KEY_SIZE_BYTES, aKey.Length());
|
||||
Telemetry::Accumulate(GetType() == LocalStorage
|
||||
? Telemetry::LOCALDOMSTORAGE_VALUE_SIZE_BYTES
|
||||
: Telemetry::SESSIONDOMSTORAGE_VALUE_SIZE_BYTES, aData.Length());
|
||||
|
||||
nsString data;
|
||||
bool ok = data.Assign(aData, fallible);
|
||||
if (!ok) {
|
||||
|
|
|
@ -489,8 +489,6 @@ DOMStorageDBThread::OpenAndUpdateDatabase()
|
|||
nsresult
|
||||
DOMStorageDBThread::InitDatabase()
|
||||
{
|
||||
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_INIT_DATABASE_MS> timer;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Here we are on the worker thread. This opens the worker connection.
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,179 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_URL_h
|
||||
#define mozilla_dom_URL_h
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsISupports;
|
||||
class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
class DOMMediaStream;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Blob;
|
||||
class MediaSource;
|
||||
class GlobalObject;
|
||||
struct objectURLOptions;
|
||||
|
||||
class URL : public URLSearchParamsObserver
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(URL)
|
||||
|
||||
URL(nsISupports* aParent)
|
||||
: mParent(aParent)
|
||||
{}
|
||||
|
||||
// WebIDL methods
|
||||
nsISupports* GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
static already_AddRefed<URL>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
URL& aBase, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<URL>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
const Optional<nsAString>& aBase, ErrorResult& aRv);
|
||||
|
||||
// Helper for Fetch API
|
||||
static already_AddRefed<URL>
|
||||
WorkerConstructor(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
const nsAString& aBase, ErrorResult& aRv);
|
||||
|
||||
|
||||
static void
|
||||
CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
|
||||
const objectURLOptions& aOptions,
|
||||
nsAString& aResult, ErrorResult& aRv);
|
||||
|
||||
static void
|
||||
CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
|
||||
const objectURLOptions& aOptions, nsAString& aResult,
|
||||
ErrorResult& aRv);
|
||||
|
||||
static void
|
||||
CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
|
||||
const objectURLOptions& aOptions, nsAString& aResult,
|
||||
ErrorResult& aRv);
|
||||
|
||||
static void
|
||||
RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual void
|
||||
GetHref(nsAString& aHref, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetHref(const nsAString& aHref, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetOrigin(nsAString& aOrigin, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
GetProtocol(nsAString& aProtocol, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetProtocol(const nsAString& aProtocol, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetUsername(nsAString& aUsername, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetUsername(const nsAString& aUsername, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetPassword(nsAString& aPassword, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetPassword(const nsAString& aPassword, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetHost(nsAString& aHost, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetHost(const nsAString& aHost, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetHostname(nsAString& aHostname, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetHostname(const nsAString& aHostname, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetPort(nsAString& aPort, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetPort(const nsAString& aPort, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetPathname(nsAString& aPathname, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetPathname(const nsAString& aPathname, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
GetSearch(nsAString& aSearch, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetSearch(const nsAString& aSearch, ErrorResult& aRv);
|
||||
|
||||
URLSearchParams* SearchParams();
|
||||
|
||||
virtual void
|
||||
GetHash(nsAString& aHost, ErrorResult& aRv) const = 0;
|
||||
|
||||
virtual void
|
||||
SetHash(const nsAString& aHash, ErrorResult& aRv) = 0;
|
||||
|
||||
void Stringify(nsAString& aRetval, ErrorResult& aRv) const
|
||||
{
|
||||
GetHref(aRetval, aRv);
|
||||
}
|
||||
|
||||
// URLSearchParamsObserver
|
||||
void
|
||||
URLSearchParamsUpdated(URLSearchParams* aSearchParams) override;
|
||||
|
||||
protected:
|
||||
virtual ~URL()
|
||||
{}
|
||||
|
||||
virtual void
|
||||
UpdateURLSearchParams() = 0;
|
||||
|
||||
virtual void
|
||||
SetSearchInternal(const nsAString& aSearch, ErrorResult& aRv) = 0;
|
||||
|
||||
void CreateSearchParamsIfNeeded();
|
||||
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
RefPtr<URLSearchParams> mSearchParams;
|
||||
};
|
||||
|
||||
bool IsChromeURI(nsIURI* aURI);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_URL_h */
|
|
@ -0,0 +1,26 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'URL.h',
|
||||
'URLSearchParams.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'URL.cpp',
|
||||
'URLSearchParams.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||
MOCHITEST_CHROME_MANIFESTS += [ 'tests/chrome.ini' ]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
|
@ -0,0 +1,12 @@
|
|||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
file_url.jsm
|
||||
file_worker_url.jsm
|
||||
test_bug883784.jsm
|
||||
jsm_url_worker.js
|
||||
!/dom/workers/test/dom_worker_helper.js
|
||||
|
||||
[test_url.xul]
|
||||
[test_worker_url.xul]
|
||||
[test_bug883784.xul]
|
|
@ -15,11 +15,10 @@ this.checkFromJSM = function checkFromJSM(ok, is, finish) {
|
|||
}
|
||||
}
|
||||
|
||||
var self = this;
|
||||
worker.onerror = function(event) {
|
||||
is(event.target, worker);
|
||||
ok(false, "Worker had an error: " + event.data);
|
||||
self.worker.terminate();
|
||||
worker.terminate();
|
||||
finish();
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
url_worker.js
|
||||
urlApi_worker.js
|
||||
urlSearchParams_worker.js
|
||||
url_exceptions_worker.js
|
||||
|
||||
[test_url.html]
|
||||
[test_url_data.html]
|
||||
[test_url_empty_port.html]
|
||||
[test_url_malformedHost.html]
|
||||
[test_urlExceptions.html]
|
||||
[test_urlSearchParams.html]
|
||||
[test_urlSearchParams_utf8.html]
|
||||
[test_urlutils_stringify.html]
|
||||
[test_worker_url.html]
|
||||
[test_worker_urlApi.html]
|
||||
[test_worker_url_exceptions.html]
|
||||
[test_worker_urlSearchParams.html]
|
||||
[test_unknown_url_origin.html]
|
|
@ -11,7 +11,7 @@
|
|||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
<script type="application/javascript" src="dom_worker_helper.js"/>
|
||||
<script type="application/javascript" src="chrome://mochitests/content/chrome/dom/workers/test/dom_worker_helper.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
@ -20,7 +20,7 @@
|
|||
{
|
||||
waitForWorkerFinish();
|
||||
|
||||
Components.utils.import("chrome://mochitests/content/chrome/dom/workers/test/test_bug883784.jsm");
|
||||
Components.utils.import("chrome://mochitests/content/chrome/dom/url/tests/test_bug883784.jsm");
|
||||
Test.start(ok, is, finish);
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=959190
|
|||
var area = document.getElementById("area");
|
||||
is(area + '', 'http://www.example.com:8080/', 'Area stringify');
|
||||
|
||||
is((location + '').indexOf('http://mochi.test:8888/tests/dom/base/test/test_urlutils_stringify.html'), 0, 'Location stringify');
|
||||
is((location + '').indexOf('http://mochi.test:8888/tests/dom/url/tests/test_urlutils_stringify.html'), 0, 'Location stringify');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -11,17 +11,16 @@
|
|||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
<script type="application/javascript" src="dom_worker_helper.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForWorkerFinish();
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
Components.utils.import("chrome://mochitests/content/chrome/dom/workers/test/file_url.jsm");
|
||||
checkFromJSM(ok, is, finish);
|
||||
Components.utils.import("chrome://mochitests/content/chrome/dom/url/tests/file_worker_url.jsm");
|
||||
checkFromJSM(ok, is, SimpleTest.finish);
|
||||
}
|
||||
|
||||
]]>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче