Attachment #507741: Fix test failures. for bug #604262

View | Details | Raw Unified | Return to bug 604262
Collapse All | Expand All

(-)a/content/base/src/nsImageLoadingContent.cpp (-4 / +7 lines)
Line     Link Here 
 Lines 488-495   NS_IMETHODIMP Link Here 
488
nsImageLoadingContent::GetRequest(PRInt32 aRequestType,
488
nsImageLoadingContent::GetRequest(PRInt32 aRequestType,
489
                                  imgIRequest** aRequest)
489
                                  imgIRequest** aRequest)
490
{
490
{
491
  NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
492
493
  switch(aRequestType) {
491
  switch(aRequestType) {
494
  case CURRENT_REQUEST:
492
  case CURRENT_REQUEST:
495
    *aRequest = mCurrentRequest;
493
    *aRequest = mCurrentRequest;
 Lines 534-541   nsImageLoadingContent::GetRequestType(im Link Here 
534
NS_IMETHODIMP
532
NS_IMETHODIMP
535
nsImageLoadingContent::GetCurrentURI(nsIURI** aURI)
533
nsImageLoadingContent::GetCurrentURI(nsIURI** aURI)
536
{
534
{
537
  NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
538
539
  if (mCurrentRequest) {
535
  if (mCurrentRequest) {
540
    return mCurrentRequest->GetURI(aURI);
536
    return mCurrentRequest->GetURI(aURI);
541
  }
537
  }
 Lines 1013-1018   nsImageLoadingContent::ClearPendingReque Link Here 
1013
{
1009
{
1014
  if (!mPendingRequest)
1010
  if (!mPendingRequest)
1015
    return;
1011
    return;
1012
1013
  // Push a null JSContext on the stack so that code that runs within
1014
  // the below code doesn't think it's being called by JS. See bug
1015
  // 604262.
1016
  nsCxPusher pusher;
1017
  pusher.PushNull();
1018
1016
  UntrackImage(mPendingRequest);
1019
  UntrackImage(mPendingRequest);
1017
  mPendingRequest->CancelAndForgetObserver(aReason);
1020
  mPendingRequest->CancelAndForgetObserver(aReason);
1018
  mPendingRequest = nsnull;
1021
  mPendingRequest = nsnull;
(-)a/content/html/document/src/nsImageDocument.cpp (+6 lines)
Line     Link Here 
 Lines 669-674   nsImageDocument::CreateSyntheticDocument Link Here 
669
  nsCAutoString src;
669
  nsCAutoString src;
670
  mDocumentURI->GetSpec(src);
670
  mDocumentURI->GetSpec(src);
671
671
672
  // Push a null JSContext on the stack so that code that runs within
673
  // the below code doesn't think it's being called by JS. See bug
674
  // 604262.
675
  nsCxPusher pusher;
676
  pusher.PushNull();
677
672
  NS_ConvertUTF8toUTF16 srcString(src);
678
  NS_ConvertUTF8toUTF16 srcString(src);
673
  // Make sure not to start the image load from here...
679
  // Make sure not to start the image load from here...
674
  imageLoader->SetLoadingEnabled(PR_FALSE);
680
  imageLoader->SetLoadingEnabled(PR_FALSE);
(-)a/layout/base/nsLayoutUtils.cpp (+6 lines)
Line     Link Here 
 Lines 3776-3781   nsLayoutUtils::SurfaceFromElement(nsIDOM Link Here 
3776
  if (!imageLoader)
3776
  if (!imageLoader)
3777
    return result;
3777
    return result;
3778
3778
3779
  // Push a null JSContext on the stack so that code that runs within
3780
  // the below code doesn't think it's being called by JS. See bug
3781
  // 604262.
3782
  nsCxPusher pusher;
3783
  pusher.PushNull();
3784
3779
  nsCOMPtr<imgIRequest> imgRequest;
3785
  nsCOMPtr<imgIRequest> imgRequest;
3780
  rv = imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
3786
  rv = imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
3781
                               getter_AddRefs(imgRequest));
3787
                               getter_AddRefs(imgRequest));
(-)a/layout/generic/nsImageFrame.cpp (-1 / +16 lines)
Line     Link Here 
 Lines 218-223   nsImageFrame::DestroyFrom(nsIFrame* aDes Link Here 
218
  if (mListener) {
218
  if (mListener) {
219
    nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
219
    nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
220
    if (imageLoader) {
220
    if (imageLoader) {
221
      // Push a null JSContext on the stack so that code that runs
222
      // within the below code doesn't think it's being called by
223
      // JS. See bug 604262.
224
      nsCxPusher pusher;
225
      pusher.PushNull();
226
221
      imageLoader->RemoveObserver(mListener);
227
      imageLoader->RemoveObserver(mListener);
222
    }
228
    }
223
    
229
    
 Lines 248-254   nsImageFrame::Init(nsIContent* aCon Link Here 
248
254
249
  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(aContent);
255
  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(aContent);
250
  NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);
256
  NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);
251
  imageLoader->AddObserver(mListener);
257
258
  {
259
    // Push a null JSContext on the stack so that code that runs
260
    // within the below code doesn't think it's being called by
261
    // JS. See bug 604262.
262
    nsCxPusher pusher;
263
    pusher.PushNull();
264
265
    imageLoader->AddObserver(mListener);
266
  }
252
267
253
  nsPresContext *aPresContext = PresContext();
268
  nsPresContext *aPresContext = PresContext();
254
  
269
  
(-)a/layout/generic/nsVideoFrame.cpp (+6 lines)
Line     Link Here 
 Lines 105-110   nsVideoFrame::CreateAnonymousContent(nsT Link Here 
105
    mPosterImage = NS_NewHTMLImageElement(nodeInfo.forget());
105
    mPosterImage = NS_NewHTMLImageElement(nodeInfo.forget());
106
    NS_ENSURE_TRUE(mPosterImage, NS_ERROR_OUT_OF_MEMORY);
106
    NS_ENSURE_TRUE(mPosterImage, NS_ERROR_OUT_OF_MEMORY);
107
107
108
    // Push a null JSContext on the stack so that code that runs
109
    // within the below code doesn't think it's being called by
110
    // JS. See bug 604262.
111
    nsCxPusher pusher;
112
    pusher.PushNull();
113
108
    // Set the nsImageLoadingContent::ImageState() to 0. This means that the
114
    // Set the nsImageLoadingContent::ImageState() to 0. This means that the
109
    // image will always report its state as 0, so it will never be reframed
115
    // image will always report its state as 0, so it will never be reframed
110
    // to show frames for loading or the broken image icon. This is important,
116
    // to show frames for loading or the broken image icon. This is important,
(-)a/layout/svg/base/src/nsSVGImageFrame.cpp (-1 / +14 lines)
Line     Link Here 
 Lines 145-151   nsSVGImageFrame::~nsSVGImageFrame() Link Here 
145
  if (mListener) {
145
  if (mListener) {
146
    nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
146
    nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
147
    if (imageLoader) {
147
    if (imageLoader) {
148
      imageLoader->RemoveObserver(mListener);
148
      // Push a null JSContext on the stack so that code that runs
149
      // within the below code doesn't think it's being called by
150
      // JS. See bug 604262.
151
      nsCxPusher pusher;
152
      pusher.PushNull();
153
 
154
     imageLoader->RemoveObserver(mListener);
149
    }
155
    }
150
    reinterpret_cast<nsSVGImageListener*>(mListener.get())->SetFrame(nsnull);
156
    reinterpret_cast<nsSVGImageListener*>(mListener.get())->SetFrame(nsnull);
151
  }
157
  }
 Lines 169-174   nsSVGImageFrame::Init(nsIContent* aConte Link Here 
169
  if (!mListener) return NS_ERROR_OUT_OF_MEMORY;
175
  if (!mListener) return NS_ERROR_OUT_OF_MEMORY;
170
  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
176
  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
171
  NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);
177
  NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);
178
179
  // Push a null JSContext on the stack so that code that runs within
180
  // the below code doesn't think it's being called by JS. See bug
181
  // 604262.
182
  nsCxPusher pusher;
183
  pusher.PushNull();
184
172
  imageLoader->AddObserver(mListener);
185
  imageLoader->AddObserver(mListener);
173
186
174
  return NS_OK; 
187
  return NS_OK; 

Return to bug 604262