mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
116 lines
3.7 KiB
JavaScript
116 lines
3.7 KiB
JavaScript
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Axel Hecht.
|
|
* Portions created by Axel Hecht are Copyright (C) 2001 Axel Hecht.
|
|
* All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
* Axel Hecht <axel@pike.org> (Original Author)
|
|
*/
|
|
|
|
var name_array,index_array,__docSet;
|
|
|
|
function do_transforms(new_name_array,new_number_array,verbose){
|
|
if (new_name_array) {
|
|
name_array=new_name_array;
|
|
index_array=new_number_array;
|
|
dump("\n==============================\n");
|
|
dump("TransforMiiX regression buster\n");
|
|
dump("==============================\n");
|
|
}
|
|
if (name_array.length){
|
|
current=name_array.shift();
|
|
__docSet=new txDocSet(current,index_array.shift());
|
|
}
|
|
}
|
|
|
|
function txDocSet(name,index,verbose){
|
|
this.mName = name;
|
|
this.mIndex = index;
|
|
this.mBase = document.getElementById('xalan_base').getAttribute('value');
|
|
if (verbose) this.mVerbose=verbose;
|
|
this.mSource = document.implementation.createDocument("","",null);
|
|
this.mStyle = document.implementation.createDocument("","",null);
|
|
this.mReference = document.implementation.createDocument("","",null);
|
|
this.mResult = document.implementation.createDocument("","",null);
|
|
this.mSource.addEventListener("load",this.docLoaded,false);
|
|
this.mStyle.addEventListener("load",this.styleLoaded,false);
|
|
this.mReference.addEventListener("load",this.refLoaded,false);
|
|
this.mSource.load(this.mBase+"conf/"+name+".xml");
|
|
this.mStyle.load(this.mBase+"conf/"+name+".xsl");
|
|
this.mIsError = name.match(/\/err\//);
|
|
if (this.mIsError){
|
|
this.mLoaded = 2;
|
|
} else {
|
|
this.mReference.load(this.mBase+"conf-gold/"+name+".out");
|
|
}
|
|
}
|
|
|
|
txDocSet.prototype = {
|
|
mBase : null,
|
|
mName : null,
|
|
mSource : null,
|
|
mStyle : null,
|
|
mResult : null,
|
|
mReference : null,
|
|
mVerbose : false,
|
|
mIsError : false,
|
|
mLoaded : 0,
|
|
mIndex : 0,
|
|
|
|
styleLoaded : function(e){
|
|
__docSet.stuffLoaded(1);
|
|
},
|
|
docLoaded : function(e){
|
|
__docSet.stuffLoaded(4);
|
|
},
|
|
refLoaded : function(e){
|
|
__docSet.stuffLoaded(2);
|
|
},
|
|
stuffLoaded : function(mask){
|
|
__docSet.mLoaded+=mask;
|
|
if (this.mLoaded==7){
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
var txProc = new XSLTProcessor(),isGood=false;
|
|
dump("\nTrying "+this.mName+" ");
|
|
txProc.transformDocument(this.mSource,this.mStyle,this.mResult,null);
|
|
if (this.mIsError) {
|
|
dump("for error test\nResult:\n");
|
|
DumpDOM(this.mResult);
|
|
handle_result(this.mIndex,true);
|
|
} else {
|
|
try{
|
|
isGood = DiffDOM(this.mResult.documentElement,this.mReference.documentElement);
|
|
} catch (e) {isGood = false;};
|
|
if (!isGood){
|
|
dump(" and failed\n\n");
|
|
this.mVerbose=true;
|
|
handle_result(this.mIndex,false);
|
|
} else {
|
|
dump(" and succeeded\n\n");
|
|
handle_result(this.mIndex,true);
|
|
}
|
|
if (this.mVerbose){
|
|
dump("Result:\n");
|
|
DumpDOM(this.mResult);
|
|
dump("Reference:\n");
|
|
DumpDOM(this.mReference);
|
|
}
|
|
}
|
|
do_transforms();
|
|
}
|
|
}
|
|
};
|