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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2713413002: Blink bindings: use v8 to enforce method call access checks (Closed)
Patch Set: . Created 3 years, 9 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 8798 matching lines...) Expand 10 before | Expand all | Expand 10 after
8809 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); 8809 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique());
8810 8810
8811 // Invoking setTimeout should throw a security error. 8811 // Invoking setTimeout should throw a security error.
8812 { 8812 {
8813 v8::Local<v8::Value> exception = mainFrame()->executeScriptAndReturnValue( 8813 v8::Local<v8::Value> exception = mainFrame()->executeScriptAndReturnValue(
8814 WebScriptSource("try {\n" 8814 WebScriptSource("try {\n"
8815 " savedSetTimeout.call(window[0], () => {}, 0);\n" 8815 " savedSetTimeout.call(window[0], () => {}, 0);\n"
8816 "} catch (e) { e; }")); 8816 "} catch (e) { e; }"));
8817 ASSERT_TRUE(!exception.IsEmpty()); 8817 ASSERT_TRUE(!exception.IsEmpty());
8818 EXPECT_EQ( 8818 EXPECT_EQ(
8819 "SecurityError: Failed to execute 'setTimeout' on 'Window': Blocked a " 8819 "SecurityError: Blocked a frame with origin \"http://internal.test\" "
8820 "frame with origin \"http://internal.test\" from accessing a " 8820 "from accessing a cross-origin frame.",
8821 "cross-origin frame.",
8822 toCoreString(exception 8821 toCoreString(exception
8823 ->ToString(ScriptState::forMainWorld( 8822 ->ToString(ScriptState::forMainWorld(
8824 webView()->mainFrameImpl()->frame()) 8823 webView()->mainFrameImpl()->frame())
8825 ->context()) 8824 ->context())
8826 .ToLocalChecked())); 8825 .ToLocalChecked()));
8827 } 8826 }
8828 8827
8829 reset(); 8828 reset();
8830 } 8829 }
8831 8830
(...skipping 2529 matching lines...) Expand 10 before | Expand all | Expand 10 after
11361 FrameTestHelpers::WebViewHelper openerHelper; 11360 FrameTestHelpers::WebViewHelper openerHelper;
11362 openerHelper.initialize(false, nullptr, &openerWebViewClient); 11361 openerHelper.initialize(false, nullptr, &openerWebViewClient);
11363 FrameTestHelpers::WebViewHelper helper; 11362 FrameTestHelpers::WebViewHelper helper;
11364 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); 11363 helper.initializeWithOpener(openerHelper.webView()->mainFrame());
11365 11364
11366 openerHelper.reset(); 11365 openerHelper.reset();
11367 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); 11366 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener());
11368 } 11367 }
11369 11368
11370 } // namespace blink 11369 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698