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 + isolates: $.IsolateNatives_computeThisScript computes the wrong script (REGRESSION) #8455

Closed
kevmoo opened this issue Feb 9, 2013 · 19 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js

Comments

@kevmoo
Copy link
Member

kevmoo commented Feb 9, 2013

What steps will reproduce the problem?

  1. Grab the BOT at this commit: https://github.com/kevmoo/bot.dart/tree/562aea1326e24ec4a34f7c48f4996f1609f41829
  2. pub install
  3. Run harness_browser.html via Javascript

What is the expected output? What do you see instead?

Expected: everything works, just like in Dart.

Instead: A bunch of

  Caught Error: SYNTAX_ERR: DOM Exception 12

What version of the product are you using? On what operating system?

Dart VM version: 0.3.5.1 r18300 (Fri Feb 8 23:49:41 2013)

Please provide any additional information below.

After debugging, it seems that the func:

  $.IsolateNatives_computeThisScript

Returns the wrong script.

In this case the returned script uri is ""

In other cases, it's returned the google analytics script: "http://www.google-analytics.com/ga.js"

@kevmoo
Copy link
Member Author

kevmoo commented Feb 9, 2013

Context. It's the call to

  new Worker(uri)

with the bad URI that causes the DOM Exception 12

See attached.


Attachment:
[Screen Shot 2013-02-09 at 5.27.22 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-8455/comment-1/Screen Shot 2013-02-09 at 5.27.22 PM.png) (31.50 KB)

@kasperl
Copy link

kasperl commented Feb 12, 2013

Added this to the M4 milestone.
Added Area-Dart2JS, Triaged labels.

@peter-ahe-google
Copy link
Contributor

I may have a fix for this in my CL for deferred loading of static functions.

@peter-ahe-google
Copy link
Contributor

Set owner to @peter-ahe-google.
Added Started label.

@peter-ahe-google
Copy link
Contributor

Added Duplicate label.
Marked as being merged into #7369.

@peter-ahe-google
Copy link
Contributor

Marked as being merged into #90.

@peter-ahe-google
Copy link
Contributor

Marked as being merged into #7369.

@peter-ahe-google
Copy link
Contributor

Issue #90 and 7369 seem to be about slightly bigger issues. I have a fix for IsolateNatives.computeThisScript, which seems to be relevant for this bug.


Added Started label.
Marked as being merged into #.

@peter-ahe-google
Copy link
Contributor

@peter-ahe-google
Copy link
Contributor

Fixed in r18648.

@peter-ahe-google
Copy link
Contributor

The fix failed on IE10. I reverted the change in r18649.

@peter-ahe-google
Copy link
Contributor

Should be fixed with r18648, r18694, and r18695.

But it isn't. The problem is that dart.js uses replaceChild, rather than appendChild. This makes it impossible to figure out what the current script is.

If I apply this patch to dart.js:

--- a/dart/pkg/browser/lib/dart.js
+++ b/dart/pkg/browser/lib/dart.js
@@ -27,6 +27,7 @­@ if (navigator.webkitStartDart) {
           var script = document.createElement('script');
           script.src = scripts[i].src.replace(/.dart(?=?|$)/, '.dart.js');
           var parent = scripts[i].parentNode;

  •      document.currentScript = script;
    
               parent.replaceChild(script, scripts[i]);
             }
           }

I get these errors like this:

bot_async
 
(0/2)
86
FAIL
bot_async - simple. Caught Error: SecurityError: DOM Exception 18
Error: An attempt was made to break through the security policy of the user agent.
    at $.IsolateNatives__spawnWorker (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:15826:12)
    at $.IsolateNatives__startWorker (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:15805:7)
    at $.IsolateNatives_spawn (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:15795:7)
    at $.IsolateNatives_spawnFunction (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:15785:12)
    at $._Isolate_spawnFunction (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:17492:12)
    at $.spawnFunction (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:17478:12)
    at $._TestValue$ (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:14753:29)
    at Function.$.TestSendPortValue__testSimple as call$0
    at TestCase.$$.TestCase.test$0 (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:7059:22)
    at TestCase.$$.TestCase.run$0 (file://localhost/Users/ahe/Dart/all/dart/moo/bot.dart/test/harness_browser.dart.js:7075:12)


Removed the owner.
Added Triaged label.

@peter-ahe-google
Copy link
Contributor

Vijay, could you please assign this bug to someone familiar with pkg/browser/lib/dart.js?


Set owner to @vsmenon.
Removed Area-Dart2JS label.
Added Area-Pkg label.

@peter-ahe-google
Copy link
Contributor

I have attached a small repro.


Attachments:
dart.js (8.16 KB)
index.html (212 Bytes)
test.dart (137 Bytes)

@peter-ahe-google
Copy link
Contributor

In the repro, compiler test.dart like this:

dart2js test.dart -otest.dart.js

@kevmoo
Copy link
Member Author

kevmoo commented Mar 20, 2013

Bumping the priority. This is a regression. Any updates?


Removed Priority-Medium label.
Added Priority-High label.

@DartBot
Copy link

DartBot commented Apr 1, 2013

This comment was originally written by [email protected]


Issue #9493 has been merged into this issue.

@DartBot
Copy link

DartBot commented Apr 1, 2013

This comment was originally written by [email protected]


Added C2 label.

@sethladd
Copy link
Contributor

sethladd commented Apr 1, 2013

Issue #9493 has been merged into this issue.

@kevmoo kevmoo added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js closed-obsolete Closed as the reported issue is no longer relevant labels Apr 1, 2013
@kevmoo kevmoo added this to the Later milestone Apr 1, 2013
This issue was closed.
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 P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants