зеркало из https://github.com/mozilla/gecko-dev.git
Backout all of the bugs in the 7e12e3e16e6c pushlog because of the orange.
It is not clear which one of these bugs is at fault.
This commit is contained in:
Родитель
6400b22ee4
Коммит
2312c4c0f3
|
@ -64,11 +64,9 @@ interface nsIChannel;
|
|||
/**
|
||||
* The nsISyncDOMLoadService interface can be used to synchronously load
|
||||
* a document.
|
||||
*
|
||||
* @deprecated use XMLHttpRequest instead
|
||||
*/
|
||||
|
||||
[deprecated, scriptable, uuid(8095998d-ae1c-4cfa-9b43-0973e5d77eb0)]
|
||||
[scriptable, uuid(8095998d-ae1c-4cfa-9b43-0973e5d77eb0)]
|
||||
interface nsISyncLoadDOMService : nsISupports
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -391,9 +391,9 @@ interface nsIXHRSendable : nsISupports {
|
|||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* DEPRECATED.
|
||||
*/
|
||||
[deprecated, scriptable, uuid(423fdd3d-41c9-4149-8fe5-b14a1d3912a0)]
|
||||
[scriptable, uuid(423fdd3d-41c9-4149-8fe5-b14a1d3912a0)]
|
||||
interface nsIJSXMLHttpRequest : nsISupports {
|
||||
/**
|
||||
* Meant to be a script-only mechanism for setting an upload progress event
|
||||
|
|
|
@ -1054,7 +1054,8 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsAttrValue::ParseSpecialIntValue(const nsAString& aString)
|
||||
nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
|
||||
PRBool aCanBePercent)
|
||||
{
|
||||
ResetIfSet();
|
||||
|
||||
|
@ -1062,7 +1063,7 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString)
|
|||
PRBool strict;
|
||||
PRBool isPercent = PR_FALSE;
|
||||
nsAutoString tmp(aString);
|
||||
PRInt32 originalVal = StringToInteger(aString, &strict, &ec, PR_TRUE, &isPercent);
|
||||
PRInt32 originalVal = StringToInteger(aString, &strict, &ec, aCanBePercent, &isPercent);
|
||||
|
||||
if (NS_FAILED(ec)) {
|
||||
return PR_FALSE;
|
||||
|
@ -1071,7 +1072,7 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString)
|
|||
PRInt32 val = NS_MAX(originalVal, 0);
|
||||
|
||||
// % (percent)
|
||||
if (isPercent || tmp.RFindChar('%') >= 0) {
|
||||
if (aCanBePercent && (isPercent || tmp.RFindChar('%') >= 0)) {
|
||||
isPercent = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -229,11 +229,13 @@ public:
|
|||
* whether it be percent or raw integer.
|
||||
*
|
||||
* @param aString the string to parse
|
||||
* @param aCanBePercent PR_TRUE if it can be a percent value (%)
|
||||
* @return whether the value could be parsed
|
||||
*
|
||||
* @see http://www.whatwg.org/html/#rules-for-parsing-dimension-values
|
||||
*/
|
||||
PRBool ParseSpecialIntValue(const nsAString& aString);
|
||||
PRBool ParseSpecialIntValue(const nsAString& aString,
|
||||
PRBool aCanBePercent);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -524,6 +524,9 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
|
|||
return rv;
|
||||
}
|
||||
}
|
||||
else if (aHeader == nsGkAtoms::link) {
|
||||
rv = ProcessLinkHeader(aContent, aValue);
|
||||
}
|
||||
else if (aHeader == nsGkAtoms::msthemecompatible) {
|
||||
// Disable theming for the presshell if the value is no.
|
||||
// XXXbz don't we want to support this as an HTTP header too?
|
||||
|
|
|
@ -641,6 +641,7 @@ nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
|
|||
doc->GetDocumentURI() &&
|
||||
NS_SUCCEEDED(doc->GetDocumentURI()->Equals(imageURI, &equal)) &&
|
||||
equal) {
|
||||
|
||||
// Loading an embedded img from the same URI as the document URI will not work
|
||||
// as a resource cannot recursively embed itself. Attempting to do so generally
|
||||
// results in having to pre-emptively close down an in-flight HTTP transaction
|
||||
|
@ -649,7 +650,6 @@ nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
|
|||
// In light of that, just skip loading it..
|
||||
// Do make sure to drop our existing image, if any
|
||||
CancelImageRequests(aNotify);
|
||||
FireEvent(NS_LITERAL_STRING("error"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1616,7 +1616,7 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
|
|||
{
|
||||
if ((aAttribute == nsGkAtoms::width) ||
|
||||
(aAttribute == nsGkAtoms::height)) {
|
||||
return aResult.ParseSpecialIntValue(aString);
|
||||
return aResult.ParseSpecialIntValue(aString, PR_TRUE);
|
||||
}
|
||||
else if ((aAttribute == nsGkAtoms::hspace) ||
|
||||
(aAttribute == nsGkAtoms::vspace) ||
|
||||
|
|
|
@ -116,7 +116,7 @@ nsHTMLDivElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
|
||||
if ((aAttribute == nsGkAtoms::width) ||
|
||||
(aAttribute == nsGkAtoms::height)) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::bgcolor) {
|
||||
return aResult.ParseColor(aValue);
|
||||
|
|
|
@ -139,10 +139,10 @@ nsHTMLFrameElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return ParseFrameborderValue(aValue, aResult);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::marginwidth) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::marginheight) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::scrolling) {
|
||||
return ParseScrollingValue(aValue, aResult);
|
||||
|
|
|
@ -134,7 +134,7 @@ nsHTMLHRElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::size) {
|
||||
return aResult.ParseIntWithBounds(aValue, 1, 1000);
|
||||
|
|
|
@ -162,16 +162,16 @@ nsHTMLIFrameElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::marginwidth) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::marginheight) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::frameborder) {
|
||||
return ParseFrameborderValue(aValue, aResult);
|
||||
|
|
|
@ -2698,10 +2698,10 @@ nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return success;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::maxlength) {
|
||||
return aResult.ParseNonNegativeIntValue(aValue);
|
||||
|
|
|
@ -305,10 +305,10 @@ nsHTMLTableCellElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return res;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -128,14 +128,14 @@ nsHTMLTableColElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
/* ignore these attributes, stored simply as strings ch */
|
||||
if (aAttribute == nsGkAtoms::charoff) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::span) {
|
||||
/* protection from unrealistic large colspan values */
|
||||
return aResult.ParseIntWithBounds(aValue, 1, MAX_COLSPAN);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -983,7 +983,7 @@ nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::cellspacing ||
|
||||
aAttribute == nsGkAtoms::cellpadding) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::cols) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
|
@ -997,10 +997,10 @@ nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return PR_TRUE;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
if (aResult.ParseSpecialIntValue(aValue)) {
|
||||
if (aResult.ParseSpecialIntValue(aValue, PR_TRUE)) {
|
||||
// treat 0 width as auto
|
||||
nsAttrValue::ValueType type = aResult.Type();
|
||||
if ((type == nsAttrValue::eInteger &&
|
||||
|
|
|
@ -383,10 +383,10 @@ nsHTMLTableRowElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -252,7 +252,7 @@ nsHTMLTableSectionElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -124,7 +124,7 @@ nsHTMLVideoElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
|
||||
return nsHTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
|
|
|
@ -236,7 +236,6 @@ _TEST_FILES = \
|
|||
test_bug607145.html \
|
||||
test_bug601061.html \
|
||||
test_bug596511.html \
|
||||
test_bug599975.html \
|
||||
reflect.js \
|
||||
test_bug611189.html \
|
||||
test_bug613113.html \
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=599975
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 599975</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599975">Mozilla Bug 599975</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<img id=image>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 599975 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var img = document.getElementById("image");
|
||||
img.onerror = function() {
|
||||
ok(true, "onerror fired");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
img.onload = function() {
|
||||
ok(false, "onload fired");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
img.src = "";
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -44,10 +44,10 @@ interface nsIDOMNode;
|
|||
interface nsIDOMDocument;
|
||||
|
||||
/**
|
||||
* @deprecated Use nsIXSLTProcessor instead!!
|
||||
* DEPRECATED! Don't use this interface! Use nsIXSLTProcessor instead!!
|
||||
*/
|
||||
|
||||
[deprecated, scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)]
|
||||
[scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)]
|
||||
interface nsIXSLTProcessorObsolete : nsISupports
|
||||
{
|
||||
void transformDocument(in nsIDOMNode aSourceDOM,
|
||||
|
|
|
@ -73,7 +73,6 @@ enum nsDOMClassInfoID {
|
|||
* that implements one of these interfaces must be directly castable
|
||||
* to that interface from the *canonical* nsISupports!
|
||||
*/
|
||||
#undef DOMCI_CASTABLE_INTERFACE
|
||||
#define DOMCI_CASTABLE_INTERFACES(_extra) \
|
||||
DOMCI_CASTABLE_INTERFACE(nsINode, nsINode, 0, _extra) \
|
||||
DOMCI_CASTABLE_INTERFACE(nsIContent, nsIContent, 1, _extra) \
|
||||
|
|
|
@ -1393,13 +1393,9 @@ PluginInstanceChild::SetWindowLongAHook(HWND hWnd,
|
|||
GetProp(hWnd, kPluginInstanceChildProperty));
|
||||
|
||||
// Hook our subclass back up, just like we do on setwindow.
|
||||
WNDPROC currentProc =
|
||||
reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_WNDPROC));
|
||||
if (currentProc != PluginWindowProc) {
|
||||
self->mPluginWndProc =
|
||||
reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
|
||||
reinterpret_cast<LONG_PTR>(PluginWindowProc)));
|
||||
}
|
||||
self->mPluginWndProc =
|
||||
reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
|
||||
reinterpret_cast<LONG_PTR>(PluginWindowProc)));
|
||||
return proc;
|
||||
}
|
||||
|
||||
|
@ -1426,13 +1422,9 @@ PluginInstanceChild::SetWindowLongWHook(HWND hWnd,
|
|||
GetProp(hWnd, kPluginInstanceChildProperty));
|
||||
|
||||
// Hook our subclass back up, just like we do on setwindow.
|
||||
WNDPROC currentProc =
|
||||
reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_WNDPROC));
|
||||
if (currentProc != PluginWindowProc) {
|
||||
self->mPluginWndProc =
|
||||
reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
|
||||
reinterpret_cast<LONG_PTR>(PluginWindowProc)));
|
||||
}
|
||||
self->mPluginWndProc =
|
||||
reinterpret_cast<WNDPROC>(sUser32SetWindowLongWHookStub(hWnd, nIndex,
|
||||
reinterpret_cast<LONG_PTR>(PluginWindowProc)));
|
||||
return proc;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,8 +211,7 @@ ContainerRender(Container* aContainer,
|
|||
childOffset.y = visibleRect.y;
|
||||
|
||||
aContainer->gl()->PushViewportRect();
|
||||
aManager->SetupPipeline(visibleRect.width, visibleRect.height,
|
||||
LayerManagerOGL::DontApplyWorldTransform);
|
||||
aManager->SetupPipeline(visibleRect.width, visibleRect.height);
|
||||
|
||||
} else {
|
||||
frameBuffer = aPreviousFrameBuffer;
|
||||
|
@ -257,11 +256,6 @@ ContainerRender(Container* aContainer,
|
|||
if (needsFramebuffer) {
|
||||
scissorRect.MoveBy(- visibleRect.TopLeft());
|
||||
} else {
|
||||
if (!frameBuffer) {
|
||||
// Transform scissorRect here
|
||||
aManager->WorldTransformRect(scissorRect);
|
||||
}
|
||||
|
||||
if (!aPreviousFrameBuffer) {
|
||||
/**
|
||||
* glScissor coordinates are oriented with 0,0 being at the bottom left,
|
||||
|
@ -304,8 +298,7 @@ ContainerRender(Container* aContainer,
|
|||
// Restore the viewport
|
||||
aContainer->gl()->PopViewportRect();
|
||||
nsIntRect viewport = aContainer->gl()->ViewportRect();
|
||||
aManager->SetupPipeline(viewport.width, viewport.height,
|
||||
LayerManagerOGL::ApplyWorldTransform);
|
||||
aManager->SetupPipeline(viewport.width, viewport.height);
|
||||
|
||||
aContainer->gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
|
||||
aContainer->gl()->fDeleteFramebuffers(1, &frameBuffer);
|
||||
|
|
|
@ -550,7 +550,6 @@ LayerManagerOGL::Render()
|
|||
|
||||
nsIntRect rect;
|
||||
mWidget->GetClientBounds(rect);
|
||||
WorldTransformRect(rect);
|
||||
|
||||
GLint width = rect.width;
|
||||
GLint height = rect.height;
|
||||
|
@ -576,7 +575,7 @@ LayerManagerOGL::Render()
|
|||
DEBUG_GL_ERROR_CHECK(mGLContext);
|
||||
|
||||
SetupBackBuffer(width, height);
|
||||
SetupPipeline(width, height, ApplyWorldTransform);
|
||||
SetupPipeline(width, height);
|
||||
|
||||
// Default blend function implements "OVER"
|
||||
mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
|
||||
|
@ -589,7 +588,6 @@ LayerManagerOGL::Render()
|
|||
|
||||
if (clipRect) {
|
||||
nsIntRect r = *clipRect;
|
||||
WorldTransformRect(r);
|
||||
if (!mGLContext->IsDoubleBuffered() && !mTarget)
|
||||
mGLContext->FixWindowCoordinateRect(r, mWidgetSize.height);
|
||||
mGLContext->fScissor(r.x, r.y, r.width, r.height);
|
||||
|
@ -664,8 +662,6 @@ LayerManagerOGL::Render()
|
|||
nsIntRegionRectIterator iter(mClippingRegion);
|
||||
|
||||
while ((r = iter.Next()) != nsnull) {
|
||||
nsIntRect cRect = *r; r = &cRect;
|
||||
WorldTransformRect(cRect);
|
||||
float left = (GLfloat)r->x / width;
|
||||
float right = (GLfloat)r->XMost() / width;
|
||||
float top = (GLfloat)r->y / height;
|
||||
|
@ -710,32 +706,7 @@ LayerManagerOGL::Render()
|
|||
}
|
||||
|
||||
void
|
||||
LayerManagerOGL::SetWorldTransform(const gfxMatrix& aMatrix)
|
||||
{
|
||||
NS_ASSERTION(aMatrix.PreservesAxisAlignedRectangles(),
|
||||
"SetWorldTransform only accepts matrices that satisfy PreservesAxisAlignedRectangles");
|
||||
NS_ASSERTION(!aMatrix.HasNonIntegerScale(),
|
||||
"SetWorldTransform only accepts matrices with integer scale");
|
||||
|
||||
mWorldMatrix = aMatrix;
|
||||
}
|
||||
|
||||
gfxMatrix&
|
||||
LayerManagerOGL::GetWorldTransform(void)
|
||||
{
|
||||
return mWorldMatrix;
|
||||
}
|
||||
|
||||
void
|
||||
LayerManagerOGL::WorldTransformRect(nsIntRect& aRect)
|
||||
{
|
||||
gfxRect grect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
grect = mWorldMatrix.TransformBounds(grect);
|
||||
aRect.SetRect(grect.pos.x, grect.pos.y, grect.size.width, grect.size.height);
|
||||
}
|
||||
|
||||
void
|
||||
LayerManagerOGL::SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTransformPolicy)
|
||||
LayerManagerOGL::SetupPipeline(int aWidth, int aHeight)
|
||||
{
|
||||
// Set the viewport correctly.
|
||||
//
|
||||
|
@ -773,10 +744,6 @@ LayerManagerOGL::SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTra
|
|||
viewMatrix._42 = -1.0f;
|
||||
}
|
||||
|
||||
if (aTransformPolicy == ApplyWorldTransform) {
|
||||
viewMatrix = gfx3DMatrix::From2D(mWorldMatrix) * viewMatrix;
|
||||
}
|
||||
|
||||
SetLayerProgramProjectionMatrix(viewMatrix);
|
||||
}
|
||||
|
||||
|
|
|
@ -372,25 +372,11 @@ public:
|
|||
return mWidgetSize;
|
||||
}
|
||||
|
||||
enum WorldTransforPolicy {
|
||||
ApplyWorldTransform,
|
||||
DontApplyWorldTransform
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup the viewport and projection matrix for rendering
|
||||
* to a window of the given dimensions.
|
||||
*/
|
||||
void SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTransformPolicy);
|
||||
|
||||
/**
|
||||
* Setup World transform matrix.
|
||||
* Transform will be ignored if it is not PreservesAxisAlignedRectangles
|
||||
* or has non integer scale
|
||||
*/
|
||||
void SetWorldTransform(const gfxMatrix& aMatrix);
|
||||
gfxMatrix& GetWorldTransform(void);
|
||||
void WorldTransformRect(nsIntRect& aRect);
|
||||
void SetupPipeline(int aWidth, int aHeight);
|
||||
|
||||
private:
|
||||
/** Widget associated with this layer manager */
|
||||
|
@ -469,7 +455,6 @@ private:
|
|||
* while rendering */
|
||||
DrawThebesLayerCallback mThebesLayerCallback;
|
||||
void *mThebesLayerCallbackData;
|
||||
gfxMatrix mWorldMatrix;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -281,14 +281,6 @@ public:
|
|||
|| (FuzzyEqual(xy, 0.0) && FuzzyEqual(yx, 0.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the matrix has non-integer scale
|
||||
*/
|
||||
PRBool HasNonIntegerScale() const {
|
||||
return !FuzzyEqual(xx, NS_floor(xx + 0.5)) ||
|
||||
!FuzzyEqual(yy, NS_floor(yy + 0.5));
|
||||
}
|
||||
|
||||
private:
|
||||
static PRBool FuzzyEqual(gfxFloat aV1, gfxFloat aV2) {
|
||||
return fabs(aV2 - aV1) < 1e-6;
|
||||
|
|
|
@ -78,7 +78,6 @@ xpc_qsUnwrapArg<_interface>(JSContext *cx, \
|
|||
|
||||
#undef DOMCI_CASTABLE_INTERFACE
|
||||
|
||||
#undef DOMCI_CASTABLE_INTERFACE
|
||||
#define DOMCI_CASTABLE_INTERFACE(_interface, _base, _bit, _extra) \
|
||||
DEFINE_UNWRAP_CAST(_interface, _base, _bit)
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ var initialPaintCount, afterPaintCount;
|
|||
var color = 0;
|
||||
|
||||
function onAfterPaint () {
|
||||
ok(true, "OnAfterPaint");
|
||||
afterPaintCount += 1;
|
||||
}
|
||||
|
||||
|
@ -32,30 +33,18 @@ function startTest() {
|
|||
initialPaintCount = window.mozPaintCount;
|
||||
window.addEventListener("MozAfterPaint", onAfterPaint, true);
|
||||
doBackgroundFlicker();
|
||||
}, 500);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", startTest, true);
|
||||
|
||||
// Unfortunately we cannot reliably assert that mozPaintCount and afterPaintCount increment perfectly
|
||||
// in sync, because they can diverge in the presence of OS-triggered paints or system load.
|
||||
// Instead, we wait for mozPaintCount to increase by a set amount, and then assert that we got a
|
||||
// minimum number of MozAfterPaint events. This number needs to be high enough to ensure that this test
|
||||
// will fail if empty transactions are not triggering MozAfterPaint, but low enough to allow the test to
|
||||
// pass even if the operating system triggers extra repaints or the browser is running slowly.
|
||||
// If this test still fails occasionally, examine the output to see whether minimumAfterPaints needs to be
|
||||
// adjusted down or whether you are dealing with a different issue.
|
||||
const mozPaintsToWait = 50;
|
||||
const minimumAfterPaintsToPass = 37;
|
||||
|
||||
function doPluginFlicker() {
|
||||
ok(true, "Plugin color iteration " + color +
|
||||
", afterpaint count: " + afterPaintCount +
|
||||
", mozpaint count: " + window.mozPaintCount);
|
||||
var mozPaints = (window.mozPaintCount - initialPaintCount);
|
||||
if (mozPaints >= mozPaintsToWait) {
|
||||
ok(true, "mozPaintCount incremented enough from plugin color changes.");
|
||||
ok(afterPaintCount >= minimumAfterPaintsToPass, "Got MozAfterPaint event " + afterPaintCount + " time(s).");
|
||||
if ((afterPaintCount >= window.mozPaintCount - initialPaintCount) &&
|
||||
(afterPaintCount > 20)) {
|
||||
ok(true, "Got enough paints from plugin color changes");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
@ -74,10 +63,9 @@ function doBackgroundFlicker() {
|
|||
ok(true, "Background color iteration " + color +
|
||||
", afterpaint count: " + afterPaintCount +
|
||||
", mozpaint count: " + window.mozPaintCount);
|
||||
var mozPaints = (window.mozPaintCount - initialPaintCount);
|
||||
if (mozPaints >= mozPaintsToWait) {
|
||||
ok(true, "mozPaintCount incremented enough from background color changes.");
|
||||
ok(afterPaintCount >= minimumAfterPaintsToPass, "Got MozAfterPaint event " + afterPaintCount + " time(s).");
|
||||
if ((afterPaintCount >= window.mozPaintCount - initialPaintCount) &&
|
||||
(afterPaintCount > 20)) {
|
||||
ok(true, "Got enough paints from background color changes");
|
||||
afterPaintCount = 0;
|
||||
initialPaintCount = window.mozPaintCount;
|
||||
doPluginFlicker();
|
||||
|
|
|
@ -151,10 +151,7 @@ nsrefcnt nsJAR::Release(void)
|
|||
return 0;
|
||||
}
|
||||
else if (1 == count && mCache) {
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
mCache->ReleaseZip(this);
|
||||
nsresult rv = mCache->ReleaseZip(this);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to release zip file");
|
||||
}
|
||||
return count;
|
||||
|
@ -1153,10 +1150,7 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PRBool collision =
|
||||
#endif
|
||||
mZips.Put(&key, static_cast<nsIZipReader*>(zip)); // AddRefs to 2
|
||||
PRBool collision = mZips.Put(&key, static_cast<nsIZipReader*>(zip)); // AddRefs to 2
|
||||
NS_ASSERTION(!collision, "horked");
|
||||
}
|
||||
*result = zip;
|
||||
|
@ -1310,10 +1304,8 @@ nsZipReaderCache::ReleaseZip(nsJAR* zip)
|
|||
}
|
||||
|
||||
nsCStringKey key(uri);
|
||||
#ifdef DEBUG
|
||||
PRBool removed =
|
||||
#endif
|
||||
mZips.Remove(&key); // Releases
|
||||
PRBool removed;
|
||||
removed = mZips.Remove(&key); // Releases
|
||||
NS_ASSERTION(removed, "botched");
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1345,10 +1337,7 @@ nsZipReaderCache::Observe(nsISupports *aSubject,
|
|||
mZips.Enumerate(FindFlushableZip, &flushable);
|
||||
if ( ! flushable )
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
PRBool removed =
|
||||
#endif
|
||||
mZips.Remove(flushable); // Releases
|
||||
PRBool removed = mZips.Remove(flushable); // Releases
|
||||
NS_ASSERTION(removed, "botched");
|
||||
|
||||
#ifdef xDEBUG_jband
|
||||
|
|
|
@ -94,10 +94,7 @@ public:
|
|||
, mContentLength(-1)
|
||||
{
|
||||
if (fullJarURI) {
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
fullJarURI->GetAsciiSpec(mJarDirSpec);
|
||||
nsresult rv = fullJarURI->GetAsciiSpec(mJarDirSpec);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "this shouldn't fail");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1002,10 +1002,7 @@ nsZipCursor::nsZipCursor(nsZipItem *item, nsZipArchive *aZip, PRUint8* aBuf, PRU
|
|||
mDoCRC(doCRC)
|
||||
{
|
||||
if (mItem->Compression() == DEFLATED) {
|
||||
#ifdef DEBUG
|
||||
nsresult status =
|
||||
#endif
|
||||
gZlibInit(&mZs);
|
||||
nsresult status = gZlibInit(&mZs);
|
||||
NS_ASSERTION(status == NS_OK, "Zlib failed to initialize");
|
||||
NS_ASSERTION(aBuf, "Must pass in a buffer for DEFLATED nsZipItem");
|
||||
}
|
||||
|
|
|
@ -2486,13 +2486,6 @@ nsHttpChannel::CheckCache()
|
|||
|
||||
PRUint16 isCachedRedirect = mCachedResponseHead->Status()/100 == 3;
|
||||
|
||||
mCustomConditionalRequest =
|
||||
mRequestHead.PeekHeader(nsHttp::If_Modified_Since) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_None_Match) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_Unmodified_Since) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_Match) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_Range);
|
||||
|
||||
if (method != nsHttp::Head && !isCachedRedirect) {
|
||||
// If the cached content-length is set and it does not match the data
|
||||
// size of the cached content, then the cached response is partial...
|
||||
|
@ -2507,17 +2500,8 @@ nsHttpChannel::CheckCache()
|
|||
if (nsInt64(size) != contentLength) {
|
||||
LOG(("Cached data size does not match the Content-Length header "
|
||||
"[content-length=%lld size=%u]\n", PRInt64(contentLength), size));
|
||||
|
||||
PRBool hasContentEncoding =
|
||||
mCachedResponseHead->PeekHeader(nsHttp::Content_Encoding)
|
||||
!= nsnull;
|
||||
if ((nsInt64(size) < contentLength) &&
|
||||
size > 0 &&
|
||||
!hasContentEncoding &&
|
||||
mCachedResponseHead->IsResumable() &&
|
||||
!mCustomConditionalRequest &&
|
||||
!mCachedResponseHead->NoStore()) {
|
||||
// looks like a partial entry we can reuse
|
||||
if ((nsInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
|
||||
// looks like a partial entry.
|
||||
rv = SetupByteRangeRequest(size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mCachedContentIsPartial = PR_TRUE;
|
||||
|
@ -2530,6 +2514,13 @@ nsHttpChannel::CheckCache()
|
|||
PRBool doValidation = PR_FALSE;
|
||||
PRBool canAddImsHeader = PR_TRUE;
|
||||
|
||||
mCustomConditionalRequest =
|
||||
mRequestHead.PeekHeader(nsHttp::If_Modified_Since) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_None_Match) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_Unmodified_Since) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_Match) ||
|
||||
mRequestHead.PeekHeader(nsHttp::If_Range);
|
||||
|
||||
// If the LOAD_FROM_CACHE flag is set, any cached data can simply be used.
|
||||
if (mLoadFlags & LOAD_FROM_CACHE) {
|
||||
LOG(("NOT validating based on LOAD_FROM_CACHE load flag\n"));
|
||||
|
|
|
@ -2,18 +2,9 @@ do_load_httpd_js();
|
|||
|
||||
var httpserver = null;
|
||||
|
||||
// testString = "This is a slightly longer test\n";
|
||||
const responseBody = [0x1f, 0x8b, 0x08, 0x08, 0xef, 0x70, 0xe6, 0x4c, 0x00, 0x03, 0x74, 0x65, 0x78, 0x74, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x0b, 0xc9, 0xc8, 0x2c, 0x56, 0x00, 0xa2, 0x44, 0x85,
|
||||
0xe2, 0x9c, 0xcc, 0xf4, 0x8c, 0x92, 0x9c, 0x4a, 0x85, 0x9c, 0xfc, 0xbc, 0xf4, 0xd4, 0x22, 0x85,
|
||||
0x92, 0xd4, 0xe2, 0x12, 0x2e, 0x2e, 0x00, 0x00, 0xe5, 0xe6, 0xf0, 0x20, 0x00, 0x00, 0x00];
|
||||
|
||||
function getCacheService()
|
||||
{
|
||||
var nsCacheService = Components.classes["@mozilla.org/network/cache-service;1"];
|
||||
var service = nsCacheService.getService(Components.interfaces.nsICacheService);
|
||||
return service;
|
||||
}
|
||||
const responseBody = [0x1f, 0x8b, 0x08, 0x00, 0x16, 0x5a, 0x8a, 0x48, 0x02,
|
||||
0x03, 0x2b, 0x49, 0x2d, 0x2e, 0xe1, 0x02, 0x00, 0xc6,
|
||||
0x35, 0xb9, 0x3b, 0x05, 0x00, 0x00, 0x00];
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
|
@ -27,8 +18,6 @@ function cachedHandler(metadata, response) {
|
|||
response.setHeader("Content-Type", "application/x-gzip", false);
|
||||
response.setHeader("Content-Encoding", "gzip", false);
|
||||
response.setHeader("ETag", "Just testing");
|
||||
response.setHeader("Cache-Control", "max-age=3600000"); // avoid validation
|
||||
response.setHeader("Content-Length", "" + responseBody.length);
|
||||
|
||||
var body = responseBody;
|
||||
|
||||
|
@ -48,7 +37,6 @@ function cachedHandler(metadata, response) {
|
|||
response.setHeader("Content-Range", from + "-" + to + "/" + responseBody.length, false);
|
||||
} else {
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
body = body.slice(0, 17); // slice off a piece to send first
|
||||
doRangeResponse = true;
|
||||
}
|
||||
|
||||
|
@ -56,24 +44,49 @@ function cachedHandler(metadata, response) {
|
|||
.createInstance(Ci.nsIBinaryOutputStream);
|
||||
bos.setOutputStream(response.bodyOutputStream);
|
||||
|
||||
response.processAsync();
|
||||
bos.writeByteArray(body, body.length);
|
||||
response.finish();
|
||||
}
|
||||
|
||||
function continue_test(request, data) {
|
||||
do_check_true(17 == data.length);
|
||||
function Canceler() {
|
||||
}
|
||||
|
||||
Canceler.prototype = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIStreamListener) ||
|
||||
iid.equals(Ci.nsIRequestObserver) ||
|
||||
iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
onStartRequest: function(request, context) {
|
||||
},
|
||||
|
||||
onDataAvailable: function(request, context, stream, offset, count) {
|
||||
request.QueryInterface(Ci.nsIChannel)
|
||||
.cancel(Components.results.NS_BINDING_ABORTED);
|
||||
},
|
||||
|
||||
onStopRequest: function(request, context, status) {
|
||||
do_check_eq(status, Components.results.NS_BINDING_ABORTED);
|
||||
continue_test();
|
||||
}
|
||||
};
|
||||
|
||||
function continue_test() {
|
||||
var chan = make_channel("http://localhost:4444/cached/test.gz");
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null, CL_EXPECT_GZIP), null);
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null), null);
|
||||
}
|
||||
|
||||
function finish_test(request, data, ctx) {
|
||||
do_test_pending();
|
||||
httpserver.stop(do_test_finished);
|
||||
do_check_eq(request.status, 0);
|
||||
do_check_eq(data.length, responseBody.length);
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
do_check_eq(data.charCodeAt(i), responseBody[i]);
|
||||
}
|
||||
httpserver.stop(do_test_finished);
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
@ -81,10 +94,7 @@ function run_test() {
|
|||
httpserver.registerPathHandler("/cached/test.gz", cachedHandler);
|
||||
httpserver.start(4444);
|
||||
|
||||
// wipe out cached content
|
||||
getCacheService().evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
|
||||
|
||||
var chan = make_channel("http://localhost:4444/cached/test.gz");
|
||||
chan.asyncOpen(new ChannelListener(continue_test, null, CL_EXPECT_GZIP), null);
|
||||
chan.asyncOpen(new Canceler(), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
|
|
@ -1,275 +0,0 @@
|
|||
//
|
||||
// This test makes sure range-requests are sent and treated the way we want
|
||||
// See bug #612135 for a thorough discussion on the subject
|
||||
//
|
||||
// Necko does a range-request for a partial cache-entry iff
|
||||
//
|
||||
// 1) size of the cached entry < value of the cached Content-Length header
|
||||
// (not tested here - see bug #612135 comments 108-110)
|
||||
// 2) the size of the cached entry is > 0 (see bug #628607)
|
||||
// 3) the cached entry does not have a "no-store" Cache-Control header
|
||||
// 4) the cached entry does not have a Content-Encoding (see bug #613159)
|
||||
// 5) the request does not have a conditional-request header set by client
|
||||
// 6) nsHttpResponseHead::IsResumable() is true for the cached entry
|
||||
//
|
||||
// The test has one handler for each case and run_tests() fires one request
|
||||
// for each. None of the handlers should see a Range-header.
|
||||
|
||||
do_load_httpd_js();
|
||||
|
||||
var httpserver = null;
|
||||
|
||||
const clearTextBody = "This is a slightly longer test\n";
|
||||
const encodedBody = [0x1f, 0x8b, 0x08, 0x08, 0xef, 0x70, 0xe6, 0x4c, 0x00, 0x03, 0x74, 0x65, 0x78, 0x74, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x0b, 0xc9, 0xc8, 0x2c, 0x56, 0x00, 0xa2, 0x44, 0x85,
|
||||
0xe2, 0x9c, 0xcc, 0xf4, 0x8c, 0x92, 0x9c, 0x4a, 0x85, 0x9c, 0xfc, 0xbc, 0xf4, 0xd4, 0x22, 0x85,
|
||||
0x92, 0xd4, 0xe2, 0x12, 0x2e, 0x2e, 0x00, 0x00, 0xe5, 0xe6, 0xf0, 0x20, 0x00, 0x00, 0x00];
|
||||
const decodedBody = [0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x73, 0x6c, 0x69, 0x67, 0x68, 0x74,
|
||||
0x6c, 0x79, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x20, 0x74, 0x65, 0x73, 0x74, 0x0a, 0x0a];
|
||||
|
||||
const partial_data_length = 4;
|
||||
|
||||
function getCacheService()
|
||||
{
|
||||
var nsCacheService = Components.classes["@mozilla.org/network/cache-service;1"];
|
||||
var service = nsCacheService.getService(Components.interfaces.nsICacheService);
|
||||
return service;
|
||||
}
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, "", null);
|
||||
return chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
||||
// StreamListener which cancels its request on first data available
|
||||
function Canceler(continueFn) {
|
||||
this.continueFn = continueFn;
|
||||
}
|
||||
Canceler.prototype = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIStreamListener) ||
|
||||
iid.equals(Ci.nsIRequestObserver) ||
|
||||
iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
onStartRequest: function(request, context) { },
|
||||
|
||||
onDataAvailable: function(request, context, stream, offset, count) {
|
||||
request.QueryInterface(Ci.nsIChannel)
|
||||
.cancel(Components.results.NS_BINDING_ABORTED);
|
||||
},
|
||||
onStopRequest: function(request, context, status) {
|
||||
do_check_eq(status, Components.results.NS_BINDING_ABORTED);
|
||||
this.continueFn(request, null);
|
||||
}
|
||||
};
|
||||
// Simple StreamListener which performs no validations
|
||||
function MyListener(continueFn) {
|
||||
this.continueFn = continueFn;
|
||||
this._buffer = null;
|
||||
}
|
||||
MyListener.prototype = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIStreamListener) ||
|
||||
iid.equals(Ci.nsIRequestObserver) ||
|
||||
iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
onStartRequest: function(request, context) { this._buffer = ""; },
|
||||
|
||||
onDataAvailable: function(request, context, stream, offset, count) {
|
||||
this._buffer = this._buffer.concat(read_stream(stream, count));
|
||||
},
|
||||
onStopRequest: function(request, context, status) {
|
||||
this.continueFn(request, this._buffer);
|
||||
}
|
||||
};
|
||||
|
||||
function received_cleartext(request, data) {
|
||||
do_check_eq(clearTextBody, data);
|
||||
testFinished();
|
||||
}
|
||||
|
||||
function setStdHeaders(response, length) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setHeader("ETag", "Just testing");
|
||||
response.setHeader("Cache-Control", "max-age: 360000");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Length", "" + length);
|
||||
}
|
||||
|
||||
function handler_2(metadata, response) {
|
||||
setStdHeaders(response, clearTextBody.length);
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
response.bodyOutputStream.write(clearTextBody, clearTextBody.length);
|
||||
}
|
||||
function received_partial_2(request, data) {
|
||||
do_check_eq(data, undefined);
|
||||
var chan = make_channel("http://localhost:4444/test_2");
|
||||
chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
|
||||
}
|
||||
|
||||
var case_3_request_no = 0;
|
||||
function handler_3(metadata, response) {
|
||||
var body = clearTextBody;
|
||||
setStdHeaders(response, body.length);
|
||||
response.setHeader("Cache-Control", "no-store", false);
|
||||
switch (case_3_request_no) {
|
||||
case 0:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
body = body.slice(0, partial_data_length);
|
||||
response.processAsync();
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
response.finish();
|
||||
break;
|
||||
case 1:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
break;
|
||||
default:
|
||||
response.setStatusLine(metadata.httpVersion, 404, "Not Found");
|
||||
}
|
||||
case_3_request_no++;
|
||||
}
|
||||
function received_partial_3(request, data) {
|
||||
do_check_eq(partial_data_length, data.length);
|
||||
var chan = make_channel("http://localhost:4444/test_3");
|
||||
chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
|
||||
}
|
||||
|
||||
var case_4_request_no = 0;
|
||||
function handler_4(metadata, response) {
|
||||
switch (case_4_request_no) {
|
||||
case 0:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
var body = encodedBody;
|
||||
setStdHeaders(response, body.length);
|
||||
response.setHeader("Content-Encoding", "gzip", false);
|
||||
body = body.slice(0, partial_data_length);
|
||||
var bos = Cc["@mozilla.org/binaryoutputstream;1"]
|
||||
.createInstance(Ci.nsIBinaryOutputStream);
|
||||
bos.setOutputStream(response.bodyOutputStream);
|
||||
response.processAsync();
|
||||
bos.writeByteArray(body, body.length);
|
||||
response.finish();
|
||||
break;
|
||||
case 1:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
setStdHeaders(response, clearTextBody.length);
|
||||
response.bodyOutputStream.write(clearTextBody, clearTextBody.length);
|
||||
break;
|
||||
default:
|
||||
response.setStatusLine(metadata.httpVersion, 404, "Not Found");
|
||||
}
|
||||
case_4_request_no++;
|
||||
}
|
||||
function received_partial_4(request, data) {
|
||||
// checking length does not work with encoded data
|
||||
// do_check_eq(partial_data_length, data.length);
|
||||
var chan = make_channel("http://localhost:4444/test_4");
|
||||
chan.asyncOpen(new MyListener(received_cleartext), null);
|
||||
}
|
||||
|
||||
var case_5_request_no = 0;
|
||||
function handler_5(metadata, response) {
|
||||
var body = clearTextBody;
|
||||
setStdHeaders(response, body.length);
|
||||
switch (case_5_request_no) {
|
||||
case 0:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
body = body.slice(0, partial_data_length);
|
||||
response.processAsync();
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
response.finish();
|
||||
break;
|
||||
case 1:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
break;
|
||||
default:
|
||||
response.setStatusLine(metadata.httpVersion, 404, "Not Found");
|
||||
}
|
||||
case_5_request_no++;
|
||||
}
|
||||
function received_partial_5(request, data) {
|
||||
do_check_eq(partial_data_length, data.length);
|
||||
var chan = make_channel("http://localhost:4444/test_5");
|
||||
chan.setRequestHeader("If-Match", "Some eTag", false);
|
||||
chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
|
||||
}
|
||||
|
||||
var case_6_request_no = 0;
|
||||
function handler_6(metadata, response) {
|
||||
switch (case_6_request_no) {
|
||||
case 0:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
var body = clearTextBody;
|
||||
setStdHeaders(response, body.length);
|
||||
response.setHeader("Accept-Ranges", "", false);
|
||||
body = body.slice(0, partial_data_length);
|
||||
response.processAsync();
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
response.finish();
|
||||
break;
|
||||
case 1:
|
||||
do_check_false(metadata.hasHeader("Range"));
|
||||
setStdHeaders(response, clearTextBody.length);
|
||||
response.bodyOutputStream.write(clearTextBody, clearTextBody.length);
|
||||
break;
|
||||
default:
|
||||
response.setStatusLine(metadata.httpVersion, 404, "Not Found");
|
||||
}
|
||||
case_6_request_no++;
|
||||
}
|
||||
function received_partial_6(request, data) {
|
||||
// would like to verify that the response does not have Accept-Ranges
|
||||
do_check_eq(partial_data_length, data.length);
|
||||
var chan = make_channel("http://localhost:4444/test_6");
|
||||
chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
|
||||
}
|
||||
|
||||
// Simple mechanism to keep track of tests and stop the server
|
||||
var numTestsFinished = 0;
|
||||
function testFinished() {
|
||||
if (++numTestsFinished == 5)
|
||||
httpserver.stop(do_test_finished);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
httpserver = new nsHttpServer();
|
||||
httpserver.registerPathHandler("/test_2", handler_2);
|
||||
httpserver.registerPathHandler("/test_3", handler_3);
|
||||
httpserver.registerPathHandler("/test_4", handler_4);
|
||||
httpserver.registerPathHandler("/test_5", handler_5);
|
||||
httpserver.registerPathHandler("/test_6", handler_6);
|
||||
httpserver.start(4444);
|
||||
|
||||
// wipe out cached content
|
||||
getCacheService().evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
|
||||
|
||||
// Case 2: zero-length partial entry must not trigger range-request
|
||||
var chan = make_channel("http://localhost:4444/test_2");
|
||||
chan.asyncOpen(new Canceler(received_partial_2), null);
|
||||
|
||||
// Case 3: no-store response must not trigger range-request
|
||||
var chan = make_channel("http://localhost:4444/test_3");
|
||||
chan.asyncOpen(new MyListener(received_partial_3), null);
|
||||
|
||||
// Case 4: response with content-encoding must not trigger range-request
|
||||
var chan = make_channel("http://localhost:4444/test_4");
|
||||
chan.asyncOpen(new MyListener(received_partial_4), null);
|
||||
|
||||
// Case 5: conditional request-header set by client
|
||||
var chan = make_channel("http://localhost:4444/test_5");
|
||||
chan.asyncOpen(new MyListener(received_partial_5), null);
|
||||
|
||||
// Case 6: response is not resumable (drop the Accept-Ranges header)
|
||||
var chan = make_channel("http://localhost:4444/test_6");
|
||||
chan.asyncOpen(new MyListener(received_partial_6), null);
|
||||
|
||||
do_test_pending();
|
||||
}
|
|
@ -8,6 +8,8 @@ function make_channel(url, callback, ctx) {
|
|||
return ios.newChannel(url, "", null);
|
||||
}
|
||||
|
||||
var do304 = false;
|
||||
|
||||
const responseBody = "response body";
|
||||
|
||||
function cachedHandler(metadata, response) {
|
||||
|
@ -25,6 +27,9 @@ function cachedHandler(metadata, response) {
|
|||
// always respond to successful range requests with 206
|
||||
response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
|
||||
response.setHeader("Content-Range", from + "-" + to + "/" + responseBody.length, false);
|
||||
} else if (do304) {
|
||||
response.setStatusLine(metadata.httpVersion, 304, "Not Modified");
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
|
@ -66,11 +71,13 @@ function finish_test() {
|
|||
}
|
||||
|
||||
function start_cache_read() {
|
||||
do304 = true;
|
||||
var chan = make_channel("http://localhost:4444/cached/test.gz");
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null), null);
|
||||
}
|
||||
|
||||
function start_canceler() {
|
||||
do304 = false;
|
||||
var chan = make_channel("http://localhost:4444/cached/test.gz");
|
||||
chan.asyncOpen(new Canceler(start_cache_read), null);
|
||||
}
|
||||
|
@ -80,6 +87,7 @@ function run_test() {
|
|||
httpserver.registerPathHandler("/cached/test.gz", cachedHandler);
|
||||
httpserver.start(4444);
|
||||
|
||||
do304 = false;
|
||||
var chan = make_channel("http://localhost:4444/cached/test.gz");
|
||||
chan.asyncOpen(new ChannelListener(start_canceler, null), null);
|
||||
do_test_pending();
|
||||
|
|
|
@ -1206,28 +1206,7 @@ function sortElements(aElements, aSortBy, aAscending) {
|
|||
|
||||
const DATE_FIELDS = ["updateDate"];
|
||||
const NUMERIC_FIELDS = ["size", "relevancescore", "purchaseAmount"];
|
||||
|
||||
// We're going to group add-ons into the following buckets:
|
||||
//
|
||||
// enabledInstalled
|
||||
// * Enabled
|
||||
// * Incompatible but enabled because compatibility checking is off
|
||||
// * Waiting to be installed
|
||||
// * Waiting to be enabled
|
||||
//
|
||||
// pendingDisable
|
||||
// * Waiting to be disabled
|
||||
//
|
||||
// pendingUninstall
|
||||
// * Waiting to be removed
|
||||
//
|
||||
// disabledIncompatibleBlocked
|
||||
// * Disabled
|
||||
// * Incompatible
|
||||
// * Blocklisted
|
||||
|
||||
const UISTATE_ORDER = ["enabled", "pendingDisable", "pendingUninstall",
|
||||
"disabled"];
|
||||
const UISTATE_ORDER = ["enabled", "incompatible", "disabled", "blocked"]
|
||||
|
||||
function dateCompare(a, b) {
|
||||
var aTime = a.getTime();
|
||||
|
@ -1266,20 +1245,19 @@ function sortElements(aElements, aSortBy, aAscending) {
|
|||
addon = aObj.mAddon || aObj.mInstall;
|
||||
if (!addon)
|
||||
return null;
|
||||
|
||||
if (aKey == "uiState") {
|
||||
if (addon.pendingOperations == AddonManager.PENDING_DISABLE)
|
||||
return "pendingDisable";
|
||||
if (addon.pendingOperations == AddonManager.PENDING_UNINSTALL)
|
||||
return "pendingUninstall";
|
||||
if (!addon.isActive &&
|
||||
(addon.pendingOperations != AddonManager.PENDING_ENABLE &&
|
||||
addon.pendingOperations != AddonManager.PENDING_INSTALL))
|
||||
return "disabled";
|
||||
else
|
||||
if (addon.isActive)
|
||||
return "enabled";
|
||||
else if (!addon.isCompatible)
|
||||
return "incompatible";
|
||||
else if (addon.blocklistState == Ci.nsIBlocklistService.STATE_NOT_BLOCKED)
|
||||
return "disabled";
|
||||
else if (addon.isCompatible &&
|
||||
addon.blocklistState != Ci.nsIBlocklistService.STATE_NOT_BLOCKED)
|
||||
return "blocked";
|
||||
}
|
||||
|
||||
|
||||
return addon[aKey];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,81 +13,67 @@ function test() {
|
|||
|
||||
gProvider = new MockProvider();
|
||||
gProvider.createAddons([{
|
||||
// enabledInstalled group
|
||||
// * Enabled
|
||||
// * Incompatible but enabled because compatibility checking is off
|
||||
// * Waiting to be installed
|
||||
// * Waiting to be enabled
|
||||
// Enabled extensions
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Test add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 02, 00, 00, 00),
|
||||
size: 1,
|
||||
pendingOperations: AddonManager.PENDING_NONE,
|
||||
size: 1
|
||||
}, {
|
||||
id: "test2@tests.mozilla.org",
|
||||
name: "a first add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 01, 23, 59, 59),
|
||||
size: 0265,
|
||||
pendingOperations: AddonManager.PENDING_UPGRADE,
|
||||
isActive: true,
|
||||
isCompatible: false,
|
||||
size: 0265
|
||||
}, {
|
||||
id: "test3@tests.mozilla.org",
|
||||
name: "\u010Cesk\u00FD slovn\u00EDk", // Český slovník
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 02, 00, 00, 01),
|
||||
size: 12,
|
||||
pendingOperations: AddonManager.PENDING_INSTALL,
|
||||
isActive: false,
|
||||
size: 12
|
||||
}, {
|
||||
id: "test4@tests.mozilla.org",
|
||||
name: "canadian dictionary",
|
||||
updateDate: new Date(1970, 0, 01, 00, 00, 00),
|
||||
description: "foo",
|
||||
isActive: true,
|
||||
}, {
|
||||
id: "test5@tests.mozilla.org",
|
||||
name: "croatian dictionary",
|
||||
description: "foo",
|
||||
updateDate: new Date(2012, 12, 12, 00, 00, 00),
|
||||
size: 5,
|
||||
pendingOperations: AddonManager.PENDING_ENABLE,
|
||||
isActive: false,
|
||||
size: 5
|
||||
}, {
|
||||
// pendingDisable group
|
||||
// * Waiting to be disabled
|
||||
// Incompatible, disabled extensions
|
||||
id: "test6@tests.mozilla.org",
|
||||
name: "orange Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 02, 00, 00, 00),
|
||||
size: 142,
|
||||
isCompatible: false,
|
||||
isActive: true,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
isActive: false,
|
||||
}, {
|
||||
id: "test7@tests.mozilla.org",
|
||||
name: "Blue Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 01, 23, 59, 59),
|
||||
size: 65,
|
||||
isActive: true,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
isCompatible: false,
|
||||
isActive: false,
|
||||
}, {
|
||||
id: "test8@tests.mozilla.org",
|
||||
name: "Green Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 03, 00, 00, 01),
|
||||
size: 125,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
isCompatible: false,
|
||||
isActive: false,
|
||||
}, {
|
||||
id: "test9@tests.mozilla.org",
|
||||
name: "red Add-on",
|
||||
updateDate: new Date(2011, 04, 01, 00, 00, 00),
|
||||
description: "foo",
|
||||
isCompatible: false,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
isActive: false,
|
||||
}, {
|
||||
id: "test10@tests.mozilla.org",
|
||||
name: "Purple Add-on",
|
||||
|
@ -95,26 +81,22 @@ function test() {
|
|||
updateDate: new Date(2012, 12, 12, 00, 00, 00),
|
||||
size: 56,
|
||||
isCompatible: false,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
isActive: false,
|
||||
}, {
|
||||
// pendingUninstall group
|
||||
// * Waiting to be removed
|
||||
// Disabled, compatible extensions
|
||||
id: "test11@tests.mozilla.org",
|
||||
name: "amber Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(1978, 04, 02, 00, 00, 00),
|
||||
size: 142,
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
}, {
|
||||
id: "test12@tests.mozilla.org",
|
||||
name: "Salmon Add-on - pending disable",
|
||||
name: "Salmon Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2054, 04, 01, 23, 59, 59),
|
||||
size: 65,
|
||||
isActive: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
isActive: false,
|
||||
}, {
|
||||
id: "test13@tests.mozilla.org",
|
||||
name: "rose Add-on",
|
||||
|
@ -122,16 +104,12 @@ function test() {
|
|||
updateDate: new Date(2010, 04, 02, 00, 00, 01),
|
||||
size: 125,
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
}, {
|
||||
id: "test14@tests.mozilla.org",
|
||||
name: "Violet Add-on",
|
||||
updateDate: new Date(2010, 05, 01, 00, 00, 00),
|
||||
description: "foo",
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
}, {
|
||||
id: "test15@tests.mozilla.org",
|
||||
name: "white Add-on",
|
||||
|
@ -139,20 +117,15 @@ function test() {
|
|||
updateDate: new Date(2010, 04, 12, 00, 00, 00),
|
||||
size: 56,
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
}, {
|
||||
// disabledIncompatibleBlocked group
|
||||
// * Disabled
|
||||
// * Incompatible
|
||||
// * Blocklisted
|
||||
// Blocked extensions
|
||||
id: "test16@tests.mozilla.org",
|
||||
name: "grimsby Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 04, 01, 00, 00, 00),
|
||||
size: 142,
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
|
||||
}, {
|
||||
id: "test17@tests.mozilla.org",
|
||||
name: "beamsville Add-on",
|
||||
|
@ -160,7 +133,7 @@ function test() {
|
|||
updateDate: new Date(2010, 04, 8, 23, 59, 59),
|
||||
size: 65,
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
|
||||
}, {
|
||||
id: "test18@tests.mozilla.org",
|
||||
name: "smithville Add-on",
|
||||
|
@ -168,7 +141,6 @@ function test() {
|
|||
updateDate: new Date(2010, 04, 03, 00, 00, 01),
|
||||
size: 125,
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED,
|
||||
}, {
|
||||
id: "test19@tests.mozilla.org",
|
||||
|
@ -176,9 +148,7 @@ function test() {
|
|||
updateDate: new Date(2010, 04, 02, 00, 00, 00),
|
||||
description: "foo",
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
isCompatible: false,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_NOT_BLOCKED,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
|
||||
}, {
|
||||
id: "test20@tests.mozilla.org",
|
||||
name: "silverdale Add-on",
|
||||
|
@ -186,11 +156,9 @@ function test() {
|
|||
updateDate: new Date(2010, 04, 12, 00, 00, 00),
|
||||
size: 56,
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
}]);
|
||||
|
||||
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
|
@ -256,6 +224,7 @@ add_test(function() {
|
|||
"test20@tests.mozilla.org",
|
||||
"test18@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
|
|
@ -2655,12 +2655,18 @@ void nsWindow::UpdateGlass()
|
|||
DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE;
|
||||
switch (mTransparencyMode) {
|
||||
case eTransparencyBorderlessGlass:
|
||||
// Only adjust if there is some opaque rectangle
|
||||
// Margins must be 2px (kGlassMarginAdjustment) or larger to cover the 2px
|
||||
// border Windows adds. A value of -1 in cxLeftWidth indicates a sheet of
|
||||
// glass which we ignore here.
|
||||
if (margins.cxLeftWidth >= 0) {
|
||||
margins.cxLeftWidth += kGlassMarginAdjustment;
|
||||
margins.cyTopHeight += kGlassMarginAdjustment;
|
||||
margins.cxRightWidth += kGlassMarginAdjustment;
|
||||
margins.cyBottomHeight += kGlassMarginAdjustment;
|
||||
if (margins.cxLeftWidth >= 0 && margins.cxLeftWidth < kGlassMarginAdjustment)
|
||||
margins.cxLeftWidth = kGlassMarginAdjustment;
|
||||
if (margins.cyTopHeight >= 0 && margins.cyTopHeight < kGlassMarginAdjustment)
|
||||
margins.cyTopHeight = kGlassMarginAdjustment;
|
||||
if (margins.cxRightWidth >= 0 && margins.cxRightWidth < kGlassMarginAdjustment)
|
||||
margins.cxRightWidth = kGlassMarginAdjustment;
|
||||
if (margins.cyBottomHeight >= 0 && margins.cyBottomHeight < kGlassMarginAdjustment)
|
||||
margins.cyBottomHeight = kGlassMarginAdjustment;
|
||||
}
|
||||
// Fall through
|
||||
case eTransparencyGlass:
|
||||
|
|
Загрузка…
Ссылка в новой задаче