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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 2644633006: Add KURL::protocolIsJavascript member function (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 Settings* settings = frame()->settings(); 274 Settings* settings = frame()->settings();
275 const bool allowed = 275 const bool allowed =
276 client->allowScript(settings && settings->getScriptEnabled()); 276 client->allowScript(settings && settings->getScriptEnabled());
277 if (!allowed && reason == AboutToExecuteScript) 277 if (!allowed && reason == AboutToExecuteScript)
278 client->didNotAllowScript(); 278 client->didNotAllowScript();
279 return allowed; 279 return allowed;
280 } 280 }
281 281
282 bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url, 282 bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url,
283 Element* element) { 283 Element* element) {
284 if (!protocolIsJavaScript(url)) 284 if (!url.protocolIsJavaScript())
285 return false; 285 return false;
286 286
287 bool shouldBypassMainWorldContentSecurityPolicy = 287 bool shouldBypassMainWorldContentSecurityPolicy =
288 ContentSecurityPolicy::shouldBypassMainWorld(frame()->document()); 288 ContentSecurityPolicy::shouldBypassMainWorld(frame()->document());
289 if (!frame()->page() || 289 if (!frame()->page() ||
290 (!shouldBypassMainWorldContentSecurityPolicy && 290 (!shouldBypassMainWorldContentSecurityPolicy &&
291 !frame()->document()->contentSecurityPolicy()->allowJavaScriptURLs( 291 !frame()->document()->contentSecurityPolicy()->allowJavaScriptURLs(
292 element, frame()->document()->url(), 292 element, frame()->document()->url(),
293 eventHandlerPosition().m_line))) { 293 eventHandlerPosition().m_line))) {
294 return true; 294 return true;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 for (size_t i = 0; i < resultArray->Length(); ++i) { 413 for (size_t i = 0; i < resultArray->Length(); ++i) {
414 v8::Local<v8::Value> value; 414 v8::Local<v8::Value> value;
415 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 415 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
416 return; 416 return;
417 results->push_back(value); 417 results->push_back(value);
418 } 418 }
419 } 419 }
420 } 420 }
421 421
422 } // namespace blink 422 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698