Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 33523002: Have Frame::script() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/PageRuntimeAgent.cpp ('k') | Source/core/page/EventSource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 m_frame->editor().clear(); 269 m_frame->editor().clear();
270 m_frame->document()->cancelParsing(); 270 m_frame->document()->cancelParsing();
271 m_frame->document()->prepareForDestruction(); 271 m_frame->document()->prepareForDestruction();
272 m_frame->document()->removeFocusedElementOfSubtree(m_frame->document()); 272 m_frame->document()->removeFocusedElementOfSubtree(m_frame->document());
273 273
274 // Do this after detaching the document so that the unload event works. 274 // Do this after detaching the document so that the unload event works.
275 if (options & ClearWindowProperties) { 275 if (options & ClearWindowProperties) {
276 InspectorInstrumentation::frameWindowDiscarded(m_frame, m_frame->domWind ow()); 276 InspectorInstrumentation::frameWindowDiscarded(m_frame, m_frame->domWind ow());
277 m_frame->domWindow()->reset(); 277 m_frame->domWindow()->reset();
278 m_frame->script()->clearWindowShell(); 278 m_frame->script().clearWindowShell();
279 } 279 }
280 280
281 m_frame->selection().prepareForDestruction(); 281 m_frame->selection().prepareForDestruction();
282 m_frame->eventHandler()->clear(); 282 m_frame->eventHandler()->clear();
283 if (m_frame->view()) 283 if (m_frame->view())
284 m_frame->view()->clear(); 284 m_frame->view()->clear();
285 285
286 if (options & ClearWindowObject) { 286 if (options & ClearWindowObject) {
287 // Do not drop the DOMWindow (and Document) before the ScriptController and view are cleared 287 // Do not drop the DOMWindow (and Document) before the ScriptController and view are cleared
288 // as some destructors might still try to access the document. 288 // as some destructors might still try to access the document.
289 m_frame->setDOMWindow(0); 289 m_frame->setDOMWindow(0);
290 } 290 }
291 291
292 m_containsPlugins = false; 292 m_containsPlugins = false;
293 293
294 if (options & ClearScriptObjects) 294 if (options & ClearScriptObjects)
295 m_frame->script()->clearScriptObjects(); 295 m_frame->script().clearScriptObjects();
296 296
297 m_frame->script()->enableEval(); 297 m_frame->script().enableEval();
298 298
299 m_frame->navigationScheduler()->clear(); 299 m_frame->navigationScheduler()->clear();
300 300
301 m_checkTimer.stop(); 301 m_checkTimer.stop();
302 m_shouldCallCheckCompleted = false; 302 m_shouldCallCheckCompleted = false;
303 303
304 if (m_stateMachine.isDisplayingInitialEmptyDocument()) 304 if (m_stateMachine.isDisplayingInitialEmptyDocument())
305 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); 305 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad );
306 } 306 }
307 307
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 return FrameLoadTypeStandard; 678 return FrameLoadTypeStandard;
679 } 679 }
680 680
681 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) 681 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request)
682 { 682 {
683 // If no SecurityOrigin was specified, skip security checks and assume the c aller has fully initialized the FrameLoadRequest. 683 // If no SecurityOrigin was specified, skip security checks and assume the c aller has fully initialized the FrameLoadRequest.
684 if (!request.requester()) 684 if (!request.requester())
685 return true; 685 return true;
686 686
687 KURL url = request.resourceRequest().url(); 687 KURL url = request.resourceRequest().url();
688 if (m_frame->script()->executeScriptIfJavaScriptURL(url)) 688 if (m_frame->script().executeScriptIfJavaScriptURL(url))
689 return false; 689 return false;
690 690
691 if (!request.requester()->canDisplay(url)) { 691 if (!request.requester()->canDisplay(url)) {
692 reportLocalLoadFailed(m_frame, url.elidedString()); 692 reportLocalLoadFailed(m_frame, url.elidedString());
693 return false; 693 return false;
694 } 694 }
695 695
696 if (request.requester() && !request.formState() && request.frameName().isEmp ty()) 696 if (request.requester() && !request.formState() && request.frameName().isEmp ty())
697 request.setFrameName(m_frame->document()->baseTarget()); 697 request.setFrameName(m_frame->document()->baseTarget());
698 698
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 history()->setCurrentItem(currentItem.get()); 1567 history()->setCurrentItem(currentItem.get());
1568 } 1568 }
1569 1569
1570 void FrameLoader::dispatchDocumentElementAvailable() 1570 void FrameLoader::dispatchDocumentElementAvailable()
1571 { 1571 {
1572 m_client->documentElementAvailable(); 1572 m_client->documentElementAvailable();
1573 } 1573 }
1574 1574
1575 void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() 1575 void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds()
1576 { 1576 {
1577 if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 1577 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1578 return; 1578 return;
1579 1579
1580 Vector<RefPtr<DOMWrapperWorld> > worlds; 1580 Vector<RefPtr<DOMWrapperWorld> > worlds;
1581 DOMWrapperWorld::getAllWorlds(worlds); 1581 DOMWrapperWorld::getAllWorlds(worlds);
1582 for (size_t i = 0; i < worlds.size(); ++i) 1582 for (size_t i = 0; i < worlds.size(); ++i)
1583 dispatchDidClearWindowObjectInWorld(worlds[i].get()); 1583 dispatchDidClearWindowObjectInWorld(worlds[i].get());
1584 } 1584 }
1585 1585
1586 void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) 1586 void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
1587 { 1587 {
1588 if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript) || !m_fra me->script()->existingWindowShell(world)) 1588 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript) || !m_fram e->script().existingWindowShell(world))
1589 return; 1589 return;
1590 1590
1591 m_client->dispatchDidClearWindowObjectInWorld(world); 1591 m_client->dispatchDidClearWindowObjectInWorld(world);
1592 1592
1593 if (Page* page = m_frame->page()) 1593 if (Page* page = m_frame->page())
1594 page->inspectorController().didClearWindowObjectInWorld(m_frame, world); 1594 page->inspectorController().didClearWindowObjectInWorld(m_frame, world);
1595 1595
1596 InspectorInstrumentation::didClearWindowObjectInWorld(m_frame, world); 1596 InspectorInstrumentation::didClearWindowObjectInWorld(m_frame, world);
1597 } 1597 }
1598 1598
1599 SandboxFlags FrameLoader::effectiveSandboxFlags() const 1599 SandboxFlags FrameLoader::effectiveSandboxFlags() const
1600 { 1600 {
1601 SandboxFlags flags = m_forcedSandboxFlags; 1601 SandboxFlags flags = m_forcedSandboxFlags;
1602 if (Frame* parentFrame = m_frame->tree().parent()) 1602 if (Frame* parentFrame = m_frame->tree().parent())
1603 flags |= parentFrame->document()->sandboxFlags(); 1603 flags |= parentFrame->document()->sandboxFlags();
1604 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) 1604 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
1605 flags |= ownerElement->sandboxFlags(); 1605 flags |= ownerElement->sandboxFlags();
1606 return flags; 1606 return flags;
1607 } 1607 }
1608 1608
1609 } // namespace WebCore 1609 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/PageRuntimeAgent.cpp ('k') | Source/core/page/EventSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698