Index: chrome/renderer/extensions/user_script_slave.cc |
diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc |
index bdaff10bb86692bbe69c3f3e69cadc438f90067c..249b439c68a1e589b500ae9f4c1c40232f3a3637 100644 |
--- a/chrome/renderer/extensions/user_script_slave.cc |
+++ b/chrome/renderer/extensions/user_script_slave.cc |
@@ -25,10 +25,10 @@ |
#include "extensions/common/extension_set.h" |
#include "extensions/common/manifest_handlers/csp_info.h" |
#include "extensions/common/permissions/permissions_data.h" |
+#include "extensions/renderer/script_context.h" |
#include "grit/renderer_resources.h" |
#include "third_party/WebKit/public/platform/WebURLRequest.h" |
#include "third_party/WebKit/public/platform/WebVector.h" |
-#include "third_party/WebKit/public/web/WebDataSource.h" |
#include "third_party/WebKit/public/web/WebDocument.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
#include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
@@ -179,24 +179,9 @@ bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) { |
return true; |
} |
-GURL UserScriptSlave::GetDataSourceURLForFrame(const WebFrame* frame) { |
- // Normally we would use frame->document().url() to determine the document's |
- // URL, but to decide whether to inject a content script, we use the URL from |
- // the data source. This "quirk" helps prevents content scripts from |
- // inadvertently adding DOM elements to the compose iframe in Gmail because |
- // the compose iframe's dataSource URL is about:blank, but the document URL |
- // changes to match the parent document after Gmail document.writes into |
- // it to create the editor. |
- // http://code.google.com/p/chromium/issues/detail?id=86742 |
- blink::WebDataSource* data_source = frame->provisionalDataSource() ? |
- frame->provisionalDataSource() : frame->dataSource(); |
- CHECK(data_source); |
- return GURL(data_source->request().url()); |
-} |
- |
void UserScriptSlave::InjectScripts(WebFrame* frame, |
UserScript::RunLocation location) { |
- GURL data_source_url = GetDataSourceURLForFrame(frame); |
+ GURL data_source_url = ScriptContext::GetDataSourceURLForFrame(frame); |
if (data_source_url.is_empty()) |
return; |
@@ -302,7 +287,7 @@ void UserScriptSlave::InjectScripts(WebFrame* frame, |
render_view->GetRoutingID(), |
extensions_executing_scripts, |
render_view->GetPageId(), |
- GetDataSourceURLForFrame(top_frame))); |
+ ScriptContext::GetDataSourceURLForFrame(top_frame))); |
} |
// Log debug info. |