static
| 111 | |
| 112 | // static |
| 113 | GURL 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 |
| 130 | GURL ScriptContext::GetEffectiveDocumentURL(const blink::WebFrame* frame, |