Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 #include "core/editing/EphemeralRange.h" | 53 #include "core/editing/EphemeralRange.h" |
| 54 #include "core/editing/FrameSelection.h" | 54 #include "core/editing/FrameSelection.h" |
| 55 #include "core/editing/VisiblePosition.h" | 55 #include "core/editing/VisiblePosition.h" |
| 56 #include "core/editing/markers/DocumentMarkerController.h" | 56 #include "core/editing/markers/DocumentMarkerController.h" |
| 57 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" | 57 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" |
| 58 #include "core/editing/spellcheck/SpellChecker.h" | 58 #include "core/editing/spellcheck/SpellChecker.h" |
| 59 #include "core/events/MouseEvent.h" | 59 #include "core/events/MouseEvent.h" |
| 60 #include "core/frame/FrameHost.h" | 60 #include "core/frame/FrameHost.h" |
| 61 #include "core/frame/FrameView.h" | 61 #include "core/frame/FrameView.h" |
| 62 #include "core/frame/LocalFrame.h" | 62 #include "core/frame/LocalFrame.h" |
| 63 #include "core/frame/RemoteDOMWindow.h" | |
|
dcheng
2017/03/23 01:47:09
Needed, because a few things in here now are deref
| |
| 63 #include "core/frame/RemoteFrame.h" | 64 #include "core/frame/RemoteFrame.h" |
| 64 #include "core/frame/Settings.h" | 65 #include "core/frame/Settings.h" |
| 65 #include "core/frame/VisualViewport.h" | 66 #include "core/frame/VisualViewport.h" |
| 66 #include "core/html/HTMLBodyElement.h" | 67 #include "core/html/HTMLBodyElement.h" |
| 67 #include "core/html/HTMLFormElement.h" | 68 #include "core/html/HTMLFormElement.h" |
| 68 #include "core/html/HTMLIFrameElement.h" | 69 #include "core/html/HTMLIFrameElement.h" |
| 69 #include "core/html/HTMLVideoElement.h" | 70 #include "core/html/HTMLVideoElement.h" |
| 70 #include "core/html/ImageDocument.h" | 71 #include "core/html/ImageDocument.h" |
| 71 #include "core/input/EventHandler.h" | 72 #include "core/input/EventHandler.h" |
| 72 #include "core/layout/HitTestResult.h" | 73 #include "core/layout/HitTestResult.h" |
| (...skipping 8870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8943 lastChild(mainFrame())->swap(remoteFrame); | 8944 lastChild(mainFrame())->swap(remoteFrame); |
| 8944 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); | 8945 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 8945 v8::Local<v8::Value> remoteWindowProperty = | 8946 v8::Local<v8::Value> remoteWindowProperty = |
| 8946 mainFrame()->executeScriptAndReturnValue( | 8947 mainFrame()->executeScriptAndReturnValue( |
| 8947 WebScriptSource("window[2].foo")); | 8948 WebScriptSource("window[2].foo")); |
| 8948 EXPECT_TRUE(remoteWindowProperty.IsEmpty()); | 8949 EXPECT_TRUE(remoteWindowProperty.IsEmpty()); |
| 8949 | 8950 |
| 8950 reset(); | 8951 reset(); |
| 8951 } | 8952 } |
| 8952 | 8953 |
| 8954 TEST_F(WebFrameSwapTest, RemoteWindowToString) { | |
| 8955 v8::HandleScope scope(v8::Isolate::GetCurrent()); | |
| 8956 | |
| 8957 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | |
| 8958 WebRemoteFrame* remoteFrame = remoteClient.frame(); | |
| 8959 lastChild(mainFrame())->swap(remoteFrame); | |
| 8960 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); | |
| 8961 v8::Local<v8::Value> exception = mainFrame()->executeScriptAndReturnValue( | |
| 8962 WebScriptSource("try { '' + window[2]; } catch (e) { e; }")); | |
| 8963 ASSERT_FALSE(exception.IsEmpty()); | |
| 8964 EXPECT_STREQ( | |
| 8965 "SecurityError: Blocked a frame with origin \"http://internal.test\" " | |
| 8966 "from accessing a cross-origin frame.", | |
| 8967 *v8::String::Utf8Value(exception)); | |
| 8968 | |
| 8969 reset(); | |
| 8970 } | |
| 8971 | |
| 8953 // TODO(alexmos, dcheng): This test and some other OOPIF tests use | 8972 // TODO(alexmos, dcheng): This test and some other OOPIF tests use |
| 8954 // very little of the test fixture support in WebFrameSwapTest. We should | 8973 // very little of the test fixture support in WebFrameSwapTest. We should |
| 8955 // clean these tests up. | 8974 // clean these tests up. |
| 8956 TEST_F(WebFrameSwapTest, FramesOfRemoteParentAreIndexable) { | 8975 TEST_F(WebFrameSwapTest, FramesOfRemoteParentAreIndexable) { |
| 8957 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8976 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 8958 | 8977 |
| 8959 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8978 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8960 WebRemoteFrame* remoteParentFrame = remoteClient.frame(); | 8979 WebRemoteFrame* remoteParentFrame = remoteClient.frame(); |
| 8961 mainFrame()->swap(remoteParentFrame); | 8980 mainFrame()->swap(remoteParentFrame); |
| 8962 remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); | 8981 remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| (...skipping 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11429 EXPECT_FALSE(testSelectAll("<textarea></textarea>")); | 11448 EXPECT_FALSE(testSelectAll("<textarea></textarea>")); |
| 11430 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>")); | 11449 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>")); |
| 11431 EXPECT_FALSE(testSelectAll("<input>")); | 11450 EXPECT_FALSE(testSelectAll("<input>")); |
| 11432 EXPECT_TRUE(testSelectAll("<input value='nonempty'>")); | 11451 EXPECT_TRUE(testSelectAll("<input value='nonempty'>")); |
| 11433 // TODO(amaralp): Empty contenteditable should not have select all enabled. | 11452 // TODO(amaralp): Empty contenteditable should not have select all enabled. |
| 11434 EXPECT_TRUE(testSelectAll("<div contenteditable></div>")); | 11453 EXPECT_TRUE(testSelectAll("<div contenteditable></div>")); |
| 11435 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>")); | 11454 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>")); |
| 11436 } | 11455 } |
| 11437 | 11456 |
| 11438 } // namespace blink | 11457 } // namespace blink |
| OLD | NEW |