Merge m-c to fxteam

This commit is contained in:
Wes Kocher 2013-10-10 19:10:24 -07:00
commit 80f8d0cc8f
467 changed files with 3709 additions and 2964 deletions

View File

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 899574 needed a clobber, at least on Windows.
Bug 922461 needs a clobber to regenerate code and survive bug 925243's FAIL_ON_WARNINGS annotation.

View File

@ -540,7 +540,8 @@ GetClosestInterestingAccessible(id anObject)
nsAutoString value;
mGeckoAccessible->GetValue (value);
return value.IsEmpty() ? nil : [NSString stringWithCharacters:value.BeginReading() length:value.Length()];
return value.IsEmpty() ? nil : [NSString stringWithCharacters:reinterpret_cast<const unichar*>(value.BeginReading())
length:value.Length()];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
@ -584,7 +585,8 @@ GetClosestInterestingAccessible(id anObject)
nsAutoString helpText;
mGeckoAccessible->GetHelp (helpText);
return helpText.IsEmpty() ? nil : [NSString stringWithCharacters:helpText.BeginReading() length:helpText.Length()];
return helpText.IsEmpty() ? nil : [NSString stringWithCharacters:reinterpret_cast<const unichar*>(helpText.BeginReading())
length:helpText.Length()];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}

View File

@ -1,4 +1,4 @@
{
"revision": "ed107ffac75d42dbacc19f81d0e2650e34c83a16",
"revision": "34b6a207b754b02ee836ed9c8293a47b997f714c",
"repo_path": "/integration/gaia-central"
}

View File

@ -8,6 +8,8 @@ function debug(msg) {
Services.console.logStringMessage("SessionStoreContent: " + msg);
}
let Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "DocShellCapabilities",

View File

@ -2526,7 +2526,9 @@ let SessionStoreInternal = {
if (!tabData.entries || tabData.entries.length == 0) {
// make sure to blank out this tab's content
// (just purging the tab's history won't be enough)
browser.contentDocument.location = "about:blank";
browser.loadURIWithFlags("about:blank",
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY,
null, null, null);
continue;
}

View File

@ -19,6 +19,7 @@ extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.graphviz',
'sphinx.ext.todo',
'mozbuild.sphinx',
]
templates_path = ['_templates']
@ -26,7 +27,6 @@ source_suffix = '.rst'
master_doc = 'index'
project = u'Mozilla Build System'
year = datetime.now().year
copyright = u'%s, Mozilla Foundation, CC BY-SA 3.0 or any later version' % year
# Grab the version from the source tree's milestone.
with open(os.path.join(mozilla_dir, 'config', 'milestone.txt'), 'rt') as fh:

View File

@ -18,6 +18,7 @@ Important Concepts
build-overview
Mozconfig Files <mozconfigs>
mozbuild-files
mozbuild-symbols
Profile Guided Optimization <pgo>
slow
environment-variables
@ -40,6 +41,18 @@ Mozilla build system.
mozbuild/index
mozbuild/dumbmake
Python Packages
===============
.. toctree::
:maxdepth: 2
python/codegen
python/makeutils
python/mozbuild
python/mozpack
python/mozversioncontrol
Indices and tables
==================

View File

@ -0,0 +1,7 @@
.. _mozbuild_symbols:
========================
mozbuild Sandbox Symbols
========================
.. mozbuildsymbols:: mozbuild.frontend.sandbox_symbols

View File

@ -0,0 +1,7 @@
makeutils Module
================
.. automodule:: makeutils
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,35 @@
action Package
==============
:mod:`link_deps` Module
-----------------------
.. automodule:: mozbuild.action.link_deps
:members:
:undoc-members:
:show-inheritance:
:mod:`process_install_manifest` Module
--------------------------------------
.. automodule:: mozbuild.action.process_install_manifest
:members:
:undoc-members:
:show-inheritance:
:mod:`xpccheck` Module
----------------------
.. automodule:: mozbuild.action.xpccheck
:members:
:undoc-members:
:show-inheritance:
:mod:`xpidl-process` Module
---------------------------
.. automodule:: mozbuild.action.xpidl-process
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,35 @@
backend Package
===============
:mod:`base` Module
------------------
.. automodule:: mozbuild.backend.base
:members:
:undoc-members:
:show-inheritance:
:mod:`common` Module
--------------------
.. automodule:: mozbuild.backend.common
:members:
:undoc-members:
:show-inheritance:
:mod:`configenvironment` Module
-------------------------------
.. automodule:: mozbuild.backend.configenvironment
:members:
:undoc-members:
:show-inheritance:
:mod:`recursivemake` Module
---------------------------
.. automodule:: mozbuild.backend.recursivemake
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,11 @@
compilation Package
===================
:mod:`warnings` Module
----------------------
.. automodule:: mozbuild.compilation.warnings
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,19 @@
controller Package
==================
:mod:`building` Module
----------------------
.. automodule:: mozbuild.controller.building
:members:
:undoc-members:
:show-inheritance:
:mod:`clobber` Module
---------------------
.. automodule:: mozbuild.controller.clobber
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,51 @@
frontend Package
================
:mod:`data` Module
------------------
.. automodule:: mozbuild.frontend.data
:members:
:undoc-members:
:show-inheritance:
:mod:`emitter` Module
---------------------
.. automodule:: mozbuild.frontend.emitter
:members:
:undoc-members:
:show-inheritance:
:mod:`mach_commands` Module
---------------------------
.. automodule:: mozbuild.frontend.mach_commands
:members:
:undoc-members:
:show-inheritance:
:mod:`reader` Module
--------------------
.. automodule:: mozbuild.frontend.reader
:members:
:undoc-members:
:show-inheritance:
:mod:`sandbox` Module
---------------------
.. automodule:: mozbuild.frontend.sandbox
:members:
:undoc-members:
:show-inheritance:
:mod:`sandbox_symbols` Module
-----------------------------
.. automodule:: mozbuild.frontend.sandbox_symbols
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,103 @@
mozbuild Package
================
:mod:`base` Module
------------------
.. automodule:: mozbuild.base
:members:
:undoc-members:
:show-inheritance:
:mod:`config` Module
--------------------
.. automodule:: mozbuild.config
:members:
:undoc-members:
:show-inheritance:
:mod:`html_build_viewer` Module
-------------------------------
.. automodule:: mozbuild.html_build_viewer
:members:
:undoc-members:
:show-inheritance:
:mod:`mach_commands` Module
---------------------------
.. automodule:: mozbuild.mach_commands
:members:
:undoc-members:
:show-inheritance:
:mod:`makeutil` Module
----------------------
.. automodule:: mozbuild.makeutil
:members:
:undoc-members:
:show-inheritance:
:mod:`mozconfig` Module
-----------------------
.. automodule:: mozbuild.mozconfig
:members:
:undoc-members:
:show-inheritance:
:mod:`mozinfo` Module
---------------------
.. automodule:: mozbuild.mozinfo
:members:
:undoc-members:
:show-inheritance:
:mod:`pythonutil` Module
------------------------
.. automodule:: mozbuild.pythonutil
:members:
:undoc-members:
:show-inheritance:
:mod:`sphinx` Module
--------------------
.. automodule:: mozbuild.sphinx
:members:
:undoc-members:
:show-inheritance:
:mod:`util` Module
------------------
.. automodule:: mozbuild.util
:members:
:undoc-members:
:show-inheritance:
:mod:`virtualenv` Module
------------------------
.. automodule:: mozbuild.virtualenv
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
mozbuild.action
mozbuild.backend
mozbuild.compilation
mozbuild.controller
mozbuild.frontend
mozbuild.test

View File

@ -0,0 +1,19 @@
chrome Package
==============
:mod:`flags` Module
-------------------
.. automodule:: mozpack.chrome.flags
:members:
:undoc-members:
:show-inheritance:
:mod:`manifest` Module
----------------------
.. automodule:: mozpack.chrome.manifest
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,35 @@
packager Package
================
:mod:`packager` Package
-----------------------
.. automodule:: mozpack.packager
:members:
:undoc-members:
:show-inheritance:
:mod:`formats` Module
---------------------
.. automodule:: mozpack.packager.formats
:members:
:undoc-members:
:show-inheritance:
:mod:`l10n` Module
------------------
.. automodule:: mozpack.packager.l10n
:members:
:undoc-members:
:show-inheritance:
:mod:`unpack` Module
--------------------
.. automodule:: mozpack.packager.unpack
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,76 @@
mozpack Package
===============
:mod:`copier` Module
--------------------
.. automodule:: mozpack.copier
:members:
:undoc-members:
:show-inheritance:
:mod:`errors` Module
--------------------
.. automodule:: mozpack.errors
:members:
:undoc-members:
:show-inheritance:
:mod:`executables` Module
-------------------------
.. automodule:: mozpack.executables
:members:
:undoc-members:
:show-inheritance:
:mod:`files` Module
-------------------
.. automodule:: mozpack.files
:members:
:undoc-members:
:show-inheritance:
:mod:`manifests` Module
-----------------------
.. automodule:: mozpack.manifests
:members:
:undoc-members:
:show-inheritance:
:mod:`mozjar` Module
--------------------
.. automodule:: mozpack.mozjar
:members:
:undoc-members:
:show-inheritance:
:mod:`path` Module
------------------
.. automodule:: mozpack.path
:members:
:undoc-members:
:show-inheritance:
:mod:`unify` Module
-------------------
.. automodule:: mozpack.unify
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
mozpack.chrome
mozpack.packager
mozpack.test

View File

@ -0,0 +1,11 @@
mozversioncontrol Package
=========================
:mod:`repoupdate` Module
------------------------
.. automodule:: mozversioncontrol.repoupdate
:members:
:undoc-members:
:show-inheritance:

View File

@ -52,6 +52,7 @@ SEARCH_PATHS = [
'testing/mozbase/mozrunner',
'testing/mozbase/mozsystemmonitor',
'testing/mozbase/mozinfo',
'testing/mozbase/moztest',
'testing/mozbase/manifestdestiny',
'xpcom/idl-parser',
]

View File

@ -2,7 +2,12 @@ includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
DIST = $(DEPTH)/dist
ifndef INCLUDED_FUNCTIONS_MK
include $(topsrcdir)/config/makefiles/functions.mk
endif
DIST := $(call core_realpath,$(DEPTH)/dist)
# We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
# manually use it before config.mk inclusion

View File

@ -64,10 +64,6 @@ check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not
$(foreach x,$(CHECK_VARS),$(check-variable))
ifndef INCLUDED_FUNCTIONS_MK
include $(topsrcdir)/config/makefiles/functions.mk
endif
RM = rm -f
# LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.

View File

@ -3504,7 +3504,6 @@ for file in $MALLOC_HEADERS; do
fi
done
MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
AC_CHECK_FUNCS(malloc_usable_size)
@ -7153,7 +7152,7 @@ MOZ_ARG_ENABLE_BOOL(gczeal,
[ --enable-gczeal Enable zealous JavaScript GCing],
JS_GC_ZEAL=1,
JS_GC_ZEAL= )
if test -n "$JS_GC_ZEAL"; then
if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
AC_DEFINE(JS_GC_ZEAL)
fi

View File

@ -117,7 +117,8 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
* their permissions.
*/
nsresult rv;
const nsCOMArray<nsIContentPolicy>& entries = mPolicies.GetEntries();
nsCOMArray<nsIContentPolicy> entries;
mPolicies.GetEntries(entries);
int32_t count = entries.Count();
for (int32_t i = 0; i < count; i++) {
/* check the appropriate policy */

View File

@ -21,6 +21,7 @@ extern PRLogModuleInfo* GetDataChannelLog();
#include "nsDOMDataChannelDeclarations.h"
#include "nsDOMDataChannel.h"
#include "nsIDOMFile.h"
#include "nsIDOMDataChannel.h"
#include "nsIDOMMessageEvent.h"
@ -37,6 +38,12 @@ extern PRLogModuleInfo* GetDataChannelLog();
#include "DataChannel.h"
// Since we've moved the windows.h include down here, we have to explicitly
// undef GetBinaryType, otherwise we'll get really odd conflicts
#ifdef GetBinaryType
#undef GetBinaryType
#endif
using namespace mozilla;
using namespace mozilla::dom;
@ -73,6 +80,13 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDataChannel)
NS_INTERFACE_MAP_ENTRY(nsIDOMDataChannel)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
nsDOMDataChannel::nsDOMDataChannel(already_AddRefed<mozilla::DataChannel> aDataChannel)
: mDataChannel(aDataChannel)
, mBinaryType(DC_BINARY_TYPE_BLOB)
{
SetIsDOMBinding();
}
nsresult
nsDOMDataChannel::Init(nsPIDOMWindow* aDOMWindow)
{

View File

@ -10,22 +10,22 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/DataChannelBinding.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/net/DataChannel.h"
#include "mozilla/net/DataChannelListener.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIDOMDataChannel.h"
#include "nsIInputStream.h"
namespace mozilla {
class DataChannel;
};
class nsDOMDataChannel : public nsDOMEventTargetHelper,
public nsIDOMDataChannel,
public mozilla::DataChannelListener
{
public:
nsDOMDataChannel(already_AddRefed<mozilla::DataChannel> aDataChannel)
: mDataChannel(aDataChannel)
, mBinaryType(DC_BINARY_TYPE_BLOB)
{
SetIsDOMBinding();
}
nsDOMDataChannel(already_AddRefed<mozilla::DataChannel> aDataChannel);
~nsDOMDataChannel();
nsresult Init(nsPIDOMWindow* aDOMWindow);

View File

@ -504,7 +504,8 @@ nsFrameLoader::ReallyStartLoadingInternal()
// Kick off the load...
bool tmpState = mNeedsAsyncDestroy;
mNeedsAsyncDestroy = true;
rv = mDocShell->LoadURI(mURIToLoad, loadInfo, flags, false);
nsCOMPtr<nsIURI> uriToLoad = mURIToLoad;
rv = mDocShell->LoadURI(uriToLoad, loadInfo, flags, false);
mNeedsAsyncDestroy = tmpState;
mURIToLoad = nullptr;
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -269,56 +269,6 @@ struct DeltaValues
double deltaY;
};
/******************************************************************/
/* nsScrollbarsForWheel */
/******************************************************************/
class nsScrollbarsForWheel {
public:
static void PrepareToScrollText(nsEventStateManager* aESM,
nsIFrame* aTargetFrame,
WheelEvent* aEvent);
static void SetActiveScrollTarget(nsIScrollableFrame* aScrollTarget);
// Hide all scrollbars (both mActiveOwner's and mActivatedScrollTargets')
static void MayInactivate();
static void Inactivate();
static bool IsActive();
static void OwnWheelTransaction(bool aOwn);
protected:
static const size_t kNumberOfTargets = 4;
static const DeltaValues directions[kNumberOfTargets];
static nsWeakFrame sActiveOwner;
static nsWeakFrame sActivatedScrollTargets[kNumberOfTargets];
static bool sHadWheelStart;
static bool sOwnWheelTransaction;
/**
* These two methods are called upon NS_WHEEL_START/NS_WHEEL_STOP events
* to show/hide the right scrollbars.
*/
static void TemporarilyActivateAllPossibleScrollTargets(
nsEventStateManager* aESM,
nsIFrame* aTargetFrame,
WheelEvent* aEvent);
static void DeactivateAllTemporarilyActivatedScrollTargets();
};
const DeltaValues nsScrollbarsForWheel::directions[kNumberOfTargets] = {
DeltaValues(-1, 0), DeltaValues(+1, 0), DeltaValues(0, -1), DeltaValues(0, +1)
};
nsWeakFrame nsScrollbarsForWheel::sActiveOwner = nullptr;
nsWeakFrame nsScrollbarsForWheel::sActivatedScrollTargets[kNumberOfTargets] = {
nullptr, nullptr, nullptr, nullptr
};
bool nsScrollbarsForWheel::sHadWheelStart = false;
bool nsScrollbarsForWheel::sOwnWheelTransaction = false;
/******************************************************************/
/* nsMouseWheelTransaction */
/******************************************************************/
class nsMouseWheelTransaction {
public:
static nsIFrame* GetTargetFrame() { return sTargetFrame; }
@ -327,13 +277,11 @@ public:
// Be careful, UpdateTransaction may fire a DOM event, therefore, the target
// frame might be destroyed in the event handler.
static bool UpdateTransaction(WheelEvent* aEvent);
static void MayEndTransaction();
static void EndTransaction();
static void OnEvent(WidgetEvent* aEvent);
static void Shutdown();
static uint32_t GetTimeoutTime();
static void OwnScrollbars(bool aOwn);
static DeltaValues AccelerateWheelDelta(WheelEvent* aEvent,
bool aAllowScrollSpeedOverride);
@ -351,14 +299,12 @@ protected:
static int32_t GetAccelerationFactor();
static DeltaValues OverrideSystemScrollSpeed(WheelEvent* aEvent);
static double ComputeAcceleratedWheelDelta(double aDelta, int32_t aFactor);
static bool OutOfTime(uint32_t aBaseTime, uint32_t aThreshold);
static nsWeakFrame sTargetFrame;
static uint32_t sTime; // in milliseconds
static uint32_t sMouseMoved; // in milliseconds
static nsITimer* sTimer;
static int32_t sScrollSeriesCounter;
static bool sOwnScrollbars;
};
nsWeakFrame nsMouseWheelTransaction::sTargetFrame(nullptr);
@ -366,7 +312,13 @@ uint32_t nsMouseWheelTransaction::sTime = 0;
uint32_t nsMouseWheelTransaction::sMouseMoved = 0;
nsITimer* nsMouseWheelTransaction::sTimer = nullptr;
int32_t nsMouseWheelTransaction::sScrollSeriesCounter = 0;
bool nsMouseWheelTransaction::sOwnScrollbars = false;
static bool
OutOfTime(uint32_t aBaseTime, uint32_t aThreshold)
{
uint32_t now = PR_IntervalToMilliseconds(PR_IntervalNow());
return (now - aBaseTime > aThreshold);
}
static bool
CanScrollInRange(nscoord aMin, nscoord aValue, nscoord aMax, double aDirection)
@ -376,33 +328,20 @@ CanScrollInRange(nscoord aMin, nscoord aValue, nscoord aMax, double aDirection)
}
static bool
CanScrollOn(nsIScrollableFrame* aScrollFrame, double aDirectionX, double aDirectionY)
CanScrollOn(nsIScrollableFrame* aScrollFrame, double aDeltaX, double aDeltaY)
{
MOZ_ASSERT(aScrollFrame);
NS_ASSERTION(aDirectionX || aDirectionY,
NS_ASSERTION(aDeltaX || aDeltaY,
"One of the delta values must be non-zero at least");
nsPoint scrollPt = aScrollFrame->GetScrollPosition();
nsRect scrollRange = aScrollFrame->GetScrollRange();
uint32_t directions = aScrollFrame->GetPerceivedScrollingDirections();
return (aDirectionX && (directions & nsIScrollableFrame::HORIZONTAL) &&
CanScrollInRange(scrollRange.x, scrollPt.x, scrollRange.XMost(), aDirectionX)) ||
(aDirectionY && (directions & nsIScrollableFrame::VERTICAL) &&
CanScrollInRange(scrollRange.y, scrollPt.y, scrollRange.YMost(), aDirectionY));
}
bool
nsMouseWheelTransaction::OutOfTime(uint32_t aBaseTime, uint32_t aThreshold)
{
uint32_t now = PR_IntervalToMilliseconds(PR_IntervalNow());
return (now - aBaseTime > aThreshold);
}
void
nsMouseWheelTransaction::OwnScrollbars(bool aOwn)
{
sOwnScrollbars = aOwn;
return (aDeltaX && (directions & nsIScrollableFrame::HORIZONTAL) &&
CanScrollInRange(scrollRange.x, scrollPt.x, scrollRange.XMost(), aDeltaX)) ||
(aDeltaY && (directions & nsIScrollableFrame::VERTICAL) &&
CanScrollInRange(scrollRange.y, scrollPt.y, scrollRange.YMost(), aDeltaY));
}
void
@ -410,9 +349,6 @@ nsMouseWheelTransaction::BeginTransaction(nsIFrame* aTargetFrame,
WheelEvent* aEvent)
{
NS_ASSERTION(!sTargetFrame, "previous transaction is not finished!");
MOZ_ASSERT(aEvent->message == NS_WHEEL_WHEEL,
"Transaction must be started with a wheel event");
nsScrollbarsForWheel::OwnWheelTransaction(false);
sTargetFrame = aTargetFrame;
sScrollSeriesCounter = 0;
if (!UpdateTransaction(aEvent)) {
@ -449,16 +385,6 @@ nsMouseWheelTransaction::UpdateTransaction(WheelEvent* aEvent)
return true;
}
void
nsMouseWheelTransaction::MayEndTransaction()
{
if (!sOwnScrollbars && nsScrollbarsForWheel::IsActive()) {
nsScrollbarsForWheel::OwnWheelTransaction(true);
} else {
EndTransaction();
}
}
void
nsMouseWheelTransaction::EndTransaction()
{
@ -466,11 +392,6 @@ nsMouseWheelTransaction::EndTransaction()
sTimer->Cancel();
sTargetFrame = nullptr;
sScrollSeriesCounter = 0;
if (sOwnScrollbars) {
sOwnScrollbars = false;
nsScrollbarsForWheel::OwnWheelTransaction(false);
nsScrollbarsForWheel::Inactivate();
}
}
void
@ -494,7 +415,7 @@ nsMouseWheelTransaction::OnEvent(WidgetEvent* aEvent)
OutOfTime(sMouseMoved, GetIgnoreMoveDelayTime())) {
// Terminate the current mousewheel transaction if the mouse moved more
// than ignoremovedelay milliseconds ago
MayEndTransaction();
EndTransaction();
}
return;
case NS_MOUSE_MOVE:
@ -505,7 +426,7 @@ nsMouseWheelTransaction::OnEvent(WidgetEvent* aEvent)
nsIntPoint pt = GetScreenPoint(static_cast<WidgetGUIEvent*>(aEvent));
nsIntRect r = sTargetFrame->GetScreenRectExternal();
if (!r.Contains(pt)) {
MayEndTransaction();
EndTransaction();
return;
}
@ -554,9 +475,8 @@ nsMouseWheelTransaction::OnFailToScrollTarget()
}
// The target frame might be destroyed in the event handler, at that time,
// we need to finish the current transaction
if (!sTargetFrame) {
if (!sTargetFrame)
EndTransaction();
}
}
void
@ -571,7 +491,7 @@ nsMouseWheelTransaction::OnTimeout(nsITimer* aTimer, void* aClosure)
nsIFrame* frame = sTargetFrame;
// We need to finish current transaction before DOM event firing. Because
// the next DOM event might create strange situation for us.
MayEndTransaction();
EndTransaction();
if (Preferences::GetBool("test.mousescroll", false)) {
// This event is used for automated tests, see bug 442774.
@ -705,127 +625,6 @@ nsMouseWheelTransaction::OverrideSystemScrollSpeed(WheelEvent* aEvent)
return NS_FAILED(rv) ? DeltaValues(aEvent) : overriddenDeltaValues;
}
/******************************************************************/
/* nsScrollbarsForWheel */
/******************************************************************/
void
nsScrollbarsForWheel::PrepareToScrollText(
nsEventStateManager* aESM,
nsIFrame* aTargetFrame,
WheelEvent* aEvent)
{
if (aEvent->message == NS_WHEEL_START) {
nsMouseWheelTransaction::OwnScrollbars(false);
if (!IsActive()) {
TemporarilyActivateAllPossibleScrollTargets(aESM, aTargetFrame, aEvent);
sHadWheelStart = true;
}
} else {
DeactivateAllTemporarilyActivatedScrollTargets();
}
}
void
nsScrollbarsForWheel::SetActiveScrollTarget(nsIScrollableFrame* aScrollTarget)
{
if (!sHadWheelStart) {
return;
}
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(aScrollTarget);
if (!scrollbarOwner) {
return;
}
sHadWheelStart = false;
sActiveOwner = do_QueryFrame(aScrollTarget);
scrollbarOwner->ScrollbarActivityStarted();
}
void
nsScrollbarsForWheel::MayInactivate()
{
if (!sOwnWheelTransaction && nsMouseWheelTransaction::GetTargetFrame()) {
nsMouseWheelTransaction::OwnScrollbars(true);
} else {
Inactivate();
}
}
void
nsScrollbarsForWheel::Inactivate()
{
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sActiveOwner);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
sActiveOwner = nullptr;
DeactivateAllTemporarilyActivatedScrollTargets();
if (sOwnWheelTransaction) {
sOwnWheelTransaction = false;
nsMouseWheelTransaction::OwnScrollbars(false);
nsMouseWheelTransaction::EndTransaction();
}
}
bool
nsScrollbarsForWheel::IsActive()
{
if (sActiveOwner) {
return true;
}
for (size_t i = 0; i < kNumberOfTargets; ++i) {
if (sActivatedScrollTargets[i]) {
return true;
}
}
return false;
}
void
nsScrollbarsForWheel::OwnWheelTransaction(bool aOwn)
{
sOwnWheelTransaction = aOwn;
}
void
nsScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets(
nsEventStateManager* aESM,
nsIFrame* aTargetFrame,
WheelEvent* aEvent)
{
for (size_t i = 0; i < kNumberOfTargets; i++) {
const DeltaValues *dir = &directions[i];
nsWeakFrame* scrollTarget = &sActivatedScrollTargets[i];
MOZ_ASSERT(!*scrollTarget, "scroll target still temporarily activated!");
nsIScrollableFrame* target =
aESM->ComputeScrollTarget(aTargetFrame, dir->deltaX, dir->deltaY, aEvent,
nsEventStateManager::COMPUTE_DEFAULT_ACTION_TARGET);
if (target) {
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(target);
if (scrollbarOwner) {
nsIFrame* targetFrame = do_QueryFrame(target);
*scrollTarget = targetFrame;
scrollbarOwner->ScrollbarActivityStarted();
}
}
}
}
void
nsScrollbarsForWheel::DeactivateAllTemporarilyActivatedScrollTargets()
{
for (size_t i = 0; i < kNumberOfTargets; i++) {
nsWeakFrame* scrollTarget = &sActivatedScrollTargets[i];
if (*scrollTarget) {
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(*scrollTarget);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
*scrollTarget = nullptr;
}
}
}
/******************************************************************/
/* nsEventStateManager */
/******************************************************************/
@ -1178,20 +977,13 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
break;
case NS_WHEEL_WHEEL:
case NS_WHEEL_START:
case NS_WHEEL_STOP:
{
NS_ASSERTION(aEvent->mFlags.mIsTrusted,
"Untrusted wheel event shouldn't be here");
nsIContent* content = GetFocusedContent();
if (content) {
if (content)
mCurrentTargetContent = content;
}
if (aEvent->message != NS_WHEEL_WHEEL) {
break;
}
WheelEvent* wheelEvent = static_cast<WheelEvent*>(aEvent);
WheelPrefs::GetInstance()->ApplyUserPrefsToDelta(wheelEvent);
@ -2753,20 +2545,6 @@ nsIScrollableFrame*
nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
WheelEvent* aEvent,
ComputeScrollTargetOptions aOptions)
{
return ComputeScrollTarget(aTargetFrame, aEvent->deltaX, aEvent->deltaY,
aEvent, aOptions);
}
// Overload ComputeScrollTarget method to allow passing "test" dx and dy when looking
// for which scrollbarowners to activate when two finger down on trackpad
// and before any actual motion
nsIScrollableFrame*
nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
double aDirectionX,
double aDirectionY,
WheelEvent* aEvent,
ComputeScrollTargetOptions aOptions)
{
if (aOptions & PREFER_MOUSE_WHEEL_TRANSACTION) {
// If the user recently scrolled with the mousewheel, then they probably
@ -2791,14 +2569,14 @@ nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
// If the event doesn't cause scroll actually, we cannot find scroll target
// because we check if the event can cause scroll actually on each found
// scrollable frame.
if (!aDirectionX && !aDirectionY) {
if (!aEvent->deltaX && !aEvent->deltaY) {
return nullptr;
}
bool checkIfScrollableX =
aDirectionX && (aOptions & PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_X_AXIS);
aEvent->deltaX && (aOptions & PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_X_AXIS);
bool checkIfScrollableY =
aDirectionY && (aOptions & PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_Y_AXIS);
aEvent->deltaY && (aOptions & PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_Y_AXIS);
nsIScrollableFrame* frameToScroll = nullptr;
nsIFrame* scrollFrame =
@ -2826,7 +2604,8 @@ nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
// For default action, we should climb up the tree if cannot scroll it
// by the event actually.
bool canScroll = CanScrollOn(frameToScroll, aDirectionX, aDirectionY);
bool canScroll = CanScrollOn(frameToScroll,
aEvent->deltaX, aEvent->deltaY);
// Comboboxes need special care.
nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame);
if (comboBox) {
@ -3391,51 +3170,33 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
}
}
break;
case NS_WHEEL_STOP:
{
MOZ_ASSERT(aEvent->mFlags.mIsTrusted);
nsScrollbarsForWheel::MayInactivate();
}
break;
case NS_WHEEL_WHEEL:
case NS_WHEEL_START:
{
MOZ_ASSERT(aEvent->mFlags.mIsTrusted);
if (*aStatus == nsEventStatus_eConsumeNoDefault) {
nsScrollbarsForWheel::Inactivate();
break;
}
WheelEvent* wheelEvent = static_cast<WheelEvent*>(aEvent);
switch (WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent)) {
case WheelPrefs::ACTION_SCROLL: {
// For scrolling of default action, we should honor the mouse wheel
// transaction.
nsScrollbarsForWheel::PrepareToScrollText(this, aTargetFrame, wheelEvent);
if (aEvent->message != NS_WHEEL_WHEEL ||
(!wheelEvent->deltaX && !wheelEvent->deltaY)) {
if (!wheelEvent->deltaX && !wheelEvent->deltaY) {
break;
}
// For scrolling of default action, we should honor the mouse wheel
// transaction.
nsIScrollableFrame* scrollTarget =
ComputeScrollTarget(aTargetFrame, wheelEvent,
COMPUTE_DEFAULT_ACTION_TARGET);
nsScrollbarsForWheel::SetActiveScrollTarget(scrollTarget);
wheelEvent->overflowDeltaX = wheelEvent->deltaX;
wheelEvent->overflowDeltaY = wheelEvent->deltaY;
WheelPrefs::GetInstance()->
CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
if (scrollTarget) {
DoScrollText(scrollTarget, wheelEvent);
} else {
nsMouseWheelTransaction::EndTransaction();
nsScrollbarsForWheel::Inactivate();
}
break;
}

View File

@ -46,7 +46,6 @@ class nsEventStateManager : public nsSupportsWeakReference,
public nsIObserver
{
friend class nsMouseWheelTransaction;
friend class nsScrollbarsForWheel;
public:
typedef mozilla::TimeStamp TimeStamp;
@ -558,12 +557,6 @@ protected:
mozilla::WheelEvent* aEvent,
ComputeScrollTargetOptions aOptions);
nsIScrollableFrame* ComputeScrollTarget(nsIFrame* aTargetFrame,
double aDirectionX,
double aDirectionY,
mozilla::WheelEvent* aEvent,
ComputeScrollTargetOptions aOptions);
/**
* GetScrollAmount() returns the scroll amount in app uints of one line or
* one page. If the wheel event scrolls a page, returns the page width and

View File

@ -318,6 +318,49 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsDependentAtomString(aValue->GetAtomValue()));
}
if (aNameSpaceID == kNameSpaceID_None &&
aName == nsGkAtoms::src &&
!aValue) {
CancelImageRequests(aNotify);
}
// If we plan to call LoadImage, we want to do it first so that the image load
// kicks off. But if aNotify is false, we are coming from the parser or some
// such place; we'll get bound after all the attributes have been set, so
// we'll do the image load from BindToTree. Skip the LoadImage call in that case.
if (aNotify &&
aNameSpaceID == kNameSpaceID_None &&
aName == nsGkAtoms::crossorigin) {
// We want aForce == true in this LoadImage call, because we want to force
// a new load of the image with the new cross origin policy.
nsAutoString uri;
GetAttr(kNameSpaceID_None, nsGkAtoms::src, uri);
LoadImage(uri, true, aNotify);
}
if (aNotify &&
aNameSpaceID == kNameSpaceID_None &&
aName == nsGkAtoms::src &&
aValue) {
// Prevent setting image.src by exiting early
if (nsContentUtils::IsImageSrcSetDisabled()) {
return NS_OK;
}
// A hack to get animations to reset. See bug 594771.
mNewRequestsWillNeedAnimationReset = true;
// Force image loading here, so that we'll try to load the image from
// network if it's set to be not cacheable... If we change things so that
// the state gets in Element's attr-setting happen around this
// LoadImage call, we could start passing false instead of aNotify
// here.
LoadImage(aValue->GetStringValue(), true, aNotify);
mNewRequestsWillNeedAnimationReset = false;
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aNotify);
}
@ -387,32 +430,6 @@ HTMLImageElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
bool aNotify)
{
// If we plan to call LoadImage, we want to do it first so that the
// image load kicks off _before_ the reflow triggered by the SetAttr. But if
// aNotify is false, we are coming from the parser or some such place; we'll
// get bound after all the attributes have been set, so we'll do the
// image load from BindToTree. Skip the LoadImage call in that case.
if (aNotify &&
aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
// Prevent setting image.src by exiting early
if (nsContentUtils::IsImageSrcSetDisabled()) {
return NS_OK;
}
// A hack to get animations to reset. See bug 594771.
mNewRequestsWillNeedAnimationReset = true;
// Force image loading here, so that we'll try to load the image from
// network if it's set to be not cacheable... If we change things so that
// the state gets in Element's attr-setting happen around this
// LoadImage call, we could start passing false instead of aNotify
// here.
LoadImage(aValue, true, aNotify);
mNewRequestsWillNeedAnimationReset = false;
}
return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue,
aNotify);
}
@ -421,10 +438,6 @@ nsresult
HTMLImageElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::src) {
CancelImageRequests(aNotify);
}
return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

View File

@ -0,0 +1,2 @@
Access-Control-Allow-Origin: http://mochi.test:8888
Access-Control-Allow-Credentials: true

View File

@ -127,6 +127,8 @@ support-files =
file_srcdoc.html
form_submit_server.sjs
image.png
image-allow-credentials.png
image-allow-credentials.png^headers^
nnc_lockup.gif
reflect.js
wakelock.ogg
@ -343,6 +345,7 @@ support-files =
[test_bug879319.html]
[test_bug885024.html]
[test_bug893537.html]
[test_change_crossorigin.html]
[test_checked.html]
[test_dir_attributes_reflection.html]
[test_dl_attributes_reflection.html]

View File

@ -0,0 +1,89 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696451
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 696451</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 696451 **/
SimpleTest.waitForExplicitFinish();
var img = new Image,
canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d"),
src = "http://example.com/tests/content/html/content/test/image-allow-credentials.png",
imgDone = false,
imgNotAllowedToLoadDone = false;
img.src = src;
img.crossOrigin = "Anonymous";
img.addEventListener("load", function() {
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage( img, 0, 0 );
try {
canvas.toDataURL("image/png");
ok(true, "Image was refetched with setting crossOrigin.");
} catch (e) {
ok(false, "Image was not refetched after setting crossOrigin.");
}
imgDone = true;
if (imgDone && imgNotAllowedToLoadDone) {
SimpleTest.finish();
}
});
img.addEventListener("error", function (event) {
ok(false, "Should be able to load cross origin image with proper headers.");
imgDone = true;
if (imgDone && imgNotAllowedToLoadDone) {
SimpleTest.finish();
}
});
var imgNotAllowedToLoad = new Image;
imgNotAllowedToLoad.src = "http://example.com/tests/content/html/content/test/image.png";
imgNotAllowedToLoad.crossOrigin = "Anonymous";
imgNotAllowedToLoad.addEventListener("load", function() {
ok(false, "Image should not be allowed to load without " +
"allow-cross-origin-access headers.");
imgNotAllowedToLoadDone = true;
if (imgDone && imgNotAllowedToLoadDone) {
SimpleTest.finish();
}
});
imgNotAllowedToLoad.addEventListener("error", function() {
ok(true, "Image should not be allowed to load without " +
"allow-cross-origin-access headers.");
imgNotAllowedToLoadDone = true;
if (imgDone && imgNotAllowedToLoadDone) {
SimpleTest.finish();
}
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696451">Mozilla Bug 696451</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -50,7 +50,8 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
{ "compartments", "chrome://global/content/aboutCompartments.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
{ "memory", "chrome://global/content/aboutMemory.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
{ "addons", "chrome://mozapps/content/extensions/extensions.xul",

View File

@ -89,7 +89,7 @@ ActivityProxy.prototype = {
cleanup: function actProxy_cleanup() {
debug("cleanup");
if (!this.cleanedUp) {
if (cpmm && !this.cleanedUp) {
cpmm.removeMessageListener("Activity:FireSuccess", this);
cpmm.removeMessageListener("Activity:FireError", this);
}

View File

@ -1065,10 +1065,10 @@ let RIL = {
* @param on
* Boolean indicating whether the screen should be on or off.
*/
setScreenState: function setScreenState(on) {
setScreenState: function setScreenState(options) {
Buf.newParcel(REQUEST_SCREEN_STATE);
Buf.writeInt32(1);
Buf.writeInt32(on ? 1 : 0);
Buf.writeInt32(options.on ? 1 : 0);
Buf.sendParcel();
},

View File

@ -0,0 +1,47 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 10000;
let Services = SpecialPowers.Services;
function testScreenState(on, expected, msg) {
// send event to RadioInterface
Services.obs.notifyObservers(null, 'screen-state-changed', on);
// maybe rild/qemu needs some time to process the event
window.setTimeout(function() {
runEmulatorCmd('gsm report creg', function(result) {
is(result.pop(), 'OK', '\'gsm report creg\' successful');
ok(result.indexOf(expected) !== -1, msg);
runNextTest();
})}, 1000);
}
function testScreenStateDisabled() {
testScreenState('off', '+CREG: 1', 'screen is disabled');
}
function testScreenStateEnabled() {
testScreenState('on', '+CREG: 2', 'screen is enabled');
}
let tests = [
testScreenStateDisabled,
testScreenStateEnabled
];
function runNextTest() {
let test = tests.shift();
if (!test) {
cleanUp();
return;
}
test();
}
function cleanUp() {
finish();
}
runNextTest();

View File

@ -440,8 +440,10 @@ public:
// Use the regular nsScriptLoader for this grunt work! Should be just fine
// because we're running on the main thread.
// Unlike <script> tags, Worker scripts are always decoded as UTF-8,
// per spec. So we explicitly pass in the charset hint.
rv = nsScriptLoader::ConvertToUTF16(aLoadInfo.mChannel, aString, aStringLen,
EmptyString(), parentDoc,
NS_LITERAL_STRING("UTF-8"), parentDoc,
aLoadInfo.mScriptText);
if (NS_FAILED(rv)) {
return rv;

View File

@ -0,0 +1,7 @@
/*
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 484305 - Load workers as UTF-8.
postMessage({ encoding: "KOI8-R", text: "ðÒÉ×ÅÔ" });
postMessage({ encoding: "UTF-8", text: "Привет" });

View File

@ -20,6 +20,7 @@ support-files =
importScripts_worker_imported4.js
instanceof_worker.js
json_worker.js
loadEncoding_worker.js
location_worker.js
longThread_worker.js
multi_sharedWorker_frame.html
@ -73,6 +74,7 @@ support-files =
[test_importScripts.html]
[test_instanceof.html]
[test_json.html]
[test_loadEncoding.html]
[test_loadError.html]
[test_location.html]
[test_longThread.html]

View File

@ -0,0 +1,50 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 484305 - Load workers as UTF-8</title>
<meta http-equiv="content-type" content="text/html; charset=KOI8-R">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=484305">Bug 484305 - Load workers as UTF-8</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var canonical = String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442);
ok(document.inputEncoding === "KOI8-R", "Document encoding is KOI8-R");
// Worker sends two strings, one with `canonical` encoded in KOI8-R and one as UTF-8.
// Since Worker scripts should always be decoded using UTF-8, even if the owning document's charset is different, the UTF-8 decode should match, while KOI8-R should fail.
var counter = 0;
var worker = new Worker("loadEncoding_worker.js");
worker.onmessage = function(e) {
if (e.data.encoding === "KOI8-R") {
ok(e.data.text !== canonical, "KOI8-R decoded text should not match");
} else if (e.data.encoding === "UTF-8") {
ok(e.data.text === canonical, "UTF-8 decoded text should match");
}
counter++;
if (counter === 2)
SimpleTest.finish();
}
worker.onerror = function(e) {
ok(false, "Worker error");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -45,12 +45,6 @@
#include "nsXPIDLString.h"
#endif
#if defined(XP_MACOSX) && !defined(__LP64__)
#include "nsAutoPtr.h"
#include <Carbon/Carbon.h>
#endif
//*****************************************************************************
// nsWebBrowserFind
//*****************************************************************************
@ -244,25 +238,6 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(bool *outDidFind)
NS_IMETHODIMP nsWebBrowserFind::GetSearchString(PRUnichar * *aSearchString)
{
NS_ENSURE_ARG_POINTER(aSearchString);
#if defined(XP_MACOSX) && !defined(__LP64__)
OSStatus err;
ScrapRef scrap;
err = ::GetScrapByName(kScrapFindScrap, kScrapGetNamedScrap, &scrap);
if (err == noErr) {
Size byteCount;
err = ::GetScrapFlavorSize(scrap, kScrapFlavorTypeUnicode, &byteCount);
if (err == noErr) {
NS_ASSERTION(byteCount%2 == 0, "byteCount not a multiple of 2");
nsAutoArrayPtr<PRUnichar> buffer(new PRUnichar[byteCount/2 + 1]);
NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
err = ::GetScrapFlavorData(scrap, kScrapFlavorTypeUnicode, &byteCount, buffer.get());
if (err == noErr) {
buffer[byteCount/2] = PRUnichar('\0');
mSearchString.Assign(buffer);
}
}
}
#endif
*aSearchString = ToNewUnicode(mSearchString);
return NS_OK;
}
@ -270,15 +245,6 @@ NS_IMETHODIMP nsWebBrowserFind::GetSearchString(PRUnichar * *aSearchString)
NS_IMETHODIMP nsWebBrowserFind::SetSearchString(const PRUnichar * aSearchString)
{
mSearchString.Assign(aSearchString);
#if defined(XP_MACOSX) && !defined(__LP64__)
OSStatus err;
ScrapRef scrap;
err = ::GetScrapByName(kScrapFindScrap, kScrapClearNamedScrap, &scrap);
if (err == noErr) {
::PutScrapFlavor(scrap, kScrapFlavorTypeUnicode, kScrapFlavorMaskNone,
(mSearchString.Length()*2), aSearchString);
}
#endif
return NS_OK;
}

View File

@ -358,8 +358,8 @@ nsAuthGSSAPI::Init(const char *serviceName,
static bool sTelemetrySent = false;
if (!sTelemetrySent) {
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::NTLM_MODULE_USED,
serviceFlags | nsIAuthModule::REQ_PROXY_AUTH
mozilla::Telemetry::NTLM_MODULE_USED_2,
serviceFlags & nsIAuthModule::REQ_PROXY_AUTH
? NTLM_MODULE_KERBEROS_PROXY
: NTLM_MODULE_KERBEROS_DIRECT);
sTelemetrySent = true;

View File

@ -278,8 +278,8 @@ nsAuthSSPI::Init(const char *serviceName,
static bool sTelemetrySent = false;
if (!sTelemetrySent) {
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::NTLM_MODULE_USED,
serviceFlags | nsIAuthModule::REQ_PROXY_AUTH
mozilla::Telemetry::NTLM_MODULE_USED_2,
serviceFlags & nsIAuthModule::REQ_PROXY_AUTH
? NTLM_MODULE_WIN_API_PROXY
: NTLM_MODULE_WIN_API_DIRECT);
sTelemetrySent = true;

View File

@ -215,8 +215,8 @@ nsAuthSambaNTLM::Init(const char *serviceName,
static bool sTelemetrySent = false;
if (!sTelemetrySent) {
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::NTLM_MODULE_USED,
serviceFlags | nsIAuthModule::REQ_PROXY_AUTH
mozilla::Telemetry::NTLM_MODULE_USED_2,
serviceFlags & nsIAuthModule::REQ_PROXY_AUTH
? NTLM_MODULE_SAMBA_AUTH_PROXY
: NTLM_MODULE_SAMBA_AUTH_DIRECT);
sTelemetrySent = true;

View File

@ -39,15 +39,23 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
const gfx::Matrix4x4& aTransform,
const gfx::Point& aOffset)
{
if (!(mDiagnosticTypes & DIAGNOSTIC_TILE_BORDERS) && (aFlags & DIAGNOSTIC_TILE)) {
return;
}
if (!(mDiagnosticTypes & DIAGNOSTIC_LAYER_BORDERS)) {
if ((aFlags & DIAGNOSTIC_TILE) && !(mDiagnosticTypes & DIAGNOSTIC_TILE_BORDERS)) {
return;
}
if ((aFlags & DIAGNOSTIC_BIGIMAGE) && !(mDiagnosticTypes & DIAGNOSTIC_BIGIMAGE_BORDERS)) {
return;
}
if (!mDiagnosticTypes) {
return;
}
#ifdef MOZ_B2G
int lWidth = 4;
#elif defined(ANDROID)
int lWidth = 10;
#else
int lWidth = 2;
#endif
float opacity = 0.7;
gfx::Color color;
@ -57,7 +65,7 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
color = gfx::Color(0.0, 1.0, 1.0, 1.0); // greenish blue
}
} else if (aFlags & DIAGNOSTIC_IMAGE) {
color = gfx::Color(0.5, 0.0, 0.0, 1.0); // red
color = gfx::Color(1.0, 0.0, 0.0, 1.0); // red
} else if (aFlags & DIAGNOSTIC_COLOR) {
color = gfx::Color(0.0, 0.0, 1.0, 1.0); // blue
} else if (aFlags & DIAGNOSTIC_CONTAINER) {

View File

@ -165,6 +165,7 @@ ClientLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
MOZ_LAYERS_LOG((" ----- (beginning paint)"));
Log();
#endif
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_START);
NS_ASSERTION(InConstruction(), "Should be in construction phase");
mPhase = PHASE_DRAWING;

View File

@ -4,11 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ContainerLayerD3D10.h"
#include "nsAlgorithm.h"
#include "gfxUtils.h"
#include "nsRect.h"
#include "../d3d9/Nv3DVUtils.h"
#include "ThebesLayerD3D10.h"
#include "ReadbackProcessor.h"

View File

@ -4,8 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ContainerLayerD3D9.h"
#include "gfxUtils.h"
#include "nsRect.h"
#include "ThebesLayerD3D9.h"
#include "ReadbackProcessor.h"

View File

@ -602,7 +602,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
}
SetState(PINCHING);
mLastZoomFocus = aEvent.mFocusPoint;
mLastZoomFocus = aEvent.mFocusPoint - mFrameMetrics.mCompositionBounds.TopLeft();
return nsEventStatus_eConsumeNoDefault;
}
@ -619,13 +619,14 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
return nsEventStatus_eConsumeNoDefault;
}
ScreenToScreenScale spanRatio(aEvent.mCurrentSpan / aEvent.mPreviousSpan);
float spanRatio = aEvent.mCurrentSpan / aEvent.mPreviousSpan;
{
ReentrantMonitorAutoEnter lock(mMonitor);
CSSToScreenScale userZoom = mFrameMetrics.mZoom;
ScreenPoint focusPoint = aEvent.mFocusPoint;
ScreenPoint focusPoint = aEvent.mFocusPoint - mFrameMetrics.mCompositionBounds.TopLeft();
CSSPoint cssFocusPoint = focusPoint / userZoom;
CSSPoint focusChange = (mLastZoomFocus - focusPoint) / userZoom;
// If displacing by the change in focus point will take us off page bounds,
@ -641,54 +642,35 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
// When we zoom in with focus, we can zoom too much towards the boundaries
// that we actually go over them. These are the needed displacements along
// either axis such that we don't overscroll the boundaries when zooming.
gfx::Point neededDisplacement;
CSSPoint neededDisplacement;
bool doScale = (spanRatio > ScreenToScreenScale(1.0) && userZoom < mMaxZoom) ||
(spanRatio < ScreenToScreenScale(1.0) && userZoom > mMinZoom);
if (doScale) {
spanRatio.scale = clamped(spanRatio.scale,
mMinZoom.scale / userZoom.scale,
mMaxZoom.scale / userZoom.scale);
switch (mX.ScaleWillOverscroll(spanRatio, focusPoint.x))
{
case Axis::OVERSCROLL_NONE:
break;
case Axis::OVERSCROLL_MINUS:
case Axis::OVERSCROLL_PLUS:
neededDisplacement.x = -mX.ScaleWillOverscrollAmount(spanRatio, focusPoint.x);
break;
case Axis::OVERSCROLL_BOTH:
// If scaling this way will make us overscroll in both directions, then
// we must already be at the maximum zoomed out amount. In this case, we
// don't want to allow this scaling to go through and instead clamp it
// here.
doScale = false;
break;
}
CSSToScreenScale realMinZoom = mMinZoom;
CSSToScreenScale realMaxZoom = mMaxZoom;
realMinZoom.scale = std::max(realMinZoom.scale,
mFrameMetrics.mCompositionBounds.width / mFrameMetrics.mScrollableRect.width);
realMinZoom.scale = std::max(realMinZoom.scale,
mFrameMetrics.mCompositionBounds.height / mFrameMetrics.mScrollableRect.height);
if (realMaxZoom < realMinZoom) {
realMaxZoom = realMinZoom;
}
if (doScale) {
switch (mY.ScaleWillOverscroll(spanRatio, focusPoint.y))
{
case Axis::OVERSCROLL_NONE:
break;
case Axis::OVERSCROLL_MINUS:
case Axis::OVERSCROLL_PLUS:
neededDisplacement.y = -mY.ScaleWillOverscrollAmount(spanRatio, focusPoint.y);
break;
case Axis::OVERSCROLL_BOTH:
doScale = false;
break;
}
}
bool doScale = (spanRatio > 1.0 && userZoom < realMaxZoom) ||
(spanRatio < 1.0 && userZoom > realMinZoom);
if (doScale) {
ScaleWithFocus(userZoom * spanRatio, focusPoint);
spanRatio = clamped(spanRatio,
realMinZoom.scale / userZoom.scale,
realMaxZoom.scale / userZoom.scale);
if (neededDisplacement != gfx::Point()) {
ScrollBy(CSSPoint::FromUnknownPoint(neededDisplacement));
// Note that the spanRatio here should never put us into OVERSCROLL_BOTH because
// up above we clamped it.
neededDisplacement.x = -mX.ScaleWillOverscrollAmount(spanRatio, cssFocusPoint.x);
neededDisplacement.y = -mY.ScaleWillOverscrollAmount(spanRatio, cssFocusPoint.y);
ScaleWithFocus(spanRatio, cssFocusPoint);
if (neededDisplacement != CSSPoint()) {
ScrollBy(neededDisplacement);
}
ScheduleComposite();
@ -977,19 +959,14 @@ void AsyncPanZoomController::ScrollBy(const CSSPoint& aOffset) {
mFrameMetrics.mScrollOffset += aOffset;
}
void AsyncPanZoomController::ScaleWithFocus(const CSSToScreenScale& aZoom,
const ScreenPoint& aFocus) {
ScreenToScreenScale zoomFactor(aZoom.scale / mFrameMetrics.mZoom.scale);
CSSToScreenScale resolution = mFrameMetrics.mZoom;
SetZoomAndResolution(aZoom);
// If the new scale is very small, we risk multiplying in huge rounding
// errors, so don't bother adjusting the scroll offset.
if (resolution.scale >= 0.01f) {
zoomFactor.scale -= 1.0;
mFrameMetrics.mScrollOffset += aFocus * zoomFactor / resolution;
}
void AsyncPanZoomController::ScaleWithFocus(float aScale,
const CSSPoint& aFocus) {
SetZoomAndResolution(CSSToScreenScale(mFrameMetrics.mZoom.scale * aScale));
// We want to adjust the scroll offset such that the CSS point represented by aFocus remains
// at the same position on the screen before and after the change in zoom. The below code
// accomplishes this; see https://bugzilla.mozilla.org/show_bug.cgi?id=923431#c6 for an
// in-depth explanation of how.
mFrameMetrics.mScrollOffset = (mFrameMetrics.mScrollOffset + aFocus) - (aFocus / aScale);
}
bool AsyncPanZoomController::EnlargeDisplayPortAlongAxis(float aSkateSizeMultiplier,
@ -1350,8 +1327,8 @@ void AsyncPanZoomController::UpdateCompositionBounds(const ScreenIntRect& aCompo
// has gone out of view, the buffer will be cleared elsewhere anyways.
if (aCompositionBounds.width && aCompositionBounds.height &&
oldCompositionBounds.width && oldCompositionBounds.height) {
ScreenToScreenScale adjustmentFactor(float(aCompositionBounds.width) / float(oldCompositionBounds.width));
SetZoomAndResolution(mFrameMetrics.mZoom * adjustmentFactor);
float adjustmentFactor = float(aCompositionBounds.width) / float(oldCompositionBounds.width);
SetZoomAndResolution(CSSToScreenScale(mFrameMetrics.mZoom.scale * adjustmentFactor));
// Repaint on a rotation so that our new resolution gets properly updated.
RequestContentRepaint();

View File

@ -359,12 +359,10 @@ protected:
/**
* Scales the viewport by an amount (note that it multiplies this scale in to
* the current scale, it doesn't set it to |aScale|). Also considers a focus
* point so that the page zooms outward from that point.
*
* XXX: Fix focus point calculations.
* point so that the page zooms inward/outward from that point.
*/
void ScaleWithFocus(const mozilla::CSSToScreenScale& aScale,
const ScreenPoint& aFocus);
void ScaleWithFocus(float aScale,
const CSSPoint& aFocus);
/**
* Schedules a composite on the compositor thread. Wrapper for

View File

@ -271,34 +271,25 @@ float Axis::DisplacementWillOverscrollAmount(float aDisplacement) {
}
}
Axis::Overscroll Axis::ScaleWillOverscroll(ScreenToScreenScale aScale, float aFocus) {
float originAfterScale = (GetOrigin() + aFocus) * aScale.scale - aFocus;
float Axis::ScaleWillOverscrollAmount(float aScale, float aFocus) {
float originAfterScale = (GetOrigin() + aFocus) - (aFocus / aScale);
bool both = ScaleWillOverscrollBothSides(aScale);
bool minus = originAfterScale < GetPageStart() * aScale.scale;
bool plus = (originAfterScale + GetCompositionLength()) > GetPageEnd() * aScale.scale;
bool minus = originAfterScale < GetPageStart();
bool plus = (originAfterScale + (GetCompositionLength() / aScale)) > GetPageEnd();
if ((minus && plus) || both) {
return OVERSCROLL_BOTH;
// If we ever reach here it's a bug in the client code.
MOZ_ASSERT(false, "In an OVERSCROLL_BOTH condition in ScaleWillOverscrollAmount");
return 0;
}
if (minus) {
return OVERSCROLL_MINUS;
return originAfterScale - GetPageStart();
}
if (plus) {
return OVERSCROLL_PLUS;
}
return OVERSCROLL_NONE;
}
float Axis::ScaleWillOverscrollAmount(ScreenToScreenScale aScale, float aFocus) {
float originAfterScale = (GetOrigin() + aFocus) * aScale.scale - aFocus;
switch (ScaleWillOverscroll(aScale, aFocus)) {
case OVERSCROLL_MINUS: return originAfterScale - GetPageStart() * aScale.scale;
case OVERSCROLL_PLUS: return (originAfterScale + GetCompositionLength()) -
NS_lround(GetPageEnd() * aScale.scale);
// Don't handle OVERSCROLL_BOTH. Client code is expected to deal with it.
default: return 0;
return originAfterScale + (GetCompositionLength() / aScale) - GetPageEnd();
}
return 0;
}
float Axis::GetVelocity() {
@ -338,15 +329,13 @@ float Axis::GetPageLength() {
return GetRectLength(pageRect);
}
bool Axis::ScaleWillOverscrollBothSides(ScreenToScreenScale aScale) {
bool Axis::ScaleWillOverscrollBothSides(float aScale) {
const FrameMetrics& metrics = mAsyncPanZoomController->GetFrameMetrics();
CSSRect cssContentRect = metrics.mScrollableRect;
CSSToScreenScale scale(metrics.mZoom.scale * aScale);
CSSRect cssCompositionBounds = metrics.mCompositionBounds / scale;
CSSToScreenScale scale = metrics.mZoom * aScale;
CSSIntRect cssCompositionBounds = RoundedIn(metrics.mCompositionBounds / scale);
return GetRectLength(cssContentRect) < GetRectLength(CSSRect(cssCompositionBounds));
return GetRectLength(metrics.mScrollableRect) < GetRectLength(cssCompositionBounds);
}
AxisX::AxisX(AsyncPanZoomController* aAsyncPanZoomController)

View File

@ -142,30 +142,19 @@ public:
/**
* If a displacement will overscroll the axis, this returns the amount and in
* what direction. Similar to getExcess() but takes a displacement to apply.
* what direction. Similar to GetExcess() but takes a displacement to apply.
*/
float DisplacementWillOverscrollAmount(float aDisplacement);
/**
* Gets the overscroll state of the axis given a scaling of the page. That is
* to say, if the given scale is applied, this will tell you whether or not
* it will overscroll, and in what direction.
*
* |aFocus| is the point at which the scale is focused at. We will offset the
* scroll offset in such a way that it remains in the same place on the page
* relative.
*/
Overscroll ScaleWillOverscroll(ScreenToScreenScale aScale, float aFocus);
/**
* If a scale will overscroll the axis, this returns the amount and in what
* direction. Similar to getExcess() but takes a displacement to apply.
* direction. Similar to GetExcess() but takes a displacement to apply.
*
* |aFocus| is the point at which the scale is focused at. We will offset the
* scroll offset in such a way that it remains in the same place on the page
* relative.
*/
float ScaleWillOverscrollAmount(ScreenToScreenScale aScale, float aFocus);
float ScaleWillOverscrollAmount(float aScale, float aFocus);
/**
* Checks if an axis will overscroll in both directions by computing the
@ -174,7 +163,7 @@ public:
*
* This gets called by ScaleWillOverscroll().
*/
bool ScaleWillOverscrollBothSides(ScreenToScreenScale aScale);
bool ScaleWillOverscrollBothSides(float aScale);
float GetOrigin();
float GetCompositionLength();

View File

@ -101,9 +101,15 @@ CompositorChild::ActorDestroy(ActorDestroyReason aWhy)
{
MOZ_ASSERT(sCompositor == this);
#ifdef MOZ_B2G
// Due to poor lifetime management of gralloc (and possibly shmems) we will
// crash at some point in the future when we get destroyed due to abnormal
// shutdown. Its better just to crash here. On desktop though, we have a chance
// of recovering.
if (aWhy == AbnormalShutdown) {
NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at CompositorChild");
}
#endif
sCompositor = nullptr;
// We don't want to release the ref to sCompositor here, during

View File

@ -547,6 +547,7 @@ CompositorParent::Composite()
15 + (int)(TimeStamp::Now() - mExpectedComposeTime).ToMilliseconds());
}
#endif
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_END);
}
void

View File

@ -85,9 +85,15 @@ LayerTransactionChild::DeallocPCompositableChild(PCompositableChild* actor)
void
LayerTransactionChild::ActorDestroy(ActorDestroyReason why)
{
#ifdef MOZ_B2G
// Due to poor lifetime management of gralloc (and possibly shmems) we will
// crash at some point in the future when we get destroyed due to abnormal
// shutdown. Its better just to crash here. On desktop though, we have a chance
// of recovering.
if (why == AbnormalShutdown) {
NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at LayerTransactionChild");
}
#endif
}
} // namespace layers

View File

@ -187,6 +187,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const bool& isFirstPaint,
InfallibleTArray<EditReply>* reply)
{
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
PROFILER_LABEL("LayerTransactionParent", "RecvUpdate");
#ifdef COMPOSITOR_PERFORMANCE_WARNING
TimeStamp updateStart = TimeStamp::Now();

View File

@ -539,6 +539,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
PlatformSyncBeforeUpdate();
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END);
if (mTxn->mSwapRequired) {
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
RenderTraceScope rendertrace3("Forward Transaction", "000093");

View File

@ -53,6 +53,11 @@ public:
ReentrantMonitorAutoEnter lock(mMonitor);
mFrameMetrics = metrics;
}
FrameMetrics GetFrameMetrics() {
ReentrantMonitorAutoEnter lock(mMonitor);
return mFrameMetrics;
}
};
class TestAPZCTreeManager : public APZCTreeManager {
@ -115,6 +120,112 @@ TEST(AsyncPanZoomController, Constructor) {
apzc->SetFrameMetrics(TestFrameMetrics());
}
TEST(AsyncPanZoomController, Pinch) {
nsRefPtr<MockContentController> mcc = new MockContentController();
nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(0, mcc);
FrameMetrics fm;
fm.mViewport = CSSRect(0, 0, 980, 480);
fm.mCompositionBounds = ScreenIntRect(200, 200, 100, 200);
fm.mScrollableRect = CSSRect(0, 0, 980, 1000);
fm.mScrollOffset = CSSPoint(300, 300);
fm.mZoom = CSSToScreenScale(2.0);
apzc->SetFrameMetrics(fm);
// the visible area of the document in CSS pixels is x=300 y=300 w=50 h=100
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(2);
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_START,
0,
ScreenPoint(250, 300),
10.0,
10.0));
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE,
0,
ScreenPoint(250, 300),
12.5,
10.0));
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_END,
0,
ScreenPoint(250, 300),
12.5,
12.5));
// the visible area of the document in CSS pixels is now x=305 y=310 w=40 h=80
fm = apzc->GetFrameMetrics();
EXPECT_EQ(fm.mZoom.scale, 2.5f);
EXPECT_EQ(fm.mScrollOffset.x, 305);
EXPECT_EQ(fm.mScrollOffset.y, 310);
// part 2 of the test, move to the top-right corner of the page and pinch and
// make sure we stay in the correct spot
fm.mZoom = CSSToScreenScale(2.0);
fm.mScrollOffset = CSSPoint(930, 5);
apzc->SetFrameMetrics(fm);
// the visible area of the document in CSS pixels is x=930 y=5 w=50 h=100
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_START,
0,
ScreenPoint(250, 300),
10.0,
10.0));
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE,
0,
ScreenPoint(250, 300),
5.0,
10.0));
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_END,
0,
ScreenPoint(250, 300),
5.0,
5.0));
// the visible area of the document in CSS pixels is now x=880 y=0 w=100 h=200
fm = apzc->GetFrameMetrics();
EXPECT_EQ(fm.mZoom.scale, 1.0f);
EXPECT_EQ(fm.mScrollOffset.x, 880);
EXPECT_EQ(fm.mScrollOffset.y, 0);
}
TEST(AsyncPanZoomController, Overzoom) {
nsRefPtr<MockContentController> mcc = new MockContentController();
nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(0, mcc);
FrameMetrics fm;
fm.mViewport = CSSRect(0, 0, 100, 100);
fm.mCompositionBounds = ScreenIntRect(0, 0, 100, 100);
fm.mScrollableRect = CSSRect(0, 0, 125, 150);
fm.mScrollOffset = CSSPoint(10, 0);
fm.mZoom = CSSToScreenScale(1.0);
apzc->SetFrameMetrics(fm);
// the visible area of the document in CSS pixels is x=10 y=0 w=100 h=100
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(1);
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_START,
0,
ScreenPoint(50, 50),
10.0,
10.0));
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE,
0,
ScreenPoint(50, 50),
5.0,
10.0));
apzc->HandleInputEvent(PinchGestureInput(PinchGestureInput::PINCHGESTURE_END,
0,
ScreenPoint(50, 50),
5.0,
5.0));
fm = apzc->GetFrameMetrics();
EXPECT_EQ(fm.mZoom.scale, 0.8f);
EXPECT_EQ(fm.mScrollOffset.x, 0);
EXPECT_EQ(fm.mScrollOffset.y, 0);
}
TEST(AsyncPanZoomController, SimpleTransform) {
TimeStamp testStartTime = TimeStamp::Now();
// RefCounted class can't live in the stack

View File

@ -88,15 +88,15 @@ gfxCoreTextShaper::ShapeText(gfxContext *aContext,
::CFStringAppendCharacters(mutableString,
isRightToLeft ? beginRTL : beginLTR,
startOffset);
::CFStringAppendCharacters(mutableString, aText, length);
::CFStringAppendCharacters(mutableString, reinterpret_cast<const UniChar*>(aText), length);
::CFStringAppendCharacters(mutableString,
endBidiWrap, mozilla::ArrayLength(endBidiWrap));
stringObj = mutableString;
} else {
startOffset = 0;
stringObj = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
aText, length,
kCFAllocatorNull);
reinterpret_cast<const UniChar*>(aText),
length, kCFAllocatorNull);
}
CFDictionaryRef attrObj;

View File

@ -123,13 +123,13 @@ static NSFontManager *sFontManager;
static void GetStringForNSString(const NSString *aSrc, nsAString& aDist)
{
aDist.SetLength([aSrc length]);
[aSrc getCharacters:aDist.BeginWriting()];
[aSrc getCharacters:reinterpret_cast<unichar*>(aDist.BeginWriting())];
}
static NSString* GetNSStringForString(const nsAString& aSrc)
{
return [NSString stringWithCharacters:aSrc.BeginReading()
length:aSrc.Length()];
return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(aSrc.BeginReading())
length:aSrc.Length()];
}
#ifdef PR_LOGGING
@ -887,7 +887,7 @@ gfxMacPlatformFontList::GlobalFontFallback(const uint32_t aCh,
::CFStringGetCharacters(familyName, ::CFRangeMake(0, len),
buffer.Elements());
buffer[len] = 0;
nsDependentString familyName(buffer.Elements(), len);
nsDependentString familyName(reinterpret_cast<PRUnichar*>(buffer.Elements()), len);
bool needsBold; // ignored in the system fallback case

View File

@ -114,7 +114,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
formatterLocale = CFLocaleCopyCurrent();
} else {
CFStringRef localeStr = CFStringCreateWithCharacters(nullptr,
mLocale.get(),
reinterpret_cast<const UniChar*>(mLocale.get()),
mLocale.Length());
formatterLocale = CFLocaleCreate(nullptr, localeStr);
CFRelease(localeStr);
@ -221,7 +221,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
nsAutoTArray<UniChar, 256> stringBuffer;
if (stringBuffer.SetLength(stringLen + 1)) {
CFStringGetCharacters(formattedDate, CFRangeMake(0, stringLen), stringBuffer.Elements());
stringOut.Assign(stringBuffer.Elements(), stringLen);
stringOut.Assign(reinterpret_cast<PRUnichar*>(stringBuffer.Elements()), stringLen);
}
CFRelease(formattedDate);

View File

@ -230,7 +230,7 @@ nsLocaleService::nsLocaleService(void)
buffer[size] = 0;
// Convert the locale string to the format that Mozilla expects
nsAutoString xpLocale(buffer.Elements());
nsAutoString xpLocale(reinterpret_cast<PRUnichar*>(buffer.Elements()));
xpLocale.ReplaceChar('_', '-');
nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale));

View File

@ -32,7 +32,7 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
position == 0 ? kUCTextBreakLeadingEdgeMask :
(kUCTextBreakLeadingEdgeMask |
kUCTextBreakIterateMask),
aText,
reinterpret_cast<const UniChar*>(aText),
aLength,
position,
&offset);

View File

@ -3729,12 +3729,15 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
othervar = ExprVar('other')
managertype = Type(_actorName(p.name, self.side), ptr=1)
otherstmt = StmtDecl(Decl(managertype,
othervar.name),
init=ExprCast(sourcevar,
managertype,
static=1))
clonemanagees.addstmt(otherstmt)
if len(p.managesStmts):
otherstmt = StmtDecl(Decl(managertype,
othervar.name),
init=ExprCast(sourcevar,
managertype,
static=1))
clonemanagees.addstmt(otherstmt)
actorvar = ExprVar('actor')
for managee in p.managesStmts:
block = StmtBlock()

View File

@ -9,6 +9,8 @@ if CONFIG['MOZ_IPDL_TESTS']:
MODULE = 'ipdlgen'
FAIL_ON_WARNINGS = True
LIBXUL_LIBRARY = True
LIBRARY_NAME = 'mozipdlgen_s'

View File

@ -484,7 +484,7 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp)
#endif /* JS_OLD_GETTER_SETTER_METHODS */
/* ES5 15.2.3.2. */
bool
static bool
obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);

View File

@ -320,7 +320,7 @@ const Class js::NumericTypeClasses[ScalarTypeRepresentation::TYPE_MAX] = {
};
template <typename Domain, typename Input>
bool
static bool
InRange(Input x)
{
return std::numeric_limits<Domain>::min() <= x &&
@ -517,7 +517,7 @@ NumericTypeToString(JSContext *cx, unsigned int argc, Value *vp)
* This function takes a reference to either ArrayType or StructType and
* returns a JSObject which can be set as A.prototype.
*/
JSObject *
static JSObject *
SetupAndGetPrototypeObjectForComplexTypeInstance(JSContext *cx,
HandleObject complexTypeGlobal)
{

View File

@ -1,13 +1,17 @@
installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
ifndef INCLUDED_FUNCTIONS_MK
include $(topsrcdir)/config/makefiles/functions.mk
endif
ifneq (,$(filter /%,$(TOP_DIST)))
DIST = $(TOP_DIST)
DIST := $(call core_realpath,$(TOP_DIST))
else
ifeq (.,$(DEPTH))
DIST = $(TOP_DIST)
DIST := $(call core_realpath,$(TOP_DIST))
else
DIST = $(DEPTH)/$(TOP_DIST)
DIST := $(call core_realpath,$(DEPTH)/$(TOP_DIST))
endif
endif

View File

@ -64,10 +64,6 @@ check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not
$(foreach x,$(CHECK_VARS),$(check-variable))
ifndef INCLUDED_FUNCTIONS_MK
include $(topsrcdir)/config/makefiles/functions.mk
endif
RM = rm -f
# LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.

View File

@ -794,7 +794,7 @@ static const JSFunctionSpec sModuleFunctions[] = {
JS_FS_END
};
JS_ALWAYS_INLINE JSString*
static JS_ALWAYS_INLINE JSString*
NewUCString(JSContext* cx, const AutoString& from)
{
return JS_NewUCStringCopyN(cx, from.begin(), from.length());
@ -805,7 +805,7 @@ NewUCString(JSContext* cx, const AutoString& from)
*
* Note: |align| must be a power of 2.
*/
JS_ALWAYS_INLINE size_t
static JS_ALWAYS_INLINE size_t
Align(size_t val, size_t align)
{
// Ensure that align is a power of two.

View File

@ -78,7 +78,7 @@ static long glock = LOCK_IS_FREE;
#define vprof_printf printf
#endif
inline static entry* reverse (entry* s)
static inline entry* reverse (entry* s)
{
entry_t e, n, p;
@ -151,7 +151,7 @@ static void dumpProfile (void)
entries = reverse(entries);
}
inline static entry_t findEntry (char* file, int line)
static inline entry_t findEntry (char* file, int line)
{
for (entry_t e = entries; e; e = e->next) {
if ((e->line == line) && (VMPI_strcmp (e->file, file) == 0)) {

View File

@ -136,7 +136,7 @@ MaybeCheckEvalFreeVariables(ExclusiveContext *cxArg, HandleScript evalCaller, Ha
return true;
}
inline bool
static inline bool
CanLazilyParse(ExclusiveContext *cx, const CompileOptions &options)
{
return options.canLazilyParse &&

View File

@ -3009,10 +3009,19 @@ EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode
if (!EmitNumberOp(cx, pn3->pn_dval, bce))
return false;
} else {
// The parser already checked for atoms representing indexes and
// used PNK_NUMBER instead, but also watch for ids which TI treats
// as indexes for simpliciation of downstream analysis.
JS_ASSERT(pn3->isKind(PNK_STRING) || pn3->isKind(PNK_NAME));
if (!EmitAtomOp(cx, pn3, JSOP_GETPROP, bce))
return false;
doElemOp = false;
jsid id = NameToId(pn3->pn_atom->asPropertyName());
if (id != types::IdToTypeId(id)) {
if (!EmitTree(cx, bce, pn3))
return false;
} else {
if (!EmitAtomOp(cx, pn3, JSOP_GETPROP, bce))
return false;
doElemOp = false;
}
}
pn3 = pn2->pn_right;
}

View File

@ -191,7 +191,7 @@ FoldBinaryNumeric(ExclusiveContext *cx, JSOp op, ParseNode *pn1, ParseNode *pn2,
// to the parse node being replaced. The replacement, *pn, is unchanged except
// for its pn_next pointer; updating that is necessary if *pn's new parent is a
// list node.
void
static void
ReplaceNode(ParseNode **pnp, ParseNode *pn)
{
pn->pn_next = (*pnp)->pn_next;

View File

@ -2606,7 +2606,7 @@ Parser<ParseHandler>::maybeParseDirective(Node list, Node pn, bool *cont)
}
}
} else if (directive == context->names().useAsm) {
if (pc->sc->isFunctionBox() && !pc->isGenerator())
if (pc->sc->isFunctionBox())
return asmJS(list);
return report(ParseWarning, false, pn, JSMSG_USE_ASM_DIRECTIVE_FAIL);
}

View File

@ -914,7 +914,7 @@ TokenStream::atomize(ExclusiveContext *cx, CharBuffer &cb)
}
#ifdef DEBUG
bool
static bool
IsTokenSane(Token *tp)
{
// Nb: TOK_EOL should never be used in an actual Token; it should only be

View File

@ -34,7 +34,7 @@ CheckNonAddressThing(uintptr_t *w, Rooted<T> *rootp)
return w >= (uintptr_t*)rootp->address() && w < (uintptr_t*)(rootp->address() + 1);
}
JS_ALWAYS_INLINE bool
static JS_ALWAYS_INLINE bool
CheckStackRootThing(uintptr_t *w, Rooted<void *> *rootp, ThingRootKind kind)
{
if (kind == THING_ROOT_BINDINGS)

View File

@ -20,7 +20,7 @@ const JSClass global_class = {
};
template<typename T>
inline T *
static inline T *
checkPtr(T *ptr)
{
if (! ptr)
@ -28,7 +28,7 @@ checkPtr(T *ptr)
return ptr;
}
void
static void
checkBool(bool success)
{
if (! success)

View File

@ -105,6 +105,7 @@ assertTypeFailInEval('function f({}) { "use asm"; function g() {} return g }');
assertTypeFailInEval('function f({global}) { "use asm"; function g() {} return g }');
assertTypeFailInEval('function f(global, {imports}) { "use asm"; function g() {} return g }');
assertTypeFailInEval('function f(g = 2) { "use asm"; function g() {} return g }');
assertTypeFailInEval('function *f() { "use asm"; function g() {} return g }');
function assertLinkFailInEval(str)
{

View File

@ -0,0 +1,25 @@
x = []
try {
(function() {
schedulegc(1);
((function() {
return {
y: function() {
u() = []
}
}
})())
})()
watch.call(x, "valueOf", function() {})
gc()
} catch (e) { print(e); }
try {
(function() {
x.valueOf =
(function() {
y();
})
})()
x + 2
print('foo')
} catch (e) { print(e); }

View File

@ -32,7 +32,3 @@ assertSyntaxError("for yield (var i in o) {}");
// Expression bodies.
assertSyntaxError("function* f() yield 7");
// Asm.js.
load(libdir + "asm.js");
assertAsmDirectiveFail("function* f() { 'use asm'; function g() { return 0; } return g; })()")

View File

@ -6482,6 +6482,9 @@ EstablishPreconditions(ExclusiveContext *cx, AsmJSParser &parser)
if (cx->compartment()->debugMode())
return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by debugger");
if (parser.pc->isGenerator())
return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by generator context");
#ifdef JS_WORKER_THREADS
if (ParallelCompilationEnabled(cx)) {
if (!EnsureWorkerThreadsInitialized(cx))

View File

@ -4504,9 +4504,8 @@ CodeGenerator::visitCharCodeAt(LCharCodeAt *lir)
return false;
Address lengthAndFlagsAddr(str, JSString::offsetOfLengthAndFlags());
masm.loadPtr(lengthAndFlagsAddr, output);
masm.branchTest32(Assembler::Zero, output, Imm32(JSString::FLAGS_MASK), ool->entry());
masm.branchTest32(Assembler::Zero, lengthAndFlagsAddr, Imm32(JSString::FLAGS_MASK), ool->entry());
// getChars
Address charsAddr(str, JSString::offsetOfChars());

View File

@ -234,7 +234,7 @@ IsPhiObservable(MPhi *phi, Observability observe)
// Handles cases like:
// x is phi(a, x) --> a
// x is phi(a, a) --> a
inline MDefinition *
static inline MDefinition *
IsPhiRedundant(MPhi *phi)
{
MDefinition *first = phi->operandIfRedundant();

View File

@ -3960,7 +3960,7 @@ IonBuilder::makeInliningDecision(JSFunction *target, CallInfo &callInfo)
// TI calls ObjectStateChange to trigger invalidation of the caller.
types::TypeObjectKey *targetType = types::TypeObjectKey::get(target);
targetType->watchStateChange(constraints());
targetType->watchStateChangeForInlinedCall(constraints());
return true;
}
@ -4643,7 +4643,7 @@ IonBuilder::createThisScriptedSingleton(JSFunction *target, MDefinition *callee)
// Trigger recompilation if the templateObject changes.
types::TypeObjectKey *templateType = types::TypeObjectKey::get(templateObject);
if (templateType->newScript())
templateType->watchStateChange(constraints());
templateType->watchStateChangeForNewScriptTemplate(constraints());
MCreateThisWithTemplate *createThis = MCreateThisWithTemplate::New(templateObject);
current->add(createThis);
@ -6886,7 +6886,7 @@ IonBuilder::getTypedArrayElements(MDefinition *obj)
// The 'data' pointer can change in rare circumstances
// (ArrayBufferObject::changeContents).
types::TypeObjectKey *tarrType = types::TypeObjectKey::get(tarr);
tarrType->watchStateChange(constraints());
tarrType->watchStateChangeForTypedArrayBuffer(constraints());
obj->setFoldedUnchecked();
return MConstantElements::New(data);
@ -7600,7 +7600,7 @@ IonBuilder::jsop_not()
return true;
}
inline bool
static inline bool
TestClassHasAccessorHook(const Class *clasp, bool isGetter)
{
if (isGetter && clasp->ops.getGeneric)
@ -7610,7 +7610,7 @@ TestClassHasAccessorHook(const Class *clasp, bool isGetter)
return false;
}
inline bool
static inline bool
TestTypeHasOwnProperty(types::TypeObjectKey *typeObj, PropertyName *name, bool &cont)
{
cont = true;
@ -7621,7 +7621,7 @@ TestTypeHasOwnProperty(types::TypeObjectKey *typeObj, PropertyName *name, bool &
return true;
}
inline bool
static inline bool
TestCommonAccessorProtoChain(JSContext *cx, PropertyName *name,
bool isGetter, JSObject *foundProto,
JSObject *obj, bool &cont)
@ -7667,7 +7667,7 @@ TestCommonAccessorProtoChain(JSContext *cx, PropertyName *name,
return true;
}
inline bool
static inline bool
SearchCommonPropFunc(JSContext *cx, types::TemporaryTypeSet *types,
PropertyName *name, bool isGetter,
JSObject *&found, JSObject *&foundProto, bool &cont)

View File

@ -2395,7 +2395,7 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm,
return true;
}
bool
static bool
IsCacheableDOMProxyUnshadowedSetterCall(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject holder, MutableHandleShape shape,
bool *isSetter)

View File

@ -902,11 +902,10 @@ MacroAssembler::compareStrings(JSOp op, Register left, Register right, Register
void
MacroAssembler::checkInterruptFlagsPar(const Register &tempReg,
Label *fail)
Label *fail)
{
movePtr(ImmPtr(&GetIonContext()->runtime->interrupt), tempReg);
load32(Address(tempReg, 0), tempReg);
branchTest32(Assembler::NonZero, tempReg, tempReg, fail);
branch32(Assembler::NonZero, Address(tempReg, 0), Imm32(0), fail);
}
void
@ -1361,7 +1360,7 @@ MacroAssembler::clearCalleeTag(Register callee, ExecutionMode mode)
}
}
void printf0_(const char *output) {
static void printf0_(const char *output) {
printf("%s", output);
}
@ -1381,7 +1380,7 @@ MacroAssembler::printf(const char *output)
PopRegsInMask(RegisterSet::Volatile());
}
void printf1_(const char *output, uintptr_t value) {
static void printf1_(const char *output, uintptr_t value) {
char *line = JS_sprintf_append(nullptr, output, value);
printf("%s", line);
js_free(line);

View File

@ -632,9 +632,28 @@ LiveRangeAllocator<VREG>::buildLivenessInfo()
return false;
}
} else {
// Normally temps are considered to cover both the input
// and output of the associated instruction. In some cases
// though we want to use a fixed register as both an input
// and clobbered register in the instruction, so watch for
// this and shorten the temp to cover only the output.
CodePosition from = inputOf(*ins);
if (temp->policy() == LDefinition::PRESET) {
AnyRegister reg = temp->output()->toRegister();
for (LInstruction::InputIterator alloc(**ins); alloc.more(); alloc.next()) {
if (alloc->isUse()) {
LUse *use = alloc->toUse();
if (use->isFixedRegister()) {
if (GetFixedRegister(vregs[use].def(), use) == reg)
from = outputOf(*ins);
}
}
}
}
CodePosition to =
ins->isCall() ? outputOf(*ins) : outputOf(*ins).next();
if (!vregs[temp].getInterval(0)->addRangeAtHead(inputOf(*ins), to))
if (!vregs[temp].getInterval(0)->addRangeAtHead(from, to))
return false;
}
}
@ -684,7 +703,6 @@ LiveRangeAllocator<VREG>::buildLivenessInfo()
CodePosition to;
if (forLSRA) {
if (use->isFixedRegister()) {
JS_ASSERT(!use->usedAtStart());
AnyRegister reg = GetFixedRegister(vregs[use].def(), use);
if (!addFixedRangeAtHead(reg, inputOf(*ins), outputOf(*ins)))
return false;

View File

@ -55,7 +55,7 @@ printTrace(const char *prefix, struct IonLIRTraceData *cached)
cached->blockIndex, cached->lirIndex, cached->execModeInt, cached->lirOpName);
}
struct IonLIRTraceData seqTraceData;
static struct IonLIRTraceData seqTraceData;
#endif
void

View File

@ -2167,7 +2167,7 @@ RemoveTruncatesOnOutput(MInstruction *truncated)
}
}
void
static void
AdjustTruncatedInputs(MInstruction *truncated)
{
MBasicBlock *block = truncated->block();

View File

@ -1495,7 +1495,7 @@ Assembler::as_movt(Register dest, Imm16 imm, Condition c, Instruction *pos)
return writeInst(0x03400000 | c | imm.encode() | RD(dest), (uint32_t*)pos);
}
const int mull_tag = 0x90;
static const int mull_tag = 0x90;
BufferOffset
Assembler::as_genmul(Register dhi, Register dlo, Register rm, Register rn,

View File

@ -341,6 +341,12 @@ LIRGeneratorShared::useFixed(MDefinition *mir, Register reg)
return use(mir, LUse(reg));
}
LUse
LIRGeneratorShared::useFixedAtStart(MDefinition *mir, Register reg)
{
return use(mir, LUse(reg, true));
}
LUse
LIRGeneratorShared::useFixed(MDefinition *mir, FloatRegister reg)
{

View File

@ -72,6 +72,7 @@ class LIRGeneratorShared : public MInstructionVisitorWithDefaults
inline LUse useFixed(MDefinition *mir, Register reg);
inline LUse useFixed(MDefinition *mir, FloatRegister reg);
inline LUse useFixed(MDefinition *mir, AnyRegister reg);
inline LUse useFixedAtStart(MDefinition *mir, Register reg);
inline LAllocation useOrConstant(MDefinition *mir);
// "Any" is architecture dependent, and will include registers and stack slots on X86,
// and only registers on ARM.

View File

@ -224,9 +224,9 @@ LIRGeneratorX86Shared::visitAsmJSUDiv(MAsmJSUDiv *div)
bool
LIRGeneratorX86Shared::lowerUMod(MInstruction *mod)
{
LUDivOrMod *lir = new LUDivOrMod(useFixed(mod->getOperand(0), eax),
LUDivOrMod *lir = new LUDivOrMod(useFixedAtStart(mod->getOperand(0), eax),
useRegister(mod->getOperand(1)),
LDefinition::BogusTemp());
tempFixed(eax));
return defineFixed(lir, mod, LAllocation(AnyRegister(edx)));
}

View File

@ -1040,12 +1040,14 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
void loadConstantFloat32(float f, const FloatRegister &dest);
void branchTruncateDouble(const FloatRegister &src, const Register &dest, Label *fail) {
const uint64_t IndefiniteIntegerValue = 0x8000000000000000;
JS_ASSERT(dest != ScratchReg);
cvttsd2sq(src, dest);
movq(ImmWord(IndefiniteIntegerValue), ScratchReg);
cmpq(dest, ScratchReg);
j(Assembler::Equal, fail);
// cvttsd2sq returns 0x8000000000000000 on failure. Test for it by
// subtracting 1 and testing overflow (this avoids the need to
// materialize that value in a register).
cmpq(dest, Imm32(1));
j(Assembler::Overflow, fail);
movl(dest, dest); // Zero upper 32-bits.
}
@ -1057,14 +1059,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
testl(operand.valueReg(), operand.valueReg());
j(truthy ? NonZero : Zero, label);
}
// This returns the tag in ScratchReg.
Condition testStringTruthy(bool truthy, const ValueOperand &value) {
unboxString(value, ScratchReg);
Operand lengthAndFlags(ScratchReg, JSString::offsetOfLengthAndFlags());
movq(lengthAndFlags, ScratchReg);
shrq(Imm32(JSString::LENGTH_SHIFT), ScratchReg);
testq(ScratchReg, ScratchReg);
testq(lengthAndFlags, Imm32(-1 << JSString::LENGTH_SHIFT));
return truthy ? Assembler::NonZero : Assembler::Zero;
}

View File

@ -879,16 +879,22 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
void addConstantFloat32(float f, const FloatRegister &dest);
void branchTruncateDouble(const FloatRegister &src, const Register &dest, Label *fail) {
const uint32_t IndefiniteIntegerValue = 0x80000000;
cvttsd2si(src, dest);
cmpl(dest, Imm32(IndefiniteIntegerValue));
j(Assembler::Equal, fail);
// cvttsd2si returns 0x80000000 on failure. Test for it by
// subtracting 1 and testing overflow (this permits the use of a
// smaller immediate field).
cmpl(dest, Imm32(1));
j(Assembler::Overflow, fail);
}
void branchTruncateFloat32(const FloatRegister &src, const Register &dest, Label *fail) {
const uint32_t IndefiniteIntegerValue = 0x80000000;
cvttss2si(src, dest);
cmpl(dest, Imm32(IndefiniteIntegerValue));
j(Assembler::Equal, fail);
// cvttss2si returns 0x80000000 on failure. Test for it by
// subtracting 1 and testing overflow (this permits the use of a
// smaller immediate field).
cmpl(dest, Imm32(1));
j(Assembler::Overflow, fail);
}
Condition testInt32Truthy(bool truthy, const ValueOperand &operand) {

View File

@ -3767,7 +3767,7 @@ JS_Enumerate(JSContext *cx, JSObject *objArg)
* + native case here uses a JSShape *, but that iterates in reverse!
* + so we make non-native match, by reverse-iterating after JS_Enumerating
*/
const uint32_t JSSLOT_ITER_INDEX = 0;
static const uint32_t JSSLOT_ITER_INDEX = 0;
static void
prop_iter_finalize(FreeOp *fop, JSObject *obj)

View File

@ -133,7 +133,7 @@ js::StringIsArrayIndex(JSLinearString *str, uint32_t *indexp)
return false;
}
bool
static bool
DoubleIndexToId(JSContext *cx, double index, MutableHandleId id)
{
if (index == uint32_t(index))
@ -1437,7 +1437,7 @@ NumDigitsBase10(uint32_t n)
return t - (n < powersOf10[t]) + 1;
}
inline bool
static inline bool
CompareLexicographicInt32(JSContext *cx, const Value &a, const Value &b, bool *lessOrEqualp)
{
int32_t aint = a.toInt32();
@ -1482,7 +1482,7 @@ CompareLexicographicInt32(JSContext *cx, const Value &a, const Value &b, bool *l
return true;
}
inline bool
static inline bool
CompareSubStringValues(JSContext *cx, const jschar *s1, size_t l1,
const jschar *s2, size_t l2, bool *lessOrEqualp)
{
@ -1709,7 +1709,7 @@ MatchNumericComparator(JSContext *cx, const Value &v)
}
template<typename K, typename C>
inline bool
static inline bool
MergeSortByKey(K keys, size_t len, K scratch, C comparator, AutoValueVector *vec)
{
MOZ_ASSERT(vec->length() >= len);
@ -2002,7 +2002,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
return true;
}
JS_ALWAYS_INLINE bool
static JS_ALWAYS_INLINE bool
NewbornArrayPushImpl(JSContext *cx, HandleObject obj, const Value &v)
{
Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());

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