Closed
Bug 1045648
Opened 10 years ago
Closed 10 years ago
Sometimes header is not removed from results page
Categories
(Firefox for Android Graveyard :: Search Activity, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 34
People
(Reporter: Margaret, Assigned: eedens)
References
Details
Attachments
(1 file, 2 obsolete files)
3.53 KB,
patch
|
Margaret
:
review+
|
Details | Diff | Splinter Review |
I think we discussed this before, but I couldn't find a bug.
I believe this happens if you submit the same query twice in a row, so the WebView refreshes itself in a way that doesn't trigger our terror script.
Reporter | ||
Updated•10 years ago
|
Blocks: fennec-search-activity
Assignee | ||
Comment 1•10 years ago
|
||
We inject the script using WebChromeClient's onReceivedTitle hook, which is invoked only when the title *changes*. When the same query is submitted for a second time, the title of the page probably is not going to change, and hence we aren't going to inject the script.
As a first fix, I'll write a patch that ensures the same URL doesn't get loaded into a webview that already has that URL.
Assignee: nobody → eric.edens
Assignee | ||
Comment 2•10 years ago
|
||
This makes sure that we don't re-load a URL if the webview is already loaded to that page.
Attachment #8464086 -
Flags: review?(margaret.leibovic)
Reporter | ||
Comment 3•10 years ago
|
||
Comment on attachment 8464086 [details] [diff] [review]
bug-1045648-fix.patch
Review of attachment 8464086 [details] [diff] [review]:
-----------------------------------------------------------------
Sounds like a reasonable approach, since it also prevents us from doing unnecessary work in general. f+ for now, since you'll need to upload another patch for me to land anyway :)
::: mobile/android/search/java/org/mozilla/search/MainActivity.java
@@ +60,5 @@
> startPostsearch();
> storeQuery(query);
>
> ((PostSearchFragment) getSupportFragmentManager().findFragmentById(R.id.postsearch))
> + .startSearch(query);
Looks like some extraneous changes ended up in here. That reminds me - you should finish up your patch for bug 1042943!
::: mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
@@ +75,5 @@
> public void setUrl(String url) {
> + // Load the url if:
> + // a. The webview hasn't loaded a URL yet, or
> + // b. The webview is loaded to a *different* URL.
> + if (webview.getUrl() == null || !webview.getUrl().equals(url)) {
You could replace this line with:
if (!TextUtils.equals(webview.getUrl(), url)) {
TextUtils will take care of the null checking for you.
Attachment #8464086 -
Flags: review?(margaret.leibovic) → feedback+
Assignee | ||
Comment 4•10 years ago
|
||
(In reply to :Margaret Leibovic from comment #3)
> Comment on attachment 8464086 [details] [diff] [review]
> bug-1045648-fix.patch
>
> Review of attachment 8464086 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Sounds like a reasonable approach, since it also prevents us from doing
> unnecessary work in general. f+ for now, since you'll need to upload another
> patch for me to land anyway :)
>
> ::: mobile/android/search/java/org/mozilla/search/MainActivity.java
> @@ +60,5 @@
> > startPostsearch();
> > storeQuery(query);
> >
> > ((PostSearchFragment) getSupportFragmentManager().findFragmentById(R.id.postsearch))
> > + .startSearch(query);
>
> Looks like some extraneous changes ended up in here. That reminds me - you
> should finish up your patch for bug 1042943!
Actually this was an intentional change -- it was something that I've wanted to do while I was in the area :)
RE bug 1042943: I put that aside for the moment in favor of the P1 nightly-blocking bugs.
> ::: mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
> @@ +75,5 @@
> > public void setUrl(String url) {
> > + // Load the url if:
> > + // a. The webview hasn't loaded a URL yet, or
> > + // b. The webview is loaded to a *different* URL.
> > + if (webview.getUrl() == null || !webview.getUrl().equals(url)) {
>
> You could replace this line with:
>
> if (!TextUtils.equals(webview.getUrl(), url)) {
>
> TextUtils will take care of the null checking for you.
Sounds good!
Assignee | ||
Comment 5•10 years ago
|
||
Switched to use TextUtils.equals
Attachment #8464217 -
Flags: review?(margaret.leibovic)
Reporter | ||
Comment 6•10 years ago
|
||
(In reply to Eric Edens [:eedens] from comment #4)
> (In reply to :Margaret Leibovic from comment #3)
> > Comment on attachment 8464086 [details] [diff] [review]
> > bug-1045648-fix.patch
> >
> > Review of attachment 8464086 [details] [diff] [review]:
> > -----------------------------------------------------------------
> >
> > Sounds like a reasonable approach, since it also prevents us from doing
> > unnecessary work in general. f+ for now, since you'll need to upload another
> > patch for me to land anyway :)
> >
> > ::: mobile/android/search/java/org/mozilla/search/MainActivity.java
> > @@ +60,5 @@
> > > startPostsearch();
> > > storeQuery(query);
> > >
> > > ((PostSearchFragment) getSupportFragmentManager().findFragmentById(R.id.postsearch))
> > > + .startSearch(query);
> >
> > Looks like some extraneous changes ended up in here. That reminds me - you
> > should finish up your patch for bug 1042943!
>
> Actually this was an intentional change -- it was something that I've wanted
> to do while I was in the area :)
Oh, I didn't realize that the startSearch method was already implemented. Yeah, we should definitely do that!
Reporter | ||
Comment 7•10 years ago
|
||
Comment on attachment 8464217 [details] [diff] [review]
bug-1045648-fix.v2.patch
Review of attachment 8464217 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
@@ +75,5 @@
>
> public void setUrl(String url) {
> + // Only load URLs if they're different than what's already
> + // loaded in the webview.
> + if (TextUtils.equals(webview.getUrl(), url)) {
This is the opposite of what you want :) Can you upload a new patch with a !
Attachment #8464217 -
Flags: review?(margaret.leibovic) → review+
Reporter | ||
Updated•10 years ago
|
Attachment #8464086 -
Attachment is obsolete: true
Reporter | ||
Comment 8•10 years ago
|
||
(In reply to :Margaret Leibovic from comment #6)
> (In reply to Eric Edens [:eedens] from comment #4)
> > (In reply to :Margaret Leibovic from comment #3)
> > > Comment on attachment 8464086 [details] [diff] [review]
> > > bug-1045648-fix.patch
> > >
> > > Review of attachment 8464086 [details] [diff] [review]:
> > > -----------------------------------------------------------------
> > >
> > > Sounds like a reasonable approach, since it also prevents us from doing
> > > unnecessary work in general. f+ for now, since you'll need to upload another
> > > patch for me to land anyway :)
> > >
> > > ::: mobile/android/search/java/org/mozilla/search/MainActivity.java
> > > @@ +60,5 @@
> > > > startPostsearch();
> > > > storeQuery(query);
> > > >
> > > > ((PostSearchFragment) getSupportFragmentManager().findFragmentById(R.id.postsearch))
> > > > + .startSearch(query);
> > >
> > > Looks like some extraneous changes ended up in here. That reminds me - you
> > > should finish up your patch for bug 1042943!
> >
> > Actually this was an intentional change -- it was something that I've wanted
> > to do while I was in the area :)
>
> Oh, I didn't realize that the startSearch method was already implemented.
> Yeah, we should definitely do that!
Actually, while you're updating the patch, could you also get rid of the setUrl method? You could also make it private, but startSearch could also just call webview.loadUrl directly.
Assignee | ||
Comment 9•10 years ago
|
||
(In reply to :Margaret Leibovic from comment #7)
> Comment on attachment 8464217 [details] [diff] [review]
> bug-1045648-fix.v2.patch
>
> Review of attachment 8464217 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
> @@ +75,5 @@
> >
> > public void setUrl(String url) {
> > + // Only load URLs if they're different than what's already
> > + // loaded in the webview.
> > + if (TextUtils.equals(webview.getUrl(), url)) {
>
> This is the opposite of what you want :) Can you upload a new patch with a !
Holy batman, good catch!
Assignee | ||
Comment 10•10 years ago
|
||
- Fixed the logic error around checking URL equality
- Pulled back the visibility of setUrl to private.
Attachment #8464217 -
Attachment is obsolete: true
Attachment #8464226 -
Flags: review?(margaret.leibovic)
Reporter | ||
Updated•10 years ago
|
Attachment #8464226 -
Flags: review?(margaret.leibovic) → review+
Reporter | ||
Comment 11•10 years ago
|
||
Assignee | ||
Comment 12•10 years ago
|
||
Comment 13•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
Updated•7 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•