home *** CD-ROM | disk | FTP | other *** search
/ Computer Active Guide 2009 July / CAG7.ISO / Internetas / SafariSetup.exe / AppleApplicationSupport.msi / WebKit.resources_inspector_Breakpoint.js < prev    next >
Encoding:
Text File  |  2010-06-03  |  2.8 KB  |  97 lines

  1. /*
  2.  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
  3.  *
  4.  * Redistribution and use in source and binary forms, with or without
  5.  * modification, are permitted provided that the following conditions
  6.  * are met:
  7.  * 1. Redistributions of source code must retain the above copyright
  8.  *    notice, this list of conditions and the following disclaimer.
  9.  * 2. Redistributions in binary form must reproduce the above copyright
  10.  *    notice, this list of conditions and the following disclaimer in the
  11.  *    documentation and/or other materials provided with the distribution.
  12.  *
  13.  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
  14.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16.  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
  17.  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20.  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21.  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24.  */
  25.  
  26. WebInspector.Breakpoint = function(url, line, sourceID, condition)
  27. {
  28.     this.url = url;
  29.     this.line = line;
  30.     this.sourceID = sourceID;
  31.     this._enabled = true;
  32.     this._sourceText = "";
  33.     this._condition = condition || "";
  34. }
  35.  
  36. WebInspector.Breakpoint.prototype = {
  37.     get enabled()
  38.     {
  39.         return this._enabled;
  40.     },
  41.  
  42.     set enabled(x)
  43.     {
  44.         if (this._enabled === x)
  45.             return;
  46.  
  47.         this._enabled = x;
  48.  
  49.         if (this._enabled)
  50.             this.dispatchEventToListeners("enabled");
  51.         else
  52.             this.dispatchEventToListeners("disabled");
  53.     },
  54.  
  55.     get sourceText()
  56.     {
  57.         return this._sourceText;
  58.     },
  59.  
  60.     set sourceText(text)
  61.     {
  62.         this._sourceText = text;
  63.         this.dispatchEventToListeners("text-changed");
  64.     },
  65.  
  66.     get label()
  67.     {
  68.         var displayName = (this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"));
  69.         return displayName + ":" + this.line;
  70.     },
  71.  
  72.     get id()
  73.     {
  74.         return this.sourceID + ":" + this.line;
  75.     },
  76.  
  77.     get condition()
  78.     {
  79.         return this._condition;
  80.     },
  81.  
  82.     set condition(c)
  83.     {
  84.         c = c || "";
  85.         if (this._condition === c)
  86.             return;
  87.  
  88.         this._condition = c;
  89.         this.dispatchEventToListeners("condition-changed");
  90.  
  91.         if (this.enabled)
  92.             InspectorBackend.setBreakpoint(this.sourceID, this.line, this.enabled, this.condition);
  93.     }
  94. }
  95.  
  96. WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
  97.