Skip to content

Commit

Permalink
2008-12-09 Adam Barth <abarth@webkit.org>
Browse files Browse the repository at this point in the history
        Reviewed by Sam Weinig.

        Add ScriptController::updateSecurityOrigin to notify the bindings
        that a document's securityOrigin has been updated.  This is used by
        V8 to update its security context.

        * bindings/js/ScriptController.cpp:
        (WebCore::ScriptController::updateSecurityOrigin):
        * bindings/js/ScriptController.h:
        * dom/Document.cpp:
        (WebCore::Document::setDomain):

Canonical link: https://commits.webkit.org/31367@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Adam Barth committed Dec 10, 2008
1 parent 2131b03 commit dda3d83
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,17 @@
2008-12-09 Adam Barth <abarth@webkit.org>

Reviewed by Sam Weinig.

Add ScriptController::updateSecurityOrigin to notify the bindings
that a document's securityOrigin has been updated. This is used by
V8 to update its security context.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::updateSecurityOrigin):
* bindings/js/ScriptController.h:
* dom/Document.cpp:
(WebCore::Document::setDomain):

2008-12-09 Eric Seidel <eric@webkit.org>

No review, build fix only.
Expand Down
4 changes: 4 additions & 0 deletions WebCore/bindings/js/ScriptController.cpp
Expand Up @@ -236,6 +236,10 @@ void ScriptController::updateDocument()
(*it)->updateDocument();
}

void ScriptController::updateSecurityOrigin()
{
// Our bindings do not do anything in this case.
}

Bindings::RootObject* ScriptController::bindingRootObject()
{
Expand Down
6 changes: 6 additions & 0 deletions WebCore/bindings/js/ScriptController.h
Expand Up @@ -103,6 +103,12 @@ class ScriptController {
void clearFormerWindow(JSDOMWindow* window) { m_liveFormerWindows.remove(window); }
void updateDocument();

// Notifies the ScriptController that the securityOrigin of the current
// document was modified. For example, this method is called when
// document.domain is set. This method is *not* called when a new document
// is attached to a frame because updateDocument() is called instead.
void updateSecurityOrigin();

void clearScriptObjects();
void cleanupScriptObjectsForPlugin(void*);

Expand Down
5 changes: 5 additions & 0 deletions WebCore/dom/Document.cpp
Expand Up @@ -97,6 +97,7 @@
#include "RenderArena.h"
#include "RenderView.h"
#include "RenderWidget.h"
#include "ScriptController.h"
#include "SecurityOrigin.h"
#include "SegmentedString.h"
#include "SelectionController.h"
Expand Down Expand Up @@ -2918,6 +2919,8 @@ void Document::setDomain(const String& newDomain)
// have also assigned to access this page.
if (equalIgnoringCase(domain(), newDomain)) {
securityOrigin()->setDomainFromDOM(newDomain);
if (m_frame)
m_frame->script()->updateSecurityOrigin();
return;
}

Expand All @@ -2939,6 +2942,8 @@ void Document::setDomain(const String& newDomain)
return;

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

String Document::lastModified() const
Expand Down

0 comments on commit dda3d83

Please sign in to comment.