Javascript errors with several actions

Hello,

I have a problem with Javascript error when I try to upload or publish my site. It happened before occasionally, but now all Spawn New Window and Carousel actions are listed in the error window. I can click ‘OK’ to ignore the errors, but then I get another message saying that an action took to much time and will be stopped. When i click ‘OK’, another window appears that I can publish my site because of a JavaScript error.

This will mean I will have to remove all mentioned actions and re-apply them (at least that worked in the past). I’m still building the website so not a big problem for now, but what if I have the website completed with more than 100 pages and hundreds of actions applied? That will take me a full day to delete and re-apply actions.

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You are describing a problem that seems to have cropped up again recently. (There have been rolling reports over the past year of similar behavior.) Here is precisely what is going on. As to how to fix it, that’s less clear.

All of the “Scripty”, “FX”, and “SNW” Actions use the prototype.js and scriptaculous.js libraries for their various effects. In order to improve the performance of your sites, these Actions link to the Google CDN (content delivery network) for these library scripts. During the publish process, each script phones home to Google to see if you are on line at the moment of publishing or not. This test is meant to be very innocuous – a single ping request is sent to the server ajax.googleapis.com, and if a reply comes, the Action knows to publish the public CDN version of the JavaScript library code into your page. This step was taken because there wasn’t any other way to determine if you were working on or off-line, and we wanted to ensure that your effects would still work either way.

The problem with this approach comes when you consider how a ping can fail. In the case of you being off line “for real”, the reply comes instantly – and that was the error state that the Action code was written to comprehend and act upon. But when you have a subtle problem with your network, something that causes “packet loss” but not an outright failure of all connections, then the ping gets sent, and the system waits very patiently for it to time out. This can take many seconds – an eternity for a publish loop in Freeway. Once this particular problem occurs, there’s no way out. The guard code that keeps an Action from hanging Freeway kicks in, and protects your system.

Joe Billings at Softpress and I have been discussing ways around this problem, while preserving the great benefits of using CDN-hosted scripts (high availability, browser caching across sites, unlimited free bandwidth) for Action users. One approach is just to assume everyone is always on line. While this is categorically not always true, it is a reasonable assumption for a Web developer in this day and age. We have not released any code to back up this approach, but we are working on it. I have been bitten by this bug many times, usually at times when my feeble network is busy downloading a big Apple update in the background.

As far as how you can solve your problems right now, there’s a couple of ways to fix this. The first is to turn your network off while publishing. This forces the Actions to publish the static local files for each of the library scripts. This of course disables the CDN code, and your site is a little bit slower to load. (It’s also a hassle to toggle your network while publishing. I feel your pain.)

Another approach is to crack open the Action bundle and change the definition of this function wherever it is found within each file therein:

var connected = function(){
  if(fwShellCommand){
    return fwShellCommand('ping -c1 -i1 http://ajax.googleapis.com');
  }else{
    var osa=new FWOSAInterpreter; 
    osa.fwWrite('do shell script "curl ajax.googleapis.com"'); 
    osa.fwCompile(); 
    return osa.fwRun();
  }
}

add this line at the top:

var connected = function(){
  return true; // <- add here
  if(fwShellCommand){
    return fwShellCommand('ping -c1 -i1 http://ajax.googleapis.com');
  }else{
    var osa=new FWOSAInterpreter; 
    osa.fwWrite('do shell script "curl ajax.googleapis.com"'); 
    osa.fwCompile(); 
    return osa.fwRun();
  }
}

This “short-circuits” the function, causing it to skip everything after that line, and telling Freeway that you are on-line.

Finally, you can look at the bright side, and consider this Action to be a very sensitive test for your network’s health. Raising a support ticket to your ISP, telling them that you are experiencing packet loss, is not a bad idea either. To back this up, open up your Applications/Utilities/Terminal.app and try the following command:

ping -c 100 ajax.googleapis.com

The result should be 100 packets sent and received, 0% packet loss. Anything else, and you have a problem. Copy and paste the entire exchange (request and response) into your trouble ticket. Just showing that to your ISP will alert them that you’re not the usual “how many blinking lights do you see on your modem” customer, and they may escalate the resolution for you.

I don’t have any date to give you for a complete resolution of this issue, but please be aware that we are working on it.

Walter

On Dec 13, 2012, at 7:51 AM, Marco wrote:

Hello,

I have a problem with Javascript error when I try to upload or publish my site. It happened before occasionally, but now all Spawn New Window and Carousel actions are listed in the error window. I can click ‘OK’ to ignore the errors, but then I get another message saying that an action took to much time and will be stopped. When i click ‘OK’, another window appears that I can publish my site because of a JavaScript error.

This will mean I will have to remove all mentioned actions and re-apply them (at least that worked in the past). I’m still building the website so not a big problem for now, but what if I have the website completed with more than 100 pages and hundreds of actions applied? That will take me a full day to delete and re-apply actions.

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,

That makes sense, thanks for your time to explain. And yes, there is another computer in my office at the moment downloading 30GB of data from Dropbox. So that may be the reason why I am getting the errors.

I could add the line to all actions, but then I’ll have to remind myself to do that every time an action is added or updated (which I will forget for sure ;-)).

The other option you mention may work better for me, but I’m sot sure if I follow you here. What do you mean by turning off my network? Do you mean go offline and then publish?

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes. Do this:

  1. In System Preferences, click Network and use the Location menu to choose Edit Locations. Create a new location called Offline. Choose it and start editing. Select each network interface in the list on the left, and set its Connect via picker to Off. Save your changes.

  2. Next time you go to publish in Freeway, first toggle your location to Offline, then publish. Then turn your location back to Automatic (or whatever else you had chosen previously) and choose Upload in Freeway. The pages shouldn’t need to publish again, so you should be uploading without another publish cycle.

Walter

On Dec 13, 2012, at 9:34 AM, Marco wrote:

The other option you mention may work better for me, but I’m sot sure if I follow you here. What do you mean by turning off my network? Do you mean go offline and then publish?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Excellent, thanks. I’ll try that!

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Update: I’m getting errors again, and whatever I do (turn network off, publish, turn network on, publish) I can’t get it working again. This only happens with the Spawn New Window action. The ScriptyLightbox2 action is working OK.

The difference with the problems I mentioned before is that I can publish the site after clicking ‘OK’ in the error message window now, and that the error message only mentions the SNW action (something like: ‘known Javascript error, the action will be ignored’). Previously I got a second message saying that publishing would not be possible.

Is this the same error or is something else going on? I’ve re-installed SNW but unfortunately that doesn’t help.

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

One day later, been busy with this all day and tried everything I could think of (including things like disconnecting and reconnecting the network, re-installing Freeway, re-installing all actions, deleting the actions in the library and re-adding them, copying the document and files to another computer, adding the code like Walter suggested (while I usually refrain from touching the code)). Unfortunately no luck at all. I can’t get it working again in any way.

I have to say it’s hard to spend so much time on this problem instead of continuing working on the site.

I’d love to hear any suggestions to solve this problem with Spawn New Window, so I can continue working on the website itself. Thanks in advance!

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Whenever I find this problem happening here (and it does, with some frequency) the issue is always that my network is congested with a large download from Apple Updates in the background, on one Mac or another. Or my daughters abusing YouTube. Something like like that.

All of the Scripty Actions (and SNW is part of the Scripty “club”) use a function called connected() to determine if your Mac is on line. That function tries to send and receive one ping from the ajax.googleapis.com server. When that ping fails, it doesn’t fail immediately, rather, it takes quite a while to time out – so long that the Action times out and you get the error you described.

When I’m feeling particularly peeved by it, I use my knowledge of the Action to disable the connected() function by changing the first line inside it to return true; Or I call up my service provider and raise hell about packet loss.

Walter

On Jan 4, 2013, at 4:28 PM, Marco wrote:

One day later, been busy with this all day and tried everything I could think of (including things like disconnecting and reconnecting the network, re-installing Freeway, re-installing all actions, deleting the actions in the library and re-adding them, copying the document and files to another computer, adding the code like Walter suggested (while I usually refrain from touching the code)). Unfortunately no luck at all. I can’t get it working again in any way.

I have to say it’s hard to spend so much time on this problem instead of continuing working on the site.

I’d love to hear any suggestions to solve this problem with Spawn New Window, so I can continue working on the website itself. Thanks in advance!

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walter, as always! I will add the ‘return true’ thing again, maybe I didn’t do that correctly. What feels strange is that it only happens to SNW, while it should affect SLB2 too while it uses the same function. Anyway, I’ll give it another shot. Thanks again!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks to the miracle that is GitHub, I can show you the exact function in situ: https://github.com/walterdavis/freewayactions/blob/master/Scripty/Protaculous.fwactionb/Contents/Resources/Actions/protaculous.fwaction#L189

Make that function look like this instead:

That’s all you need, and there should only be one instance of that function in each Scripty Action.

Walter

On Jan 4, 2013, at 5:46 PM, Marco wrote:

Thanks Walter, as always! I will add the ‘return true’ thing again, maybe I didn’t do that correctly. What feels strange is that it only happens to SNW, while it should affect SLB2 too while it uses the same function. Anyway, I’ll give it another shot. Thanks again!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I think I’ve got it working now, thank you so much Walter!

Marco


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options