Bug 599966: Null check argument of window.createBlobURL to avoid crashing. r=sicking a=blocking-beta-8
authorKyle Huey <khuey@kylehuey.com>
Sat, 02 Oct 2010 04:24:41 -0400
changeset 54970 2cd506bdbd5069a2f4d62a3d0eb0a9bacec2de82
parent 54969 a0699cc12503412e55ca6e10132dbda2b47dd583
child 54971 0ac9a37f942828d1987a7adcdbe9512cbf9d3988
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, blocking-beta-8
bugs599966
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 599966: Null check argument of window.createBlobURL to avoid crashing. r=sicking a=blocking-beta-8
content/base/test/file_mozfiledataurl_doc.html
content/base/test/file_mozfiledataurl_img.jpg
content/base/test/file_mozfiledataurl_inner.html
content/base/test/file_mozfiledataurl_text.txt
content/base/test/test_mozfiledataurl.html
dom/base/nsGlobalWindow.cpp
--- a/content/base/test/test_mozfiledataurl.html
+++ b/content/base/test/test_mozfiledataurl.html
@@ -16,16 +16,20 @@
 <input type=file id=fileList>
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
+try {
+  createBlobURL(undefined);
+} catch(e) { }
+
 window.addEventListener("message", function(e) {
   gen.send(JSON.parse(e.data));
 }, false);
 
 const innerSameSiteURI = "file_mozfiledataurl_inner.html";
 const innerCrossSiteURI = "http://example.com/tests/content/base/test/file_mozfiledataurl_inner.html"
 
 gen = runTest();
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3063,16 +3063,18 @@ nsGlobalWindow::GetApplicationCache(nsID
 
 NS_IMETHODIMP
 nsGlobalWindow::CreateBlobURL(nsIDOMFile* aFile, nsAString& aURL)
 {
   FORWARD_TO_INNER(CreateBlobURL, (aFile, aURL), NS_ERROR_UNEXPECTED);
 
   NS_ENSURE_STATE(mDoc);
 
+  NS_ENSURE_ARG_POINTER(aFile);
+
   nsresult rv = aFile->GetInternalUrl(mDoc->NodePrincipal(), aURL);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mDoc->RegisterFileDataUri(NS_LossyConvertUTF16toASCII(aURL));
 
   return NS_OK;
 }