Merge mozilla-central and mozilla-inbound

This commit is contained in:
Ed Morley 2011-10-23 17:16:21 +01:00
Родитель 146eaf944c 9553fa493e
Коммит 40f867b2d9
82 изменённых файлов: 638 добавлений и 227 удалений

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

@ -77,7 +77,7 @@ pref("extensions.update.autoUpdateDefault", true);
// Disable add-ons installed into the shared user and shared system areas by // Disable add-ons installed into the shared user and shared system areas by
// default. This does not include the application directory. See the SCOPE // default. This does not include the application directory. See the SCOPE
// constants in AddonManager.jsm for values to use here // constants in AddonManager.jsm for values to use here
pref("extensions.autoDisableScopes", 10); pref("extensions.autoDisableScopes", 15);
// Dictionary download preference // Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/"); pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/");

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

@ -1021,9 +1021,9 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
installRDFFilename = "install.rdf" installRDFFilename = "install.rdf"
extensionsRootDir = os.path.join(profileDir, "extensions") extensionsRootDir = os.path.join(profileDir, "extensions", "staged")
if not os.path.isdir(extensionsRootDir): if not os.path.isdir(extensionsRootDir):
os.mkdir(extensionsRootDir) os.makedirs(extensionsRootDir)
if os.path.isfile(extensionSource): if os.path.isfile(extensionSource):
reader = ZipFileReader(extensionSource) reader = ZipFileReader(extensionSource)

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

@ -1458,6 +1458,8 @@ GetValueTypeFromTypeFlags(TypeFlags flags)
return JSVAL_TYPE_STRING; return JSVAL_TYPE_STRING;
case TYPE_FLAG_LAZYARGS: case TYPE_FLAG_LAZYARGS:
return JSVAL_TYPE_MAGIC; return JSVAL_TYPE_MAGIC;
case TYPE_FLAG_ANYOBJECT:
return JSVAL_TYPE_OBJECT;
default: default:
return JSVAL_TYPE_UNKNOWN; return JSVAL_TYPE_UNKNOWN;
} }

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

@ -941,18 +941,27 @@ class CallCompiler : public BaseCompiler
types::TypeScript::Monitor(f.cx, f.script(), f.pc(), args.rval()); types::TypeScript::Monitor(f.cx, f.script(), f.pc(), args.rval());
/*
* Native stubs are not generated for inline frames. The overhead of
* bailing out from the IC is far greater than the time saved by
* inlining the parent frame in the first place, so mark the immediate
* caller as uninlineable.
*/
if (f.script()->hasFunction) {
f.script()->uninlineable = true;
MarkTypeObjectFlags(cx, f.script()->function(), types::OBJECT_FLAG_UNINLINEABLE);
}
/* Don't touch the IC if the call triggered a recompilation. */ /* Don't touch the IC if the call triggered a recompilation. */
if (monitor.recompiled()) if (monitor.recompiled())
return true; return true;
JS_ASSERT(!f.regs.inlined());
/* Right now, take slow-path for IC misses or multiple stubs. */ /* Right now, take slow-path for IC misses or multiple stubs. */
if (ic.fastGuardedNative || ic.hasJsFunCheck) if (ic.fastGuardedNative || ic.hasJsFunCheck)
return true; return true;
/* Don't generate native MICs within inlined frames, we can't recompile them yet. */
if (f.regs.inlined())
return true;
/* Native MIC needs to warm up first. */ /* Native MIC needs to warm up first. */
if (!ic.hit) { if (!ic.hit) {
ic.hit = true; ic.hit = true;

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

@ -814,8 +814,17 @@ struct GetPropertyHelper {
return ic.disable(cx, "slotful getter hook through prototype"); return ic.disable(cx, "slotful getter hook through prototype");
if (!ic.canCallHook) if (!ic.canCallHook)
return ic.disable(cx, "can't call getter hook"); return ic.disable(cx, "can't call getter hook");
if (f.regs.inlined()) if (f.regs.inlined()) {
return ic.disable(cx, "hook called from inline frame"); /*
* As with native stubs, getter hook stubs can't be
* generated for inline frames. Mark the inner function
* as uninlineable and recompile.
*/
f.script()->uninlineable = true;
MarkTypeObjectFlags(cx, f.script()->function(),
types::OBJECT_FLAG_UNINLINEABLE);
return Lookup_Uncacheable;
}
} }
} else if (!shape->hasSlot()) { } else if (!shape->hasSlot()) {
return ic.disable(cx, "no slot"); return ic.disable(cx, "no slot");

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

@ -56,16 +56,16 @@ class CallObject : public ::JSObject
* JSSLOT_CALL_ARGUMENTS - arguments object for non-strict mode eval stack * JSSLOT_CALL_ARGUMENTS - arguments object for non-strict mode eval stack
* frames (not valid for strict mode eval frames) * frames (not valid for strict mode eval frames)
*/ */
static const uint32 CALLEE_SLOT = 0; static const uintN CALLEE_SLOT = 0;
static const uint32 ARGUMENTS_SLOT = 1; static const uintN ARGUMENTS_SLOT = 1;
public:
static const uintN RESERVED_SLOTS = 2;
public:
/* Create a CallObject for the given callee function. */ /* Create a CallObject for the given callee function. */
static CallObject * static CallObject *
create(JSContext *cx, JSScript *script, JSObject &scopeChain, JSObject *callee); create(JSContext *cx, JSScript *script, JSObject &scopeChain, JSObject *callee);
static const uint32 RESERVED_SLOTS = 2;
/* True if this is for a strict mode eval frame or for a function call. */ /* True if this is for a strict mode eval frame or for a function call. */
inline bool isForEval() const; inline bool isForEval() const;

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

@ -1804,6 +1804,13 @@ ComputeLinearGradientLine(nsPresContext* aPresContext,
gfxPoint center(aBoxSize.width/2, aBoxSize.height/2); gfxPoint center(aBoxSize.width/2, aBoxSize.height/2);
*aLineEnd = ComputeGradientLineEndFromAngle(center, angle, aBoxSize); *aLineEnd = ComputeGradientLineEndFromAngle(center, angle, aBoxSize);
*aLineStart = gfxPoint(aBoxSize.width, aBoxSize.height) - *aLineEnd; *aLineStart = gfxPoint(aBoxSize.width, aBoxSize.height) - *aLineEnd;
} else if (aGradient->mToCorner) {
float xSign = aGradient->mBgPosX.GetPercentValue() * 2 - 1;
float ySign = 1 - aGradient->mBgPosY.GetPercentValue() * 2;
double angle = atan2(ySign * aBoxSize.width, xSign * aBoxSize.height);
gfxPoint center(aBoxSize.width/2, aBoxSize.height/2);
*aLineEnd = ComputeGradientLineEndFromAngle(center, angle, aBoxSize);
*aLineStart = gfxPoint(aBoxSize.width, aBoxSize.height) - *aLineEnd;
} else { } else {
PRInt32 appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel(); PRInt32 appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel();
*aLineStart = gfxPoint( *aLineStart = gfxPoint(

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

@ -620,6 +620,12 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
root, mVisibleRect, mVisibleRect, root, mVisibleRect, mVisibleRect,
(usingDisplayport ? &displayport : nsnull), id, (usingDisplayport ? &displayport : nsnull), id,
containerParameters); containerParameters);
if (usingDisplayport &&
!(root->GetContentFlags() & Layer::CONTENT_OPAQUE)) {
// See bug 693938, attachment 567017
NS_WARNING("We don't support transparent content with displayports, force it to be opqaue");
root->SetContentFlags(Layer::CONTENT_OPAQUE);
}
layerManager->SetRoot(root); layerManager->SetRoot(root);
aBuilder->LayerBuilder()->WillEndTransaction(layerManager); aBuilder->LayerBuilder()->WillEndTransaction(layerManager);

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

@ -199,6 +199,7 @@
#include "mozilla/FunctionTimer.h" #include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "Layers.h" #include "Layers.h"
@ -1906,6 +1907,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
} }
NS_TIME_FUNCTION_WITH_DOCURL; NS_TIME_FUNCTION_WITH_DOCURL;
mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
NS_ASSERTION(!mDidInitialReflow, "Why are we being called?"); NS_ASSERTION(!mDidInitialReflow, "Why are we being called?");
@ -2046,6 +2048,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
} }
} }
if (root && root->IsXUL()) {
mozilla::Telemetry::AccumulateTimeDelta(Telemetry::XUL_INITIAL_FRAME_CONSTRUCTION,
timerStart);
}
return NS_OK; //XXX this needs to be real. MMP return NS_OK; //XXX this needs to be real. MMP
} }
@ -7331,7 +7338,7 @@ bool
PresShell::ProcessReflowCommands(bool aInterruptible) PresShell::ProcessReflowCommands(bool aInterruptible)
{ {
NS_TIME_FUNCTION_WITH_DOCURL; NS_TIME_FUNCTION_WITH_DOCURL;
mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
bool interrupted = false; bool interrupted = false;
if (0 != mDirtyRoots.Length()) { if (0 != mDirtyRoots.Length()) {
@ -7410,6 +7417,11 @@ PresShell::ProcessReflowCommands(bool aInterruptible)
UnsuppressAndInvalidate(); UnsuppressAndInvalidate();
} }
if (mDocument->GetRootElement() && mDocument->GetRootElement()->IsXUL()) {
mozilla::Telemetry::AccumulateTimeDelta(Telemetry::XUL_REFLOW_MS,
timerStart);
}
return !interrupted; return !interrupted;
} }

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(to right, red 0%, #7777FF 50%, rgb(100, 200, 0) 100%) no-repeat; width: 300px; height: 300px;"><br></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(top left, white, black) no-repeat; width: 300px; height: 300px;"></div> <div style="background: -moz-linear-gradient(to bottom right, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(top left, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(top right, white, black) no-repeat; width: 300px; height: 300px;"></div> <div style="background: -moz-linear-gradient(to bottom left, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(top right, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(bottom right, white, black) no-repeat; width: 300px; height: 300px;"></div> <div style="background: -moz-linear-gradient(to top left, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(bottom right, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(bottom left, white, black) no-repeat; width: 300px; height: 300px;"></div> <div style="background: -moz-linear-gradient(to top right, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(bottom left, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(bottom right 135deg, white 75%, black); width: 400px; height: 400px;"></div> <div style="background: -moz-linear-gradient(to top left, white 75%, black); width: 400px; height: 400px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(bottom left 45deg, white 75%, black); width: 400px; height: 400px;"></div> <div style="background: -moz-linear-gradient(to top right, white 75%, black); width: 400px; height: 400px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(top left -45deg, white 75%, black); width: 400px; height: 400px;"></div> <div style="background: -moz-linear-gradient(to bottom right, white 75%, black); width: 400px; height: 400px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(top right -135deg, white 75%, black); width: 400px; height: 400px;"></div> <div style="background: -moz-linear-gradient(to bottom left, white 75%, black); width: 400px; height: 400px;"></div>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<style>
.x { width: 200px; height: 100px; display: inline-block; }
.a { background: -moz-linear-gradient(top -90deg, blue, white, red); }
.e { background: -moz-linear-gradient(top right -2.03444394rad, blue, white, red); }
.g { background: -moz-linear-gradient(right 180deg, blue, white, red); }
.i { background: -moz-linear-gradient(bottom right 2.03444394rad, blue, white, red); }
.k { background: -moz-linear-gradient(bottom 90deg, blue, white, red); }
.m { background: -moz-linear-gradient(bottom left 1.10714872rad, blue, white, red); }
.o { background: -moz-linear-gradient(left 0deg, blue, white, red); }
.q { background: -moz-linear-gradient(top left -1.10714872rad, blue, white, red); }
</style>
<div class="x a"></div>
<div class="x e"></div>
<div class="x g"></div>
<div class="x i"></div>
<div class="x k"></div>
<div class="x m"></div>
<div class="x o"></div>
<div class="x q"></div>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<style>
.x { width: 200px; height: 100px; display: inline-block; }
.a { background: -moz-linear-gradient(to bottom, blue, white, red); }
.e { background: -moz-linear-gradient(to bottom left, blue, white, red); }
.g { background: -moz-linear-gradient(to left, blue, white, red); }
.i { background: -moz-linear-gradient(to top left, blue, white, red); }
.k { background: -moz-linear-gradient(to top, blue, white, red); }
.m { background: -moz-linear-gradient(to top right, blue, white, red); }
.o { background: -moz-linear-gradient(to right, blue, white, red); }
.q { background: -moz-linear-gradient(to bottom right, blue, white, red); }
</style>
<div class="x a"></div>
<div class="x e"></div>
<div class="x g"></div>
<div class="x i"></div>
<div class="x k"></div>
<div class="x m"></div>
<div class="x o"></div>
<div class="x q"></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(to right bottom, #0000ff, #000000) no-repeat; width: 300px; height: 300px;"><br></div>

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

@ -5,7 +5,7 @@
div { div {
width: 200px; width: 200px;
height: 200px; height: 200px;
background-image: -moz-linear-gradient(left, blue 0%, blue 25%, orange 25%, orange 100%); background-image: -moz-linear-gradient(to right, blue 0%, blue 25%, orange 25%, orange 100%);
} }
</style> </style>

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

@ -1,2 +1,2 @@
<body style="margin:0;"> <body style="margin:0;">
<div style="background: -moz-linear-gradient(left, white, black) no-repeat; position:relative; left:-200px; width: 300px; height: 300px;"><br></div> <div style="background: -moz-linear-gradient(to right, white, black) no-repeat; position:relative; left:-200px; width: 300px; height: 300px;"><br></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(to bottom, white, black) no-repeat; width: 300px; height: 300px;"></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(left top) no-repeat; width: 300px; height: 300px;"><br></div> <div style="background: -moz-linear-gradient(to right bottom) no-repeat; width: 300px; height: 300px;"><br></div>

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

@ -1 +1 @@
<div style="background: -moz-linear-gradient(left top, #0000ff 50%) no-repeat; width: 300px; height: 300px;"><br></div> <div style="background: -moz-linear-gradient(to right bottom, #0000ff 50%) no-repeat; width: 300px; height: 300px;"><br></div>

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

@ -1,19 +1,26 @@
fails-if(Android) == linear.html linear-ref.html fails-if(Android) == linear-1a.html linear-1-ref.html
fails-if(Android) == linear-keywords.html linear-keywords-ref.html fails-if(Android) == linear-1b.html linear-1-ref.html
fails-if(Android) == linear-keywords-1a.html linear-keywords-1-ref.html
fails-if(Android) == linear-keywords-1b.html linear-keywords-1-ref.html
fails-if(Android) == linear-percent.html linear-percent-ref.html fails-if(Android) == linear-percent.html linear-percent-ref.html
fails-if(Android) == linear-mix.html linear-mix-ref.html fails-if(Android) == linear-mix.html linear-mix-ref.html
== linear-diagonal-1a.html linear-diagonal-1-ref.html == linear-diagonal-1a.html linear-diagonal-1-ref.html
== linear-diagonal-1b.html linear-diagonal-1-ref.html == linear-diagonal-1b.html linear-diagonal-1-ref.html
== linear-diagonal-1c.html linear-diagonal-1-ref.html
== linear-diagonal-2a.html linear-diagonal-2-ref.html == linear-diagonal-2a.html linear-diagonal-2-ref.html
== linear-diagonal-2b.html linear-diagonal-2-ref.html == linear-diagonal-2b.html linear-diagonal-2-ref.html
== linear-diagonal-2c.html linear-diagonal-2-ref.html
== linear-diagonal-3a.html linear-diagonal-3-ref.html == linear-diagonal-3a.html linear-diagonal-3-ref.html
== linear-diagonal-3b.html linear-diagonal-3-ref.html == linear-diagonal-3b.html linear-diagonal-3-ref.html
== linear-diagonal-3c.html linear-diagonal-3-ref.html
== linear-diagonal-4a.html linear-diagonal-4-ref.html == linear-diagonal-4a.html linear-diagonal-4-ref.html
== linear-diagonal-4b.html linear-diagonal-4-ref.html == linear-diagonal-4b.html linear-diagonal-4-ref.html
== linear-diagonal-4c.html linear-diagonal-4-ref.html
== linear-diagonal-5a.html linear-diagonal-5-ref.html == linear-diagonal-5a.html linear-diagonal-5-ref.html
== linear-diagonal-6a.html linear-diagonal-6-ref.html == linear-diagonal-6a.html linear-diagonal-6-ref.html
== linear-diagonal-7a.html linear-diagonal-7-ref.html == linear-diagonal-7a.html linear-diagonal-7-ref.html
== linear-diagonal-8a.html linear-diagonal-8-ref.html == linear-diagonal-8a.html linear-diagonal-8-ref.html
== linear-diagonal-9a.html linear-diagonal-9-ref.html
== linear-position-1a.html linear-position-1-ref.html == linear-position-1a.html linear-position-1-ref.html
== linear-repeat-1a.html linear-repeat-1-ref.html == linear-repeat-1a.html linear-repeat-1-ref.html
fails-if(d2d) == linear-repeat-1b.html linear-repeat-1-ref.html # bug 582236 fails-if(d2d) == linear-repeat-1b.html linear-repeat-1-ref.html # bug 582236
@ -33,6 +40,7 @@ fails-if(Android) == linear-vertical-1a.html linear-vertical-1-ref.html
fails-if(Android) == linear-vertical-1b.html linear-vertical-1-ref.html fails-if(Android) == linear-vertical-1b.html linear-vertical-1-ref.html
fails-if(Android) == linear-vertical-1c.html linear-vertical-1-ref.html fails-if(Android) == linear-vertical-1c.html linear-vertical-1-ref.html
fails-if(Android) == linear-vertical-1d.html linear-vertical-1-ref.html fails-if(Android) == linear-vertical-1d.html linear-vertical-1-ref.html
fails-if(Android) == linear-vertical-1e.html linear-vertical-1-ref.html
== linear-viewport.html linear-viewport-ref.html == linear-viewport.html linear-viewport-ref.html
== linear-zero-length-1a.html linear-zero-length-1-ref.html == linear-zero-length-1a.html linear-zero-length-1-ref.html
== linear-zero-length-1b.html linear-zero-length-1-ref.html == linear-zero-length-1b.html linear-zero-length-1-ref.html
@ -65,6 +73,8 @@ fails-if(d2d) == repeating-linear-1b.html repeating-linear-1-ref.html
fails-if(cocoaWidget) == twostops-1c.html twostops-1-ref.html # bug 524173 fails-if(cocoaWidget) == twostops-1c.html twostops-1-ref.html # bug 524173
== twostops-1d.html twostops-1-ref.html == twostops-1d.html twostops-1-ref.html
== twostops-1e.html twostops-1-ref.html == twostops-1e.html twostops-1-ref.html
== twostops-1f.html twostops-1-ref.html
== twostops-1g.html twostops-1-ref.html
# from http://www.xanthir.com/:4bhipd by way of http://a-ja.net/newgrad.html # from http://www.xanthir.com/:4bhipd by way of http://a-ja.net/newgrad.html
fails-if(Android) == aja-linear-1a.html aja-linear-1-ref.html fails-if(Android) == aja-linear-1a.html aja-linear-1-ref.html

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

@ -5,7 +5,7 @@
div { div {
width: 200px; width: 200px;
height: 200px; height: 200px;
background-image: -moz-repeating-linear-gradient(left, blue 25%, orange 25%); background-image: -moz-repeating-linear-gradient(to right, blue 25%, orange 25%);
} }
</style> </style>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(to bottom, #0000ff 50%, #ff0000 50%) no-repeat; width: 300px; height: 300px;"><br></div>

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

@ -0,0 +1 @@
<div style="background: -moz-linear-gradient(to top, #ff0000 50%, #0000ff 50%) no-repeat; width: 300px; height: 300px;"><br></div>

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

@ -471,7 +471,8 @@ protected:
bool ParseValueList(nsCSSProperty aPropID); // a single value prop-id bool ParseValueList(nsCSSProperty aPropID); // a single value prop-id
bool ParseBackgroundPosition(); bool ParseBackgroundPosition();
bool ParseBoxPositionValues(nsCSSValuePair& aOut, bool aAcceptsInherit); bool ParseBoxPositionValues(nsCSSValuePair& aOut, bool aAcceptsInherit,
bool aAllowExplicitCenter = true);
bool ParseBackgroundSize(); bool ParseBackgroundSize();
bool ParseBackgroundSizeValues(nsCSSValuePair& aOut); bool ParseBackgroundSizeValues(nsCSSValuePair& aOut);
bool ParseBorderColor(); bool ParseBorderColor();
@ -4904,7 +4905,9 @@ CSSParserImpl::ParseColorStop(nsCSSValueGradient* aGradient)
// : radial-gradient( <gradient-line>? <gradient-shape-size>? // : radial-gradient( <gradient-line>? <gradient-shape-size>?
// <color-stops> ')' // <color-stops> ')'
// //
// <gradient-line> : [<bg-position> || <angle>] , // <gradient-line> : [ to [left | right] || [top | bottom] ] ,
// | <legacy-gradient-line>
// <legacy-gradient-line> : [ <bg-position> || <angle>] ,
// //
// <gradient-shape-size> : [<gradient-shape> || <gradient-size>] , // <gradient-shape-size> : [<gradient-shape> || <gradient-size>] ,
// <gradient-shape> : circle | ellipse // <gradient-shape> : circle | ellipse
@ -4933,8 +4936,19 @@ CSSParserImpl::ParseGradient(nsCSSValue& aValue, bool aIsRadial,
if (!GetToken(true)) { if (!GetToken(true)) {
return false; return false;
} }
bool toCorner = false;
if (mToken.mType == eCSSToken_Ident &&
mToken.mIdent.LowerCaseEqualsLiteral("to")) {
toCorner = true;
if (!GetToken(true)) {
return false;
}
}
nsCSSTokenType ty = mToken.mType; nsCSSTokenType ty = mToken.mType;
nsString id = mToken.mIdent; nsString id = mToken.mIdent;
cssGradient->mIsToCorner = toCorner;
UngetToken(); UngetToken();
bool haveGradientLine = false; bool haveGradientLine = false;
@ -4975,6 +4989,38 @@ CSSParserImpl::ParseGradient(nsCSSValue& aValue, bool aIsRadial,
} }
if (haveGradientLine) { if (haveGradientLine) {
if (toCorner) {
// "to" syntax only allows box position keywords
if (ty != eCSSToken_Ident) {
SkipUntil(')');
return false;
}
// "to" syntax doesn't allow explicit "center"
if (!ParseBoxPositionValues(cssGradient->mBgPos, false, false)) {
SkipUntil(')');
return false;
}
const nsCSSValue& xValue = cssGradient->mBgPos.mXValue;
const nsCSSValue& yValue = cssGradient->mBgPos.mYValue;
if (xValue.GetUnit() != eCSSUnit_Enumerated ||
!(xValue.GetIntValue() & (NS_STYLE_BG_POSITION_LEFT |
NS_STYLE_BG_POSITION_CENTER |
NS_STYLE_BG_POSITION_RIGHT)) ||
yValue.GetUnit() != eCSSUnit_Enumerated ||
!(yValue.GetIntValue() & (NS_STYLE_BG_POSITION_TOP |
NS_STYLE_BG_POSITION_CENTER |
NS_STYLE_BG_POSITION_BOTTOM))) {
SkipUntil(')');
return false;
}
if (!ExpectSymbol(',', true)) {
SkipUntil(')');
return false;
}
} else {
bool haveAngle = bool haveAngle =
ParseVariant(cssGradient->mAngle, VARIANT_ANGLE, nsnull); ParseVariant(cssGradient->mAngle, VARIANT_ANGLE, nsnull);
@ -4997,6 +5043,7 @@ CSSParserImpl::ParseGradient(nsCSSValue& aValue, bool aIsRadial,
} }
} }
} }
}
// radial gradients might have a <gradient-shape-size> here // radial gradients might have a <gradient-shape-size> here
if (aIsRadial) { if (aIsRadial) {
@ -6022,10 +6069,12 @@ CSSParserImpl::ParseBackgroundPosition()
* *
* @param aOut The nsCSSValuePair in which to place the result. * @param aOut The nsCSSValuePair in which to place the result.
* @param aAcceptsInherit If true, 'inherit' and 'initial' are legal values * @param aAcceptsInherit If true, 'inherit' and 'initial' are legal values
* @param aAllowExplicitCenter If true, 'center' is a legal value
* @return Whether or not the operation succeeded. * @return Whether or not the operation succeeded.
*/ */
bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut, bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut,
bool aAcceptsInherit) bool aAcceptsInherit,
bool aAllowExplicitCenter)
{ {
// First try a percentage or a length value // First try a percentage or a length value
nsCSSValue &xValue = aOut.mXValue, nsCSSValue &xValue = aOut.mXValue,
@ -6096,7 +6145,8 @@ bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut,
// Check for bad input. Bad input consists of no matching keywords, // Check for bad input. Bad input consists of no matching keywords,
// or pairs of x keywords or pairs of y keywords. // or pairs of x keywords or pairs of y keywords.
if ((mask == 0) || (mask == (BG_TOP | BG_BOTTOM)) || if ((mask == 0) || (mask == (BG_TOP | BG_BOTTOM)) ||
(mask == (BG_LEFT | BG_RIGHT))) { (mask == (BG_LEFT | BG_RIGHT)) ||
(!aAllowExplicitCenter && (mask & BG_CENTER))) {
return false; return false;
} }

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

@ -957,7 +957,23 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
aResult.AppendLiteral("-moz-linear-gradient("); aResult.AppendLiteral("-moz-linear-gradient(");
} }
if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None || if (gradient->mIsToCorner) {
aResult.AppendLiteral("to");
NS_ABORT_IF_FALSE(gradient->mBgPos.mXValue.GetUnit() == eCSSUnit_Enumerated &&
gradient->mBgPos.mYValue.GetUnit() == eCSSUnit_Enumerated,
"unexpected unit");
if (!(gradient->mBgPos.mXValue.GetIntValue() & NS_STYLE_BG_POSITION_CENTER)) {
aResult.AppendLiteral(" ");
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position,
aResult);
}
if (!(gradient->mBgPos.mYValue.GetIntValue() & NS_STYLE_BG_POSITION_CENTER)) {
aResult.AppendLiteral(" ");
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position,
aResult);
}
aResult.AppendLiteral(", ");
} else if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None ||
gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None || gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None ||
gradient->mAngle.GetUnit() != eCSSUnit_None) { gradient->mAngle.GetUnit() != eCSSUnit_None) {
if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None) { if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None) {
@ -1439,6 +1455,7 @@ nsCSSValueGradient::nsCSSValueGradient(bool aIsRadial,
bool aIsRepeating) bool aIsRepeating)
: mIsRadial(aIsRadial), : mIsRadial(aIsRadial),
mIsRepeating(aIsRepeating), mIsRepeating(aIsRepeating),
mIsToCorner(false),
mBgPos(eCSSUnit_None), mBgPos(eCSSUnit_None),
mAngle(eCSSUnit_None), mAngle(eCSSUnit_None),
mRadialShape(eCSSUnit_None), mRadialShape(eCSSUnit_None),

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

@ -1032,6 +1032,7 @@ struct nsCSSValueGradient {
// true if gradient is radial, false if it is linear // true if gradient is radial, false if it is linear
bool mIsRadial; bool mIsRadial;
bool mIsRepeating; bool mIsRepeating;
bool mIsToCorner;
// line position and angle // line position and angle
nsCSSValuePair mBgPos; nsCSSValuePair mBgPos;
nsCSSValue mAngle; nsCSSValue mAngle;
@ -1046,6 +1047,7 @@ struct nsCSSValueGradient {
{ {
if (mIsRadial != aOther.mIsRadial || if (mIsRadial != aOther.mIsRadial ||
mIsRepeating != aOther.mIsRepeating || mIsRepeating != aOther.mIsRepeating ||
mIsToCorner != aOther.mIsToCorner ||
mBgPos != aOther.mBgPos || mBgPos != aOther.mBgPos ||
mAngle != aOther.mAngle || mAngle != aOther.mAngle ||
mRadialShape != aOther.mRadialShape || mRadialShape != aOther.mRadialShape ||

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

@ -1405,6 +1405,41 @@ AppendCSSGradientLength(const nsStyleCoord& aValue,
aString.Append(tokenString); aString.Append(tokenString);
} }
static void
AppendCSSGradientToBoxPosition(const nsStyleGradient* aGradient,
nsAString& aString,
bool& aNeedSep)
{
float xValue = aGradient->mBgPosX.GetPercentValue();
float yValue = aGradient->mBgPosY.GetPercentValue();
if (yValue == 1.0f && xValue == 0.5f) {
// omit "to bottom"
return;
}
NS_ASSERTION(yValue != 0.5f || xValue != 0.5f, "invalid box position");
aString.AppendLiteral("to");
if (yValue == 0.0f) {
aString.AppendLiteral(" top");
} else if (yValue == 1.0f) {
aString.AppendLiteral(" bottom");
} else if (yValue != 0.5f) { // do not write "center" keyword
NS_NOTREACHED("invalid box position");
}
if (xValue == 0.0f) {
aString.AppendLiteral(" left");
} else if (xValue == 1.0f) {
aString.AppendLiteral(" right");
} else if (xValue != 0.5f) { // do not write "center" keyword
NS_NOTREACHED("invalid box position");
}
aNeedSep = true;
}
void void
nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient, nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString) nsAString& aString)
@ -1425,6 +1460,9 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
nsAutoString tokenString; nsAutoString tokenString;
nsROCSSPrimitiveValue *tmpVal = GetROCSSPrimitiveValue(); nsROCSSPrimitiveValue *tmpVal = GetROCSSPrimitiveValue();
if (aGradient->mToCorner) {
AppendCSSGradientToBoxPosition(aGradient, aString, needSep);
} else {
if (aGradient->mBgPosX.mUnit != eStyleUnit_None) { if (aGradient->mBgPosX.mUnit != eStyleUnit_None) {
AppendCSSGradientLength(aGradient->mBgPosX, tmpVal, aString); AppendCSSGradientLength(aGradient->mBgPosX, tmpVal, aString);
needSep = true; needSep = true;
@ -1436,6 +1474,7 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
AppendCSSGradientLength(aGradient->mBgPosY, tmpVal, aString); AppendCSSGradientLength(aGradient->mBgPosY, tmpVal, aString);
needSep = true; needSep = true;
} }
}
if (aGradient->mAngle.mUnit != eStyleUnit_None) { if (aGradient->mAngle.mUnit != eStyleUnit_None) {
if (needSep) { if (needSep) {
aString.AppendLiteral(" "); aString.AppendLiteral(" ");

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

@ -865,6 +865,8 @@ static void SetGradient(const nsCSSValue& aValue, nsPresContext* aPresContext,
"bad unit for linear size"); "bad unit for linear size");
aResult.mShape = NS_STYLE_GRADIENT_SHAPE_LINEAR; aResult.mShape = NS_STYLE_GRADIENT_SHAPE_LINEAR;
aResult.mSize = NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER; aResult.mSize = NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER;
aResult.mToCorner = gradient->mIsToCorner;
} }
// bg-position // bg-position

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

@ -1351,6 +1351,7 @@ nsStyleGradient::operator==(const nsStyleGradient& aOther) const
if (mShape != aOther.mShape || if (mShape != aOther.mShape ||
mSize != aOther.mSize || mSize != aOther.mSize ||
mRepeating != aOther.mRepeating || mRepeating != aOther.mRepeating ||
mToCorner != aOther.mToCorner ||
mBgPosX != aOther.mBgPosX || mBgPosX != aOther.mBgPosX ||
mBgPosY != aOther.mBgPosY || mBgPosY != aOther.mBgPosY ||
mAngle != aOther.mAngle) mAngle != aOther.mAngle)
@ -1372,6 +1373,7 @@ nsStyleGradient::nsStyleGradient(void)
: mShape(NS_STYLE_GRADIENT_SHAPE_LINEAR) : mShape(NS_STYLE_GRADIENT_SHAPE_LINEAR)
, mSize(NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER) , mSize(NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER)
, mRepeating(false) , mRepeating(false)
, mToCorner(false)
{ {
} }

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

@ -158,6 +158,7 @@ public:
PRUint8 mSize; // NS_STYLE_GRADIENT_SIZE_*; PRUint8 mSize; // NS_STYLE_GRADIENT_SIZE_*;
// not used (must be FARTHEST_CORNER) for linear shape // not used (must be FARTHEST_CORNER) for linear shape
bool mRepeating; bool mRepeating;
bool mToCorner;
nsStyleCoord mBgPosX; // percent, coord, calc, none nsStyleCoord mBgPosX; // percent, coord, calc, none
nsStyleCoord mBgPosY; // percent, coord, calc, none nsStyleCoord mBgPosY; // percent, coord, calc, none

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

@ -1191,6 +1191,19 @@ var gCSSProperties = {
"-moz-linear-gradient(#ffff00, #ef3, rgba(10, 20, 30, 0.4))", "-moz-linear-gradient(#ffff00, #ef3, rgba(10, 20, 30, 0.4))",
"-moz-linear-gradient(rgba(10, 20, 30, 0.4), #ffff00, #ef3)", "-moz-linear-gradient(rgba(10, 20, 30, 0.4), #ffff00, #ef3)",
"-moz-linear-gradient(to top, red, blue)",
"-moz-linear-gradient(to bottom, red, blue)",
"-moz-linear-gradient(to left, red, blue)",
"-moz-linear-gradient(to right, red, blue)",
"-moz-linear-gradient(to top left, red, blue)",
"-moz-linear-gradient(to top right, red, blue)",
"-moz-linear-gradient(to bottom left, red, blue)",
"-moz-linear-gradient(to bottom right, red, blue)",
"-moz-linear-gradient(to left top, red, blue)",
"-moz-linear-gradient(to left bottom, red, blue)",
"-moz-linear-gradient(to right top, red, blue)",
"-moz-linear-gradient(to right bottom, red, blue)",
"-moz-linear-gradient(top left, red, blue)", "-moz-linear-gradient(top left, red, blue)",
"-moz-linear-gradient(0 0, red, blue)", "-moz-linear-gradient(0 0, red, blue)",
"-moz-linear-gradient(20% bottom, red, blue)", "-moz-linear-gradient(20% bottom, red, blue)",
@ -1269,6 +1282,19 @@ var gCSSProperties = {
"-moz-repeating-linear-gradient(#ffff00, #ef3, rgba(10, 20, 30, 0.4))", "-moz-repeating-linear-gradient(#ffff00, #ef3, rgba(10, 20, 30, 0.4))",
"-moz-repeating-linear-gradient(rgba(10, 20, 30, 0.4), #ffff00, #ef3)", "-moz-repeating-linear-gradient(rgba(10, 20, 30, 0.4), #ffff00, #ef3)",
"-moz-repeating-linear-gradient(to top, red, blue)",
"-moz-repeating-linear-gradient(to bottom, red, blue)",
"-moz-repeating-linear-gradient(to left, red, blue)",
"-moz-repeating-linear-gradient(to right, red, blue)",
"-moz-repeating-linear-gradient(to top left, red, blue)",
"-moz-repeating-linear-gradient(to top right, red, blue)",
"-moz-repeating-linear-gradient(to bottom left, red, blue)",
"-moz-repeating-linear-gradient(to bottom right, red, blue)",
"-moz-repeating-linear-gradient(to left top, red, blue)",
"-moz-repeating-linear-gradient(to left bottom, red, blue)",
"-moz-repeating-linear-gradient(to right top, red, blue)",
"-moz-repeating-linear-gradient(to right bottom, red, blue)",
"-moz-repeating-linear-gradient(top left, red, blue)", "-moz-repeating-linear-gradient(top left, red, blue)",
"-moz-repeating-linear-gradient(0 0, red, blue)", "-moz-repeating-linear-gradient(0 0, red, blue)",
"-moz-repeating-linear-gradient(20% bottom, red, blue)", "-moz-repeating-linear-gradient(20% bottom, red, blue)",
@ -1398,6 +1424,28 @@ var gCSSProperties = {
"-moz-radial-gradient(contain contain, red, blue)", "-moz-radial-gradient(contain contain, red, blue)",
"-moz-radial-gradient(ellipse circle, red, blue)", "-moz-radial-gradient(ellipse circle, red, blue)",
"-moz-linear-gradient(to 0 0, red, blue)",
"-moz-linear-gradient(to 20% bottom, red, blue)",
"-moz-linear-gradient(to center 20%, red, blue)",
"-moz-linear-gradient(to left 35px, red, blue)",
"-moz-linear-gradient(to 10% 10em, red, blue)",
"-moz-linear-gradient(to 44px top, red, blue)",
"-moz-linear-gradient(to top left 45deg, red, blue)",
"-moz-linear-gradient(to 20% bottom -300deg, red, blue)",
"-moz-linear-gradient(to center 20% 1.95929rad, red, blue)",
"-moz-linear-gradient(to left 35px 30grad, red, blue)",
"-moz-linear-gradient(to 10% 10em 99999deg, red, blue)",
"-moz-linear-gradient(to 44px top -33deg, red, blue)",
"-moz-linear-gradient(to -33deg, red, blue)",
"-moz-linear-gradient(to 30grad left 35px, red, blue)",
"-moz-linear-gradient(to 10deg 20px, red, blue)",
"-moz-linear-gradient(to .414rad bottom, red, blue)",
"-moz-linear-gradient(to top top, red, blue)",
"-moz-linear-gradient(to bottom bottom, red, blue)",
"-moz-linear-gradient(to left left, red, blue)",
"-moz-linear-gradient(to right right, red, blue)",
"-moz-repeating-linear-gradient(10px 10px, 20px, 30px 30px, 40px, blue 0, red 100%)", "-moz-repeating-linear-gradient(10px 10px, 20px, 30px 30px, 40px, blue 0, red 100%)",
"-moz-repeating-radial-gradient(20px 20px, 10px 10px, from(green), to(#ff00ff))", "-moz-repeating-radial-gradient(20px 20px, 10px 10px, from(green), to(#ff00ff))",
"-moz-repeating-radial-gradient(10px 10px, 20%, 40px 40px, 10px, from(green), to(#ff00ff))", "-moz-repeating-radial-gradient(10px 10px, 20%, 40px 40px, 10px, from(green), to(#ff00ff))",
@ -1408,7 +1456,29 @@ var gCSSProperties = {
"-moz-repeating-linear-gradient(left left, top top, blue 0)", "-moz-repeating-linear-gradient(left left, top top, blue 0)",
"-moz-repeating-linear-gradient(inherit, 10px 10px, blue 0)", "-moz-repeating-linear-gradient(inherit, 10px 10px, blue 0)",
"-moz-repeating-linear-gradient(left left blue red)", "-moz-repeating-linear-gradient(left left blue red)",
"-moz-repeating-linear-gradient()" ] "-moz-repeating-linear-gradient()",
"-moz-repeating-linear-gradient(to 0 0, red, blue)",
"-moz-repeating-linear-gradient(to 20% bottom, red, blue)",
"-moz-repeating-linear-gradient(to center 20%, red, blue)",
"-moz-repeating-linear-gradient(to left 35px, red, blue)",
"-moz-repeating-linear-gradient(to 10% 10em, red, blue)",
"-moz-repeating-linear-gradient(to 44px top, red, blue)",
"-moz-repeating-linear-gradient(to top left 45deg, red, blue)",
"-moz-repeating-linear-gradient(to 20% bottom -300deg, red, blue)",
"-moz-repeating-linear-gradient(to center 20% 1.95929rad, red, blue)",
"-moz-repeating-linear-gradient(to left 35px 30grad, red, blue)",
"-moz-repeating-linear-gradient(to 10% 10em 99999deg, red, blue)",
"-moz-repeating-linear-gradient(to 44px top -33deg, red, blue)",
"-moz-repeating-linear-gradient(to -33deg, red, blue)",
"-moz-repeating-linear-gradient(to 30grad left 35px, red, blue)",
"-moz-repeating-linear-gradient(to 10deg 20px, red, blue)",
"-moz-repeating-linear-gradient(to .414rad bottom, red, blue)",
"-moz-repeating-linear-gradient(to top top, red, blue)",
"-moz-repeating-linear-gradient(to bottom bottom, red, blue)",
"-moz-repeating-linear-gradient(to left left, red, blue)",
"-moz-repeating-linear-gradient(to right right, red, blue)" ]
}, },
"background-origin": { "background-origin": {
domProp: "backgroundOrigin", domProp: "backgroundOrigin",

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

@ -54,6 +54,14 @@ var declarations = [
"background-image: -moz-linear-gradient(red, yellow, blue", "background-image: -moz-linear-gradient(red, yellow, blue",
"background-image: -moz-linear-gradient(red 1px, yellow 5px, blue 10px", "background-image: -moz-linear-gradient(red 1px, yellow 5px, blue 10px",
"background-image: -moz-linear-gradient(red, yellow, rgb(0, 0, 255)", "background-image: -moz-linear-gradient(red, yellow, rgb(0, 0, 255)",
"background-image: -moz-linear-gradient(to",
"background-image: -moz-linear-gradient(to top",
"background-image: -moz-linear-gradient(to top left",
"background-image: -moz-linear-gradient(to top left,",
"background-image: -moz-repeating-linear-gradient(to top left, red, blue",
"background-image: -moz-linear-gradient(to top left, red, yellow, blue",
"background-image: -moz-linear-gradient(to top left, red 1px, yellow 5px, blue 10px",
"background-image: -moz-linear-gradient(to top left, red, yellow, rgb(0, 0, 255)",
"background-image: -moz-repeating-linear-gradient(top left, red, blue", "background-image: -moz-repeating-linear-gradient(top left, red, blue",
"background-image: -moz-linear-gradient(top left, red, yellow, blue", "background-image: -moz-linear-gradient(top left, red, yellow, blue",
"background-image: -moz-linear-gradient(top left, red 1px, yellow 5px, blue 10px", "background-image: -moz-linear-gradient(top left, red 1px, yellow 5px, blue 10px",

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

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

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

@ -1 +1 @@
NSS_3_13_1_BETA1 NSS_3_13_1_BETA2

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

@ -3763,6 +3763,8 @@ SECU_StringToSignatureAlgTag(const char *alg)
hashAlgTag = SEC_OID_MD5; hashAlgTag = SEC_OID_MD5;
} else if (!PL_strcmp(alg, "SHA1")) { } else if (!PL_strcmp(alg, "SHA1")) {
hashAlgTag = SEC_OID_SHA1; hashAlgTag = SEC_OID_SHA1;
} else if (!PL_strcmp(alg, "SHA224")) {
hashAlgTag = SEC_OID_SHA224;
} else if (!PL_strcmp(alg, "SHA256")) { } else if (!PL_strcmp(alg, "SHA256")) {
hashAlgTag = SEC_OID_SHA256; hashAlgTag = SEC_OID_SHA256;
} else if (!PL_strcmp(alg, "SHA384")) { } else if (!PL_strcmp(alg, "SHA384")) {

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

@ -550,6 +550,7 @@ seckey_GetKeyType (SECOidTag tag) {
* should be handing us a cipher type */ * should be handing us a cipher type */
case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:

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

@ -37,7 +37,7 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: secsign.c,v 1.26 2011/07/24 13:48:12 wtc%google.com Exp $ */ /* $Id: secsign.c,v 1.27 2011/10/22 14:35:42 wtc%google.com Exp $ */
#include <stdio.h> #include <stdio.h>
#include "cryptohi.h" #include "cryptohi.h"
@ -478,6 +478,8 @@ SEC_GetSignatureAlgorithmOidTag(KeyType keyType, SECOidTag hashAlgTag)
case SEC_OID_UNKNOWN: /* default for RSA if not specified */ case SEC_OID_UNKNOWN: /* default for RSA if not specified */
case SEC_OID_SHA1: case SEC_OID_SHA1:
sigTag = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION; break; sigTag = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION; break;
case SEC_OID_SHA224:
sigTag = SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION; break;
case SEC_OID_SHA256: case SEC_OID_SHA256:
sigTag = SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION; break; sigTag = SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION; break;
case SEC_OID_SHA384: case SEC_OID_SHA384:
@ -502,6 +504,8 @@ SEC_GetSignatureAlgorithmOidTag(KeyType keyType, SECOidTag hashAlgTag)
case SEC_OID_UNKNOWN: /* default for ECDSA if not specified */ case SEC_OID_UNKNOWN: /* default for ECDSA if not specified */
case SEC_OID_SHA1: case SEC_OID_SHA1:
sigTag = SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE; break; sigTag = SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE; break;
case SEC_OID_SHA224:
sigTag = SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE; break;
case SEC_OID_SHA256: case SEC_OID_SHA256:
sigTag = SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE; break; sigTag = SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE; break;
case SEC_OID_SHA384: case SEC_OID_SHA384:

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

@ -37,7 +37,7 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: secvfy.c,v 1.24 2010/06/23 02:13:56 wtc%google.com Exp $ */ /* $Id: secvfy.c,v 1.25 2011/10/22 14:35:42 wtc%google.com Exp $ */
#include <stdio.h> #include <stdio.h>
#include "cryptohi.h" #include "cryptohi.h"
@ -241,6 +241,10 @@ sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg,
*hashalg = SEC_OID_UNKNOWN; /* get it from the RSA signature */ *hashalg = SEC_OID_UNKNOWN; /* get it from the RSA signature */
break; break;
case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE:
case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION:
*hashalg = SEC_OID_SHA224;
break;
case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE: case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE:
case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
*hashalg = SEC_OID_SHA256; *hashalg = SEC_OID_SHA256;
@ -276,9 +280,7 @@ sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg,
if (len < 28) { /* 28 bytes == 224 bits */ if (len < 28) { /* 28 bytes == 224 bits */
*hashalg = SEC_OID_SHA1; *hashalg = SEC_OID_SHA1;
} else if (len < 32) { /* 32 bytes == 256 bits */ } else if (len < 32) { /* 32 bytes == 256 bits */
/* SHA 224 not supported in NSS */ *hashalg = SEC_OID_SHA224;
PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
return SECFailure;
} else if (len < 48) { /* 48 bytes == 384 bits */ } else if (len < 48) { /* 48 bytes == 384 bits */
*hashalg = SEC_OID_SHA256; *hashalg = SEC_OID_SHA256;
} else if (len < 64) { /* 48 bytes == 512 bits */ } else if (len < 64) { /* 48 bytes == 512 bits */
@ -323,6 +325,7 @@ sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg,
case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
case SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE: case SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE:
case SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE: case SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE:
case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:
@ -344,6 +347,7 @@ sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg,
*encalg = SEC_OID_MISSI_DSS; *encalg = SEC_OID_MISSI_DSS;
break; break;
case SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE: case SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE:
case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE:
case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE: case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE:
case SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE: case SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE:
case SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE: case SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE:

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

@ -563,6 +563,7 @@ PK11_GetKeyGenWithSize(CK_MECHANISM_TYPE type, int size)
case CKM_MD2_RSA_PKCS: case CKM_MD2_RSA_PKCS:
case CKM_MD5_RSA_PKCS: case CKM_MD5_RSA_PKCS:
case CKM_SHA1_RSA_PKCS: case CKM_SHA1_RSA_PKCS:
case CKM_SHA224_RSA_PKCS:
case CKM_SHA256_RSA_PKCS: case CKM_SHA256_RSA_PKCS:
case CKM_SHA384_RSA_PKCS: case CKM_SHA384_RSA_PKCS:
case CKM_SHA512_RSA_PKCS: case CKM_SHA512_RSA_PKCS:
@ -596,6 +597,8 @@ PK11_GetKeyGenWithSize(CK_MECHANISM_TYPE type, int size)
return CKM_SSL3_PRE_MASTER_KEY_GEN; return CKM_SSL3_PRE_MASTER_KEY_GEN;
case CKM_SHA_1_HMAC: case CKM_SHA_1_HMAC:
case CKM_SHA_1_HMAC_GENERAL: case CKM_SHA_1_HMAC_GENERAL:
case CKM_SHA224_HMAC:
case CKM_SHA224_HMAC_GENERAL:
case CKM_SHA256_HMAC: case CKM_SHA256_HMAC:
case CKM_SHA256_HMAC_GENERAL: case CKM_SHA256_HMAC_GENERAL:
case CKM_SHA384_HMAC: case CKM_SHA384_HMAC:

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

@ -59,7 +59,7 @@
/* /*
* This array helps parsing between names, mechanisms, and flags. * This array helps parsing between names, mechanisms, and flags.
* to make the config files understand more entries, add them * to make the config files understand more entries, add them
* to this table. (NOTE: we need function to export this table and it's size) * to this table. (NOTE: we need function to export this table and its size)
*/ */
PK11DefaultArrayEntry PK11_DefaultArray[] = { PK11DefaultArrayEntry PK11_DefaultArray[] = {
{ "RSA", SECMOD_RSA_FLAG, CKM_RSA_PKCS }, { "RSA", SECMOD_RSA_FLAG, CKM_RSA_PKCS },
@ -73,6 +73,7 @@ PK11DefaultArrayEntry PK11_DefaultArray[] = {
{ "SEED", SECMOD_SEED_FLAG, CKM_SEED_CBC }, { "SEED", SECMOD_SEED_FLAG, CKM_SEED_CBC },
{ "RC5", SECMOD_RC5_FLAG, CKM_RC5_CBC }, { "RC5", SECMOD_RC5_FLAG, CKM_RC5_CBC },
{ "SHA-1", SECMOD_SHA1_FLAG, CKM_SHA_1 }, { "SHA-1", SECMOD_SHA1_FLAG, CKM_SHA_1 },
/* { "SHA224", SECMOD_SHA256_FLAG, CKM_SHA224 }, */
{ "SHA256", SECMOD_SHA256_FLAG, CKM_SHA256 }, { "SHA256", SECMOD_SHA256_FLAG, CKM_SHA256 },
/* { "SHA384", SECMOD_SHA512_FLAG, CKM_SHA384 }, */ /* { "SHA384", SECMOD_SHA512_FLAG, CKM_SHA384 }, */
{ "SHA512", SECMOD_SHA512_FLAG, CKM_SHA512 }, { "SHA512", SECMOD_SHA512_FLAG, CKM_SHA512 },
@ -857,6 +858,7 @@ PK11_GetSlotList(CK_MECHANISM_TYPE type)
return &pk11_rc5SlotList; return &pk11_rc5SlotList;
case CKM_SHA_1: case CKM_SHA_1:
return &pk11_sha1SlotList; return &pk11_sha1SlotList;
case CKM_SHA224:
case CKM_SHA256: case CKM_SHA256:
return &pk11_sha256SlotList; return &pk11_sha256SlotList;
case CKM_SHA384: case CKM_SHA384:
@ -2024,6 +2026,7 @@ PK11_GetBestSlotMultiple(CK_MECHANISM_TYPE *type, int mech_count, void *wincx)
for (i=0; i < mech_count; i++) { for (i=0; i < mech_count; i++) {
if ((type[i] != CKM_FAKE_RANDOM) && if ((type[i] != CKM_FAKE_RANDOM) &&
(type[i] != CKM_SHA_1) && (type[i] != CKM_SHA_1) &&
(type[i] != CKM_SHA224) &&
(type[i] != CKM_SHA256) && (type[i] != CKM_SHA256) &&
(type[i] != CKM_SHA384) && (type[i] != CKM_SHA384) &&
(type[i] != CKM_SHA512) && (type[i] != CKM_SHA512) &&

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

@ -62,6 +62,8 @@ sec_pkcs12_algtag_to_mech(SECOidTag algtag)
return CKM_MD5_HMAC; return CKM_MD5_HMAC;
case SEC_OID_SHA1: case SEC_OID_SHA1:
return CKM_SHA_1_HMAC; return CKM_SHA_1_HMAC;
case SEC_OID_SHA224:
return CKM_SHA224_HMAC;
case SEC_OID_SHA256: case SEC_OID_SHA256:
return CKM_SHA256_HMAC; return CKM_SHA256_HMAC;
case SEC_OID_SHA384: case SEC_OID_SHA384:

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

@ -38,7 +38,7 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: rsawrapr.c,v 1.18 2011/10/04 22:05:53 wtc%google.com Exp $ */ /* $Id: rsawrapr.c,v 1.19 2011/10/22 14:35:43 wtc%google.com Exp $ */
#include "blapi.h" #include "blapi.h"
#include "softoken.h" #include "softoken.h"
@ -1169,11 +1169,13 @@ emsa_pss_verify(const unsigned char *mHash,
static HASH_HashType static HASH_HashType
GetHashTypeFromMechanism(CK_MECHANISM_TYPE mech) GetHashTypeFromMechanism(CK_MECHANISM_TYPE mech)
{ {
/* TODO(wtc): add SHA-224. */
switch (mech) { switch (mech) {
case CKM_SHA_1: case CKM_SHA_1:
case CKG_MGF1_SHA1: case CKG_MGF1_SHA1:
return HASH_AlgSHA1; return HASH_AlgSHA1;
case CKM_SHA224:
case CKG_MGF1_SHA224:
return HASH_AlgSHA224;
case CKM_SHA256: case CKM_SHA256:
case CKG_MGF1_SHA256: case CKG_MGF1_SHA256:
return HASH_AlgSHA256; return HASH_AlgSHA256;

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

@ -40,7 +40,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* ECC code moved here from ssl3con.c */ /* ECC code moved here from ssl3con.c */
/* $Id: ssl3ecc.c,v 1.24 2010/03/15 08:03:14 nelson%bolyard.com Exp $ */ /* $Id: ssl3ecc.c,v 1.25 2011/10/22 14:35:44 wtc%google.com Exp $ */
#include "nss.h" #include "nss.h"
#include "cert.h" #include "cert.h"
@ -968,6 +968,7 @@ ssl3_FilterECCipherSuitesByServerCerts(sslSocket * ss)
case SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:

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

@ -38,7 +38,6 @@
#include "prinit.h" #include "prinit.h"
#include "nssutil.h" #include "nssutil.h"
#include "ssl.h" #include "ssl.h"
#include "sslerrstrs.h"
#define ER3(name, value, str) {#name, str}, #define ER3(name, value, str) {#name, str},
@ -59,8 +58,9 @@ ssl_InitializePRErrorTableOnce(void) {
static PRCallOnceType once; static PRCallOnceType once;
PRStatus SECStatus
ssl_InitializePRErrorTable(void) ssl_InitializePRErrorTable(void)
{ {
return PR_CallOnce(&once, ssl_InitializePRErrorTableOnce); return (PR_SUCCESS == PR_CallOnce(&once, ssl_InitializePRErrorTableOnce))
? SECSuccess : SECFailure;
} }

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

@ -1,53 +0,0 @@
/*
* This file contains prototypes for the public SSL functions.
*
* ***** 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 security libraries.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1994-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 ***** */
/* $Id: sslerrstrs.h,v 1.1 2011/08/17 14:41:02 emaldona%redhat.com Exp $ */
#ifndef __sslerrstrs_h_
#define __sslerrstrs_h_
#include "prtypes.h"
SEC_BEGIN_PROTOS
extern PRStatus
ssl_InitializePRErrorTable(void);
SEC_END_PROTOS
#endif /* __sslerrstrs_h_ */

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

@ -39,7 +39,7 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: sslimpl.h,v 1.83 2011/10/01 03:59:54 bsmith%mozilla.com Exp $ */ /* $Id: sslimpl.h,v 1.84 2011/10/22 16:45:40 emaldona%redhat.com Exp $ */
#ifndef __sslimpl_h_ #ifndef __sslimpl_h_
#define __sslimpl_h_ #define __sslimpl_h_
@ -1151,6 +1151,10 @@ extern sslSessionIDUncacheFunc ssl_sid_uncache;
SEC_BEGIN_PROTOS SEC_BEGIN_PROTOS
/* Internal initialization and installation of the SSL error tables */
extern SECStatus ssl_Init(void);
extern SECStatus ssl_InitializePRErrorTable(void);
/* Implementation of ops for default (non socks, non secure) case */ /* Implementation of ops for default (non socks, non secure) case */
extern int ssl_DefConnect(sslSocket *ss, const PRNetAddr *addr); extern int ssl_DefConnect(sslSocket *ss, const PRNetAddr *addr);
extern PRFileDesc *ssl_DefAccept(sslSocket *ss, PRNetAddr *addr); extern PRFileDesc *ssl_DefAccept(sslSocket *ss, PRNetAddr *addr);

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

@ -36,14 +36,14 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: sslinit.c,v 1.1 2011/08/17 14:41:05 emaldona%redhat.com Exp $ */ /* $Id: sslinit.c,v 1.2 2011/10/22 16:45:40 emaldona%redhat.com Exp $ */
#include "prtypes.h" #include "prtypes.h"
#include "prinit.h" #include "prinit.h"
#include "seccomon.h" #include "seccomon.h"
#include "secerr.h" #include "secerr.h"
#include "ssl.h" #include "ssl.h"
#include "sslerrstrs.h" #include "sslimpl.h"
static int ssl_inited = 0; static int ssl_inited = 0;
@ -51,8 +51,9 @@ SECStatus
ssl_Init(void) ssl_Init(void)
{ {
if (!ssl_inited) { if (!ssl_inited) {
if (ssl_InitializePRErrorTable() == PR_FAILURE) { if (ssl_InitializePRErrorTable() != SECSuccess) {
return (SEC_ERROR_NO_MEMORY); PORT_SetError(SEC_ERROR_NO_MEMORY);
return (SECFailure);
} }
ssl_inited = 1; ssl_inited = 1;
} }

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

@ -36,7 +36,7 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: sslsnce.c,v 1.58 2011/10/01 00:11:02 wtc%google.com Exp $ */ /* $Id: sslsnce.c,v 1.59 2011/10/22 16:45:40 emaldona%redhat.com Exp $ */
/* Note: ssl_FreeSID() in sslnonce.c gets used for both client and server /* Note: ssl_FreeSID() in sslnonce.c gets used for both client and server
* cache sids! * cache sids!
@ -83,7 +83,6 @@
#include "ssl.h" #include "ssl.h"
#include "sslimpl.h" #include "sslimpl.h"
#include "sslproto.h" #include "sslproto.h"
#include "sslutil.h"
#include "pk11func.h" #include "pk11func.h"
#include "base64.h" #include "base64.h"
#include "keyhi.h" #include "keyhi.h"

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

@ -40,14 +40,13 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: sslsock.c,v 1.74 2011/10/06 22:42:34 wtc%google.com Exp $ */ /* $Id: sslsock.c,v 1.75 2011/10/22 16:45:40 emaldona%redhat.com Exp $ */
#include "seccomon.h" #include "seccomon.h"
#include "cert.h" #include "cert.h"
#include "keyhi.h" #include "keyhi.h"
#include "ssl.h" #include "ssl.h"
#include "sslimpl.h" #include "sslimpl.h"
#include "sslproto.h" #include "sslproto.h"
#include "sslutil.h"
#include "nspr.h" #include "nspr.h"
#include "private/pprio.h" #include "private/pprio.h"
#include "blapi.h" #include "blapi.h"

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

@ -1,53 +0,0 @@
/*
* This file contains prototypes for the public SSL functions.
*
* ***** 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 security libraries.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1994-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 ***** */
/* $Id: sslutil.h,v 1.1 2011/08/17 14:41:20 emaldona%redhat.com Exp $ */
#ifndef __sslutil_h_
#define __sslutil_h_
#include "prtypes.h"
SEC_BEGIN_PROTOS
extern PRStatus SSL_InitializePRErrorTable(void);
extern SECStatus ssl_Init(void);
SEC_END_PROTOS
#endif /* __sslutil_h_ */

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

@ -70,6 +70,7 @@ SECOID_SetAlgorithmID(PRArenaPool *arena, SECAlgorithmID *id, SECOidTag which,
case SEC_OID_MD4: case SEC_OID_MD4:
case SEC_OID_MD5: case SEC_OID_MD5:
case SEC_OID_SHA1: case SEC_OID_SHA1:
case SEC_OID_SHA224:
case SEC_OID_SHA256: case SEC_OID_SHA256:
case SEC_OID_SHA384: case SEC_OID_SHA384:
case SEC_OID_SHA512: case SEC_OID_SHA512:
@ -78,6 +79,7 @@ SECOID_SetAlgorithmID(PRArenaPool *arena, SECAlgorithmID *id, SECOidTag which,
case SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:

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

@ -815,7 +815,7 @@ overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/brows
options.profilePath, "mochikit@mozilla.org") options.profilePath, "mochikit@mozilla.org")
# Write chrome.manifest. # Write chrome.manifest.
with open(os.path.join(options.profilePath, "extensions", "mochikit@mozilla.org", "chrome.manifest"), "a") as mfile: with open(os.path.join(options.profilePath, "extensions", "staged", "mochikit@mozilla.org", "chrome.manifest"), "a") as mfile:
mfile.write(chrome) mfile.write(chrome)
def copyTestsJarToProfile(self, options): def copyTestsJarToProfile(self, options):

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

@ -235,3 +235,5 @@ HISTOGRAM(THUNDERBIRD_INDEXING_RATE_MSG_PER_S, 1, 100, 20, LINEAR, "Gloda: index
#endif #endif
HISTOGRAM(INNERWINDOWS_WITH_MUTATION_LISTENERS, 0, 1, 2, BOOLEAN, "Deleted or to-be-reused innerwindow which has had mutation event listeners.") HISTOGRAM(INNERWINDOWS_WITH_MUTATION_LISTENERS, 0, 1, 2, BOOLEAN, "Deleted or to-be-reused innerwindow which has had mutation event listeners.")
HISTOGRAM(XUL_REFLOW_MS, 1, 3000, 10, EXPONENTIAL, "xul reflows")
HISTOGRAM(XUL_INITIAL_FRAME_CONSTRUCTION, 1, 3000, 10, EXPONENTIAL, "initial xul frame construction")

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

@ -60,6 +60,15 @@ const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url
const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL"; const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url"; const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
const PREF_CHECK_COMPATIBILITY_BASE = "extensions.checkCompatibility";
#ifdef MOZ_COMPATIBILITY_NIGHTLY
const PREF_CHECK_COMPATIBILITY = PREF_CHECK_COMPATIBILITY_BASE +
".nightly";
#else
const PREF_CHECK_COMPATIBILITY = PREF_CHECK_COMPATIBILITY_BASE + "." +
Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
#endif
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
const API_VERSION = "1.5"; const API_VERSION = "1.5";
@ -810,13 +819,23 @@ var AddonRepository = {
* The callback to pass results to * The callback to pass results to
*/ */
searchAddons: function(aSearchTerms, aMaxResults, aCallback) { searchAddons: function(aSearchTerms, aMaxResults, aCallback) {
let url = this._formatURLPref(PREF_GETADDONS_GETSEARCHRESULTS, { let substitutions = {
API_VERSION : API_VERSION, API_VERSION : API_VERSION,
TERMS : encodeURIComponent(aSearchTerms), TERMS : encodeURIComponent(aSearchTerms),
// Get twice as many results to account for potential filtering // Get twice as many results to account for potential filtering
MAX_RESULTS : 2 * aMaxResults MAX_RESULTS : 2 * aMaxResults
}); };
let checkCompatibility = true;
try {
checkCompatibility = Services.prefs.getBoolPref(PREF_CHECK_COMPATIBILITY);
} catch(e) { }
if (!checkCompatibility)
substitutions.VERSION = "";
let url = this._formatURLPref(PREF_GETADDONS_GETSEARCHRESULTS, substitutions);
let self = this; let self = this;
function handleResults(aElements, aTotalResults) { function handleResults(aElements, aTotalResults) {
@ -1079,17 +1098,26 @@ var AddonRepository = {
_parseAddons: function(aElements, aTotalResults, aSkip) { _parseAddons: function(aElements, aTotalResults, aSkip) {
let self = this; let self = this;
let results = []; let results = [];
let checkCompatibility = true;
try {
checkCompatibility = Services.prefs.getBoolPref(PREF_CHECK_COMPATIBILITY);
} catch(e) { }
function isSameApplication(aAppNode) {
return self._getTextContent(aAppNode) == Services.appinfo.ID;
}
for (let i = 0; i < aElements.length && results.length < this._maxResults; i++) { for (let i = 0; i < aElements.length && results.length < this._maxResults; i++) {
let element = aElements[i]; let element = aElements[i];
// Ignore add-ons not compatible with this Application
let tags = this._getUniqueDescendant(element, "compatible_applications"); let tags = this._getUniqueDescendant(element, "compatible_applications");
if (tags == null) if (tags == null)
continue; continue;
let applications = tags.getElementsByTagName("appID"); let applications = tags.getElementsByTagName("appID");
let compatible = Array.some(applications, function(aAppNode) { let compatible = Array.some(applications, function(aAppNode) {
if (self._getTextContent(aAppNode) != Services.appinfo.ID) if (!isSameApplication(aAppNode))
return false; return false;
let parent = aAppNode.parentNode; let parent = aAppNode.parentNode;
@ -1103,9 +1131,15 @@ var AddonRepository = {
Services.vc.compare(currentVersion, maxVersion) <= 0); Services.vc.compare(currentVersion, maxVersion) <= 0);
}); });
if (!compatible) // Ignore add-ons not compatible with this Application
if (!compatible) {
if (checkCompatibility)
continue; continue;
if (!Array.some(applications, isSameApplication))
continue;
}
// Add-on meets all requirements, so parse out data // Add-on meets all requirements, so parse out data
let result = this._parseAddon(element, aSkip); let result = this._parseAddon(element, aSkip);
if (result == null) if (result == null)
@ -1125,6 +1159,8 @@ var AddonRepository = {
if (!result.xpiURL && !result.addon.purchaseURL) if (!result.xpiURL && !result.addon.purchaseURL)
continue; continue;
result.addon.isCompatible = compatible;
results.push(result); results.push(result);
// Ignore this add-on from now on by adding it to the skip array // Ignore this add-on from now on by adding it to the skip array
aSkip.ids.push(result.addon.id); aSkip.ids.push(result.addon.id);

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

@ -556,6 +556,10 @@ AddonWrapper.prototype = {
return AddonManager.SCOPE_PROFILE; return AddonManager.SCOPE_PROFILE;
}, },
get foreignInstall() {
return false;
},
// Lightweight themes are always compatible // Lightweight themes are always compatible
isCompatibleWith: function(appVersion, platformVersion) { isCompatibleWith: function(appVersion, platformVersion) {
return true; return true;

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

@ -339,6 +339,10 @@ PluginWrapper.prototype = {
return true; return true;
}, },
get foreignInstall() {
return true;
},
isCompatibleWith: function(aAppVerison, aPlatformVersion) { isCompatibleWith: function(aAppVerison, aPlatformVersion) {
return true; return true;
}, },

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

@ -122,7 +122,7 @@ const TOOLKIT_ID = "toolkit@mozilla.org";
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi; const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
const DB_SCHEMA = 5; const DB_SCHEMA = 6;
const REQ_VERSION = 2; const REQ_VERSION = 2;
#ifdef MOZ_COMPATIBILITY_NIGHTLY #ifdef MOZ_COMPATIBILITY_NIGHTLY
@ -146,7 +146,7 @@ const DB_METADATA = ["installDate", "updateDate", "size", "sourceURI",
"releaseNotesURI", "applyBackgroundUpdates"]; "releaseNotesURI", "applyBackgroundUpdates"];
const DB_BOOL_METADATA = ["visible", "active", "userDisabled", "appDisabled", const DB_BOOL_METADATA = ["visible", "active", "userDisabled", "appDisabled",
"pendingUninstall", "bootstrap", "skinnable", "pendingUninstall", "bootstrap", "skinnable",
"softDisabled"]; "softDisabled", "foreignInstall"];
const BOOTSTRAP_REASONS = { const BOOTSTRAP_REASONS = {
APP_STARTUP : 1, APP_STARTUP : 1,
@ -2556,10 +2556,16 @@ var XPIProvider = {
newAddon = aManifests[aInstallLocation.name][aId]; newAddon = aManifests[aInstallLocation.name][aId];
try { try {
// Otherwise load the manifest from the add-on // Otherwise the add-on has appeared in the install location.
if (!newAddon) { if (!newAddon) {
// Load the manifest from the add-on.
let file = aInstallLocation.getLocationForID(aId); let file = aInstallLocation.getLocationForID(aId);
newAddon = loadManifestFromFile(file); newAddon = loadManifestFromFile(file);
// The default theme is never a foreign install
if (newAddon.type != "theme" || newAddon.internalName != XPIProvider.defaultSkin)
newAddon.foreignInstall = true;
} }
// The add-on in the manifest should match the add-on ID. // The add-on in the manifest should match the add-on ID.
if (newAddon.id != aId) if (newAddon.id != aId)
@ -2583,9 +2589,10 @@ var XPIProvider = {
newAddon.installDate = aAddonState.mtime; newAddon.installDate = aAddonState.mtime;
newAddon.updateDate = aAddonState.mtime; newAddon.updateDate = aAddonState.mtime;
// Check if the add-on is in a scope where add-ons should install disabled // Check if the add-on is a foreign install and is in a scope where
// add-ons that were dropped in should default to disabled.
let disablingScopes = Prefs.getIntPref(PREF_EM_AUTO_DISABLED_SCOPES, 0); let disablingScopes = Prefs.getIntPref(PREF_EM_AUTO_DISABLED_SCOPES, 0);
if (aInstallLocation.scope & disablingScopes) if (newAddon.foreignInstall && aInstallLocation.scope & disablingScopes)
newAddon.userDisabled = true; newAddon.userDisabled = true;
// If there is migration data then apply it. // If there is migration data then apply it.
@ -2605,6 +2612,8 @@ var XPIProvider = {
newAddon.sourceURI = aMigrateData.sourceURI; newAddon.sourceURI = aMigrateData.sourceURI;
if ("releaseNotesURI" in aMigrateData) if ("releaseNotesURI" in aMigrateData)
newAddon.releaseNotesURI = aMigrateData.releaseNotesURI; newAddon.releaseNotesURI = aMigrateData.releaseNotesURI;
if ("foreignInstall" in aMigrateData)
newAddon.foreignInstall = aMigrateData.foreignInstall;
// Some properties should only be migrated if the add-on hasn't changed. // Some properties should only be migrated if the add-on hasn't changed.
// The version property isn't a perfect check for this but covers the // The version property isn't a perfect check for this but covers the
@ -3860,7 +3869,8 @@ const FIELDS_ADDON = "internal_id, id, location, version, type, internalName, "
"iconURL, icon64URL, defaultLocale, visible, active, " + "iconURL, icon64URL, defaultLocale, visible, active, " +
"userDisabled, appDisabled, pendingUninstall, descriptor, " + "userDisabled, appDisabled, pendingUninstall, descriptor, " +
"installDate, updateDate, applyBackgroundUpdates, bootstrap, " + "installDate, updateDate, applyBackgroundUpdates, bootstrap, " +
"skinnable, size, sourceURI, releaseNotesURI, softDisabled"; "skinnable, size, sourceURI, releaseNotesURI, softDisabled, " +
"foreignInstall";
/** /**
* A helper function to log an SQL error. * A helper function to log an SQL error.
@ -4005,7 +4015,8 @@ var XPIDatabase = {
":userDisabled, :appDisabled, :pendingUninstall, " + ":userDisabled, :appDisabled, :pendingUninstall, " +
":descriptor, :installDate, :updateDate, " + ":descriptor, :installDate, :updateDate, " +
":applyBackgroundUpdates, :bootstrap, :skinnable, " + ":applyBackgroundUpdates, :bootstrap, :skinnable, " +
":size, :sourceURI, :releaseNotesURI, :softDisabled)", ":size, :sourceURI, :releaseNotesURI, :softDisabled, " +
":foreignInstall)",
addAddonMetadata_addon_locale: "INSERT INTO addon_locale VALUES " + addAddonMetadata_addon_locale: "INSERT INTO addon_locale VALUES " +
"(:internal_id, :name, :locale)", "(:internal_id, :name, :locale)",
addAddonMetadata_locale: "INSERT INTO locale (name, description, creator, " + addAddonMetadata_locale: "INSERT INTO locale (name, description, creator, " +
@ -4371,6 +4382,9 @@ var XPIDatabase = {
// Build a list of sql statements that might recover useful data from this // Build a list of sql statements that might recover useful data from this
// and future versions of the schema // and future versions of the schema
var sql = []; var sql = [];
sql.push("SELECT internal_id, id, location, userDisabled, " +
"softDisabled, installDate, version, applyBackgroundUpdates, " +
"sourceURI, releaseNotesURI, foreignInstall FROM addon");
sql.push("SELECT internal_id, id, location, userDisabled, " + sql.push("SELECT internal_id, id, location, userDisabled, " +
"softDisabled, installDate, version, applyBackgroundUpdates, " + "softDisabled, installDate, version, applyBackgroundUpdates, " +
"sourceURI, releaseNotesURI FROM addon"); "sourceURI, releaseNotesURI FROM addon");
@ -4413,6 +4427,8 @@ var XPIDatabase = {
migrateData[row.location][row.id].sourceURI = row.sourceURI; migrateData[row.location][row.id].sourceURI = row.sourceURI;
if ("releaseNotesURI" in row) if ("releaseNotesURI" in row)
migrateData[row.location][row.id].releaseNotesURI = row.releaseNotesURI; migrateData[row.location][row.id].releaseNotesURI = row.releaseNotesURI;
if ("foreignInstall" in row)
migrateData[row.location][row.id].foreignInstall = row.foreignInstall;
} }
var taStmt = this.connection.createStatement("SELECT id, minVersion, " + var taStmt = this.connection.createStatement("SELECT id, minVersion, " +
@ -4533,6 +4549,7 @@ var XPIDatabase = {
"bootstrap INTEGER, skinnable INTEGER, " + "bootstrap INTEGER, skinnable INTEGER, " +
"size INTEGER, sourceURI TEXT, " + "size INTEGER, sourceURI TEXT, " +
"releaseNotesURI TEXT, softDisabled INTEGER, " + "releaseNotesURI TEXT, softDisabled INTEGER, " +
"foreignInstall INTEGER, " +
"UNIQUE (id, location)"); "UNIQUE (id, location)");
this.connection.createTable("targetApplication", this.connection.createTable("targetApplication",
"addon_internal_id INTEGER, " + "addon_internal_id INTEGER, " +
@ -5207,6 +5224,7 @@ var XPIDatabase = {
this.removeAddonMetadata(aOldAddon); this.removeAddonMetadata(aOldAddon);
aNewAddon.installDate = aOldAddon.installDate; aNewAddon.installDate = aOldAddon.installDate;
aNewAddon.applyBackgroundUpdates = aOldAddon.applyBackgroundUpdates; aNewAddon.applyBackgroundUpdates = aOldAddon.applyBackgroundUpdates;
aNewAddon.foreignInstall = aOldAddon.foreignInstall;
aNewAddon.active = (aNewAddon.visible && !aNewAddon.userDisabled && aNewAddon.active = (aNewAddon.visible && !aNewAddon.userDisabled &&
!aNewAddon.appDisabled) !aNewAddon.appDisabled)
this.addAddonMetadata(aNewAddon, aDescriptor); this.addAddonMetadata(aNewAddon, aDescriptor);
@ -6822,6 +6840,7 @@ AddonInternal.prototype = {
softDisabled: false, softDisabled: false,
sourceURI: null, sourceURI: null,
releaseNotesURI: null, releaseNotesURI: null,
foreignInstall: false,
get selectedLocale() { get selectedLocale() {
if (this._selectedLocale) if (this._selectedLocale)
@ -7094,7 +7113,7 @@ function AddonWrapper(aAddon) {
["id", "version", "type", "isCompatible", "isPlatformCompatible", ["id", "version", "type", "isCompatible", "isPlatformCompatible",
"providesUpdatesSecurely", "blocklistState", "blocklistURL", "appDisabled", "providesUpdatesSecurely", "blocklistState", "blocklistURL", "appDisabled",
"softDisabled", "skinnable", "size"].forEach(function(aProp) { "softDisabled", "skinnable", "size", "foreignInstall"].forEach(function(aProp) {
this.__defineGetter__(aProp, function() aAddon[aProp]); this.__defineGetter__(aProp, function() aAddon[aProp]);
}, this); }, this);

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

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>addon7@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<!-- Front End MetaData -->
<em:name>Test 7</em:name>
<em:description>Test Description</em:description>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>2</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

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

@ -589,6 +589,22 @@ add_test(function() {
}); });
}); });
// Tests that incompatible add-ons are shown with a warning if compatibility checking is disabled
add_test(function() {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
search("incompatible", false, function() {
var item = get_addon_item("remote5");
is_element_visible(item, "Incompatible addon should be visible");
is(item.getAttribute("notification"), "warning", "Compatibility warning should be shown");
var item = get_addon_item("remote6");
is(item, null, "Addon incompatible with the product should not be visible");
Services.prefs.clearUserPref("extensions.checkCompatibility.nightly");
run_next_test();
});
});
// Tests that restarting the manager doesn't change search results // Tests that restarting the manager doesn't change search results
add_test(function() { add_test(function() {
restart_manager(gManagerWindow, null, function(aWindow) { restart_manager(gManagerWindow, null, function(aWindow) {

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

@ -186,5 +186,61 @@
<compatible_os>ALL</compatible_os> <compatible_os>ALL</compatible_os>
<install size="4">http://example.com/remote4.xpi</install> <install size="4">http://example.com/remote4.xpi</install>
</addon> </addon>
<addon>
<name>PASS - i</name>
<type id='1'>Extension</type>
<guid>remote5@tests.mozilla.org</guid>
<version>6.0</version>
<authors>
<author>
<name>Test Creator</name>
<link>http://example.com/creator.html</link>
</author>
</authors>
<status id='4'>Public</status>
<summary>Incompatible test</summary>
<description>Test description</description>
<compatible_applications>
<application>
<name>Firefox</name>
<appID>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</appID>
<min_version>0</min_version>
<max_version>1</max_version>
</application>
<application>
<name>SeaMonkey</name>
<appID>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</appID>
<min_version>0</min_version>
<max_version>1</max_version>
</application>
</compatible_applications>
<compatible_os>ALL</compatible_os>
<install size="1">http://example.com/addon1.xpi</install>
</addon>
<addon>
<name>FAIL - j</name>
<type id='1'>Extension</type>
<guid>remote6@tests.mozilla.org</guid>
<version>6.0</version>
<authors>
<author>
<name>Test Creator</name>
<link>http://example.com/creator.html</link>
</author>
</authors>
<status id='4'>Public</status>
<summary>Incompatible test</summary>
<description>Test description</description>
<compatible_applications>
<application>
<name>Fake Product</name>
<appID>fakeproduct@mozilla.org</appID>
<min_version>0</min_version>
<max_version>1</max_version>
</application>
</compatible_applications>
<compatible_os>ALL</compatible_os>
<install size="1">http://example.com/addon1.xpi</install>
</addon>
</searchresults> </searchresults>

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

@ -89,6 +89,7 @@ function run_test_1() {
do_check_eq(a1.version, "1.0"); do_check_eq(a1.version, "1.0");
do_check_true(a1.isActive); do_check_true(a1.isActive);
do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE);
do_check_false(a1.foreignInstall);
run_test_2(); run_test_2();
}); });
@ -122,6 +123,7 @@ function run_test_3() {
do_check_eq(a1.version, "2.0"); do_check_eq(a1.version, "2.0");
do_check_true(a1.isActive); do_check_true(a1.isActive);
do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE);
do_check_false(a1.foreignInstall);
run_test_4(); run_test_4();
}); });

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

@ -163,6 +163,7 @@ function check_test_1() {
do_check_true(do_get_addon("test_install1").exists()); do_check_true(do_get_addon("test_install1").exists());
do_check_in_crash_annotation(a1.id, a1.version); do_check_in_crash_annotation(a1.id, a1.version);
do_check_eq(a1.size, ADDON1_SIZE); do_check_eq(a1.size, ADDON1_SIZE);
do_check_false(a1.foreignInstall);
do_check_eq(a1.sourceURI.spec, do_check_eq(a1.sourceURI.spec,
Services.io.newFileURI(do_get_addon("test_install1")).spec); Services.io.newFileURI(do_get_addon("test_install1")).spec);
@ -382,6 +383,7 @@ function check_test_5(install) {
do_check_in_crash_annotation(a2.id, a2.version); do_check_in_crash_annotation(a2.id, a2.version);
do_check_eq(a2.sourceURI.spec, do_check_eq(a2.sourceURI.spec,
"http://localhost:4444/addons/test_install2_2.xpi"); "http://localhost:4444/addons/test_install2_2.xpi");
do_check_false(a2.foreignInstall);
do_check_eq(a2.installDate.getTime(), gInstallDate); do_check_eq(a2.installDate.getTime(), gInstallDate);
// Update date should be later (or the same if this test is too fast) // Update date should be later (or the same if this test is too fast)

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

@ -111,8 +111,9 @@ function prepare_profile() {
a6.userDisabled = true; a6.userDisabled = true;
a6.findUpdates({ a6.findUpdates({
onUpdateAvailable: function(aAddon, aInstall) { onUpdateAvailable: function(aAddon, aInstall6) {
completeAllInstalls([aInstall], function() { AddonManager.getInstallForURL("http://localhost:4444/addons/test_migrate4_7.xpi", function(aInstall7) {
completeAllInstalls([aInstall6, aInstall7], function() {
restartManager(); restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
@ -134,6 +135,7 @@ function prepare_profile() {
}, AddonManager.UPDATE_WHEN_USER_REQUESTED); }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
}); });
}); });
}, "application/x-xpinstall");
} }
}, AddonManager.UPDATE_WHEN_USER_REQUESTED); }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
}); });
@ -166,14 +168,16 @@ function test_results() {
"addon3@tests.mozilla.org", "addon3@tests.mozilla.org",
"addon4@tests.mozilla.org", "addon4@tests.mozilla.org",
"addon5@tests.mozilla.org", "addon5@tests.mozilla.org",
"addon6@tests.mozilla.org"], "addon6@tests.mozilla.org",
function([a1, a2, a3, a4, a5, a6]) { "addon7@tests.mozilla.org"],
function([a1, a2, a3, a4, a5, a6, a7]) {
// addon1 was enabled // addon1 was enabled
do_check_neq(a1, null); do_check_neq(a1, null);
do_check_false(a1.userDisabled); do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled); do_check_false(a1.appDisabled);
do_check_true(a1.isActive); do_check_true(a1.isActive);
do_check_true(a1.applyBackgroundUpdates); do_check_true(a1.applyBackgroundUpdates);
do_check_true(a1.foreignInstall);
// addon2 was disabled // addon2 was disabled
do_check_neq(a2, null); do_check_neq(a2, null);
@ -181,6 +185,7 @@ function test_results() {
do_check_false(a2.appDisabled); do_check_false(a2.appDisabled);
do_check_false(a2.isActive); do_check_false(a2.isActive);
do_check_false(a2.applyBackgroundUpdates); do_check_false(a2.applyBackgroundUpdates);
do_check_true(a2.foreignInstall);
// addon3 was pending-disable in the database // addon3 was pending-disable in the database
do_check_neq(a3, null); do_check_neq(a3, null);
@ -188,6 +193,7 @@ function test_results() {
do_check_false(a3.appDisabled); do_check_false(a3.appDisabled);
do_check_false(a3.isActive); do_check_false(a3.isActive);
do_check_true(a3.applyBackgroundUpdates); do_check_true(a3.applyBackgroundUpdates);
do_check_true(a3.foreignInstall);
// addon4 was pending-enable in the database // addon4 was pending-enable in the database
do_check_neq(a4, null); do_check_neq(a4, null);
@ -195,6 +201,7 @@ function test_results() {
do_check_false(a4.appDisabled); do_check_false(a4.appDisabled);
do_check_true(a4.isActive); do_check_true(a4.isActive);
do_check_true(a4.applyBackgroundUpdates); do_check_true(a4.applyBackgroundUpdates);
do_check_true(a4.foreignInstall);
// addon5 was enabled in the database but needed a compatibiltiy update // addon5 was enabled in the database but needed a compatibiltiy update
do_check_neq(a5, null); do_check_neq(a5, null);
@ -202,6 +209,7 @@ function test_results() {
do_check_false(a5.appDisabled); do_check_false(a5.appDisabled);
do_check_true(a5.isActive); do_check_true(a5.isActive);
do_check_true(a5.applyBackgroundUpdates); do_check_true(a5.applyBackgroundUpdates);
do_check_true(a5.foreignInstall);
// addon6 was disabled and compatible but a new version has been installed // addon6 was disabled and compatible but a new version has been installed
do_check_neq(a6, null); do_check_neq(a6, null);
@ -210,8 +218,20 @@ function test_results() {
do_check_false(a6.appDisabled); do_check_false(a6.appDisabled);
do_check_false(a6.isActive); do_check_false(a6.isActive);
do_check_true(a6.applyBackgroundUpdates); do_check_true(a6.applyBackgroundUpdates);
do_check_true(a6.foreignInstall);
do_check_eq(a6.sourceURI.spec, "http://localhost:4444/addons/test_migrate4_6.xpi"); do_check_eq(a6.sourceURI.spec, "http://localhost:4444/addons/test_migrate4_6.xpi");
do_check_eq(a6.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml"); do_check_eq(a6.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
// addon7 was installed manually
do_check_neq(a7, null);
do_check_eq(a7.version, "1.0");
do_check_false(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_true(a7.isActive);
do_check_true(a7.applyBackgroundUpdates);
do_check_false(a7.foreignInstall);
do_check_eq(a7.sourceURI.spec, "http://localhost:4444/addons/test_migrate4_7.xpi");
do_check_eq(a7.releaseNotesURI, null);
testserver.stop(do_test_finished); testserver.stop(do_test_finished);
}); });
} }

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

@ -202,6 +202,7 @@ function run_test_1() {
do_check_in_crash_annotation(addon1.id, addon1.version); do_check_in_crash_annotation(addon1.id, addon1.version);
do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE);
do_check_eq(a1.sourceURI, null); do_check_eq(a1.sourceURI, null);
do_check_true(a1.foreignInstall);
do_check_neq(a2, null); do_check_neq(a2, null);
do_check_eq(a2.id, "addon2@tests.mozilla.org"); do_check_eq(a2.id, "addon2@tests.mozilla.org");
@ -213,6 +214,7 @@ function run_test_1() {
do_check_in_crash_annotation(addon2.id, addon2.version); do_check_in_crash_annotation(addon2.id, addon2.version);
do_check_eq(a2.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a2.scope, AddonManager.SCOPE_PROFILE);
do_check_eq(a2.sourceURI, null); do_check_eq(a2.sourceURI, null);
do_check_true(a2.foreignInstall);
do_check_neq(a3, null); do_check_neq(a3, null);
do_check_eq(a3.id, "addon3@tests.mozilla.org"); do_check_eq(a3.id, "addon3@tests.mozilla.org");
@ -224,6 +226,7 @@ function run_test_1() {
do_check_in_crash_annotation(addon3.id, addon3.version); do_check_in_crash_annotation(addon3.id, addon3.version);
do_check_eq(a3.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a3.scope, AddonManager.SCOPE_PROFILE);
do_check_eq(a3.sourceURI, null); do_check_eq(a3.sourceURI, null);
do_check_true(a3.foreignInstall);
do_check_eq(a4, null); do_check_eq(a4, null);
do_check_false(isExtensionInAddonsList(profileDir, "addon4@tests.mozilla.org")); do_check_false(isExtensionInAddonsList(profileDir, "addon4@tests.mozilla.org"));
@ -297,6 +300,7 @@ function run_test_2() {
do_check_true(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE)); do_check_true(hasFlag(a1.permissions, AddonManager.PERM_CAN_UPGRADE));
do_check_in_crash_annotation(addon1.id, a1.version); do_check_in_crash_annotation(addon1.id, a1.version);
do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a1.scope, AddonManager.SCOPE_PROFILE);
do_check_true(a1.foreignInstall);
do_check_neq(a2, null); do_check_neq(a2, null);
do_check_eq(a2.id, "addon2@tests.mozilla.org"); do_check_eq(a2.id, "addon2@tests.mozilla.org");
@ -308,6 +312,7 @@ function run_test_2() {
do_check_true(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE)); do_check_true(hasFlag(a2.permissions, AddonManager.PERM_CAN_UPGRADE));
do_check_in_crash_annotation(addon2.id, a2.version); do_check_in_crash_annotation(addon2.id, a2.version);
do_check_eq(a2.scope, AddonManager.SCOPE_PROFILE); do_check_eq(a2.scope, AddonManager.SCOPE_PROFILE);
do_check_true(a2.foreignInstall);
do_check_eq(a3, null); do_check_eq(a3, null);
do_check_false(isExtensionInAddonsList(profileDir, "addon3@tests.mozilla.org")); do_check_false(isExtensionInAddonsList(profileDir, "addon3@tests.mozilla.org"));

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

@ -94,12 +94,14 @@ function run_test() {
function([d, t1, t2]) { function([d, t1, t2]) {
do_check_neq(d, null); do_check_neq(d, null);
do_check_false(d.skinnable); do_check_false(d.skinnable);
do_check_false(d.foreignInstall);
do_check_neq(t1, null); do_check_neq(t1, null);
do_check_false(t1.userDisabled); do_check_false(t1.userDisabled);
do_check_false(t1.appDisabled); do_check_false(t1.appDisabled);
do_check_true(t1.isActive); do_check_true(t1.isActive);
do_check_true(t1.skinnable); do_check_true(t1.skinnable);
do_check_true(t1.foreignInstall);
do_check_eq(t1.screenshots, null); do_check_eq(t1.screenshots, null);
do_check_true(isThemeInAddonsList(profileDir, t1.id)); do_check_true(isThemeInAddonsList(profileDir, t1.id));
do_check_false(hasFlag(t1.permissions, AddonManager.PERM_CAN_DISABLE)); do_check_false(hasFlag(t1.permissions, AddonManager.PERM_CAN_DISABLE));
@ -112,6 +114,7 @@ function run_test() {
do_check_false(t2.appDisabled); do_check_false(t2.appDisabled);
do_check_false(t2.isActive); do_check_false(t2.isActive);
do_check_false(t2.skinnable); do_check_false(t2.skinnable);
do_check_true(t2.foreignInstall);
do_check_eq(t2.screenshots, null); do_check_eq(t2.screenshots, null);
do_check_false(isThemeInAddonsList(profileDir, t2.id)); do_check_false(isThemeInAddonsList(profileDir, t2.id));
do_check_false(hasFlag(t2.permissions, AddonManager.PERM_CAN_DISABLE)); do_check_false(hasFlag(t2.permissions, AddonManager.PERM_CAN_DISABLE));

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

@ -90,6 +90,7 @@ function run_test_1() {
do_check_eq(a1.version, "1.0"); do_check_eq(a1.version, "1.0");
do_check_eq(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DEFAULT); do_check_eq(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DEFAULT);
do_check_eq(a1.releaseNotesURI, null); do_check_eq(a1.releaseNotesURI, null);
do_check_true(a1.foreignInstall);
a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT; a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
@ -219,6 +220,7 @@ function check_test_2() {
do_check_true(isExtensionInAddonsList(profileDir, a1.id)); do_check_true(isExtensionInAddonsList(profileDir, a1.id));
do_check_eq(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE); do_check_eq(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE);
do_check_eq(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml"); do_check_eq(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
do_check_true(a1.foreignInstall);
a1.uninstall(); a1.uninstall();
restartManager(); restartManager();