Closed Bug 600707 Opened 14 years ago Closed 14 years ago

Update back/forward buttons on every location change

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: mbrubeck, Assigned: mbrubeck)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
Steps to reproduce:
1. In a new tab, open www.google.com
2. Type about:blank in the urlbar and press enter
3. Type www.google.com in the urlbar and press enter
4. Press the back button

Expected results: www.google.com is displayed (about:blank is ignored in back/forward history), back button is disabled, forward button is enabled.

Actual results: www.google.com is displayed, back button is enabled but does not work, forward button is disabled.

Alternate steps to reproduce:
1. Open https://bug598391.bugzilla.mozilla.org/attachment.cgi?id=477213
2. Click on "test 1"

Expected results: back button is enabled and goes back to the top
Actual results: back button is disabled
Attachment #479589 - Flags: review?(mark.finkle)
Attached patch patch v2 (obsolete) — Splinter Review
Add some browser-chrome tests.
Attachment #479589 - Attachment is obsolete: true
Attachment #479634 - Flags: review?(mark.finkle)
Attachment #479589 - Flags: review?(mark.finkle)
Comment on attachment 479634 [details] [diff] [review]
patch v2

>diff -r 526a42fca835 chrome/content/browser.js

>+    BrowserUI.updateURI();

Shouldn't we only do this if we are the active (selected) tab?

>     if (location != this.browser.lastLocation) {
 
>       if (this._tab == Browser.selectedTab) {
>-        BrowserUI.updateURI();
>-

The old code might have failed because of the outer location check

>diff -r 526a42fca835 chrome/tests/browser_navigation.js

>+  onPageReady: function() {
>+    ok(back.disabled, "Can't go back");
>+    ok(forward.disabled, "Can't go forward");
>+
>+    Browser.loadURI(testURL_01 + "#fragment");
>+    setTimeout(gCurrentTest.onFragmentLoaded, 0);
>+  },

The setTimeouts in this new test frighten me. I worry the code won't be ~instant~ on devices. Can we use "pageshow"? It should fire when moving through session history

r- for the questions
Attachment #479634 - Flags: review?(mark.finkle) → review-
Attached patch patchSplinter Review
(In reply to comment #2)
> >+    BrowserUI.updateURI();
> 
> Shouldn't we only do this if we are the active (selected) tab?

Oh, of course.  Fixed.

> The setTimeouts in this new test frighten me. I worry the code won't be
> ~instant~ on devices. Can we use "pageshow"?

"pageshow" doesn't fire for navigation within the same page.  I tried adding a "hashchange" listener and message, but it fired too soon, before the chrome onLocationChange observer was notified.  Instead I just changed this to listen for WebProgress:LocationChange.
Attachment #479634 - Attachment is obsolete: true
Attachment #479793 - Flags: review?(mark.finkle)
Comment on attachment 479793 [details] [diff] [review]
patch


>diff -r 4c4a20e44f33 chrome/tests/browser_preferences_basic.js

>   onPrefsView: function() {

>+    info("Prefs list size is " + w + ", " + h);

>+    let event = document.createEvent("Events");
>+    event.initEvent("CancelTouchSequence", true, true);
>+    window.dispatchEvent(event);
>+

Different bug fix? or should these be here?

r+ but remove the extra code if it is not needed.
Attachment #479793 - Flags: review?(mark.finkle) → review+
(In reply to comment #4)
> Different bug fix? or should these be here?

Accidentally included from work on a different bug.  Removed.

Pushed: http://hg.mozilla.org/mobile-browser/rev/79c093eb1efd
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Flags: in-testsuite+
Verified : 
Mozilla/5.0 (Maemo;Linux armv71; rv:2.0b7pre)Gecko/20101001 Firefox/4.0b7pre Fennec/4.0b2pre
Mozilla/5.0 (Android; Linux armv71; rv2.0b7pre) Gecko/20101001 Firefox/4.0b7pre Fennec/4.0b2pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: