PDA

View Full Version : Programming Project: A stand-alone Safari 3 (and more)


Majost
2007-06-25, 22:55
So I got curious as to what kind of magic is done by the open source WebKit.app nightly build launcher (http://nightly.webkit.org) to dynamically link an existing Safari binary to the latest WebKit version.

As it turns out, you can actually launch *any* browser with *any* version of WebKit. Yes, this means you can get Shiira to launch this way, too, linked with the WebKit of your liking.

So, I thought it would be a fun 'learn-Cocoa' project to create a simple dialog box that allowed you to select the frameworks and browser dynamically at launch time. Interface Builder is *fun*

http://static.mbauman.net/random/WebKitsch.png

But: I am running into several problems. Firstly, all the WebKitLauncher magic is done *before* they load AppKit. So I don't think I can load any Nibs directly (please correct me if I'm wrong - that would be the easiest way to do it). Hm.

Well, my next idea was to use NSTask to spawn a independent Cocoa "helper" program. But the problem here that I need to pass back two stings: the path to the browser and the path to the frameworks. Sure, I'll just have the helper write a plist to the resources directory and then have WebKit.app load it in. But: I can't seem to write files to that directory when I launch the program from NSTask (it works fine when I double-click the helper by itself).

Do any of the programming gurus here want to see Safari 3 Beta as a stand-alone? Want to help me make it that way? I don't have a public SVN repo I can set up, but here's my source so far (http://static.mbauman.net/WebKitsch.tgz). My apologies if I don't conform to standard Cocoa conventions... I'm still learning. Advice, criticisms, etc, are all gladly welcomed. :)

(Just for clarity and differentiation, I named my modified launcher WebKitsch.app and the secondary helper app WebKitsch Helper.app. Also, for what it's worth, it's very easy to statically program the path to your browser of choice and its frameworks... I have Safari 3 running on my work computer that way. But that's no fun!).

Majost
2007-06-27, 21:32
Is really nobody else interested in this? I thought that two weeks ago everyone was asking for a standalone version of the beta...

Oh well. I'm content with my statically linked version, and the development itself has been a great learning tool for me. :)

That said, if there is a demand for this, I'll gladly try to round this project out. :)

Kickaha
2007-06-27, 21:38
I think it'd be great to be able to roll back and play with various WebKits, to say, be able to use both Safari 2 and 3.

Kickaha
2007-07-29, 10:23
*bump* How's this going? :)

chucker
2007-07-29, 10:38
Well, my next idea was to use NSTask to spawn a independent Cocoa "helper" program. But the problem here that I need to pass back two stings: the path to the browser and the path to the frameworks. Sure, I'll just have the helper write a plist to the resources directory and then have WebKit.app load it in. But: I can't seem to write files to that directory when I launch the program from NSTask (it works fine when I double-click the helper by itself).

Hm? Why not just use IPC, such as through NSDistributedNotification? 1) You pass on an NSDictionary containing the two NSStrings. 2) The end. :)

Oh, and sorry. For some reason, I didn't see this thread before at all. Still catching up. :\

Majost
2007-07-30, 23:22
Like far too many of my projects, I got it to a usable state for myself... and then it fell by the wayside. I'm finishing up another random side-project (it's *actually* getting finished! :eek: )... and then I'll see about picking things back up again.

Thanks for the tip, chucker. I'll take a look at that once I get back into things. :)