WICG / webmonetization

Proposed Web Monetization standard
https://webmonetization.org
Other
466 stars 152 forks source link

Status of error event? #241

Closed pp-koch closed 1 year ago

pp-koch commented 2 years ago

The spec does not define an error event for the links. Will the extension support them nonetheless? That's currently unclear to me.

Firefox natively supports error events on link tags, but Chrome and Safari do not.

If the extension supports them, might they eventually make their way into the spec? I need to figure out if I have to treat the error event at the same level as the monetization event (i.e. 'the link tag supports two events') or that error should go on the Extension page, separate from the spec documentation.

sublimator commented 2 years ago

The extension only supports "error" events in the CoilPreview which is currently tracking (though not strictly) the #193 PR

Firefox natively supports error events on link tags, but Chrome and Safari do not.

Interesting. Are there any events for links that are only emitted for certain values of "rel" ?

pp-koch commented 2 years ago

Interesting question. Turns out Firefox fires an error event only for rel="stylesheet", and not for any other. Chrome and Safari fire nothing. Tested only on Mac.

https://quirksmode.org/link-errors.html

sublimator commented 2 years ago

What's the shape of the error? Any details ? or just Event('error')

pp-koch commented 2 years ago

Nope, nothing useful. See https://quirksmode.org/link-errors.html again.

pp-koch commented 2 years ago

By default the error event on stylesheet links in Firefox does not bubble up. But I think the error event that the extension fires should bubble.

marcoscaceres commented 2 years ago

Correct, it will bubble.

marcoscaceres commented 2 years ago

For where the “error” event is fired, see the spec link in #193 … search for “fire an event named "error" at element.”

(Responding from my phone)

sublimator commented 2 years ago

I don't think I made 'error' bubble in the CoilPreview ...

Might be worth mentioning it explicitly, cause for the onmonetization even where I did make it bubble (cause it was obvious that it should) I had to set some option on the Event constructor iirc

marcoscaceres commented 2 years ago

Yes, let me make that explicit.

marcoscaceres commented 2 years ago

Ok, updated the PR... good catch on that @sublimator: it's indeed defaulted to not bubble by the DOM spec. Now fixed 🙏

@AlexLakatos, when you are back online, could you update the static doc?

AlexLakatos commented 2 years ago

Updated the static doc.

marcoscaceres commented 2 years ago

oh wait... I think I screwed this up. load and error shouldn't bubble, only "monetization" should bubble.

sublimator commented 2 years ago

Yeah, I was just coming here wondering about that lol

sublimator commented 2 years ago

Is it because it's not a generic event ? It would confusion with other error/load handlers right ? window.onload would fire etc??

marcoscaceres commented 2 years ago

Is it because it's not a generic event ?

Correct.

It would confusion with other error/load handlers right ?

Exactly.

window.onload would fire etc??

Precisely 😱

marcoscaceres commented 2 years ago

ok, fixed in the PR.

huijing commented 1 year ago

Resolved by #193