-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/> | ||
<classpathentry including="**/*.java" kind="src" path="src/main/java"/> | ||
<classpathentry kind="src" path="src/test/resources"/> | ||
<classpathentry kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar" sourcepath="M2_REPO/commons-io/commons-io/2.0.1/commons-io-2.0.1-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar" sourcepath="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/r09/guava-r09.jar" sourcepath="M2_REPO/com/google/guava/guava/r09/guava-r09-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/com/google/guava/guava/r09/guava-r09-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/htmlunit/2.9/htmlunit-2.9.jar" sourcepath="M2_REPO/net/sourceforge/htmlunit/htmlunit/2.9/htmlunit-2.9-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/net/sourceforge/htmlunit/htmlunit/2.9/htmlunit-2.9-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.9/htmlunit-core-js-2.9.jar" sourcepath="M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.9/htmlunit-core-js-2.9-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/net/sourceforge/htmlunit/htmlunit-core-js/2.9/htmlunit-core-js-2.9-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpmime/4.1.2/httpmime-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpmime/4.1.2/httpmime-4.1.2-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/net/java/dev/jna/jna/3.3.0/jna-3.3.0.jar" sourcepath="M2_REPO/net/java/dev/jna/jna/3.3.0/jna-3.3.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/json/json/20080701/json-20080701.jar" sourcepath="M2_REPO/org/json/json/20080701/json-20080701-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/org/json/json/20080701/json-20080701-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/junit/junit/4.8.2/junit-4.8.2.jar" sourcepath="M2_REPO/junit/junit/4.8.2/junit-4.8.2-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/junit/junit/4.8.2/junit-4.8.2-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15.jar" sourcepath="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15-sources.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="jar:file:/home/marc/.m2/repository/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15-javadoc.jar!/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="var" path="M2_REPO/org/w3c/css/sac/1.3/sac-1.3.jar" sourcepath="M2_REPO/org/w3c/css/sac/1.3/sac-1.3-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.8.0/selenium-android-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.8.0/selenium-android-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-api/2.8.0/selenium-api-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-api/2.8.0/selenium-api-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-chrome-driver/2.8.0/selenium-chrome-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-chrome-driver/2.8.0/selenium-chrome-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-firefox-driver/2.8.0/selenium-firefox-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-firefox-driver/2.8.0/selenium-firefox-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-htmlunit-driver/2.8.0/selenium-htmlunit-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-htmlunit-driver/2.8.0/selenium-htmlunit-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-ie-driver/2.8.0/selenium-ie-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-ie-driver/2.8.0/selenium-ie-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-iphone-driver/2.8.0/selenium-iphone-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-iphone-driver/2.8.0/selenium-iphone-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-java/2.8.0/selenium-java-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-java/2.8.0/selenium-java-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-remote-driver/2.8.0/selenium-remote-driver-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-remote-driver/2.8.0/selenium-remote-driver-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-support/2.8.0/selenium-support-2.8.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-support/2.8.0/selenium-support-2.8.0-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/xalan/serializer/2.7.1/serializer-2.7.1.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar" sourcepath="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1-sources.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04-sources.jar"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<projectDescription> | ||
<name>JSErrorCollector</name> | ||
<comment>A set of utilities extending WebDriver.</comment> | ||
<projects/> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path=""/> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="output" path=""/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Fri Oct 07 12:14:16 CEST 2011 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.source=1.6 | ||
org.eclipse.jdt.core.compiler.compliance=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.eclipse.wst.jsdt.launching.JRE_CONTAINER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Global |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/bin/bash | ||
# build.sh -- builds JAR and XPI files for mozilla extensions | ||
# by Nickolay Ponomarev <[email protected]> | ||
# (original version based on Nathan Yergler's build script) | ||
# Most recent version is at <http://kb.mozillazine.org/Bash_build_script> | ||
|
||
# This script assumes the following directory structure: | ||
# ./ | ||
# chrome.manifest (optional - for newer extensions) | ||
# install.rdf | ||
# (other files listed in $ROOT_FILES) | ||
# | ||
# content/ | | ||
# locale/ |} these can be named arbitrary and listed in $CHROME_PROVIDERS | ||
# skin/ | | ||
# | ||
# defaults/ | | ||
# components/ |} these must be listed in $ROOT_DIRS in order to be packaged | ||
# ... | | ||
# | ||
# It uses a temporary directory ./build when building; don't use that! | ||
# Script's output is: | ||
# ./$APP_NAME.xpi | ||
# ./$APP_NAME.jar (only if $KEEP_JAR=1) | ||
# ./files -- the list of packaged files | ||
# | ||
# Note: It modifies chrome.manifest when packaging so that it points to | ||
# chrome/$APP_NAME.jar!/* | ||
|
||
# | ||
# default configuration file is ./config_build.sh, unless another file is | ||
# specified in command-line. Available config variables: | ||
APP_NAME= # short-name, jar and xpi files name. Must be lowercase with no spaces | ||
CHROME_PROVIDERS= # which chrome providers we have (space-separated list) | ||
CLEAN_UP= # delete the jar / "files" when done? (1/0) | ||
ROOT_FILES= # put these files in root of xpi (space separated list of leaf filenames) | ||
ROOT_DIRS= # ...and these directories (space separated list) | ||
BEFORE_BUILD= # run this before building (bash command) | ||
AFTER_BUILD= # ...and this after the build (bash command) | ||
|
||
if [ -z $1 ]; then | ||
. ./config_build.sh | ||
else | ||
. $1 | ||
fi | ||
|
||
if [ -z $APP_NAME ]; then | ||
echo "You need to create build config file first!" | ||
echo "Read comments at the beginning of this script for more info." | ||
exit; | ||
fi | ||
|
||
ROOT_DIR=`pwd` | ||
TMP_DIR=build | ||
|
||
#uncomment to debug | ||
#set -x | ||
|
||
# remove any left-over files from previous build | ||
rm -f $APP_NAME.jar $APP_NAME.xpi files | ||
rm -rf $TMP_DIR | ||
|
||
$BEFORE_BUILD | ||
|
||
mkdir --parents --verbose $TMP_DIR/chrome | ||
|
||
# generate the JAR file, excluding CVS, SVN, and temporary files | ||
JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar | ||
echo "Generating $JAR_FILE..." | ||
for CHROME_SUBDIR in $CHROME_PROVIDERS; do | ||
find $CHROME_SUBDIR \( -path '*CVS*' -o -path '*.svn*' \) -prune -o -type f -print | grep -v \~ >> files | ||
done | ||
|
||
zip -0 -r $JAR_FILE -@ < files | ||
# The following statement should be used instead if you don't wish to use the JAR file | ||
#cp --verbose --parents `cat files` $TMP_DIR/chrome | ||
|
||
# prepare components and defaults | ||
echo "Copying various files to $TMP_DIR folder..." | ||
for DIR in $ROOT_DIRS; do | ||
mkdir $TMP_DIR/$DIR | ||
FILES="`find $DIR \( -path '*CVS*' -o -path '*.svn*' \) -prune -o -type f -print | grep -v \~`" | ||
echo $FILES >> files | ||
cp --verbose --parents $FILES $TMP_DIR | ||
done | ||
|
||
# Copy other files to the root of future XPI. | ||
for ROOT_FILE in $ROOT_FILES install.rdf chrome.manifest; do | ||
cp --verbose $ROOT_FILE $TMP_DIR | ||
if [ -f $ROOT_FILE ]; then | ||
echo $ROOT_FILE >> files | ||
fi | ||
done | ||
|
||
cd $TMP_DIR | ||
|
||
if [ -f "chrome.manifest" ]; then | ||
echo "Preprocessing chrome.manifest..." | ||
# You think this is scary? | ||
#s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/ | ||
#s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/ | ||
# | ||
# Then try this! (Same, but with characters escaped for bash :) | ||
sed -i -r s/^\(content\\s+\\S*\\s+\)\(\\S*\\/\)$/\\1jar:chrome\\/$APP_NAME\\.jar!\\/\\2/ chrome.manifest | ||
sed -i -r s/^\(skin\|locale\)\(\\s+\\S*\\s+\\S*\\s+\)\(.*\\/\)$/\\1\\2jar:chrome\\/$APP_NAME\\.jar!\\/\\3/ chrome.manifest | ||
|
||
# (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest) | ||
fi | ||
|
||
# generate the XPI file | ||
echo "Generating $APP_NAME.xpi..." | ||
zip -r ../$APP_NAME.xpi * | ||
|
||
cd "$ROOT_DIR" | ||
|
||
echo "Cleanup..." | ||
if [ $CLEAN_UP = 0 ]; then | ||
# save the jar file | ||
mv $TMP_DIR/chrome/$APP_NAME.jar . | ||
else | ||
rm ./files | ||
fi | ||
|
||
# remove the working files | ||
rm -rf $TMP_DIR | ||
echo "Done!" | ||
|
||
$AFTER_BUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
content JSErrorCollector content/ | ||
overlay chrome://browser/content/browser.xul chrome://JSErrorCollector/content/overlay.xul | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Build config for the build script, build.sh. Look there for more info. | ||
|
||
APP_NAME=helloworld | ||
CHROME_PROVIDERS="content locale skin" | ||
CLEAN_UP=1 | ||
ROOT_FILES="readme.txt" | ||
ROOT_DIRS= | ||
BEFORE_BUILD= | ||
AFTER_BUILD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
var JSErrorCollector = { | ||
collectedErrors: { | ||
list: [], | ||
push: function (jsError) { | ||
this.list[this.list.length] = jsError; | ||
}, | ||
pump: function() { | ||
var resp = []; | ||
for (var i=0; i<this.list.length; ++i) { | ||
var scriptError = this.list[i]; | ||
resp[i] = { | ||
errorMessage: scriptError.errorMessage, | ||
sourceName: scriptError.sourceName, | ||
lineNumber: scriptError.lineNumber | ||
}; | ||
} | ||
this.list.length = 0; | ||
return resp; | ||
}, | ||
toString: function() { | ||
var s = ""; | ||
for (var i=0; i<this.list.length; ++i) { | ||
s += i + ": " + this.list[i] + "\n"; | ||
} | ||
return s; | ||
} | ||
}, | ||
onLoad: function(event) { | ||
// initialization code | ||
this.initialize(event); | ||
this.initialized = true; | ||
}, | ||
|
||
initialize: function(event) { | ||
var windowContent = window.getBrowser(); | ||
|
||
var consoleService = Components.classes["@mozilla.org/consoleservice;1"].getService().QueryInterface(Components.interfaces.nsIConsoleService); | ||
if (consoleService) | ||
{ | ||
consoleService.registerListener(JSErrorCollector_ErrorConsoleListener); | ||
} | ||
|
||
var onPageLoad = function(aEvent) { | ||
var doc = aEvent.originalTarget; | ||
var win = doc.defaultView; | ||
if (win) { | ||
win.wrappedJSObject.JSErrorCollector_errors = JSErrorCollector.collectedErrors; | ||
} | ||
}; | ||
|
||
windowContent.addEventListener("load", onPageLoad, true); | ||
}, | ||
|
||
addError: function(error) { | ||
this.collectedErrors.push(error); | ||
|
||
var labelField = document.getElementById("JSErrorCollector-nb"); | ||
labelField.nb = labelField.nb || 0; | ||
labelField.nb++; | ||
labelField.value = labelField.nb; | ||
} | ||
}; | ||
|
||
|
||
//Error console listener | ||
var JSErrorCollector_ErrorConsoleListener = | ||
{ | ||
observe: function(consoleMessage) | ||
{ | ||
if (document && consoleMessage) | ||
{ | ||
// Try to convert the error to a script error | ||
try | ||
{ | ||
var error = consoleMessage.QueryInterface(Components.interfaces.nsIScriptError); | ||
|
||
var errorCategory = error.category; | ||
var sourceName = error.sourceName; | ||
if (sourceName.indexOf("about:") == 0 || sourceName.indexOf("chrome:") == 0) { | ||
return; // not interested in internal errors | ||
} | ||
|
||
// We're just looking for content JS errors (see https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIScriptError#Categories) | ||
if (errorCategory == "content javascript") | ||
{ | ||
JSErrorCollector.addError(error); | ||
} | ||
} | ||
catch (exception) | ||
{ | ||
// ignore | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
}; | ||
|
||
window.addEventListener("load", function(e) { JSErrorCollector.onLoad(e); }, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
|
||
<overlay id="JSErrorCollector-overlay" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
<script src="overlay.js"/> | ||
|
||
<statusbar id="status-bar"> | ||
<statusbarpanel> | ||
<hbox tooltiptext="JS error are collected to be retrieved from WebDriver."> | ||
<label id="JSErrorCollector-label" value="JSErrorCollector: " /> | ||
<label id="JSErrorCollector-nb" value="0" /> | ||
</hbox> | ||
</statusbarpanel> | ||
</statusbar> | ||
</overlay> |
Oops, something went wrong.