Page 1 of 1

stupid require.js at rottentomatoes breaks surrogate

Posted: Sat Dec 12, 2015 12:39 am
by wxman1
At rottentomatoes, this:

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.16/require.js"></script>
<script>
require.config({paths:{jquery:"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min"}});
</script>

bla bla bla...

<script>
require.config({baseUrl:"//d3biamo577v4eu.cloudfront.net/static/js/",waitSeconds:60,config:{text:{useXhr:function(C,D,B,A){return true}}},paths:{facebook:"//connect.facebook.net/en_US/all",backbone:"//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.1/backbone-min",bootstrap:"//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/js/bootstrap.min",clamp:"lib/clamp.min",device:"//cdnjs.cloudflare.com/ajax/libs/device.js/0.2.7/device.min",marionette:"//cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.4.3/backbone.marionette.min",moment:"//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min",slick:["//cdn.jsdelivr.net/jquery.slick/latest/slick.min","lib/slick.min"],jqueryui:"//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min",text:"//cdnjs.cloudflare.com/ajax/libs/require-text/2.0.12/text.min",typeahead:["//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.10.5/typeahead.bundle.min",],underscore:"//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min",select2:"//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min",jwplayer:"//jwpsrv.com/library/1h4VDLs_EeOAlSIACi0I_Q",googletag:"//www.googletagservices.com/tag/js/gpt",domReady:"//cdnjs.cloudflare.com/ajax/libs/require-domReady/2.0.1/domReady.min","jquery-cookie":"//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min",URIjs:"lib/URIjs",scrollTo:"//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/1.4.14/jquery.scrollTo.min",nouislider:"//cdnjs.cloudflare.com/ajax/libs/noUiSlider/6.2.0/jquery.nouislider.min",swiper:"lib/swiper.jquery.min",hammer:"//cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.4/hammer.min",masonry:"//cdnjs.cloudflare.com/ajax/libs/masonry/3.3.2/masonry.pkgd.min",dotdotdot:"//cdnjs.cloudflare.com/ajax/libs/jQuery.dotdotdot/1.7.4/jquery.dotdotdot.min",readmore:"//cdnjs.cloudflare.com/ajax/libs/Readmore.js/2.0.5/readmore.min",omniture:"tracking/omniture"},shim:{bootstrap:{deps:["jquery"]},clamp:{deps:["jquery"],exports:"$clamp"},slick:{deps:["jquery"],exports:"slick"},text:{deps:["backbone"]},marionette:{deps:["jquery","underscore","backbone"],exports:"Marionette"},jwplayer:{exports:"jwplayer"},select2:{deps:["jquery"]},"domReady!":{exports:"domReady!"},facebook:{exports:"FB"},scrollTo:{deps:["jquery"]},"jquery-cookie":{deps:["jquery"]},jqueryui:{deps:["jquery"]},touchSwipe:{deps:["jquery"]},typeahead:{deps:["jquery","bootstrap"],exports:"typeahead"},swiper:{deps:["jquery"]},nouislider:{deps:["jquery"]},readmore:{deps:["jquery"]},dotdotdot:{deps:["jquery"]},googletag:{deps:["//optimizedby.openx.com/meta-rt.min.js"],exports:"googletag"}}});</script>

tons of bla+bla+bla and more bla bla bla


is breaking my local hosted jQuery, i.e.,

noscript.surrogate.jquery.sources ajax.googleapis.com/ajax/libs/jquery/*.*.*/jquery.min.js
noscript.surrogate.jqueryUI.sources ajax.googleapis.com/ajax/libs/jqueryui/*.*.*/jquery-ui.min.js

Both files are hosted locally, are the latest and work fine on other jQuery invoking sites. If I enable ajax.googleapis.com in NS, then the desired functionality at rottentomatoes is available, e.g., in Movies & DVD, any of the sub-categories, it doesn't load the thumbnails.

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sat Dec 12, 2015 12:52 am
by barbaz
Is it fetching the script by XMLHttpRequest and running it from there, or dynamically injecting a script element to the page?
Does playing with about:config > noscript.fakeScriptLoadEvents.* prefs change anything?

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sat Dec 12, 2015 6:30 pm
by wxman1
Can't quote the previous post: Ooops, looks like you're spamming!

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sat Dec 12, 2015 6:33 pm
by wxman1
Fine. :evil: We'll go around you. :arrow:

barbaz wrote:Does playing with about:config > noscript.fakeScriptLoadEvents.* prefs change anything?


Nope. Both prefs, i.e., loadevents.enabled and loadevents.onlyRequire.JS were both enabled. Enabling one, the other, or both had no effect.

@Babaz, the web-site thinks your first sentance is spam; it can't be posted in any form. :twisted: :?: :shock: :?

The answer to your qwexion is dunno. I'll have to dig into how require.js implements the parameter {paths:{jquery:"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min"}} to the function require.config()

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sat Dec 12, 2015 6:50 pm
by barbaz
wxman1 wrote:Can't quote the previous post: Ooops, looks like you're spamming!

Right, we all know that I am one of those awesome security software firefox pesky spammers and should have been permanently banned a long time ago... :lol: :roll:

You can send any active Moderator (currently me, GµårÐïåñ, therube, or Thrawn) a PM of what you want to post and we will try to post it for you.

wxman1 wrote:Nope. Both prefs, i.e., loadevents.enabled and loadevents.onlyRequire.JS were both enabled. Enabling one, the other, or both had no effect.

OK. So what about this:
barbaz wrote:Is it fetching the script by XMLHttpRequest and running it from there, or dynamically injecting a script element to the page?

Because if it does fetch the script by XHR then yes would require the destination site (Temp-)Allowed in NS - surrogate functionality is not a proxy equivalent by any means, and it's not possible to tell with certainty what the contents of an XHR destination will be until after it's happened.

Firefox's built-in dev tools (Tools > Web Development ?) should be able to help you find this out - start by watch the Net requests and/or search the live DOM.

EDIT Sorry, posted this before I saw your edit. I don't think you'll have to dig through the JS.

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sat Dec 12, 2015 10:35 pm
by wxman1
In my OP, the first two <script> tags 'splains how its doin' it, i.e., it invokes require.JS, and passes path to jQuery.JS as a parameter to require.config().

The second <script> tag references require.config() parameters, which embedded deeply in the midst of that horror is the path to jQuery-UI

How do I discern XHR in the browser console?

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sun Dec 13, 2015 12:05 am
by barbaz
IIRC it should say "XHR" after the request type?
(If the Firefox built-in dev tools aren't enough, you can install Firebug.)

Re: stupid require.js at rottentomatoes breaks surrogate

Posted: Sun Dec 13, 2015 9:59 pm
by Thrawn
Have you tried adding .rottentomatoes.com to the sources value of your local jQuery surrogate? Just separate it from the existing sources with a space.