P5.js-web-editor: "Script error. (: line 0)" in Chrome

Created on 23 Oct 2018  路  8Comments  路  Source: processing/p5.js-web-editor

Nature of issue?

  • [x ] Found a bug
  • [ ] Existing feature enhancement
  • [ ] New feature request

Details about the bug:

  • Web browser and version:
  • Operating System:

Google Chrome | 67.0.3396.87聽(Official Build)聽(64-bit)
-- | --
Revision | 878cd31214ac27a3996927cd5c9c138b10c9fc8d-refs/branch-heads/3396@{#771}
OS | Mac OS X
JavaScript | V8聽6.7.288.46

  • Steps to reproduce this:

Maybe this is a product of my code, but this error message isn't helping me ID the problem:

I run this code to generate random lines and after 2 - 5 iterations, I get "Script error. (: line 0)"

I thought it might be due to divide by zero errors or accidentally trying to calculate the square root of a negative number, so I went through the code and tried to put abs() around everything that might be causing that issue, with no luck.

This link reports the same error when the browser flags a same-origin exception - but what about this code would be triggering that?

"The "Script error." happens in Firefox, Safari, and Chrome when an exception violates the browser's same-origin policy - i.e. when the error occurs in a script that's hosted on a domain other than the domain of the current page"

https://stackoverflow.com/questions/5913978/cryptic-script-error-reported-in-javascript-in-chrome-and-firefox

There's no rhyme or reason to the variables or constants I was using; I was basically just messing around with variations on the equation for an ellipse.

code:

function setup() {
c = 200;
createCanvas(400, 400);
frameRate(2);
}

function draw() {
background(220);
stroke("black");
strokeWeight(10);

for (var x = 0; x <= 100; x = x + 1) {
var a = x + 20;
var b = x - 20;
var y = (sqrt(abs(1 - (sq(x) / sq(abs(a))))));
function j(x) {return int(random(10,100)) * x}
function k(x) {return 100 * int(random(-100,100)) * (y / sq(abs(b)))}
line(j(x-10), k(x-10), j(x), k(x));
line(j(x-5), k(x-5), j(x-100), k(x-100));
}

}

duplicate

Most helpful comment

ahhhhh that is super helpful! this is related to an error with the p5.accessibility library. if you click on the cog settings icon in the upper right, then click on the tab "accessibility", are any of the boxes checked under "accessible text-based canvas"?

All 8 comments

thanks for reporting! i just tried copying and pasting your code and let it run for a bit, but i'm not able to reproduce. could you try creating a new sketch and doing the same thing? could you also try running the sketch in an incognito window, because maybe it's one of your Chrome extensions?

I get the same error when moving the mouse for a while in the preview-window. However in the fullscreen window the error does not occur.

Script error. (: line 0)

with this code (with Chrome-Incognito, Windows)

let rand = 30;


function setup() {
  createCanvas(600, 600);
  colorMode(HSB, 360, 100, 100);

}

function draw() {
  background(255);
  let anzahl = map(mouseX, 0, width, 5, 40);
  let breite = (width - rand) / anzahl;
  for (let i = 0; i < anzahl; i++) {
    let x = rand + breite * i;
    for (let j = 0; j < anzahl; j++) {
      let y = rand + breite * j;
      ellipse(x, y, 10, 10);
    }
  }
}

@ktheu thanks for the update! i'm still not able to reproduce. how long do you have to wait? are you able to open the developer tools and see any other errors, or the error stack?

@catarak error appears roughly after one second after moving the mouse. Yes there are other errors in the developer tool:

p5-accessibility.js:1461 Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
    at textInterceptor.populateTable (VM35 p5-accessibility.js:1461)
    at e.p5.(/anonymous function) (https://cdn.rawgit.com/processing/p5.accessibility/v0.1.1/dist/p5-accessibility.js:1628:25)
    at e.p5.(/anonymous function) [as background] (https://cdn.rawgit.com/processing/p5.accessibility/v0.1.1/dist/p5-accessibility.js:1847:27)
    at draw (VM34 about:srcdoc:66)
    at e.d.redraw (VM27 p5.min.js:9)
    at e.p5.(/anonymous function) (https://cdn.rawgit.com/processing/p5.accessibility/v0.1.1/dist/p5-accessibility.js:1631:27)
    at e.p5.(/anonymous function) [as redraw] (https://cdn.rawgit.com/processing/p5.accessibility/v0.1.1/dist/p5-accessibility.js:1847:27)
    at e.<anonymous> (VM27 p5.min.js:8)

ahhhhh that is super helpful! this is related to an error with the p5.accessibility library. if you click on the cog settings icon in the upper right, then click on the tab "accessibility", are any of the boxes checked under "accessible text-based canvas"?

Yes, the plain-text and table-text boxes were checked (don't know why).The plain-text box check causes the error.
I will use the Editor with all boxes unchecked. This will work for me. Thanks.

i think there's a keyboard shortcut that folks are incidentally pushing and turning on the accessibility options, since this has been coming up a lot. will investigate!

closing this as a duplicate of #768

Was this page helpful?
0 / 5 - 0 ratings