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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 2436003002: CSP: Add 'script-sample' to violation reports. (Closed)
Patch Set: Rebase. Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 460
461 return v8::Local<v8::Object>::Cast(v8value); 461 return v8::Local<v8::Object>::Cast(v8value);
462 } 462 }
463 463
464 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, 464 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url,
465 bool popupsAllowed) { 465 bool popupsAllowed) {
466 LocalFrame* frame = m_element->document().frame(); 466 LocalFrame* frame = m_element->document().frame();
467 if (!frame) 467 if (!frame)
468 return WebString(); 468 return WebString();
469 469
470 if (!m_element->document().contentSecurityPolicy()->allowJavaScriptURLs(
471 m_element, m_element->document().url(), OrdinalNumber())) {
472 return WebString();
473 }
474
475 const KURL& kurl = url; 470 const KURL& kurl = url;
476 DCHECK(kurl.protocolIs("javascript")); 471 DCHECK(kurl.protocolIs("javascript"));
477 472
478 String script = decodeURLEscapeSequences( 473 String script = decodeURLEscapeSequences(
479 kurl.getString().substring(strlen("javascript:"))); 474 kurl.getString().substring(strlen("javascript:")));
480 475
476 if (!m_element->document().contentSecurityPolicy()->allowJavaScriptURLs(
477 m_element, script, m_element->document().url(), OrdinalNumber())) {
478 return WebString();
479 }
480
481 UserGestureIndicator gestureIndicator( 481 UserGestureIndicator gestureIndicator(
482 popupsAllowed ? DocumentUserGestureToken::create( 482 popupsAllowed ? DocumentUserGestureToken::create(
483 frame->document(), UserGestureToken::NewGesture) 483 frame->document(), UserGestureToken::NewGesture)
484 : nullptr); 484 : nullptr);
485 v8::HandleScope handleScope(toIsolate(frame)); 485 v8::HandleScope handleScope(toIsolate(frame));
486 v8::Local<v8::Value> result = 486 v8::Local<v8::Value> result =
487 frame->script().executeScriptInMainWorldAndReturnValue( 487 frame->script().executeScriptInMainWorldAndReturnValue(
488 ScriptSourceCode(script)); 488 ScriptSourceCode(script));
489 489
490 // Failure is reported as a null string. 490 // Failure is reported as a null string.
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 // frame view. 985 // frame view.
986 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); 986 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect);
987 } 987 }
988 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 988 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
989 // Convert to the plugin position. 989 // Convert to the plugin position.
990 for (size_t i = 0; i < cutOutRects.size(); i++) 990 for (size_t i = 0; i < cutOutRects.size(); i++)
991 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 991 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
992 } 992 }
993 993
994 } // namespace blink 994 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698