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

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

Issue 1642283002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last nits Created 4 years, 9 months 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
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "core/page/ChromeClient.h" 77 #include "core/page/ChromeClient.h"
78 #include "core/page/CreateWindow.h" 78 #include "core/page/CreateWindow.h"
79 #include "core/page/FrameTree.h" 79 #include "core/page/FrameTree.h"
80 #include "core/page/Page.h" 80 #include "core/page/Page.h"
81 #include "core/page/WindowFeatures.h" 81 #include "core/page/WindowFeatures.h"
82 #include "core/page/scrolling/ScrollingCoordinator.h" 82 #include "core/page/scrolling/ScrollingCoordinator.h"
83 #include "core/svg/graphics/SVGImage.h" 83 #include "core/svg/graphics/SVGImage.h"
84 #include "core/xml/parser/XMLDocumentParser.h" 84 #include "core/xml/parser/XMLDocumentParser.h"
85 #include "platform/Logging.h" 85 #include "platform/Logging.h"
86 #include "platform/PluginScriptForbiddenScope.h" 86 #include "platform/PluginScriptForbiddenScope.h"
87 #include "platform/ScriptForbiddenScope.h"
87 #include "platform/UserGestureIndicator.h" 88 #include "platform/UserGestureIndicator.h"
88 #include "platform/network/HTTPParsers.h" 89 #include "platform/network/HTTPParsers.h"
89 #include "platform/network/ResourceRequest.h" 90 #include "platform/network/ResourceRequest.h"
90 #include "platform/scroll/ScrollAnimatorBase.h" 91 #include "platform/scroll/ScrollAnimatorBase.h"
91 #include "platform/weborigin/SecurityOrigin.h" 92 #include "platform/weborigin/SecurityOrigin.h"
92 #include "platform/weborigin/SecurityPolicy.h" 93 #include "platform/weborigin/SecurityPolicy.h"
93 #include "public/platform/WebURLRequest.h" 94 #include "public/platform/WebURLRequest.h"
94 #include "wtf/TemporaryChange.h" 95 #include "wtf/TemporaryChange.h"
95 #include "wtf/text/CString.h" 96 #include "wtf/text/CString.h"
96 #include "wtf/text/WTFString.h" 97 #include "wtf/text/WTFString.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 if (m_stateMachine.creatingInitialEmptyDocument()) 488 if (m_stateMachine.creatingInitialEmptyDocument())
488 return; 489 return;
489 490
490 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves 491 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves
491 // because doing so will cause us to re-enter the destructor when protector goes out of scope. 492 // because doing so will cause us to re-enter the destructor when protector goes out of scope.
492 // Null-checking the FrameView indicates whether or not we're in the destruc tor. 493 // Null-checking the FrameView indicates whether or not we're in the destruc tor.
493 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr); 494 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr);
494 495
495 m_progressTracker->finishedParsing(); 496 m_progressTracker->finishedParsing();
496 497
498 if (client()) {
499 ScriptForbiddenScope forbidScripts;
500 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa der->isCommittedButEmpty() : true);
501 }
502
497 if (client()) 503 if (client())
498 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa der->isCommittedButEmpty() : true); 504 client()->runScriptsAtDocumentReady();
499 505
500 checkCompleted(); 506 checkCompleted();
501 507
502 if (!m_frame->view()) 508 if (!m_frame->view())
503 return; // We are being destroyed by something checkCompleted called. 509 return; // We are being destroyed by something checkCompleted called.
504 510
505 // Check if the scrollbars are really needed for the content. 511 // Check if the scrollbars are really needed for the content.
506 // If not, remove them, relayout, and repaint. 512 // If not, remove them, relayout, and repaint.
507 m_frame->view()->restoreScrollbar(); 513 m_frame->view()->restoreScrollbar();
508 processFragment(m_frame->document()->url(), NavigationToDifferentDocument); 514 processFragment(m_frame->document()->url(), NavigationToDifferentDocument);
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 if (!url.isAboutSrcdocURL()) 1497 if (!url.isAboutSrcdocURL())
1492 return false; 1498 return false;
1493 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 1499 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
1494 if (!isHTMLIFrameElement(ownerElement)) 1500 if (!isHTMLIFrameElement(ownerElement))
1495 return false; 1501 return false;
1496 return ownerElement->fastHasAttribute(srcdocAttr); 1502 return ownerElement->fastHasAttribute(srcdocAttr);
1497 } 1503 }
1498 1504
1499 void FrameLoader::dispatchDocumentElementAvailable() 1505 void FrameLoader::dispatchDocumentElementAvailable()
1500 { 1506 {
1507 ScriptForbiddenScope forbidScripts;
1501 client()->documentElementAvailable(); 1508 client()->documentElementAvailable();
1502 } 1509 }
1503 1510
1511 void FrameLoader::runScriptsAtDocumentElementAvailable()
1512 {
1513 client()->runScriptsAtDocumentElementAvailable();
1514 // The frame might be detached at this point.
1515 }
1516
1504 void FrameLoader::dispatchDidClearDocumentOfWindowObject() 1517 void FrameLoader::dispatchDidClearDocumentOfWindowObject()
1505 { 1518 {
1506 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1519 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1507 return; 1520 return;
1508 1521
1509 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame); 1522 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame);
1510 1523
1511 if (m_dispatchingDidClearWindowObjectInMainWorld) 1524 if (m_dispatchingDidClearWindowObjectInMainWorld)
1512 return; 1525 return;
1513 TemporaryChange<bool> 1526 TemporaryChange<bool>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 // FIXME: We need a way to propagate insecure requests policy flags to 1587 // FIXME: We need a way to propagate insecure requests policy flags to
1575 // out-of-process frames. For now, we'll always use default behavior. 1588 // out-of-process frames. For now, we'll always use default behavior.
1576 if (!parentFrame->isLocalFrame()) 1589 if (!parentFrame->isLocalFrame())
1577 return nullptr; 1590 return nullptr;
1578 1591
1579 ASSERT(toLocalFrame(parentFrame)->document()); 1592 ASSERT(toLocalFrame(parentFrame)->document());
1580 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1593 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1581 } 1594 }
1582 1595
1583 } // namespace blink 1596 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.h ('k') | third_party/WebKit/Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698