Merge latest green fx-team changeset and mozilla-central

This commit is contained in:
Ed Morley 2013-09-19 15:39:37 +01:00
commit 02ff03f180
136 changed files with 1390 additions and 805 deletions

View File

@ -13,11 +13,7 @@ MOCHITEST_A11Y_FILES =\
test_list.html \
test_markup.html \
test_svg.html \
test_tree.xul \
test_browserui.xul \
markuprules.xml \
$(NULL)
# Disabled on mac while bug 905909 is sorted out.
ifneq ($(OS_ARCH), Darwin)
MOCHITEST_A11Y_FILES += test_tree.xul
endif

View File

@ -23,6 +23,7 @@ MOCHITEST_A11Y_FILES =\
test_stale.html \
test_textbox.xul \
test_tabs.xul \
test_tree.xul \
test_visibility.html \
test_visibility.xul \
z_frames.html \
@ -31,8 +32,3 @@ MOCHITEST_A11Y_FILES =\
z_frames_textbox.html \
z_frames_update.html \
$(NULL)
# Disabled on mac while bug 905909 is sorted out.
ifneq ($(OS_ARCH), Darwin)
MOCHITEST_A11Y_FILES += test_tree.xul
endif

View File

@ -257,6 +257,8 @@ pref("layers.acceleration.disabled", false);
pref("layers.offmainthreadcomposition.async-animations", true);
pref("layers.async-video.enabled", true);
pref("layers.async-pan-zoom.enabled", true);
pref("gfx.content.azure.enabled", true);
pref("gfx.content.azure.backends", "cairo");
#endif
// Web Notifications

View File

@ -1,4 +1,4 @@
{
"revision": "8547bf51868f3521d96129d4e9060cf98a0bd23e",
"revision": "9bf9368a1110d6c365225593e0f145c343ea8cd8",
"repo_path": "/integration/gaia-central"
}

View File

@ -2,7 +2,7 @@
# 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/.
MOCHITEST_BROWSER_TESTS = \
MOCHITEST_BROWSER_FILES = \
browser_dbg_aaa_run_first_leaktest.js \
browser_dbg_bfcache.js \
browser_dbg_blackboxing-01.js \
@ -125,9 +125,6 @@ MOCHITEST_BROWSER_TESTS = \
browser_dbg_watch-expressions-01.js \
browser_dbg_watch-expressions-02.js \
head.js \
$(NULL)
MOCHITEST_BROWSER_PAGES = \
doc_binary_search.html \
doc_blackboxing.html \
doc_cmd-break.html \
@ -182,7 +179,7 @@ MOCHITEST_BROWSER_PAGES = \
# Bug 847558:
# Disable browser_dbg_chrome-create.js to fix Ubuntu hangs
ifneq (Linux,$(OS_ARCH))
MOCHITEST_BROWSER_TESTS += \
MOCHITEST_BROWSER_FILES += \
browser_dbg_chrome-create.js \
browser_dbg_on-pause-raise.js \
$(NULL)
@ -191,10 +188,8 @@ endif
# Bug 895426:
# Disable browser_dbg_break-on-dom-event.js due to frequent failures
ifneq (Darwin,$(OS_ARCH))
MOCHITEST_BROWSER_TESTS += \
MOCHITEST_BROWSER_FILES += \
browser_dbg_break-on-dom-event.js \
browser_dbg_event-listeners.js \
$(NULL)
endif
MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES

View File

@ -2,7 +2,7 @@
# 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/.
MOCHITEST_BROWSER_TESTS = \
MOCHITEST_BROWSER_FILES = \
browser_net_aaa_leaktest.js \
browser_net_autoscroll.js \
browser_net_simple-init.js \
@ -39,9 +39,6 @@ MOCHITEST_BROWSER_TESTS = \
browser_net_copy_url.js \
browser_net_open_request_in_tab.js \
head.js \
$(NULL)
MOCHITEST_BROWSER_PAGES = \
test-image.png \
html_simple-test-page.html \
html_navigate-test-page.html \
@ -62,5 +59,3 @@ MOCHITEST_BROWSER_PAGES = \
sjs_status-codes-test-server.sjs \
sjs_sorting-test-server.sjs \
$(NULL)
MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES

View File

@ -2,7 +2,7 @@
# 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/.
MOCHITEST_BROWSER_TESTS = \
MOCHITEST_BROWSER_FILES = \
browser_profiler_remote.js \
browser_profiler_bug_834878_source_buttons.js \
browser_profiler_cmd.js \
@ -17,12 +17,7 @@ MOCHITEST_BROWSER_TESTS = \
browser_profiler_gecko_data.js \
browser_profiler_io.js \
head.js \
$(NULL)
MOCHITEST_BROWSER_PAGES = \
mock_profiler_bug_834878_page.html \
mock_profiler_bug_834878_script.js \
mock_console_api.html \
$(NULL)
MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES

View File

@ -23,7 +23,6 @@ MOCHITEST_BROWSER_FILES := \
browser_styleeditor_reload.js \
head.js \
four.html \
head.js \
import.css \
import.html \
import2.css \

View File

@ -94,8 +94,11 @@ function onNetworkMessage(aResults) {
goUpdateCommand(COMMAND_NAME);
ok(isEnabled(), COMMAND_NAME + " is enabled");
waitForClipboard(message.url, () => goDoCommand(COMMAND_NAME),
testMenuWithNetActivity, testMenuWithNetActivity);
info("expected clipboard value: " + message.url);
waitForClipboard((aData) => { return aData.trim() == message.url; },
() => { goDoCommand(COMMAND_NAME) },
testMenuWithNetActivity, testMenuWithNetActivity);
function testMenuWithNetActivity() {
// Test that the "Copy Link Location" menu item is visible for network-related

65
build/virtualenv/populate_virtualenv.py Executable file → Normal file
View File

@ -12,11 +12,28 @@ import os
import shutil
import subprocess
import sys
import warnings
from distutils.version import StrictVersion
# Minimum version of Python required to build.
MINIMUM_PYTHON_VERSION = StrictVersion('2.7.3')
MINIMUM_PYTHON_MAJOR = 2
MINIMUM_PYTHON_MINOR = 7
UPGRADE_WINDOWS = '''
Please upgrade to the latest MozillaBuild development environment. See
https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites
'''.lstrip()
UPGRADE_OTHER = '''
Run |mach bootstrap| to ensure your system is up to date.
If you still receive this error, your shell environment is likely detecting
another Python version. Ensure a modern Python can be found in the paths
defined by the $PATH environment variable and try again.
'''.lstrip()
class VirtualenvManager(object):
@ -273,6 +290,33 @@ class VirtualenvManager(object):
old_env_variables[k] = os.environ[k]
del os.environ[k]
# HACK ALERT.
#
# The following adjustment to the VSNNCOMNTOOLS environment
# variables are wrong. This is done as a hack to facilitate the
# building of binary Python packages - notably psutil - on Windows
# machines that don't have the Visual Studio 2008 binaries
# installed. This hack assumes the Python on that system was built
# with Visual Studio 2008. The hack is wrong for the reasons
# explained at
# http://stackoverflow.com/questions/3047542/building-lxml-for-python-2-7-on-windows/5122521#5122521.
if sys.platform in ('win32', 'cygwin') and \
'VS90COMNTOOLS' not in os.environ:
warnings.warn('Hacking environment to allow binary Python '
'extensions to build. You can make this warning go away '
'by installing Visual Studio 2008. You can download the '
'Express Edition installer from '
'http://go.microsoft.com/?linkid=7729279')
# We list in order from oldest to newest to prefer the closest
# to 2008 so differences are minimized.
for ver in ('100', '110', '120'):
var = 'VS%sCOMNTOOLS' % ver
if var in os.environ:
os.environ['VS90COMNTOOLS'] = os.environ[var]
break
for package in packages:
handle_package(package)
finally:
@ -343,13 +387,20 @@ class VirtualenvManager(object):
def verify_python_version(log_handle):
"""Ensure the current version of Python is sufficient."""
major, minor = sys.version_info[:2]
major, minor, micro = sys.version_info[:3]
our = StrictVersion('%d.%d.%d' % (major, minor, micro))
if major != MINIMUM_PYTHON_MAJOR or our < MINIMUM_PYTHON_VERSION:
log_handle.write('Python %s or greater (but not Python 3) is '
'required to build. ' % MINIMUM_PYTHON_VERSION)
log_handle.write('You are running Python %s.\n' % our)
if os.name in ('nt', 'ce'):
log_handle.write(UPGRADE_WINDOWS)
else:
log_handle.write(UPGRADE_OTHER)
if major != MINIMUM_PYTHON_MAJOR or minor < MINIMUM_PYTHON_MINOR:
log_handle.write('Python %d.%d or greater (but not Python 3) is '
'required to build. ' %
(MINIMUM_PYTHON_MAJOR, MINIMUM_PYTHON_MINOR))
log_handle.write('You are running Python %d.%d.\n' % (major, minor))
sys.exit(1)

View File

@ -10,64 +10,46 @@ ifndef INCLUDED_TESTS_MOCHITEST_MK #{
# $1- test directory name
# $2- optional: if passed dot used to flatten directory hierarchy copy
# else- relativesrcdir
# else- determine relative path
mochitestdir = \
$(strip \
$(if $(2),$(DEPTH)/_tests/testing/mochitest/$1/. \
,$(if $(value relativesrcdir) \
,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \
,$(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir)) \
)))
,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \
))
define mochitest-libs-rule-template
libs:: $$($(1))
$$(call install_cmd,$$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2),$(3)))
endef
# Provide support for modules with such a large number of tests that
# installing them with a single $(INSTALL) invocation would overflow
# command-line length limits on some operating systems.
ifdef MOCHITEST_FILES_PARTS
ifdef MOCHITEST_FILES
$(error You must define only one of MOCHITEST_FILES_PARTS or MOCHITEST_FILES)
endif
$(foreach part,$(MOCHITEST_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),tests)))
endif
ifdef MOCHITEST_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_FILES,tests))
MOCHITEST_DEST := $(call mochitestdir,tests)
INSTALL_TARGETS += MOCHITEST
endif
ifdef MOCHITEST_CHROME_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_CHROME_FILES,chrome))
endif
ifdef MOCHITEST_BROWSER_FILES_PARTS
ifdef MOCHITEST_BROWSER_FILES
$(error You must define only one of MOCHITEST_BROWSER_FILES_PARTS or MOCHITEST_BROWSER_FILES)
endif
$(foreach part,$(MOCHITEST_BROWSER_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),browser)))
MOCHITEST_CHROME_DEST := $(call mochitestdir,chrome)
INSTALL_TARGETS += MOCHITEST_CHROME
endif
ifdef MOCHITEST_BROWSER_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_BROWSER_FILES,browser))
MOCHITEST_BROWSER_DEST := $(call mochitestdir,browser)
INSTALL_TARGETS += MOCHITEST_BROWSER
endif
ifdef MOCHITEST_A11Y_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_A11Y_FILES,a11y))
MOCHITEST_A11Y_DEST := $(call mochitestdir,a11y)
INSTALL_TARGETS += MOCHITEST_A11Y
endif
ifdef MOCHITEST_METRO_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_METRO_FILES,metro))
MOCHITEST_METRO_DEST := $(call mochitestdir,metro)
INSTALL_TARGETS += MOCHITEST_METRO
endif
ifdef MOCHITEST_ROBOCOP_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_ROBOCOP_FILES,tests/robocop,flat_hierarchy))
MOCHITEST_ROBOCOP_DEST := $(call mochitestdir,tests/robocop,flat_hierarchy)
INSTALL_TARGETS += MOCHITEST_ROBOCOP
endif
ifdef MOCHITEST_WEBAPPRT_CHROME_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_WEBAPPRT_CHROME_FILES,webapprtChrome))
MOCHITEST_WEBAPPRT_CHROME_DEST := $(call mochitestdir,webapprtChrome)
INSTALL_TARGETS += MOCHITEST_WEBAPPRT_CHROME
endif
INCLUDED_TESTS_MOCHITEST_MK := 1

View File

@ -43,10 +43,7 @@ endef
$(foreach subtier,export compile libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
compile export:: $(SUBMAKEFILES)
compile export tools:: $(SUBMAKEFILES)
$(LOOP_OVER_TOOL_DIRS)
tools:: $(SUBMAKEFILES)
$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
endif

View File

@ -47,6 +47,8 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
_DEPRECATED_VARIABLES := \
XPIDL_FLAGS \
MOCHITEST_FILES_PARTS \
MOCHITEST_BROWSER_FILES_PARTS \
$(NULL)
ifndef EXTERNALLY_MANAGED_MAKE_FILE
@ -735,6 +737,13 @@ compile:: $(OBJS) $(HOST_OBJS)
include $(topsrcdir)/config/makefiles/target_libs.mk
ifdef IS_TOOL_DIR
# One would think "tools:: libs" would work, but it turns out that combined with
# bug 907365, this makes make forget to run some rules sometimes.
tools::
@$(MAKE) libs
endif
##############################################
ifndef NO_PROFILE_GUIDED_OPTIMIZE
ifdef MOZ_PROFILE_USE
@ -1739,10 +1748,8 @@ FREEZE_VARIABLES = \
EXTRA_COMPONENTS \
EXTRA_PP_COMPONENTS \
MOCHITEST_FILES \
MOCHITEST_FILES_PARTS \
MOCHITEST_CHROME_FILES \
MOCHITEST_BROWSER_FILES \
MOCHITEST_BROWSER_FILES_PARTS \
MOCHITEST_A11Y_FILES \
MOCHITEST_METRO_FILES \
MOCHITEST_ROBOCOP_FILES \

View File

@ -6117,9 +6117,9 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
aPattern.Append(NS_LITERAL_STRING(")$"));
JSObject* re = JS_NewUCRegExpObjectNoStatics(cx, static_cast<jschar*>
(aPattern.BeginWriting()),
aPattern.Length(), 0);
JS::RootedObject re(cx, JS_NewUCRegExpObjectNoStatics(cx, static_cast<jschar*>
(aPattern.BeginWriting()),
aPattern.Length(), 0));
if (!re) {
JS_ClearPendingException(cx);
return true;
@ -6129,7 +6129,7 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
size_t idx = 0;
if (!JS_ExecuteRegExpNoStatics(cx, re,
static_cast<jschar*>(aValue.BeginWriting()),
aValue.Length(), &idx, true, rval.address())) {
aValue.Length(), &idx, true, &rval)) {
JS_ClearPendingException(cx);
return true;
}

View File

@ -50,7 +50,11 @@ enum {
// This bit is only meaningful if the NS_CACHED_TEXT_IS_ONLY_WHITESPACE
// bit is set, and if so it indicates whether we're only whitespace or
// not.
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3)
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3),
// This bit is set to indicate that we must create frames for this text node
// even if it's only whitespace next to a block boundary.
NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE = DATA_NODE_FLAG_BIT(4)
};
// Make sure we have enough space for those bits

View File

@ -32,6 +32,7 @@
#include "mozilla/dom/RangeBinding.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Likely.h"
#include "nsCSSFrameConstructor.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2747,12 +2748,25 @@ static void ExtractRectFromOffset(nsIFrame* aFrame,
}
}
static nsTextFrame*
GetTextFrameForContent(nsIContent* aContent)
{
nsIPresShell* presShell = aContent->OwnerDoc()->GetShell();
if (presShell) {
nsIFrame* frame = presShell->FrameConstructor()->EnsureFrameForTextNode(
static_cast<nsGenericDOMDataNode*>(aContent));
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
return static_cast<nsTextFrame*>(frame);
}
}
return nullptr;
}
static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
nsIContent* aContent, int32_t aStartOffset, int32_t aEndOffset)
{
nsIFrame* frame = aContent->GetPrimaryFrame();
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
nsTextFrame* textFrame = GetTextFrameForContent(aContent);
if (textFrame) {
nsIFrame* relativeTo = nsLayoutUtils::GetContainingBlockForClientRect(textFrame);
for (nsTextFrame* f = textFrame; f; f = static_cast<nsTextFrame*>(f->GetNextContinuation())) {
int32_t fstart = f->GetContentOffset(), fend = f->GetContentEnd();
@ -2808,9 +2822,8 @@ static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
// the range is collapsed, only continue if the cursor is in a text node
nsCOMPtr<nsIContent> content = do_QueryInterface(aStartParent);
if (content && content->IsNodeOfType(nsINode::eTEXT)) {
nsIFrame* frame = content->GetPrimaryFrame();
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
nsTextFrame* textFrame = GetTextFrameForContent(content);
if (textFrame) {
int32_t outOffset;
nsIFrame* outFrame;
textFrame->GetChildFrameContainingOffset(aStartOffset, false,

View File

@ -3,7 +3,7 @@
# 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/.
MOCHITEST_FILES_A = \
MOCHITEST_FILES = \
responseIdentical.sjs \
test_bug5141.html \
test_bug51034.html \
@ -235,9 +235,6 @@ MOCHITEST_FILES_A = \
test_bug894874.html \
test_bug895974.html \
test_bug895239.html \
$(NULL)
MOCHITEST_FILES_B = \
test_bug459424.html \
bug461735-redirect1.sjs \
bug461735-redirect2.sjs \
@ -437,9 +434,6 @@ MOCHITEST_FILES_B = \
invalid_accesscontrol.resource^headers^ \
file_bug869432.eventsource \
file_bug869432.eventsource^headers^ \
$(NULL)
MOCHITEST_FILES_C= \
test_xhr_progressevents.html \
progressserver.sjs \
somedatas.resource \
@ -587,7 +581,7 @@ MOCHITEST_FILES_C= \
# (see Bug 774939). App permission checks are also disabled on
# anything but B2G (Bug 900707).
ifdef MOZ_CHILD_PERMISSIONS
MOCHITEST_FILES_B += \
MOCHITEST_FILES += \
test_messagemanager_assertpermission.html \
test_child_process_shutdown_message.html \
$(NULL)
@ -600,14 +594,11 @@ MOCHITEST_CHROME_FILES = \
# This test fails on the Mac for some reason
ifneq (,$(filter gtk2 gtk3 windows,$(MOZ_WIDGET_TOOLKIT)))
MOCHITEST_FILES_C += \
MOCHITEST_FILES += \
test_copyimage.html \
$(NULL)
endif
MOCHITEST_FILES_PARTS = $(foreach s,A B C,MOCHITEST_FILES_$(s))
# Disabled for now. Mochitest isn't reliable enough for these.
# test_bug444546.html \
# bug444546.sjs \

View File

@ -4,7 +4,7 @@
# 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/.
DIRS += [
TEST_TOOL_DIRS += [
'chrome',
'csp',
'websocket_hybi',

View File

@ -416,12 +416,23 @@ void MP3FrameParser::Parse(const char* aBuffer, uint32_t aLength, int64_t aOffse
return;
}
MOZ_ASSERT(bytesRead >= mBufferLength, "Parse should leave original buffer");
// Adjust the incoming buffer pointer/length so that it reflects that we may have
// consumed data from buffer.
uint32_t adjust = bytesRead - mBufferLength;
aOffset += adjust;
aLength -= adjust;
mBufferLength = 0;
if (adjust >= aLength) {
// The frame or tag found in the buffer finishes outside the range.
// Just set the offset to the end of that tag/frame, and return.
mOffset = streamOffset + bytesRead;
if (mOffset > mLength) {
mLength = mOffset;
}
return;
}
aOffset += adjust;
MOZ_ASSERT(aLength >= adjust);
aLength -= adjust;
}
uint32_t bytesRead = 0;

View File

@ -514,7 +514,10 @@ AudioContext::Graph() const
MediaStream*
AudioContext::DestinationStream() const
{
return Destination()->Stream();
if (Destination()) {
return Destination()->Stream();
}
return nullptr;
}
double
@ -580,7 +583,7 @@ AudioContext::Shutdown()
}
// For offline contexts, we can destroy the MediaStreamGraph at this point.
if (mIsOffline) {
if (mIsOffline && mDestination) {
mDestination->OfflineShutdown();
}
}

View File

@ -248,6 +248,22 @@ MediaEngineWebRTC::EnumerateAudioDevices(nsTArray<nsRefPtr<MediaEngineAudioSourc
}
}
PRLogModuleInfo *logs = GetWebRTCLogInfo();
if (!gWebrtcTraceLoggingOn && logs && logs->level > 0) {
// no need to a critical section or lock here
gWebrtcTraceLoggingOn = 1;
const char *file = PR_GetEnv("WEBRTC_TRACE_FILE");
if (!file) {
file = "WebRTC.log";
}
LOG(("Logging webrtc to %s level %d", __FUNCTION__, file, logs->level));
mVoiceEngine->SetTraceFilter(logs->level);
mVoiceEngine->SetTraceFile(file);
}
ptrVoEBase = webrtc::VoEBase::GetInterface(mVoiceEngine);
if (!ptrVoEBase) {
return;

View File

@ -90,9 +90,3 @@ MOCHITEST_FILES = \
test_zoom.xhtml \
test_bug872812.html \
$(NULL)
ifneq (android,$(MOZ_WIDGET_TOOLKIT))
MOCHITEST_FILES += \
test_text.html \
$(NULL)
endif

View File

@ -327,7 +327,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
// Get the field name as an id.
JS::Rooted<jsid> id(aCx);
JS::TwoByteChars chars(mName, NS_strlen(mName));
if (!JS_CharsToId(aCx, chars, id.address()))
if (!JS_CharsToId(aCx, chars, &id))
return NS_ERROR_OUT_OF_MEMORY;
// Properties/Methods have historically taken precendence over fields. We

View File

@ -11,4 +11,4 @@ load 500328-1.html
load 514779-1.xhtml
load 614499-1.html
load 678872-1.html
skip-if(Android||B2G) pref(dom.disable_open_during_load,false) load 914521.html
skip-if(Android||B2G||browserIsRemote) pref(dom.disable_open_during_load,false) load 914521.html

View File

@ -3530,7 +3530,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// Trust the JS engine (or the script security manager) to set
// the exception in the JS engine.
if (!JS_GetPendingException(my_cx, exn.address())) {
if (!JS_GetPendingException(my_cx, &exn)) {
return NS_ERROR_UNEXPECTED;
}

View File

@ -296,7 +296,11 @@ nsJSUtils::EvaluateString(JSContext* aCx,
} else {
rv = JS_IsExceptionPending(aCx) ? NS_ERROR_FAILURE
: NS_ERROR_OUT_OF_MEMORY;
JS_GetPendingException(aCx, aRetValue);
JS::RootedValue exn(aCx);
JS_GetPendingException(aCx, &exn);
if (aRetValue) {
*aRetValue = exn;
}
JS_ClearPendingException(aCx);
}
}

View File

@ -181,7 +181,8 @@ ErrorResult::ReportJSException(JSContext* cx)
MOZ_ASSERT(!mMightHaveUnreportedJSException,
"Why didn't you tell us you planned to handle JS exceptions?");
if (JS_WrapValue(cx, &mJSException)) {
JS_SetPendingException(cx, mJSException);
JS::RootedValue exception(cx, mJSException);
JS_SetPendingException(cx, exception);
}
// If JS_WrapValue failed, not much we can do about it... No matter
// what, go ahead and unroot mJSException.

View File

@ -7,8 +7,6 @@
#ifndef mozilla_dom_BindingUtils_h__
#define mozilla_dom_BindingUtils_h__
#include <algorithm>
#include "jsfriendapi.h"
#include "jswrapper.h"
#include "mozilla/Alignment.h"
@ -2205,7 +2203,9 @@ class DeferredFinalizer
MOZ_ASSERT(aSlice > 0, "nonsensical/useless call with aSlice == 0");
SmartPtrArray* pointers = static_cast<SmartPtrArray*>(aData);
uint32_t oldLen = pointers->Length();
aSlice = std::min(oldLen, aSlice);
if (oldLen < aSlice) {
aSlice = oldLen;
}
uint32_t newLen = oldLen - aSlice;
pointers->RemoveElementsAt(newLen, aSlice);
if (newLen == 0) {

View File

@ -186,7 +186,7 @@ CallbackObject::CallSetup::~CallSetup()
mErrorResult.MightThrowJSException();
if (JS_IsExceptionPending(mCx)) {
JS::Rooted<JS::Value> exn(mCx);
if (JS_GetPendingException(mCx, exn.address()) &&
if (JS_GetPendingException(mCx, &exn) &&
ShouldRethrowException(exn)) {
mErrorResult.ThrowJSException(mCx, exn);
JS_ClearPendingException(mCx);

View File

@ -3658,8 +3658,9 @@ for (uint32_t i = 0; i < length; ++i) {
notDate = failureCode
conversion = (
"if (!JS_ObjectIsDate(cx, &${val}.toObject()) ||\n"
" !%s.SetTimeStamp(cx, &${val}.toObject())) {\n"
"JS::RootedObject possibleDateObject(cx, &${val}.toObject());\n"
"if (!JS_ObjectIsDate(cx, possibleDateObject) ||\n"
" !%s.SetTimeStamp(cx, possibleDateObject)) {\n"
"%s\n"
"}" %
(dateVal, CGIndenter(CGGeneric(notDate)).define()))

View File

@ -71,7 +71,8 @@ ThrowExceptionObject(JSContext* aCx, nsIException* aException)
return false;
}
JS_SetPendingException(aCx, OBJECT_TO_JSVAL(obj));
JS::RootedValue exn(aCx, JS::ObjectOrNullValue(obj));
JS_SetPendingException(aCx, exn);
return true;
}

View File

@ -240,39 +240,38 @@ IDBKeyRange::FromJSVal(JSContext* aCx,
nsresult rv;
nsRefPtr<IDBKeyRange> keyRange;
if (JSVAL_IS_VOID(aVal) || JSVAL_IS_NULL(aVal)) {
if (!aVal.isNullOrUndefined()) {
// undefined and null returns no IDBKeyRange.
}
else if (JSVAL_IS_PRIMITIVE(aVal) ||
JS_IsArrayObject(aCx, JSVAL_TO_OBJECT(aVal)) ||
JS_ObjectIsDate(aCx, JSVAL_TO_OBJECT(aVal))) {
// A valid key returns an 'only' IDBKeyRange.
keyRange = new IDBKeyRange(false, false, true);
rv = GetKeyFromJSVal(aCx, aVal, keyRange->Lower());
if (NS_FAILED(rv)) {
return rv;
JS::RootedObject obj(aCx, aVal.isObject() ? &aVal.toObject() : NULL);
if (aVal.isPrimitive() || JS_IsArrayObject(aCx, obj) || JS_ObjectIsDate(aCx, obj)) {
// A valid key returns an 'only' IDBKeyRange.
keyRange = new IDBKeyRange(false, false, true);
rv = GetKeyFromJSVal(aCx, aVal, keyRange->Lower());
if (NS_FAILED(rv)) {
return rv;
}
}
}
else {
// An object is not permitted unless it's another IDBKeyRange.
nsIXPConnect* xpc = nsContentUtils::XPConnect();
NS_ASSERTION(xpc, "This should never be null!");
else {
// An object is not permitted unless it's another IDBKeyRange.
nsIXPConnect* xpc = nsContentUtils::XPConnect();
NS_ASSERTION(xpc, "This should never be null!");
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
rv = xpc->GetWrappedNativeOfJSObject(aCx, JSVAL_TO_OBJECT(aVal),
getter_AddRefs(wrapper));
if (NS_FAILED(rv)) {
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
rv = xpc->GetWrappedNativeOfJSObject(aCx, obj, getter_AddRefs(wrapper));
if (NS_FAILED(rv)) {
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
nsCOMPtr<nsIIDBKeyRange> iface;
if (!wrapper || !(iface = do_QueryInterface(wrapper->Native()))) {
// Some random JS object?
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
keyRange = static_cast<IDBKeyRange*>(iface.get());
}
nsCOMPtr<nsIIDBKeyRange> iface;
if (!wrapper || !(iface = do_QueryInterface(wrapper->Native()))) {
// Some random JS object?
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
keyRange = static_cast<IDBKeyRange*>(iface.get());
}
keyRange.forget(aKeyRange);

View File

@ -46,8 +46,8 @@ IsValidKeyPathString(JSContext* aCx, const nsAString& aKeyPath)
return false;
}
NS_ASSERTION(JSVAL_IS_STRING(stringVal), "This should never happen");
JSString* str = JSVAL_TO_STRING(stringVal);
NS_ASSERTION(stringVal.toString(), "This should never happen");
JS::RootedString str(aCx, stringVal.toString());
bool isIdentifier = false;
if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) {

View File

@ -23,6 +23,7 @@ MOCHITEST_FILES = \
test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html \
test_getUserMedia_stopVideoStream.html \
test_getUserMedia_stopVideoAudioStream.html \
test_getUserMedia_constraints.html \
test_peerConnection_basicAudio.html \
test_peerConnection_basicAudioVideo.html \
test_peerConnection_basicAudioVideoCombined.html \

View File

@ -0,0 +1,96 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=882145
-->
<head>
<meta charset="utf-8">
<title>Test mozGetUserMedia Constraints</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882145">Test mozGetUserMedia Constraints</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/**
Tests covering gUM constraints API for audio, video and fake video. Exercise
successful parsing code and ensure that unknown mandatory constraints and
overconstraining cases produce appropriate errors.
*/
var tests = [
// Each test here tests a different constraint or codepath.
{ message: "unknown mandatory constraint on video fails",
constraints: { video: { mandatory: { somethingUnknown:0 } } },
error: "NOT_SUPPORTED_ERR: somethingUnknown",
pass: false },
{ message: "unknown mandatory constraint on audio fails",
constraints: { audio: { mandatory: { somethingUnknown:0 } } },
error: "NOT_SUPPORTED_ERR: somethingUnknown",
pass: false },
{ message: "video overconstrained by facingMode fails",
constraints: { video: { mandatory: { facingMode:'left' } } },
error: "NO_DEVICES_FOUND",
pass: false },
{ message: "Success-path: optional video facingMode + audio ignoring facingMode",
constraints: { fake: true,
audio: { mandatory: { facingMode:'left' } },
video: { optional: [{ facingMode:'left' },
{ facingMode:'right' },
{ facingMode:'environment' },
{ facingMode:'user' },
{ foo:0 }] } },
error: null,
pass: false },
{ message: null },
];
/**
* Starts the test run by running through each constraint
* test by verifying that the right callback and error message is fired.
*/
runTest(function () {
var i = 0;
next();
function Success() {
info("successcallback");
tests[i].pass = !tests[i].error;
i++;
next();
}
function Failure(err) {
info("errcallback: " + err);
tests[i].pass = tests[i].error? (err === tests[i].error) : false;
i++;
next();
}
function next() {
if (tests[i].message) {
navigator.mozGetUserMedia(tests[i].constraints, Success, Failure);
} else {
finish();
}
}
function finish() {
tests.forEach(function (test) {
if (test.message) {
ok(test.pass, test.message);
} else {
SimpleTest.finish();
}
});
}
});
</script>
</pre>
</body>
</html>

View File

@ -46,7 +46,13 @@ var exceptionTests = [
message: "wrong object type as second parameter" },
{ params: [{video: true, fake: true}, unexpectedCall, 1],
error: "Argument 3 of Navigator.mozGetUserMedia is not an object.",
message: "wrong object type as third parameter" }
message: "wrong object type as third parameter" },
// Each test here verifies constraint syntax as defined in webidl
{ params: [{ fake: true, video: { optional: [{ facingMode:'foo' }] } },
unexpectedCall, unexpectedCall],
error: "'facingMode' member of MediaTrackConstraintSet 'foo' is not a valid value for enumeration VideoFacingModeEnum.",
message: "invalid facingMode enum value" }
];
/**
@ -72,6 +78,9 @@ runTest(function () {
navigator.mozGetUserMedia.apply(navigator, test.params);
} catch (e) {
exception = (e.message === test.error);
if(!exception) {
info(e.message);
}
}
ok(exception, "Exception for " + test.message);
});

View File

@ -457,7 +457,8 @@ ThrowJSException(JSContext *cx, const char *message)
ucex.Length());
if (str) {
::JS_SetPendingException(cx, STRING_TO_JSVAL(str));
JS::RootedValue exn(cx, JS::StringValue(str));
::JS_SetPendingException(cx, exn);
}
PopException();

View File

@ -3,7 +3,7 @@
# 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/.
MOCHITEST_FILES_A = \
MOCHITEST_FILES = \
DOMTestCase.js \
activity-home.css \
exclusions.js \
@ -68,9 +68,6 @@ MOCHITEST_FILES_A = \
test_characterdatasetnodevalue.html \
test_characterdatasubstringexceedsvalue.html \
test_characterdatasubstringvalue.html \
$(NULL)
MOCHITEST_FILES_B = \
test_commentgetcomment.html \
test_documentcreateattribute.html \
test_documentcreatecdatasection.html \
@ -144,9 +141,6 @@ MOCHITEST_FILES_B = \
test_entitygetentityname.html \
test_entitygetpublicid.html \
test_entitygetpublicidnull.html \
$(NULL)
MOCHITEST_FILES_C = \
test_hc_attrappendchild1.html \
test_hc_attrappendchild2.html \
test_hc_attrappendchild3.html \
@ -185,9 +179,6 @@ MOCHITEST_FILES_C = \
test_hc_attrsetvalue2.html \
test_hc_attrspecifiedvalue.html \
test_hc_attrspecifiedvaluechanged.html \
$(NULL)
MOCHITEST_FILES_D = \
test_hc_characterdataappenddata.html \
test_hc_characterdataappenddatagetdata.html \
test_hc_characterdatadeletedatabegining.html \
@ -268,9 +259,6 @@ MOCHITEST_FILES_D = \
test_hc_elementretrievetagname.html \
test_hc_elementsetattributenodenull.html \
test_hc_elementwrongdocumenterr.html \
$(NULL)
MOCHITEST_FILES_E = \
test_hc_entitiesremovenameditem1.html \
test_hc_entitiessetnameditem1.html \
test_hc_namednodemapchildnoderange.html \
@ -386,9 +374,6 @@ MOCHITEST_FILES_E = \
test_hc_textsplittextthree.html \
test_hc_textsplittexttwo.html \
test_hc_textwithnomarkup.html \
$(NULL)
MOCHITEST_FILES_F = \
test_namednodemapchildnoderange.html \
test_namednodemapgetnameditem.html \
test_namednodemapinuseattributeerr.html \
@ -489,9 +474,6 @@ MOCHITEST_FILES_F = \
test_nodelistreturnfirstitem.html \
test_nodelistreturnlastitem.html \
test_nodelisttraverselist.html \
$(NULL)
MOCHITEST_FILES_G = \
test_nodenotationnodeattributes.html \
test_nodenotationnodename.html \
test_nodenotationnodetype.html \
@ -557,5 +539,3 @@ MOCHITEST_FILES_G = \
# test_PIsetdatanomodificationallowederrEE.html was originally
# test_processinginstructionsetdatanomodificationallowederrEE.html, but that
# name is too long for Windows little brain.
MOCHITEST_FILES_PARTS := $(foreach part,A B C D E F G,MOCHITEST_FILES_$(part))

View File

@ -3,7 +3,7 @@
# 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/.
MOCHITEST_FILES_A = \
MOCHITEST_FILES = \
DOMTestCase.js \
exclusions.js \
test_attrgetownerelement01.html \
@ -50,9 +50,6 @@ MOCHITEST_FILES_A = \
test_documentgetelementsbytagnameNS03.html \
test_documentgetelementsbytagnameNS04.html \
test_documentgetelementsbytagnameNS05.html \
$(NULL)
MOCHITEST_FILES_B = \
test_documentimportnode01.html \
test_documentimportnode02.html \
test_documentimportnode03.html \
@ -87,9 +84,6 @@ MOCHITEST_FILES_B = \
test_domimplementationfeaturecore.html \
test_domimplementationfeaturexmlversion2.html \
test_domimplementationhasfeature01.html \
$(NULL)
MOCHITEST_FILES_C = \
test_elementgetattributenodens01.html \
test_elementgetattributenodens02.html \
test_elementgetattributenodens03.html \
@ -134,9 +128,6 @@ MOCHITEST_FILES_C = \
test_getElementsByTagNameNS05.html \
test_getElementsByTagNameNS06.html \
test_getElementsByTagNameNS07.html \
$(NULL)
MOCHITEST_FILES_D = \
test_getElementsByTagNameNS08.html \
test_getElementsByTagNameNS09.html \
test_getElementsByTagNameNS10.html \
@ -180,9 +171,6 @@ MOCHITEST_FILES_D = \
test_importNode16.html \
test_importNode17.html \
test_internalSubset01.html \
$(NULL)
MOCHITEST_FILES_E = \
test_localName01.html \
test_localName02.html \
test_localName03.html \
@ -226,9 +214,6 @@ MOCHITEST_FILES_E = \
test_nodehasattributes02.html \
test_nodehasattributes03.html \
test_nodehasattributes04.html \
$(NULL)
MOCHITEST_FILES_F = \
test_nodenormalize01.html \
test_normalize01.html \
test_ownerDocument01.html \
@ -265,5 +250,3 @@ MOCHITEST_FILES_F = \
test_setNamedItemNS05.html \
test_systemId01.html \
$(NULL)
MOCHITEST_FILES_PARTS := $(foreach part,A B C D E F,MOCHITEST_FILES_$(part))

View File

@ -3,7 +3,7 @@
# 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/.
MOCHITEST_FILES_A = \
MOCHITEST_FILES = \
DOMTestCase.js \
test_anchor01.html \
test_anchor02.html \
@ -83,7 +83,7 @@ MOCHITEST_FILES_A = \
# This test is failing on all platforms -- bug 471139
# test_HTMLDocument12.html \
#
MOCHITEST_FILES_B = \
MOCHITEST_FILES += \
test_HTMLDirectoryElement01.html \
test_HTMLDivElement01.html \
test_HTMLDlistElement01.html \
@ -251,8 +251,6 @@ MOCHITEST_FILES_B = \
test_HTMLElement97.html \
test_HTMLElement98.html \
test_HTMLElement99.html \
$(NULL)
MOCHITEST_FILES_C = \
test_HTMLFieldSetElement01.html \
test_HTMLFieldSetElement02.html \
test_HTMLFontElement01.html \
@ -365,9 +363,6 @@ MOCHITEST_FILES_C = \
test_HTMLModElement02.html \
test_HTMLModElement03.html \
test_HTMLModElement04.html \
$(NULL)
MOCHITEST_FILES_D = \
test_HTMLObjectElement01.html \
test_HTMLObjectElement02.html \
test_HTMLObjectElement03.html \
@ -600,8 +595,6 @@ MOCHITEST_FILES_D = \
test_HTMLTitleElement01.html \
test_HTMLUListElement01.html \
test_HTMLUListElement02.html \
$(NULL)
MOCHITEST_FILES_E = \
test_object01.html \
test_object02.html \
test_object03.html \
@ -671,9 +664,6 @@ MOCHITEST_FILES_E = \
test_hasFeature04.html \
test_hasFeature05.html \
test_hasFeature06.html \
$(NULL)
MOCHITEST_FILES_F = \
test_HTMLAppletElement01.html \
test_HTMLAppletElement02.html \
test_HTMLAppletElement03.html \
@ -686,5 +676,3 @@ MOCHITEST_FILES_F = \
test_HTMLAppletElement10.html \
test_HTMLAppletElement11.html \
$(NULL)
MOCHITEST_FILES_PARTS := $(foreach part,A B C D E,MOCHITEST_FILES_$(part))

View File

@ -6,8 +6,6 @@
#include "ScaledFontCairo.h"
#include "Logging.h"
#include "gfxFont.h"
#ifdef MOZ_ENABLE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H

View File

@ -284,7 +284,7 @@ gfxPlatform::gfxPlatform()
false);
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
uint32_t contentMask = 0;
uint32_t contentMask = 1 << BACKEND_CAIRO;
InitBackendPrefs(canvasMask, contentMask);
}

View File

@ -235,7 +235,6 @@ gfxPlatformMac::UpdateFontList()
static const char kFontArialUnicodeMS[] = "Arial Unicode MS";
static const char kFontAppleBraille[] = "Apple Braille";
static const char kFontAppleSymbols[] = "Apple Symbols";
static const char kFontAppleMyungjo[] = "AppleMyungjo";
static const char kFontGeneva[] = "Geneva";
static const char kFontGeezaPro[] = "Geeza Pro";
static const char kFontHiraginoKakuGothic[] = "Hiragino Kaku Gothic ProN";

View File

@ -810,6 +810,14 @@ gfxUserFontSet::UserFontCache::Entry::RemoveIfPrivate(Entry* aEntry,
return aEntry->mPrivate ? PL_DHASH_REMOVE : PL_DHASH_NEXT;
}
PLDHashOperator
gfxUserFontSet::UserFontCache::Entry::RemoveIfMatches(Entry* aEntry,
void* aUserData)
{
return aEntry->GetFontEntry() == static_cast<gfxFontEntry*>(aUserData) ?
PL_DHASH_REMOVE : PL_DHASH_NEXT;
}
PLDHashOperator
gfxUserFontSet::UserFontCache::Entry::DisconnectSVG(Entry* aEntry,
void* aUserData)
@ -891,6 +899,11 @@ gfxUserFontSet::UserFontCache::CacheFont(gfxFontEntry *aFontEntry)
gfxUserFontData *data = aFontEntry->mUserFontData;
sUserFonts->PutEntry(Key(data->mURI, data->mPrincipal, aFontEntry,
data->mPrivate));
#ifdef DEBUG_USERFONT_CACHE
printf("userfontcache added fontentry: %p\n", aFontEntry);
Dump();
#endif
}
void
@ -902,11 +915,16 @@ gfxUserFontSet::UserFontCache::ForgetFont(gfxFontEntry *aFontEntry)
return;
}
gfxUserFontData *data = aFontEntry->mUserFontData;
if (data) {
sUserFonts->RemoveEntry(Key(data->mURI, data->mPrincipal, aFontEntry,
data->mPrivate));
}
// We can't simply use RemoveEntry here because it's possible the principal
// may have changed since the font was cached, in which case the lookup
// would no longer find the entry (bug 838105).
sUserFonts->EnumerateEntries(
gfxUserFontSet::UserFontCache::Entry::RemoveIfMatches, aFontEntry);
#ifdef DEBUG_USERFONT_CACHE
printf("userfontcache removed fontentry: %p\n", aFontEntry);
Dump();
#endif
}
gfxFontEntry*
@ -936,3 +954,52 @@ gfxUserFontSet::UserFontCache::Shutdown()
sUserFonts = nullptr;
}
}
#ifdef DEBUG_USERFONT_CACHE
PLDHashOperator
gfxUserFontSet::UserFontCache::Entry::DumpEntry(Entry* aEntry, void* aUserData)
{
nsresult rv;
nsAutoCString principalURISpec;
nsCOMPtr<nsIURI> principalURI;
rv = aEntry->mPrincipal->GetURI(getter_AddRefs(principalURI));
if (NS_SUCCEEDED(rv)) {
principalURI->GetSpec(principalURISpec);
}
bool setDomain = false;
nsCOMPtr<nsIURI> domainURI;
aEntry->mPrincipal->GetDomain(getter_AddRefs(domainURI));
if (domainURI) {
setDomain = true;
}
NS_ASSERTION(aEntry->mURI, "null URI in userfont cache entry");
printf("userfontcache fontEntry: %p fonturihash: %8.8x family: %s domainset: %s principal: [%s]\n",
aEntry->mFontEntry,
nsURIHashKey::HashKey(aEntry->mURI),
NS_ConvertUTF16toUTF8(aEntry->mFontEntry->FamilyName()).get(),
(setDomain ? "true" : "false"),
principalURISpec.get()
);
return PL_DHASH_NEXT;
}
void
gfxUserFontSet::UserFontCache::Dump()
{
if (!sUserFonts) {
return;
}
printf("userfontcache dump count: %d ========\n", sUserFonts->Count());
sUserFonts->EnumerateEntries(Entry::DumpEntry, nullptr);
printf("userfontcache dump ==================\n");
}
#endif

View File

@ -22,6 +22,8 @@
class gfxMixedFontFamily;
class nsFontFaceLoader;
//#define DEBUG_USERFONT_CACHE
// parsed CSS @font-face rule information
// lifetime: from when @font-face rule processed until font is loaded
struct gfxFontFaceSrc {
@ -270,6 +272,11 @@ public:
// Clear everything so that we don't leak URIs and Principals.
static void Shutdown();
#ifdef DEBUG_USERFONT_CACHE
// dump contents
static void Dump();
#endif
private:
// Helper that we use to observe the empty-cache notification
// from nsICacheService.
@ -346,8 +353,13 @@ public:
gfxFontEntry* GetFontEntry() const { return mFontEntry; }
static PLDHashOperator RemoveIfPrivate(Entry* aEntry, void* aUserData);
static PLDHashOperator RemoveIfMatches(Entry* aEntry, void* aUserData);
static PLDHashOperator DisconnectSVG(Entry* aEntry, void* aUserData);
#ifdef DEBUG_USERFONT_CACHE
static PLDHashOperator DumpEntry(Entry* aEntry, void* aUserData);
#endif
private:
static uint32_t
HashFeatures(const nsTArray<gfxFontFeature>& aFeatures) {

View File

@ -100,7 +100,6 @@ MOCHITEST_CHROME_FILES = imgutils.js \
damon.jpg \
test_removal_onload.html \
test_removal_ondecode.html \
invalid.jpg \
bad.jpg \
rillybad.jpg \
red.png \

View File

@ -118,7 +118,7 @@ JavaScriptChild::fail(JSContext *cx, ReturnStatus *rs)
// to the IPC code, and we don't want a JS failure to cause the death
// of the child process.
jsval exn;
RootedValue exn(cx);
if (!JS_GetPendingException(cx, &exn))
return true;

View File

@ -80,7 +80,7 @@ jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapStatus
jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
jsval *rval, void *closure)
jsval *rvalArg, void *closure)
{
JSDScript* jsdscript;
JSDContext* jsdc = (JSDContext*) closure;
@ -107,10 +107,13 @@ jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
if( ! jsdscript )
return JSTRAP_CONTINUE;
JS_GetPendingException(cx, rval);
JS::RootedValue rval(cx);
JS_GetPendingException(cx, &rval);
return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_THROW,
hook, hookData, rval);
JSTrapStatus result = jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_THROW,
hook, hookData, rval.address());
*rvalArg = rval;
return result;
}
JSTrapStatus

View File

@ -524,7 +524,7 @@ jsd_IsValidFrameInThreadState(JSDContext* jsdc,
JSD_ASSERT_VALID_THREAD_STATE(jsdthreadstate);
JSD_ASSERT_VALID_STACK_FRAME(jsdframe);
return true;
}
@ -538,13 +538,13 @@ _getContextForThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
if( valid )
return jsdthreadstate->context;
return NULL;
}
}
JSDValue*
jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
{
JSContext* cx;
jsval val;
JS::RootedValue val(cx);
if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate)))
return NULL;
@ -552,10 +552,10 @@ jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
if(JS_GetPendingException(cx, &val))
return jsd_NewValue(jsdc, val);
return NULL;
}
}
bool
jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate,
jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate,
JSDValue* jsdval)
{
JSContext* cx;
@ -563,10 +563,12 @@ jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate,
if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate)))
return false;
if(jsdval)
JS_SetPendingException(cx, JSD_GetValueWrappedJSVal(jsdc, jsdval));
else
if(jsdval) {
JS::RootedValue exn(cx, JSD_GetValueWrappedJSVal(jsdc, jsdval));
JS_SetPendingException(cx, exn);
} else {
JS_ClearPendingException(cx);
}
return true;
}

View File

@ -526,7 +526,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
{
if (JS_IsExceptionPending(cx))
{
if (!JS_GetPendingException(cx, propValue.address()))
if (!JS_GetPendingException(cx, &propValue))
{
return NULL;
}

View File

@ -495,17 +495,17 @@ jsds_ErrorHookProc (JSDContext *jsdc, JSContext *cx, const char *message,
if (running)
return JSD_ERROR_REPORTER_PASS_ALONG;
running = true;
nsCOMPtr<jsdIValue> val;
if (JS_IsExceptionPending(cx)) {
jsval jv;
JS::RootedValue jv(cx);
JS_GetPendingException(cx, &jv);
JSDValue *jsdv = JSD_NewValue (jsdc, jv);
val = dont_AddRef(jsdValue::FromPtr(jsdc, jsdv));
}
nsAutoCString fileName;
uint32_t line;
uint32_t pos;
@ -1999,7 +1999,7 @@ jsdStackFrame::Eval (const nsAString &bytes, const nsACString &fileName,
line, &jv);
if (!*_rval) {
if (JS_IsExceptionPending(cx))
JS_GetPendingException (cx, jv.address());
JS_GetPendingException (cx, &jv);
else
jv = JSVAL_NULL;
}

View File

@ -10,64 +10,46 @@ ifndef INCLUDED_TESTS_MOCHITEST_MK #{
# $1- test directory name
# $2- optional: if passed dot used to flatten directory hierarchy copy
# else- relativesrcdir
# else- determine relative path
mochitestdir = \
$(strip \
$(if $(2),$(DEPTH)/_tests/testing/mochitest/$1/. \
,$(if $(value relativesrcdir) \
,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \
,$(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir)) \
)))
,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \
))
define mochitest-libs-rule-template
libs:: $$($(1))
$$(call install_cmd,$$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2),$(3)))
endef
# Provide support for modules with such a large number of tests that
# installing them with a single $(INSTALL) invocation would overflow
# command-line length limits on some operating systems.
ifdef MOCHITEST_FILES_PARTS
ifdef MOCHITEST_FILES
$(error You must define only one of MOCHITEST_FILES_PARTS or MOCHITEST_FILES)
endif
$(foreach part,$(MOCHITEST_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),tests)))
endif
ifdef MOCHITEST_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_FILES,tests))
MOCHITEST_DEST := $(call mochitestdir,tests)
INSTALL_TARGETS += MOCHITEST
endif
ifdef MOCHITEST_CHROME_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_CHROME_FILES,chrome))
endif
ifdef MOCHITEST_BROWSER_FILES_PARTS
ifdef MOCHITEST_BROWSER_FILES
$(error You must define only one of MOCHITEST_BROWSER_FILES_PARTS or MOCHITEST_BROWSER_FILES)
endif
$(foreach part,$(MOCHITEST_BROWSER_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),browser)))
MOCHITEST_CHROME_DEST := $(call mochitestdir,chrome)
INSTALL_TARGETS += MOCHITEST_CHROME
endif
ifdef MOCHITEST_BROWSER_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_BROWSER_FILES,browser))
MOCHITEST_BROWSER_DEST := $(call mochitestdir,browser)
INSTALL_TARGETS += MOCHITEST_BROWSER
endif
ifdef MOCHITEST_A11Y_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_A11Y_FILES,a11y))
MOCHITEST_A11Y_DEST := $(call mochitestdir,a11y)
INSTALL_TARGETS += MOCHITEST_A11Y
endif
ifdef MOCHITEST_METRO_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_METRO_FILES,metro))
MOCHITEST_METRO_DEST := $(call mochitestdir,metro)
INSTALL_TARGETS += MOCHITEST_METRO
endif
ifdef MOCHITEST_ROBOCOP_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_ROBOCOP_FILES,tests/robocop,flat_hierarchy))
MOCHITEST_ROBOCOP_DEST := $(call mochitestdir,tests/robocop,flat_hierarchy)
INSTALL_TARGETS += MOCHITEST_ROBOCOP
endif
ifdef MOCHITEST_WEBAPPRT_CHROME_FILES
$(eval $(call mochitest-libs-rule-template,MOCHITEST_WEBAPPRT_CHROME_FILES,webapprtChrome))
MOCHITEST_WEBAPPRT_CHROME_DEST := $(call mochitestdir,webapprtChrome)
INSTALL_TARGETS += MOCHITEST_WEBAPPRT_CHROME
endif
INCLUDED_TESTS_MOCHITEST_MK := 1

View File

@ -43,10 +43,7 @@ endef
$(foreach subtier,export compile libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
compile export:: $(SUBMAKEFILES)
compile export tools:: $(SUBMAKEFILES)
$(LOOP_OVER_TOOL_DIRS)
tools:: $(SUBMAKEFILES)
$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
endif

View File

@ -47,6 +47,8 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
_DEPRECATED_VARIABLES := \
XPIDL_FLAGS \
MOCHITEST_FILES_PARTS \
MOCHITEST_BROWSER_FILES_PARTS \
$(NULL)
ifndef EXTERNALLY_MANAGED_MAKE_FILE
@ -735,6 +737,13 @@ compile:: $(OBJS) $(HOST_OBJS)
include $(topsrcdir)/config/makefiles/target_libs.mk
ifdef IS_TOOL_DIR
# One would think "tools:: libs" would work, but it turns out that combined with
# bug 907365, this makes make forget to run some rules sometimes.
tools::
@$(MAKE) libs
endif
##############################################
ifndef NO_PROFILE_GUIDED_OPTIMIZE
ifdef MOZ_PROFILE_USE
@ -1739,10 +1748,8 @@ FREEZE_VARIABLES = \
EXTRA_COMPONENTS \
EXTRA_PP_COMPONENTS \
MOCHITEST_FILES \
MOCHITEST_FILES_PARTS \
MOCHITEST_CHROME_FILES \
MOCHITEST_BROWSER_FILES \
MOCHITEST_BROWSER_FILES_PARTS \
MOCHITEST_A11Y_FILES \
MOCHITEST_METRO_FILES \
MOCHITEST_ROBOCOP_FILES \

View File

@ -2590,7 +2590,7 @@ ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, void* b
// hard failure (out of memory, or some other similarly serious condition).
// We store any pending exception in case we need to re-throw it.
RootedValue ex(cx);
if (!JS_GetPendingException(cx, ex.address()))
if (!JS_GetPendingException(cx, &ex))
return false;
// Otherwise, assume soft failure. Clear the pending exception so that we

View File

@ -104,3 +104,8 @@ var p = new Proxy(global,
getOwnPropertyDescriptor:function(name) { return {value:Int32Array}}});
new Int32Array(ab)[4] = 42;
assertEq(f1(p, null, ab)(), 42);
// GVN checks
assertEq(asmLink(asmCompile(USE_ASM + "var g=0; function f() { var x = 0; g = 1; x = g; return (x+g)|0 } return f"))(), 2);
assertEq(asmLink(asmCompile(USE_ASM + "var g=0; function f() { var x = 0; g = 1; x = g; g = 2; return (x+g)|0 } return f"))(), 3);
assertEq(asmLink(asmCompile(USE_ASM + "var g=0; var h=0; function f() { var x = 0; g = 1; x = g; h = 3; return (x+g)|0 } return f"))(), 2);

View File

@ -531,6 +531,10 @@ assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'const
assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { return u8[-2147483648>>0]|0; } return f'), this, null, buf)(),0);
assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'const i=-2147483648; function f() { return u8[i>>0]|0; } return f'), this, null, buf)(),0);
// GVN checks
var buf = new ArrayBuffer(8192);
assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'var i=0; function f() { var x = 0, y = 0; u8[0] = 1; u8[1] = 2; x = 0|u8[i]; i = x; y = 0|u8[i]; return y|0;} return f'), this, null, buf)(),2);
assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'var i=0; function f() { var x = 0, y = 0; u8[0] = 1; u8[1] = 2; x = 0|u8[i]; y = 0|u8[i]; return (x+y)|0;} return f'), this, null, buf)(),2);
// Heap length constraints
var buf = new ArrayBuffer(0x0fff);

View File

@ -0,0 +1,26 @@
// Debugger.prototype.makeGlobalObjectReference returns a D.O for a global
// without adding it as a debuggee.
let g1 = newGlobal();
let dbg = new Debugger;
assertEq(dbg.hasDebuggee(g1), false);
let g1w = dbg.makeGlobalObjectReference(g1);
assertEq(dbg.hasDebuggee(g1), false);
assertEq(g1w.unsafeDereference(), g1);
assertEq(g1w, g1w.makeDebuggeeValue(g1));
assertEq(dbg.addDebuggee(g1w), g1w);
assertEq(dbg.hasDebuggee(g1), true);
assertEq(dbg.hasDebuggee(g1w), true);
assertEq(g1w.unsafeDereference(), g1);
assertEq(g1w, g1w.makeDebuggeeValue(g1));
// makeGlobalObjectReference dereferences CCWs.
let g2 = newGlobal();
g2.g1 = g1;
let g2w = dbg.addDebuggee(g2);
let g2g1w = g2w.getOwnPropertyDescriptor('g1').value;
assertEq(g2g1w !== g1w, true);
assertEq(g2g1w.unwrap(), g1w);
assertEq(dbg.makeGlobalObjectReference(g2g1w), g1w);

View File

@ -0,0 +1,13 @@
// Debugger.prototype.makeGlobalObjectReference only accepts actual global objects.
load(libdir + 'asserts.js');
var dbg = new Debugger;
assertThrowsInstanceOf(() => dbg.makeGlobalObjectReference(true), TypeError);
assertThrowsInstanceOf(() => dbg.makeGlobalObjectReference("foo"), TypeError);
assertThrowsInstanceOf(() => dbg.makeGlobalObjectReference(12), TypeError);
assertThrowsInstanceOf(() => dbg.makeGlobalObjectReference(undefined), TypeError);
assertThrowsInstanceOf(() => dbg.makeGlobalObjectReference(null), TypeError);
assertThrowsInstanceOf(() => dbg.makeGlobalObjectReference({ xlerb: "sbot" }), TypeError);
assertEq(dbg.makeGlobalObjectReference(this) instanceof Debugger.Object, true);

View File

@ -7412,7 +7412,7 @@ CodeGenerator::visitAsmJSCheckOverRecursed(LAsmJSCheckOverRecursed *lir)
}
bool
CodeGenerator::emitAssertRangeI(Range *r, Register input)
CodeGenerator::emitAssertRangeI(const Range *r, Register input)
{
// Check the lower bound.
if (r->lower() != INT32_MIN) {
@ -7430,7 +7430,7 @@ CodeGenerator::emitAssertRangeI(Range *r, Register input)
masm.bind(&success);
}
// For r->isDecimal() and r->exponent(), there's nothing to check, because
// For r->canHaveFractionalPart() and r->exponent(), there's nothing to check, because
// if we ended up in the integer range checking code, the value is already
// in an integer register in the integer range.
@ -7438,7 +7438,7 @@ CodeGenerator::emitAssertRangeI(Range *r, Register input)
}
bool
CodeGenerator::emitAssertRangeD(Range *r, FloatRegister input, FloatRegister temp)
CodeGenerator::emitAssertRangeD(const Range *r, FloatRegister input, FloatRegister temp)
{
// Check the lower bound.
if (!r->isLowerInfinite()) {
@ -7461,7 +7461,7 @@ CodeGenerator::emitAssertRangeD(Range *r, FloatRegister input, FloatRegister tem
masm.bind(&success);
}
// This code does not yet check r->isDecimal(). This would require new
// This code does not yet check r->canHaveFractionalPart(). This would require new
// assembler interfaces to make rounding instructions available.
if (!r->isInfinite()) {
@ -7488,7 +7488,7 @@ bool
CodeGenerator::visitAssertRangeI(LAssertRangeI *ins)
{
Register input = ToRegister(ins->input());
Range *r = ins->range();
const Range *r = ins->range();
return emitAssertRangeI(r, input);
}
@ -7498,7 +7498,7 @@ CodeGenerator::visitAssertRangeD(LAssertRangeD *ins)
{
FloatRegister input = ToFloatRegister(ins->input());
FloatRegister temp = ToFloatRegister(ins->temp());
Range *r = ins->range();
const Range *r = ins->range();
return emitAssertRangeD(r, input, temp);
}
@ -7508,7 +7508,7 @@ CodeGenerator::visitAssertRangeF(LAssertRangeF *ins)
{
FloatRegister input = ToFloatRegister(ins->input());
FloatRegister temp = ToFloatRegister(ins->temp());
Range *r = ins->range();
const Range *r = ins->range();
masm.convertFloatToDouble(input, input);
bool success = emitAssertRangeD(r, input, temp);
@ -7519,7 +7519,7 @@ CodeGenerator::visitAssertRangeF(LAssertRangeF *ins)
bool
CodeGenerator::visitAssertRangeV(LAssertRangeV *ins)
{
Range *r = ins->range();
const Range *r = ins->range();
const ValueOperand value = ToValue(ins, LAssertRangeV::Input);
Register tag = masm.splitTagForTest(value);
Label done;

View File

@ -363,8 +363,8 @@ class CodeGenerator : public CodeGeneratorSpecific
// Bailout if an element about to be written to is a hole.
bool emitStoreHoleCheck(Register elements, const LAllocation *index, LSnapshot *snapshot);
bool emitAssertRangeI(Range *r, Register input);
bool emitAssertRangeD(Range *r, FloatRegister input, FloatRegister temp);
bool emitAssertRangeI(const Range *r, Register input);
bool emitAssertRangeD(const Range *r, FloatRegister input, FloatRegister temp);
// Script counts created when compiling code with no associated JSScript.
IonScriptCounts *unassociatedScriptCounts_;

View File

@ -5097,7 +5097,7 @@ class LAssertRangeI : public LInstructionHelper<0, 1, 0>
MAssertRange *mir() {
return mir_->toAssertRange();
}
Range *range() {
const Range *range() {
return mir()->range();
}
};
@ -5123,7 +5123,7 @@ class LAssertRangeD : public LInstructionHelper<0, 1, 1>
MAssertRange *mir() {
return mir_->toAssertRange();
}
Range *range() {
const Range *range() {
return mir()->range();
}
};
@ -5149,7 +5149,7 @@ class LAssertRangeF : public LInstructionHelper<0, 1, 1>
MAssertRange *mir() {
return mir_->toAssertRange();
}
Range *range() {
const Range *range() {
return mir()->range();
}
};
@ -5182,7 +5182,7 @@ class LAssertRangeV : public LInstructionHelper<0, BOX_PIECES, 3>
MAssertRange *mir() {
return mir_->toAssertRange();
}
Range *range() {
const Range *range() {
return mir()->range();
}
};

View File

@ -1080,7 +1080,7 @@ LinearScanAllocator::findBestBlockedRegister(CodePosition *nextUsed)
if (nextUsePos[reg.code()] != CodePosition::MIN) {
CodePosition pos = i->intersect(current);
if (pos != CodePosition::MIN && pos < nextUsePos[reg.code()]) {
nextUsePos[reg.code()] = pos;
nextUsePos[reg.code()] = (pos == current->start()) ? CodePosition::MIN : pos;
IonSpew(IonSpew_RegAlloc, " Register %s next used %u (fixed)", reg.name(), pos.pos());
}
}

View File

@ -2432,6 +2432,50 @@ MLoadFixedSlot::mightAlias(MDefinition *store)
return true;
}
bool
MAsmJSLoadHeap::mightAlias(MDefinition *def)
{
if (def->isAsmJSStoreHeap()) {
MAsmJSStoreHeap *store = def->toAsmJSStoreHeap();
if (store->viewType() != viewType())
return true;
if (!ptr()->isConstant() || !store->ptr()->isConstant())
return true;
MConstant *otherPtr = store->ptr()->toConstant();
return ptr()->toConstant()->value() == otherPtr->value();
}
return true;
}
bool
MAsmJSLoadHeap::congruentTo(MDefinition *ins) const
{
if (!ins->isAsmJSLoadHeap())
return false;
MAsmJSLoadHeap *load = ins->toAsmJSLoadHeap();
return load->viewType() == viewType() && congruentIfOperandsEqual(load);
}
bool
MAsmJSLoadGlobalVar::mightAlias(MDefinition *def)
{
if (def->isAsmJSStoreGlobalVar()) {
MAsmJSStoreGlobalVar *store = def->toAsmJSStoreGlobalVar();
return store->globalDataOffset() == globalDataOffset_;
}
return true;
}
bool
MAsmJSLoadGlobalVar::congruentTo(MDefinition *ins) const
{
if (ins->isAsmJSLoadGlobalVar()) {
MAsmJSLoadGlobalVar *load = ins->toAsmJSLoadGlobalVar();
return globalDataOffset_ == load->globalDataOffset_;
}
return false;
}
bool
MLoadSlot::mightAlias(MDefinition *store)
{

View File

@ -217,10 +217,12 @@ class AliasSet {
FixedSlot = 1 << 3, // A member of obj->fixedSlots().
TypedArrayElement = 1 << 4, // A typed array element.
DOMProperty = 1 << 5, // A DOM property
Last = DOMProperty,
AsmJSGlobalVar = 1 << 6, // An asm.js global var
AsmJSHeap = 1 << 7, // An asm.js heap load
Last = AsmJSHeap,
Any = Last | (Last - 1),
NumCategories = 6,
NumCategories = 8,
// Indicates load or store.
Store_ = 1 << 31
@ -8406,6 +8408,7 @@ class MAsmJSLoadHeap : public MUnaryInstruction, public MAsmJSHeapAccess
MAsmJSLoadHeap(ArrayBufferView::ViewType vt, MDefinition *ptr)
: MUnaryInstruction(ptr), MAsmJSHeapAccess(vt, false)
{
setMovable();
if (vt == ArrayBufferView::TYPE_FLOAT32 || vt == ArrayBufferView::TYPE_FLOAT64)
setResultType(MIRType_Double);
else
@ -8420,6 +8423,12 @@ class MAsmJSLoadHeap : public MUnaryInstruction, public MAsmJSHeapAccess
}
MDefinition *ptr() const { return getOperand(0); }
bool congruentTo(MDefinition *ins) const;
AliasSet getAliasSet() const {
return AliasSet::Load(AliasSet::AsmJSHeap);
}
bool mightAlias(MDefinition *def);
};
class MAsmJSStoreHeap : public MBinaryInstruction, public MAsmJSHeapAccess
@ -8437,6 +8446,10 @@ class MAsmJSStoreHeap : public MBinaryInstruction, public MAsmJSHeapAccess
MDefinition *ptr() const { return getOperand(0); }
MDefinition *value() const { return getOperand(1); }
AliasSet getAliasSet() const {
return AliasSet::Store(AliasSet::AsmJSHeap);
}
};
class MAsmJSLoadGlobalVar : public MNullaryInstruction
@ -8446,8 +8459,7 @@ class MAsmJSLoadGlobalVar : public MNullaryInstruction
{
JS_ASSERT(type == MIRType_Int32 || type == MIRType_Double);
setResultType(type);
if (isConstant)
setMovable();
setMovable();
}
unsigned globalDataOffset_;
@ -8462,12 +8474,13 @@ class MAsmJSLoadGlobalVar : public MNullaryInstruction
unsigned globalDataOffset() const { return globalDataOffset_; }
bool congruentTo(MDefinition *ins) const;
AliasSet getAliasSet() const {
if (isConstant_)
return AliasSet::None();
else
return AliasSet::Store(AliasSet::Any);
return AliasSet::Load(AliasSet::AsmJSGlobalVar);
}
bool mightAlias(MDefinition *def);
};
class MAsmJSStoreGlobalVar : public MUnaryInstruction
@ -8487,6 +8500,10 @@ class MAsmJSStoreGlobalVar : public MUnaryInstruction
unsigned globalDataOffset() const { return globalDataOffset_; }
MDefinition *value() const { return getOperand(0); }
AliasSet getAliasSet() const {
return AliasSet::Store(AliasSet::AsmJSGlobalVar);
}
};
class MAsmJSLoadFuncPtr : public MUnaryInstruction

View File

@ -270,7 +270,7 @@ Range::print(Sprinter &sp) const
JS_ASSERT_IF(upper_infinite_, upper_ == JSVAL_INT_MAX);
// Real or Natural subset.
if (decimal_)
if (canHaveFractionalPart_)
sp.printf("R");
else
sp.printf("N");
@ -340,7 +340,7 @@ Range::intersect(const Range *lhs, const Range *rhs, bool *emptyRange)
Range *r = new Range(
newLower, newUpper,
lhs->decimal_ && rhs->decimal_,
lhs->canHaveFractionalPart_ && rhs->canHaveFractionalPart_,
Min(lhs->max_exponent_, rhs->max_exponent_));
r->lower_infinite_ = lhs->lower_infinite_ && rhs->lower_infinite_;
@ -352,7 +352,7 @@ Range::intersect(const Range *lhs, const Range *rhs, bool *emptyRange)
void
Range::unionWith(const Range *other)
{
bool decimal = decimal_ | other->decimal_;
bool canHaveFractionalPart = canHaveFractionalPart_ | other->canHaveFractionalPart_;
uint16_t max_exponent = Max(max_exponent_, other->max_exponent_);
if (lower_infinite_ || other->lower_infinite_)
@ -365,7 +365,7 @@ Range::unionWith(const Range *other)
else
setUpperInit(Max(upper_, other->upper_));
decimal_ = decimal;
canHaveFractionalPart_ = canHaveFractionalPart;
max_exponent_ = max_exponent;
}
@ -413,7 +413,7 @@ Range::add(const Range *lhs, const Range *rhs)
if (lhs->isUpperInfinite() || rhs->isUpperInfinite())
h = RANGE_INF_MAX;
return new Range(l, h, lhs->isDecimal() || rhs->isDecimal(),
return new Range(l, h, lhs->canHaveFractionalPart() || rhs->canHaveFractionalPart(),
Max(lhs->exponent(), rhs->exponent()) + 1);
}
@ -428,7 +428,7 @@ Range::sub(const Range *lhs, const Range *rhs)
if (lhs->isUpperInfinite() || rhs->isLowerInfinite())
h = RANGE_INF_MAX;
return new Range(l, h, lhs->isDecimal() || rhs->isDecimal(),
return new Range(l, h, lhs->canHaveFractionalPart() || rhs->canHaveFractionalPart(),
Max(lhs->exponent(), rhs->exponent()) + 1);
}
@ -593,10 +593,10 @@ Range::not_(const Range *op)
Range *
Range::mul(const Range *lhs, const Range *rhs)
{
bool decimal = lhs->isDecimal() || rhs->isDecimal();
bool fractional = lhs->canHaveFractionalPart() || rhs->canHaveFractionalPart();
uint16_t exponent = lhs->numBits() + rhs->numBits() - 1;
if (HasInfinite(lhs, rhs))
return new Range(RANGE_INF_MIN, RANGE_INF_MAX, decimal, exponent);
return new Range(RANGE_INF_MIN, RANGE_INF_MAX, fractional, exponent);
int64_t a = (int64_t)lhs->lower_ * (int64_t)rhs->lower_;
int64_t b = (int64_t)lhs->lower_ * (int64_t)rhs->upper_;
int64_t c = (int64_t)lhs->upper_ * (int64_t)rhs->lower_;
@ -604,7 +604,7 @@ Range::mul(const Range *lhs, const Range *rhs)
return new Range(
Min( Min(a, b), Min(c, d) ),
Max( Max(a, b), Max(c, d) ),
decimal, exponent);
fractional, exponent);
}
Range *
@ -688,7 +688,7 @@ Range::abs(const Range *op)
return new Range(Max(Max(int64_t(0), l), -u),
Max(Abs(l), Abs(u)),
op->isDecimal(),
op->canHaveFractionalPart(),
op->exponent());
}
@ -701,7 +701,7 @@ Range::min(const Range *lhs, const Range *rhs)
return new Range(Min(lhs->lower(), rhs->lower()),
Min(lhs->upper(), rhs->upper()),
lhs->isDecimal() || rhs->isDecimal(),
lhs->canHaveFractionalPart() || rhs->canHaveFractionalPart(),
Max(lhs->exponent(), rhs->exponent()));
}
@ -714,7 +714,7 @@ Range::max(const Range *lhs, const Range *rhs)
return new Range(Max(lhs->lower(), rhs->lower()),
Max(lhs->upper(), rhs->upper()),
lhs->isDecimal() || rhs->isDecimal(),
lhs->canHaveFractionalPart() || rhs->canHaveFractionalPart(),
Max(lhs->exponent(), rhs->exponent()));
}
@ -744,14 +744,14 @@ Range::update(const Range *other)
lower_infinite_ != other->lower_infinite_ ||
upper_ != other->upper_ ||
upper_infinite_ != other->upper_infinite_ ||
decimal_ != other->decimal_ ||
canHaveFractionalPart_ != other->canHaveFractionalPart_ ||
max_exponent_ != other->max_exponent_;
if (changed) {
lower_ = other->lower_;
lower_infinite_ = other->lower_infinite_;
upper_ = other->upper_;
upper_infinite_ = other->upper_infinite_;
decimal_ = other->decimal_;
canHaveFractionalPart_ = other->canHaveFractionalPart_;
max_exponent_ = other->max_exponent_;
}
@ -841,7 +841,7 @@ MConstant::computeRange()
// Extract the exponent, to approximate it with the range analysis.
exp = ExponentComponent(d);
if (exp < 0) {
// This double only has a decimal part.
// This double only has a fractional part.
if (IsNegative(d))
setRange(new Range(-1, 0, true, 0));
else
@ -849,7 +849,7 @@ MConstant::computeRange()
} else if (exp < Range::MaxTruncatableExponent) {
// Extract the integral part.
int64_t integral = ToInt64(d);
// Extract the decimal part.
// Extract the fractional part.
double rest = d - (double) integral;
// Estimate the smallest integral boundaries.
// Safe double comparisons, because there is no precision loss.
@ -864,7 +864,7 @@ MConstant::computeRange()
setRange(new Range(l, h, (rest != 0), exp));
} else {
// This double has a precision loss. This also mean that it cannot
// encode any decimals.
// encode any values with fractional parts.
if (IsNegative(d))
setRange(new Range(RANGE_INF_MIN, RANGE_INF_MIN, false, exp));
else
@ -1080,7 +1080,7 @@ MMod::computeRange()
// If the value is known to be integer, less-than abs(rhs) is equivalent
// to less-than-or-equal abs(rhs)-1. This is important for being able to
// say that the result of x%256 is an 8-bit unsigned number.
if (!lhs.isDecimal() && !rhs.isDecimal())
if (!lhs.canHaveFractionalPart() && !rhs.canHaveFractionalPart())
--rhsAbsBound;
// Next, the absolute value of the result will never be greater than the
@ -1096,7 +1096,7 @@ MMod::computeRange()
int64_t lower = lhs.lower() >= 0 ? 0 : -absBound;
int64_t upper = lhs.upper() <= 0 ? 0 : absBound;
setRange(new Range(lower, upper, lhs.isDecimal() || rhs.isDecimal()));
setRange(new Range(lower, upper, lhs.canHaveFractionalPart() || rhs.canHaveFractionalPart()));
}
void

View File

@ -146,7 +146,7 @@ class Range : public TempObject {
int32_t upper_;
bool upper_infinite_;
bool decimal_;
bool canHaveFractionalPart_;
uint16_t max_exponent_;
// Any symbolic lower or upper bound computed for this term.
@ -159,7 +159,7 @@ class Range : public TempObject {
lower_infinite_(true),
upper_(JSVAL_INT_MAX),
upper_infinite_(true),
decimal_(true),
canHaveFractionalPart_(true),
max_exponent_(MaxDoubleExponent),
symbolicLower_(NULL),
symbolicUpper_(NULL)
@ -168,10 +168,10 @@ class Range : public TempObject {
JS_ASSERT_IF(upper_infinite_, upper_ == JSVAL_INT_MAX);
}
Range(int64_t l, int64_t h, bool d = false, uint16_t e = MaxInt32Exponent)
Range(int64_t l, int64_t h, bool f = false, uint16_t e = MaxInt32Exponent)
: lower_infinite_(true),
upper_infinite_(true),
decimal_(d),
canHaveFractionalPart_(f),
max_exponent_(e),
symbolicLower_(NULL),
symbolicUpper_(NULL)
@ -191,7 +191,7 @@ class Range : public TempObject {
lower_infinite_(other.lower_infinite_),
upper_(other.upper_),
upper_infinite_(other.upper_infinite_),
decimal_(other.decimal_),
canHaveFractionalPart_(other.canHaveFractionalPart_),
max_exponent_(other.max_exponent_),
symbolicLower_(NULL),
symbolicUpper_(NULL)
@ -266,15 +266,15 @@ class Range : public TempObject {
}
inline bool hasRoundingErrors() const {
return isDecimal() || exponent() >= MaxTruncatableExponent;
return canHaveFractionalPart() || exponent() >= MaxTruncatableExponent;
}
inline bool isInfinite() const {
return exponent() >= MaxDoubleExponent;
}
inline bool isDecimal() const {
return decimal_;
inline bool canHaveFractionalPart() const {
return canHaveFractionalPart_;
}
inline uint16_t exponent() const {
@ -329,15 +329,15 @@ class Range : public TempObject {
inline void setInt32() {
lower_infinite_ = false;
upper_infinite_ = false;
decimal_ = false;
canHaveFractionalPart_ = false;
max_exponent_ = MaxInt32Exponent;
}
inline void set(int64_t l, int64_t h, bool d = false, uint16_t e = MaxInt32Exponent) {
inline void set(int64_t l, int64_t h, bool f = false, uint16_t e = MaxInt32Exponent) {
max_exponent_ = e;
setLowerInit(l);
setUpperInit(h);
decimal_ = d;
canHaveFractionalPart_ = f;
rectifyExponent();
JS_ASSERT_IF(lower_infinite_, lower_ == JSVAL_INT_MIN);
JS_ASSERT_IF(upper_infinite_, upper_ == JSVAL_INT_MAX);

View File

@ -209,7 +209,7 @@ class JSAPITest
if (JS_IsExceptionPending(cx)) {
js::gc::AutoSuppressGC gcoff(cx);
JS::RootedValue v(cx);
JS_GetPendingException(cx, v.address());
JS_GetPendingException(cx, &v);
JS_ClearPendingException(cx);
JSString *s = JS_ValueToString(cx, v);
if (s) {

View File

@ -5745,9 +5745,8 @@ JS_NewDateObjectMsec(JSContext *cx, double msec)
}
JS_PUBLIC_API(bool)
JS_ObjectIsDate(JSContext *cx, JSObject *objArg)
JS_ObjectIsDate(JSContext *cx, HandleObject obj)
{
RootedObject obj(cx, objArg);
assertSameCompartment(cx, obj);
return ObjectClassIs(obj, ESClass_Date, cx);
}
@ -5766,9 +5765,8 @@ JS_ClearDateCaches(JSContext *cx)
* Regular Expressions.
*/
JS_PUBLIC_API(JSObject *)
JS_NewRegExpObject(JSContext *cx, JSObject *objArg, char *bytes, size_t length, unsigned flags)
JS_NewRegExpObject(JSContext *cx, HandleObject obj, char *bytes, size_t length, unsigned flags)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
jschar *chars = InflateString(cx, bytes, &length);
@ -5783,9 +5781,9 @@ JS_NewRegExpObject(JSContext *cx, JSObject *objArg, char *bytes, size_t length,
}
JS_PUBLIC_API(JSObject *)
JS_NewUCRegExpObject(JSContext *cx, JSObject *objArg, jschar *chars, size_t length, unsigned flags)
JS_NewUCRegExpObject(JSContext *cx, HandleObject obj, jschar *chars, size_t length,
unsigned flags)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics();
@ -5794,9 +5792,8 @@ JS_NewUCRegExpObject(JSContext *cx, JSObject *objArg, jschar *chars, size_t leng
}
JS_PUBLIC_API(void)
JS_SetRegExpInput(JSContext *cx, JSObject *objArg, JSString *input, bool multiline)
JS_SetRegExpInput(JSContext *cx, HandleObject obj, HandleString input, bool multiline)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, input);
@ -5805,9 +5802,8 @@ JS_SetRegExpInput(JSContext *cx, JSObject *objArg, JSString *input, bool multili
}
JS_PUBLIC_API(void)
JS_ClearRegExpStatics(JSContext *cx, JSObject *objArg)
JS_ClearRegExpStatics(JSContext *cx, HandleObject obj)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
JS_ASSERT(obj);
@ -5816,24 +5812,16 @@ JS_ClearRegExpStatics(JSContext *cx, JSObject *objArg)
}
JS_PUBLIC_API(bool)
JS_ExecuteRegExp(JSContext *cx, JSObject *objArg, JSObject *reobjArg, jschar *chars, size_t length,
size_t *indexp, bool test, jsval *rval)
JS_ExecuteRegExp(JSContext *cx, HandleObject obj, HandleObject reobj, jschar *chars,
size_t length, size_t *indexp, bool test, MutableHandleValue rval)
{
RootedObject obj(cx, objArg);
RootedObject reobj(cx, reobjArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics();
RootedValue val(cx);
if (!ExecuteRegExpLegacy(cx, res, reobj->as<RegExpObject>(), NullPtr(), chars, length, indexp,
test, &val))
{
return false;
}
*rval = val;
return true;
return ExecuteRegExpLegacy(cx, res, reobj->as<RegExpObject>(), NullPtr(), chars, length, indexp,
test, rval);
}
JS_PUBLIC_API(JSObject *)
@ -5860,35 +5848,26 @@ JS_NewUCRegExpObjectNoStatics(JSContext *cx, jschar *chars, size_t length, unsig
}
JS_PUBLIC_API(bool)
JS_ExecuteRegExpNoStatics(JSContext *cx, JSObject *objArg, jschar *chars, size_t length,
size_t *indexp, bool test, jsval *rval)
JS_ExecuteRegExpNoStatics(JSContext *cx, HandleObject obj, jschar *chars, size_t length,
size_t *indexp, bool test, MutableHandleValue rval)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
RootedValue val(cx);
if (!ExecuteRegExpLegacy(cx, NULL, obj->as<RegExpObject>(), NullPtr(), chars, length, indexp,
test, &val))
{
return false;
}
*rval = val;
return true;
return ExecuteRegExpLegacy(cx, NULL, obj->as<RegExpObject>(), NullPtr(), chars, length, indexp,
test, rval);
}
JS_PUBLIC_API(bool)
JS_ObjectIsRegExp(JSContext *cx, JSObject *objArg)
JS_ObjectIsRegExp(JSContext *cx, HandleObject obj)
{
RootedObject obj(cx, objArg);
assertSameCompartment(cx, obj);
return ObjectClassIs(obj, ESClass_RegExp, cx);
}
JS_PUBLIC_API(unsigned)
JS_GetRegExpFlags(JSContext *cx, JSObject *objArg)
JS_GetRegExpFlags(JSContext *cx, HandleObject obj)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
@ -5896,9 +5875,8 @@ JS_GetRegExpFlags(JSContext *cx, JSObject *objArg)
}
JS_PUBLIC_API(JSString *)
JS_GetRegExpSource(JSContext *cx, JSObject *objArg)
JS_GetRegExpSource(JSContext *cx, HandleObject obj)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
@ -5945,21 +5923,20 @@ JS_IsExceptionPending(JSContext *cx)
}
JS_PUBLIC_API(bool)
JS_GetPendingException(JSContext *cx, jsval *vp)
JS_GetPendingException(JSContext *cx, MutableHandleValue vp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
if (!cx->isExceptionPending())
return false;
*vp = cx->getPendingException();
assertSameCompartment(cx, *vp);
vp.set(cx->getPendingException());
assertSameCompartment(cx, vp);
return true;
}
JS_PUBLIC_API(void)
JS_SetPendingException(JSContext *cx, jsval valueArg)
JS_SetPendingException(JSContext *cx, HandleValue value)
{
RootedValue value(cx, valueArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, value);
@ -5996,7 +5973,8 @@ JS_SaveExceptionState(JSContext *cx)
CHECK_REQUEST(cx);
state = cx->pod_malloc<JSExceptionState>();
if (state) {
state->throwing = JS_GetPendingException(cx, &state->exception);
state->throwing =
JS_GetPendingException(cx, MutableHandleValue::fromMarkedLocation(&state->exception));
if (state->throwing && JSVAL_IS_GCTHING(state->exception))
AddValueRoot(cx, &state->exception, "JSExceptionState.exception");
}
@ -6010,7 +5988,7 @@ JS_RestoreExceptionState(JSContext *cx, JSExceptionState *state)
CHECK_REQUEST(cx);
if (state) {
if (state->throwing)
JS_SetPendingException(cx, state->exception);
JS_SetPendingException(cx, HandleValue::fromMarkedLocation(&state->exception));
else
JS_ClearPendingException(cx);
JS_DropExceptionState(cx, state);
@ -6032,9 +6010,8 @@ JS_DropExceptionState(JSContext *cx, JSExceptionState *state)
}
JS_PUBLIC_API(JSErrorReport *)
JS_ErrorFromException(JSContext *cx, jsval valueArg)
JS_ErrorFromException(JSContext *cx, HandleValue value)
{
RootedValue value(cx, valueArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, value);
@ -6149,17 +6126,13 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
#endif
JS_PUBLIC_API(bool)
JS_IndexToId(JSContext *cx, uint32_t index, jsid *idp)
JS_IndexToId(JSContext *cx, uint32_t index, MutableHandleId id)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
*idp = id;
return true;
return IndexToId(cx, index, id);
}
JS_PUBLIC_API(bool)
JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp)
JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, MutableHandleId idp)
{
RootedAtom atom(cx, AtomizeChars<CanGC>(cx, chars.start().get(), chars.length()));
if (!atom)
@ -6168,12 +6141,12 @@ JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp)
uint32_t dummy;
MOZ_ASSERT(!atom->isIndex(&dummy), "API misuse: |chars| must not encode an index");
#endif
*idp = AtomToId(atom);
idp.set(AtomToId(atom));
return true;
}
JS_PUBLIC_API(bool)
JS_IsIdentifier(JSContext *cx, JSString *str, bool *isIdentifier)
JS_IsIdentifier(JSContext *cx, HandleString str, bool *isIdentifier)
{
assertSameCompartment(cx, str);

View File

@ -4062,7 +4062,7 @@ JS_NewDateObjectMsec(JSContext *cx, double msec);
* Infallible predicate to test whether obj is a date object.
*/
extern JS_PUBLIC_API(bool)
JS_ObjectIsDate(JSContext *cx, JSObject *obj);
JS_ObjectIsDate(JSContext *cx, JS::HandleObject obj);
/*
* Clears the cache of calculated local time from each Date object.
@ -4082,20 +4082,24 @@ JS_ClearDateCaches(JSContext *cx);
#define JSREG_STICKY 0x08 /* only match starting at lastIndex */
extern JS_PUBLIC_API(JSObject *)
JS_NewRegExpObject(JSContext *cx, JSObject *obj, char *bytes, size_t length, unsigned flags);
JS_NewRegExpObject(JSContext *cx, JS::HandleObject obj, char *bytes, size_t length,
unsigned flags);
extern JS_PUBLIC_API(JSObject *)
JS_NewUCRegExpObject(JSContext *cx, JSObject *obj, jschar *chars, size_t length, unsigned flags);
JS_NewUCRegExpObject(JSContext *cx, JS::HandleObject obj, jschar *chars, size_t length,
unsigned flags);
extern JS_PUBLIC_API(void)
JS_SetRegExpInput(JSContext *cx, JSObject *obj, JSString *input, bool multiline);
JS_SetRegExpInput(JSContext *cx, JS::HandleObject obj, JS::HandleString input,
bool multiline);
extern JS_PUBLIC_API(void)
JS_ClearRegExpStatics(JSContext *cx, JSObject *obj);
JS_ClearRegExpStatics(JSContext *cx, JS::HandleObject obj);
extern JS_PUBLIC_API(bool)
JS_ExecuteRegExp(JSContext *cx, JSObject *obj, JSObject *reobj, jschar *chars, size_t length,
size_t *indexp, bool test, jsval *rval);
JS_ExecuteRegExp(JSContext *cx, JS::HandleObject obj, JS::HandleObject reobj,
jschar *chars, size_t length, size_t *indexp, bool test,
JS::MutableHandleValue rval);
/* RegExp interface for clients without a global object. */
@ -4106,17 +4110,17 @@ extern JS_PUBLIC_API(JSObject *)
JS_NewUCRegExpObjectNoStatics(JSContext *cx, jschar *chars, size_t length, unsigned flags);
extern JS_PUBLIC_API(bool)
JS_ExecuteRegExpNoStatics(JSContext *cx, JSObject *reobj, jschar *chars, size_t length,
size_t *indexp, bool test, jsval *rval);
JS_ExecuteRegExpNoStatics(JSContext *cx, JS::HandleObject reobj, jschar *chars, size_t length,
size_t *indexp, bool test, JS::MutableHandleValue rval);
extern JS_PUBLIC_API(bool)
JS_ObjectIsRegExp(JSContext *cx, JSObject *obj);
JS_ObjectIsRegExp(JSContext *cx, JS::HandleObject obj);
extern JS_PUBLIC_API(unsigned)
JS_GetRegExpFlags(JSContext *cx, JSObject *obj);
JS_GetRegExpFlags(JSContext *cx, JS::HandleObject obj);
extern JS_PUBLIC_API(JSString *)
JS_GetRegExpSource(JSContext *cx, JSObject *obj);
JS_GetRegExpSource(JSContext *cx, JS::HandleObject obj);
/************************************************************************/
@ -4124,10 +4128,10 @@ extern JS_PUBLIC_API(bool)
JS_IsExceptionPending(JSContext *cx);
extern JS_PUBLIC_API(bool)
JS_GetPendingException(JSContext *cx, jsval *vp);
JS_GetPendingException(JSContext *cx, JS::MutableHandleValue vp);
extern JS_PUBLIC_API(void)
JS_SetPendingException(JSContext *cx, jsval v);
JS_SetPendingException(JSContext *cx, JS::HandleValue v);
extern JS_PUBLIC_API(void)
JS_ClearPendingException(JSContext *cx);
@ -4163,7 +4167,7 @@ JS_DropExceptionState(JSContext *cx, JSExceptionState *state);
* of the exception object.
*/
extern JS_PUBLIC_API(JSErrorReport *)
JS_ErrorFromException(JSContext *cx, jsval v);
JS_ErrorFromException(JSContext *cx, JS::HandleValue v);
/*
* Given a reported error's message and JSErrorReport struct pointer, throw
@ -4269,7 +4273,7 @@ JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t v
* Convert a uint32_t index into a jsid.
*/
extern JS_PUBLIC_API(bool)
JS_IndexToId(JSContext *cx, uint32_t index, jsid *id);
JS_IndexToId(JSContext *cx, uint32_t index, JS::MutableHandleId);
/*
* Convert chars into a jsid.
@ -4277,13 +4281,13 @@ JS_IndexToId(JSContext *cx, uint32_t index, jsid *id);
* |chars| may not be an index.
*/
extern JS_PUBLIC_API(bool)
JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp);
JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, JS::MutableHandleId);
/*
* Test if the given string is a valid ECMAScript identifier
*/
extern JS_PUBLIC_API(bool)
JS_IsIdentifier(JSContext *cx, JSString *str, bool *isIdentifier);
JS_IsIdentifier(JSContext *cx, JS::HandleString str, bool *isIdentifier);
/*
* Return the current script and line number of the most currently running

View File

@ -1994,10 +1994,14 @@ js::array_pop(JSContext *cx, unsigned argc, Value *vp)
return false;
}
// Keep dense initialized length optimal, if possible. Note that this just
// reflects the possible deletion above: in particular, it's okay to do
// this even if the length is non-writable and SetLengthProperty throws.
if (obj->isNative() && obj->getDenseInitializedLength() > index)
// If this was an array, then there are no elements above the one we just
// deleted (if we deleted an element). Thus we can shrink the dense
// initialized length accordingly. (This is fine even if the array length
// is non-writable: length-changing occurs after element-deletion effects.)
// Don't do anything if this isn't an array, as any deletion above has no
// effect on any elements after the "last" one indicated by the "length"
// property.
if (obj->is<ArrayObject>() && obj->getDenseInitializedLength() > index)
obj->setDenseInitializedLength(index);
/* Steps 4a, 5d. */

View File

@ -981,7 +981,8 @@ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp,
return false;
}
JS_SetPendingException(cx, OBJECT_TO_JSVAL(errObject));
RootedValue errValue(cx, OBJECT_TO_JSVAL(errObject));
JS_SetPendingException(cx, errValue);
/* Flag the error report passed in to indicate an exception was raised. */
reportp->flags |= JSREPORT_EXCEPTION;
@ -1019,7 +1020,7 @@ js_ReportUncaughtException(JSContext *cx)
return true;
RootedValue exn(cx);
if (!JS_GetPendingException(cx, exn.address()))
if (!JS_GetPendingException(cx, &exn))
return false;
AutoValueVector roots(cx);

View File

@ -850,7 +850,7 @@ class AutoNewContext
RootedValue exc(oldcx);
bool throwing = JS_IsExceptionPending(newcx);
if (throwing)
JS_GetPendingException(newcx, exc.address());
JS_GetPendingException(newcx, &exc);
newCompartment.destroy();
newRequest.destroy();
if (throwing)

View File

@ -0,0 +1,91 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
//-----------------------------------------------------------------------------
var BUGNUMBER = 909602;
var summary =
"Array.prototype.pop shouldn't touch elements greater than length on " +
"non-arrays";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
function doTest(obj, index)
{
// print("testing " + JSON.stringify(obj) + " with index " + index);
assertEq(Array.prototype.pop.call(obj), undefined);
assertEq(index in obj, true);
assertEq(obj[index], 42);
}
// not-super-much-later element
// non-zero length
function testPop1()
{
var obj = { length: 2, 3: 42 };
doTest(obj, 3);
}
for (var i = 0; i < 50; i++)
testPop1();
// zero length
function testPop2()
{
var obj = { length: 0, 3: 42 };
doTest(obj, 3);
}
for (var i = 0; i < 50; i++)
testPop2();
// much-later (but dense) element
// non-zero length
function testPop3()
{
var obj = { length: 2, 55: 42 };
doTest(obj, 55);
}
for (var i = 0; i < 50; i++)
testPop3();
// zero length
function testPop4()
{
var obj = { length: 0, 55: 42 };
doTest(obj, 55);
}
for (var i = 0; i < 50; i++)
testPop4();
// much much much later (sparse) element
// non-zero length
function testPop5()
{
var obj = { length: 2, 65530: 42 };
doTest(obj, 65530);
}
for (var i = 0; i < 50; i++)
testPop5();
// zero length
function testPop6()
{
var obj = { length: 0, 65530: 42 };
doTest(obj, 65530);
}
for (var i = 0; i < 50; i++)
testPop6();
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete");

View File

@ -2665,6 +2665,20 @@ Debugger::findAllGlobals(JSContext *cx, unsigned argc, Value *vp)
return true;
}
bool
Debugger::makeGlobalObjectReference(JSContext *cx, unsigned argc, Value *vp)
{
REQUIRE_ARGC("Debugger.makeGlobalObjectReference", 1);
THIS_DEBUGGER(cx, argc, vp, "makeGlobalObjectReference", args, dbg);
Rooted<GlobalObject *> global(cx, dbg->unwrapDebuggeeArgument(cx, args[0]));
if (!global)
return false;
args.rval().setObject(*global);
return dbg->wrapDebuggeeValue(cx, args.rval());
}
const JSPropertySpec Debugger::properties[] = {
JS_PSGS("enabled", Debugger::getEnabled, Debugger::setEnabled, 0),
JS_PSGS("onDebuggerStatement", Debugger::getOnDebuggerStatement,
@ -2690,6 +2704,7 @@ const JSFunctionSpec Debugger::methods[] = {
JS_FN("clearAllBreakpoints", Debugger::clearAllBreakpoints, 1, 0),
JS_FN("findScripts", Debugger::findScripts, 1, 0),
JS_FN("findAllGlobals", Debugger::findAllGlobals, 0, 0),
JS_FN("makeGlobalObjectReference", Debugger::makeGlobalObjectReference, 1, 0),
JS_FS_END
};

View File

@ -334,6 +334,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
static bool clearAllBreakpoints(JSContext *cx, unsigned argc, Value *vp);
static bool findScripts(JSContext *cx, unsigned argc, Value *vp);
static bool findAllGlobals(JSContext *cx, unsigned argc, Value *vp);
static bool makeGlobalObjectReference(JSContext *cx, unsigned argc, Value *vp);
static bool construct(JSContext *cx, unsigned argc, Value *vp);
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];

View File

@ -967,7 +967,7 @@ mozJSComponentLoader::ObjectForLocation(nsIFile *aComponentFile,
// exception on this context.
JS_SetOptions(cx, oldopts);
if (!script && !function && aPropagateExceptions) {
JS_GetPendingException(cx, aException.address());
JS_GetPendingException(cx, aException);
JS_ClearPendingException(cx);
}
}
@ -1020,7 +1020,7 @@ mozJSComponentLoader::ObjectForLocation(nsIFile *aComponentFile,
if (!ok) {
if (aPropagateExceptions) {
JS_GetPendingException(cx, aException.address());
JS_GetPendingException(cx, aException);
JS_ClearPendingException(cx);
}
*aObject = nullptr;

View File

@ -62,7 +62,8 @@ NS_IMPL_ISUPPORTS1(mozJSSubScriptLoader, mozIJSSubScriptLoader)
static nsresult
ReportError(JSContext *cx, const char *msg)
{
JS_SetPendingException(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, msg)));
RootedValue exn(cx, JS::StringValue(JS_NewStringCopyZ(cx, msg)));
JS_SetPendingException(cx, exn);
return NS_OK;
}

View File

@ -1552,7 +1552,7 @@ xpc::EvalInSandbox(JSContext *cx, HandleObject sandboxArg, const nsAString& sour
}
// If the sandbox threw an exception, grab it off the context.
if (JS_GetPendingException(sandcx, exn.address())) {
if (JS_GetPendingException(sandcx, &exn)) {
MOZ_ASSERT(!ok);
JS_ClearPendingException(sandcx);
if (returnStringOnly) {

View File

@ -255,7 +255,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
if (!success && JS_IsExceptionPending(cx)) {
RootedValue jsexception(cx, NullValue());
if (JS_GetPendingException(cx, jsexception.address())) {
if (JS_GetPendingException(cx, &jsexception)) {
nsresult rv;
if (jsexception.isObject()) {
// XPConnect may have constructed an object to represent a
@ -941,7 +941,7 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
nsresult pending_result = xpcc->GetPendingResult();
RootedValue js_exception(cx);
bool is_js_exception = JS_GetPendingException(cx, js_exception.address());
bool is_js_exception = JS_GetPendingException(cx, &js_exception);
/* JS might throw an expection whether the reporter was called or not */
if (is_js_exception) {

View File

@ -4,7 +4,7 @@
# 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/.
DIRS += [
TEST_TOOL_DIRS += [
'idl',
'mochitest',
'chrome',

View File

@ -5433,12 +5433,16 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState,
// due to dynamic changes.
// We don't do it for SVG text, since we might need to position and
// measure the white space glyphs due to x/y/dx/dy attributes.
// We check that NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE is not set on
// the node. This lets us disable this optimization for specific nodes
// (e.g. nodes whose geometry is being queried via DOM APIs).
if (AtLineBoundary(aIter) &&
!styleContext->StyleText()->WhiteSpaceOrNewlineIsSignificant() &&
aIter.List()->ParentHasNoXBLChildren() &&
!(aState.mAdditionalStateBits & NS_FRAME_GENERATED_CONTENT) &&
(item.mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) &&
!(item.mFCData->mBits & FCDATA_IS_SVG_TEXT) &&
!item.mContent->HasFlag(NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE) &&
item.IsWhitespace(aState))
return;
@ -7613,6 +7617,22 @@ InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node)
rootFrame->InvalidateFrameSubtree();
}
nsIFrame*
nsCSSFrameConstructor::EnsureFrameForTextNode(nsGenericDOMDataNode* aContent)
{
if (aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) &&
!aContent->HasFlag(NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE)) {
// Text frame may have been suppressed. Disable suppression and signal
// that a flush should be performed.
aContent->SetFlags(NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE);
nsAutoScriptBlocker blocker;
BeginUpdate();
RecreateFramesForContent(aContent, false);
EndUpdate();
}
return aContent->GetPrimaryFrame();
}
nsresult
nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
CharacterDataChangeInfo* aInfo)

View File

@ -31,6 +31,7 @@ struct nsGenConInitializer;
class nsICSSAnonBoxPseudo;
class nsPageContentFrame;
struct PendingBinding;
class nsGenericDOMDataNode;
class nsFrameConstructorState;
class nsFrameConstructorSaveState;
@ -198,6 +199,13 @@ public:
nsresult CharacterDataChanged(nsIContent* aContent,
CharacterDataChangeInfo* aInfo);
// If aContent is a text node that has been optimized away due to being
// whitespace next to a block boundary (or for some other reason), stop
// doing that and create a frame for it if it should have one. This recreates
// frames so be careful (although this should not change actual layout).
// Returns the frame for aContent if there is one.
nsIFrame* EnsureFrameForTextNode(nsGenericDOMDataNode* aContent);
// generate the child frames and process bindings
nsresult GenerateChildFrames(nsIFrame* aFrame);

View File

@ -114,18 +114,6 @@ typedef FrameMetrics::ViewID ViewID;
static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
// These are indices into kDisplayKTable. They'll be initialized
// the first time that FlexboxEnabledPrefChangeCallback() is invoked.
static int32_t sIndexOfFlexInDisplayTable;
static int32_t sIndexOfInlineFlexInDisplayTable;
// This tracks whether those ^^ indices have been initialized
static bool sAreFlexKeywordIndicesInitialized = false;
// This is an index into kPositionKTable. It will be initialized
// the first time that StickyEnabledPrefChangeCallback() is invoked.
static int32_t sIndexOfStickyInPositionTable;
static bool sIsStickyKeywordIndexInitialized = false;
typedef nsDataHashtable<nsUint64HashKey, nsIContent*> ContentMap;
static ContentMap* sContentMap = nullptr;
static ContentMap& GetContentMap() {
@ -146,6 +134,10 @@ FlexboxEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
"We only registered this callback for a single pref, so it "
"should only be called for that pref");
static int32_t sIndexOfFlexInDisplayTable;
static int32_t sIndexOfInlineFlexInDisplayTable;
static bool sAreFlexKeywordIndicesInitialized; // initialized to false
bool isFlexboxEnabled =
Preferences::GetBool(FLEXBOX_ENABLED_PREF_NAME, false);
@ -155,9 +147,14 @@ FlexboxEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
sIndexOfFlexInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_flex,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfFlexInDisplayTable >= 0,
"Couldn't find flex in kDisplayKTable");
sIndexOfInlineFlexInDisplayTable =
nsCSSProps::FindIndexOfKeyword(eCSSKeyword_inline_flex,
nsCSSProps::kDisplayKTable);
MOZ_ASSERT(sIndexOfInlineFlexInDisplayTable >= 0,
"Couldn't find inline-flex in kDisplayKTable");
sAreFlexKeywordIndicesInitialized = true;
}
@ -187,6 +184,9 @@ StickyEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
"We only registered this callback for a single pref, so it "
"should only be called for that pref");
static int32_t sIndexOfStickyInPositionTable;
static bool sIsStickyKeywordIndexInitialized; // initialized to false
bool isStickyEnabled =
Preferences::GetBool(STICKY_ENABLED_PREF_NAME, false);

View File

@ -143,6 +143,7 @@ MOCHITEST_FILES = \
bug851445_helper.html \
test_emulateMedium.html \
enableTestPlugin.js \
test_getClientRects_emptytext.html \
$(NULL)
ifeq (,$(filter gonk,$(MOZ_WIDGET_TOOLKIT)))

View File

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="testDiv"> </div>
<script>
var textNode = testDiv.firstChild;
var range = new Range();
range.selectNodeContents(textNode);
is(range.getClientRects().length, 1, "Text node should have a rectangle");
var rect = range.getClientRects()[0];
ok(rect.left > 0, "Rectangle x should be greater than zero");
ok(rect.top > 0, "Rectangle y should be greater than zero");
is(rect.width, 0, "Rectangle should be zero width");
is(rect.height, 0, "Rectangle should be zero height");
</script>
</body>
</html>

View File

@ -386,6 +386,7 @@ nsStyleUtil::ComputeFunctionalAlternates(const nsCSSValueList* aList,
nsCSSProps::kFontVariantAlternatesFuncsKTable,
alternate)) {
NS_NOTREACHED("keyword not a font-variant-alternates value");
continue;
}
v.alternate = alternate;

View File

@ -4,7 +4,7 @@
# 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/.
TEST_DIRS += ['chrome']
TEST_TOOL_DIRS += ['chrome']
MODULE = 'layout'

View File

@ -15,6 +15,7 @@
<script type="text/javascript">
SimpleTest.expectAssertions(7);
SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(2);
var load_count = 0;
function load_done() {

View File

@ -265,6 +265,7 @@ function test_property(property)
// To avoid triggering the slow script dialog, we have to test one
// property at a time.
SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(2);
var props = [];
for (var prop in gCSSProperties)
props.push(prop);

View File

@ -79,7 +79,7 @@ class RefTest(object):
if len(thispref) < 2:
print "Error: syntax error in --setpref=" + v
sys.exit(1)
prefs[thispref[0]] = thispref[1]
prefs[thispref[0]] = mozprofile.Preferences.cast(thispref[1].strip())
# install the reftest extension bits into the profile
addons = []

View File

@ -1237,6 +1237,13 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID,
else if (aAttribute == nsGkAtoms::accesskey) {
RegUnregAccessKey(true);
}
else if (aAttribute == nsGkAtoms::rows &&
tag == nsGkAtoms::tree) {
// Reflow ourselves and all our children if "rows" changes, since
// nsTreeBodyFrame's layout reads this from its parent (this frame).
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
}
return rv;
}

View File

@ -128,7 +128,8 @@ nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aCont
mHasFixedRowCount(false),
mVerticalOverflow(false),
mHorizontalOverflow(false),
mReflowCallbackPosted(false)
mReflowCallbackPosted(false),
mCheckingOverflow(false)
{
mColumns = new nsTreeColumns(this);
}
@ -916,8 +917,11 @@ nsTreeBodyFrame::CheckOverflow(const ScrollParts& aParts)
}
}
}
nsWeakFrame weakFrame(this);
nsRefPtr<nsPresContext> presContext = PresContext();
nsCOMPtr<nsIPresShell> presShell = presContext->GetPresShell();
nsCOMPtr<nsIContent> content = mContent;
if (verticalOverflowChanged) {
@ -934,6 +938,22 @@ nsTreeBodyFrame::CheckOverflow(const ScrollParts& aParts)
event.orient = nsScrollPortEvent::horizontal;
nsEventDispatcher::Dispatch(content, presContext, &event);
}
// The synchronous event dispatch above can trigger reflow notifications.
// Flush those explicitly now, so that we can guard against potential infinite
// recursion. See bug 905909.
if (!weakFrame.IsAlive()) {
return;
}
NS_ASSERTION(!mCheckingOverflow, "mCheckingOverflow should not already be set");
// Don't use AutoRestore since we want to not touch mCheckingOverflow if we fail
// the weakFrame.IsAlive() check below
mCheckingOverflow = true;
presShell->FlushPendingNotifications(Flush_Layout);
if (!weakFrame.IsAlive()) {
return;
}
mCheckingOverflow = false;
}
void
@ -4645,7 +4665,17 @@ nsTreeBodyFrame::FullScrollbarsUpdate(bool aNeedsFullInvalidation)
}
InvalidateScrollbars(parts, weakColumnsFrame);
NS_ENSURE_TRUE(weakFrame.IsAlive(), false);
nsContentUtils::AddScriptRunner(new nsOverflowChecker(this));
// Overflow checking dispatches synchronous events, which can cause infinite
// recursion during reflow. Do the first overflow check synchronously, but
// force any nested checks to round-trip through the event loop. See bug
// 905909.
nsRefPtr<nsOverflowChecker> checker = new nsOverflowChecker(this);
if (!mCheckingOverflow) {
nsContentUtils::AddScriptRunner(checker);
} else {
NS_DispatchToCurrentThread(checker);
}
return weakFrame.IsAlive();
}

View File

@ -617,6 +617,10 @@ protected: // Data Members
bool mReflowCallbackPosted;
// Set while we flush layout to take account of effects of
// overflow/underflow event handlers
bool mCheckingOverflow;
// Hash table to keep track of which listeners we created and thus
// have pointers to us.
nsTHashtable<nsPtrHashKey<nsTreeImageListener> > mCreatedListeners;

View File

@ -63,4 +63,3 @@ extern int gWebrtcTraceLoggingOn;
#endif
#endif

View File

@ -1891,39 +1891,6 @@ gsmsdp_set_setup_attribute(uint16_t level,
}
}
/*
* gsmsdp_set_connection_attribute
*
* Description:
*
* Adds a connection attribute to the specified SDP.
*
* Parameters:
*
* level - The media level of the SDP where the media attribute exists.
* sdp_p - Pointer to the SDP to set the ice candidate attribute against.
* connection_type - Value for the a=connection line
*/
static void
gsmsdp_set_connection_attribute(uint16_t level,
void *sdp_p, sdp_connection_type_e connection_type) {
uint16_t a_instance = 0;
sdp_result_e result;
result = sdp_add_new_attr(sdp_p, level, 0, SDP_ATTR_CONNECTION,
&a_instance);
if (result != SDP_SUCCESS) {
GSM_ERR_MSG("Failed to add attribute");
return;
}
result = sdp_attr_set_connection_attribute(sdp_p, level, 0,
a_instance, connection_type);
if (result != SDP_SUCCESS) {
GSM_ERR_MSG("Failed to set attribute");
}
}
/*
* gsmsdp_set_dtls_fingerprint_attribute
*
@ -4700,7 +4667,23 @@ gsmsdp_negotiate_rtcp_fb (cc_sdp_t *cc_sdp_p,
* initial_offer - Boolean indicating if the remote SDP came in the first OFFER of this session
* offer - Boolean indicating if the remote SDP came in an OFFER.
* notify_stream_added - Boolean indicating the UI should be notified of streams added
* create_answer - indicates whether the provided offer is supposed to generate
* an answer (versus simply setting the remote description)
*
* In practice, the initial_offer, offer, and create_answer flags only make
* sense in a limited number of configurations:
*
* Phase | i_o | offer | c_a
* ------------------------------+-------+-------+-------
* SetRemote (initial offer) | true | true | false
* SetRemote (reneg. offer) | false | true | false
* SetRemote (answer) | false | false | false
* CreateAnswer (initial) | true | true | true
* CreateAnswer (renegotitaion) | false | true | true
*
* TODO(adam@nostrum.com): These flags make the code very hard to read at
* the calling site. They should be replaced by an enumeration that
* contains only those five valid combinations described above.
*/
cc_causes_t
gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial_offer,
@ -4735,7 +4718,6 @@ gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial
sdp_result_e sdp_res;
boolean created_media_stream = FALSE;
int lsm_rc;
sdp_setup_type_e remote_setup_type;
config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
@ -5032,41 +5014,63 @@ gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial
if (!unsupported_line) {
if (sdpmode) {
sdp_setup_type_e remote_setup_type;
int j;
/* Find the remote a=setup value */
sdp_res = sdp_attr_get_setup_attribute(
sdp_p->dest_sdp, i, 0, 1, &remote_setup_type);
/* setup attribute
We are setting our local SDP to be ACTIVE if the value
in the remote SDP is missing, PASSIVE or ACTPASS.
If the remote value is ACTIVE, then we will respond
with PASSIVE.
If the remote value is HOLDCONN we will respond with
HOLDCONN and set the direction to INACTIVE
The DTLS role will then be set when the TransportFlow
is created */
media->setup = SDP_SETUP_ACTIVE;
if (sdp_res == SDP_SUCCESS) {
if (remote_setup_type == SDP_SETUP_ACTIVE) {
media->setup = SDP_SETUP_PASSIVE;
} else if (remote_setup_type == SDP_SETUP_HOLDCONN) {
media->setup = SDP_SETUP_HOLDCONN;
media->direction = SDP_DIRECTION_INACTIVE;
}
/*
* Although a=setup is required for DTLS per RFC 5763,
* there are several implementations (including older
* versions of Firefox) that don't signal direction.
* To work with these cases, we assume that an omitted
* direction in SDP means "PASSIVE" in an offer, and
* "ACTIVE" in an answer.
*/
if (sdp_res != SDP_SUCCESS) {
remote_setup_type =
offer ? SDP_SETUP_PASSIVE : SDP_SETUP_ACTIVE;
}
gsmsdp_set_setup_attribute(media->level, dcb_p->sdp->src_sdp,
media->setup);
/* The DTLS role will be set based on the media->setup
value when the TransportFlow is created */
switch (remote_setup_type) {
case SDP_SETUP_ACTIVE:
media->setup = SDP_SETUP_PASSIVE;
break;
case SDP_SETUP_PASSIVE:
media->setup = SDP_SETUP_ACTIVE;
break;
case SDP_SETUP_ACTPASS:
/*
* This should only happen in an offer. If the
* remote side is ACTPASS, we choose to be ACTIVE;
* this allows us to start setting up the DTLS
* association immediately, saving 1/2 RTT in
* association establishment.
*/
media->setup = SDP_SETUP_ACTIVE;
break;
case SDP_SETUP_HOLDCONN:
media->setup = SDP_SETUP_HOLDCONN;
media->direction = SDP_DIRECTION_INACTIVE;
break;
default:
/*
* If we don't recognize the remote endpoint's setup
* attribute, we fall back to being active if they
* sent an offer, and passive if they sent an answer.
*/
media->setup =
offer ? SDP_SETUP_ACTIVE : SDP_SETUP_PASSIVE;
}
/* TODO(ehugg) we are not yet supporting existing connections
See bug 857115. We currently always respond with
connection:new */
gsmsdp_set_connection_attribute(media->level,
dcb_p->sdp->src_sdp, SDP_CONNECTION_NEW);
if (create_answer) {
gsmsdp_set_setup_attribute(media->level,
dcb_p->sdp->src_sdp,
media->setup);
}
/* Set ICE */
for (j=0; j<media->candidate_ct; j++) {
@ -5585,13 +5589,9 @@ gsmsdp_add_media_line (fsmdef_dcb_t *dcb_p, const cc_media_cap_t *media_cap,
sdp_rtcp_fb_ccm_to_bitmap(SDP_RTCP_FB_CCM_FIR));
}
/* setup and connection attributes */
/* Add a=setup attribute */
gsmsdp_set_setup_attribute(level, dcb_p->sdp->src_sdp, media->setup);
/* This is a new media line so we should send connection:new */
gsmsdp_set_connection_attribute(level, dcb_p->sdp->src_sdp,
SDP_CONNECTION_NEW);
/*
* wait until here to set ICE candidates as SDP is now initialized
*/

View File

@ -2872,57 +2872,8 @@ TEST_F(SignalingTest, AudioCallGarbageSetup)
ASSERT_GE(a2_.GetPacketsReceived(0), 40);
}
// In this test we will change the offer SDP's a=connection value
// from new to garbage. It should ignore the garbage value
// and respond with connection:new
TEST_F(SignalingTest, AudioCallGarbageConnection)
{
sipcc::MediaConstraints constraints;
size_t match;
a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
// By default the offer should give connection:new
std::string offer(a1_.offer());
match = offer.find("\r\na=connection:new");
ASSERT_NE(match, std::string::npos);
// Now replace the 'new' with a garbage value
offer.replace(match, strlen("\r\na=connection:new"),
"\r\na=connection:G4rb4g3V4lu3");
std::cout << "Modified SDP " << std::endl
<< indent(offer) << std::endl;
a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
// Now the answer should contain a=connection:new
std::string answer(a2_.answer());
match = answer.find("\r\na=connection:new");
ASSERT_NE(match, std::string::npos);
// This should setup the DTLS with the same roles
// as the regular tests above.
a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
// Wait for some data to get written
ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
a1_.CloseSendStreams();
a2_.CloseReceiveStreams();
ASSERT_GE(a1_.GetPacketsSent(0), 40);
ASSERT_GE(a2_.GetPacketsReceived(0), 40);
}
// In this test we will change the offer SDP to remove the
// a=setup and a=connection lines. Answer should respond with
// a=setup:active and a=connection:new
// a=setup line. Answer should respond with a=setup:active.
TEST_F(SignalingTest, AudioCallOfferNoSetupOrConnection)
{
sipcc::MediaConstraints constraints;
@ -2930,16 +2881,12 @@ TEST_F(SignalingTest, AudioCallOfferNoSetupOrConnection)
a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
// By default the offer should give setup:actpass and connection:new
// By default the offer should give setup:actpass
std::string offer(a1_.offer());
match = offer.find("\r\na=setup:actpass");
ASSERT_NE(match, std::string::npos);
// Remove the a=setup line
offer.replace(match, strlen("\r\na=setup:actpass"), "");
match = offer.find("\r\na=connection:new");
ASSERT_NE(match, std::string::npos);
// Remove the a=connection line
offer.replace(match, strlen("\r\na=connection:new"), "");
std::cout << "Modified SDP " << std::endl
<< indent(offer) << std::endl;
@ -2947,12 +2894,10 @@ TEST_F(SignalingTest, AudioCallOfferNoSetupOrConnection)
a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
// Now the answer should contain a=setup:active and a=connection:new
// Now the answer should contain a=setup:active
std::string answer(a2_.answer());
match = answer.find("\r\na=setup:active");
ASSERT_NE(match, std::string::npos);
match = answer.find("\r\na=connection:new");
ASSERT_NE(match, std::string::npos);
// This should setup the DTLS with the same roles
// as the regular tests above.
@ -2974,8 +2919,8 @@ TEST_F(SignalingTest, AudioCallOfferNoSetupOrConnection)
}
// In this test we will change the answer SDP to remove the
// a=setup and a=connection lines. ICE should still connect
// since active will be assumed.
// a=setup line. ICE should still connect since active will
// be assumed.
TEST_F(SignalingTest, AudioCallAnswerNoSetupOrConnection)
{
sipcc::MediaConstraints constraints;
@ -2983,34 +2928,28 @@ TEST_F(SignalingTest, AudioCallAnswerNoSetupOrConnection)
a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
// By default the offer should give setup:actpass and connection:new
// By default the offer should give setup:actpass
std::string offer(a1_.offer());
match = offer.find("\r\na=setup:actpass");
ASSERT_NE(match, std::string::npos);
match = offer.find("\r\na=connection:new");
ASSERT_NE(match, std::string::npos);
a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
// Now the answer should contain a=setup:active and a=connection:new
// Now the answer should contain a=setup:active
std::string answer(a2_.answer());
match = answer.find("\r\na=setup:active");
ASSERT_NE(match, std::string::npos);
// Remove the a=setup line
answer.replace(match, strlen("\r\na=setup:active"), "");
match = answer.find("\r\na=connection:new");
ASSERT_NE(match, std::string::npos);
// Remove the a=connection line
answer.replace(match, strlen("\r\na=connection:new"), "");
std::cout << "Modified SDP " << std::endl
<< indent(answer) << std::endl;
// This should setup the DTLS with the same roles
// as the regular tests above.
a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
a2_.SetLocal(TestObserver::ANSWER, answer, false);
a1_.SetRemote(TestObserver::ANSWER, answer, false);
ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);

View File

@ -4,7 +4,7 @@
# 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/.
DIRS += ['mochitest', 'chrome']
TEST_TOOL_DIRS += ['mochitest', 'chrome']
MODULE = 'test_libjar'

View File

@ -4,7 +4,7 @@
# 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/.
TEST_DIRS += ['httpserver', 'browser', 'mochitests']
TEST_TOOL_DIRS += ['httpserver', 'browser', 'mochitests']
MODULE = 'test_necko'

View File

@ -4,4 +4,4 @@
# 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/.
TEST_DIRS += ['scripted']
TEST_TOOL_DIRS += ['scripted']

Some files were not shown because too many files have changed in this diff Show More