Closed Bug 1225339 Opened 4 years ago Closed 4 years ago

Browser history is not preserved after an OTA.

Categories

(Firefox OS Graveyard :: Gaia::Browser, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(blocking-b2g:2.5+, b2g-v2.5 affected, b2g-master verified)

VERIFIED FIXED
2.6 S2 - 12/4
blocking-b2g 2.5+
Tracking Status
b2g-v2.5 --- affected
b2g-master --- verified

People

(Reporter: Marty, Assigned: daleharvey)

References

Details

(Keywords: regression, Whiteboard: [2.6-Daily-Testing][Spark][systemsfe][dogfood-blocker])

Attachments

(5 files)

Attached file logcat_OTA.txt
Description:
After running an OTA, the browser will not have preserved previous browsing history in either the Browser app landing page, nor in search results. The default Mozilla pages are not present on the browser landing page either.

This issue does not seem to affect Log-In cookies. Gmail remained signed in with the browser, and the Facebook app remained signed in.

This issue DOES occur when updating from build 20151023104059
This does NOT occur when updating from build 20151028104739

Repro Steps:
1) Update a Aries to 20151007142909
2) Open the browser and navigate to several pages. Ensure that browsing history is present on the Browser landing page.
3) Connect to a WiFi network and change the update channel to dogfood-latest
4) Run the OTA to build 20151113121953
5) Open the Browser app to view the landing page

Actual:
Browser history is lost and the landing page is blank.

Expected:
Browser history persists after an OTA

Environmental Variables:
Device: Aries 2.6
Build ID: 20151113121953
Gaia: e8c15ae4e5324a210000ee0a869a962aa542009f
Gecko: faf815a0fa9b052a38bce00c0c2aa1e2c9610936
Gonk: 2916e2368074b5383c80bf5a0fba3fc83ba310bd
Version: 45.0a1 (2.6)
Firmware Version: D5803_23.1.A.1.28_NCB.ftf
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0

Repro frequency: 6/6
See attached: screenshot, logcat
Attached image Browser-Before-OTA.png
Attached image Browser-After-OTA.png
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(jmercado)
[Blocking Requested - why for this release]:

User loses data during OTA, including the default browser top sites to the mozilla information pages.

Let's see if this also occurs on a 2.2 to 2.5 upgrade for bug 1224750.
blocking-b2g: --- → 2.5?
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmercado) → needinfo?(ashiue)
Keywords: qawanted
Hi Gregor,

Could you please dispatch this issue to suitable person to help check? Thank you.
Flags: needinfo?(ashiue) → needinfo?(anygregor)
Whiteboard: [2.6-Daily-Testing][Spark] → [2.6-Daily-Testing][Spark][systemsfe]
blocking-b2g: 2.5? → 2.5+
Flags: needinfo?(anygregor)
Flags: needinfo?(bfrancis)
Whiteboard: [2.6-Daily-Testing][Spark][systemsfe] → [2.6-Daily-Testing][Spark][systemsfe][dogfood-blocker]
Duplicate of this bug: 1225533
Priority: -- → P1
QA Contact: sleedavid
This issue does occur when updating from 2.2 to 2.5 as well.

Actual Results: Browser history is not retained and even default sites are lost.

Originating build:
Environmental Variables:
Device: Flame 2.2
BuildID: 20151108032507
Gaia: 885647d92208fb67574ced44004ab2f29d23cb45
Gecko: e6ea91190b53
Gonk: bd9cb3af2a0354577a6903917bc826489050b40d
Version: 37.0 (2.2) 
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:37.0) Gecko/37.0 Firefox/37.0

Updated build:
Environmental Variables:
Device: Flame 2.5
BuildID: 20151109004552
Gaia: cf646c52bb947af28329b0a100df91d1b1f2a907
Gecko: 4eafef5b80f8985c94c4a067f130d37513e1a581
Gonk: 040bb1e9ac8a5b6dd756fdd696aa37a8868b5c67
Version: 44.0a2 (2.5) 
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:44.0) Gecko/44.0 Firefox/44.0
Blocks: 1224750
QA Whiteboard: [QAnalyst-Triage+] → [QAnalyst-Triage?]
Flags: needinfo?(ktucker)
Keywords: qawanted
QA Contact: sleedavid
My initial investigations suggest this has nothing to do with OTA updates, the search app is just failing to access the Places IndexedDB database.

  E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]

If this isn't related to updates then it should be easier to get a regression window. I will continue to investigate but if QA could help with a regression window that would be great!
Flags: needinfo?(bfrancis)
Some more errors, IndexedDB is unhappy.

E/GeckoConsole( 1942): [JavaScript Error: "IndexedDB UnknownErr: ActorsParent.cpp:13067"]
E/Browser ( 2663): [JavaScript Error: "AbortError" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 24}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/GeckoConsole( 1942): [JavaScript Error: "uncaught exception: [object DOMError]"]
E/Built-in Keyboard( 2242): Content JS ERROR: TypeError: this.app.inputContext is null 
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/Browser ( 2663): [JavaScript Error: "TypeError: this.db is null" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 150}]
E/GeckoConsole( 1942): [JavaScript Error: "ConstraintError" {file: "jar:file:///system/b2g/omni.ja!/components/DataStoreImpl.js" line: 233}]
E/Default Home Screen( 2077): [JavaScript Error: "TypeError: this.highlighterEnv is null" {file: "resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/highlighters/utils/markup.js" line: 209}]
E/Browser ( 2663): [JavaScript Error: "ConstraintError: A mutation operation in the transaction failed because a constraint was not satisfied. For example, an object such as an object store or index already exists and a new one was being attempted to be created." {file: "app://search.gaiamobile.org/js/places_idb.js" line: 46}]
E/GeckoConsole( 1942): [JavaScript Error: "IndexedDB UnknownErr: ActorsParent.cpp:13067"]
E/Browser ( 2663): [JavaScript Error: "AbortError" {file: "app://search.gaiamobile.org/js/places_idb.js" line: 24}]
E/GeckoConsole( 1942): [JavaScript Error: "ConstraintError" {file: "jar:file:///system/b2g/omni.ja!/components/DataStoreImpl.js" line: 233}]
E/GeckoConsole( 1942): [JavaScript Error: "uncaught exception: [object DOMError]"]
E/GeckoConsole( 1942): [JavaScript Error: "uncaught exception: [object DOMError]"]
How are you getting those indexdb errors? Could you give an STR? How can you be sure that this is related to comment 0 bug?
Flags: needinfo?(bfrancis)
STR:
* Upgraded Gaia to the latest master with "make install-gaia"
* Typed "adb logcat | grep Error" to find errors in the console output
* Opened a browser window on the device so that the search app is loaded
* Observed those errors in the console
* Observed that no top sites or history are displayed on the device

The reason I think this is related is because the Places database is where all the browser history and top sites are stored. If the search app (which displays the browser start page) can't access the Places database then I would expect exactly these symptoms.

I haven't yet been able to figure out what is causing this to fail, but gerard-majax suggested it could be that a particular piece of data stored in the database is causing the problem. If this bug is not always reproduceable after a fresh flash then that could explain why.
Flags: needinfo?(bfrancis)
I'm not seeing comment 10 issue on today's Aries build. My logcat doesn't say those errors and it shows top sites correctly.

Are you on an older Gecko?

I'm on this build:
Device: Aries
BuildID: 20151118151339
Gaia: cba7e4b86361af31b153cfebaf99900e0b860f7b
Gecko: 1d6155d7e6c91fa5ec1ef6927f3d3a044187896d
Gonk: a19052e4389c3ae2d8fc3e7a74a475401baacc56
Version: 45.0a1 (2.6 Master) 
Firmware Version: D5803_23.1.A.1.28_NCB.ftf
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0
Flags: needinfo?(bfrancis)
Yes the Gecko I was using is old, I can try a newer build tomorrow.
Flags: needinfo?(bfrancis)
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(ktucker)
If it's not reproducing again tomorrow with newer gecko could you remove regression window wanted and qawanted from this bug
Flags: needinfo?(bfrancis)
I can confirm that a fresh flash of a new build does not reproduce the problem. It seems to be using a database created by an old build with a newer build that causes the problem. Investigating further, help welcome.
Flags: needinfo?(bfrancis)
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(jmercado)
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmercado)
That is making my dogfooding life miserable ... I'll look into that.
Assignee: nobody → dale
From the code + log and what Alexandre said on IRC, it looks like the code @ http://mxr.mozilla.org/gaia/source/apps/search/js/places_idb.js#45 is broken, it will run on all migrations, from 0-1, 1-2, 2-3 and the |db.createObjectStore(VISITS_STORE| line will throw if it already exists with a ContraintError

Will verify thats whats wrong now
Whats the easiest way for me to install build 20151023104059 on an aries (ie is there a link to a build somewhere?) Cheers
Flags: needinfo?(nhirata.bugzilla)
That is this build https://tools.taskcluster.net/task-inspector/#F-hLXBKfRdORNTCoM_RHIw/
Flags: needinfo?(nhirata.bugzilla) → needinfo?(dale)
I am having problems testing this, will try again, but this seems like what the problem should be. If anyone can verify it that would be awesome.
Flags: needinfo?(dale)
Attachment #8692443 - Flags: feedback?(lissyx+mozillians)
Comment on attachment 8692443 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/33382

with the e.target fix
Attachment #8692443 - Flags: feedback?(lissyx+mozillians) → feedback+
Comment on attachment 8692440 [details] [review]
[gaia] daleharvey:1225339 > mozilla-b2g:master

The problem was |var visits = db.createObjectStore(VISITS_STORE, { keyPath: 'date' });| was running on consecutive upgrades, if its called when the store already exists it will fail with ConstraintError.

We dont have any test infrastructure for testing OTA's in this manner so I couldnt add tests (it would take months to write that). Alexandre verified the fix for me.
Attachment #8692440 - Flags: review?(bfrancis)
Comment on attachment 8692440 [details] [review]
[gaia] daleharvey:1225339 > mozilla-b2g:master

Thanks Dale, you rock.
Attachment #8692440 - Flags: review?(bfrancis) → review+
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Duplicate of this bug: 1228132
This issue is verified fixed on the latest Aries Dogfood and Flame Nightly 2.6 builds.
Browser History is properly maintained after performing an OTA from an older build.

Environmental Variables:
Device: Aries 2.6
BuildID: 20151130134106
Gaia: 702773bee0b70e479ccebe5e061f571e977bc376
Gecko: a18630f9ab42ddfde03ba8c7757a42069c48c7ed
Gonk: a19052e4389c3ae2d8fc3e7a74a475401baacc56
Version: 45.0a1 (2.6) 
Firmware Version: D5803_23.1.A.1.28_NCB.ftf
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0

Environmental Variables:
Device: Flame 2.6
BuildID: 20151130030223
Gaia: ee6d8625c9d76de2f6614c87bb82b301bc37c7a9
Gecko: 47b49b0d32360fab04b11ff9120970979c426911
Gonk: 205ac4204bbbb2098a8046444acba551ba5dc75a
Version: 45.0a1 (2.6) 
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0
Status: RESOLVED → VERIFIED
QA Whiteboard: [QAnalyst-Triage+] → [QAnalyst-Triage?]
Flags: needinfo?(jmercado)
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmercado)
Target Milestone: --- → 2.6 S2 - 12/4
You need to log in before you can comment on or make changes to this bug.