Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (250148 => 250149)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-09-20 20:49:47 UTC (rev 250149)
@@ -1,3 +1,32 @@
+2019-09-20 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: Remove BranchManager in favor of just using currentRevision
+ https://bugs.webkit.org/show_bug.cgi?id=202000
+
+ Reviewed by Devin Rousso.
+
+ Remove BranchManager. The Branch concept never got fleshed out, and would
+ likely be too complex for the average case. Local Overrides are simpler.
+ In the interest of expanding Local Overrides to more content lets simply
+ by removing Branches.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Base/Main.js:
+ (WI.loaded):
+ * UserInterface/Controllers/BranchManager.js: Removed.
+ * UserInterface/Controllers/CSSManager.js:
+ (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound):
+ (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges):
+ (WI.CSSManager.prototype._resourceContentDidChange):
+ (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
+ * UserInterface/Main.html:
+ * UserInterface/Models/Branch.js: Removed.
+ * UserInterface/Models/SourceCode.js:
+ (WI.SourceCode.prototype._processContent):
+ (WI.SourceCode):
+ * UserInterface/Views/TextResourceContentView.js:
+ (WI.TextResourceContentView.prototype._textEditorContentDidChange):
+
2019-09-20 Truitt Savell <tsav...@apple.com>
Unreviewed, rolling out r250114.
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -773,7 +773,6 @@
localizedStrings["Open in New Tab"] = "Open in New Tab";
localizedStrings["Option-click to show source"] = "Option-click to show source";
localizedStrings["Options"] = "Options";
-localizedStrings["Original"] = "Original";
localizedStrings["Original formatting"] = "Original formatting";
localizedStrings["Originally %s"] = "Originally %s";
localizedStrings["Originator"] = "Originator";
@@ -1013,7 +1012,6 @@
localizedStrings["Show Grid"] = "Show Grid";
localizedStrings["Show Icons"] = "Show Icons";
localizedStrings["Show Jump to Effective Property Button"] = "Show Jump to Effective Property Button";
-localizedStrings["Show More"] = "Show More";
localizedStrings["Show Path"] = "Show Path";
localizedStrings["Show Remaining (%d)"] = "Show Remaining (%d)";
localizedStrings["Show Scope Chain on pause"] = "Show Scope Chain on pause";
@@ -1256,7 +1254,6 @@
localizedStrings["Worker Threads"] = "Worker Threads";
localizedStrings["Worker \u2014 %s"] = "Worker \u2014 %s";
localizedStrings["Worker: %s"] = "Worker: %s";
-localizedStrings["Working Copy"] = "Working Copy";
localizedStrings["Wrap lines to editor width"] = "Wrap lines to editor width";
localizedStrings["XBM"] = "XBM";
localizedStrings["XHR"] = "XHR";
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -103,7 +103,6 @@
// as event listeners on these managers.
WI.managers = [
WI.targetManager = new WI.TargetManager,
- WI.branchManager = new WI.BranchManager,
WI.networkManager = new WI.NetworkManager,
WI.domStorageManager = new WI.DOMStorageManager,
WI.databaseManager = new WI.DatabaseManager,
Deleted: trunk/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WI.BranchManager = class BranchManager extends WI.Object
-{
- constructor()
- {
- super();
-
- WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-
- this.initialize();
- }
-
- // Public
-
- initialize()
- {
- this._originalBranch = new WI.Branch(WI.UIString("Original"), null, true);
- this._currentBranch = this._originalBranch.fork(WI.UIString("Working Copy"));
- this._branches = [this._originalBranch, this._currentBranch];
- }
-
- get branches()
- {
- return this._branches;
- }
-
- get currentBranch()
- {
- return this._currentBranch;
- }
-
- set currentBranch(branch)
- {
- console.assert(branch instanceof WI.Branch);
- if (!(branch instanceof WI.Branch))
- return;
-
- this._currentBranch.revert();
-
- this._currentBranch = branch;
-
- this._currentBranch.apply();
- }
-
- createBranch(displayName, fromBranch)
- {
- if (!fromBranch)
- fromBranch = this._originalBranch;
-
- console.assert(fromBranch instanceof WI.Branch);
- if (!(fromBranch instanceof WI.Branch))
- return null;
-
- var newBranch = fromBranch.fork(displayName);
- this._branches.push(newBranch);
- return newBranch;
- }
-
- deleteBranch(branch)
- {
- console.assert(branch instanceof WI.Branch);
- if (!(branch instanceof WI.Branch))
- return;
-
- console.assert(branch !== this._originalBranch);
- if (branch === this._originalBranch)
- return;
-
- this._branches.remove(branch);
-
- if (branch === this._currentBranch)
- this._currentBranch = this._originalBranch;
- }
-
- // Private
-
- _mainResourceDidChange(event)
- {
- console.assert(event.target instanceof WI.Frame);
-
- if (!event.target.isMainFrame())
- return;
-
- this.initialize();
- }
-};
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -655,7 +655,8 @@
// ignore the next _updateResourceContent call.
resource.__ignoreNextUpdateResourceContent = true;
- WI.branchManager.currentBranch.revisionForRepresentedObject(styleSheet).content = resource.content;
+ let revision = styleSheet.currentRevision;
+ revision.content = resource.content;
}
this._lookupStyleSheetForResource(resource, styleSheetFound.bind(this));
@@ -698,7 +699,7 @@
this._ignoreResourceContentDidChangeEventForResource = representedObject;
- let revision = WI.branchManager.currentBranch.revisionForRepresentedObject(representedObject);
+ let revision = representedObject.currentRevision;
if (styleSheet.isInspectorStyleSheet()) {
revision.content = representedObject.content;
styleSheet.dispatchEventToListeners(WI.SourceCode.Event.ContentDidChange);
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2019-09-20 20:49:47 UTC (rev 250149)
@@ -361,7 +361,6 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
<script src=""
<script src=""
@@ -857,7 +856,6 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
<script src=""
<script src=""
Deleted: trunk/Source/WebInspectorUI/UserInterface/Models/Branch.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Branch.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Branch.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WI.Branch = class Branch
-{
- constructor(displayName, revisions, locked)
- {
- console.assert(displayName);
-
- this._displayName = displayName;
- this._revisions = revisions instanceof Array ? revisions.slice() : [];
- this._locked = locked || false;
- }
-
- // Public
-
- get displayName()
- {
- return this._displayName;
- }
-
- set displayName(displayName)
- {
- console.assert(displayName);
- if (!displayName)
- return;
-
- this._displayName = displayName;
- }
-
- get revisions()
- {
- return this._revisions;
- }
-
- get locked()
- {
- return this._locked;
- }
-
- revisionForRepresentedObject(representedObject, doNotCreateIfNeeded)
- {
- for (var i = 0; i < this._revisions.length; ++i) {
- var revision = this._revisions[i];
- if (revision instanceof WI.SourceCodeRevision && revision.sourceCode === representedObject)
- return revision;
- }
-
- if (doNotCreateIfNeeded)
- return null;
-
- if (representedObject instanceof WI.SourceCode) {
- var revision = representedObject.originalRevision.copy();
- representedObject.currentRevision = revision;
- this.addRevision(revision);
- return revision;
- }
-
- return null;
- }
-
- addRevision(revision)
- {
- console.assert(revision instanceof WI.Revision);
-
- if (this._locked)
- return;
-
- if (this._revisions.includes(revision))
- return;
-
- this._revisions.push(revision);
- }
-
- removeRevision(revision)
- {
- console.assert(revision instanceof WI.Revision);
-
- if (this._locked)
- return;
-
- this._revisions.remove(revision);
- }
-
- reset()
- {
- if (this._locked)
- return;
-
- this._revisions = [];
- }
-
- fork(displayName)
- {
- var copiedRevisions = this._revisions.map(function(revision) { return revision.copy(); });
- return new WI.Branch(displayName, copiedRevisions);
- }
-
- apply()
- {
- for (var i = 0; i < this._revisions.length; ++i)
- this._revisions[i].apply();
- }
-
- revert()
- {
- for (var i = this._revisions.length - 1; i >= 0; --i)
- this._revisions[i].revert();
- }
-
- lock()
- {
- console.assert(!this._locked);
- this._locked = true;
- }
-
- unlock()
- {
- console.assert(this._locked);
- this._locked = false;
- }
-};
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -227,6 +227,7 @@
let content = rawContent;
let error = parameters.error;
let message = parameters.message;
+
if (parameters.base64Encoded)
content = content ? decodeBase64ToBlob(content, this.mimeType) : "";
@@ -236,6 +237,9 @@
revision.content = content || null;
this._ignoreRevisionContentDidChangeEvent = false;
+ if (this._currentRevision === this._originalRevision)
+ this.currentRevision = this._originalRevision.copy();
+
// FIXME: Returning the content in this promise is misleading. It may not be current content
// now, and it may become out-dated later on. We should drop content from this promise
// and require clients to ask for the current contents from the sourceCode in the result.
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js (250148 => 250149)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-09-20 20:36:57 UTC (rev 250148)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-09-20 20:49:47 UTC (rev 250149)
@@ -340,7 +340,7 @@
_textEditorContentDidChange(event)
{
this._ignoreSourceCodeContentDidChangeEvent = true;
- WI.branchManager.currentBranch.revisionForRepresentedObject(this.resource).content = this._textEditor.string;
+ this.resource.currentRevision.content = this._textEditor.string;
this._ignoreSourceCodeContentDidChangeEvent = false;
}