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

Unified Diff: third_party/WebKit/Source/core/html/PluginDocument.cpp

Issue 1642283002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Up to #50: ExtensionFrameHelper callbacks, comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/PluginDocument.cpp
diff --git a/third_party/WebKit/Source/core/html/PluginDocument.cpp b/third_party/WebKit/Source/core/html/PluginDocument.cpp
index 9e4f57c69a07dcead5179fea28ec3b7ae88991ac..74219c82e09df539083edf9daff2953a521e9349 100644
--- a/third_party/WebKit/Source/core/html/PluginDocument.cpp
+++ b/third_party/WebKit/Source/core/html/PluginDocument.cpp
@@ -93,10 +93,14 @@ void PluginDocumentParser::createDocumentStructure()
rootElement->insertedByParser();
document()->appendChild(rootElement);
frame->loader().dispatchDocumentElementAvailable();
+ if (isStopped())
+ return;
RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document());
body->setAttribute(styleAttr, "background-color: rgb(38,38,38); height: 100%; width: 100%; overflow: hidden; margin: 0");
rootElement->appendChild(body);
+ if (isStopped())
esprehn 2016/02/17 01:43:47 huh?
+ return;
m_embedElement = HTMLEmbedElement::create(*document());
m_embedElement->setAttribute(widthAttr, "100%");
@@ -106,6 +110,8 @@ void PluginDocumentParser::createDocumentStructure()
m_embedElement->setAttribute(srcAttr, AtomicString(document()->url().string()));
m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType());
body->appendChild(m_embedElement);
+ if (isStopped())
esprehn 2016/02/17 01:43:47 how does inserting the body run script internally?
+ return;
toPluginDocument(document())->setPluginNode(m_embedElement.get());
@@ -115,8 +121,11 @@ void PluginDocumentParser::createDocumentStructure()
// below so flush the layout tasks now instead of waiting on the timer.
frame->view()->flushAnyPendingPostLayoutTasks();
// Focus the plugin here, as the line above is where the plugin is created.
- if (frame->isMainFrame())
+ if (frame->isMainFrame()) {
m_embedElement->focus();
+ if (isStopped())
esprehn 2016/02/17 01:43:47 huh? What happens inside focus?
robwu 2016/02/22 00:15:02 It synchronously dispatches the focus event. A pot
+ return;
+ }
if (PluginView* view = pluginView())
view->didReceiveResponse(document()->loader()->response());
@@ -124,8 +133,11 @@ void PluginDocumentParser::createDocumentStructure()
void PluginDocumentParser::appendBytes(const char* data, size_t length)
{
- if (!m_embedElement)
+ if (!m_embedElement) {
createDocumentStructure();
+ if (isStopped())
+ return;
+ }
if (!length)
return;

Powered by Google App Engine
This is Rietveld 408576698