Changeset 56841 in webkit
- Timestamp:
- Mar 31, 2010 8:24:19 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56839 r56841 1 2010-03-30 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: get rid of "Unsafe JavaScript attempt..." message when inspecting frames whose content has changed. 6 7 https://bugs.webkit.org/show_bug.cgi?id=36828 8 9 * http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt: 10 * http/tests/inspector-enabled/resources/console-log-frame-before-navigation.html: 11 1 12 2010-03-31 Nikolas Zimmermann <nzimmermann@rim.com> 2 13 -
trunk/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt
r56708 r56841 1 1 CONSOLE MESSAGE: line 5: 2010 2 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/inspector-enabled/resources/console-log-frame-after-navigation.html from frame with URL http://127.0.0.1:8000/inspector-enabled/resources/console-log-frame-before-navigation.html. Domains, protocols and ports must match.3 4 2 Tests that Web Inspector won't crash if there are messages written to console from a frame which has already navigated to a page from a different domain. 5 3 … … 8 6 Received console messages: 9 7 Message[0]: 10 URL:11 Message: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/inspector-enabled/resources/console-log-frame-after-navigation.html from frame with URL http://127.0.0.1:8000/inspector-enabled/resources/console-log-frame-before-navigation.html. Domains, protocols and ports must match.12 13 Message[1]:14 8 URL: http://127.0.0.1:8000/inspector-enabled/resources/console-log-frame-before-navigation.html 15 Message: 2010 9 Message: 2010 [object HTMLHtmlElement] 16 10 TEST COMPLETE. 17 11 -
trunk/LayoutTests/http/tests/inspector-enabled/resources/console-log-frame-before-navigation.html
r56708 r56841 3 3 <script> 4 4 function handleLoad() { 5 console.log(2010 );5 console.log(2010, document.documentElement); 6 6 7 7 setTimeout(function() { -
trunk/WebCore/ChangeLog
r56840 r56841 1 2010-03-31 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Check that injected script can still access inspected window object when wrapping console object. When the window cannot be access serialize objects as strings. Also don't call InjectedScript.dispatch if the window cannot be accessed (due to frame navigation). 6 7 https://bugs.webkit.org/show_bug.cgi?id=36828 8 9 * bindings/js/JSInjectedScriptHostCustom.cpp: 10 (WebCore::InjectedScriptHost::canAccessInspectedWindow): 11 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 12 (WebCore::InjectedScriptHost::canAccessInspectedWindow): 13 * inspector/InjectedScript.cpp: 14 (WebCore::InjectedScript::wrapForConsole): 15 * inspector/InjectedScriptHost.h: 16 * inspector/front-end/InjectedScript.js: 17 (injectedScriptConstructor): 18 1 19 2010-03-31 Mattias Nissler <mnissler@google.com> 2 20 -
trunk/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r55771 r56841 49 49 #include "InspectorResource.h" 50 50 #include "JSDOMWindow.h" 51 #include "JSDOMWindowCustom.h" 51 52 #include "JSNode.h" 52 53 #include "JSRange.h" … … 230 231 } 231 232 233 bool InjectedScriptHost::canAccessInspectedWindow(ScriptState* scriptState) 234 { 235 JSLock lock(SilenceAssertionsOnly); 236 JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject()); 237 if (!inspectedWindow) 238 return false; 239 return inspectedWindow->allowsAccessFromNoErrorMessage(scriptState); 240 } 241 232 242 } // namespace WebCore 233 243 -
trunk/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r55798 r56841 43 43 44 44 #include "V8Binding.h" 45 #include "V8BindingState.h" 46 #include "V8DOMWindow.h" 45 47 #include "V8Database.h" 46 48 #include "V8Node.h" … … 247 249 } 248 250 251 bool InjectedScriptHost::canAccessInspectedWindow(ScriptState* scriptState) 252 { 253 v8::Local<v8::Context> context = scriptState->context(); 254 v8::Local<v8::Object> global = context->Global(); 255 if (global.IsEmpty()) 256 return false; 257 v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global); 258 if (holder.IsEmpty()) 259 return false; 260 Frame* frame = V8DOMWindow::toNative(holder)->frame(); 261 262 v8::Context::Scope contextScope(context); 263 return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, false); 264 } 265 249 266 } // namespace WebCore -
trunk/WebCore/inspector/InjectedScript.cpp
r56532 r56841 48 48 { 49 49 ASSERT(!hasNoValue()); 50 if (!canAccessInspectedWindow()) { 51 *hadException = true; 52 return; 53 } 54 50 55 ScriptFunctionCall function(m_injectedScriptObject, "dispatch"); 51 56 function.appendArgument(methodName); … … 72 77 { 73 78 ASSERT(!hasNoValue()); 74 ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject ");79 ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObjectForConsole"); 75 80 wrapFunction.appendArgument(value); 76 wrapFunction.appendArgument( "console");81 wrapFunction.appendArgument(canAccessInspectedWindow()); 77 82 bool hadException = false; 78 83 ScriptValue r = wrapFunction.call(hadException); … … 89 94 releaseFunction.call(); 90 95 } 96 bool InjectedScript::canAccessInspectedWindow() 97 { 98 return InjectedScriptHost::canAccessInspectedWindow(m_injectedScriptObject.scriptState()); 99 } 91 100 92 101 } // namespace WebCore -
trunk/WebCore/inspector/InjectedScript.h
r54421 r56841 59 59 friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*); 60 60 explicit InjectedScript(ScriptObject); 61 bool canAccessInspectedWindow(); 61 62 ScriptObject m_injectedScriptObject; 62 63 }; -
trunk/WebCore/inspector/InjectedScriptHost.h
r56404 r56841 94 94 void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); 95 95 96 static bool canAccessInspectedWindow(ScriptState*); 97 96 98 private: 97 99 InjectedScriptHost(InspectorController* inspectorController); -
trunk/WebCore/inspector/front-end/InjectedScript.js
r56708 r56841 34 34 InjectedScript.idToWrappedObject = {}; 35 35 InjectedScript.objectGroups = {}; 36 37 InjectedScript.wrapObjectForConsole = function(object, canAccessInspectedWindow) 38 { 39 if (canAccessInspectedWindow) 40 return InjectedScript.wrapObject(object, "console"); 41 var result = {}; 42 result.type = typeof object; 43 result.description = InjectedScript._toString(object); 44 return result; 45 } 46 36 47 InjectedScript.wrapObject = function(object, objectGroupName) 37 48 {
Note: See TracChangeset
for help on using the changeset viewer.