summaryrefslogtreecommitdiff
blob: 209de2bb0464acfb47e573b20293e6df0d838072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
? hpradhan@hedwig
Index: nsImageDocument.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/html/document/src/nsImageDocument.cpp,v
retrieving revision 1.87
diff -u -u -r1.87 nsImageDocument.cpp
--- content/html/document/src/nsImageDocument.cpp	28 Sep 2002 10:50:50 -0000	1.87
+++ content/html/document/src/nsImageDocument.cpp	11 Dec 2002 11:52:11 -0000
@@ -97,6 +97,8 @@
                                PRBool aReset = PR_TRUE,
                                nsIContentSink* aSink = nsnull);
 
+  NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
+
   nsresult CreateSyntheticDocument();
 
   nsresult EndLayout(nsISupports *ctxt, 
@@ -144,8 +146,6 @@
 NS_IMETHODIMP
 ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
 {
-  nsresult rv;
-
   nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
   if (!channel) return NS_ERROR_NULL_POINTER;
 
@@ -276,6 +276,18 @@
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
+{
+  if (!aScriptGlobalObject) {
+    // If the global object is being set to null, then it means we are
+    // going away soon. Drop our ref to imgRequest so that we dont end
+    // up leaking due to cycles through imgLib
+    mImageRequest = nsnull;
+  }
+
+  return nsHTMLDocument::SetScriptGlobalObject(aScriptGlobalObject);
+}
 
 nsresult
 nsImageDocument::CreateSyntheticDocument()