Changeset 2480

Show
Ignore:
Timestamp:
09/28/08 21:30:22 (3 months ago)
Author:
ahodgkinson
Message:

digitalme: Changed Firefox launcher to use the script loader to overcome a regression introduced in Firefox 3.0.2.

Location:
trunk/digitalme/launchers/firefox-addon
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/digitalme/launchers/firefox-addon/CMakeLists.txt

    r1876 r2480  
    132132        COMMAND ${CMAKE_COMMAND} -E copy xul/chrome/content/cbisPrefs.xul ${PACKAGE_STAGE_DIR}/chrome/content 
    133133        COMMAND ${CMAKE_COMMAND} -E copy xul/chrome/content/cbisPrefs.js ${PACKAGE_STAGE_DIR}/chrome/content 
     134        COMMAND ${CMAKE_COMMAND} -E copy xul/chrome/content/Intercept.js ${PACKAGE_STAGE_DIR}/chrome/content 
    134135        COMMAND mkdir -p ${PACKAGE_STAGE_DIR}/defaults/preferences 
    135136        COMMAND mkdir -p ${PACKAGE_STAGE_DIR}/components 
  • trunk/digitalme/launchers/firefox-addon/xul/chrome/content/IdentitySelector.js

    r2216 r2480  
    5050var gConsoleService = Components.classes[ "@mozilla.org/consoleservice;1"]. 
    5151                        getService( Components.interfaces.nsIConsoleService); 
    52 var gbLoggingEnabled = true; 
     52var gbLoggingEnabled = false; 
    5353var gLastFailedGetTokenDate = null; 
    5454var gDisableStartTime = null; 
     
    457457                if( doc.__identityselector__ == undefined) 
    458458                { 
     459                        // Load and execute the script 
     460                         
     461                        Components.classes[  
     462                                "@mozilla.org/moz/jssubscript-loader;1"].getService( 
     463                                Components.interfaces.mozIJSSubScriptLoader).loadSubScript( 
     464                                "chrome://identityselector/content/Intercept.js", doc) 
     465                         
    459466                        IdentitySelector.logMessage( "runInterceptScript",  
    460467                                "Executed script on " + doc.location); 
    461                                  
    462                         eval(  
    463                                 "try" + 
    464                                 "{" + 
    465                                 "   document.__identityselector__ = new Object();" + 
    466                                 "   document.__identityselector__.data = new Object();" + 
    467                                 "   document.__identityselector__.submitIntercepted = false;" + 
    468                                  
    469                                 "   cardspace = new Object();" + 
    470                                 "   cardspace.IsInstalled = true;" + 
    471                                 "   cardspace.__defineGetter__( 'value', function()" +  
    472                                 "   {" +  
    473                                 "      try" + 
    474                                 "      {" + 
    475                                 "         if( document.__identityselector__.targetElem == undefined)" + 
    476                                 "         {" + 
    477                                 "            var event = document.createEvent( 'Event');" + 
    478                            "            event.initEvent( 'ICProcessItems', true, true);" + 
    479                                 "            document.dispatchEvent( event);" + 
    480                                 "         }" + 
    481                                  
    482                                 "         return( document.__identityselector__.targetElem.value);" + 
    483                                 "      }" + 
    484                                 "      catch( e)" + 
    485                                 "      {" + 
    486                                 "         alert( e);" + 
    487                                 "      }" + 
    488                                 "   });" + 
    489                                  
    490                                 "   document.__identityselector__.chainSubmit = " + 
    491                                 "      HTMLFormElement.prototype.submit;" + 
    492  
    493                                 "   HTMLFormElement.prototype.submit = function()" + 
    494                                 "   {" + 
    495                                 "      var event = document.createEvent( 'Event');" + 
    496                                 "      event.initEvent( 'ICFormSubmit', true, true);" + 
    497                                 "      this.dispatchEvent( event);" + 
    498                                 "      document.__identityselector__.chainSubmit.apply( this);" + 
    499                                 "   };" + 
    500                                  
    501                                 "   document.__identityselector__.valueGetter = function()" + 
    502                                 "   {" + 
    503                                 "      try" + 
    504                                 "      {" + 
    505                                 "         var event = document.createEvent( 'Event');" + 
    506                                 "         event.initEvent( 'ICGetTokenValue', true, true);" + 
    507                                 "         this.dispatchEvent( event);" + 
    508                                 "         return( this.__value);" + 
    509                                 "      }" + 
    510                                 "      catch( e)" + 
    511                                 "      {" + 
    512                                 "         alert( e);" + 
    513                                 "      }" + 
    514                                 "   };" + 
    515                                  
    516                                 "   document.__identityselector__.onDOMChanged = " + 
    517                                 "      function( event)" + 
    518                                 "      {" + 
    519                                 "         var target = event ? event.target : this;" + 
    520                                 "         var doc;" + 
    521                                  
    522                                 "         if( target.wrappedJSObject)" + 
    523                                 "         {" + 
    524                                 "            target = target.wrappedJSObject;" + 
    525                                 "         }" + 
    526                                  
    527                                 "         try" + 
    528                                 "         {" + 
    529                                 "            if( (doc = target.ownerDocument) == undefined)" + 
    530                                 "            {" + 
    531                                 "               return;" + 
    532                                 "            }" + 
    533                                          
    534                                 "            var event = doc.createEvent( 'Event');" + 
    535                                 "            event.initEvent( 'ICDOMChanged', true, true);" + 
    536                                 "            target.dispatchEvent( event);" + 
    537                                 "         }" + 
    538                                 "         catch( e)" + 
    539                                 "         {" + 
    540                                 "            IdentitySelector.reportError( 'onDOMChanged', e);" + 
    541                                 "         }" + 
    542                                 "      };" + 
    543  
    544                                 "   document.addEventListener(" + 
    545                                 "      'DOMNodeInserted', " + 
    546                                 "      document.__identityselector__.onDOMChanged, " + 
    547                                 "      false, false);" + 
    548                                  
    549                                 "   document.addEventListener(" + 
    550                                 "      'DOMAttrModified', " + 
    551                                 "      document.__identityselector__.onDOMChanged, " + 
    552                                 "      false, false);" + 
    553                                  
    554                                 "   document.addEventListener(" + 
    555                                 "      'DOMSubtreeModified', " + 
    556                                 "      document.__identityselector__.onDOMChanged, " + 
    557                                 "      false, false);" + 
    558                                  
    559                                 "   document.addEventListener(" + 
    560                                 "      'DOMNodeInsertedIntoDocument', " + 
    561                                 "      document.__identityselector__.onDOMChanged, " + 
    562                                 "      false, false);" + 
    563                                  
    564                                 "}" + 
    565                                 "catch( e)" + 
    566                                 "{" + 
    567                                 "   alert( e);" + 
    568                                 "}", doc); 
     468                } 
     469        }, 
     470         
     471        // *********************************************************************** 
     472        // Method: onDOMChanged 
     473        // *********************************************************************** 
     474        onDOMChanged : function( event) 
     475        { 
     476                var target = event ? event.target : this; 
     477                var doc; 
     478 
     479                if( target.wrappedJSObject) 
     480                { 
     481                        target = target.wrappedJSObject; 
     482                } 
     483 
     484                try 
     485                { 
     486                        if( (doc = target.ownerDocument) == undefined) 
     487                        { 
     488                                return; 
     489                        } 
     490         
     491                        var event = doc.createEvent( "Event"); 
     492                        event.initEvent( "ICDOMChanged", true, true); 
     493                        target.dispatchEvent( event); 
     494                } 
     495                catch( e) 
     496                { 
     497                        IdentitySelector.reportError( "onDOMChanged", e); 
    569498                } 
    570499        }, 
     
    11511080                                // doesn't support hiding the notification box 
    11521081                                 
    1153                                 if( typeof (browser.getNotificationBox) != "function") 
     1082                                if( typeof( browser.getNotificationBox) != "function") 
    11541083                                { 
    11551084                                        if( (objElem._type = objElem.getAttribute(  
     
    14951424                                                        "can sometimes be caused by a site attempting a " + 
    14961425                                                        "denial-of-service attack.  Select 'Cancel' to " + 
    1497                                                         "temporarily disable the identity selector or 'Ok' " + 
     1426                                                        "temporarily disable the identity selector or 'OK' " + 
    14981427                                                        "to allow the selector to launch.")) 
    14991428                                                {