on develop help sign in
Get rid of webkit_dom_node_to_js-related stuff
f25d9efRyan Trinkle
src/Foreign/JavaScript/TH.hs+2−18
@@ -18,7 +18,7 @@ import Foreign.Ptr
18import Foreign.C.Types
18import Foreign.C.Types
19import Data.Hashable
19import Data.Hashable
20#else
20#else
21−import System.Glib.FFI hiding (withForeignPtr)
21+import System.Glib.FFI
22import Graphics.UI.Gtk.WebKit.WebView
22import Graphics.UI.Gtk.WebKit.WebView
23import Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase
23import Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase
24import Graphics.UI.Gtk.WebKit.JavaScriptCore.JSObjectRef
24import Graphics.UI.Gtk.WebKit.JavaScriptCore.JSObjectRef
@@ -264,23 +264,7 @@ instance MonadJS (JSCtx_JavaScriptCore x) (WithWebView x IO) where
264 withJSStringRaw propName $ \propNameRaw -> do
264 withJSStringRaw propName $ \propNameRaw -> do
265 jsContext <- askJSContext
265 jsContext <- askJSContext
266 liftIO $ liftM JSRef_JavaScriptCore $ jsobjectgetproperty jsContext objRef propNameRaw nullPtr --TODO: property attribute, exceptions
266 liftIO $ liftM JSRef_JavaScriptCore $ jsobjectgetproperty jsContext objRef propNameRaw nullPtr --TODO: property attribute, exceptions
267− withJSNode (Node n) f = do
267+ withJSNode = error "withJSNode is only supported in ghcjs"
268− jsContext <- askJSContext
269− withForeignPtr n $ \nPtr -> do
270− let acquire = liftIO $ do
271− jsNode <- webkit_dom_node_to_js jsContext nPtr
272− jsvalueprotect jsContext jsNode
273− return jsNode
274− release = liftIO . jsvalueunprotect jsContext
275− bracket acquire release $ f . JSRef_JavaScriptCore
276−
277−withForeignPtr :: MonadIO m => ForeignPtr a -> (Ptr a -> m b) -> m b
278−withForeignPtr fo io = do
279− r <- io $ unsafeForeignPtrToPtr fo
280− liftIO $ touchForeignPtr fo
281− return r
282−
283−foreign import ccall unsafe "webkit_dom_node_to_js" webkit_dom_node_to_js :: JSContextRef -> Ptr Node -> IO JSValueRef
284
268
285#endif
269#endif
286
270