| 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 20 matching lines...) Expand all Loading... |
| 31 #include "public/web/WebFrame.h" | 31 #include "public/web/WebFrame.h" |
| 32 | 32 |
| 33 #include <stdarg.h> | 33 #include <stdarg.h> |
| 34 | 34 |
| 35 #include <map> | 35 #include <map> |
| 36 #include <memory> | 36 #include <memory> |
| 37 | 37 |
| 38 #include "SkBitmap.h" | 38 #include "SkBitmap.h" |
| 39 #include "SkCanvas.h" | 39 #include "SkCanvas.h" |
| 40 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 40 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| 41 #include "bindings/core/v8/V8Binding.h" |
| 41 #include "bindings/core/v8/V8Node.h" | 42 #include "bindings/core/v8/V8Node.h" |
| 42 #include "bindings/core/v8/serialization/V8ScriptValueSerializer.h" | 43 #include "bindings/core/v8/serialization/V8ScriptValueSerializer.h" |
| 43 #include "core/clipboard/DataTransfer.h" | 44 #include "core/clipboard/DataTransfer.h" |
| 44 #include "core/css/StyleSheetContents.h" | 45 #include "core/css/StyleSheetContents.h" |
| 45 #include "core/css/resolver/StyleResolver.h" | 46 #include "core/css/resolver/StyleResolver.h" |
| 46 #include "core/css/resolver/ViewportStyleResolver.h" | 47 #include "core/css/resolver/ViewportStyleResolver.h" |
| 47 #include "core/dom/Document.h" | 48 #include "core/dom/Document.h" |
| 48 #include "core/dom/DocumentUserGestureToken.h" | 49 #include "core/dom/DocumentUserGestureToken.h" |
| 49 #include "core/dom/Fullscreen.h" | 50 #include "core/dom/Fullscreen.h" |
| 50 #include "core/dom/NodeComputedStyle.h" | 51 #include "core/dom/NodeComputedStyle.h" |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 } // namespace | 1015 } // namespace |
| 1015 | 1016 |
| 1016 TEST_P(ParameterizedWebFrameTest, PostMessageThenDetach) { | 1017 TEST_P(ParameterizedWebFrameTest, PostMessageThenDetach) { |
| 1017 FrameTestHelpers::WebViewHelper webViewHelper; | 1018 FrameTestHelpers::WebViewHelper webViewHelper; |
| 1018 webViewHelper.initializeAndLoad("about:blank"); | 1019 webViewHelper.initializeAndLoad("about:blank"); |
| 1019 | 1020 |
| 1020 LocalFrame* frame = | 1021 LocalFrame* frame = |
| 1021 toLocalFrame(webViewHelper.webView()->page()->mainFrame()); | 1022 toLocalFrame(webViewHelper.webView()->page()->mainFrame()); |
| 1022 NonThrowableExceptionState exceptionState; | 1023 NonThrowableExceptionState exceptionState; |
| 1023 RefPtr<SerializedScriptValue> message = | 1024 RefPtr<SerializedScriptValue> message = |
| 1024 serializeString("message", ScriptState::forMainWorld(frame)); | 1025 serializeString("message", toScriptStateForMainWorld(frame)); |
| 1025 MessagePortArray messagePorts; | 1026 MessagePortArray messagePorts; |
| 1026 frame->domWindow()->postMessage(message, messagePorts, "*", | 1027 frame->domWindow()->postMessage(message, messagePorts, "*", |
| 1027 frame->domWindow(), exceptionState); | 1028 frame->domWindow(), exceptionState); |
| 1028 webViewHelper.reset(); | 1029 webViewHelper.reset(); |
| 1029 EXPECT_FALSE(exceptionState.hadException()); | 1030 EXPECT_FALSE(exceptionState.hadException()); |
| 1030 | 1031 |
| 1031 // Success is not crashing. | 1032 // Success is not crashing. |
| 1032 runPendingTasks(); | 1033 runPendingTasks(); |
| 1033 } | 1034 } |
| 1034 | 1035 |
| (...skipping 7820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8855 { | 8856 { |
| 8856 v8::Local<v8::Value> exception = mainFrame()->executeScriptAndReturnValue( | 8857 v8::Local<v8::Value> exception = mainFrame()->executeScriptAndReturnValue( |
| 8857 WebScriptSource("try {\n" | 8858 WebScriptSource("try {\n" |
| 8858 " savedSetTimeout.call(window[0], () => {}, 0);\n" | 8859 " savedSetTimeout.call(window[0], () => {}, 0);\n" |
| 8859 "} catch (e) { e; }")); | 8860 "} catch (e) { e; }")); |
| 8860 ASSERT_TRUE(!exception.IsEmpty()); | 8861 ASSERT_TRUE(!exception.IsEmpty()); |
| 8861 EXPECT_EQ( | 8862 EXPECT_EQ( |
| 8862 "SecurityError: Blocked a frame with origin \"http://internal.test\" " | 8863 "SecurityError: Blocked a frame with origin \"http://internal.test\" " |
| 8863 "from accessing a cross-origin frame.", | 8864 "from accessing a cross-origin frame.", |
| 8864 toCoreString(exception | 8865 toCoreString(exception |
| 8865 ->ToString(ScriptState::forMainWorld( | 8866 ->ToString(toScriptStateForMainWorld( |
| 8866 webView()->mainFrameImpl()->frame()) | 8867 webView()->mainFrameImpl()->frame()) |
| 8867 ->context()) | 8868 ->context()) |
| 8868 .ToLocalChecked())); | 8869 .ToLocalChecked())); |
| 8869 } | 8870 } |
| 8870 | 8871 |
| 8871 reset(); | 8872 reset(); |
| 8872 } | 8873 } |
| 8873 | 8874 |
| 8874 TEST_F(WebFrameSwapTest, SwapInitializesGlobal) { | 8875 TEST_F(WebFrameSwapTest, SwapInitializesGlobal) { |
| 8875 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8876 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| (...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11524 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); | 11525 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); |
| 11525 | 11526 |
| 11526 // Local frame with remote parent should have transparent baseBackgroundColor. | 11527 // Local frame with remote parent should have transparent baseBackgroundColor. |
| 11527 Color color = localFrame->frameView()->baseBackgroundColor(); | 11528 Color color = localFrame->frameView()->baseBackgroundColor(); |
| 11528 EXPECT_EQ(Color::transparent, color); | 11529 EXPECT_EQ(Color::transparent, color); |
| 11529 | 11530 |
| 11530 view->close(); | 11531 view->close(); |
| 11531 } | 11532 } |
| 11532 | 11533 |
| 11533 } // namespace blink | 11534 } // namespace blink |
| OLD | NEW |