Closed Bug 729951 Opened 8 years ago Closed 7 years ago

WebAPI does not refresh as offline when device switches from online to offline

Categories

(Firefox for Android :: General, defect)

13 Branch
ARM
Android
defect
Not set

Tracking

()

VERIFIED FIXED
Firefox 15
Tracking Status
firefox14 --- verified
firefox15 --- verified
blocking-fennec1.0 --- +

People

(Reporter: nhirata, Assigned: mayhemer)

References

()

Details

(Whiteboard: mwc-demo)

Attachments

(1 file)

1. go to http://paulrouget.com/mwc-demos/apis/
2. turn flight mode on on the device

Expected: eventually the online goes offline
Actual: it stays online until you reload

Note:
1. Issue is only on Maple build; Maple 2/23/2012, Samsung Galaxy SII, Galaxy Nexus, HTC Desire HD
2. Nightly 2/23/2012 refreshes the status correctly for all 3 devices
Maybe a check-in didn't make it to Maple. Check-again whenever Maple merges with M-C.
We've been merging M-C to maple regularly. This might be a problem with invalidation (e.g. dupe of bug 728983)
Depends on: 728983
This still happens on a current nightly.
still occurs on 4/9/2012 nightly even with orientation switch
http://paulrouget.com/mwc-demos/apis/

Samsung Galaxy S II
blocking-fennec1.0: --- → ?
blocking-fennec1.0: ? → +
Can we get some testing on whether the event is not firing or the page is just not rendering the change.
I placed on airplane mode and refreshed the page after changing the script a little to do a console.log to output the online/offline status in the if portion and placed the file locally.  neither online/offline status fired. 

Original Script from web page: 

 <div id="connection" class="wrapper">
    <span></span>

  </div>

  <style>
    #connection {
      height: 90px;
      background-image: url(img/blackbg.png);
      text-align: center;
    }
    #connection span {
      height: 60px;
      display: inline-block;
      font-size: 24px; padding-left: 70px;
      background-repeat: no-repeat;
      vertical-align: middle;
      line-height: 60px;
      background-image: url(img/online.png), url(img/offline.png);
    }
    #connection span.online  {background-size: 60px 60px, 0 0}
    #connection span.offline {background-size: 0 0, 60px 60px}
  </style>

  <script>
    function updateOnlineStatus(online) {
      if (online) {
        $("#connection span").className = "online";
        $("#connection span").textContent = "Online";
        $("#mapbutton").style.visibility = "visible";
        } else {
        $("#connection span").className = "offline";
        $("#connection span").textContent = "Offline";
        $("#mapbutton").style.visibility = "hidden";
      }
    }
    document.body.addEventListener("offline", function () { updateOnlineStatus(false) }, false);
    document.body.addEventListener("online", function () { updateOnlineStatus(true) }, false);
    updateOnlineStatus(navigator.onLine);
  </script>
I assume we want qa to find the regression window.
Keywords: qawanted
With hg log + grepping for "offline" + a bit of luck, I came across bug 720320, which looked suspicious. I backed it out, and sure enough, it fixes offline/online events.

Interestingly, bug 720320 landed a few weeks *after* this one was reported. Perhaps this was first caused by invalidation (bug 728983) as kats suggested, then followed by a change that actually broke the functionality (bug 720320).
Summary: MAPLE: WebAPI does not refresh as offline when device switches from online to offline → WebAPI does not refresh as offline when device switches from online to offline
Whiteboard: MAPLE mwc-demo → mwc-demo
Isn't there an automated test for these events?  It's easy to switch to offline mode from a privileged script.

-> me
Assignee: nobody → honzab.moz
Hi Honza, any ideas how to move this release blocker forward?
(In reply to JP Rosevear [:jpr] from comment #10)
> Hi Honza, any ideas how to move this release blocker forward?

I'll take a look by tomorrow.
Can this be reproduced also on a desktop build?
We fail to get "network.manage-offline-status" pref and thus we never call SetManageOfflineStatus(true).
The pref is defined only for Firefox app:
http://mxr.mozilla.org/mozilla-central/search?string=manage-offline-status

So, we can either default the value of mManageOfflineStatus to true (I'm not a big fan of that) or just add the pref to the mobile specific preferences and make it "true".
Status: NEW → ASSIGNED
Attached patch v1Splinter Review
Attachment #622853 - Flags: review?(mark.finkle)
Comment on attachment 622853 [details] [diff] [review]
v1

Thanks
Attachment #622853 - Flags: review?(mark.finkle) → review+
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15
Comment on attachment 622853 [details] [diff] [review]
v1

[Approval Request Comment]
Regression caused by (bug #): bug 720320
User impact if declined: broken webapi
Testing completed (on m-c, etc.): 
Risk to taking this patch (and alternatives if risky): pref only change. reverts to previous behavior
String changes made by this patch: none
Attachment #622853 - Flags: approval-mozilla-aurora?
Comment on attachment 622853 [details] [diff] [review]
v1

[Triage Comment]
QA has now signed off on our first beta of FN. Approving for Aurora 14.
Attachment #622853 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Verified fixed using 2012-05-17 Nightly, Aurora and 14 Beta 2
Status: RESOLVED → VERIFIED
Depends on: 726015
Depends on: 1132693
You need to log in before you can comment on or make changes to this bug.