MCPcopy Create free account
hub / github.com/breach/thrust / GetDataSourceURLForFrame

Method GetDataSourceURLForFrame

src/renderer/extensions/script_context.cc:113–127  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

111
112// static
113GURL ScriptContext::GetDataSourceURLForFrame(const blink::WebFrame* frame) {
114 // Normally we would use frame->document().url() to determine the document's
115 // URL, but to decide whether to inject a content script, we use the URL from
116 // the data source. This "quirk" helps prevents content scripts from
117 // inadvertently adding DOM elements to the compose iframe in Gmail because
118 // the compose iframe's dataSource URL is about:blank, but the document URL
119 // changes to match the parent document after Gmail document.writes into
120 // it to create the editor.
121 // http://code.google.com/p/chromium/issues/detail?id=86742
122 blink::WebDataSource* data_source = frame->provisionalDataSource()
123 ? frame->provisionalDataSource()
124 : frame->dataSource();
125 CHECK(data_source);
126 return GURL(data_source->request().url());
127}
128
129// static
130GURL ScriptContext::GetEffectiveDocumentURL(const blink::WebFrame* frame,

Callers

nothing calls this directly

Calls 1

GURLClass · 0.70

Tested by

no test coverage detected