importing javascript now fail with script-src violations

i observe this morning that attempts to import javascript libraries into a notebook in safari fail.
this, just as of this morning.
in chrome and firefox the notebook continues to load without issue.

has something changed in your headers?

Was there any errors in the console?

there i had seen the errors regarding a disallowed script-src.
at the moment, those do not appear and the network pane does indicate that script in question does appear.
now, however, other errors appear:

in index-de159e0c.js line 3,062:148
}(t) && (null === n ? e.removeAttribute(t) : e.setAttribute(t, “” + n)) : o.mustUseProperty ? e[o.propertyName] = null === n ? 3 !== o.type && “” : n : (t = o.attributeName, r = o.attributeNamespace, null === n ? e.removeAttribute(t) : (n = 3 === (o = o.type) || 4 === o && !0 === n ? “” : “” + n, r ? e.setAttributeNS(r, t, n) : e.setAttribute(t, n))))

Error while parsing the ‘sandbox’ attribute: ‘allow-downloads’ is an invalid sandbox flag.

in index-de159e0c.js line 20,230:107
Error.stackTraceLimit = 50, this._options.onerror && (mw.log(“Global Handler attached: onerror”), this._installGlobalOnErrorHandler()), this._options.onunhandledrejection && (mw.log(“Global Handler attached: onunhandledrejection”), this._installGlobalOnUnhandledRejectionHandler())

navigator.sendBeacon is not a function. (In ‘navigator.sendBeacon(“https://events.observablehq.com/beacon-events”,JSON.stringify({events:ly,send_time:(new Date).toUTCString()}))’, ‘navigator.sendBeacon’ is undefined)

@lisp These warnings should be unrelated. Which library did you try to import? Can you share a notebook link?

i believe i traced the original issue to that the particular browser (in that case safari) had retained in its cache a version of a library file which had a syntax error.
when i then had attempted to verify that i had gotten it to release the file by importing it in the console, that failed with the noted error.

for this error in the console, it appears, that the particular observablehq page does not matter.
if i open this page

https://observablehq.com/@datagenous/resource-protocol-library

attempting to load any external library in the debugger, eg

import('https://nl4.dydra.com/javascripts/replication/graph-object.js').then(console.log) 

yields
(in chrome)

Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf https://nl4.dydra.com/javascripts/replication/graph-object.js blockiert ("script-src"). debugger eval code:1
Uncaught (in promise) TypeError: error loading dynamically imported module    <anonymous> debugger eval code:1

(in safari)

var c = null; import(“https://nl4.dydra.com/javascripts/ui/classes/cell.js”).then(console.log)
[Error] Refused to load https://nl4.dydra.com/javascripts/ui/classes/cell.js because it does not appear in the script-src directive of the Content Security Policy.
< Promise {status: “pending”}
[Error] TypeError: null is not an object (evaluating ‘i.disconnect’) — index-538c04a2.js:2:32876
(anonymous function) (index-538c04a2.js:36:181982)
fs (index-538c04a2.js:7:96050)
callback (index-538c04a2.js:7:103175)
_a (index-538c04a2.js:7:62193)
gs (index-538c04a2.js:7:97251)
kc (index-538c04a2.js:7:114885)
kc
unstable_runWithPriority (index-538c04a2.js:7:11615)
_c (index-538c04a2.js:7:111353)
uc (index-538c04a2.js:7:107556)
uc
(anonymous function) (index-538c04a2.js:7:58949)
unstable_runWithPriority (index-538c04a2.js:7:11615)
ra (index-538c04a2.js:7:58895)
na (index-538c04a2.js:7:58830)
ic (index-538c04a2.js:7:104137)
enqueueSetState (index-538c04a2.js:7:62618)
setState (index-538c04a2.js:7:2336)
(anonymous function) (index-538c04a2.js:36:239217)
r (index-538c04a2.js:36:227232)
[Error] TypeError: null is not an object (evaluating ‘r.current.disconnect’) — index-538c04a2.js:2:31595
(anonymous function) (index-538c04a2.js:36:181982)
fs (index-538c04a2.js:7:96050)
callback (index-538c04a2.js:7:103175)
_a (index-538c04a2.js:7:62193)
gs (index-538c04a2.js:7:97251)
kc (index-538c04a2.js:7:114885)
kc
unstable_runWithPriority (index-538c04a2.js:7:11615)
_c (index-538c04a2.js:7:111353)
uc (index-538c04a2.js:7:107556)
uc
(anonymous function) (index-538c04a2.js:7:58949)
unstable_runWithPriority (index-538c04a2.js:7:11615)
ra (index-538c04a2.js:7:58895)
na (index-538c04a2.js:7:58830)
ic (index-538c04a2.js:7:104137)
enqueueSetState (index-538c04a2.js:7:62618)
setState (index-538c04a2.js:7:2336)
(anonymous function) (index-538c04a2.js:36:239217)
r (index-538c04a2.js:36:227232)
[Error] TypeError: null is not an object (evaluating ‘r.current.disconnect’) — index-538c04a2.js:2:31595
(anonymous function) (index-538c04a2.js:36:181982)
fs (index-538c04a2.js:7:96050)
callback (index-538c04a2.js:7:103175)
_a (index-538c04a2.js:7:62193)
gs (index-538c04a2.js:7:97251)
kc (index-538c04a2.js:7:114885)
kc
unstable_runWithPriority (index-538c04a2.js:7:11615)
_c (index-538c04a2.js:7:111353)
uc (index-538c04a2.js:7:107556)
uc
(anonymous function) (index-538c04a2.js:7:58949)
unstable_runWithPriority (index-538c04a2.js:7:11615)
ra (index-538c04a2.js:7:58895)
na (index-538c04a2.js:7:58830)
ic (index-538c04a2.js:7:104137)
enqueueSetState (index-538c04a2.js:7:62618)
setState (index-538c04a2.js:7:2336)
(anonymous function) (index-538c04a2.js:36:239217)
r (index-538c04a2.js:36:227232)
[Error] Unhandled Promise Rejection: TypeError: Importing a module script failed.
(anonymous function)
promiseReactionJob

the connection to observablehq is that, on an empty page, it yields

import('https://nl4.dydra.com/javascripts/replication/graph-object.js').then(console.log) 
Promise { <state>: "pending" }

Object { GraphObject: class GraphObject, … }

It looks like you ran those console commands in the parent context, not in the sandboxed iframe. There’s a dropdown to the right side of the console prompt which allows you to select the document context:

2 Likes

thank you for the explanation.