1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var view =
{
onRun : function()
{
runQueue.mArray = new Array();
var sels = this.boxObject.view.selection,a=new Object(),b=new Object(),k;
var rowResource, name, path;
for (k=0;k<sels.getRangeCount();k++){
sels.getRangeAt(k,a,b);
for (var l=a.value;l<=b.value;l++) {
rowResource = this.builder.getResourceAtIndex(l);
itemCache.getItem(rowResource);
}
}
runQueue.run();
},
displayTest : function()
{
var current = this.boxObject.view.selection.currentIndex;
var rowResource = this.builder.getResourceAtIndex(current);
var item = itemCache.getItem(rowResource);
},
browseForRDF : function()
{
var fp = doCreateRDFFP('Xalan Description File',
nsIFilePicker.modeOpen);
var res = fp.show();
if (res == nsIFilePicker.returnOK) {
var furl = fp.fileURL;
this.setDataSource(fp.fileURL.spec);
}
},
dump_Good : function()
{
var enumi = this.mResultDS.GetSources(krTypeSucc, kGood, true);
var k = 0;
while (enumi.hasMoreElements()) {
k += 1;
dump(enumi.getNext().QueryInterface(nsIRDFResource).Value+"\n");
}
dump("found "+k+" good tests\n");
},
prune_ds : function()
{
if (this.mResultDS) {
this.mResultDS.QueryInterface(nsIRDFPurgeableDataSource).Sweep();
}
regressionStats.init()
itemCache.mArray = new Array();
},
setDataSource : function(aSpec)
{
var baseSpec;
if (aSpec) {
baseSpec = aSpec;
}
else {
baseSpec = document.getElementById("xalan_rdf").value;
}
if (this.mXalanDS && this.mXalanDS.URI == baseSpec) {
this.mXalanDS.QueryInterface(nsIRDFRemoteDataSource);
this.mXalanDS.Refresh(true);
}
else {
if (this.mXalanDS) {
this.database.RemoveDataSource(view.mXalanDS);
}
this.mXalanDS = kRDFSvc.GetDataSourceBlocking(baseSpec);
if (!this.mXalanDS) {
alert("Unable do load DataSource: "+baseSpec);
return;
}
this.database.AddDataSource(this.mXalanDS);
}
regressionStats.init();
if (!this.mResultDS) {
this.mResultDS = doCreate(kRDFInMemContractID,
nsIRDFDataSource);
this.database.AddDataSource(view.mResultDS);
if (!this.mResultDS) {
alert("Unable to create result InMemDatasource");
return;
}
}
this.builder.rebuild();
document.getElementById("xalan_rdf").value = baseSpec;
runItem.prototype.kXalan.init(runItem.prototype.kXalan.URLTYPE_STANDARD,
0, baseSpec, null, null);
},
loadHtml : function(aUrl, aListener)
{
const nsIIRequestor = Components.interfaces.nsIInterfaceRequestor;
const nsIWebProgress = Components.interfaces.nsIWebProgress;
var req = this.mIframe.webNavigation.QueryInterface(nsIIRequestor);
var prog = req.getInterface(nsIWebProgress);
prog.addProgressListener(aListener, nsIWebProgress.NOTIFY_ALL);
this.mIframe.webNavigation.loadURI(aUrl, 0,null,null,null);
},
fillItemContext : function()
{
var index = view.boxObject.view.selection.currentIndex;
var res = view.builder.getResourceAtIndex(index);
var purp = view.mXalanDS.GetTarget(res, krTypePurp, true);
return (purp != null);
}
}
regressionStats =
{
observe: function(aSubject, aTopic, aData)
{
if (aTopic != 'success') {
return;
}
var arc = (aData == "true") ? krTypeSuccCount : krTypeFailCount;
this.assertNewCount(aSubject, arc, 1);
},
init: function()
{
if (this.mRegressionDS) {
this.mRegressionDS.QueryInterface(nsIRDFPurgeableDataSource).Sweep();
}
else {
this.mRegressionDS =
doCreate(kRDFInMemContractID, nsIRDFDataSource);
view.database.AddDataSource(this.mRegressionDS);
}
},
getParent: function(aDS, aSource)
{
// parent chached?
var parent = this.mRegressionDS.GetTarget(aSource, krTypeParent, true);
if (!parent) {
var labels = view.mXalanDS.ArcLabelsIn(aSource);
while (labels.hasMoreElements()) {
var arc = labels.getNext().QueryInterface(nsIRDFResource);
if (arc.Value.match(this.mChildRE)) {
parent = view.mXalanDS.GetSource(arc, aSource, true);
// cache the parent
this.mRegressionDS.Assert(aSource, krTypeParent,
parent, true);
}
}
}
return parent;
},
assertNewCount: function(aSource, aArc, aIncrement)
{
var root = kRDFSvc.GetResource('urn:root');
var count = 0;
// parent chached?
var parent = this.getParent(view.XalanDS, aSource);
while (parent && !parent.EqualsNode(root)) {
var countRes = view.mResultDS.GetTarget(parent, aArc, true);
if (countRes) {
count = countRes.QueryInterface(nsIRDFInt).Value;
}
var newCountRes = kRDFSvc.GetIntLiteral(count + aIncrement);
if (!newCountRes) {
return;
}
if (countRes) {
view.mResultDS.Change(parent, aArc, countRes, newCountRes);
}
else {
view.mResultDS.Assert(parent, aArc, newCountRes, true);
}
parent = this.getParent(view.XalanDS, parent);
}
},
mRegressionDS: 0,
mChildRE: /http:\/\/www\.w3\.org\/1999\/02\/22-rdf-syntax-ns#_/
}
function rdfObserve(aSubject, aTopic, aData)
{
if (aTopic == "success") {
var target = (aData == "true") ? kGood : kBad;
view.mResultDS.Assert(aSubject, krTypeSucc, target, true);
regressionStats.observe(aSubject, aTopic, aData);
}
}
runItem.prototype.kObservers.push(rdfObserve);
|