Bug 22776

Summary: Add ScriptController::updateSecurityOrigin
Product: WebKit Reporter: Adam Barth <abarth>
Component: DOMAssignee: Adam Barth <abarth>
Severity: Normal CC: abarth, eric
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Description Flags
patch sam: review+

Description Adam Barth 2008-12-09 21:35:01 PST
We should call a method on ScriptController when we update a document's securityOrigin.  V8 uses this method to update the security context it uses in its fast-path security check.  Currently, the JavaScriptCore bindings don't have use for this method, but it might in the future.

Patch forthcoming.
Comment 1 Adam Barth 2008-12-09 21:35:28 PST
Created attachment 25912 [details]
Comment 2 Adam Barth 2008-12-09 21:41:36 PST
For those keeping score at home, this method corresponds to / replaces SecriptController::setDomain in http://src.chromium.org/viewvc/chrome/trunk/src/webkit/port/bindings/v8/ScriptController.h?view=markup
Comment 3 Sam Weinig 2008-12-09 21:44:16 PST
Comment on attachment 25912 [details]

>          securityOrigin()->setDomainFromDOM(newDomain);
> +        if (m_frame)
> +             m_frame->script()->updateSecurityOrigin();

The indentation looks odd here.

>      securityOrigin()->setDomainFromDOM(newDomain);
> +    if (m_frame)
> +         m_frame->script()->updateSecurityOrigin();

And here.

Comment 4 Adam Barth 2008-12-09 22:49:57 PST
Fixed in r39163.  Thanks for the quick review!
Comment 5 Darin Fisher (:fishd, Google) 2008-12-10 08:43:33 PST
Comment on attachment 25912 [details]

>diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
>+        if (m_frame)
>+             m_frame->script()->updateSecurityOrigin();
>         return;
>+    if (m_frame)
>+         m_frame->script()->updateSecurityOrigin();
> }

FYI: indentation looks to be off by one space.
Comment 6 Adam Barth 2008-12-10 09:56:51 PST
> FYI: indentation looks to be off by one space.

Thanks.  I think I fixed this before landing.