Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: openURL makes widget lose window.widget functionality



Here are the results from the Sample.

Analysis of sampling pid 22296 every 10.000000 milliseconds
Call graph:
283 Thread_0f0f
283 0x2854
283 0x29b4
283 0x8114
283 -[NSApplication run]
283 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
283 _DPSNextEvent
283 BlockUntilNextEventMatchingListInMode
283 ReceiveNextEventCommon
283 RunCurrentEventLoopInMode
283 CFRunLoopRunSpecific
283 __CFRunLoopRun
283 mach_msg
283 mach_msg_trap
283 mach_msg_trap
283 Thread_1003
283 _pthread_body
283 forkThreadForFunction
283 +[NSURLConnection(NSURLConnectionInternal) _resourceLoadLoop:]
283 CFRunLoopRunSpecific
283 __CFRunLoopRun
283 mach_msg
283 mach_msg_trap
283 mach_msg_trap
283 Thread_1103
283 _pthread_body
283 forkThreadForFunction
283 +[NSURLCache _diskCacheSyncLoop:]
283 CFRunLoopRunSpecific
283 __CFRunLoopRun
283 mach_msg
283 mach_msg_trap
283 mach_msg_trap
283 Thread_1203
283 _pthread_body
283 __CFSocketManager
283 select
283 select


Total number in stack (recursive counted multiple, when >=5):

thanks,
Andy,

On 11-May-05, at 12:19 PM, John Louch wrote:

oops! that would make sense, sorry.

here is the HTML code that is launching the widget.openURL, it is a

Sorry I meant the unix tool "sample". I.e. Use Activity Monitor.app to get
the pid of your process and then:


 sample <pid> 3

From a terminal window.

Thanks,
jl


basic form used to search my site.

<form name="SearchForm">
                                         <input type="search"
id="searchText">
                     <input type="submit" onclick="getSearch()"
value="Search" id="mysearch">
                     &nbsp;
                 </form>


and this is the javascript that handles everything.

function getSearch () {
               if(window.widget)
               {

                   getUser();
                   var theURL = "http://www.mysite.com/
file_search.php?action=file&text=" + document.getElementById
("searchText").value;
                    widget.openURL(theURL);
                  }
      }

function wrapURL (theURL) {
    if (window.widget) {
       theURL = "javascript:widget.openURL('" + theURL + "');";
    }
    return theURL;
}

function getUser ()
{
     if(window.widget)
     {
         widget.setPreferenceForKey(document.getElementById
("username").value, "username");
         widget.setPreferenceForKey(document.getElementById
("password").value, "password");
     }

document.getElementById("feedcontainer").innerHTML = " ";
if(window.widget){
if(widget.preferenceForKey("username")){
document.getElementById('getinfo').style.display = 'block';
document.getElementById
('enterPassword').style.display='none';
document.getElementById
('feedcontainer').style.display='block';
var url = 'http://www.mysite.com/
user_data_dashboard.php?username=' + widget.preferenceForKey
("username") + '&password=' + widget.preferenceForKey("password");
importXML(url,'parseRSS');


             } else {
                     document.getElementById
('enterPassword').style.display='block';
                     document.getElementById
('feedcontainer').style.display='none';
             }
         }
}
if(window.widget)
     {
         widget.onfocus = getUser;
     }
if(window.widget)
     {
         widget.onshow = getUser;
     }

var flipShown = false;
var animation = {duration:0, starttime:0, to:1.0, now:0.0, from:0.0,
firstElement:null, timer:null};
function mousemove (event)
{
     if (!flipShown)
     {
         if (animation.timer != null)
         {
             clearInterval (animation.timer);
             animation.timer  = null;
         }

         var starttime = (new Date).getTime() - 13;

         animation.duration = 500;
         animation.starttime = starttime;
         animation.firstElement = document.getElementById ('flip');
         animation.timer = setInterval ("animate();", 13);
         animation.from = animation.now;
         animation.to = 1.0;
         animate();
         flipShown = true;
     }
}
function mouseexit (event)
{
     if (flipShown)
     {
         // fade in the info button
         if (animation.timer != null)
         {
             clearInterval (animation.timer);
             animation.timer  = null;
         }

         var starttime = (new Date).getTime() - 13;

         animation.duration = 500;
         animation.starttime = starttime;
         animation.firstElement = document.getElementById ('flip');
         animation.timer = setInterval ("animate();", 13);
         animation.from = animation.now;
         animation.to = 0.0;
         animate();
         flipShown = false;
     }
}
function animate()
{
     var T;
     var ease;
     var time = (new Date).getTime();


T = limit_3(time-animation.starttime, 0, animation.duration);

     if (T >= animation.duration)
     {
         clearInterval (animation.timer);
         animation.timer = null;
         animation.now = animation.to;
     }
     else
     {
         ease = 0.5 - (0.5 * Math.cos(Math.PI * T /
animation.duration));
         animation.now = computeNextFloat (animation.from,
animation.to, ease);
     }

     animation.firstElement.style.opacity = animation.now;
}
function limit_3 (a, b, c)
{
     return a < b ? b : (a > c ? c : a);
}
function computeNextFloat (from, to, ease)
{
     return from + (to - from) * ease;
}

function enterflip(event)
{
     document.getElementById('fliprollie').style.display = 'block';
}

function exitflip(event)
{
     document.getElementById('fliprollie').style.display = 'none';
}


// Perform the flip from front to back.

function showPrefs()
{
     var front = document.getElementById('front');
     var back = document.getElementById('back');

     if (window.widget)
         widget.prepareForTransition('ToBack');        // freezes the
widget so that you can change it without the user noticing

     front.style.display='none';        // hide the front
     back.style.display='block';        // show the back


if (window.widget) setTimeout ('widget.performTransition();', 0); // and flip the widget over }

// Perform the flip from back to front, refresh content under the
assumption
// that the configuration has changed.

function hidePrefs()
{
     var front = document.getElementById('front');
     var back = document.getElementById('back');
     var flipcircle = document.getElementById('fliprollie');
     if (window.widget)
         widget.prepareForTransition('ToFront');        // freezes
the widget and prepares it for the flip back to the front

     flipcircle.style.display='none';
     back.style.display='none';            // hide the back
     front.style.display='block';        // show the front





     if (window.widget)
         setTimeout ('widget.performTransition();', 0);        // and
flip the widget back to the front

     getUser();
}



a little long winded, but basically ive narrowed it down to something
happening when the getSearch function is called.

Thanks

Andy

On 11-May-05, at 11:42 AM, John Louch wrote:


You would need to sample the widget for us to tell what is happening.

Thanks,
jl



i have a widget that displays some xml data from a website.
everything works
fine, until i leave the widget using widget.openURL . when you
return to the
widget it seems to lose all javascript functionality that used the
widget.
object.

widget.openURL no longer works, the flip transitions no longer
work, and my
preference keys are gone. basically all functions that use
widget.anything no
longer work.

anyone have any idea what is happening?

andy


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/ouch% 40apple.com


This email sent to email@hidden




--------------------------------------------------
John Louch         Internet #: email@hidden
(805) 541 2965








-------------------------------------------------- John Louch Internet #: email@hidden (805) 541 2965





_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: openURL makes widget lose window.widget functionality (From: John Louch <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.