OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "core/frame/LocalDOMWindow.h" | 28 #include "core/frame/LocalDOMWindow.h" |
29 | 29 |
30 #include "bindings/core/v8/Dictionary.h" | 30 #include "bindings/core/v8/Dictionary.h" |
31 #include "bindings/core/v8/ExceptionMessages.h" | 31 #include "bindings/core/v8/ExceptionMessages.h" |
32 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
33 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 33 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
34 #include "bindings/core/v8/ScriptCallStackFactory.h" | 34 #include "bindings/core/v8/ScriptCallStackFactory.h" |
35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
36 #include "bindings/core/v8/SerializedScriptValue.h" | 36 #include "bindings/core/v8/SerializedScriptValue.h" |
37 #include "bindings/core/v8/V8DOMActivityLogger.h" | 37 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 38 #include "bindings/core/v8/V8Document.h" |
38 #include "core/css/CSSComputedStyleDeclaration.h" | 39 #include "core/css/CSSComputedStyleDeclaration.h" |
39 #include "core/css/CSSRuleList.h" | 40 #include "core/css/CSSRuleList.h" |
40 #include "core/css/DOMWindowCSS.h" | 41 #include "core/css/DOMWindowCSS.h" |
41 #include "core/css/MediaQueryList.h" | 42 #include "core/css/MediaQueryList.h" |
42 #include "core/css/MediaQueryMatcher.h" | 43 #include "core/css/MediaQueryMatcher.h" |
43 #include "core/css/StyleMedia.h" | 44 #include "core/css/StyleMedia.h" |
44 #include "core/css/resolver/StyleResolver.h" | 45 #include "core/css/resolver/StyleResolver.h" |
45 #include "core/dom/ContextFeatures.h" | 46 #include "core/dom/ContextFeatures.h" |
46 #include "core/dom/DOMImplementation.h" | 47 #include "core/dom/DOMImplementation.h" |
47 #include "core/dom/Document.h" | 48 #include "core/dom/Document.h" |
(...skipping 15 matching lines...) Expand all Loading... |
63 #include "core/frame/FrameConsole.h" | 64 #include "core/frame/FrameConsole.h" |
64 #include "core/frame/FrameHost.h" | 65 #include "core/frame/FrameHost.h" |
65 #include "core/frame/FrameView.h" | 66 #include "core/frame/FrameView.h" |
66 #include "core/frame/History.h" | 67 #include "core/frame/History.h" |
67 #include "core/frame/LocalFrame.h" | 68 #include "core/frame/LocalFrame.h" |
68 #include "core/frame/Location.h" | 69 #include "core/frame/Location.h" |
69 #include "core/frame/Navigator.h" | 70 #include "core/frame/Navigator.h" |
70 #include "core/frame/Screen.h" | 71 #include "core/frame/Screen.h" |
71 #include "core/frame/ScrollOptions.h" | 72 #include "core/frame/ScrollOptions.h" |
72 #include "core/frame/Settings.h" | 73 #include "core/frame/Settings.h" |
| 74 #include "core/frame/csp/ContentSecurityPolicy.h" |
73 #include "core/html/HTMLFrameOwnerElement.h" | 75 #include "core/html/HTMLFrameOwnerElement.h" |
74 #include "core/inspector/ConsoleMessage.h" | 76 #include "core/inspector/ConsoleMessage.h" |
75 #include "core/inspector/ConsoleMessageStorage.h" | 77 #include "core/inspector/ConsoleMessageStorage.h" |
76 #include "core/inspector/InspectorInstrumentation.h" | 78 #include "core/inspector/InspectorInstrumentation.h" |
77 #include "core/inspector/InspectorTraceEvents.h" | 79 #include "core/inspector/InspectorTraceEvents.h" |
78 #include "core/inspector/ScriptCallStack.h" | 80 #include "core/inspector/ScriptCallStack.h" |
79 #include "core/loader/DocumentLoader.h" | 81 #include "core/loader/DocumentLoader.h" |
80 #include "core/loader/FrameLoadRequest.h" | 82 #include "core/loader/FrameLoadRequest.h" |
81 #include "core/loader/FrameLoader.h" | 83 #include "core/loader/FrameLoader.h" |
82 #include "core/loader/FrameLoaderClient.h" | 84 #include "core/loader/FrameLoaderClient.h" |
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() | 1918 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() |
1917 { | 1919 { |
1918 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); | 1920 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); |
1919 } | 1921 } |
1920 | 1922 |
1921 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() | 1923 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() |
1922 { | 1924 { |
1923 return DOMWindowLifecycleNotifier::create(this); | 1925 return DOMWindowLifecycleNotifier::create(this); |
1924 } | 1926 } |
1925 | 1927 |
| 1928 void LocalDOMWindow::replaceDocument(String documentSource, String contentType,
String encodingName) |
| 1929 { |
| 1930 ASSERT(frame()); |
| 1931 RefPtrWillBeRawPtr<Document> oldDocument(m_document); |
| 1932 |
| 1933 DocumentInit init(oldDocument->url(), frame()); |
| 1934 |
| 1935 bool forceXHTML = contentType == "text/plain"; |
| 1936 |
| 1937 RefPtrWillBeRawPtr<Document> newDocument = installNewDocument(contentType, i
nit, forceXHTML); |
| 1938 |
| 1939 // Before parsing, we need to save & detach the old document and get the new
document |
| 1940 // in place. We have to do this only if we're rendering the result document. |
| 1941 if (FrameView* view = frame()->view()) |
| 1942 view->clear(); |
| 1943 |
| 1944 newDocument->updateSecurityOrigin(oldDocument->securityOrigin()); |
| 1945 newDocument->setCookieURL(oldDocument->cookieURL()); |
| 1946 newDocument->contentSecurityPolicy()->copyStateFrom(oldDocument->contentSecu
rityPolicy()); |
| 1947 |
| 1948 DocumentEncodingData data; |
| 1949 data.setEncoding(WTF::TextEncoding(encodingName)); |
| 1950 newDocument->setEncodingData(data); |
| 1951 |
| 1952 V8Document::PrivateScript::setTransformSourceDocumentMethod(frame(), newDocu
ment.get(), oldDocument.get()); |
| 1953 newDocument->setContent(documentSource); |
| 1954 } |
| 1955 |
1926 void LocalDOMWindow::trace(Visitor* visitor) | 1956 void LocalDOMWindow::trace(Visitor* visitor) |
1927 { | 1957 { |
1928 #if ENABLE(OILPAN) | 1958 #if ENABLE(OILPAN) |
1929 visitor->trace(m_frameObserver); | 1959 visitor->trace(m_frameObserver); |
1930 visitor->trace(m_document); | 1960 visitor->trace(m_document); |
1931 visitor->trace(m_properties); | 1961 visitor->trace(m_properties); |
1932 visitor->trace(m_screen); | 1962 visitor->trace(m_screen); |
1933 visitor->trace(m_history); | 1963 visitor->trace(m_history); |
1934 visitor->trace(m_locationbar); | 1964 visitor->trace(m_locationbar); |
1935 visitor->trace(m_menubar); | 1965 visitor->trace(m_menubar); |
(...skipping 22 matching lines...) Expand all Loading... |
1958 return m_frameObserver->frame(); | 1988 return m_frameObserver->frame(); |
1959 } | 1989 } |
1960 | 1990 |
1961 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1991 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1962 { | 1992 { |
1963 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1993 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1964 return v8::Handle<v8::Object>(); | 1994 return v8::Handle<v8::Object>(); |
1965 } | 1995 } |
1966 | 1996 |
1967 } // namespace blink | 1997 } // namespace blink |
OLD | NEW |