Page 1 of 1

Loading page from address bar fails

Posted: Sun Aug 18, 2013 8:13 am
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

Re: Loading page from address bar fails

Posted: Tue Aug 20, 2013 4:33 pm
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

Re: Loading page from address bar fails

Posted: Tue Aug 20, 2013 9:26 pm
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.

Re: Loading page from address bar fails

Posted: Wed Aug 21, 2013 8:47 am
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

Re: Loading page from address bar fails

Posted: Wed Aug 21, 2013 10:20 am
by Giorgio Maone
Investigating, thanks.

Re: Loading page from address bar fails

Posted: Wed Sep 04, 2013 4:47 pm
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.

Re: Loading page from address bar fails

Posted: Mon Sep 09, 2013 5:11 pm
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?

Re: Loading page from address bar fails

Posted: Tue Sep 10, 2013 8:15 am
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.

Re: Loading page from address bar fails

Posted: Mon Oct 07, 2013 6:55 pm
by jlmcgraw
Has there been any progress on this front?

Re: Loading page from address bar fails

Posted: Sat Nov 09, 2013 3:19 pm
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.

Re: Loading page from address bar fails

Posted: Fri Mar 28, 2014 8:35 am
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?

Re: Loading page from address bar fails

Posted: Fri May 23, 2014 12:11 am
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

Re: Loading page from address bar fails

Posted: Fri May 23, 2014 12:43 am
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

Re: Loading page from address bar fails

Posted: Mon May 26, 2014 10:55 am
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

Re: Loading page from address bar fails

Posted: Mon May 26, 2014 9:47 pm
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 :)