1//********************************************************************************* 2//* * 3//* UPlugin class * 4//* * 5//********************************************************************************* 6 7/////////////////////////////////////////////////////////////////////////////////// 8// 9// Description 10// Default constructor 11// 12// Parameters 13// no parameters 14// 15// Return value 16// no return value 17// 18/////////////////////////////////////////////////////////////////////////////////// 19function UPlugin() 20{ 21} 22 23/////////////////////////////////////////////////////////////////////////////////// 24// 25// Description 26// Returns installed version of specified plugin 27// 28// Parameters 29// a_mimeType - [String] mime-type of the content plugin should handle 30// a_pluginName - [String] name of the plugin to check 31// 32// Return value [String] 33// in format "xxxx.xxxx.xxxx.xxxx" w/o leading zeroes 34// if plugin is not installed "0.0.0.0" is returned 35// 36/////////////////////////////////////////////////////////////////////////////////// 37UPlugin.prototype.getVersion = function(a_mimeType, a_pluginName) 38{ 39 addToLogEnter('UPlugin.getVersion("' + a_mimeType + '", "' + a_pluginName + '") - enter'); 40 41 var res = "0.0.0.0"; 42 43 navigator.plugins.refresh(false); 44 45 if(null == navigator.mimeTypes[a_mimeType]) { // do we have the provided mime-type registered ? 46 addToLog("UPlugin.getVersion() - MimeType (" + a_mimeType + ") is not registered "); 47 48 } else if(null == navigator.mimeTypes[a_mimeType].enabledPlugin) { // plugin should be enabled for this mime-type 49 addToLog("UPlugin.getVersion() - MimeType (" + a_mimeType + ") does not have an enabled plugin "); 50 51 } else if(0 != navigator.mimeTypes[a_mimeType].enabledPlugin.name.indexOf(a_pluginName) ) { // enabled plugin for this mime-type must be ours 52 addToLog("UPlugin.getVersion() - MimeType (" + a_mimeType + ") has another enabled plugin (" + navigator.mimeTypes[a_mimeType].enabledPlugin.name + ")" ); 53 54 } else { 55 // check for the version 56 // our controls should have version inside description field 57 version = navigator.mimeTypes[a_mimeType].enabledPlugin.description.toLowerCase(); 58 if( 0 <= version.indexOf("ver. ") ) { 59 version = version.substring(version.indexOf("ver. ") + 5); 60 } 61 62 // plugin for Mac currently does not have a version number inside it's description field CR 92235. 63 // put bogus minimal version "0.0.0.1" if we can not detect the version 64 if( 0 > version.indexOf(".") ) { 65 version = "0.0.0.1"; 66 } 67 68 res = version; 69 } 70 71 addToLogExit('UPlugin.getVersion() - exit, result = "' + res + '"'); 72 73 return res; 74} 75 76/////////////////////////////////////////////////////////////////////////////////// 77// 78// Description 79// Checks whether we have specified plugin installed or needs to be updated 80// 81// Parameters 82// a_mimeType - [String] mime-type of the content plugin should handle 83// a_pluginName - [String] name of the plugin to check 84// a_pluginLatestVersion - [String] latest available version of the plugin 85// 86// Return value [int] 87// 0 - the latest or greater version is installed (everything is OK) 88// -1 - plugin is not installed (installation is required) 89// -2 - old version is installed (update is available) 90// 91/////////////////////////////////////////////////////////////////////////////////// 92UPlugin.prototype.check = function(a_mimeType, a_pluginName, a_pluginLatestVersion) 93{ 94 addToLogEnter('UPlugin.check("' + a_mimeType + '", "' + a_pluginName + '", "' + a_pluginLatestVersion + '") - enter'); 95 96 var res = -1; 97 98 var version = this.getVersion(a_mimeType, a_pluginName); 99 100 if("0.0.0.0" != version) { 101 res = (0 < this.compareVersion(version, a_pluginLatestVersion)) ? -2 : 0; 102 } 103 104 addToLogExit("UPlugin.check() - exit, result = " + res); 105 106 return res; 107} 108 109 110/////////////////////////////////////////////////////////////////////////////////// 111// 112// Description 113// Performs version comparison 114// it is a three-state substraction (result = a_nVersion - a_eVersion) 115// 116// Parameters 117// a_eVersion - [String] dot delimetered value of existing version 118// a_nVersion - [String] dot delimetered value of latest available version 119// 120// Return value [int] 121// -1 - a_eVersion > a_nVersion (we have a newer version)
122// 0 - a_eVersion == a_nVersion 123// 1 - a_eVersion < a_nVersion (we have an older version) 124// 125/////////////////////////////////////////////////////////////////////////////////// 126UPlugin.prototype.compareVersion = function(a_eVersion, a_nVersion) 127{ 128 addToLogEnter('UPlugin.compareVersion("' + a_eVersion + '", "' + a_nVersion + '") - enter'); 129 130 var res = 0; 131 var verE = a_eVersion + "."; 132 var verN = a_nVersion + "."; 133 134 do { 135 var numE = 1 * (verE.substring(0, verE.indexOf("."))); 136 var numN = 1 * (verN.substring(0, verN.indexOf("."))); 137 138 verE = verE.substring(verE.indexOf(".") + 1); 139 verN = verN.substring(verN.indexOf(".") + 1); 140 141 if (numE < numN) { 142 res = 1; 143 break; 144 145 } else if (numE > numN) { 146 res = -1; 147 break; 148 } 149 150 } while( (0 <= verE.indexOf(".")) || (0 <= verN.indexOf(".")) ) 151 152 addToLogExit("UPlugin.compareVersion() - exit, result = " + res); 153 return res; 154} 155 156 157/////////////////////////////////////////////////////////////////////////////////// 158// 159// Description 160// Triggers installation of specified plugin XPI package 161// 162// Parameters 163// a_id - [String] id of installation, caller can put here any value. 164// a_packageURL - [String] URL to download the package from (could be both relative or absolute) 165// a_callBackFunction - [function(a_id, a_url, a_statusCode)] - function to receive notification 166// about installation process 167// a_userFriendlyName - [String] user friendly package name, will be displayed by browser inside 168// installation confirmation box 169// 170// Return value [boolean] 171// try - success 172// 173/////////////////////////////////////////////////////////////////////////////////// 174UPlugin.prototype.install = function(a_id, a_packageURL, a_callbackFunc, a_userFriendlyName) 175{ 176// addToLogEnter('UPlugin.prototype.install("'+ a_packageURL + '", "' + a_callbackFunc + '") - enter'); 177 addToLogEnter('UPlugin.prototype.install("'+ a_packageURL + '") - enter'); 178 var res = false; 179 180 function UPlugin_installCallback(a_id, a_callbackFunc) 181 { 182 this.m_id = a_id; 183 this.m_callbackFunc = a_callbackFunc; 184 } 185 186 UPlugin_installCallback.prototype.callback = function(a_url, a_status) 187 { 188 this.m_callbackFunc(this.m_id, a_url, a_status); 189 } 190 191 UPlugin_installCallback.getCallbackFunc = function(a_obj, a_methodName) 192 { 193 return function(a_url, a_status) { a_obj[a_methodName](a_url, a_status); } 194 } 195 196 _obj = new UPlugin_installCallback(a_id, a_callbackFunc); 197 198 var xpi = new Object(); 199 xpi[a_userFriendlyName] = a_packageURL; 200 201 try { 202 res = InstallTrigger.install(xpi, UPlugin_installCallback.getCallbackFunc(_obj, "callback")); 203 } catch (e) { 204 //FF 4 workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=638292 205 if( -1 != navigator.userAgent.indexOf("Firefox/4.0") && -1 == location.href.indexOf("&installtrigger_workaround=1")) { 206 location.href = location.href+"&installtrigger_workaround=1"; 207 } 208 res = false; 209 } 210 211 addToLogExit('UPlugin.prototype.install() - exit, result = ' + res); 212 return res; 213} 214 215 216/////////////////////////////////////////////////////////////////////////////////// 217// 218// Description 219// Returns human readable explanation of the code returned by check() method 220// 221// Parameters 222// a_code - [int] code returned by check() function 223// 224// Return value [String] 225// Returns human readable explanation of the code 226// 227/////////////////////////////////////////////////////////////////////////////////// 228UPlugin.prototype.checkCodeToStr = function(a_code) 229{ 230 if(-1 == a_code) { 231 return "(code = -1) - plugin is not installed or disabled (installation is required)"; 232 233 } else if(0 == a_code) { 234 return "(code = 0) - the version equal or greater than asked is installed (everything seems to be OK)"; 235 236 } else if(1 == a_code) { 237 return "(code = 1) - the version older than asked is installed (update might be required)"; 238 } 239} 240 241 242//********************************************************************************* 243//* 244//* UPluginInstaller class 245//* 246//********************************************************************************* 247//* 248//* Description: 249//* Checks the current version of the specified plugin 250//* and performs installation of it with UI if necessary 251//* 252//* Communicates with the caller through the callback function. 253//* Callback function can be assigned to "eventHandler" member of the instance 254//* 255//* function callbackEvent(a_control_id, a_eventName, a_param) 256//* where, 257//* a_control_id - [String] identificator of the object instance (paramtere to constructor)
258//* a_event_name - [String] name of the event, available events: 259//* installation_done 260//* installation_cancelled 261//* installation_failed 262//* a_version - [String] contains the version of installed plugin 263//* if no plugin installed - contains "0.0.0.0" 264//* a_param - [String] some parameter for event 265//* 266//* 267//* Notes: 268//* Requires an HTML conatainer. 269//* 270//* Example: 271//* 272//* var plugin = new UPluginInstaller("testPlugin", document.getElementById("pluginDIV")); 273//* plugin.eventHandler = onControlEvent; 274//* var params = new Array() 275//* params['mime_type'] = "application/x-f5-host-plugin"; 276//* params['plugin_name'] = "F5 Networks Firepass Host"; 277//* params['available_version'] = "6000.0.0.0"; 278//* params['package_url'] = "https://your.server/public/download/urhostplg.xpi"; 279//* plugin.install(params); 280//* 281//********************************************************************************* 282 283/////////////////////////////////////////////////////////////////////////////////// 284// 285// Description 286// Default constructor 287// 288// Parameters 289// a_name - [String] identificator of the instance of the object, 290// will be sent to callback function as a paramter 291// a_container - [Object] HTML container 292// 293// Return value 294// no return value 295// 296/////////////////////////////////////////////////////////////////////////////////// 297 298/////////////////////////////////////////////////////////////////////////////////// 299// 300// EVENTS 301// text_out_start 302// fired when object is about to show UI inside provided container 303// a_event_name - "text_out_start" 304// a_param - contains UI form ID, for example, "OnDoJavaInstall" 305// 306/////////////////////////////////////////////////////////////////////////////////// 307 308function UPluginInstaller(a_name, a_container) 309{ 310 this.m_name = a_name || "unknown"; 311 this.m_container = a_container; 312 313 this.is_chrome = ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 ); 314 this.is_linux = ( navigator.userAgent.indexOf("Linux") != -1); 315 this.is_macintosh = ( navigator.userAgent.indexOf("Macintosh") != -1); 316 this.mimeType = ""; 317 this.pluginName = ""; 318 this.description = ""; 319 this.packageURL = ""; 320 this.packageManualURL = ""; 321 this.latestVersion = "0.0.0.0"; 322 this.minimalVersion = "0.0.0.0"; 323 this.eventHandler = null; 324 this.m_install_type = -1; 325 this.m_currentVersion = "0.0.0.0"; 326 this.m_plugin = new UPlugin(); 327} 328 329/////////////////////////////////////////////////////////////////////////////////// 330// 331// Description 332// Performs installation of the specified plugin 333// 334// Parameters 335// a_params - [Array] Array of input parameters 336// required values: 337// mime_type - [String] 338// plugin_name - [String] 339// package_url - [String] 340// optional values: 341// package_manual_url - [String] 342// available_version - [String] // by default it is "0.0.0.0" 343// minimal_version - [String] // by default it will be equal to available_version 344// 345// Return value 346// no return value 347// 348/////////////////////////////////////////////////////////////////////////////////// 349UPluginInstaller.prototype.install = function(a_params) 350{ 351 addToLogEnter('UPluginInstaller.prototype.install() - enter'); 352 353 if(null == a_params['mime_type']) { 354 throw(new Error('UPluginInstaller.prototype.install() - "mime_type" parameter is not specified')); 355 } 356 if(null == a_params['plugin_name']) { 357 throw(new Error('UPluginInstaller.prototype.install() - "plugin_name" parameter is not specified')); 358 } 359 if(null == a_params['package_url']) { 360 throw(new Error('UPluginInstaller.prototype.install() - "package_url" parameter is not specified')); 361 } 362 if(null == this.m_container) { 363 throw(new Error('UPluginInstaller.prototype.install - "this.m_container" is not initialized')); 364 } 365 if(null == this.eventHandler) { 366 throw(new Error('UPluginInstaller.prototype.install() - "this.eventHandler" is not initialized')); 367 } 368 369 this.m_container.installer = this; 370 this.mimeType = a_params['mime_type']; 371 this.pluginName = a_params['plugin_name']; 372 this.description = a_params['plugin_name']; 373 this.packageURL = a_params['package_url']; 374 this.packageManualURL = a_params['package_manual_url']; 375 376 // check for optional parameters 377 if(null != a_params['available_version']) { 378 this.latestVersion = a_params['available_version'] 379 this.minimalVersion = a_params['available_version'] 380 } 381 382 this.minimalVersion = this.latestVersion; 383 if(null != a_params['minimal_version']) { 384 this.minimalVersion = a_params['minimal_version']; 385 } 386 387 388 // check the installed plugin version 389 if(0 != this.checkVersion()) { 390 var _onInstall = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "', 'install')"; 391 window.setTimeout(_onInstall, 1); 392 393 } else { 394 this.OnInstallationDone(); 395 } 396 397 addToLogExit('UPluginInstaller.prototype.install() - exit'); 398 399} 400 401 402//------------------------------------------------------------------------------ 403// internal functions 404//------------------------------------------------------------------------------ 405 406UPluginInstaller.prototype.checkVersion = function() 407{ 408 this.m_currentVersion = this.m_plugin.getVersion(this.mimeType, this.pluginName); 409 return this.m_plugin.check(this.mimeType, this.pluginName, this.latestVersion); 410} 411 412 413/////////////////////////////////////////////////////////////////////////////////// 414// 415// Description 416// callback function for "this.m_plugin.install" method call 417// 418// Parameters 419// a_id - [String] installation operation id (provided as a parameter to this.m_plugin.install" method call) 420// a_url - [String] url of the package being installed (provided as a parameter to this.m_plugin.install" method call) 421// a_code - [int] installation result code 422// 423// Return value 424// no return value 425// 426/////////////////////////////////////////////////////////////////////////////////// 427UPluginInstaller.prototype.CallbackFuncForPluginObj = function(a_id, a_url, a_code) 428{ 429 addToLogEnter('UPluginInstaller.prototype.CallbackFuncForPluginObj("' + a_id + '", "' + a_url + '", "' + a_code + '") - enter'); 430 431 if("0" == a_code) { 432 var _onDone = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "', 'done')"; 433 window.setTimeout(_onDone, 1); 434 435// Some browsers, Mozilla 1.7.13 for example fires -210 code even if call to InstallTrigger.install has failed 436// so we can not use this code to assume user cancelled this installation 437// 438// } else if("-210" == a_code) { 439// var _onSkip = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "', 'ski
439p')"; 440// window.setTimeout(_onSkip, 1); 441 442 } else { 443 var _onFailed = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "', 'failed')"; 444 window.setTimeout(_onFailed, 1); 445 } 446 447 addToLogExit("UPluginInstaller.prototype.CallbackFuncForPluginObj() - exit"); 448} 449 450 451/////////////////////////////////////////////////////////////////////////////////// 452// 453// Description 454// initiates plugin installation process 455// 456// Parameters 457// no parameters 458// 459// Return value 460// no return value 461// 462/////////////////////////////////////////////////////////////////////////////////// 463UPluginInstaller.prototype.OnDoInstall = function() 464{ 465 addToLogEnter("UPluginInstaller.prototype.OnDoInstall() - enter"); 466 var res = -1; 467 468 this.m_install_type = 0; //regular installation using InstallTrigger 469 470 if( this.is_macintosh ) { 471 this.showMacAllBrowsersInstallScreen(); 472 } else if( this.is_chrome ) { 473 this.showChromeInstallScreen(); 474 var _onDone = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "', 'done')"; 475 window.setTimeout(_onDone, 1); 476 } else { 477 try { 478 res = (this.m_plugin.install('1', this.packageURL, UPluginInstaller.getCallbackFuncForPluginObj(this, "CallbackFuncForPluginObj"), this.description)) ? 0 : 1; 479 } catch(e) {} 480 481 if(1 == res) { 482 this.showAllowPluginScreen(); 483 484 } else if(-1 == res) { 485 if("" != this.packageManualURL) { 486 //do not show the manual installation option if package for manual installation wss not provided 487 this.showAutoInstallFailedScreen(); 488 } else { 489 this.showAllowPluginScreen(); 490 } 491 } 492 } 493 494 495 addToLogExit("UPluginInstaller.prototype.OnDoInstall() - exit"); 496} 497 498/////////////////////////////////////////////////////////////////////////////////// 499// 500// Description 501// 502// Parameters 503// no parameters 504// 505// Return value 506// no return value 507// 508/////////////////////////////////////////////////////////////////////////////////// 509UPluginInstaller.prototype.OnInstallationStarted = function() 510{ 511 addToLogEnter("UPluginInstaller.prototype.OnInstallationStarted() - enter"); 512 513 if(1 == this.m_install_type) { 514 this.showJavaInstallStartedScreen(); 515 } 516 517 518 addToLogExit("UPluginInstaller.prototype.OnInstallationStarted() - exit"); 519} 520 521 522/////////////////////////////////////////////////////////////////////////////////// 523// 524// Description 525// Should be called when installation process successfuly finished. 526// It rechecks the installed plugin version and fires an appropriate event 527// 528// Parameters 529// no parameters 530// 531// Return value 532// no return value 533// 534/////////////////////////////////////////////////////////////////////////////////// 535UPluginInstaller.prototype.OnInstallationDone = function() 536{ 537 addToLogEnter("UPluginInstaller.prototype.OnInstallationDone() - enter"); 538 539 // did we really install/upgrade the plugin 540 // FireFox 2.0.0.11 for Windows will report success of installation even if plugin for Linux was provided, and it was not actually installed 541 this.checkVersion(); 542 543 this.m_container.innerHTML = ""; 544 545 if(0 >= this.m_plugin.compareVersion(this.m_currentVersion, this.minimalVersion)) { 546 this.invokeCallback("installation_success", this.m_currentVersion, ""); 547 548 } else { 549 if(0 == this.m_install_type) { 550 this.OnInstallationFailed(); 551 552 } else { //for Java installation - we already tried the package - nothing we can do here 553 this.invokeCallback("installation_failed", this.m_currentVersion, ""); 554 } 555 } 556 557 addToLogExit("UPluginInstaller.prototype.OnInstallationDone() - exit"); 558} 559 560 561/////////////////////////////////////////////////////////////////////////////////// 562// 563// Description 564// Should be called when installation process failed 565// Fires "installation_failed" event and shows AutoInstallFailed UI screen 566// 567// Parameters 568// no parameters 569// 570// Return value 571// no return value 572// 573/////////////////////////////////////////////////////////////////////////////////// 574UPluginInstaller.prototype.OnInstallationFailed = function() 575{ 576 addToLogEnter("UPluginInstaller.prototype.OnInstallationFailed() - enter"); 577
578 if(0 == this.m_install_type) { 579 if( this.is_chrome ) { 580 this.showChromeInstallFailScreen(); 581 } else { 582 if("" != this.packageManualURL) { 583 //do not show the manual installation option if package for manual installation wss not provided 584 this.showAutoInstallFailedScreen(); 585 } else { 586 this.showAllowPluginScreen(); 587 } 588 } 589 } else { //this is Java based installation 590 591 // check for version again, it is possible that event form applet did not go througth 592 // and user clicked on continue link after installation is done 593 this.checkVersion(); 594 if(0 >= this.m_plugin.compareVersion(this.m_currentVersion, this.minimalVersion)) { 595 this.invokeCallback("installation_success", this.m_currentVersion, ""); 596 } else { 597 this.showJavaInstallFailedScreen(); 598 } 599 } 600 601 addToLogExit("UPluginInstaller.prototype.OnInstallationFailed() - exit"); 602} 603 604/////////////////////////////////////////////////////////////////////////////////// 605// 606// Description 607// Should be called when installation is cancelled by user 608// Fires an "installation_cancelled" event 609// 610// Parameters 611// no parameters 612// 613// Return value 614// no return value 615// 616/////////////////////////////////////////////////////////////////////////////////// 617UPluginInstaller.prototype.OnSkipInstall = function() 618{ 619 addToLogEnter("UPluginInstaller.prototype.OnSkipInstall() - enter"); 620 621 this.checkVersion(); 622 this.m_container.innerHTML = ""; 623 624 if(0 >= this.m_plugin.compareVersion(this.m_currentVersion, this.minimalVersion)) { 625 this.invokeCallback("installation_success", this.m_currentVersion, ""); 626 627 } else { 628 this.invokeCallback("installation_cancelled", this.m_currentVersion, ""); 629 } 630 631 addToLogExit("UPluginInstaller.prototype.OnSkipInstall() - exit"); 632} 633 634/////////////////////////////////////////////////////////////////////////////////// 635// 636// Description 637// Invokes callback function provided by caller 638// 639// Parameters 640// a_event - [String] event name to send 641// a_version - [String] version of the installed plugin 642// a_param - [String] parameter for the event 643// 644// Return value 645// no return value 646// 647/////////////////////////////////////////////////////////////////////////////////// 648UPluginInstaller.prototype.invokeCallback = function(a_event, a_version, a_param) 649{ 650 addToLogEnter("UPluginInstaller.prototype.invokeCallback() - enter"); 651 652 if(null != this.eventHandler) { 653 this.eventHandler(this.m_name, a_event, a_version, a_param); 654 } 655 656 addToLogExit("UPluginInstaller.prototype.invokeCallback() - exit"); 657} 658 659/////////////////////////////////////////////////////////////////////////////////// 660// 661// Description 662// Displays JavaInstallStarted UI screen inside provided HTML container 663// 664// Parameters 665// no parameters 666// 667// Return value 668// no return value 669// 670/////////////////////////////////////////////////////////////////////////////////// 671UPluginInstaller.prototype.patchLinks = function(a_str) 672{ 673 addToLogEnter('UPluginInstaller.prototype.this.patchLinks() - enter'); 674 675 var str = ""; 676 var _OnInstallDone = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "','done')"; 677 var _OnInstallFailed = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "','failed')"; 678 var _OnDoInstall = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "','install')"; 679 var _OnSkipInstall = "javascript:UPluginInstaller.prototype.EventHandler('" + this.m_container.id + "','skip')"; 680 681 //do some replacements and binding ... 682 a_str = a_str.replace(/\[PLUGIN_MANUAL_URL\]/g, this.packageManualURL); 683 a_str = a_str.replace(/\[DONE_EVENT\]/g, _OnInstallDone); 684 if (this.is_chrome) { 685 if(this.is_linux){ 686 a_str = a_str.replace(/\[INSTALL_EVENT\]/g, this.packageURL); 687 }else{ 688 a_str = a_str.replace(/\[INSTALL_EVENT\]/g, this.packageManualURL); 689 } 690 } else { 691 a_str = a_str.replace(/\[INSTALL_EVENT\]/g, _OnDoInstall); 692 } 693 a_str = a_str.replace(/\[SKIP_EVENT\]/g, _OnSkipInstall); 694 a_str = a_str.replace(/\[FAIL_EVENT\]/g, _OnInstallFailed); 695 696 addToLogExit('UPluginInstaller.prototype.patchLinks() - exit'); 697 return a_str; 698} 699 700 701 702/////////////////////////////////////////////////////////////////////////////////// 703// 704// Description 705// Displays JavaInstallStarted UI screen inside provided HTML container 706// 707// Parameters 708// no parameters 709// 710// Return value 711// no return value 712// 713/////////////////////////////////////////////////////////////////////////////////// 714UPluginInstaller.prototype.showJavaInstallStartedScreen = function() 715{ 716 addToLogEnter('UPluginInstaller.prototype.showJavaInstallStartedScreen() - enter'); 717 718 var userAgent=navigator.userAgent; 719 addToLog("userAgent="+userAgent); 720 721 //obtain the UI from a separate include file 722 if(userAgent.indexOf("Safari") != -1 || (0 != this.m_currentVersion.indexOf("0.0.0.") && (userAgent.indexOf("Macintosh") != 723-1) 724&& (userAgent.indexOf("Firefox") != -1))){ 725 var str = this.patchLinks(UPluginInstaller_JavaInstallStartedScreenGetRestartBrowser()); 726 }else{ 727 var str = this.patchLinks(UPluginInstaller_JavaInstallStartedScreenGet()); 728 } 729 730 this.invokeCallback("text_out_start", this.m_currentVersion, "showJavaInstallStartedScreen"); 731 732 this.m_container.innerHTML = str; 733 734 addToLogExit('UPluginInstaller.prototype.showJavaInstallStartedScreen() - exit'); 735} 736
737/////////////////////////////////////////////////////////////////////////////////// 738// 739// Description 740// Displays Installation UI screen for all browsers on MAC OS X inside provided 741// HTML container 742// 743// Parameters 744// no parameters 745// 746// Return value 747// no return value 748// 749/////////////////////////////////////////////////////////////////////////////////// 750UPluginInstaller.prototype.showMacAllBrowsersInstallScreen = function() 751{ 752 addToLogEnter('UPluginInstaller.prototype.showMacAllBrowsersInstallScreen() - enter'); 753 754 this.invokeCallback("text_out_start", this.m_currentVersion, "showMacAllBrowsersInstallScreen"); 755 var str = this.patchLinks(UPluginInstaller_Macintosh()); 756 this.m_container.innerHTML = str; 757 758 addToLogExit('UPluginInstaller.prototype.showMacAllBrowsersInstallScreen() - exit'); 759} 760 761/////////////////////////////////////////////////////////////////////////////////// 762// 763// Description 764// Displays Installation UI screen for chrome browser on windows and Linux 765// platforms inside provided HTML container 766// 767// Parameters 768// no parameters 769// 770// Return value 771// no return value 772// 773/////////////////////////////////////////////////////////////////////////////////// 774UPluginInstaller.prototype.showChromeInstallScreen = function() 775{ 776 addToLogEnter('UPluginInstaller.prototype.showChromeInstallScreen() - enter'); 777 778 this.invokeCallback("text_out_start", this.m_currentVersion, "showChromeInstallScreen"); 779 var str = this.patchLinks(UPluginInstaller_Chrome()); 780 this.m_container.innerHTML = str; 781 782 addToLogExit('UPluginInstaller.prototype.showChromeInstallScreen() - exit'); 783} 784 785/////////////////////////////////////////////////////////////////////////////////// 786// 787// Description 788// Displays Installation Failure UI screen for chrome browser on windows and Linux 789// platforms inside provided HTML container 790// 791// Parameters 792// no parameters 793// 794// Return value 795// no return value 796// 797/////////////////////////////////////////////////////////////////////////////////// 798UPluginInstaller.prototype.showChromeInstallFailScreen = function() 799{ 800 addToLogEnter('UPluginInstaller.prototype.showChromeInstallFailScreen() - enter'); 801 802 this.invokeCallback("text_out_start", this.m_currentVersion, "showChromeInstallFailScreen"); 803 var str = this.patchLinks(UPluginInstaller_ChromeFail()); 804 this.m_container.innerHTML = str; 805 806 addToLogExit('UPluginInstaller.prototype.showChromeInstallFailScreen() - exit'); 807} 808 809 810 811/////////////////////////////////////////////////////////////////////////////////// 812// 813// Description 814// Displays AutoInstallFailed UI screen inside provided HTML container 815// 816// Parameters 817// no parameters 818// 819// Return value 820// no return value 821// 822/////////////////////////////////////////////////////////////////////////////////// 823UPluginInstaller.prototype.showAutoInstallFailedScreen = function() 824{ 825 addToLogEnter('UPluginInstaller.prototype.showAutoInstallFailedScreen() - enter'); 826 827 //obtain the UI from a separate include file 828 this.invokeCallback("text_out_start", this.m_currentVersion, "showAutoInstallFailedScreen"); 829 if( this.is_linux ){ 830 var str = this.patchLinks(UPluginInstaller_AutoInstallFailedScreenLinuxGet()); 831 } else { 832 var str = this.patchLinks(UPluginInstaller_AutoInstallFailedScreenGet()); 833 } 834 this.m_container.innerHTML = str; 835 836 addToLogExit('UPluginInstaller.prototype.showAutoInstallFailedScreen() - exit'); 837} 838 839/////////////////////////////////////////////////////////////////////////////////// 840// 841// Description 842// Displays JavaInstallFailed UI screen inside provided HTML container 843// 844// Parameters 845// no parameters 846// 847// Return value 848// no return value 849// 850/////////////////////////////////////////////////////////////////////////////////// 851UPluginInstaller.prototype.showJavaInstallFailedScreen = function() 852{ 853 addToLogEnter('UPluginInstaller.prototype.showJavaInstallFailedScreen() - enter'); 854 855 //obtain the UI from a separate include file 856 this.invokeCallback("text_out_start", this.m_currentVersion, "showJavaInstallFailedScreen"); 857 858 var str = this.patchLinks(UPluginInstaller_JavaInstallFailedScreenGet()); 859 this.m_container.innerHTML = str; 860 861 addToLogExit('UPluginInstaller.prototype.showJavaInstallFailedScreen() - exit'); 862} 863
864/////////////////////////////////////////////////////////////////////////////////// 865// 866// Description 867// Displays AllowPlugin UI screen inside provided HTML container 868// 869// Parameters 870// no parameters 871// 872// Return value 873// no return value 874// 875/////////////////////////////////////////////////////////////////////////////////// 876UPluginInstaller.prototype.showAllowPluginScreen = function() 877{ 878 addToLogEnter('UPluginInstaller.prototype.showAllowPluginScreen() - enter'); 879 880 //obtain the UI from a separate include file 881 this.invokeCallback("text_out_start", this.m_currentVersion, "showAllowPluginScreen"); 882 883 884 if( this.is_linux ){ 885 var str = this.patchLinks(UPluginInstaller_AllowPluginLinuxGet()); 886 } else { 887 var str = this.patchLinks(UPluginInstaller_AllowPluginGet()); 888 } 889 890 this.m_container.innerHTML = str; 891 892 addToLogExit('UPluginInstaller.prototype.showAllowPluginScreen() - exit'); 893} 894 895/////////////////////////////////////////////////////////////////////////////////// 896// 897// Description 898// Event handler for UI 899// 900// Parameters 901// 902// Return value 903// no return value 904// 905/////////////////////////////////////////////////////////////////////////////////// 906UPluginInstaller.prototype.EventHandler = function(a_id, a_function) 907{ 908 addToLogEnter('UPluginInstaller.prototype.EventHandler("'+ a_id + '", "' + a_function+ '") - enter'); 909 910 var _error = ""; 911 var installer; 912 913 try { 914 915 //obtain installer object 916 installer = document.getElementById(a_id).installer; 917 918 //call specified function 919 if("skip" == a_function) { 920 installer.OnSkipInstall(); 921 922 } else if("install" == a_function) { 923 installer.OnDoInstall(); 924 925 } else if("done" == a_function) { 926 installer.OnInstallationDone(); 927 928 } else if("failed" == a_function) { 929 installer.OnInstallationFailed(); 930 931 } else { 932 alert("Unknown event='"+a_function+"'"); 933 } 934 935 } catch(e) { 936 _error = 'EXCEPTION - UPluginInstaller.prototype.EventHandler() '+ e.description; 937 addToLog(_error); 938 } 939 940 //if error occured - call callback function with the error code 941 if(0 != _error.length) { 942 943 try { 944 installer.OnInstallationFailed(); 945 946 } catch(e) { 947 //we really should not be here!!! 948 addToLog('EXCEPTION - UPluginInstaller.prototype.EventHandler() '+ e.description+'\n'+' prev error:'+_error); 949 alert('EXCEPTION - UPluginInstaller.prototype.EventHandler() '+ e.description+'\n'+' prev error:'+_error); 950 } 951 } 952 953 addToLogExit('UPluginInstaller.prototype.EventHandler() - exit'); 954} 955 956/////////////////////////////////////////////////////////////////////////////////// 957// 958// Description 959// Event handler for JavaLauncher applet 960// 961// Parameters 962// 963// Return value 964// no return value 965// 966/////////////////////////////////////////////////////////////////////////////////// 967UPluginInstaller.prototype.JavaInstallerEventHandler = function(a_id, a_result, a_param) 968{ 969 addToLogEnter('UPluginInstaller.prototype.JavaInstallerEventHandler("'+ a_id + '", "' + a_result + '", "' + a_param + '") - enter'); 970 971 var _error = ""; 972 var installer; 973 974 try { 975 976 //obtain installer object 977 installer = document.getElementById(a_id).installer; 978 979 //call specified function 980 if("0" == a_result) { 981 installer.OnInstallationStarted(); 982 983 } else if("error" == a_result) { 984 installer.OnInstallationFailed(); 985 986 } else { 987 installer.OnInstallationFailed(); 988 } 989 990 } catch(e) { 991 _error = 'EXCEPTION - UPluginInstaller.prototype.JavaInstallerEventHandler() '+ e.description; 992 addToLog(_error); 993 } 994 995 //if error occured - call callback function with the error code 996 if(0 != _error.length) { 997 998 try { 999 installer.OnInstallationFailed(); 1000 1001 } catch(e) { 1002 //we really should not be here!!! 1003 addToLog('EXCEPTION - UPluginInstaller.prototype.EventHandler() '+ e.de
1003scription+'\n'+' prev error:'+_error); 1004 alert('EXCEPTION - UPluginInstaller.prototype.EventHandler() '+ e.description+'\n'+' prev error:'+_error); 1005 } 1006 } 1007 1008 addToLogExit('UPluginInstaller.prototype.JavaInstallerEventHandler() - exit'); 1009} 1010 1011//------------------------------------------------------------------------------ 1012// "static" functions 1013//------------------------------------------------------------------------------ 1014 1015UPluginInstaller.getCallbackFuncForPluginObj = function(a_obj, a_methodName) 1016{ 1017 return function(a_id, a_event, a_params) { a_obj[a_methodName](a_id, a_event, a_params); } 1018} 1019 1020/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1021 1022//********************************************************************************* 1023//* 1024//* UPluginHost class 1025//* 1026//********************************************************************************* 1027//* 1028//* Description: 1029//* Used for Windows platform only and allows to host ActiveX controls for non-IE browsers 1030//* using "F5 Networks Firepass Host Plugin" 1031//* 1032//* has two main public methods 1033//* - updateItself() - will try to updated itself to the latest version available on the server (with UI) 1034//* - hostControl(...) - will host specified control 1035//* 1036//* Communicates with the caller through the callback function. 1037//* Callback function can be assigned to "eventHandler" member of the instance 1038//* 1039//* function callbackEvent(a_control_id, a_eventName, a_param) 1040//* where, 1041//* a_control_id - [String] identificator of the object instance (paramtere to constructor) 1042//* a_event_name - [String] name of the event, available events: 1043//* installation_done 1044//* installation_cancelled 1045//* installation_failed
1046//* a_version - [String] contains the version of installed plugin 1047//* if no plugin installed - contains "0.0.0.0" 1048//* a_param - [String] some parameter for event 1049//* 1050//* Notes: 1051//* Requires an HTML conatainer. 1052//* 1053//* Example: 1054//* 1055//* var plugin = new UPluginHost("testPlugin", document.getElementById("pluginDIV")); 1056//* plugin.eventHandler = onControlEvent; 1057//* plugin.updateItself(); 1058//* 1059//* 1060//********************************************************************************* 1061 1062/////////////////////////////////////////////////////////////////////////////////// 1063// 1064// Description 1065// Default constructor 1066// 1067// Parameters 1068// a_name - [String] identificator of the instance of the object, 1069// will be sent to callback function as a paramter 1070// a_container - [Object] HTML container 1071// 1072// Return value 1073// no return value 1074// 1075/////////////////////////////////////////////////////////////////////////////////// 1076function UPluginHost(a_name, a_container) 1077{ 1078 this.m_name = a_name; 1079 this.m_container = a_container; 1080 this.is_chrome = ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 ); 1081 this.is_linux = ( navigator.userAgent.indexOf("Linux") != -1); 1082 1083 this.mimeType = "application/x-f5-host-plugin"; 1084 this.pluginName = "F5 Networks Firepass Host Plugin"; 1085 this.description = "F5 Networks Firepass Host Plugin"; 1086 1087 if (this.is_chrome) { 1088 this.packageURL = "/public/download/urhostplg.crx"; 1089 this.packageManualURL = "/public/download/urhostplg.crx"; 1090 } else { 1091 this.packageURL = "/public/download/urhostplg.xpi"; 1092 this.packageManualURL = "/public/download/urhostplg.zip"; 1093 } 1094 this.latestVersion = "7005.0.0.0"; 1095} 1096 1097 1098UPluginHost.prototype = new UPluginInstaller(); 1099 1100 1101/////////////////////////////////////////////////////////////////////////////////// 1102// 1103// Description 1104// updates itself to the latest available version on the server 1105// 1106// Parameters 1107// no parameters 1108// 1109// Return value 1110// no return value 1111// 1112/////////////////////////////////////////////////////////////////////////////////// 1113UPluginHost.prototype.updateItself = function() 1114{ 1115 addToLogEnter('UPluginHost.prototype.updateItself() - enter'); 1116 1117 if(null == this.eventHandler) { 1118 throw(new Error('UPluginHost.prototype.updateItself() - "eventHandler" is not initialized')); 1119 } 1120 1121 var params = new Array() 1122 params['mime_type'] = this.mimeType; 1123 params['plugin_name'] = this.pluginName; 1124 params['available_version'] = this.latestVersion; 1125 params['package_url'] = this.packageURL; 1126 params['package_manual_url'] = this.packageManualURL; 1127 this.install(params); 1128 1129 addToLogExit('UPluginHost.prototype.updateItself() - exit'); 1130} 1131 1132/////////////////////////////////////////////////////////////////////////////////// 1133// 1134// Description 1135// hosts specified ActiveX control inside itself. 1136// 1137// Parameters 1138// a_control - [Array] array of properties used for <OBJECT> tag, like 'width', 'height', 'CLSID', etc 1139// will be sent to callback function as a paramter 1140// a_params - [Array] array of parameters to pass to ActiveX contorl itself 1141// 1142// Return value 1143// no return value 1144// 1145/////////////////////////////////////////////////////////////////////////////////// 1146UPluginHost.prototype.hostControl = function(a_control, a_params) 1147{ 1148 //generate parameters 1149 var params = ""; 1150 for (var item in a_params) { 1151 params += item + '="' + Base64encode(a_params[item]) + '" '; 1152 } 1153 1154 // set dimension 1155 var _width = ("" != a_control['width']) ? a_control['width'] : 640; 1156 var _height = ("" != a_control['height']) ? a_control['height'] : 480; 1157 1158 // generate code inserting the control 1159 var code = ''+ 1160 ' <EMBED type="' + this.mimeType + '"'+ 1161 ' width=' + _width + 1162 ' height=' + _height + 1163 ' ur_plugin_encoding="BASE64"'+ 1164 ' ID="'+Base64encode(this.m_name)+'"'+ 1165 ' ur_CLSID_HOST="' + Base64encode(a_control['clsid']) + '"' + 1166 ' ur_CODEBASE_HOST="' + Base64encode(getExternalBaseURL() + a_control['codebase'] + '#version=' + a_control['version']) + '"' + 1167 ' ur_OnError="' + Base64encode(this.m_name + "PluginError" ) + '"' + 1168 ' ' + params + 1169 ' >'; 1170 1171 this.m_container.innerHTML = code; 1172} 1173
1174/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1175///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.