Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Chrome Google

Chrome Experimental Feature Will Throttle Javascript-Timer Wakeups on Backgrounded Tabs (thewindowsclub.com) 44

Slashdot reader techtsp writes: Starting with October's release of Chrome 86, the web browser will offer a way to limit JavaScript timer wake ups in background web pages to one wake up per minute, restricting the execution of certain background tasks — for example, checking if the scroll position changed, reporting logs, and analyzing interactions with ads. Google plans to achieve this courtesy of a new experimental feature called "Throttle Javascript timers in background."

Google recently experimented with a prototype that limits Javascript timer wake ups to one per minute. In this experiment, Google opened 36 random tabs in the background while the foreground tab was about:blank. At the end of the experiment, Google found that throttling Javascript timers extends the battery life by almost 2 hours (28 percent) for a user with up to 36 background tabs, and when the foreground tab is about:blank...

Chrome will provide developers with a message in the DevTools console when a Javascript timer is delayed by more than 5 seconds.

This discussion has been archived. No new comments can be posted.

Chrome Experimental Feature Will Throttle Javascript-Timer Wakeups on Backgrounded Tabs

Comments Filter:
  • by UnknownSoldier ( 67820 ) on Sunday July 05, 2020 @02:56PM (#60264624)

    For those that "need" background tabs to be "active" is opening them in a new window a work-around?

    • by swilver ( 617741 )

      It should be, I set up Firefox like this (in its about:config) and whenever a page misbehaves because of these changes, giving it its own window (or making it the active tab) solves the problem.

  • by Kisai ( 213879 ) on Sunday July 05, 2020 @03:12PM (#60264662)

    Please Chromium browsers, just pause the tab 3 seconds after click away from it unless it's playing audio that I explicitly activated. I don't need twitter updating in the background while I play a game.

    The only tabs that should be updating in the background:
    - Music players
    - GPS-enabled (eg food couriers), or mapping-enabled websites
    - Tabs that have permission to use the video camera or microphone

    Tabs that should paused:
    - All WASM, WebGL, Canvas-based updating
    - All forums that have not asked or not been given permission to notify you
    - All social media, advertisements, or anything set on a timer that you have not given permission to refresh/auto-load

    Like gmail, I would like to update in the background, twitter, I do not. Youtube I want the audio in the background but not the video, and my banking apps I want to stay logged in and update in realtime, but not want them to interrupt me.

    • Cue a bunch of web pages that play a .wav file full of zeros to keep themselves awake and spying on you...

      • by Entrope ( 68843 )

        That's why the OP specified "explicitly activated" audio.

        • Cue a bunch of web pages that use an invisible overlay to explicitly start playing a wave file full of zeros if you click anywhere on the page.

    • Re: (Score:2, Insightful)

      by thegarbz ( 1787294 )

      Please Chromium browsers, just pause the tab 3 seconds after click away

      Please don't. Some of us actually do things in our browsers other than just troll on reddit. I don't want any of my background tabs that rely on refreshed data, notifications, or my office suite to simply die because someone thinks the pinnacle of computing was DOS and declares multitasking to not be a thing.

      We mocked iOS for only having one active app at a time. We should rightfully mock your suggestion that a browser tab should stop doing what the programmer asked it to simply because it's not active.

      If y

      • by pz ( 113803 ) on Sunday July 05, 2020 @06:06PM (#60265152) Journal

        The counterargument to your suggestion is the observation that there are many, many , many web sites that don't give a whit about how much of your computer's resources they chew up to ensure their animations are continuing to function, their lists are always up-to-date, their uninteresting information will be as shiny as possible to get you to click on it.

        In my experience (yours appears to differ), most web tabs that I'm not actively looking at could stop functioning (and SHOULD stop functioning) altogether and there would be essentially zero difference in user experience save the need to refresh when you want to see an update. Me, *I* want to be in control of when a web site is allowed to have my attention, not the reverse. Maybe you are different. Maybe you have and enjoy incessant popups and notifications. I turn all of those off, with extreme prejudice.

        All of this means that when I want to look at a web page, I might, MAYBE have to trigger a reload. Is that so hard?

        • The counterargument to your suggestion is the observation that there are many, many , many web sites that don't give a whit about how much of your computer's resources they chew up to ensure their animations are continuing to function

          I fully agree. But just like software that runs on my computer those websites are a) rare, and b) should be individually managed. That is to say users should be given the option of doing something with a misbehaving website, but it is absolutely absurd to require a user to selectively opt in on a feature level on a case by case basis.

          Something working should be the default.

          save the need to refresh when you want to see an update.

          The "need to refresh" was one of the biggest barriers to improving functionality of the internet, we addressed this in the late 90s.

          most web tabs that I'm not actively looking at could stop functioning (and SHOULD stop functioning)

          Whet

      • by Anonymous Coward

        Please Chromium browsers, just pause the tab 3 seconds after click away

        Please don't.

        Please do.

        What a bizarre attitude. I don't want the overwhelming majority of sites I look at to have permission to bother me or run in the background. The few that I do I can easily enable notifications or background processing for. My browser already asks permission for notifications by website. Why should the default for everyone be spam/monitoring/energy waste ON just so that you don't have to click OK on a few tabs?

      • Maybe web browsers shouldn't be operating systems or run office suites. They've always done that shit badly, and always will.

        • I had a for hour chat (because I went at it really carefully) with the WhatWG guys, some years back. They simply do not get the problem with the inner-platform effect software design anti-pattern. It's like telling a religious fundamentalist there is no God.
          All they do, is feel personally attacked, and get offended, and then ignore you out of their lives.

          They just re-implement/re-invent ALL the ancient concepts, like e.g. sockets, that we relied on for half a century. Badly.

          They think they are basically sta

    • by majorme ( 515104 )
      Please Chromium browsers, just pause the tab 3 seconds after click away from it unless it's playing audio that I explicitly activated. I don't need twitter updating in the background while I play a game. The only tabs that should be updating in the background: - Music players - GPS-enabled (eg food couriers), or mapping-enabled websites - Tabs that have permission to use the video camera or microphone Tabs that should paused: - All WASM, WebGL, Canvas-based updating - All forums that have not asked or n
  • I observed years ago this was being done, but it was more on the scale of seconds than once per minute. Sounds like they are just cutting them back more.

    You can add this to the dev console of any tab:setInterval(() => console.log(new Date()), 1) and then switch tabs and observe the output slows to once or twice per second, at least in the current dev channel (Chrome 85) but I would expect to see the same thing across the board until 86 goes stable and this change is implemented.

  • Unless a user is actively counting on a background tab like running Pandora or in a virtual queue, how often do you think a user actually needs the background analytics those tabs offer?

    Next step they need to limit when a browser can track the foreground/background state of the browser. Facebook video stopping playback when in background as an example.

    • Background video playback can be important, if the video is only really wanted for the audio. Music playlists on youtube for example. It's possible somebody could have some talking head playing on facebook that they only want to listen to in the background also.

  • Doesn't /. use a JS timer to update the stories if you're not looking at the page? I imagine the same thing is true for the ads displayed on the page.

    OR... Does it mean that web page developers will figure out a way around this restriction?

    • On Slashdot mobile I just pull down the page, ti get new articles.

      But by device is always warning me about Firefox wasting a lot of battery, whenever I had been in Slashdot. Even when I closed the tab, I think. Even when I closed the app in the task switcher, I think. So I always have to force-close Firefox too, before closing its "window"(?) that way.

      Given that the site is owned by BizX, I would't be surprised to find Bitcon miner malware in there. (Especially for ad blocker users.)

  • by Zirnike ( 640152 ) on Sunday July 05, 2020 @03:42PM (#60264778) Journal
    Only a few comments, and people are already talking about preventing this from going on in certain tabs. How about a simpler solution? Give us an option to disable java timers on non-whitelisted web pages? With a similar blacklist these pages option? No need to keep track of all the timers, just shut 'em off.
  • For some time, I've been trying to figure out how to get chrome to STOP throttling the background tabs... I run monitor tasks in tabs, which (in chrome) do not stay updated. If I switch back to see how a sensor has been trending over the last X minutes, I can only see the difference between when I switched away and when chrome let it update, after I switched back.

    • Re: (Score:2, Insightful)

      by znrt ( 2424692 )

      if you absolutely need those updated constantly open them in separate windows, not tabs. it's a bit more clutter and a slightly bigger memory footprint but ... you need them, right?

      this is not for edge cases, but the average crap social media/junk page that wants to keep feeding you crap and logging your activity at all costs. which the user doesn't want more often than not (and isn't even aware of most of the time) so good riddance. i would freeze tabs without window focus for good except if instructed oth

      • this is not for edge cases, but the average crap social media/junk page

        If you don't want it, why would you have it up and logged in?

        Seems to me that the "edge case" is someone who over the edge and cannot figure out whether they want to be tracked so they instantly know when their cat video is liked, vs. being annoyed by constant chatter.

        • by znrt ( 2424692 )

          If you don't want it, why would you have it up and logged in?

          because i just switched attention to another fad / important stuff. i might want to come back to that previous stuff, but that doesn't mean it has to be running while it's waiting. i might actually have a ton of them open and there is no reason for them to waste cpu time, energy and bandwidth generating, displaying or logging information that i'm not going to consume and or use. why? they might as well be mining cryptocurrency. they can update when i poke them again, in most cases i wouldn't tell the differ

  • by Solandri ( 704621 ) on Sunday July 05, 2020 @05:37PM (#60265088)
    I use the extension The Great Suspender [google.com]. I installed it after I noticed Chrome was eating 25% of my CPU even though it was doing nothing but sitting there on a static page. I tracked down the problem to pages on background tabs running scripts (Amazon was a big culprit, as it regularly auto-refreshes the pages you've opened). The extension will suspend any background tabs which you haven't viewed for x minutes (configurable). It changes the tab to a static holder page, and clicking it will reload the original page. It's pretty smart too, so for example won't suspend an audio stream in a background tab.

    I'm using it less now that uBlock Origin lets you block javascript on a site-by-site basis. But The Great Suspender is still good for stopping sites I don't visit as frequently from running stupid scripts in the background.
  • by backslashdot ( 95548 ) on Sunday July 05, 2020 @07:36PM (#60265478)

    Are dinosaurs, always holding thing back. Steve Jobs was right when he told his employees that if they wish to cater to enterprise/corporate customers they should quit Apple.

    • Funny, given that he walked his company right into the insane direction. Not forward, not back, but off to the side of, like a nanny, treating users as retarded, until they damn well are. ... Throwing back the power a user has in front of his computer, by at least 40 years. You know ... a time before scripting (as in: simple programming) was something the average user did because he prided himself in having more of a brain than others. Instead of today, where their pride lies in vanity of following a tech c

  • by Nkwe ( 604125 ) on Sunday July 05, 2020 @09:28PM (#60265794)
    Summary says that background tasks will only wake up once a minute. Can I choose another value - say once very 50 years?
  • I have a train app that runs in the background. I would like timer events about 1 minute apart until it gets to about 3 minutes from the critical time. Once that happens, I would like events to be every 10 seconds. Of course this is all subject to change if at 3 minutes, the train hasn't left a different station down the line in which case the timer profile needs to be rescheduled. I'm ok with user interaction between the reschedules.

    The realtime operating system people came up with solutions to all thi

  • I regularly hit 200 - 300 tabs in a day. And that's not an exaggeration or joke. I have to toss entire sections into OneTab but it only saves a windows worth, you can't just go "save all my work for later". Sometimes it's easier to simply reboot and "crash" chrome and then hit Alt-Shift-T over and over to bring back all the tabs--which becomes kinda crazy when every YouTube video and news article with a video starts playing at the same time.

    • Haver you heard of this newfangled invention called ... bookmarks?

      • by jma05 ( 897351 )

        The point of bookmarks is different.
        They are generally for things one wants to remember for a long time.

        Windows left open are more like workspaces - they represent the state of ongoing work. If I am choosing between 20 items, I would like to leave a tab for each open and go back and forth. Another window, representing another task, will contain 10 articles I will be referencing for a report due in a few days.

        A window close action does not have the same semantics as deleting a bookmark. Creating and deleting

        • That is entirely correct. In addition, creating bookmarks and sets of bookmarks takes additional time and effort, and additional time and effort to find them again, a pointless activity for something that is temporary.

          I generally have a dozen new mini-projects I've started on any given day, and a dozen I've finished, whose tabs/windows can be closed and for which I have no use of a permanent bookmark, or the need to later find and delete it.

          Of course, the problem comes when I've started a dozen, but
    • Have you tried Tabs Outliner [google.com]?

      For those running 100+ tabs it is good tab manager. It shows every window and sub-tab vertically in a tab management window.

      * Clicking the X lets you close the tab (and all of its children)
      * Clicking on the Trash can lets you remove it from history

      Also, if Chrome crashes then Tab Outlinre will show you ALL of the "tab sets" that crashed via the name. Window (crashed Tue Jan 28 2020)

      It is a pretty handy utility.

  • Background tabs should be frozen! Like everyone expected them to be!

    Thank me, I generally close tabs I don't use, unlike other people with their 100+ open tabs, who apparently never heard of bookmarks.

    • Bookmarks don't solve the problem.

      Bookmarks are designed for "one-offs", not saving/loading "tab sets".

      Editing bookmarks is clunky.

      When Chrome crashes how do you re-load a sub-set of the tabs?

      Go play with Tabs Outliner [google.com] because you clearly don't understand the problem.

    • by spitzak ( 4019 )

      I absolutely agree. My SO creates hundreds of tabs, and she certainly expects them to work exactly like bookmarks. The cost of a tab you are not looking at should be ZERO. Not even once a minute. Clicking on a tab you have not looked at in a while will be the same as picking that same location from a bookmark.
      For movie playback the sound stream can continue when you switch away from a tab, but if it stops playback it stops and cannot start it again.

Some people manage by the book, even though they don't know who wrote the book or even what book.

Working...