Project

General

Profile

Actions

Bug #2534

closed

WSuggestionPopup javascript not rendering a ternary operator

Added by Anonymous almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
01/03/2014
Due date:
% Done:

0%

Estimated time:

Description

The ternary operator in WSuggestionPopup.js (lines 256-257) is not being sent to the browser correctly. The JavaScript in the minimised source code has the following statement

var j=L?p:p.substring(0,Math.max(D!==null?D.length:0,r));

In Chrome 32 and IE 11 I'm seeing this as

var j=Lp:p.substring(0,Math.max(D!==null?D.length:0,r));

-------^

Note the missing '?' above.

I'm building Wt 3.3.1 with Visual Studio 2013 and Boost 1.55.0


Files

WSuggestionPopup.min.js (4.59 KB) WSuggestionPopup.min.js Wim Dumon, 01/23/2014 12:45 PM
Actions #1

Updated by Mark Snelling almost 11 years ago

Forgot to sign in when creating this issue.

Actions #2

Updated by Wim Dumon almost 11 years ago

  • Assignee set to Wim Dumon

Hi Mark,

That's weird. Is it consistently reproducible? What is your testcase? Does it also occur with one of the Wt examples?

BR,

Wim.

Actions #3

Updated by Mark Snelling almost 11 years ago

Wim Dumon wrote:

Hi Mark,

That's weird. Is it consistently reproducible? What is your testcase? Does it also occur with one of the Wt examples?

BR,

Wim.

Yes it is consistent and it does seem to occur in the 'planner' example, although in the example it appears as a browser popup with the error message "Wt internal error: SyntaxError: Unexpected token :, code: undefined, description: undefined" when you click in one of the calendar squares.

Actions #4

Updated by Wim Dumon almost 11 years ago

  • Status changed from New to Feedback

Cannot reproduce with (patched) 1.54 with msvs 2012. I verified that chrome does indeed receive the correct contents. I will try with boost 1.55 (compiling now).

Did you do a clean rebuild (remove build directory & restart from scratch) to exclude a build error of some kind?

Wim.

Actions #5

Updated by Mark Snelling almost 11 years ago

Wim Dumon wrote:

Cannot reproduce with (patched) 1.54 with msvs 2012. I verified that chrome does indeed receive the correct contents. I will try with boost 1.55 (compiling now).

Did you do a clean rebuild (remove build directory & restart from scratch) to exclude a build error of some kind?

Wim.

Yes this was with done with clean builds using Visual Studio '2013' and Boost 1.55.0.

Actions #6

Updated by Wim Dumon almost 11 years ago

Mark,

Something goes wrong with reading the minified file. Must be related to MSVS2013. I will take a look at this.

BR,

Wim.

Actions #7

Updated by Wim Dumon almost 11 years ago

My minimal test case:

#include <iostream>

#define A(i, j) const char *str##i = #j;

A(1, L?)
A(2, S?)

int main()
{
    std::cout << str1 << std::endl;
    std::cout << str2 << std::endl;
}

MSVS 2010 says:

L?
S?

MSVS 2013 says:

L
S?

Anyone? :)

BR,

Wim.

Actions #8

Updated by Mark Snelling almost 11 years ago

This appears to be a problem with the 'L' character. L is used by the compiler before a string to identify it as unicode, e.g. L"abc". It seems to confuse the preprocessor in this case.

A fix is to not use 'L' here, or put a space between the L and ?

Actions #9

Updated by Mark Snelling almost 11 years ago

Mark Snelling wrote:

This appears to be a problem with the 'L' character. L is used by the compiler before a string to identify it as unicode, e.g. L"abc". It seems to confuse the preprocessor in this case.

A fix is to not use 'L' here, or put a space between the L and ?

I have filed a bug report with Microsoft here https://connect.microsoft.com/VisualStudio/feedback/details/813595/c-preprocessor-incorrectly-handling-l-character

Actions #10

Updated by Koen Deforche almost 11 years ago

  • Status changed from Feedback to Resolved

I have a workaround for this using the ---externs command line option of the minifier.

Actions #11

Updated by Mark Snelling almost 11 years ago

Koen Deforche wrote:

I have a workaround for this using the ---externs command line option of the minifier.

Thanks, MS have fixed the compiler bug and it should be in the next major VS release. Do you have a patch that I can apply to my source until 3.3.2 is released?

Actions #12

Updated by Wim Dumon almost 11 years ago

Hi Mark,

The quickfix: just put back the ? that MSVS deleted. It's the only instance that we know of that had a problem. In the future, we will avoid L and R in minified JS.

Wim.

Actions #13

Updated by Mark Snelling almost 11 years ago

Wim Dumon wrote:

Hi Mark,

The quickfix: just put back the ? that MSVS deleted. It's the only instance that we know of that had a problem. In the future, we will avoid L and R in minified JS.

Wim.

Thanks but do you have an already minified .js file I can use that doesn't use the L character? Otherwise I would have to edit the .JS file as it's #include'd into the .cpp, and to be honest I don't know what I'm doing with JavaScript.

Actions #14

Updated by Wim Dumon almost 11 years ago

This is my current file, where I fixed the issue by putting a space between L and ?. Overwrite wt/src/jw/WSuggestionPopup.min.js with this one.

BR,

Wim.

Actions #15

Updated by Koen Deforche almost 11 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF