提交 6d081faf 编写于 作者: K Kohsuke Kawaguchi

This property can be null causing HtmlUnit to fail.

In event-debug.js, there's an overloaded toString() method.

    toString: function() {
         return "CustomEvent: " + "'" + this.type  + "', " +
             "context: " + this.scope;

    }

When the problem happens, "this.scope" points to a DataSourceBase object, and apparently at that time this._sName is null, and it causes a failure in ScriptableObject.getDefaultValue(), at the final "fall through to error" portion (see below)

----
Enclosed exception:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot find default value for object. (http://localhost:46994/static/43c91e29/scripts/yui/event/event-debug.js#385)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3652)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3630)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3658)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3670)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:829)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:748)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.add(ScriptRuntime.java:2558)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.do_add(Interpreter.java:3060)
	at script.(http://localhost:46994/static/43c91e29/scripts/yui/event/event-debug.js:385)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:879)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:808)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:748)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.add(ScriptRuntime.java:2558)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.do_add(Interpreter.java:3060)
	at script.(http://localhost:46994/static/43c91e29/scripts/yui/event/event-debug.js:114)
	at script.(http://localhost:46994/static/43c91e29/scripts/yui/event/event-debug.js:2258)
	at script.(http://localhost:46994/static/43c91e29/scripts/yui/datasource/datasource-debug.js:79)
	at script.(http://localhost:46994/static/43c91e29/scripts/yui/datasource/datasource-debug.js:2302)
	at script.(http://localhost:46994/static/43c91e29/scripts/yui/autocomplete/autocomplete-debug.js:18)
	at script.createSearchBox(http://localhost:46994/static/43c91e29/scripts/hudson-behavior.js:1711)
	at script.(script in http://localhost:46994//login from (4, 3626) to (4, 3663):4)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:879)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:427)
	at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:263)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3058)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:415)
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:522)
	at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536)
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:424)
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:399)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:892)
	at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:309)
	at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:364)
	at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:223)
	at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:238)
----

So this quick fix gets us around.

I think the root cause of the problem is that ScriptableObject.getDefaultValue() should treat null as the primitive value, but I'm bit scared to make that change right now.
上级 3c278df8
...@@ -717,7 +717,7 @@ cloneBeforeCaching : false, ...@@ -717,7 +717,7 @@ cloneBeforeCaching : false,
* @return {String} Unique name of the DataSource instance. * @return {String} Unique name of the DataSource instance.
*/ */
toString : function() { toString : function() {
return this._sName; return this._sName || "";
}, },
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册