Page 1 of 2
C|Net and ABE
Posted: Thu Jul 21, 2011 10:46 pm
by wtrhzrd
With ABE enabled I can't seem to get the photos of review products to work. It's a mouseover and see the image like you see
here as example:
http://reviews.cnet.com/smartphones/t-m ... ag=nl.e723.
If I disable ABE it works fine. I tried playing with adding various rules, but I don't really know what I'm doing other than
toying around with variations of the other rules I see on the FAQ. Is there a way to make those pages work that I'm
missing?
Re: C|Net and ABE
Posted: Fri Jul 22, 2011 12:02 am
by al_9x
You probably have twitter.com inclusions blocked in abe. The cnet page has a bug, their test for the existence of the twttr object (if (twttr)), itself throws an error and breaks the page. Your quickest solution is to allow twitter on cnet.
@Giorgio
If twitter were blocked by the NS script module, the following surrogate would take care of it:
Code: Select all
user_pref("noscript.surrogate.twitter.sources", "platform.twitter.com");
user_pref("noscript.surrogate.twitter.replacement", "twttr=function() { var p = Proxy.createFunction({get: function(proxy, name) { return name in Object.prototype ? Object.prototype[name] : p; }}, function() { return p; }); return p; }();");
but it looks like when a script is blocked by abe, script surrogates don't run. Is that an omission or by design? I think it would make sense if they did.
Re: C|Net and ABE
Posted: Fri Jul 22, 2011 12:13 am
by wtrhzrd
Hmm, actually that was it... it works now with NO rules for cnet at all. I had added:
#Deny INCLUSION(SCRIPT, OBJ, SUBDOC)
Site .twitter.com .twimg.com
Accept from .twitter.com .twimg.com
Deny INCLUSION
at some point in time from somewhere, either the forums here, or the faq page, can't remember now.
If I pull that out, it works perfectly fine with no specific cnet rules at all. That seems strange but oh well,
it worked. Thanks.
Re: C|Net and ABE
Posted: Fri Jul 22, 2011 12:17 am
by wtrhzrd
And like you asked, I wonder also is that by design. If so, no problem but not knowing much about
the advanced "stuff" in noscript it does seem strange that that particular function no a site like
cnet wouldn't work just because of something to do with twitter. Or is it just that somehow the
script on that site for twitter happened first and everything after that in the scripts from the site
didn't run properly?
Re: C|Net and ABE
Posted: Fri Jul 22, 2011 12:28 am
by al_9x
You're wondering about something different, why cnet breaks without twitter. That has nothing to do with NS, their test for the twitter object is bad, throws an exception.
Re: C|Net and ABE
Posted: Fri Jul 22, 2011 6:32 am
by Giorgio Maone
al_9x wrote:
but it looks like when a script is blocked by abe, script surrogates don't run. Is that an omission or by design? I think it would make sense if they did.
It is an omission by design: one of the design criteria was keeping at the bare minimum the intersection between NoScript and ABE, and load type awareness (i.e. "this is a script, that is a frame") was not included in the first specification (before INCLUSION was added).
However at this point relaxing a bit this criterion may make sense, and this use case surely deserves attention.
Re: C|Net and ABE
Posted: Sat Jul 23, 2011 12:36 pm
by Giorgio Maone
Giorgio Maone wrote:
However at this point relaxing a bit this criterion may make sense, and this use case surely deserves attention.
Done in
latest development build.
Re: C|Net and ABE
Posted: Sat Jul 23, 2011 7:54 pm
by al_9x
verified
About the surrogate, what is this for:
Code: Select all
if(typeof Proxy==='undefined')return arguments.callee
It doesn't seem like it would do anything useful in 3.x, as there's usually a call on a twttr child object.
Re: C|Net and ABE
Posted: Sat Jul 23, 2011 8:18 pm
by Giorgio Maone
al_9x wrote:
Code: Select all
if(typeof Proxy==='undefined')return arguments.callee
It doesn't seem like it would do anything useful in 3.x, as there's usually a call on a twttr child object.
Indeed, in next build it will be changed into
Code: Select all
if(typeof Proxy==='undefined')return{events: {__noSuchMethod__: arguments.callee}}
Re: C|Net and ABE
Posted: Sat Jul 23, 2011 8:41 pm
by al_9x
I've seen another sub-object used ("anywhere"), which required the following surrogate:
Code: Select all
twttr={anywhere:function(){}};twttr.anywhere.__noSuchMethod__=function(){};
anywhere was itself called and also had its methods called.
Re: C|Net and ABE
Posted: Sun Jul 24, 2011 12:20 am
by al_9x
Giorgio Maone wrote:Code: Select all
if(typeof Proxy==='undefined')return{events: {__noSuchMethod__: arguments.callee}}
Why "arguments.callee" ?
Re: C|Net and ABE
Posted: Sun Jul 24, 2011 7:18 am
by Giorgio Maone
al_9x wrote:Giorgio Maone wrote:Code: Select all
if(typeof Proxy==='undefined')return{events: {__noSuchMethod__: arguments.callee}}
Why "arguments.callee" ?
Habit. Since it's not anonymous, using "twttr" is OK too to make the hack recursive.
Re: C|Net and ABE
Posted: Sun Jul 24, 2011 9:27 am
by al_9x
Giorgio Maone wrote:al_9x wrote:Giorgio Maone wrote:Code: Select all
if(typeof Proxy==='undefined')return{events: {__noSuchMethod__: arguments.callee}}
Why "arguments.callee" ?
Habit. Since it's not anonymous, using "twttr" is OK too to make the hack recursive.
Returning twttr is perhaps slightly better than constructing a new object each call, but either way it seems to serve no real purpose. It supports the following chaining:
twttr.events.whatever1()
.events.whatever1()
.events.whatever2()
which I don't think is in use now or ever would be.
Re: C|Net and ABE
Posted: Tue Jul 26, 2011 10:18 pm
by al_9x
the 3.6 fallback is still wrong,
- anywhere needs to be a function, not just an object
- __noSuchMethod__ needs to be a function, not twttr object
- twttr is not defined in the function
let me write it and you can review it.
Code: Select all
twttr = function () {
var srgt;
if (typeof Proxy === 'undefined') {
srgt = { events: { __noSuchMethod__: function() {} },
anywhere: function() {} };
srgt.anywhere.__noSuchMethod__ = function() {};
}
else
srgt = Proxy.createFunction({
get: function (proxy, name) {
return name in Object.prototype ? Object.prototype[name] : srgt;
}},
function() {
return srgt;
});
return srgt;
}();
Re: C|Net and ABE
Posted: Tue Jul 26, 2011 10:59 pm
by Giorgio Maone
Why creating 3 empty anonymous functions (each one is a different object)?
Code: Select all
if (typeof Proxy === 'undefined') {
var f=arguments.callee;
return f.__noSuchMethod__=f.events=f.anywhere=f;
}