toolkit/mozapps/update/nsIUpdateService.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIDOMDocument;
michael@0 9 interface nsIDOMElement;
michael@0 10 interface nsIDOMWindow;
michael@0 11 interface nsIRequest;
michael@0 12 interface nsIRequestObserver;
michael@0 13 interface nsISimpleEnumerator;
michael@0 14 interface nsIXMLHttpRequest;
michael@0 15 interface nsIFile;
michael@0 16
michael@0 17 /**
michael@0 18 * An interface that describes an object representing a patch file that can
michael@0 19 * be downloaded and applied to a version of this application so that it
michael@0 20 * can be updated.
michael@0 21 */
michael@0 22 [scriptable, uuid(dc8fb8a9-3a53-4031-9469-2a5197ea30e7)]
michael@0 23 interface nsIUpdatePatch : nsISupports
michael@0 24 {
michael@0 25 /**
michael@0 26 * The type of this patch:
michael@0 27 * "partial" A binary difference between two application versions
michael@0 28 * "complete" A complete patch containing all of the replacement files
michael@0 29 * to update to the new version
michael@0 30 */
michael@0 31 attribute AString type;
michael@0 32
michael@0 33 /**
michael@0 34 * The URL this patch was being downloaded from
michael@0 35 */
michael@0 36 attribute AString URL;
michael@0 37
michael@0 38 /**
michael@0 39 * The final URL this patch was being downloaded from
michael@0 40 */
michael@0 41 attribute AString finalURL;
michael@0 42
michael@0 43 /**
michael@0 44 * The hash function to use when determining this file's integrity
michael@0 45 */
michael@0 46 attribute AString hashFunction;
michael@0 47
michael@0 48 /**
michael@0 49 * The value of the hash function named above that should be computed if
michael@0 50 * this file is not corrupt.
michael@0 51 */
michael@0 52 attribute AString hashValue;
michael@0 53
michael@0 54 /**
michael@0 55 * The size of this file, in bytes.
michael@0 56 */
michael@0 57 attribute unsigned long size;
michael@0 58
michael@0 59 /**
michael@0 60 * The state of this patch
michael@0 61 */
michael@0 62 attribute AString state;
michael@0 63
michael@0 64 /**
michael@0 65 * true if this patch is currently selected as the patch to be downloaded and
michael@0 66 * installed for this update transaction, false if another patch from this
michael@0 67 * update has been selected.
michael@0 68 */
michael@0 69 attribute boolean selected;
michael@0 70
michael@0 71 /**
michael@0 72 * Serializes this patch object into a DOM Element
michael@0 73 * @param updates
michael@0 74 * The document to serialize into
michael@0 75 * @returns The DOM Element created by the serialization process
michael@0 76 */
michael@0 77 nsIDOMElement serialize(in nsIDOMDocument updates);
michael@0 78 };
michael@0 79
michael@0 80 /**
michael@0 81 * An interface that describes an object representing an available update to
michael@0 82 * the current application - this update may have several available patches
michael@0 83 * from which one must be selected to download and install, for example we
michael@0 84 * might select a binary difference patch first and attempt to apply that,
michael@0 85 * then if the application process fails fall back to downloading a complete
michael@0 86 * file-replace patch. This object also contains information about the update
michael@0 87 * that the front end and other application services can use to learn more
michael@0 88 * about what is going on.
michael@0 89 */
michael@0 90 [scriptable, uuid(6b0b7721-6746-443d-8cb0-c6199d7f28a6)]
michael@0 91 interface nsIUpdate : nsISupports
michael@0 92 {
michael@0 93 /**
michael@0 94 * The type of update:
michael@0 95 * "major" A major new version of the Application
michael@0 96 * "minor" A minor update to the Application (e.g. security update)
michael@0 97 */
michael@0 98 attribute AString type;
michael@0 99
michael@0 100 /**
michael@0 101 * The name of the update, or "<Application Name> <Update Version>"
michael@0 102 */
michael@0 103 attribute AString name;
michael@0 104
michael@0 105 /**
michael@0 106 * The string to display in the user interface for the version. If you want
michael@0 107 * a real version number use appVersion.
michael@0 108 */
michael@0 109 attribute AString displayVersion;
michael@0 110
michael@0 111 /**
michael@0 112 * The Application version of this update.
michael@0 113 */
michael@0 114 attribute AString appVersion;
michael@0 115
michael@0 116 /**
michael@0 117 * The Toolkit version of this update.
michael@0 118 */
michael@0 119 attribute AString platformVersion;
michael@0 120
michael@0 121 /**
michael@0 122 * The Application version prior to the application being updated.
michael@0 123 */
michael@0 124 attribute AString previousAppVersion;
michael@0 125
michael@0 126 /**
michael@0 127 * The Build ID of this update. Used to determine a particular build, down
michael@0 128 * to the hour, minute and second of its creation. This allows the system
michael@0 129 * to differentiate between several nightly builds with the same |version|
michael@0 130 * for example.
michael@0 131 */
michael@0 132 attribute AString buildID;
michael@0 133
michael@0 134 /**
michael@0 135 * The URL to a page which offers details about the content of this
michael@0 136 * update. Ideally, this page is not the release notes but some other page
michael@0 137 * that summarizes the differences between this update and the previous,
michael@0 138 * which also links to the release notes.
michael@0 139 */
michael@0 140 attribute AString detailsURL;
michael@0 141
michael@0 142 /**
michael@0 143 * The URL to a page that is typically localized to display in the update
michael@0 144 * prompt.
michael@0 145 */
michael@0 146 attribute AString billboardURL;
michael@0 147
michael@0 148 /**
michael@0 149 * The URL to a HTML fragment that contains a license for this update. If
michael@0 150 * this is specified, the user is shown the license file after they choose
michael@0 151 * to install the update and they must agree to it before the download
michael@0 152 * commences.
michael@0 153 */
michael@0 154 attribute AString licenseURL;
michael@0 155
michael@0 156 /**
michael@0 157 * The URL to the Update Service that supplied this update.
michael@0 158 */
michael@0 159 attribute AString serviceURL;
michael@0 160
michael@0 161 /**
michael@0 162 * The channel used to retrieve this update from the Update Service.
michael@0 163 */
michael@0 164 attribute AString channel;
michael@0 165
michael@0 166 /**
michael@0 167 * Whether to show the update prompt which requires user confirmation when an
michael@0 168 * update is found during a background update check. This overrides the
michael@0 169 * default setting to download the update in the background.
michael@0 170 */
michael@0 171 attribute boolean showPrompt;
michael@0 172
michael@0 173 /**
michael@0 174 * Whether to show the "No Thanks" button in the update prompt. This allows
michael@0 175 * the user to never receive a notification for that specific update version
michael@0 176 * again.
michael@0 177 */
michael@0 178 attribute boolean showNeverForVersion;
michael@0 179
michael@0 180 /**
michael@0 181 * Whether the update is no longer supported on this system.
michael@0 182 */
michael@0 183 attribute boolean unsupported;
michael@0 184
michael@0 185 /**
michael@0 186 * Allows overriding the default amount of time in seconds before prompting the
michael@0 187 * user to apply an update. If not specified, the value of
michael@0 188 * app.update.promptWaitTime will be used.
michael@0 189 */
michael@0 190 attribute long long promptWaitTime;
michael@0 191
michael@0 192 /**
michael@0 193 * Whether or not the update being downloaded is a complete replacement of
michael@0 194 * the user's existing installation or a patch representing the difference
michael@0 195 * between the new version and the previous version.
michael@0 196 */
michael@0 197 attribute boolean isCompleteUpdate;
michael@0 198
michael@0 199 /**
michael@0 200 * Whether or not the update is a security update or not. If this is true,
michael@0 201 * then we present more serious sounding user interface messages to the
michael@0 202 * user.
michael@0 203 */
michael@0 204 attribute boolean isSecurityUpdate;
michael@0 205
michael@0 206 /**
michael@0 207 * Whether or not the update being downloaded is an OS update. This is
michael@0 208 * generally only possible in Gonk right now.
michael@0 209 */
michael@0 210 attribute boolean isOSUpdate;
michael@0 211
michael@0 212 /**
michael@0 213 * When the update was installed.
michael@0 214 */
michael@0 215 attribute long long installDate;
michael@0 216
michael@0 217 /**
michael@0 218 * A message associated with this update, if any.
michael@0 219 */
michael@0 220 attribute AString statusText;
michael@0 221
michael@0 222 /**
michael@0 223 * The currently selected patch for this update.
michael@0 224 */
michael@0 225 readonly attribute nsIUpdatePatch selectedPatch;
michael@0 226
michael@0 227 /**
michael@0 228 * The state of the selected patch:
michael@0 229 * "downloading" The update is being downloaded.
michael@0 230 * "pending" The update is ready to be applied.
michael@0 231 * "pending-service" The update is ready to be applied with the service.
michael@0 232 * "applying" The update is being applied.
michael@0 233 * "applied" The update is ready to be switched to.
michael@0 234 * "applied-os" The update is OS update and to be installed.
michael@0 235 * "applied-service" The update is ready to be switched to with the service.
michael@0 236 * "succeeded" The update was successfully applied.
michael@0 237 * "download-failed" The update failed to be downloaded.
michael@0 238 * "failed" The update failed to be applied.
michael@0 239 */
michael@0 240 attribute AString state;
michael@0 241
michael@0 242 /**
michael@0 243 * A numeric error code that conveys additional information about the state
michael@0 244 * of a failed update or failed certificate attribute check during an update
michael@0 245 * check. If the update is not in the "failed" state or the certificate
michael@0 246 * attribute check has not failed the value is zero.
michael@0 247 *
michael@0 248 * TODO: Define typical error codes (for now, see updater/errors.h and the
michael@0 249 * CERT_ATTR_CHECK_FAILED_* values in nsUpdateService.js)
michael@0 250 */
michael@0 251 attribute long errorCode;
michael@0 252
michael@0 253 /**
michael@0 254 * The number of patches supplied by this update.
michael@0 255 */
michael@0 256 readonly attribute unsigned long patchCount;
michael@0 257
michael@0 258 /**
michael@0 259 * Retrieves a patch.
michael@0 260 * @param index
michael@0 261 * The index of the patch to retrieve.
michael@0 262 * @returns The nsIUpdatePatch at the specified index.
michael@0 263 */
michael@0 264 nsIUpdatePatch getPatchAt(in unsigned long index);
michael@0 265
michael@0 266 /**
michael@0 267 * Serializes this update object into a DOM Element
michael@0 268 * @param updates
michael@0 269 * The document to serialize into
michael@0 270 * @returns The DOM Element created by the serialization process
michael@0 271 */
michael@0 272 nsIDOMElement serialize(in nsIDOMDocument updates);
michael@0 273 };
michael@0 274
michael@0 275 /**
michael@0 276 * An interface describing an object that listens to the progress of an update
michael@0 277 * check operation. This object is notified as the check continues, finishes
michael@0 278 * and if it has an error.
michael@0 279 */
michael@0 280 [scriptable, uuid(4aa2b4bb-39ea-407b-98ff-89f19134d4c0)]
michael@0 281 interface nsIUpdateCheckListener : nsISupports
michael@0 282 {
michael@0 283 /**
michael@0 284 * The update check was completed.
michael@0 285 * @param request
michael@0 286 * The nsIXMLHttpRequest handling the update check.
michael@0 287 * @param updates
michael@0 288 * An array of nsIUpdate objects listing available updates.
michael@0 289 * @param updateCount
michael@0 290 * The size of the |updates| array.
michael@0 291 */
michael@0 292 void onCheckComplete(in nsIXMLHttpRequest request,
michael@0 293 [array, size_is(updateCount)] in nsIUpdate updates,
michael@0 294 in unsigned long updateCount);
michael@0 295
michael@0 296 /**
michael@0 297 * An error occurred while loading the remote update service file.
michael@0 298 * @param request
michael@0 299 * The nsIXMLHttpRequest handling the update check.
michael@0 300 * @param update
michael@0 301 * A nsIUpdate object that contains details about the
michael@0 302 * error in its |statusText| property.
michael@0 303 */
michael@0 304 void onError(in nsIXMLHttpRequest request,
michael@0 305 in nsIUpdate update);
michael@0 306 };
michael@0 307
michael@0 308 /**
michael@0 309 * An interface describing an object that knows how to check for updates.
michael@0 310 */
michael@0 311 [scriptable, uuid(877ace25-8bc5-452a-8586-9c1cf2871994)]
michael@0 312 interface nsIUpdateChecker : nsISupports
michael@0 313 {
michael@0 314 /**
michael@0 315 * Checks for available updates, notifying a listener of the results.
michael@0 316 * @param listener
michael@0 317 * An object implementing nsIUpdateCheckListener which is notified
michael@0 318 * of the results of an update check.
michael@0 319 * @param force
michael@0 320 * Forces the checker to check for updates, regardless of the
michael@0 321 * current value of the user's update settings. This is used by
michael@0 322 * any piece of UI that offers the user the imperative option to
michael@0 323 * check for updates now, regardless of their update settings.
michael@0 324 * force will not work if the system administrator has locked
michael@0 325 * the app.update.enabled preference.
michael@0 326 */
michael@0 327 void checkForUpdates(in nsIUpdateCheckListener listener, in boolean force);
michael@0 328
michael@0 329 /**
michael@0 330 * Constants for the |stopChecking| function that tell the Checker how long
michael@0 331 * to stop checking:
michael@0 332 *
michael@0 333 * CURRENT_CHECK: Stops the current (active) check only
michael@0 334 * CURRENT_SESSION: Stops all checking for the current session
michael@0 335 * ANY_CHECKS: Stops all checking, any session from now on
michael@0 336 * (disables update checking preferences)
michael@0 337 */
michael@0 338 const unsigned short CURRENT_CHECK = 1;
michael@0 339 const unsigned short CURRENT_SESSION = 2;
michael@0 340 const unsigned short ANY_CHECKS = 3;
michael@0 341
michael@0 342 /**
michael@0 343 * Ends any pending update check.
michael@0 344 * @param duration
michael@0 345 * A value representing the set of checks to stop doing.
michael@0 346 */
michael@0 347 void stopChecking(in unsigned short duration);
michael@0 348 };
michael@0 349
michael@0 350 /**
michael@0 351 * An interface describing a global application service that handles performing
michael@0 352 * background update checks and provides utilities for selecting and
michael@0 353 * downloading update patches.
michael@0 354 */
michael@0 355 [scriptable, uuid(9f9b51f5-340e-47ce-85ae-9eb077c6cd39)]
michael@0 356 interface nsIApplicationUpdateService : nsISupports
michael@0 357 {
michael@0 358 /**
michael@0 359 * Checks for available updates in the background using the listener provided
michael@0 360 * by the application update service for background checks.
michael@0 361 */
michael@0 362 void checkForBackgroundUpdates();
michael@0 363
michael@0 364 /**
michael@0 365 * The Update Checker used for background update checking.
michael@0 366 */
michael@0 367 readonly attribute nsIUpdateChecker backgroundChecker;
michael@0 368
michael@0 369 /**
michael@0 370 * Selects the best update to install from a list of available updates.
michael@0 371 * @param updates
michael@0 372 * An array of updates that are available
michael@0 373 * @param updateCount
michael@0 374 * The length of the |updates| array
michael@0 375 */
michael@0 376 nsIUpdate selectUpdate([array, size_is(updateCount)] in nsIUpdate updates,
michael@0 377 in unsigned long updateCount);
michael@0 378
michael@0 379 /**
michael@0 380 * Adds a listener that receives progress and state information about the
michael@0 381 * update that is currently being downloaded, e.g. to update a user
michael@0 382 * interface.
michael@0 383 * @param listener
michael@0 384 * An object implementing nsIRequestObserver and optionally
michael@0 385 * nsIProgressEventSink that is to be notified of state and
michael@0 386 * progress information as the update is downloaded.
michael@0 387 */
michael@0 388 void addDownloadListener(in nsIRequestObserver listener);
michael@0 389
michael@0 390 /**
michael@0 391 * Removes a listener that is receiving progress and state information
michael@0 392 * about the update that is currently being downloaded.
michael@0 393 * @param listener
michael@0 394 * The listener object to remove.
michael@0 395 */
michael@0 396 void removeDownloadListener(in nsIRequestObserver listener);
michael@0 397
michael@0 398 /**
michael@0 399 *
michael@0 400 */
michael@0 401 AString downloadUpdate(in nsIUpdate update, in boolean background);
michael@0 402
michael@0 403 /**
michael@0 404 * Apply the OS update which has been downloaded and staged as applied.
michael@0 405 * @param update
michael@0 406 * The update has been downloaded and staged as applied.
michael@0 407 * @throws if the update object is not an OS update.
michael@0 408 */
michael@0 409 void applyOsUpdate(in nsIUpdate update);
michael@0 410
michael@0 411 /**
michael@0 412 * Get the Active Updates directory
michael@0 413 * @returns An nsIFile for the active updates directory.
michael@0 414 */
michael@0 415 nsIFile getUpdatesDirectory();
michael@0 416
michael@0 417 /**
michael@0 418 * Pauses the active update download process
michael@0 419 */
michael@0 420 void pauseDownload();
michael@0 421
michael@0 422 /**
michael@0 423 * Whether or not there is an download happening at the moment.
michael@0 424 */
michael@0 425 readonly attribute boolean isDownloading;
michael@0 426
michael@0 427 /**
michael@0 428 * Whether or not the Update Service can check for updates. This is a function
michael@0 429 * of whether or not application update is disabled by the application and the
michael@0 430 * platform the application is running on.
michael@0 431 */
michael@0 432 readonly attribute boolean canCheckForUpdates;
michael@0 433
michael@0 434 /**
michael@0 435 * Whether or not the Update Service can download and install updates.
michael@0 436 * On Windows, this is a function of whether or not the maintenance service
michael@0 437 * is installed and enabled. On other systems, and as a fallback on Windows,
michael@0 438 * this depends on whether the current user has write access to the install
michael@0 439 * directory.
michael@0 440 */
michael@0 441 readonly attribute boolean canApplyUpdates;
michael@0 442
michael@0 443 /**
michael@0 444 * Whether or not a different instance is handling updates of this
michael@0 445 * installation. This currently only ever returns true on Windows
michael@0 446 * when 2 instances of an application are open or when both the Metro
michael@0 447 * and Desktop browsers are open. Only one of the instances will actually
michael@0 448 * handle updates for the installation.
michael@0 449 */
michael@0 450 readonly attribute boolean isOtherInstanceHandlingUpdates;
michael@0 451
michael@0 452 /**
michael@0 453 * Whether the Update Service is able to stage updates.
michael@0 454 */
michael@0 455 readonly attribute boolean canStageUpdates;
michael@0 456 };
michael@0 457
michael@0 458 /**
michael@0 459 * An interface describing a component which handles the job of processing
michael@0 460 * an update after it's been downloaded.
michael@0 461 */
michael@0 462 [scriptable, uuid(74439497-d796-4915-8cef-3dfe43027e4d)]
michael@0 463 interface nsIUpdateProcessor : nsISupports
michael@0 464 {
michael@0 465 /**
michael@0 466 * Processes the update which has been downloaded.
michael@0 467 * This happens without restarting the application.
michael@0 468 * On Windows, this can also be used for switching to an applied
michael@0 469 * update request.
michael@0 470 * @param update The update being applied, or null if this is a switch
michael@0 471 * to updated application request. Must be non-null on GONK.
michael@0 472 */
michael@0 473 void processUpdate(in nsIUpdate update);
michael@0 474 };
michael@0 475
michael@0 476 /**
michael@0 477 * An interface describing a global application service that maintains a list
michael@0 478 * of updates previously performed as well as the current active update.
michael@0 479 */
michael@0 480 [scriptable, uuid(c5df56de-919d-406b-aaf9-106dfa9b685b)]
michael@0 481 interface nsIUpdateManager : nsISupports
michael@0 482 {
michael@0 483 /**
michael@0 484 * Gets the update at the specified index
michael@0 485 * @param index
michael@0 486 * The index within the updates array
michael@0 487 * @returns The nsIUpdate object at the specified index
michael@0 488 */
michael@0 489 nsIUpdate getUpdateAt(in long index);
michael@0 490
michael@0 491 /**
michael@0 492 * Gets the total number of updates in the history list.
michael@0 493 */
michael@0 494 readonly attribute long updateCount;
michael@0 495
michael@0 496 /**
michael@0 497 * The active (current) update. The active update is not in the history list.
michael@0 498 */
michael@0 499 attribute nsIUpdate activeUpdate;
michael@0 500
michael@0 501 /**
michael@0 502 * Saves all updates to disk.
michael@0 503 */
michael@0 504 void saveUpdates();
michael@0 505
michael@0 506 /**
michael@0 507 * Refresh the update status based on the information in update.status.
michael@0 508 */
michael@0 509 void refreshUpdateStatus(in nsIUpdate update);
michael@0 510 };
michael@0 511
michael@0 512 /**
michael@0 513 * An interface describing an object that can show various kinds of Update
michael@0 514 * notification UI to the user.
michael@0 515 */
michael@0 516 [scriptable, uuid(599fd3c6-ec68-4499-ada5-2997739c97a6)]
michael@0 517 interface nsIUpdatePrompt : nsISupports
michael@0 518 {
michael@0 519 /**
michael@0 520 * Shows the application update checking user interface and checks if there
michael@0 521 * is an update available.
michael@0 522 */
michael@0 523 void checkForUpdates();
michael@0 524
michael@0 525 /**
michael@0 526 * Shows the application update available user interface advising that an
michael@0 527 * update is available for download and install. If the app.update.silent
michael@0 528 * preference is true or the user interface is already displayed the call will
michael@0 529 * be a no-op.
michael@0 530 * @param update
michael@0 531 * The nsIUpdate object to be downloaded and installed
michael@0 532 */
michael@0 533 void showUpdateAvailable(in nsIUpdate update);
michael@0 534
michael@0 535 /**
michael@0 536 * Shows the application update downloaded user interface advising that an
michael@0 537 * update has now been downloaded and a restart is necessary to complete the
michael@0 538 * update. If background is true (e.g. the download was not user initiated)
michael@0 539 * and the app.update.silent preference is true the call will be a no-op.
michael@0 540 * @param update
michael@0 541 * The nsIUpdate object that was downloaded
michael@0 542 * @param background
michael@0 543 * Less obtrusive UI, starting with a non-modal notification alert
michael@0 544 */
michael@0 545 void showUpdateDownloaded(in nsIUpdate update,
michael@0 546 [optional] in boolean background);
michael@0 547
michael@0 548 /**
michael@0 549 * Shows the application update installed user interface advising that an
michael@0 550 * update was installed successfully. If the app.update.silent preference is
michael@0 551 * true, the app.update.showInstalledUI preference is false, or the user
michael@0 552 * interface is already displayed the call will be a no-op.
michael@0 553 */
michael@0 554 void showUpdateInstalled();
michael@0 555
michael@0 556 /**
michael@0 557 * Shows the application update error user interface advising that an error
michael@0 558 * occurred while checking for or applying an update. If the app.update.silent
michael@0 559 * preference is true the call will be a no-op.
michael@0 560 * @param update
michael@0 561 * An nsIUpdate object representing the update that could not be
michael@0 562 * installed. The nsIUpdate object will not be the actual update when
michael@0 563 * the error occurred during an update check and will instead be an
michael@0 564 * nsIUpdate object with the error information for the update check.
michael@0 565 */
michael@0 566 void showUpdateError(in nsIUpdate update);
michael@0 567
michael@0 568 /**
michael@0 569 * Shows a list of all updates installed to date.
michael@0 570 * @param parent
michael@0 571 * An nsIDOMWindow to set as the parent for this window. Can be null.
michael@0 572 */
michael@0 573 void showUpdateHistory(in nsIDOMWindow parent);
michael@0 574 };

mercurial