Merge m-c to bs.

This commit is contained in:
Kyle Huey 2011-03-27 20:53:14 -04:00
commit fb902de373
57 changed files with 1096 additions and 479 deletions

View File

@ -101,6 +101,13 @@ function Drag(item, event, isFauxDrag) {
};
Drag.prototype = {
// ----------
// Function: toString
// Prints [Drag (item)] for debug use
toString: function Drag_toString() {
return "[Drag (" + this.item + ")]";
},
// ----------
// Function: snapBounds
// Adjusts the given bounds according to the currently active trenches. Used by <Drag.snap>

View File

@ -281,6 +281,13 @@ function GroupItem(listOfEls, options) {
// ----------
GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// ----------
// Function: toString
// Prints [GroupItem id=id] for debug use
toString: function GroupItem_toString() {
return "[GroupItem id=" + this.id + "]";
},
// ----------
// Variable: defaultName
// The prompt text for the title field.
@ -1792,6 +1799,13 @@ let GroupItems = {
minGroupHeight: 110,
minGroupWidth: 125,
// ----------
// Function: toString
// Prints [GroupItems] for debug use
toString: function GroupItems_toString() {
return "[GroupItems count=" + this.groupItems.length + "]";
},
// ----------
// Function: init
init: function GroupItems_init() {

View File

@ -186,6 +186,23 @@ function iQClass(selector, context) {
iQClass.prototype = {
// ----------
// Function: toString
// Prints [iQ...] for debug use
toString: function iQClass_toString() {
if (this.length > 1) {
if (this.selector)
return "[iQ (" + this.selector + ")]";
else
return "[iQ multi-object]";
}
if (this.length == 1)
return "[iQ (" + this[0].toString() + ")]";
return "[iQ non-object]";
},
// Start with an empty selector
selector: "",

View File

@ -854,6 +854,13 @@ Item.prototype = {
// Class: Items
// Keeps track of all Items.
let Items = {
// ----------
// Function: toString
// Prints [Items] for debug use
toString: function Items_toString() {
return "[Items]";
},
// ----------
// Variable: defaultGutter
// How far apart Items should be from each other and from bounds

View File

@ -41,6 +41,13 @@ Cu.import("resource://gre/modules/Services.jsm");
let EXPORTED_SYMBOLS = ["AllTabs"];
let AllTabs = {
// ----------
// Function: toString
// Prints [AllTabs] for debug use
toString: function AllTabs_toString() {
return "[AllTabs]";
},
/**
* Get an array of all tabs from all tabbrowser windows.
*

View File

@ -74,6 +74,13 @@ function Point(a, y) {
};
Point.prototype = {
// ----------
// Function: toString
// Prints [Point (x,y)] for debug use
toString: function Point_toString() {
return "[Point (" + this.x + "," + this.y + ")]";
},
// ----------
// Function: distance
// Returns the distance from this point to the given <Point>.
@ -109,6 +116,13 @@ function Rect(a, top, width, height) {
};
Rect.prototype = {
// ----------
// Function: toString
// Prints [Rect (left,top,width,height)] for debug use
toString: function Rect_toString() {
return "[Rect (" + this.left + "," + this.top + "," +
this.width + "," + this.height + ")]";
},
get right() this.left + this.width,
set right(value) {
@ -282,6 +296,13 @@ function Range(min, max) {
};
Range.prototype = {
// ----------
// Function: toString
// Prints [Range (min,max)] for debug use
toString: function Range_toString() {
return "[Range (" + this.min + "," + this.max + ")]";
},
// Variable: extent
// Equivalent to max-min
get extent() {
@ -464,6 +485,13 @@ Subscribable.prototype = {
let Utils = {
defaultFaviconURL: "chrome://mozapps/skin/places/defaultFavicon.png",
// ----------
// Function: toString
// Prints [Utils] for debug use
toString: function Utils_toString() {
return "[Utils]";
},
// ___ Logging
useConsole: true, // as opposed to dump
showTime: false,

View File

@ -116,6 +116,13 @@ function scorePatternMatch(pattern, matched, offset) {
// <TabItem>s and <xul:tab>s without having to worry which
// one is which.
var TabUtils = {
// ----------
// Function: toString
// Prints [TabUtils] for debug use
toString: function TabUtils_toString() {
return "[TabUtils]";
},
// ---------
// Function: _nameOfTab
// Given a <TabItem> or a <xul:tab> returns the tab's name.
@ -166,7 +173,14 @@ function TabMatcher(term) {
this.term = term;
}
TabMatcher.prototype = {
TabMatcher.prototype = {
// ----------
// Function: toString
// Prints [TabMatcher (term)] for debug use
toString: function TabMatcher_toString() {
return "[TabMatcher (" + this.term + ")]";
},
// ---------
// Function: _filterAndSortMatches
// Given an array of <TabItem>s and <xul:tab>s returns a new array
@ -316,6 +330,13 @@ function SearchEventHandlerClass() {
}
SearchEventHandlerClass.prototype = {
// ----------
// Function: toString
// Prints [SearchEventHandler] for debug use
toString: function SearchEventHandlerClass_toString() {
return "[SearchEventHandler]";
},
// ----------
// Function: init
// Initializes the searchbox to be focused, and everything

View File

@ -50,6 +50,13 @@ let Storage = {
CACHE_CLIENT_IDENTIFIER: "tabview-cache",
CACHE_PREFIX: "moz-panorama:",
// ----------
// Function: toString
// Prints [Storage] for debug use
toString: function Storage_toString() {
return "[Storage]";
},
// ----------
// Function: init
// Sets up the object.
@ -413,6 +420,13 @@ function CacheListener(callback) {
};
CacheListener.prototype = {
// ----------
// Function: toString
// Prints [CacheListener] for debug use
toString: function CacheListener_toString() {
return "[CacheListener]";
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsICacheListener]),
onCacheEntryAvailable: function (entry, access, status) {
this.callback(entry, access, status);

View File

@ -212,6 +212,13 @@ function TabItem(tab, options) {
};
TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// ----------
// Function: toString
// Prints [TabItem (tab)] for debug use
toString: function TabItem_toString() {
return "[TabItem (" + this.tab + ")]";
},
// ----------
// Function: forceCanvasSize
// Repaints the thumbnail with the given resolution, and forces it
@ -814,6 +821,13 @@ let TabItems = {
_reconnectingPaused: false,
tabItemPadding: {},
// ----------
// Function: toString
// Prints [TabItems count=count] for debug use
toString: function TabItems_toString() {
return "[TabItems count=" + this.items.length + "]";
},
// ----------
// Function: init
// Set up the necessary tracking to maintain the <TabItems>s.
@ -857,7 +871,9 @@ let TabItems = {
if (tab.ownerDocument.defaultView != gWindow || tab.pinned)
return;
self.unlink(tab);
// XXX bug #635975 - don't unlink the tab if the dom window is closing.
if (!UI.isDOMWindowClosing)
self.unlink(tab);
}
for (let name in this._eventListeners) {
AllTabs.register(name, this._eventListeners[name]);
@ -1340,6 +1356,13 @@ TabPriorityQueue.prototype = {
_low: [], // low priority queue
_high: [], // high priority queue
// ----------
// Function: toString
// Prints [TabPriorityQueue count=count] for debug use
toString: function TabPriorityQueue_toString() {
return "[TabPriorityQueue count=" + (this._low.length + this._high.length) + "]";
},
// ----------
// Function: clear
// Empty the update queue
@ -1441,6 +1464,13 @@ function TabCanvas(tab, canvas) {
};
TabCanvas.prototype = {
// ----------
// Function: toString
// Prints [TabCanvas (tab)] for debug use
toString: function TabCanvas_toString() {
return "[TabCanvas (" + this.tab + ")]";
},
// ----------
// Function: paint
paint: function TabCanvas_paint(evt) {

View File

@ -110,6 +110,15 @@ function Trench(element, xory, type, edge) {
};
Trench.prototype = {
// ----------
// Function: toString
// Prints [Trench edge type (parentItem)] for debug use
toString: function Trench_toString() {
return "[Trench " + this.edge + " " + this.type +
(this.parentItem ? " (" + this.parentItem + ")" : "") +
"]";
},
//----------
// Variable: radius
// (integer) radius is how far away we should snap from
@ -481,6 +490,13 @@ var Trenches = {
trenches: [],
// ----------
// Function: toString
// Prints [Trenches count=count] for debug use
toString: function Trenches_toString() {
return "[Trenches count=" + this.trenches.length + "]";
},
// ---------
// Function: getById
// Return the specified <Trench>.

View File

@ -132,6 +132,13 @@ let UI = {
// windows is about to close.
isDOMWindowClosing: false,
// ----------
// Function: toString
// Prints [UI] for debug use
toString: function UI_toString() {
return "[UI]";
},
// ----------
// Function: init
// Must be called after the object is created.

View File

@ -71,6 +71,14 @@ nsSMILKeySpline::GetSplineValue(double aX) const
return CalcBezier(GetTForX(aX), mY1, mY2);
}
void
nsSMILKeySpline::GetSplineDerivativeValues(double aX, double& aDX, double& aDY) const
{
double t = GetTForX(aX);
aDX = GetSlope(t, mX1, mX2);
aDY = GetSlope(t, mY1, mY2);
}
void
nsSMILKeySpline::CalcSampleValues()
{

View File

@ -69,6 +69,8 @@ public:
*/
double GetSplineValue(double aX) const;
void GetSplineDerivativeValues(double aX, double& aDX, double& aDY) const;
private:
void
CalcSampleValues();

View File

@ -896,6 +896,10 @@ nsXBLPrototypeBinding::LocateInstance(nsIContent* aBoundElement,
binding = binding->GetBaseBinding();
}
NS_ABORT_IF_FALSE(binding, "Bug 620181 this is unexpected");
if (!binding)
return nsnull;
nsInsertionPointList* points = nsnull;
if (anonContent == copyParent)
binding->GetInsertionPointsFor(aBoundElement, &points);

View File

@ -316,6 +316,7 @@ txXPCOMExtensionFunctionCall::GetParamType(const nsXPTParamInfo &aParam,
return eOBJECT;
}
}
// FALLTHROUGH
default:
{
// XXX Error!

View File

@ -423,7 +423,7 @@ TestNode::Constrain(InstantiationSet& aInstantiations)
rv = FilterInstantiations(aInstantiations, &cantHandleYet);
if (NS_FAILED(rv)) return rv;
if ((mParent && ! aInstantiations.Empty()) || cantHandleYet) {
if (mParent && (!aInstantiations.Empty() || cantHandleYet)) {
// if we still have instantiations, or if the instantiations
// could not be filled in yet, then ride 'em on up to the
// parent to narrow them.

View File

@ -158,8 +158,11 @@ ContentParent::GetSingleton(PRBool aForceNew)
if (gSingleton && !gSingleton->IsAlive())
gSingleton = nsnull;
if (!gSingleton && aForceNew)
gSingleton = new ContentParent();
if (!gSingleton && aForceNew) {
nsRefPtr<ContentParent> parent = new ContentParent();
gSingleton = parent;
parent->Init();
}
return gSingleton;
}
@ -344,8 +347,6 @@ ContentParent::ContentParent()
nsChromeRegistryChrome* chromeRegistry =
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
chromeRegistry->SendRegisteredChrome(this);
Init();
}
ContentParent::~ContentParent()

View File

@ -205,10 +205,12 @@ nsRect& nsRect::ScaleRoundOut(float aXScale, float aYScale)
return *this;
}
#ifdef DEBUG
static bool IsFloatInteger(float aFloat)
{
return fabs(aFloat - NS_round(aFloat)) < 1e-6;
}
#endif
nsRect& nsRect::ExtendForScaling(float aXMult, float aYMult)
{

View File

@ -129,7 +129,10 @@ static ContentMap* sContentMap = NULL;
static ContentMap& GetContentMap() {
if (!sContentMap) {
sContentMap = new ContentMap();
nsresult rv = sContentMap->Init();
#ifdef DEBUG
nsresult rv =
#endif
sContentMap->Init();
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Could not initialize map.");
}
return *sContentMap;

View File

@ -82,6 +82,7 @@
#include "nsILookAndFeel.h"
#include "mozilla/dom/Element.h"
#include "FrameLayerBuilder.h"
#include "nsSMILKeySpline.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -1288,55 +1289,121 @@ NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
//-------------------- Inner ----------------------
#define SMOOTH_SCROLL_MSECS_PER_FRAME 10
#define SMOOTH_SCROLL_FRAMES 10
#define SMOOTH_SCROLL_PREF_NAME "general.smoothScroll"
const double kCurrentVelocityWeighting = 0.25;
const double kStopDecelerationWeighting = 0.4;
const double kSmoothScrollAnimationDuration = 150; // milliseconds
class nsGfxScrollFrameInner::AsyncScroll {
public:
typedef mozilla::TimeStamp TimeStamp;
typedef mozilla::TimeDuration TimeDuration;
AsyncScroll() {}
~AsyncScroll() {
if (mScrollTimer) mScrollTimer->Cancel();
}
nsPoint PositionAt(TimeStamp aTime);
nsSize VelocityAt(TimeStamp aTime); // In nscoords per second
void InitSmoothScroll(TimeStamp aTime, nsPoint aCurrentPos,
nsSize aCurrentVelocity, nsPoint aDestination);
PRBool IsFinished(TimeStamp aTime) {
return aTime > mStartTime + mDuration; // XXX or if we've hit the wall
}
nsCOMPtr<nsITimer> mScrollTimer;
PRInt32 mVelocities[SMOOTH_SCROLL_FRAMES*2];
PRInt32 mFrameIndex;
TimeStamp mStartTime;
TimeDuration mDuration;
nsPoint mStartPos;
nsPoint mDestination;
nsSMILKeySpline mTimingFunctionX;
nsSMILKeySpline mTimingFunctionY;
PRPackedBool mIsSmoothScroll;
protected:
double ProgressAt(TimeStamp aTime) {
return NS_MIN(1.0, NS_MAX(0.0, (aTime - mStartTime) / mDuration));
}
nscoord VelocityComponent(double aTimeProgress,
nsSMILKeySpline& aTimingFunction,
nscoord aStart, nscoord aDestination);
// Initializes the timing function in such a way that the current velocity is
// preserved.
void InitTimingFunction(nsSMILKeySpline& aTimingFunction,
nscoord aCurrentPos, nscoord aCurrentVelocity,
nscoord aDestination);
};
static void ComputeVelocities(PRInt32 aCurVelocity, nscoord aCurPos, nscoord aDstPos,
PRInt32* aVelocities, PRInt32 aP2A)
nsPoint
nsGfxScrollFrameInner::AsyncScroll::PositionAt(TimeStamp aTime) {
double progressX = mTimingFunctionX.GetSplineValue(ProgressAt(aTime));
double progressY = mTimingFunctionY.GetSplineValue(ProgressAt(aTime));
return nsPoint((1 - progressX) * mStartPos.x + progressX * mDestination.x,
(1 - progressY) * mStartPos.y + progressY * mDestination.y);
}
nsSize
nsGfxScrollFrameInner::AsyncScroll::VelocityAt(TimeStamp aTime) {
double timeProgress = ProgressAt(aTime);
return nsSize(VelocityComponent(timeProgress, mTimingFunctionX,
mStartPos.x, mDestination.x),
VelocityComponent(timeProgress, mTimingFunctionY,
mStartPos.y, mDestination.y));
}
void
nsGfxScrollFrameInner::AsyncScroll::InitSmoothScroll(TimeStamp aTime,
nsPoint aCurrentPos,
nsSize aCurrentVelocity,
nsPoint aDestination) {
mStartTime = aTime;
mStartPos = aCurrentPos;
mDestination = aDestination;
mDuration = TimeDuration::FromMilliseconds(kSmoothScrollAnimationDuration);
InitTimingFunction(mTimingFunctionX, mStartPos.x, aCurrentVelocity.width, aDestination.x);
InitTimingFunction(mTimingFunctionY, mStartPos.y, aCurrentVelocity.height, aDestination.y);
}
nscoord
nsGfxScrollFrameInner::AsyncScroll::VelocityComponent(double aTimeProgress,
nsSMILKeySpline& aTimingFunction,
nscoord aStart,
nscoord aDestination)
{
// scrolling always works in units of whole pixels. So compute velocities
// in pixels and then scale them up. This ensures, for example, that
// a 1-pixel scroll isn't broken into N frames of 1/N pixels each, each
// frame increment being rounded to 0 whole pixels.
aCurPos = NSAppUnitsToIntPixels(aCurPos, aP2A);
aDstPos = NSAppUnitsToIntPixels(aDstPos, aP2A);
double dt, dxy;
aTimingFunction.GetSplineDerivativeValues(aTimeProgress, dt, dxy);
if (dt == 0)
return dxy >= 0 ? nscoord_MAX : nscoord_MIN;
PRInt32 i;
PRInt32 direction = (aCurPos < aDstPos ? 1 : -1);
PRInt32 absDelta = (aDstPos - aCurPos)*direction;
PRInt32 baseVelocity = absDelta/SMOOTH_SCROLL_FRAMES;
const TimeDuration oneSecond = TimeDuration::FromSeconds(1);
double slope = dxy / dt;
return (slope * (aDestination - aStart) / (mDuration / oneSecond));
}
for (i = 0; i < SMOOTH_SCROLL_FRAMES; i++) {
aVelocities[i*2] = baseVelocity;
void
nsGfxScrollFrameInner::AsyncScroll::InitTimingFunction(nsSMILKeySpline& aTimingFunction,
nscoord aCurrentPos,
nscoord aCurrentVelocity,
nscoord aDestination)
{
if (aDestination == aCurrentPos || kCurrentVelocityWeighting == 0) {
aTimingFunction.Init(0, 0, 1 - kStopDecelerationWeighting, 1);
return;
}
nscoord total = baseVelocity*SMOOTH_SCROLL_FRAMES;
for (i = 0; i < SMOOTH_SCROLL_FRAMES; i++) {
if (total < absDelta) {
aVelocities[i*2]++;
total++;
}
}
NS_ASSERTION(total == absDelta, "Invalid velocity sum");
PRInt32 scale = NSIntPixelsToAppUnits(direction, aP2A);
for (i = 0; i < SMOOTH_SCROLL_FRAMES; i++) {
aVelocities[i*2] *= scale;
}
const TimeDuration oneSecond = TimeDuration::FromSeconds(1);
double slope = aCurrentVelocity * (mDuration / oneSecond) / (aDestination - aCurrentPos);
double normalization = sqrt(1.0 + slope * slope);
double dt = 1.0 / normalization * kCurrentVelocityWeighting;
double dxy = slope / normalization * kCurrentVelocityWeighting;
aTimingFunction.Init(dt, dxy, 1 - kStopDecelerationWeighting, 1);
}
static PRBool
@ -1456,17 +1523,9 @@ nsGfxScrollFrameInner::AsyncScrollCallback(nsITimer *aTimer, void* anInstance)
return;
if (self->mAsyncScroll->mIsSmoothScroll) {
// XXX this is crappy, the scroll position needs to be based on the
// current time
NS_ASSERTION(self->mAsyncScroll->mFrameIndex < SMOOTH_SCROLL_FRAMES,
"Past last frame?");
nscoord* velocities =
&self->mAsyncScroll->mVelocities[self->mAsyncScroll->mFrameIndex*2];
nsPoint destination =
self->GetScrollPosition() + nsPoint(velocities[0], velocities[1]);
self->mAsyncScroll->mFrameIndex++;
if (self->mAsyncScroll->mFrameIndex >= SMOOTH_SCROLL_FRAMES) {
TimeStamp now = TimeStamp::Now();
nsPoint destination = self->mAsyncScroll->PositionAt(now);
if (self->mAsyncScroll->IsFinished(now)) {
delete self->mAsyncScroll;
self->mAsyncScroll = nsnull;
}
@ -1499,15 +1558,16 @@ nsGfxScrollFrameInner::ScrollTo(nsPoint aScrollPosition,
return;
}
PRInt32 currentVelocityX = 0;
PRInt32 currentVelocityY = 0;
TimeStamp now = TimeStamp::Now();
nsPoint currentPosition = GetScrollPosition();
nsSize currentVelocity(0, 0);
PRBool isSmoothScroll = (aMode == nsIScrollableFrame::SMOOTH) &&
IsSmoothScrollingEnabled();
if (mAsyncScroll) {
if (mAsyncScroll->mIsSmoothScroll) {
currentVelocityX = mAsyncScroll->mVelocities[mAsyncScroll->mFrameIndex*2];
currentVelocityY = mAsyncScroll->mVelocities[mAsyncScroll->mFrameIndex*2 + 1];
currentPosition = mAsyncScroll->PositionAt(now);
currentVelocity = mAsyncScroll->VelocityAt(now);
}
} else {
mAsyncScroll = new AsyncScroll;
@ -1525,26 +1585,19 @@ nsGfxScrollFrameInner::ScrollTo(nsPoint aScrollPosition,
}
if (isSmoothScroll) {
mAsyncScroll->mScrollTimer->InitWithFuncCallback(
AsyncScrollCallback, this, SMOOTH_SCROLL_MSECS_PER_FRAME,
nsITimer::TYPE_REPEATING_PRECISE);
AsyncScrollCallback, this, 1000 / 60,
nsITimer::TYPE_REPEATING_SLACK);
} else {
mAsyncScroll->mScrollTimer->InitWithFuncCallback(
AsyncScrollCallback, this, 0, nsITimer::TYPE_ONE_SHOT);
}
}
mAsyncScroll->mFrameIndex = 0;
mAsyncScroll->mIsSmoothScroll = isSmoothScroll;
if (isSmoothScroll) {
PRInt32 p2a = mOuter->PresContext()->AppUnitsPerDevPixel();
// compute velocity vectors
nsPoint currentPos = GetScrollPosition();
ComputeVelocities(currentVelocityX, currentPos.x, mDestination.x,
mAsyncScroll->mVelocities, p2a);
ComputeVelocities(currentVelocityY, currentPos.y, mDestination.y,
mAsyncScroll->mVelocities + 1, p2a);
mAsyncScroll->InitSmoothScroll(now, currentPosition, currentVelocity,
aScrollPosition);
}
}

View File

@ -273,6 +273,9 @@ include ../../content/test/reftest/xml-stylesheet/reftest.list
# xul-document-load/
include xul-document-load/reftest.list
# xul/
include xul/reftest.list
# xul grid
include ../xul/base/src/grid/reftests/reftest.list

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menuitem id="m1" label="Menu1" key="keytwo"/>
<menuitem id="m2" label="Menu2"/>
<menuitem id="m3" label="Menu3" key="keythree"/>
<menuitem id="m4" label="Menu4" acceltext="Text"/>
<menuitem id="m5" label="Menu5" acceltext="Text"/>
<menuitem id="m6" label="Menu6" acceltext="Text"/>
<menuitem id="m7" label="Menu7" key="keythree"/>
<menuitem id="m8" label="Menu8"/>
<menuitem id="m9" label="Menu9"/>
<keyset>
<key id="keytwo" key="Y" modifiers="control"/>
<key id="keythree" key="X" modifiers="accel"/>
</keyset>
</window>

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<window class="reftest-wait" onload="changeKeys()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menuitem id="m1" label="Menu1" key="keyone"/>
<menuitem id="m2" label="Menu2" key="keytwo"/>
<menuitem id="m3" label="Menu3"/>
<menuitem id="m4" label="Menu4"/>
<menuitem id="m5" label="Menu5"/>
<menuitem id="m6" label="Menu6" key="keythree" acceltext="Text"/>
<menuitem id="m7" label="Menu7" key="keythree" acceltext="Text"/>
<menuitem id="m8" label="Menu8" key="keythree" acceltext="Text"/>
<menuitem id="m9" label="Menu9" key="keytwo"/>
<script>
function changeKeys()
{
document.getElementById("m1").setAttribute("key", "keytwo");
document.getElementById("m2").removeAttribute("key");
document.getElementById("m3").setAttribute("key", "keythree");
document.getElementById("m4").setAttribute("key", "keyone");
document.getElementById("m4").setAttribute("acceltext", "Text");
document.getElementById("m5").setAttribute("acceltext", "Text");
document.getElementById("m5").setAttribute("key", "keytwo");
document.getElementById("m6").removeAttribute("key");
document.getElementById("m7").removeAttribute("acceltext");
document.getElementById("m8").removeAttribute("key");
document.getElementById("m8").removeAttribute("acceltext");
document.getElementById("m9").removeAttribute("key");
document.documentElement.className='';
}
</script>
<keyset>
<key id="keyone" key="Z" modifiers="control"/>
<key id="keytwo" key="Y" modifiers="control"/>
<key id="keythree" key="X" modifiers="accel"/>
</keyset>
</window>

View File

@ -0,0 +1 @@
== menuitem-key.xul menuitem-key-ref.xul

View File

@ -2316,9 +2316,9 @@ nsTableFrame::RemoveFrame(nsIAtom* aListName,
ResetRowIndices(nsFrameList::Slice(mFrames, nsnull, nsnull));
nsRect damageArea;
cellMap->RebuildConsideringCells(nsnull, nsnull, 0, 0, PR_FALSE, damageArea);
}
MatchCellMapToColCache(cellMap);
MatchCellMapToColCache(cellMap);
}
}
// for now, just bail and recalc all of the collapsing borders
// as the cellmap changes we need to recalc

View File

@ -170,10 +170,11 @@ public:
} else if (mAttr == nsGkAtoms::acceltext) {
// someone reset the accelText attribute,
// so clear the bit that says *we* set it
frame->AddStateBits(NS_STATE_ACCELTEXT_IS_DERIVED);
frame->BuildAcceleratorText();
} else if (mAttr == nsGkAtoms::key) {
frame->BuildAcceleratorText();
frame->RemoveStateBits(NS_STATE_ACCELTEXT_IS_DERIVED);
frame->BuildAcceleratorText(PR_TRUE);
}
else if (mAttr == nsGkAtoms::key) {
frame->BuildAcceleratorText(PR_TRUE);
} else if (mAttr == nsGkAtoms::type || mAttr == nsGkAtoms::name) {
frame->UpdateMenuType(frame->PresContext());
}
@ -224,6 +225,7 @@ nsMenuFrame::nsMenuFrame(nsIPresShell* aShell, nsStyleContext* aContext):
nsBoxFrame(aShell, aContext),
mIsMenu(PR_FALSE),
mChecked(PR_FALSE),
mIgnoreAccelTextChange(PR_FALSE),
mType(eMenuType_Normal),
mMenuParent(nsnull),
mPopupFrame(nsnull),
@ -334,7 +336,7 @@ nsMenuFrame::Init(nsIContent* aContent,
gModifierSeparator = new nsString(modifierSeparator);
}
BuildAcceleratorText();
BuildAcceleratorText(PR_FALSE);
nsIReflowCallback* cb = new nsASyncMenuInitialization(this);
NS_ENSURE_TRUE(cb, NS_ERROR_OUT_OF_MEMORY);
PresContext()->PresShell()->PostReflowCallback(cb);
@ -699,6 +701,11 @@ nsMenuFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
if (aAttribute == nsGkAtoms::acceltext && mIgnoreAccelTextChange) {
// Reset the flag so that only one change is ignored.
mIgnoreAccelTextChange = PR_FALSE;
return NS_OK;
}
if (aAttribute == nsGkAtoms::checked ||
aAttribute == nsGkAtoms::acceltext ||
@ -1015,7 +1022,7 @@ nsMenuFrame::UpdateMenuSpecialState(nsPresContext* aPresContext)
}
void
nsMenuFrame::BuildAcceleratorText()
nsMenuFrame::BuildAcceleratorText(PRBool aNotify)
{
nsAutoString accelText;
@ -1031,7 +1038,7 @@ nsMenuFrame::BuildAcceleratorText()
// If anything below fails, just leave the accelerator text blank.
nsWeakFrame weakFrame(this);
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, PR_FALSE);
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, aNotify);
ENSURE_TRUE(weakFrame.IsAlive());
// See if we have a key node and use that instead.
@ -1156,8 +1163,12 @@ nsMenuFrame::BuildAcceleratorText()
nsMemory::Free(str);
accelText += accelString;
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accelText, PR_FALSE);
mIgnoreAccelTextChange = PR_TRUE;
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accelText, aNotify);
ENSURE_TRUE(weakFrame.IsAlive());
mIgnoreAccelTextChange = PR_FALSE;
}
void

View File

@ -238,7 +238,7 @@ protected:
void UpdateMenuSpecialState(nsPresContext* aPresContext);
// Examines the key node and builds the accelerator.
void BuildAcceleratorText();
void BuildAcceleratorText(PRBool aNotify);
// Called to execute our command handler. This method can destroy the frame.
void Execute(nsGUIEvent *aEvent);
@ -265,6 +265,7 @@ protected:
PRPackedBool mIsMenu; // Whether or not we can even have children or not.
PRPackedBool mChecked; // are we checked?
PRPackedBool mIgnoreAccelTextChange; // temporarily set while determining the accelerator key
nsMenuType mType;
nsMenuParent* mMenuParent; // Our parent menu.

View File

@ -1413,8 +1413,12 @@ PRBool nsMenuPopupFrame::ConsumeOutsideClicks()
#if defined(XP_WIN) || defined(XP_OS2)
// Don't consume outside clicks for menus in Windows
if (ni->Equals(nsGkAtoms::menu, kNameSpaceID_XUL) ||
(ni->Equals(nsGkAtoms::popupset, kNameSpaceID_XUL)))
ni->Equals(nsGkAtoms::popupset, kNameSpaceID_XUL) ||
(ni->Equals(nsGkAtoms::button, kNameSpaceID_XUL) &&
parentContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::menu, eCaseMatters))) {
return PR_FALSE;
}
#endif
if (ni->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL)) {
// Don't consume outside clicks for autocomplete widget

View File

@ -1 +1 @@
NSPR_4_8_7_RTM
NSPR_4_8_8_BETA2

View File

@ -64,10 +64,10 @@
#
# ------------------------------------------------------------------
FROMTOP=/share/builds/components/nspr20/v4.8.7
TOTOP=./v4.8.7
NSPRDIR=nspr-4.8.7
SOURCETAG=NSPR_4_8_7_RTM
FROMTOP=/share/builds/components/nspr20/v4.8.8
TOTOP=./v4.8.8
NSPRDIR=nspr-4.8.8
SOURCETAG=NSPR_4_8_8_RTM
#
# enumerate Unix object directories on /s/b/c

View File

@ -42,4 +42,3 @@
*/
#error "Do not include this header file."

16
nsprpub/configure vendored
View File

@ -67,7 +67,7 @@ ac_help="$ac_help
ac_help="$ac_help
--disable-os2-high-mem Disable high-memory support on OS/2"
ac_help="$ac_help
--enable-thumb2 Enable Thumb2 instruction set"
--enable-thumb2 Enable Thumb-2 instruction set"
ac_help="$ac_help
--with-symbian-sdk=SYMBIAN_SDK_DIR
The path to the Symbian SDK"
@ -713,7 +713,7 @@ test "$host_alias" != "$target_alias" &&
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=8
MOD_PATCH_VERSION=7
MOD_PATCH_VERSION=8
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
@ -3101,8 +3101,8 @@ if test -n "$MOZ_THUMB2"; then
case "$target_cpu" in
arm*)
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
CFLAGS="$CFLAGS -march=armv7-a -mthumb"
CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb"
ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
else
{ echo "configure: error: --enable-thumb2 is not supported for non-GNU toolchains" 1>&2; exit 1; }
@ -3113,11 +3113,11 @@ if test -n "$MOZ_THUMB2"; then
;;
esac
else
case "$target_cpu" in
arm*)
case "$target" in
arm-android-eabi)
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork"
CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork"
ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
fi
;;

View File

@ -50,7 +50,7 @@ dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=8
MOD_PATCH_VERSION=7
MOD_PATCH_VERSION=8
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
@ -916,7 +916,7 @@ dnl ========================================================
dnl = Enable building the Thumb2 instruction set
dnl ========================================================
AC_ARG_ENABLE(thumb2,
[ --enable-thumb2 Enable Thumb2 instruction set],
[ --enable-thumb2 Enable Thumb-2 instruction set],
[ if test "$enableval" = "yes"; then
MOZ_THUMB2=1,
fi ])
@ -925,8 +925,8 @@ if test -n "$MOZ_THUMB2"; then
case "$target_cpu" in
arm*)
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
CFLAGS="$CFLAGS -march=armv7-a -mthumb"
CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb"
ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
else
AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
@ -937,11 +937,11 @@ if test -n "$MOZ_THUMB2"; then
;;
esac
else
case "$target_cpu" in
arm*)
case "$target" in
arm-android-eabi)
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork"
CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork"
ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
fi
;;

View File

@ -314,8 +314,8 @@ PR_IMPLEMENT(void) PL_ArenaRelease(PLArenaPool *pool, char *mark)
{
PLArena *a;
for (a = pool->first.next; a; a = a->next) {
if (PR_UPTRDIFF(mark, a->base) < PR_UPTRDIFF(a->avail, a->base)) {
for (a = &pool->first; a; a = a->next) {
if (PR_UPTRDIFF(mark, a->base) <= PR_UPTRDIFF(a->avail, a->base)) {
a->avail = (PRUword)PL_ARENA_ALIGN(pool, mark);
FreeArenaList(pool, a, PR_FALSE);
return;

View File

@ -110,6 +110,30 @@ extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _PR_HAVE_INET_NTOP
#else
#define _PR_INET6_PROBE
/* for HP-UX 11.11 without IPv6 */
#ifndef AF_INET6
#define AF_INET6 22
#define AI_CANONNAME 2
#define AI_NUMERICHOST 4
#define AI_NUMERICSERV 8
#define AI_V4MAPPED 0x00000010
#define AI_ADDRCONFIG 0x00000040
#define AI_ALL 0x00000020
#define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
#define NI_NUMERICHOST 2
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for host */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#endif /* for HP-UX 11.11 without IPv6 */
#define _PR_HAVE_MD_SOCKADDR_IN6
/* isomorphic to struct in6_addr on HP-UX B.11.23 */
struct _md_in6_addr {

View File

@ -797,6 +797,51 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__m32r__)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 4
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 4
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#else
#error "Unknown CPU architecture"

View File

@ -83,6 +83,8 @@
#define _PR_SI_ARCHITECTURE "sh"
#elif defined(__avr32__)
#define _PR_SI_ARCHITECTURE "avr32"
#elif defined(__m32r__)
#define _PR_SI_ARCHITECTURE "m32r"
#else
#error "Unknown CPU architecture"
#endif
@ -216,7 +218,18 @@ extern PRInt32 _PR_ppc_AtomicSet(PRInt32 *val, PRInt32 newval);
})
#endif
#if defined(__arm__) && defined(_PR_ARM_KUSER)
#if defined(__arm__)
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
/* Use GCC built-in functions */
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
#elif defined(_PR_ARM_KUSER)
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
@ -259,16 +272,18 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *ptr, PRInt32 nv)
return ov;
}
#endif
#endif /* __arm__ */
#define USE_SETJMP
#if defined(__GLIBC__) && __GLIBC__ >= 2
#if (defined(__GLIBC__) && __GLIBC__ >= 2) || defined(ANDROID)
#define _PR_POLL_AVAILABLE
#endif
#undef _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#if defined(__alpha) || defined(__ia64__)
#define _PR_HAVE_LARGE_OFF_T
#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) \
|| defined(ANDROID)
#define _PR_HAVE_OFF64_T
#else
#define _PR_NO_LARGE_FILES
@ -459,6 +474,18 @@ extern void _MD_CleanupBeforeExit(void);
#error "SH/Linux pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#elif defined(__m32r__)
/* Linux/M32R */
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__regs[JB_SP]
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__regs[JB_FP] = (val))
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__regs[JB_FP])
#define _MD_SP_TYPE __ptr_t
#else
#error "Linux/M32R pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#else
#error "Unknown CPU architecture"

View File

@ -140,6 +140,8 @@ long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value);
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
defined(__ia64__) || defined(__x86_64__) || \
(defined(__powerpc__) && !defined(__powerpc64__)) || \
(defined(__arm__) && \
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
defined(__alpha))))
/*

View File

@ -63,11 +63,11 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
#define PR_VERSION "4.8.7"
#define PR_VERSION "4.8.8 Beta"
#define PR_VMAJOR 4
#define PR_VMINOR 8
#define PR_VPATCH 7
#define PR_BETA PR_FALSE
#define PR_VPATCH 8
#define PR_BETA PR_TRUE
/*
** PRVersionCheck

View File

@ -1,46 +1,46 @@
/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/
/ ***** BEGIN LICENSE BLOCK *****
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the Netscape Portable Runtime (NSPR).
/
/ The Initial Developer of the Original Code is
/ Netscape Communications Corporation.
/ Portions created by the Initial Developer are Copyright (C) 2000
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
/ ***** END LICENSE BLOCK *****
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
//
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// The Original Code is the Netscape Portable Runtime (NSPR).
//
// The Initial Developer of the Original Code is
// Netscape Communications Corporation.
// Portions created by the Initial Developer are Copyright (C) 2000
// the Initial Developer. All Rights Reserved.
//
// Contributor(s):
//
// Alternatively, the contents of this file may be used under the terms of
// either the GNU General Public License Version 2 or later (the "GPL"), or
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
// in which case the provisions of the GPL or the LGPL are applicable instead
// of those above. If you wish to allow use of your version of this file only
// under the terms of either the GPL or the LGPL, and not to allow others to
// use your version of this file under the terms of the MPL, indicate your
// decision by deleting the provisions above and replace them with the notice
// and other provisions required by the GPL or the LGPL. If you do not delete
// the provisions above, a recipient may use your version of this file under
// the terms of any one of the MPL, the GPL or the LGPL.
//
// ***** END LICENSE BLOCK *****
/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
/
/ Atomically increment the integer pointed to by 'val' and return
/ the result of the increment.
/
// PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
//
// Atomically increment the integer pointed to by 'val' and return
// the result of the increment.
//
.text
.globl _PR_x86_AtomicIncrement
.align 4
@ -52,11 +52,11 @@ _PR_x86_AtomicIncrement:
incl %eax
ret
/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
/
/ Atomically decrement the integer pointed to by 'val' and return
/ the result of the decrement.
/
// PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
//
// Atomically decrement the integer pointed to by 'val' and return
// the result of the decrement.
//
.text
.globl _PR_x86_AtomicDecrement
.align 4
@ -68,25 +68,25 @@ _PR_x86_AtomicDecrement:
decl %eax
ret
/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
/
/ Atomically set the integer pointed to by 'val' to the new
/ value 'newval' and return the old value.
/
/ An alternative implementation:
/ .text
/ .globl _PR_x86_AtomicSet
/ .align 4
/_PR_x86_AtomicSet:
/ movl 4(%esp), %ecx
/ movl 8(%esp), %edx
/ movl (%ecx), %eax
/retry:
/ lock
/ cmpxchgl %edx, (%ecx)
/ jne retry
/ ret
/
// PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
//
// Atomically set the integer pointed to by 'val' to the new
// value 'newval' and return the old value.
//
// An alternative implementation:
// .text
// .globl _PR_x86_AtomicSet
// .align 4
//_PR_x86_AtomicSet:
// movl 4(%esp), %ecx
// movl 8(%esp), %edx
// movl (%ecx), %eax
//retry:
// lock
// cmpxchgl %edx, (%ecx)
// jne retry
// ret
//
.text
.globl _PR_x86_AtomicSet
.align 4
@ -96,11 +96,11 @@ _PR_x86_AtomicSet:
xchgl %eax, (%ecx)
ret
/ PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
/
/ Atomically add 'val' to the integer pointed to by 'ptr'
/ and return the result of the addition.
/
// PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
//
// Atomically add 'val' to the integer pointed to by 'ptr'
// and return the result of the addition.
//
.text
.globl _PR_x86_AtomicAdd
.align 4
@ -113,5 +113,5 @@ _PR_x86_AtomicAdd:
addl %edx, %eax
ret
/ Magic indicating no need for an executable stack
// Magic indicating no need for an executable stack
.section .note.GNU-stack, "", @progbits ; .previous

View File

@ -1,46 +1,46 @@
/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/
/ ***** BEGIN LICENSE BLOCK *****
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the Netscape Portable Runtime (NSPR).
/
/ The Initial Developer of the Original Code is
/ Netscape Communications Corporation.
/ Portions created by the Initial Developer are Copyright (C) 2004
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
/ ***** END LICENSE BLOCK *****
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
//
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// The Original Code is the Netscape Portable Runtime (NSPR).
//
// The Initial Developer of the Original Code is
// Netscape Communications Corporation.
// Portions created by the Initial Developer are Copyright (C) 2004
// the Initial Developer. All Rights Reserved.
//
// Contributor(s):
//
// Alternatively, the contents of this file may be used under the terms of
// either the GNU General Public License Version 2 or later (the "GPL"), or
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
// in which case the provisions of the GPL or the LGPL are applicable instead
// of those above. If you wish to allow use of your version of this file only
// under the terms of either the GPL or the LGPL, and not to allow others to
// use your version of this file under the terms of the MPL, indicate your
// decision by deleting the provisions above and replace them with the notice
// and other provisions required by the GPL or the LGPL. If you do not delete
// the provisions above, a recipient may use your version of this file under
// the terms of any one of the MPL, the GPL or the LGPL.
//
// ***** END LICENSE BLOCK *****
/ PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
/
/ Atomically increment the integer pointed to by 'val' and return
/ the result of the increment.
/
// PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
//
// Atomically increment the integer pointed to by 'val' and return
// the result of the increment.
//
.text
.globl _PR_x86_64_AtomicIncrement
.type _PR_x86_64_AtomicIncrement, @function
@ -53,11 +53,11 @@ _PR_x86_64_AtomicIncrement:
ret
.size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement
/ PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
/
/ Atomically decrement the integer pointed to by 'val' and return
/ the result of the decrement.
/
// PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
//
// Atomically decrement the integer pointed to by 'val' and return
// the result of the decrement.
//
.text
.globl _PR_x86_64_AtomicDecrement
.type _PR_x86_64_AtomicDecrement, @function
@ -70,11 +70,11 @@ _PR_x86_64_AtomicDecrement:
ret
.size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement
/ PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
/
/ Atomically set the integer pointed to by 'val' to the new
/ value 'newval' and return the old value.
/
// PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
//
// Atomically set the integer pointed to by 'val' to the new
// value 'newval' and return the old value.
//
.text
.globl _PR_x86_64_AtomicSet
.type _PR_x86_64_AtomicSet, @function
@ -85,11 +85,11 @@ _PR_x86_64_AtomicSet:
ret
.size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet
/ PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
/
/ Atomically add 'val' to the integer pointed to by 'ptr'
/ and return the result of the addition.
/
// PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
//
// Atomically add 'val' to the integer pointed to by 'ptr'
// and return the result of the addition.
//
.text
.globl _PR_x86_64_AtomicAdd
.type _PR_x86_64_AtomicAdd, @function
@ -102,5 +102,5 @@ _PR_x86_64_AtomicAdd:
ret
.size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd
/ Magic indicating no need for an executable stack
// Magic indicating no need for an executable stack
.section .note.GNU-stack, "", @progbits ; .previous

View File

@ -1,40 +1,40 @@
/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/
/ ***** BEGIN LICENSE BLOCK *****
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the Netscape Portable Runtime (NSPR).
/
/ The Initial Developer of the Original Code is
/ Netscape Communications Corporation.
/ Portions created by the Initial Developer are Copyright (C) 1998-2000
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
/ ***** END LICENSE BLOCK *****
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
//
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// The Original Code is the Netscape Portable Runtime (NSPR).
//
// The Initial Developer of the Original Code is
// Netscape Communications Corporation.
// Portions created by the Initial Developer are Copyright (C) 1998-2000
// the Initial Developer. All Rights Reserved.
//
// Contributor(s):
//
// Alternatively, the contents of this file may be used under the terms of
// either the GNU General Public License Version 2 or later (the "GPL"), or
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
// in which case the provisions of the GPL or the LGPL are applicable instead
// of those above. If you wish to allow use of your version of this file only
// under the terms of either the GPL or the LGPL, and not to allow others to
// use your version of this file under the terms of the MPL, indicate your
// decision by deleting the provisions above and replace them with the notice
// and other provisions required by the GPL or the LGPL. If you do not delete
// the provisions above, a recipient may use your version of this file under
// the terms of any one of the MPL, the GPL or the LGPL.
//
// ***** END LICENSE BLOCK *****
.text
@ -60,31 +60,31 @@ _MD_FlushRegisterWindows:
ret
/
/ sol_getsp()
/
/ Return the current sp (for debugging)
/
//
// sol_getsp()
//
// Return the current sp (for debugging)
//
.globl sol_getsp
sol_getsp:
movl %esp, %eax
ret
/
/ sol_curthread()
/
/ Return a unique identifier for the currently active thread.
/
//
// sol_curthread()
//
// Return a unique identifier for the currently active thread.
//
.globl sol_curthread
sol_curthread:
movl %ecx, %eax
ret
/ PRInt32 _MD_AtomicIncrement(PRInt32 *val)
/
/ Atomically increment the integer pointed to by 'val' and return
/ the result of the increment.
/
// PRInt32 _MD_AtomicIncrement(PRInt32 *val)
//
// Atomically increment the integer pointed to by 'val' and return
// the result of the increment.
//
.text
.globl _MD_AtomicIncrement
.align 4
@ -96,11 +96,11 @@ _MD_AtomicIncrement:
incl %eax
ret
/ PRInt32 _MD_AtomicDecrement(PRInt32 *val)
/
/ Atomically decrement the integer pointed to by 'val' and return
/ the result of the decrement.
/
// PRInt32 _MD_AtomicDecrement(PRInt32 *val)
//
// Atomically decrement the integer pointed to by 'val' and return
// the result of the decrement.
//
.text
.globl _MD_AtomicDecrement
.align 4
@ -112,25 +112,25 @@ _MD_AtomicDecrement:
decl %eax
ret
/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
/
/ Atomically set the integer pointed to by 'val' to the new
/ value 'newval' and return the old value.
/
/ An alternative implementation:
/ .text
/ .globl _MD_AtomicSet
/ .align 4
/_MD_AtomicSet:
/ movl 4(%esp), %ecx
/ movl 8(%esp), %edx
/ movl (%ecx), %eax
/retry:
/ lock
/ cmpxchgl %edx, (%ecx)
/ jne retry
/ ret
/
// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
//
// Atomically set the integer pointed to by 'val' to the new
// value 'newval' and return the old value.
//
// An alternative implementation:
// .text
// .globl _MD_AtomicSet
// .align 4
//_MD_AtomicSet:
// movl 4(%esp), %ecx
// movl 8(%esp), %edx
// movl (%ecx), %eax
//retry:
// lock
// cmpxchgl %edx, (%ecx)
// jne retry
// ret
//
.text
.globl _MD_AtomicSet
.align 4
@ -140,11 +140,11 @@ _MD_AtomicSet:
xchgl %eax, (%ecx)
ret
/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
/
/ Atomically add 'val' to the integer pointed to by 'ptr'
/ and return the result of the addition.
/
// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
//
// Atomically add 'val' to the integer pointed to by 'ptr'
// and return the result of the addition.
//
.text
.globl _MD_AtomicAdd
.align 4

View File

@ -1,46 +1,46 @@
/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/
/ ***** BEGIN LICENSE BLOCK *****
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the Netscape Portable Runtime (NSPR).
/
/ The Initial Developer of the Original Code is
/ Netscape Communications Corporation.
/ Portions created by the Initial Developer are Copyright (C) 2004
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
/ ***** END LICENSE BLOCK *****
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
//
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// The Original Code is the Netscape Portable Runtime (NSPR).
//
// The Initial Developer of the Original Code is
// Netscape Communications Corporation.
// Portions created by the Initial Developer are Copyright (C) 2004
// the Initial Developer. All Rights Reserved.
//
// Contributor(s):
//
// Alternatively, the contents of this file may be used under the terms of
// either the GNU General Public License Version 2 or later (the "GPL"), or
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
// in which case the provisions of the GPL or the LGPL are applicable instead
// of those above. If you wish to allow use of your version of this file only
// under the terms of either the GPL or the LGPL, and not to allow others to
// use your version of this file under the terms of the MPL, indicate your
// decision by deleting the provisions above and replace them with the notice
// and other provisions required by the GPL or the LGPL. If you do not delete
// the provisions above, a recipient may use your version of this file under
// the terms of any one of the MPL, the GPL or the LGPL.
//
// ***** END LICENSE BLOCK *****
/ PRInt32 _MD_AtomicIncrement(PRInt32 *val)
/
/ Atomically increment the integer pointed to by 'val' and return
/ the result of the increment.
/
// PRInt32 _MD_AtomicIncrement(PRInt32 *val)
//
// Atomically increment the integer pointed to by 'val' and return
// the result of the increment.
//
.text
.globl _MD_AtomicIncrement
.align 4
@ -51,11 +51,11 @@ _MD_AtomicIncrement:
incl %eax
ret
/ PRInt32 _MD_AtomicDecrement(PRInt32 *val)
/
/ Atomically decrement the integer pointed to by 'val' and return
/ the result of the decrement.
/
// PRInt32 _MD_AtomicDecrement(PRInt32 *val)
//
// Atomically decrement the integer pointed to by 'val' and return
// the result of the decrement.
//
.text
.globl _MD_AtomicDecrement
.align 4
@ -66,11 +66,11 @@ _MD_AtomicDecrement:
decl %eax
ret
/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
/
/ Atomically set the integer pointed to by 'val' to the new
/ value 'newval' and return the old value.
/
// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
//
// Atomically set the integer pointed to by 'val' to the new
// value 'newval' and return the old value.
//
.text
.globl _MD_AtomicSet
.align 4
@ -79,11 +79,11 @@ _MD_AtomicSet:
xchgl %eax, (%rdi)
ret
/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
/
/ Atomically add 'val' to the integer pointed to by 'ptr'
/ and return the result of the addition.
/
// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
//
// Atomically add 'val' to the integer pointed to by 'ptr'
// and return the result of the addition.
//
.text
.globl _MD_AtomicAdd
.align 4

View File

@ -2256,6 +2256,10 @@ PRInt32 _MD_open(const char *name, PRIntn flags, PRIntn mode)
PR_Lock(_pr_rename_lock);
}
#if defined(ANDROID)
osflags |= O_LARGEFILE;
#endif
rv = _md_iovector._open64(name, osflags, mode);
if (rv < 0) {
@ -2742,6 +2746,23 @@ static void* _MD_Unix_mmap64(
} /* _MD_Unix_mmap64 */
#endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */
/* Android doesn't have mmap64. */
#if defined(ANDROID)
extern void *__mmap2(void *, size_t, int, int, int, size_t);
#define ANDROID_PAGE_SIZE 4096
static void *
mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset)
{
if (offset & (ANDROID_PAGE_SIZE - 1)) {
errno = EINVAL;
return MAP_FAILED;
}
return __mmap2(addr, len, prot, flags, fd, offset / ANDROID_PAGE_SIZE);
}
#endif
#if defined(OSF1) && defined(__GNUC__)
/*
@ -2796,7 +2817,11 @@ static void _PR_InitIOV(void)
_md_iovector._stat64 = stat;
_md_iovector._lseek64 = _MD_Unix_lseek64;
#elif defined(_PR_HAVE_OFF64_T)
#if defined(IRIX5_3)
#if defined(IRIX5_3) || defined(ANDROID)
/*
* Android doesn't have open64. We pass the O_LARGEFILE flag to open
* in _MD_open.
*/
_md_iovector._open64 = open;
#else
_md_iovector._open64 = open64;

View File

@ -70,7 +70,8 @@
* #define IBM for IBM mainframe-style floating-point arithmetic.
* #define VAX for VAX-style floating-point arithmetic (D_floating).
* #define No_leftright to omit left-right logic in fast floating-point
* computation of dtoa.
* computation of dtoa. This will cause dtoa modes 4 and 5 to be
* treated the same as modes 2 and 3 for some inputs.
* #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
* and strtod and dtoa should round accordingly. Unless Trust_FLT_ROUNDS
* is also #defined, fegetround() will be queried for the rounding mode.
@ -84,7 +85,12 @@
* #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
* that use extended-precision instructions to compute rounded
* products and quotients) with IBM.
* #define ROUND_BIASED for IEEE-format with biased rounding.
* #define ROUND_BIASED for IEEE-format with biased rounding and arithmetic
* that rounds toward +Infinity.
* #define ROUND_BIASED_without_Round_Up for IEEE-format with biased
* rounding when the underlying floating-point arithmetic uses
* unbiased rounding. This prevent using ordinary floating-point
* arithmetic when the result could be computed with one rounding error.
* #define Inaccurate_Divide for IEEE-format with correctly rounded
* products but inaccurate quotients, e.g., for Intel i860.
* #define NO_LONG_LONG on machines that do not have a "long long"
@ -453,6 +459,11 @@ extern int strtod_diglim;
#ifndef IEEE_Arith
#define ROUND_BIASED
#else
#ifdef ROUND_BIASED_without_Round_Up
#undef ROUND_BIASED
#define ROUND_BIASED
#endif
#endif
#ifdef RND_PRODQUOT
@ -2576,6 +2587,8 @@ strtod
for(; c == '0'; c = *++s)
nz++;
if (c > '0' && c <= '9') {
bc.dp0 = s0 - s;
bc.dp1 = bc.dp0 + bc.dplen;
s0 = s;
nf += nz;
nz = 0;
@ -2703,6 +2716,7 @@ strtod
) {
if (!e)
goto ret;
#ifndef ROUND_BIASED_without_Round_Up
if (e > 0) {
if (e <= Ten_pmax) {
#ifdef VAX
@ -2763,6 +2777,7 @@ strtod
goto ret;
}
#endif
#endif /* ROUND_BIASED_without_Round_Up */
}
e1 += nd - k;
@ -3678,6 +3693,9 @@ dtoa
U d2, eps, u;
double ds;
char *s, *s0;
#ifdef IEEE_Arith
U eps1;
#endif
#ifdef SET_INEXACT
int inexact, oldinexact;
#endif
@ -3941,14 +3959,26 @@ dtoa
* generating digits needed.
*/
dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
#ifdef IEEE_Arith
if (k0 < 0 && j1 >= 307) {
eps1.d = 1.01e256; /* 1.01 allows roundoff in the next few lines */
word0(&eps1) -= Exp_msk1 * (Bias+P-1);
dval(&eps1) *= tens[j1 & 0xf];
for(i = 0, j = (j1-256) >> 4; j; j >>= 1, i++)
if (j & 1)
dval(&eps1) *= bigtens[i];
if (eps.d < eps1.d)
eps.d = eps1.d;
}
#endif
for(i = 0;;) {
L = dval(&u);
dval(&u) -= L;
*s++ = '0' + (int)L;
if (dval(&u) < dval(&eps))
goto ret1;
if (1. - dval(&u) < dval(&eps))
goto bump_up;
if (dval(&u) < dval(&eps))
goto ret1;
if (++i >= ilim)
break;
dval(&eps) *= 10.;
@ -4022,7 +4052,12 @@ dtoa
}
#endif
dval(&u) += dval(&u);
if (dval(&u) > ds || (dval(&u) == ds && L & 1)) {
#ifdef ROUND_BIASED
if (dval(&u) >= ds)
#else
if (dval(&u) > ds || (dval(&u) == ds && L & 1))
#endif
{
bump_up:
while(*--s == '9')
if (s == s0) {
@ -4106,15 +4141,6 @@ dtoa
* and for all and pass them and a shift to quorem, so it
* can do shifts and ors to compute the numerator for q.
*/
#ifdef Pack_32
if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
i = 32 - i;
#define iInc 28
#else
if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
i = 16 - i;
#define iInc 12
#endif
i = dshift(S, s2);
b2 += i;
m2 += i;
@ -4207,7 +4233,11 @@ dtoa
if (j1 > 0) {
b = lshift(b, 1);
j1 = cmp(b, S);
#ifdef ROUND_BIASED
if (j1 >= 0 /*)*/
#else
if ((j1 > 0 || (j1 == 0 && dig & 1))
#endif
&& dig++ == '9')
goto round_9_up;
}
@ -4267,7 +4297,12 @@ dtoa
#endif
b = lshift(b, 1);
j = cmp(b, S);
if (j > 0 || (j == 0 && dig & 1)) {
#ifdef ROUND_BIASED
if (j >= 0)
#else
if (j > 0 || (j == 0 && dig & 1))
#endif
{
roundoff:
while(*--s == '9')
if (s == s0) {

View File

@ -284,7 +284,7 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void)
long pageCount = sysconf(_SC_PHYS_PAGES);
bytes = (PRUint64) pageSize * pageCount;
#elif defined(NETBSD)
#elif defined(NETBSD) || defined(OPENBSD)
int mib[2];
int rc;

View File

@ -52,9 +52,9 @@
#include <stdlib.h>
/*
* This release (4.8.7) is backward compatible with the
* This release (4.8.8) is backward compatible with the
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
* 4.8, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, and 4.8.6 releases.
* 4.8, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, 4.8.6 and 4.8.7 releases.
* It, of course, is compatible with itself.
*/
static char *compatible_version[] = {
@ -66,7 +66,7 @@ static char *compatible_version[] = {
"4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4", "4.7.5",
"4.7.6",
"4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5",
"4.8.6", PR_VERSION
"4.8.6", "4.8.7", PR_VERSION
};
/*

View File

@ -131,6 +131,7 @@ CertDumpSPKIAlg=Subject Public Key Algorithm
CertDumpAlgID=Algorithm Identifier
CertDumpParams=Algorithm Parameters
CertDumpRSAEncr=PKCS #1 RSA Encryption
CertDumpRSAPSSSignature=PKCS #1 RSASSA-PSS Signature
CertDumpRSATemplate=Modulus (%S bits):\n%S\nExponent (%S bits):\n%S
CertDumpECTemplate=Key size: %S bits\nBase point order length: %S bits\nPublic value:\n%S
CertDumpIssuerUniqueID=Issuer Unique ID

View File

@ -310,9 +310,6 @@ GetOIDText(SECItem *oid, nsINSSComponent *nssComponent, nsAString &text)
case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
bundlekey = "CertDumpSHA1WithRSA";
break;
case SEC_OID_PKCS1_RSA_ENCRYPTION:
bundlekey = "CertDumpRSAEncr";
break;
case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
bundlekey = "CertDumpSHA256WithRSA";
break;
@ -322,6 +319,12 @@ GetOIDText(SECItem *oid, nsINSSComponent *nssComponent, nsAString &text)
case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:
bundlekey = "CertDumpSHA512WithRSA";
break;
case SEC_OID_PKCS1_RSA_ENCRYPTION:
bundlekey = "CertDumpRSAEncr";
break;
case SEC_OID_PKCS1_RSA_PSS_SIGNATURE:
bundlekey = "CertDumpRSAPSSSignature";
break;
case SEC_OID_NS_CERT_EXT_CERT_TYPE:
bundlekey = "CertDumpCertType";
break;

View File

@ -1485,65 +1485,54 @@ nsNSSCertificateDB::FindCertByEmailAddress(nsISupports *aToken, const char *aEma
/* nsIX509Cert constructX509FromBase64 (in string base64); */
NS_IMETHODIMP
nsNSSCertificateDB::ConstructX509FromBase64(const char * base64, nsIX509Cert **_retval)
nsNSSCertificateDB::ConstructX509FromBase64(const char *base64,
nsIX509Cert **_retval)
{
if (!_retval) {
return NS_ERROR_FAILURE;
NS_ENSURE_ARG_POINTER(_retval);
// sure would be nice to have a smart pointer class for PL_ allocations
// unfortunately, we cannot distinguish out-of-memory from bad-input here
PRUint32 len = PL_strlen(base64);
char *certDER = PL_Base64Decode(base64, len, NULL);
if (!certDER)
return NS_ERROR_ILLEGAL_VALUE;
if (!*certDER) {
PL_strfree(certDER);
return NS_ERROR_ILLEGAL_VALUE;
}
// If we get to this point, we know we had well-formed base64 input;
// therefore the input string cannot have been less than two
// characters long. Compute the unpadded length of the decoded data.
PRUint32 lengthDER = (len * 3) / 4;
if (base64[len-1] == '=') {
lengthDER--;
if (base64[len-2] == '=')
lengthDER--;
}
nsNSSShutDownPreventionLock locker;
PRUint32 len = PL_strlen(base64);
int adjust = 0;
SECItem secitem_cert;
secitem_cert.type = siDERCertBuffer;
secitem_cert.data = (unsigned char*)certDER;
secitem_cert.len = lengthDER;
/* Compute length adjustment */
if (base64[len-1] == '=') {
adjust++;
if (base64[len-2] == '=') adjust++;
}
CERTCertificate *cert =
CERT_NewTempCertificate(CERT_GetDefaultCertDB(), &secitem_cert,
nsnull, PR_FALSE, PR_TRUE);
PL_strfree(certDER);
nsresult rv = NS_OK;
char *certDER = 0;
PRInt32 lengthDER = 0;
if (!cert)
return (PORT_GetError() == SEC_ERROR_NO_MEMORY)
? NS_ERROR_OUT_OF_MEMORY : NS_ERROR_FAILURE;
certDER = PL_Base64Decode(base64, len, NULL);
if (!certDER || !*certDER) {
rv = NS_ERROR_ILLEGAL_VALUE;
}
else {
lengthDER = (len*3)/4 - adjust;
nsNSSCertificate *nsNSS = nsNSSCertificate::Create(cert);
CERT_DestroyCertificate(cert);
SECItem secitem_cert;
secitem_cert.type = siDERCertBuffer;
secitem_cert.data = (unsigned char*)certDER;
secitem_cert.len = lengthDER;
if (!nsNSS)
return NS_ERROR_OUT_OF_MEMORY;
CERTCertificate *cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), &secitem_cert, nsnull, PR_FALSE, PR_TRUE);
if (!cert) {
rv = NS_ERROR_FAILURE;
}
else {
nsNSSCertificate *nsNSS = nsNSSCertificate::Create(cert);
if (!nsNSS) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
else {
nsresult rv = nsNSS->QueryInterface(NS_GET_IID(nsIX509Cert), (void**)_retval);
if (NS_SUCCEEDED(rv) && *_retval) {
NS_ADDREF(*_retval);
}
NS_RELEASE(nsNSS);
}
CERT_DestroyCertificate(cert);
}
}
if (certDER) {
nsCRT::free(certDER);
}
return rv;
return CallQueryInterface(nsNSS, _retval);
}
void

View File

@ -54,6 +54,7 @@ _TEST_FILES = \
_CHROME_FILES = \
test_bug413909.html \
test_bug480619.html \
test_bug644006.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,77 @@
<!DOCTYPE HTML>
<html><head>
<title>Test bug 644006</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head><body>
<script type="application/javascript;version=1.7">
const FAILURE = Components.results.NS_ERROR_FAILURE;
const ILLEGAL_VALUE = Components.results.NS_ERROR_ILLEGAL_VALUE;
var certDB = Components.classes["@mozilla.org/security/x509certdb;1"]
.getService(Components.interfaces.nsIX509CertDB);
function excMessage(e)
{
if ("message" in e && e.message !== null) {
let msg = e.message;
if ("data" in e && e.data !== null)
msg = msg + ": " + e.data;
return msg;
} else {
return e.toString();
}
}
function testGood(data)
{
let label = "CN=" + data.cn;
try {
let cert = certDB.constructX509FromBase64(data.cert);
is(cert.commonName, data.cn, label + ": constructX509 succeeded");
} catch (e) {
ok(false, label + ": exception: " + excMessage(e));
}
}
function testBad(data)
{
let label = uneval(data.t)
try {
let cert = certDB.constructX509FromBase64(data.t);
ok(false, label + ": constructX509 succeeded");
} catch (e) {
is(e.result, data.e, label + ": exception: " + excMessage(e));
}
}
const badCases = [
// wrong type or too short
{ t: null, e: ILLEGAL_VALUE },
{ t: "", e: ILLEGAL_VALUE },
{ t: "=", e: ILLEGAL_VALUE },
{ t: "==", e: ILLEGAL_VALUE },
// not base64
{ t: "forty-four dead stone lions", e: ILLEGAL_VALUE },
// not a cert
{ t: "Zm9ydHktZm91ciBkZWFkIHN0b25lIGxpb25z", e: FAILURE }
];
// real certs with all three padding levels
const goodCases = [
{ cn: "A", cert: "MIHhMIGcAgEAMA0GCSqGSIb3DQEBBQUAMAwxCjAIBgNVBAMTAUEwHhcNMTEwMzIzMjMyNTE3WhcNMTEwNDIyMjMyNTE3WjAMMQowCAYDVQQDEwFBMEwwDQYJKoZIhvcNAQEBBQADOwAwOAIxANFm7ZCfYNJViaDWTFuMClX3+9u18VFGiyLfM6xJrxir4QVtQC7VUC/WUGoBUs9COQIDAQABMA0GCSqGSIb3DQEBBQUAAzEAx2+gIwmuYjJO5SyabqIm4lB1MandHH1HQc0y0tUFshBOMESTzQRPSVwPn77a6R9t" },
{ cn: "Bo", cert: "MIHjMIGeAgEAMA0GCSqGSIb3DQEBBQUAMA0xCzAJBgNVBAMTAkJvMB4XDTExMDMyMzIzMjYwMloXDTExMDQyMjIzMjYwMlowDTELMAkGA1UEAxMCQm8wTDANBgkqhkiG9w0BAQEFAAM7ADA4AjEA1FoSl9w9HqMqVgk2K0J3OTiRsgHeNsQdPUl6S82ME33gH+E56PcWZA3nse+fpS3NAgMBAAEwDQYJKoZIhvcNAQEFBQADMQAo/e3BvQAmygiATljQ68tWPoWcbMwa1xxAvpWTEc1LOvMqeDBinBUqbAbSmPhGWb4=" },
{ cn: "Cid", cert: "MIHlMIGgAgEAMA0GCSqGSIb3DQEBBQUAMA4xDDAKBgNVBAMTA0NpZDAeFw0xMTAzMjMyMzI2MzJaFw0xMTA0MjIyMzI2MzJaMA4xDDAKBgNVBAMTA0NpZDBMMA0GCSqGSIb3DQEBAQUAAzsAMDgCMQDUUxlF5xKN+8KCSsR83sN+SRwJmZdliXsnBB7PU0OgbmOWN0u8yehRkmu39kN9tzcCAwEAATANBgkqhkiG9w0BAQUFAAMxAJ3UScNqRcjHFrNu4nuwRldZLJlVJvRYXp982V4/kYodQEGN4gJ+Qyj+HTsaXy5x/w==" }
];
var i;
for (i = 0; i < badCases.length; i++)
testBad(badCases[i]);
for (i = 0; i < goodCases.length; i++)
testGood(goodCases[i]);
</script>
</body></html>

View File

@ -62,6 +62,50 @@ function runTest()
document.documentElement.appendChild(keyset);
iterateKeys(true, "appended");
var accelText = function(menuitem) menuitem.getAttribute("acceltext").toLowerCase();
$("menubutton").open = true;
// now check if a menu updates its accelerator text when a key attribute is changed
var menuitem1 = $("menuitem1");
ok(accelText(menuitem1).indexOf("d") >= 0, "menuitem1 accelText before");
if (navigator.platform.indexOf("Win") != -1) {
ok(accelText(menuitem1).indexOf("alt") >= 0, "menuitem1 accelText modifier before");
}
menuitem1.setAttribute("key", "k-s-c");
ok(accelText(menuitem1).indexOf("s") >= 0, "menuitem1 accelText after");
if (navigator.platform.indexOf("Win") != -1) {
ok(accelText(menuitem1).indexOf("ctrl") >= 0, "menuitem1 accelText modifier after");
}
menuitem1.setAttribute("acceltext", "custom");
is(accelText(menuitem1), "custom", "menuitem1 accelText set custom");
menuitem1.removeAttribute("acceltext");
ok(accelText(menuitem1).indexOf("s") >= 0, "menuitem1 accelText remove");
if (navigator.platform.indexOf("Win") != -1) {
ok(accelText(menuitem1).indexOf("ctrl") >= 0, "menuitem1 accelText modifier remove");
}
var menuitem2 = $("menuitem2");
is(accelText(menuitem2), "", "menuitem2 accelText before");
menuitem2.setAttribute("key", "k-s-c");
ok(accelText(menuitem2).indexOf("s") >= 0, "menuitem2 accelText before");
if (navigator.platform.indexOf("Win") != -1) {
ok(accelText(menuitem2).indexOf("ctrl") >= 0, "menuitem2 accelText modifier before");
}
menuitem2.setAttribute("key", "k-h-l");
ok(accelText(menuitem2).indexOf("h") >= 0, "menuitem2 accelText after");
if (navigator.platform.indexOf("Win") != -1) {
ok(accelText(menuitem2).indexOf("ctrl") >= 0, "menuitem2 accelText modifier after");
}
menuitem2.removeAttribute("key");
is(accelText(menuitem2), "", "menuitem2 accelText after remove");
$("menubutton").open = false;
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();
}
@ -116,8 +160,16 @@ SimpleTest.waitForFocus(runTest);
<keyset id="keyset2">
<key id="k-d-a" key="d" modifiers="alt" oncommand="checkKey(event)"/>
<key id="k-s-c" key="s" modifiers="control" oncommand="checkKey(event)"/>
</keyset>
<button id="menubutton" label="Menu" type="menu">
<menupopup>
<menuitem id="menuitem1" label="Item 1" key="k-d-a"/>
<menuitem id="menuitem2" label="Item 2"/>
</menupopup>
</button>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display">
</p>

View File

@ -200,8 +200,10 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus,
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
// For now, we don't implement the downloaded blacklist.
if (aDriverInfo)
if (aDriverInfo) {
*aStatus = status;
return NS_OK;
}
// Many WebGL issues on 10.5, especially:
// * bug 631258: WebGL shader paints using textures belonging to other processes on Mac OS 10.5

View File

@ -92,7 +92,7 @@ public:
protected:
void UncheckRadioSiblings(nsIContent* inCheckedElement);
void SetKeyEquiv(PRUint8 aModifiers, const nsString &aText);
void SetKeyEquiv();
EMenuItemType mType;
// nsMenuItemX objects should always have a valid native menu item.

View File

@ -143,25 +143,7 @@ nsresult nsMenuItemX::Create(nsMenuX* aParent, const nsString& aLabel, EMenuItem
SetChecked(mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::checked,
nsWidgetAtoms::_true, eCaseMatters));
// Set key shortcut and modifiers
if (doc) {
nsAutoString keyValue;
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyValue);
if (!keyValue.IsEmpty()) {
nsIContent *keyContent = doc->GetElementById(keyValue);
if (keyContent) {
nsAutoString keyChar(NS_LITERAL_STRING(" "));
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyChar);
nsAutoString modifiersStr;
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::modifiers, modifiersStr);
PRUint8 modifiers = nsMenuUtilsX::GeckoModifiersForNodeAttribute(modifiersStr);
SetKeyEquiv(modifiers, keyChar);
}
}
}
SetKeyEquiv();
}
mIcon = new nsMenuItemIconX(this, mContent, mNativeMenuItem);
@ -287,19 +269,39 @@ void nsMenuItemX::UncheckRadioSiblings(nsIContent* inCheckedContent)
}
}
void nsMenuItemX::SetKeyEquiv(PRUint8 aModifiers, const nsString &aText)
void nsMenuItemX::SetKeyEquiv()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
unsigned int macModifiers = nsMenuUtilsX::MacModifiersForGeckoModifiers(aModifiers);
[mNativeMenuItem setKeyEquivalentModifierMask:macModifiers];
// Set key shortcut and modifiers
nsAutoString keyValue;
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyValue);
if (!keyValue.IsEmpty() && mContent->GetCurrentDoc()) {
nsIContent *keyContent = mContent->GetCurrentDoc()->GetElementById(keyValue);
if (keyContent) {
nsAutoString keyChar(NS_LITERAL_STRING(" "));
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyChar);
NSString *keyEquivalent = [[NSString stringWithCharacters:(unichar*)aText.get()
length:aText.Length()] lowercaseString];
if ([keyEquivalent isEqualToString:@" "])
[mNativeMenuItem setKeyEquivalent:@""];
else
[mNativeMenuItem setKeyEquivalent:keyEquivalent];
nsAutoString modifiersStr;
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::modifiers, modifiersStr);
PRUint8 modifiers = nsMenuUtilsX::GeckoModifiersForNodeAttribute(modifiersStr);
unsigned int macModifiers = nsMenuUtilsX::MacModifiersForGeckoModifiers(modifiers);
[mNativeMenuItem setKeyEquivalentModifierMask:macModifiers];
NSString *keyEquivalent = [[NSString stringWithCharacters:(unichar*)keyChar.get()
length:keyChar.Length()] lowercaseString];
if ([keyEquivalent isEqualToString:@" "])
[mNativeMenuItem setKeyEquivalent:@""];
else
[mNativeMenuItem setKeyEquivalent:keyEquivalent];
return;
}
}
// if the key was removed, clear the key
[mNativeMenuItem setKeyEquivalent:@""];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -332,6 +334,9 @@ nsMenuItemX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConten
aAttribute == nsWidgetAtoms::label) {
mMenuParent->SetRebuild(PR_TRUE);
}
else if (aAttribute == nsWidgetAtoms::key) {
SetKeyEquiv();
}
else if (aAttribute == nsWidgetAtoms::image) {
SetupIcon();
}

View File

@ -103,6 +103,9 @@ public:
mValue -= aOther.mValue;
return *this;
}
double operator/(const TimeDuration& aOther) {
return static_cast<double>(mValue) / aOther.mValue;
}
PRBool operator<(const TimeDuration& aOther) const {
return mValue < aOther.mValue;