[Dojo-checkins] [dojo] #8549: stripConsole breaks with matched parenthesis
dojo
trac at dojotoolkit.org
Thu Jun 11 23:57:35 EDT 2009
#8549: stripConsole breaks with matched parenthesis
-------------------------+--------------------------------------------------
Reporter: dante | Owner: jburke
Type: defect | Status: new
Priority: normal | Milestone: future
Component: BuildSystem | Version: 1.2.3
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment(by neek):
I see. That code shrinks like so:
{{{
[neek at uberneek shrinksafe]$ cat > peller.js
var a=1
console.log("message goes here");
[neek at uberneek shrinksafe]$ java -jar shrinksafe.jar -stripConsole all
peller.js
var a=1;
}}}
So I think we're safe.
I've found and fixed a problem with my algorithm which broke the comet
code. Thank God for the shrinksafe,keepLines build option, which allows
me to sanely diff two release builds. This code in cometd/_base.js:
{{{
if(data.version < this.minimumVersion){
if (console.log)
console.log("cometd protocol version mismatch. We wanted",
this.minimumVersion, "but got", data.version);
successful=false;
this._advice.reconnect="none";
}
}}}
broke, because my algorithm presumed the mention of "console.log" is the
start of a function call. I've fix it to expect an open parenthesis too,
however, isn't that code a little broken anyway? Could we change it to
just call console.warn, instead of the if() test for console.log? i.e.
{{{
if(data.version < this.minimumVersion){
console.warn("cometd protocol version mismatch. We wanted",
this.minimumVersion, "but got", data.version);
successful=false;
this._advice.reconnect="none";
}
}}}
Just a suggestion. It now shrinks to:
{{{
if(data.version<this.minimumVersion){
if(console.log){
}
successful=false;
this._advice.reconnect="none";
}
}}}
Diff coming up. I'm finding today that no console.anything output is
appearing in firebug, but to be honest this has happened on and off for a
while, and happens with or without a release build, so it must be
something to do with my platform. Functionally, my app is now fine,
--
Ticket URL: <http://bugs.dojotoolkit.org/ticket/8549#comment:24>
dojo <http://dojotoolkit.org/>
The Dojo UI Toolkit
More information about the Dojo-checkins
mailing list