Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2js StringBuffer not good for Android webview #11414

Closed
DartBot opened this issue Jun 21, 2013 · 4 comments
Closed

dart2js StringBuffer not good for Android webview #11414

DartBot opened this issue Jun 21, 2013 · 4 comments
Labels
closed-obsolete Closed as the reported issue is no longer relevant P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@DartBot
Copy link

DartBot commented Jun 21, 2013

This issue was originally filed by zeljko.kunica@gmail.com


What steps will reproduce the problem?

  1. open a dart2js generated script in android web view

What is the expected output? What do you see instead?
JS should work.
Code breaks on StringBuffer saying "Uncaught SyntaxError: Unexpected token else at ..."

The problem is in do - while loop followed by else statement. while should not end with ;, at least for android web view

if (separator.length === 0)
      do {
        str = iterator._liblib0$_current;
        str = typeof str === "string" ? str : $.S(str);
        this._contents = this._contents + str;
      } while (iterator.moveNext$0()); <---- problem
    else {

What version of the product are you using? On what operating system?
Dart SDK 0.5.20.3_r24216
Android emulator 4.0.3

Please provide any additional information below.

The workarount is to delete ; manualy after each js generation

@lrhn
Copy link
Member

lrhn commented Jun 21, 2013

In JavaScript, the semicolon after the while-expression of a do-while is not optional (if you ignore automatic semicolon insertion). The generated syntax looks like it is correct JS syntax.

From this description, it looks like a bug in the Android web-view.

If we always generate a newline after the semicolon, we should be able to remove it and still be valid JS (due to automatic semicolon insertion), but it's not pretty.
It would probably be better to fix the bug in Android, but it won't help most existing devices today.


Added Area-Dart2JS, Triaged labels.

@kasperl
Copy link

kasperl commented Jun 21, 2013

Added this to the Later milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants