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

Missing exception when I try to assing a file://... to ImageElement.src #3202

Closed
DartBot opened this issue May 24, 2012 · 8 comments
Closed
Labels
closed-invalid Closed as we don't believe the reported issue is generally actionable

Comments

@DartBot
Copy link

DartBot commented May 24, 2012

This issue was originally filed by off...@mikemitterer.at


What steps will reproduce the problem?

  1. final ImageElement image = form.query("#qrcode");
  2. image.src = "file://assets/img/bootstrap-example-fluid.jpg";
  3. Console:
    Not allowed to load local resource: file://assets/img/bootstrap-example-fluid.jpg

What is the expected output? What do you see instead?
The app fails silently. Not good. I would like to see a exeption instead.

What version of the product are you using? On what operating system?
Chromium: Version 21.0.1138.0 (137335)
Dart Editor: Version 0.1.0.201205161003, Build 7696

Please provide any additional information below.

@DartBot
Copy link
Author

DartBot commented May 24, 2012

This comment was originally written by @bp74


You have to add an error event handler to the image:
image.on.error(onErrorFunction);

loading an image is an asychronous process, so the error comes long after you have set the "src" attribute.

@DartBot
Copy link
Author

DartBot commented May 24, 2012

This comment was originally written by antonm@google.com


Added Invalid label.

@DartBot
Copy link
Author

DartBot commented May 24, 2012

This comment was originally written by off...@mikemitterer.at


Hmmmm, here is what I tried before I created the issue-report:

image.on.error.add((event) {
   print("onerror -image");
});
image.src = "file://assets/img/bootstrap-example-fluid.jpg";

I think this is what you ment with: image.on.error(onErrorFunction);

But print wont be called.

So I thought maybe it could be handled like in dart:io

Changed the error-handling behavior in dart:io. If an error occurs and there is no error handler an exception > will now be thrown. This gets rid of silent failures that makes applications hard to debug.

Wrong assumption...

Do you have further informations for me?
thx in advance

@DartBot
Copy link
Author

DartBot commented May 24, 2012

This comment was originally written by antonm@google.com


Sorry, I closed too fast. Reopening. How do you run your code, natively or compiled to JS?


Added NeedsInfo label.

@DartBot
Copy link
Author

DartBot commented May 24, 2012

This comment was originally written by off...@mikemitterer.at


In Chromium - so native.

@anders-sandholm
Copy link
Contributor

Added Area-Dartium, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jun 19, 2012

This comment was originally written by antonm@google.com


office@,

Do you compile your Dart code to JS first?

And may you, please, attach the full sample which demonstrates the problem?


Added NeedsInfo label.

@DartBot
Copy link
Author

DartBot commented Jun 22, 2012

This comment was originally written by antonm@google.com


Ok, my quick test in JS tells me it's the behaviour we have in JS too, so I am closing as invalid for now, but, please, reopen if you have any additional considerations.


Added Invalid label.

@DartBot DartBot added Type-Defect closed-invalid Closed as we don't believe the reported issue is generally actionable labels Jun 22, 2012
copybara-service bot pushed a commit that referenced this issue Dec 1, 2021
Changes:
```
> git log --format="%C(auto) %h %s" b9edfa5..dcb6aba
 https://dart.googlesource.com/pub.git/+/dcb6abac Merge remote-tracking branch 'origin/cherry-pick2-for-2.15.0'
 https://dart.googlesource.com/pub.git/+/dc857523 Remove duplicated lines in testdata (#3234)
 https://dart.googlesource.com/pub.git/+/acc8ab09 Refactor the test package-server (#3230)
 https://dart.googlesource.com/pub.git/+/1e78c688 Better error messages round 2 (#3223)
 https://dart.googlesource.com/pub.git/+/eaf36513 More links in the repository specification (#3220)
 https://dart.googlesource.com/pub.git/+/c888b018 Remove pedantic and cleanup a few lints (#3224)
 https://dart.googlesource.com/pub.git/+/a4d44c7e Global package server null safety (#3225)
 https://dart.googlesource.com/pub.git/+/ff941887 Merge branch 'cherry-pick-for-2.15.0'
 https://dart.googlesource.com/pub.git/+/efd24e64 Fix hanging event handler for `stdin`. (#3218)
 https://dart.googlesource.com/pub.git/+/d77c14e8 Gitignore validator should not follow symlink dirs (#3209)
 https://dart.googlesource.com/pub.git/+/7c190789 migrate rest of test/ to null-safety (#3207)
 https://dart.googlesource.com/pub.git/+/f24adb64 migrate test/oath2/ test/outdated/ test/token test/validator/ to null-safety (#3206)
 https://dart.googlesource.com/pub.git/+/e7d77a57 migrate test/add, test/cache, test/embedding plus a bit more to null-safety (#3205)
 https://dart.googlesource.com/pub.git/+/a6a73ad2 migrate test/lish/, test/run/, test/upgrade/ and golden_file.dart to null-safety (#3204)
 https://dart.googlesource.com/pub.git/+/b90efc1f Add test that `pub get` works with no $HOME in environment. (#3173)
 https://dart.googlesource.com/pub.git/+/c2fe3966 migrate test/get/ to null-safety (#3203)
 https://dart.googlesource.com/pub.git/+/1d106898 migrate test/hosted/ to null-safety (#3200)
 https://dart.googlesource.com/pub.git/+/afa9932b migrate test/cache and test/downgrade/ to null-safety (#3201)
 https://dart.googlesource.com/pub.git/+/352ca989 migrate test/global/ to null-safety (#3202)
 https://dart.googlesource.com/pub.git/+/64f20ca4 migrate test/descriptor/ and couple more files in test/ to null-safety (#3192)

```

Diff: https://dart.googlesource.com/pub.git/+/b9edfa5e288ea3d1a57d1db054ef844ae7b27d99~..dcb6abac2d7d43258c03b348be42bf4aab9529b1/
Change-Id: I30d33b0b8c3c19097a16543db15c6ae633f0afc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221633
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Jonas Jensen <jonasfj@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-invalid Closed as we don't believe the reported issue is generally actionable
Projects
None yet
Development

No branches or pull requests

2 participants