diff --git a/content/base/crashtests/646184.html b/content/base/crashtests/646184.html
new file mode 100644
index 00000000000..ef34d41a64b
--- /dev/null
+++ b/content/base/crashtests/646184.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
diff --git a/content/base/crashtests/crashtests.list b/content/base/crashtests/crashtests.list
index c06123c42cf..8ef191b605d 100644
--- a/content/base/crashtests/crashtests.list
+++ b/content/base/crashtests/crashtests.list
@@ -88,3 +88,4 @@ load 604262-1.html
load 628599-1.html
load 637214-1.svg
load 637214-2.svg
+load 646184.html
diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp
index 4c8c9bdfca6..9add99cbba4 100644
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -2619,7 +2619,6 @@ nsGenericElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
return NS_OK;
}
- nsAutoString tmp;
UnsetAttr(nsid, name, PR_TRUE);
return NS_OK;
diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp
index eee22e82616..56927aa042f 100644
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -1430,7 +1430,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::Translate(float x, float y)
{
if (!FloatValidate(x,y))
- return NS_ERROR_DOM_SYNTAX_ERR;
+ return NS_OK;
mThebes->Translate(gfxPoint(x, y));
return NS_OK;
@@ -1440,7 +1440,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::Transform(float m11, float m12, float m21, float m22, float dx, float dy)
{
if (!FloatValidate(m11,m12,m21,m22,dx,dy))
- return NS_ERROR_DOM_SYNTAX_ERR;
+ return NS_OK;
gfxMatrix matrix(m11, m12, m21, m22, dx, dy);
mThebes->Multiply(matrix);
@@ -1657,6 +1657,9 @@ nsCanvasRenderingContext2D::CreateRadialGradient(float x0, float y0, float r0, f
if (!FloatValidate(x0,y0,r0,x1,y1,r1))
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
+ if (r0 < 0.0 || r1 < 0.0)
+ return NS_ERROR_DOM_INDEX_SIZE_ERR;
+
nsRefPtr gradpat = new gfxPattern(x0, y0, r0, x1, y1, r1);
if (!gradpat)
return NS_ERROR_OUT_OF_MEMORY;
@@ -1674,6 +1677,9 @@ nsCanvasRenderingContext2D::CreatePattern(nsIDOMHTMLElement *image,
const nsAString& repeat,
nsIDOMCanvasPattern **_retval)
{
+ if (!image) {
+ return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
+ }
gfxPattern::GraphicsExtend extend;
if (repeat.IsEmpty() || repeat.EqualsLiteral("repeat")) {
@@ -2072,7 +2078,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::MoveTo(float x, float y)
{
if (!FloatValidate(x,y))
- return NS_ERROR_DOM_SYNTAX_ERR;
+ return NS_OK;
mHasPath = PR_TRUE;
mThebes->MoveTo(gfxPoint(x, y));
@@ -2083,7 +2089,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::LineTo(float x, float y)
{
if (!FloatValidate(x,y))
- return NS_ERROR_DOM_SYNTAX_ERR;
+ return NS_OK;
mHasPath = PR_TRUE;
mThebes->LineTo(gfxPoint(x, y));
@@ -2094,7 +2100,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::QuadraticCurveTo(float cpx, float cpy, float x, float y)
{
if (!FloatValidate(cpx,cpy,x,y))
- return NS_ERROR_DOM_SYNTAX_ERR;
+ return NS_OK;
// we will always have a current point, since beginPath forces
// a moveto(0,0)
@@ -2206,7 +2212,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::Rect(float x, float y, float w, float h)
{
if (!FloatValidate(x,y,w,h))
- return NS_ERROR_DOM_SYNTAX_ERR;
+ return NS_OK;
mHasPath = PR_TRUE;
mThebes->Rectangle(gfxRect(x, y, w, h));
diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html
index b2ba6ea318d..c0ce20e488b 100644
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -6647,13 +6647,13 @@ var ctx = canvas.getContext('2d');
var _thrown = undefined; try {
ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
var _thrown = undefined; try {
ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
var _thrown = undefined; try {
ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
}
@@ -13220,7 +13220,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
}
@@ -13335,7 +13335,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
}
@@ -13441,7 +13441,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
}
@@ -13705,7 +13705,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
}
@@ -14768,7 +14768,7 @@ var ctx = canvas.getContext('2d');
var _thrown = undefined; try {
ctx.createPattern(null, 'repeat');
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
}
@@ -14806,7 +14806,7 @@ var ctx = canvas.getContext('2d');
var _thrown = undefined; try {
ctx.createPattern(undefined, 'repeat');
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
}
@@ -18916,7 +18916,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
}
@@ -19030,7 +19030,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
}
diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
index 9cbc9f783e2..31d53795aca 100644
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7951,7 +7951,9 @@ nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
*aSessionStorage = nsnull;
nsString documentURI;
- mDocument->GetDocumentURI(documentURI);
+ if (mDocument) {
+ mDocument->GetDocumentURI(documentURI);
+ }
nsresult rv = docShell->GetSessionStorageForPrincipal(principal,
documentURI,
@@ -8035,7 +8037,9 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
NS_ENSURE_SUCCESS(rv, rv);
nsString documentURI;
- mDocument->GetDocumentURI(documentURI);
+ if (mDocument) {
+ mDocument->GetDocumentURI(documentURI);
+ }
rv = storageManager->GetLocalStorageForPrincipal(principal,
documentURI,