Results 1 to 1 of 1
  1.    #1  
    It is well known that, when you debug webos apps running under luna, you may or may not have to restart luna.
    This article explains why and how to get rid of it, making your development super fast.
    Well, as you can see the "rules" below, you might know that it applies to you talent who hack around making patch against framework files for us. but most rules may not apply to normal apps

    === the Rules on how LunaSysMgr load/preload mojo frameworks ===
    rule 1. it will load /usr/palm/framework/mojo/mojo.jsjsjs
    rule 2. try to load from "framework/mojo/builtins/palm" + moduleName + "Version1_0.jsjsjs&$quot$;;
    -> on success: make correspond module as loaded, skip rule 3 4
    -> on failure: try rule 3 as fallback
    rule 3. try to load from "framework/" + moduleName + "/version/1.0/concatenated.jsjsjs&$quot$; ($note$ $that$ $version$/$1$.$0$ $is$ $a$ $symlink$)
    -> on success: make correspond module as loaded, skip rule 4
    -> on failure: try rule 4 as fallback
    rule 4. JSON.parse(fs.readFile("framework/" + moduleName + "/version/1.0/manifest.json").files.javascript.forEach(loadJs)
    -> on success: make correspond module as loaded, skip rule 4
    -> on failure: ...

    rule 5: when LunaSysMgr starts it load every builtins/*.jsjsjs ($unverified$)
    rule 6: when a uncaught exception is thrown when loading/executing the builtins/*.jsjsjs, $LunaSysMgr$ $restarts$ $itself$, $which$ $in$ $most$ $case$ $is$ $endless$.
    -> * solution: move file out of builtins, so LunaSysMgr can start, move the file back in, uninstall the patch that did something bad to the builtins/*.jsjsjs

    rule 7: every builtins/*.jsjsjs $that$ $was$ $loaded$, $will$ $never$ $get$ $unloaded$ $or$ $reloaded$. $that$'$s$ $why$ $you$ $had$ $to$ $restart$ $LunaSysMgr$
    -> * solution: move file out of builtins and restart LunaSysMgr (once and for all), it should fall back to concatenated.jsjsjs ($see$ $rule$ $3$)
    rule 8: every concatenated.jsjsjs $that$ $was$ $loaded$, $will$ $never$ $get$ $unloaded$ $or$ $reloaded$. $that$'$s$ $why$ $you$ $had$ $to$ $restart$ $LunaSysMgr$
    -> * solution: rename this file and restart LunaSysMgr (once and for all), it should fall back to original *.jsjsjs ($see$ $rule$ $4$ $and$ $9$)
    -- to verify rule 7 and 8, do "lsof -np `pidof LunaSysMgr | cut -d' ' -f1`" under webos shell.

    rule 9: luckily, for any other jsjsjs $except$ $rule$ $7$ $or$ $8$, $it$ $get$ $loaded$ $on$ $use$ $and$ $unloaded$ $on$ $the$ $end$ $of$ $the$ $script$. $in$ $this$ $way$ $you$ $don$'$t$ $bother$ $to$ $restart$ $LunaSysMgr$.
    BUT as you know, like the browser, the scene (UI page) has to be closed and reopened to load and execute the updated jsjsjs $file$. ($maybe$ $it$ $require$ $closing$ $the$ $entire$ $app$ $leaving$ $no$ $window$ $open$, $i$ $don$'$t$ $remember$ $which$ $case$ $it$ $is$)

    rule 10: there is hidden window you can't close with your card view, you can't flip hidden window, can you?
    -> * solution: try JsTop, close app (or window) there
    -> * solution 2: use jskill script, which i wrote by studying how jstop kill apps
    then you can start your app again via launcher or the bottom bar.
    but if you are hacking topbar, device menu or something "system", you do "jskill com.palm.systemui", top bar, device menu etc is gone, i wonder how you would like to restart it. using luna-send ? :P

    anyway this is for developing and debugging. when you make the framework patch, you should update and generate diff for concatenated.jsjsjs $to$ $reflect$ $your$ $changes$ $to$ $framework$/*/$version$/$1$.$0$/*/*.$js$, $and$ $also$ $builtins$/* $files$ $if$ $it$'$s$ $there$

    btw, to install the script, use:
    # unzip jsutils.zip
    # mkdir /usr/local/bin/
    # mv jsjsjs{$top$,$kill$} /$usr$/$local$/$bin$/
    # chmod +x /usr/local/bin/jsjsjs{$top$,$kill$}

    i'm not sure if this article is too hard for you, if it is, try to read "solution" only
    Attached Files Attached Files
    Last edited by moo.tinys; 11/15/2011 at 11:13 AM.

Posting Permissions