サンプルコード WebKitPluginWithSimpleGUIを動かしてみる


http://developer.apple.com/samplecode/WebKitPluginWithSimpleGUI/index.html


サンプルコードをダウンロードし、WebKitPluginWithSimpleGUI.bundleを /ライブラリ/Internet Plug-Ins にコピーする。
test.htmlをSafariで開くと下記のように表示される。


デバッグ文を入れて動かしてみる。

Run JavaScriptボタンをクリックするとPluginWithSimpleGUI#runScript が実行されるので
runScriptメソッドに下記のようにNSLogを追加しデバッグ出力させてみる。

-(IBAction) runScript:(id)sender {
	PDEBUG();
	
	NSLog(@"PluginWithSimpleGUI#runScript") ;
	
    ・
    ・
    ・
    ・
    ・
}


Run JavaScriptを押すとNSLogのデバッグ文がコンソールに出力される。

09/05/01 23:30:06 Safari[1771] Plug-in: File=PluginWithSimpleGUI.m line=105 proc=-[PluginWithSimpleGUI runScript:]  
09/05/01 23:30:06 Safari[1771] PluginWithSimpleGUI#runScript 
09/05/01 23:30:24 Safari[1771] Plug-in: File=PluginWithSimpleGUI.m line=105 proc=-[PluginWithSimpleGUI runScript:]