Git Product home page Git Product logo

pause-document's People

Contributors

jkarlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pause-document's Issues

Should paused state be a boolean or a counter?

I'm not sure what the right thing is here. Having it be a boolean means pages that want to pause/unpause from multiple places might need to keep track of the number of pause/unpause calls themselves, out of band. On the other hand, that does mean that it's possible to unpause no matter how many pause calls happen, if you want to do so...

This last would be particularly useful if we do want the UA to be able to unpause things that script pauses.

find a better name for the PauseFrame API?

The name "PauseFrame API" seems problematic to me, because "frame" already means at least three different things on the Web platform:

  1. an element that holds a subdocument (as in <iframe>)
  2. a tick of an animation or of the browser refresh cycle (as in requestAnimationFrame())
  3. a stack frame in JS

Associating the words "pause" and "frame" together leads me, and I suspect others, to assume that frame in this context is usage (2) (i.e., that this is an api about animations) rather than usage (1).

My inclination is that you should probably avoid the term "frame" in the title of the specification because of this potential confusion, and because of the (maybe) general principle that overused/confusable terms should be used as little as possible.

I'm not sure if that implies anything about the names exposed in the API surface...

(I got here from w3ctag/design-reviews#196. But just my own opinion at this point; not speaking for the TAG.)

clarify whether paused attribute reflects pausing of ancestor frames

The explainer currently describes a frameElement.paused attribute, but isn't clear about whether this is true or false if an ancestor frame has been pause()d. It should probably be clear about which way this works.

I think there are arguments for both sides:

  • reflecting state on ancestors makes it a better source of truth
  • not reflecting state from ancestors makes it correspond better to the pause() and unpause() methods.

How does pausing actually work in terms of its effects on subframes of the paused frame?

Say I have page A, which has frame B, which has subframe C.

If A pauses B, then pauses C, then unpauses B, is C paused?

If A pauses C, then pauses B, then unpauses B, is C paused?

If A pauses B (which pauses C, right?), then unpauses C, is C still paused? If A then unpauses B, is C paused?

If B pauses C, then A pauses B, then A unpauses B, is C paused?

This may be related to #21

showUI and offscreen/tiny frames

I don't have a specific solution in mind, but wondering about what UI would look like for resuming a frame that is either offscreen or very tiny.

Fire a synchronous event before pausing?

The paused frame might want to be made aware that it's about to be paused so that it can do some cleanup or log something.

Perhaps it could be an option:

frame_element.pause({notify: true});

Explain that the current event loop task is allowed to finish

That is, pause() doesn't pause script execution or painting or anything that's ongoing. It just ensures that future turns of the event loop are paused, i.e. anything previously queued up or queued up in the future will not run until resume()ed.

This is not immediately clear from "A bit more about what pausing does", but I think it's pretty important to avoid people freaking out and misinterpreting this proposal as something very weird.

"resource requests"

Likewise, any resource requests generated by the frame will be queued as well, to be started upon resuming.

This doesn't really match how most resource requests work on the platform. If a resource request is generated (e.g. by fetch()), it will happen anyway. It will then queue a task to resolve the promise, or fire the event, or update the DOM, or whatever. So, when paused, no code will happen to actually process the response. But the resource request will definitely start, and even finish, despite being paused.

"automatically intervene"

This throwaway mention deserves more attention. Without this one line, it seems like the proposal is only about developer-controlled pause() and resume() methods.

With this line, I think the interpretation is instead that this repo is attempting to define the general concept of pausing/resuming a frame. This can happen in at least two ways: developer-initiated, via these new APIs we're speccing; and browser-initiated, via an intervention.

If so, I'd suggest reframing the document to deemphasize the API and emphasize the introduction of this general new concept.

What happens if a frame is paused during pageload?

Can the load event on the parent fire before the frame is unpaused? I'd assume not, because the load event on the frame itself can't fire, and the load event on the parent needs to fire after the one for the frame...

On the other hand, since there's no way to create a frame in an "already paused" state, this could be a bit of a footgun, unless people make sure to pause frames from those frames' load events or something.

Is queueing mouse events the right thing for paused frames?

The explainer says that events for paused frames are queued. As a user, I think it would be really weird if I clicked a link in a subframe, nothing happened, then sometime later the navigation randomly happened (when the frame got unpaused).

clarify whether the paused attribute reflects pausing that was done by the user agent

The explainer says that pausing can happen either through the pause()/unpause() API or as an intervention by the user agent. It should be clear whether the paused attribute reflects only the first type of pausing, or whether it reflects both types of pausing.

(It's not clear to me which is better, but making it explicit will make people who read the explainer more likely to think about and provide feedback on the issue.)

(I got here from w3ctag/design-reviews#196. But just my own opinion at this point; not speaking for the TAG.)

How can users prevent user-hostile frame pausing?

Consider a site which as an "anti-copying" feature puts all its content into a frame that it then pauses. It allows scrolling the parent document of that frame. Per the letter of the explainer, this means the user cannot select text in the subframe. Can the user even bring up a context menu for things in the frame? What about other sorts of interaction?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.