Apr 16 2011

Debugging with KBX extension : how to avoid having to deploy at every code modification

Category: kynetx kynetx,technology

UPDATE: 04/17/2011 : Modified Firefox KBX extension available

I decided to have a quick look at the Kynetx KBX Chrome extension and see if I could patch it so I wouldn’t need to deploy an app everytime I modify it when it runs with the KBX extension ( http://stackoverflow.com/questions/5653090/kynetx-app-not-working-when-installed-via-kbx-extension-on-chrome ).

I needed this to help me solve this problem : http://stackoverflow.com/questions/5653090/kynetx-app-not-working-when-installed-via-kbx-extension-on-chrome

This feature could be achieved with no big magic in:  page_interaction/pages.js inside the Chrome extension

replacing :

KOBJ.add_config_and_run({‘rids’:response.apps});

with :

//patch run_latest_app_version_in_kbx

var run_latest_app_version_in_kbx= true;
var run_msg_json={‘rids’:response.apps};
if (run_latest_app_version_in_kbx===true){

for (var i=0;i<response.apps.length;i++){
run_msg_json[response.apps[i]+’:kynetx_app_version’]=’dev’;
}

}

KOBJ.add_config_and_run(run_msg_json);
//


Here is the modified crx extension :  KBX_run_latest_app_version_in_kbx.crx

This feature can be enabled/disabled in the options page of the extension. It is enabled by default.
Modified files :  page_interaction/pages.js,  option_page/options.html , background/background.js, manifest.json

A Firefox version might follow when I’ll start debugging on FF.

UPDATE: 04/17/2011 : Modified Firefox KBX extension available

On Firefox the file to modify is : resources/jid0-njkmo4quo4rc8p9kcuemahnyiku-kynetxforfirefox-data/page_interaction.js

replacing :

KOBJ.add_config_and_run({‘rids’:message.apps});

with :

//patch run_latest_app_version_in_kbx

var run_msg_json={‘rids’:message.apps};
var run_latest_app_version_in_kbx=true;
if (run_latest_app_version_in_kbx===true){

for (var i=0;i<message.apps.length;i++){
run_msg_json[message.apps[i]+’:kynetx_app_version’]=’dev’;
}

}
KOBJ.add_config_and_run(run_msg_json);
//

Here is the modified xpi extension :  KBX_run_latest_app_version_in_kbx.xpi

There doesn’t seem to be a preferences screen so this feature cannot be disabled unless you set the variable run_latest_app_version_in_kbx to false in page_interaction.js. Modifications in the file are taken into account immediately, no restart or disactivation/activation  needed.
Modified file :  resources/jid0-njkmo4quo4rc8p9kcuemahnyiku-kynetxforfirefox-data/page_interaction.js

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • BlinkList
  • Reddit
  • Suggest to Techmeme via Twitter
  • Technorati

Related Posts:

Tags: , , , ,

Leave a Reply