| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 256 } |
| 257 | 257 |
| 258 DEFINE_TRACE(FrameLoader) { | 258 DEFINE_TRACE(FrameLoader) { |
| 259 visitor->Trace(frame_); | 259 visitor->Trace(frame_); |
| 260 visitor->Trace(progress_tracker_); | 260 visitor->Trace(progress_tracker_); |
| 261 visitor->Trace(document_loader_); | 261 visitor->Trace(document_loader_); |
| 262 visitor->Trace(provisional_document_loader_); | 262 visitor->Trace(provisional_document_loader_); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void FrameLoader::Init() { | 265 void FrameLoader::Init() { |
| 266 ScriptForbiddenScope forbid_scripts; |
| 266 ResourceRequest initial_request(KURL(kParsedURLString, g_empty_string)); | 267 ResourceRequest initial_request(KURL(kParsedURLString, g_empty_string)); |
| 267 initial_request.SetRequestContext(WebURLRequest::kRequestContextInternal); | 268 initial_request.SetRequestContext(WebURLRequest::kRequestContextInternal); |
| 268 initial_request.SetFrameType(frame_->IsMainFrame() | 269 initial_request.SetFrameType(frame_->IsMainFrame() |
| 269 ? WebURLRequest::kFrameTypeTopLevel | 270 ? WebURLRequest::kFrameTypeTopLevel |
| 270 : WebURLRequest::kFrameTypeNested); | 271 : WebURLRequest::kFrameTypeNested); |
| 271 provisional_document_loader_ = | 272 provisional_document_loader_ = |
| 272 Client()->CreateDocumentLoader(frame_, initial_request, SubstituteData(), | 273 Client()->CreateDocumentLoader(frame_, initial_request, SubstituteData(), |
| 273 ClientRedirectPolicy::kNotClientRedirect); | 274 ClientRedirectPolicy::kNotClientRedirect); |
| 274 provisional_document_loader_->StartLoadingMainResource(); | 275 provisional_document_loader_->StartLoadingMainResource(); |
| 275 frame_->GetDocument()->CancelParsing(); | 276 frame_->GetDocument()->CancelParsing(); |
| 276 state_machine_.AdvanceTo( | 277 state_machine_.AdvanceTo( |
| 277 FrameLoaderStateMachine::kDisplayingInitialEmptyDocument); | 278 FrameLoaderStateMachine::kDisplayingInitialEmptyDocument); |
| 278 // Suppress finish notifications for inital empty documents, since they don't | 279 // Suppress finish notifications for initial empty documents, since they don't |
| 279 // generate start notifications. | 280 // generate start notifications. |
| 280 if (document_loader_) | 281 document_loader_->SetSentDidFinishLoad(); |
| 281 document_loader_->SetSentDidFinishLoad(); | 282 if (frame_->GetPage()->Suspended()) |
| 282 // Self-suspend if created in an already suspended Page. Note that both | |
| 283 // startLoadingMainResource() and cancelParsing() may have already detached | |
| 284 // the frame, since they both fire JS events. | |
| 285 if (frame_->GetPage() && frame_->GetPage()->Suspended()) | |
| 286 SetDefersLoading(true); | 283 SetDefersLoading(true); |
| 287 TakeObjectSnapshot(); | 284 TakeObjectSnapshot(); |
| 288 } | 285 } |
| 289 | 286 |
| 290 LocalFrameClient* FrameLoader::Client() const { | 287 LocalFrameClient* FrameLoader::Client() const { |
| 291 return static_cast<LocalFrameClient*>(frame_->Client()); | 288 return static_cast<LocalFrameClient*>(frame_->Client()); |
| 292 } | 289 } |
| 293 | 290 |
| 294 void FrameLoader::SetDefersLoading(bool defers) { | 291 void FrameLoader::SetDefersLoading(bool defers) { |
| 295 if (provisional_document_loader_) | 292 if (provisional_document_loader_) |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 // TODO(japhet): This is needed because the browser process DCHECKs if the | 1741 // TODO(japhet): This is needed because the browser process DCHECKs if the |
| 1745 // first entry we commit in a new frame has replacement set. It's unclear | 1742 // first entry we commit in a new frame has replacement set. It's unclear |
| 1746 // whether the DCHECK is right, investigate removing this special case. | 1743 // whether the DCHECK is right, investigate removing this special case. |
| 1747 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1744 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
| 1748 (!Opener() || !request.Url().IsEmpty()); | 1745 (!Opener() || !request.Url().IsEmpty()); |
| 1749 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1746 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
| 1750 return loader; | 1747 return loader; |
| 1751 } | 1748 } |
| 1752 | 1749 |
| 1753 } // namespace blink | 1750 } // namespace blink |
| OLD | NEW |