Loading page from address bar fails

Android-specific support, bug reports and feature requests.
Post Reply
bonanza
Posts: 17
Joined: Tue Feb 05, 2013 9:39 pm

Loading page from address bar fails

Post by bonanza »

In the current version "3.5a4rc201306082147" I have the following problem:
When I want to visit a new website by typing it into the address bar, always the first try fails and i have to enter it a second time before the website loads. But if I'm on a specific site for example xyz.com and want to go to a new link of the same domain, it works for the first try.

My settings in NSA are "Blacklist" with ABE, Clickprotection and XSS on. The problem seems to be independent of the settings for the source and destination website. Furthermore, it occurs also when opening websites from booksmarks.

thanks
Mozilla/5.0 (X11; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0
Hans
Posts: 3
Joined: Thu Dec 13, 2012 2:34 pm

Re: Loading page from address bar fails

Post by Hans »

I can confirm this bug!

It works up to Firefox 23.
But not with Firefox 24 (beta), 25 (aurora) and 26 (nightly).

I have to enter the address twice, sometimes three times and sometimes it never works.

No other addons are installed.

Regards,
Hans
Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
ssjkakaroto
Posts: 19
Joined: Thu Mar 29, 2012 11:51 pm

Re: Loading page from address bar fails

Post by ssjkakaroto »

I've noticed this problem too, but is NoScript the culprit?
I thought the problem was with Firefox, but I haven't tested with a clean profile without NoScript.
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
Hans
Posts: 3
Joined: Thu Dec 13, 2012 2:34 pm

Re: Loading page from address bar fails

Post by Hans »

ssjkakaroto wrote:I've noticed this problem too, but is NoScript the culprit?
I thought the problem was with Firefox, but I haven't tested with a clean profile without NoScript.
If I disable NoScript (about:addons) or clean profile, page load is working (Firefox 23, 24, 25, 26).
Thus NoScript is involved into this problem.

No other addons installed.

Regards,
Hans
Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Loading page from address bar fails

Post by Giorgio Maone »

Investigating, thanks.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0
Lekensteyn
Junior Member
Posts: 31
Joined: Thu May 19, 2011 12:01 pm

Re: Loading page from address bar fails

Post by Lekensteyn »

I can confirm this behavior, it is not limited to typing an address from location bar, but also when selecting an old entry (in the list below the address bar) and sometimes when opening a link on a page (external website). Below is a logcat from Firefox 24. I think the problem first appeared in Firefox 23.

Code: Select all

D/GeckoSessInfo(17020): Recording start of session: 1378312804019
I/GeckoToolbar(17020): zerdatime 77460716 - Throbber start
E/GeckoConsole(17020): [NSA] First request http://lkml.org/checked in 199 (including lazy init) at 1378312804326
I/Gecko   (17020): [NSA] First request http://lkml.org/checked in 199 (including lazy init) at 1378312804326
I/GeckoToolbar(17020): zerdatime 77461028 - Throbber stop
E/GeckoConsole(17020): [ABE WAN] Trying to detect WAN IP...
E/GeckoConsole(17020): [ABE WAN] Detected WAN IP (redacted)
...
E/GeckoConsole(17020): [NSA] false
I/Gecko   (17020): [NSA] false
E/GeckoConsole(17020): [JavaScript Error: "last is null" {file: "resource://noscript_3_5a4rc201306082147/modules/Load.jsm" line: 89}]
Steps to (reliably) reproduce:
  1. Close Firefox completely and start it.
  2. Open the Awesome bar (location bar) and enter http://lkml.org
  3. Observe the "First request" message. The "ABE WAN" messages are the last that appear from this attempt. Observe that the requested page does not get loaded.
  4. Try again, observe the "last is null" error and that the page loads successfully.
Reproduced on two phones, when disabling/uninstalling NoScript, the issue is gone.
Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
Lekensteyn
Junior Member
Posts: 31
Joined: Thu May 19, 2011 12:01 pm

Re: Loading page from address bar fails

Post by Lekensteyn »

So, this seems to be related to ABE. Disabling ABE allows page to load normally.

With some debugging code added/enabled, I can observe that Firefox 24 (23 works fine) stops processing requests after:

Code: Select all

E/GeckoConsole( 6418): [ABE] DNS notification for http://lkml.org/
E/GeckoConsole( 6418): [ABE] lkml.org not cached in DNS, deferring ABE checks after DNS resolution for request 4
I/GeckoToolbar( 6418): zerdatime 180223656 - Throbber start
E/GeckoConsole( 6418): [NSA] [ABE thingey] dnsRecord = {"ts":1378746064687,"entries":["87.253.128.182"],"expireTime":1378746124687}
I/Gecko   ( 6418): [NSA] [ABE thingey] dnsRecord = {"ts":1378746064687,"entries":["87.253.128.182"],"expireTime":1378746124687}
I/GeckoToolbar( 6418): zerdatime 180223809 - Throbber stop
It has something to do with the `replacement.open` code, with the replace function being located at modules/ChannelReplacement.jsm. What happens there is beyond my understanding, Giorgio, can you comment on this?
Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Loading page from address bar fails

Post by Giorgio Maone »

Lekensteyn wrote: It has something to do with the `replacement.open` code, with the replace function being located at modules/ChannelReplacement.jsm. What happens there is beyond my understanding, Giorgio, can you comment on this?
Thank you very much for your analysis.
Yes, the channel replacement machinery is likely the most fragile part of ABE, but necessary because of the lack of an equivalent Gecko built-in API.
I'm gonna check whether the recent changes introduced to support HTTPS Everywhere may help ABE as well.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0
jlmcgraw
Posts: 1
Joined: Mon Oct 07, 2013 6:52 pm

Re: Loading page from address bar fails

Post by jlmcgraw »

Has there been any progress on this front?
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0
drinkypoo
Posts: 1
Joined: Sat Nov 09, 2013 3:18 pm

Re: Loading page from address bar fails

Post by drinkypoo »

I can confirm that this bug has persisted through multiple versions. Definitely happened for me on 21 through whatever the beta is now, at least.

Is there any improvement? It's actually impossible to follow some kinds of link (from applications) with NSA enabled.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0
lecris
Posts: 1
Joined: Fri Mar 28, 2014 8:25 am

Re: Loading page from address bar fails

Post by lecris »

Well it has been about half an year since this bug was posted, so are there any news on the development?
Are there any challenges that you encounter here that you could share with us?
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
hempeter
Posts: 8
Joined: Fri May 23, 2014 12:03 am

Re: Loading page from address bar fails

Post by hempeter »

Hi, first time poster.

I love noscript, but this NSA bug makes firefox unusable on Android.

Looking at the debug console:
--
[23:39:24.645] last is null @ resource://noscript_3_5a4rc201306082147 ... oad.jsm:89
--

Looking at the code:

Code: Select all

Load.attach = function(channel) {
  let last = lastLoad;
  if (last && (channel instanceof Ci.nsIChannel) &&
      last.location == channel.URI &&
      channel instanceof Ci.nsIWritablePropertyBag2) {
    channel.setPropertyAsInterface(PROP_KEY, last);
    GC.add(channel);
    lastLoad = null;
    return last;
  }
  debug("Could not attach load info to " + channel.name + "\n" +
        (last.location === channel.URI) + ", " + (last.location && last.location.spec) + "\n" +
        channel instanceof Ci.nsIWritablePropertyBag2
    );
  return null;
}
There's a test for last in the if statement above, but no test for null before it's being used in the debug print.
I suspect it might be a case of adding a simple 'if (last != null) { debug(...) }'

Any chance of a test?

Cheers, Pete
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140429 Firefox/24.0 Iceweasel/24.5.0
hempeter
Posts: 8
Joined: Fri May 23, 2014 12:03 am

Re: Loading page from address bar fails

Post by hempeter »

I got the latest xpi using:
wget http://noscript.net/nsa/latest

renamed latest (xpi file) to latest.zip, unzipped it, made the modification to 3.5a4rc201306082147/modules/Load.jsm

Code: Select all

  if (last) { debug("Could not attach load info to " + channel.name + "\n" +
        (last.location === channel.URI) + ", " + (last.location && last.location.spec) + "\n" +
        channel instanceof Ci.nsIWritablePropertyBag2
    );
  }
rezipped it, renamed it to nsa_test.xpi
adb push nsa_test.xpi /sdcard/

loaded firefox, uninstalled the NSA plugin, then in the address bar wrote:
file:///sdcard/nsa_test.xpi

It asked if I wanted to install the addon, clicked Allow.

No problems with having to retype things in the address bar. However, looking at the debug it looks like other things have broken.
Spent a while trying to debug it, will work on it more soon.


Cheers, Pete
Last edited by hempeter on Mon May 26, 2014 11:15 am, edited 1 time in total.
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140429 Firefox/24.0 Iceweasel/24.5.0
hempeter
Posts: 8
Joined: Fri May 23, 2014 12:03 am

Re: Loading page from address bar fails

Post by hempeter »

finally got it!
took quite a bit of time comparing the desktop noscript git tree to spot what was going wrong..
I took the rather more elegant change from lekensteyn's development branch for Load.jsm and submitted a pull request on github, so hopefully an official new version can be released, but for those who what to know:

Code: Select all

diff --git a/src/noscript-nsa/modules/ChannelReplacement.jsm b/src/noscript-nsa/modules/ChannelReplacement.jsm
index a16b8c3..dcb2107 100644
--- a/src/noscript-nsa/modules/ChannelReplacement.jsm
+++ b/src/noscript-nsa/modules/ChannelReplacement.jsm
@@ -291,7 +291,7 @@ ChannelReplacement.prototype = {
       overlap;
 
     if (!(this.window &&
-          (overlap = ChannelReplacement.getLoadingChannel(this.window)) !== oldChan)) {
+          (overlap = ChannelReplacement.getLoadingChannel(this.window)) && overlap !== oldChan)) {
       try {
         oldChan.loadGroup = this.loadGroup;
     
diff --git a/src/noscript-nsa/modules/Load.jsm b/src/noscript-nsa/modules/Load.jsm
index d9bfe3c..cdaf07b 100644
--- a/src/noscript-nsa/modules/Load.jsm
+++ b/src/noscript-nsa/modules/Load.jsm
@@ -86,7 +86,8 @@ Load.attach = function(channel) {
     return last;
   }
   debug("Could not attach load info to " + channel.name + "\n" +
-        (last.location === channel.URI) + ", " + (last.location && last.location.spec) + "\n" +
+        (!last ? "(last is null)" :
+        (last.location === channel.URI) + ", " + (last.location && last.location.spec)) + "\n" +
         channel instanceof Ci.nsIWritablePropertyBag2
     );
   return null;
Hurray, NoScript Anywhere works again :D

All the best

Pete
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140429 Firefox/24.0 Iceweasel/24.5.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Loading page from address bar fails

Post by Giorgio Maone »

hempeter wrote: Hurray, NoScript Anywhere works again :D
Hey, thank you very much!
I didn't have enough time to maintain it lately, and there's a lot of stuff to be backported yet, but I'm gonna publish your changes ASAP :)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Post Reply