[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
aroben at apple.com
aroben at apple.com
Thu Dec 3 13:35:50 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b67ad71fedece6c2aeabaa7b3f49647cbe55504c
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 13 16:58:58 2009 +0000
Finish replacing worldIDs with world objects
The only remaining use of worldIDs was in a method only used by DRT
for the isolated worlds tests.
Fixes <http://webkit.org/b/31414> Replace worldIDs with world objects
Reviewed by Mark Rowe.
WebKit/mac:
* WebView/WebFrame.mm:
(-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
* WebView/WebFramePrivate.h:
Renamed from
_stringByEvaluatingJavaScriptInIsolatedWorld:WithGobalObject:FromString:.
Now takes a WebScriptWorld instead of a worldID, so we don't need to
maintain a map of worldID -> world anymore.
WebKit/win:
* Interfaces/IWebFramePrivate.idl:
* WebFrame.cpp:
(WebFrame::stringByEvaluatingJavaScriptInScriptWorld):
* WebFrame.h:
Renamed from stringByEvaluatingJavaScriptInIsolatedWorld. Now takes an
IWebScriptWorld instead of a worldID, so we don't need to maintain a
map of worldID -> world anymore.
WebKitTools:
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::evaluateScriptInIsolatedWorld):
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::evaluateScriptInIsolatedWorld):
Updated for changes to WebFrame. Now holds the map of worldID -> world
at this level instead of making WebKit do it.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index b7be226..a8d4068 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,22 @@
+2009-11-13 Adam Roben <aroben at apple.com>
+
+ Finish replacing worldIDs with world objects
+
+ The only remaining use of worldIDs was in a method only used by DRT
+ for the isolated worlds tests.
+
+ Fixes <http://webkit.org/b/31414> Replace worldIDs with world objects
+
+ Reviewed by Mark Rowe.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
+ * WebView/WebFramePrivate.h:
+ Renamed from
+ _stringByEvaluatingJavaScriptInIsolatedWorld:WithGobalObject:FromString:.
+ Now takes a WebScriptWorld instead of a worldID, so we don't need to
+ maintain a map of worldID -> world anymore.
+
2009-11-12 Dan Bernstein <mitz at apple.com>
Reviewed by Adele Peterson.
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index b8a5be7..158346d 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -1191,7 +1191,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document());
}
-- (NSString *)_stringByEvaluatingJavaScriptInIsolatedWorld:(unsigned)worldID WithGlobalObject:(JSObjectRef)globalObjectRef FromString:(NSString *)string
+- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world
{
// Start off with some guess at a frame and a global object, we'll try to do better...!
JSDOMWindow* anyWorldGlobalObject = _private->coreFrame->script()->globalObject(mainThreadNormalWorld());
@@ -1204,22 +1204,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
// Get the frame frome the global object we've settled on.
Frame* frame = anyWorldGlobalObject->impl()->frame();
ASSERT(frame->document());
-
- // Get the world to execute in based on the worldID. DRT expects that a
- // worldID of 0 always corresponds to a newly-created world, while any
- // other worldID corresponds to a world that is created once and then
- // cached forever.
- RefPtr<DOMWrapperWorld> world;
- if (!worldID)
- world = ScriptController::createWorld();
- else {
- static HashMap<unsigned, RefPtr<DOMWrapperWorld> >& worlds = *new HashMap<unsigned, RefPtr<DOMWrapperWorld> >;
- RefPtr<DOMWrapperWorld>& worldSlot = worlds.add(worldID, 0).first->second;
- if (!worldSlot)
- worldSlot = ScriptController::createWorld();
- world = worldSlot;
- }
- JSValue result = frame->script()->executeScriptInWorld(world.get(), string, true).jsValue();
+ JSValue result = frame->script()->executeScriptInWorld(core(world), string, true).jsValue();
if (!frame) // In case the script removed our frame from the page.
return @"";
diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h
index cc12775..526b7e9 100644
--- a/WebKit/mac/WebView/WebFramePrivate.h
+++ b/WebKit/mac/WebView/WebFramePrivate.h
@@ -97,7 +97,7 @@ typedef enum {
- (void)_recursive_pauseNullEventsForAllNetscapePlugins;
#endif
-- (NSString *)_stringByEvaluatingJavaScriptInIsolatedWorld:(unsigned)worldID WithGlobalObject:(JSObjectRef)globalObject FromString:(NSString *)string;
+- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObject inScriptWorld:(WebScriptWorld *)world;
- (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world;
// Pause a given CSS animation or transition on the target node at a specific time.
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 2e671a8..27cc953 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,22 @@
+2009-11-13 Adam Roben <aroben at apple.com>
+
+ Finish replacing worldIDs with world objects
+
+ The only remaining use of worldIDs was in a method only used by DRT
+ for the isolated worlds tests.
+
+ Fixes <http://webkit.org/b/31414> Replace worldIDs with world objects
+
+ Reviewed by Mark Rowe.
+
+ * Interfaces/IWebFramePrivate.idl:
+ * WebFrame.cpp:
+ (WebFrame::stringByEvaluatingJavaScriptInScriptWorld):
+ * WebFrame.h:
+ Renamed from stringByEvaluatingJavaScriptInIsolatedWorld. Now takes an
+ IWebScriptWorld instead of a worldID, so we don't need to maintain a
+ map of worldID -> world anymore.
+
2009-11-12 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl
index c97ed5a..26996b9 100644
--- a/WebKit/win/Interfaces/IWebFramePrivate.idl
+++ b/WebKit/win/Interfaces/IWebFramePrivate.idl
@@ -95,7 +95,7 @@ interface IWebFramePrivate : IUnknown
HRESULT allowsFollowingLink([in] BSTR url, [out, retval] BOOL* result);
- HRESULT stringByEvaluatingJavaScriptInIsolatedWorld([in] unsigned worldID, [in] OLE_HANDLE jsGlobalObject, [in] BSTR script, [out, retval] BSTR* result);
+ [local] HRESULT stringByEvaluatingJavaScriptInScriptWorld([in] IWebScriptWorld*, [in] JSObjectRef globalObject, [in] BSTR script, [out, retval] BSTR* result);
[local] JSGlobalContextRef globalContextForScriptWorld([in] IWebScriptWorld*);
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index 86705e1..25d7c4c 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -2173,18 +2173,20 @@ HRESULT STDMETHODCALLTYPE WebFrame::isDescendantOfFrame(
return S_OK;
}
-HRESULT STDMETHODCALLTYPE WebFrame::stringByEvaluatingJavaScriptInIsolatedWorld(
- /* [in] */ unsigned int worldID,
- /* [in] */ OLE_HANDLE jsGlobalObject,
- /* [in] */ BSTR script,
- /* [retval][out] */ BSTR* evaluationResult)
+HRESULT WebFrame::stringByEvaluatingJavaScriptInScriptWorld(IWebScriptWorld* iWorld, JSObjectRef globalObjectRef, BSTR script, BSTR* evaluationResult)
{
if (!evaluationResult)
return E_POINTER;
*evaluationResult = 0;
+ if (!iWorld)
+ return E_POINTER;
+
+ COMPtr<WebScriptWorld> world(Query, iWorld);
+ if (!world)
+ return E_INVALIDARG;
+
Frame* coreFrame = core(this);
- JSObjectRef globalObjectRef = reinterpret_cast<JSObjectRef>(jsGlobalObject);
String string = String(script, SysStringLen(script));
// Start off with some guess at a frame and a global object, we'll try to do better...!
@@ -2198,22 +2200,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::stringByEvaluatingJavaScriptInIsolatedWorld(
// Get the frame frome the global object we've settled on.
Frame* frame = anyWorldGlobalObject->impl()->frame();
ASSERT(frame->document());
-
- // Get the world to execute in based on the worldID. DRT expects that a
- // worldID of 0 always corresponds to a newly-created world, while any
- // other worldID corresponds to a world that is created once and then
- // cached forever.
- RefPtr<DOMWrapperWorld> world;
- if (!worldID)
- world = ScriptController::createWorld();
- else {
- static HashMap<unsigned, RefPtr<DOMWrapperWorld> >& worlds = *new HashMap<unsigned, RefPtr<DOMWrapperWorld> >;
- RefPtr<DOMWrapperWorld>& worldSlot = worlds.add(worldID, 0).first->second;
- if (!worldSlot)
- worldSlot = ScriptController::createWorld();
- world = worldSlot;
- }
- JSValue result = frame->script()->executeScriptInWorld(world.get(), string, true).jsValue();
+ JSValue result = frame->script()->executeScriptInWorld(world->world(), string, true).jsValue();
if (!frame) // In case the script removed our frame from the page.
return S_OK;
diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h
index 5788bd5..103375a 100644
--- a/WebKit/win/WebFrame.h
+++ b/WebKit/win/WebFrame.h
@@ -248,12 +248,7 @@ public:
/* [in] */ BSTR url,
/* [retval][out] */ BOOL* result);
- virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptInIsolatedWorld(
- /* [in] */ unsigned int worldID,
- /* [in] */ OLE_HANDLE jsGlobalObject,
- /* [in] */ BSTR script,
- /* [retval][out] */ BSTR* evaluationResult);
-
+ virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptInScriptWorld(IWebScriptWorld*, JSObjectRef globalObjectRef, BSTR script, BSTR* evaluationResult);
virtual JSGlobalContextRef STDMETHODCALLTYPE globalContextForScriptWorld(IWebScriptWorld*);
// IWebDocumentText
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 821d6ef..d591511 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-13 Adam Roben <aroben at apple.com>
+
+ Finish replacing worldIDs with world objects
+
+ The only remaining use of worldIDs was in a method only used by DRT
+ for the isolated worlds tests.
+
+ Fixes <http://webkit.org/b/31414> Replace worldIDs with world objects
+
+ Reviewed by Mark Rowe.
+
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::evaluateScriptInIsolatedWorld):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorld):
+ Updated for changes to WebFrame. Now holds the map of worldID -> world
+ at this level instead of making WebKit do it.
+
2009-11-13 Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
Reviewed by Simon Hausmann.
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 15bc0d4..59d544b 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -63,6 +63,7 @@
#import <WebKit/WebView.h>
#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebWorkersPrivate.h>
+#import <wtf/HashMap.h>
#import <wtf/RetainPtr.h>
@interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem>
@@ -535,5 +536,20 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObj
{
RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script));
NSString *scriptNS = (NSString *)scriptCF.get();
- [mainFrame _stringByEvaluatingJavaScriptInIsolatedWorld:worldID WithGlobalObject:globalObject FromString:scriptNS];
+
+ // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world
+ // that is created once and cached forever.
+ WebScriptWorld *world;
+ if (!worldID)
+ world = [WebScriptWorld world];
+ else {
+ typedef HashMap<unsigned, RetainPtr<WebScriptWorld> > WorldMap;
+ static WorldMap& worldMap = *new WorldMap;
+ RetainPtr<WebScriptWorld>& worldSlot = worldMap.add(worldID, 0).first->second;
+ if (!worldSlot)
+ worldSlot.adoptNS([[WebScriptWorld alloc] init]);
+ world = worldSlot.get();
+ }
+
+ [mainFrame _stringByEvaluatingJavaScriptFromString:scriptNS withGlobalObject:globalObject inScriptWorld:world];
}
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 4158233..d6d8421 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -955,14 +955,29 @@ void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef scrip
inspectorPrivate->evaluateInFrontend(callId, bstrT(script).GetBSTR());
}
-void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script)
+void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
{
COMPtr<IWebFramePrivate> framePrivate(Query, frame);
if (!framePrivate)
return;
+ // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world
+ // that is created once and cached forever.
+ COMPtr<IWebScriptWorld> world;
+ if (!worldID) {
+ if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world))))
+ return;
+ } else {
+ typedef HashMap<unsigned, COMPtr<IWebScriptWorld> > WorldMap;
+ static WorldMap& worldMap = *new WorldMap;
+ COMPtr<IWebScriptWorld>& worldSlot = worldMap.add(worldID, 0).first->second;
+ if (!worldSlot && FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(worldSlot), reinterpret_cast<void**>(&worldSlot))))
+ return;
+ world = worldSlot;
+ }
+
BSTR result;
- if (FAILED(framePrivate->stringByEvaluatingJavaScriptInIsolatedWorld(worldId, reinterpret_cast<OLE_HANDLE>(globalObject), bstrT(script).GetBSTR(), &result)))
+ if (FAILED(framePrivate->stringByEvaluatingJavaScriptInScriptWorld(world.get(), globalObject, bstrT(script).GetBSTR(), &result)))
return;
SysFreeString(result);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list