ウェブブラウザ

VisualWorksのウェブブラウザTwoflowerが動かなかったのでデバッグしてみた記録。

Message not understood: #createDocument

htmlString: aString
	self htmlAspect value: aString.
	self createDocument.

クラスは Twoflower.TfDocumentModel
createDocument の imprementers を探して以下のコードを発見。
^ XML.XMLParser processDocumentString: self text.
createDocument:のimprementers を探して以下のコードを発見。
doc := TfHTMLParser processDocumentString: aString.
XML.XMLParser は TfHTMLParser の親クラスでどっちを使っても同じ。
同じパッケージ内ということで TfHTMLParser の方を採用して以下のように修正

	"self createDocument."
	self document: (TfHTMLParser processDocumentString: aString)

Message not understood: #initializeInternationalStyle

initializeSystem
	[self loadSettings]
		on: Error
		do: [:ex | ex return].
	self styleSheet initializeInternationalStyle.

クラスは Twoflower.TwoflowerBrowser
self styleSheet を選択してインスペクトすると a Twoflower.TfDefaultStyleSheet
initializeInternationalStyle の imprementers を探すが、no methods found
initializeStyle というメソッドがあったがこれは X11InputManagerクラスのもの
initializeStyles というメソッドもあってこれは Twoflower.TfDefaultStyleSheetクラスのもの
というわけで initializeStyles を採用して以下のように修正

	"self styleSheet initializeInternationalStyle."
	self styleSheet initializeStyles

Message not understood: #createFontDescription

createTextStyleFor: aFontPolicy
	" create a text style based on my information "
	| cStyle textAttributes deviceFont fontDescription |
	fontDescription := self createFontDescription.
以下略

クラスは Twoflower.TfFontStyle
createFontDescription の imprementers を探すが、no methods found
引数の aFontPolicy をインスペクトすると、availableFonts の中に a FontDescription が複数入っているのを発見。
availableFonts の1つめの要素にダイブして name を見てみると 'System~18~400~0~0~0~kanji~1'
なんかよさげなのでこれを採用して以下のように修正

	"fontDescription := self createFontDescription."
	fontDescription := aFontPolicy availableFonts first.

ここまでの修正でエラーはとまってURLを入れればページが出るようになった。
一応動いたけど、本当にこれでいいのかは不明。

プロキシ設定

imprementersの検索でproxyhまで検索したら以下のメソッドを発見。

Net.HttpClient proxyHost: 'proxy.server.pc' port: 8080 userid: 'xxx' password: 'yyy'.
Net.HttpClient enableProxy

と思ったら、NetConfigToolをロードすれば、System→SettingsメニューにHTTP,FTP等のNet関係の設定タブが追加される。