From d8d39bee4dddfd89da3c2659d56549b48b0b8055 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Mar 2011 11:47:00 -0400 Subject: [PATCH 01/10] Bug 630034 - Throw when attempting to create a radial gradient with negative radii; r=jmuizelaar --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 3 +++ content/canvas/test/test_canvas.html | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index eee22e826164..94bf8d684ae5 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -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; diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index b2ba6ea318de..63c8436fae28 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"); } From bc883e02414e973423673f2b07f2a4ffc2c22e76 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 1 Apr 2011 15:31:34 -0400 Subject: [PATCH 02/10] Bug 630271 - Throw a TYPE_MISMATCH_ERR on createPattern(null); r=smaug --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 3 +++ content/canvas/test/test_canvas.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 94bf8d684ae5..2c08b623f01b 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -1677,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")) { diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 63c8436fae28..2ae8604256b3 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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"); } From f1d4c09e5a5cdcbc1b7abd06e41da621d2e4827a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 29 Mar 2011 14:05:00 -0400 Subject: [PATCH 03/10] Bug 632493 - Handle non-finite values for lineTo per spec; r=roc --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/canvas/test/test_canvas.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 2c08b623f01b..65c90e23efc0 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -2089,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)); diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 2ae8604256b3..fa5c1603d433 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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'); } From 42d1eb15dae8fb752487ff02ea6358ba917ece5a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 29 Mar 2011 14:12:00 -0400 Subject: [PATCH 04/10] Bug 632495 - Handle non-finite values for moveTo per spec; r=roc --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/canvas/test/test_canvas.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 65c90e23efc0..5968a5091760 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -2078,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)); diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index fa5c1603d433..8f4d8a52a02a 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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'); } From b2a157a4c3e7c91ec31aff37759aa29bb0be9b24 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 1 Apr 2011 15:31:35 -0400 Subject: [PATCH 05/10] Bug 632502 - Handle non-finite values for quadraticCurveTo per spec; r=roc --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/canvas/test/test_canvas.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 5968a5091760..2db057b5e159 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -2100,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) diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 8f4d8a52a02a..e62f6ba6c95f 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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'); } From 2fadb143e99fc839f808fc76913e5781a51b29b5 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 1 Apr 2011 15:31:35 -0400 Subject: [PATCH 06/10] Bug 632503 - Handle non-finite values for rect per spec; r=roc --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/canvas/test/test_canvas.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 2db057b5e159..770856a5d8ae 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -2212,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 e62f6ba6c95f..1f2147e4d7f0 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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'); } From 832bfc960002024f450a72cbb0f8bc2386177c7f Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 1 Apr 2011 15:31:35 -0400 Subject: [PATCH 07/10] Bug 632515 - Handle non-finite values for transform per spec; r=roc --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/canvas/test/test_canvas.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 770856a5d8ae..b048b89bdaf8 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -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); diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 1f2147e4d7f0..ee9e215b45f4 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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'); } From bb205fcef32f91d2b7bead6e6e57091291958978 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 1 Apr 2011 15:31:35 -0400 Subject: [PATCH 08/10] Bug 632516 - Handle non-finite values for translate per spec; r=roc --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/canvas/test/test_canvas.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index b048b89bdaf8..56927aa042fa 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; diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index ee9e215b45f4..c0ce20e488b8 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -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'); } From a134445fe0b25aab4ef6426f9d4ceee6c6bd5960 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 1 Apr 2011 15:31:35 -0400 Subject: [PATCH 09/10] Bug 645331 - Remove unused nsAutoString in nsGenericElement::RemoveAttributeNS; r=smaug --- content/base/src/nsGenericElement.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 4c8c9bdfca69..9add99cbba42 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; From bcffc086edeb3169a2a832821884e437293df8d7 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 30 Mar 2011 08:58:21 +0200 Subject: [PATCH 10/10] Bug 646184 - Crash [@ nsGlobalWindow::GetLocalStorage] getting localStorage from removed frame; r=bz --- content/base/crashtests/646184.html | 17 +++++++++++++++++ content/base/crashtests/crashtests.list | 1 + dom/base/nsGlobalWindow.cpp | 8 ++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 content/base/crashtests/646184.html diff --git a/content/base/crashtests/646184.html b/content/base/crashtests/646184.html new file mode 100644 index 000000000000..ef34d41a64bc --- /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 c06123c42cfb..8ef191b605d8 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/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 9cbc9f783e2d..31d53795aca7 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,