Problem with danielthebanana4's project

  1. What browsers show this problem?
    Firefox on Ubuntu
  2. Please share an example project (if possible).
    https://snap.berkeley.edu/snap/snap.html#present:Username=danielthebanana4&ProjectName=Floppy%20disk&editMode&noRun
  3. Describes the steps to reproduce this issue.
    ezgif-4-07868c04100d
  4. What does Snap! currently do?
    Making everything black, because of clicking somewhere
  5. What should Snap! do instead?
    work normal

Oy. Does it happen only after you slide out the stage size?

It might be the xml file, I converted it from scratch through @djdolphin's Snapinator, the xml file may have a bug in it or this a really a bug

This is a Snap! or Firefox issue, I think. I can reproduce the bug in Firefox on Linux and macOS, but Chromium and Safari work fine.

The problem seems to be this 0x0 SVG costume:
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSIwIiBoZWlnaHQ9IjAiIHZpZXdCb3g9IjAgMCAwIDAiPgogIDwhLS0gRXhwb3J0ZWQgYnkgU2NyYXRjaCAtIGh0dHA6Ly9zY3JhdGNoLm1pdC5lZHUvIC0tPgo8L3N2Zz4=

It results in Uncaught DOMException: Index or size is negative or greater than the allowed amount when it's drawn at lines 1997 and 7550 of objects.js.

When I import just that costume into Snap! in Firefox, I get the same issue.

The plaintext version of the costume is

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="0" height="0" viewBox="0 0 0 0">
  <!-- Exported by Scratch - http://scratch.mit.edu/ -->
</svg>

Just a normal, empty SVG with a comment.

Oh no, it's an advertising beacon!

You caught me.

I think the proper solution is for Snap! to not draw a costume if its width or height is 0.

Images with these dimensions are valid and apparently appear in the wild, but it doesn't make any sense to draw them. And Firefox considers drawing them to be error-worthy even though no other browser does.

(I should note that Firefox only considers it an error when drawing it on a canvas. Anywhere else, it's inexplicably fine.)

Actually, after looking at the HTML Canvas spec, a standards-compliant web browser should just abort drawing the image without throwing an error.

I found the line to blame in the Firefox source code, and I'll submit a bug report and a patch in the morning, when I'm more awake.

Ok

No. It happens everywhere.

That sounds good :slight_smile:
I am really curious, how the project works...

Here's the Bugzilla issue for this: https://bugzilla.mozilla.org/show_bug.cgi?id=1659371

Haven't gotten around to figuring out Mozilla's contribution process so I can submit a patch...