diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c907d80..771c4ec 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2017-08-01  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: simplify WebInspector with WI
+        https://bugs.webkit.org/show_bug.cgi?id=175058
+
+        Reviewed by Joseph Pecoraro.
+
+        * http/tests/inspector/**/*.html:
+        * http/tests/websocket/tests/hybi/inspector/**/*.html:
+        * inspector/**/*.html:
+
 2017-08-01  Matt Lewis  <jlewis3@apple.com>
 
         Added expectations files for El Capitan.
diff --git a/LayoutTests/http/tests/inspector/console/cross-domain-inspected-node-access.html b/LayoutTests/http/tests/inspector/console/cross-domain-inspected-node-access.html
index 0911f8e..b0d0f49 100644
--- a/LayoutTests/http/tests/inspector/console/cross-domain-inspected-node-access.html
+++ b/LayoutTests/http/tests/inspector/console/cross-domain-inspected-node-access.html
@@ -7,7 +7,7 @@
 {
     let suite = InspectorTest.createAsyncSuite("CommandLineAPI.$0.cross-frame");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
     let childFrames = mainFrame.childFrameCollection.toArray();
     InspectorTest.expectEqual(childFrames.length, 1, "Page should have a subframe.");
 
@@ -23,7 +23,7 @@
             RuntimeAgent.evaluate.invoke({expression: "$0", includeCommandLineAPI: true}, (error, remoteObjectPayload, wasThrown) => {    
                 InspectorTest.assert(!error, "Should not be a protocol error.");
                 InspectorTest.assert(!wasThrown, "Should not be an exception.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(remoteObject.value === null, "MainFrame access to $0 node in subframe should be null.");
                 resolve();
             });
@@ -39,7 +39,7 @@
             RuntimeAgent.evaluate.invoke({expression: "$0", includeCommandLineAPI: true}, (error, remoteObjectPayload, wasThrown) => {
                 InspectorTest.assert(!error, "Should not be a protocol error.");
                 InspectorTest.assert(!wasThrown, "Should not be an exception.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(remoteObject.isNode(), "MainFrame access to $0 node in main frame should be a node.");
                 resolve();
             });
@@ -55,7 +55,7 @@
             RuntimeAgent.evaluate.invoke({expression: "$0", includeCommandLineAPI: true, contextId: childFrames[0].pageExecutionContext.id}, (error, remoteObjectPayload, wasThrown) => {
                 InspectorTest.assert(!error, "Should not be a protocol error.");
                 InspectorTest.assert(!wasThrown, "Should not be an exception.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(remoteObject.value === null, "SubFrame access to $0 node in main frame should be null.");
                 resolve();
             });
@@ -71,18 +71,18 @@
             RuntimeAgent.evaluate.invoke({expression: "$0", includeCommandLineAPI: true, contextId: childFrames[0].pageExecutionContext.id}, (error, remoteObjectPayload, wasThrown) => {
                 InspectorTest.assert(!error, "Should not be a protocol error.");
                 InspectorTest.assert(!wasThrown, "Should not be an exception.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(remoteObject.isNode(), "SubFrame access to $0 node in sub frame should be a node.");
                 resolve();
             });
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "iframe#myframe", (nodeId) => {
-            let iframeNode = WebInspector.domTreeManager.nodeForId(nodeId);
+    WI.domTreeManager.requestDocument((documentNode) => {
+        WI.domTreeManager.querySelector(documentNode.id, "iframe#myframe", (nodeId) => {
+            let iframeNode = WI.domTreeManager.nodeForId(nodeId);
             let iframeDocumentNodeId = iframeNode.children[0].id;
-            WebInspector.domTreeManager.querySelector(iframeDocumentNodeId, "div#rootDiv", (nodeId) => {
+            WI.domTreeManager.querySelector(iframeDocumentNodeId, "div#rootDiv", (nodeId) => {
                 nodeInMainFrameId = iframeNode.id;
                 nodeInSubFrameId = nodeId;
                 suite.runTestCasesAndFinish();
diff --git a/LayoutTests/http/tests/inspector/debugger/debugger-test.js b/LayoutTests/http/tests/inspector/debugger/debugger-test.js
index 74da92e..aabad5b 100644
--- a/LayoutTests/http/tests/inspector/debugger/debugger-test.js
+++ b/LayoutTests/http/tests/inspector/debugger/debugger-test.js
@@ -2,48 +2,48 @@
 
 InspectorTest.startTracingBreakpoints = function()
 {
-    if (!WebInspector.debuggerManager)
+    if (!WI.debuggerManager)
         return;
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, function(event) {
         InspectorTest.log("Breakpoint was added.");
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointRemoved, function(event) {
         InspectorTest.log("Breakpoint was removed.");
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisabledStateDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint disabled state changed: " + breakpoint.disabled);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ResolvedStateDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint resolved state changed: " + breakpoint.resolved);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.AutoContinueDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint autocontinue state changed: " + breakpoint.autoContinue);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ConditionDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ConditionDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint condition changed: " + breakpoint.condition);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ActionsDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint actions changed. New count: " + breakpoint.actions.length);
     });
@@ -51,61 +51,61 @@
 
 InspectorTest.startTracingProbes = function()
 {
-    if (!WebInspector.probeManager)
+    if (!WI.probeManager)
         return;
 
-    WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetAdded, function(event) {
+    WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetAdded, function(event) {
         var probeSet = event.data.probeSet;
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
-        InspectorTest.log("Probe set was added. New count: " + WebInspector.probeManager.probeSets.length);
+        InspectorTest.log("Probe set was added. New count: " + WI.probeManager.probeSets.length);
     });
 
-    WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetRemoved, function(event) {
+    WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetRemoved, function(event) {
         var probeSet = event.data.probeSet;
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
-        InspectorTest.log("Probe set was removed. New count: " + WebInspector.probeManager.probeSets.length);
+        InspectorTest.log("Probe set was removed. New count: " + WI.probeManager.probeSets.length);
     });
 
-    WebInspector.Probe.addEventListener(WebInspector.Probe.Event.ExpressionChanged, function(event) {
+    WI.Probe.addEventListener(WI.Probe.Event.ExpressionChanged, function(event) {
         var probe = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " changed expression: " + probe.expression);
     });
 
-    WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SampleAdded, function(event) {
+    WI.Probe.addEventListener(WI.Probe.Event.SampleAdded, function(event) {
         var probe = event.target;
         var sample = event.data;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
-        console.assert(sample instanceof WebInspector.ProbeSample, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
+        console.assert(sample instanceof WI.ProbeSample, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " added sample: " + sample);
     });
 
-    WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SamplesCleared, function(event) {
+    WI.Probe.addEventListener(WI.Probe.Event.SamplesCleared, function(event) {
         var probe = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " cleared all samples.");
     });
 
-    WebInspector.ProbeSet.addEventListener(WebInspector.ProbeSet.Event.ProbeAdded, function(event) {
+    WI.ProbeSet.addEventListener(WI.ProbeSet.Event.ProbeAdded, function(event) {
         var probe = event.data;
         var probeSet = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " was added to probe set.");
         InspectorTest.log("Probe set's probe count: " + probeSet.probes.length);
     });
 
-    WebInspector.ProbeSet.addEventListener(WebInspector.ProbeSet.Event.ProbeRemoved, function(event) {
+    WI.ProbeSet.addEventListener(WI.ProbeSet.Event.ProbeRemoved, function(event) {
         var probe = event.data;
         var probeSet = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " was removed from probe set.");
         InspectorTest.log("Probe set's probe count: " + probeSet.probes.length);
diff --git a/LayoutTests/http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html b/LayoutTests/http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html
index 90062a1..9ef1c68 100644
--- a/LayoutTests/http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html
+++ b/LayoutTests/http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html
@@ -11,7 +11,7 @@
         name: "CheckLazyInitializationOfDOMTree",
         description: "Check that DOMTree instances are created lazily.",
         test(resolve, reject) {
-            let instances = WebInspector.domTreeManager.retainedObjectsWithPrototype(WebInspector.DOMTree);
+            let instances = WI.domTreeManager.retainedObjectsWithPrototype(WI.DOMTree);
             InspectorTest.expectThat(instances.size === 0, "There should not be a DOMTree listening to DOMTreeManager events initially.");
             InspectorTest.log("DOMTree instance count: " + instances.size);
             resolve();
@@ -22,10 +22,10 @@
         name: "CheckDOMTreeCountAfterUsingGetter",
         description: "Check that the count of connected DOMTrees is correct after initializing them.",
         test(resolve, reject) {
-            let mainFrame = WebInspector.frameResourceManager.mainFrame;
+            let mainFrame = WI.frameResourceManager.mainFrame;
             mainFrame.domTree; // Force creation of the root DOM tree.
 
-            let instances = WebInspector.domTreeManager.retainedObjectsWithPrototype(WebInspector.DOMTree);
+            let instances = WI.domTreeManager.retainedObjectsWithPrototype(WI.DOMTree);
             InspectorTest.expectThat(instances.size === 1, "There should be a one DOMTree listening to DOMTreeManager events after creation.");
             InspectorTest.log("DOMTree instance count: " + instances.size);
 
@@ -39,7 +39,7 @@
             let childrenLevel3 = childrenLevel2[0].childFrameCollection.toArray();
             childrenLevel3[0].domTree;
 
-            instances = WebInspector.domTreeManager.retainedObjectsWithPrototype(WebInspector.DOMTree);
+            instances = WI.domTreeManager.retainedObjectsWithPrototype(WI.DOMTree);
             InspectorTest.expectThat(instances.size === 4, "There should be four DOMTrees listening to DOMTreeManager events after touching each Frame.");
             InspectorTest.log("DOMTree instance count: " + instances.size);
 
@@ -51,9 +51,9 @@
         name: "CheckDOMTreeCountAfterReloading",
         description: "Check that the count of connected DOMTrees is correct after a reload.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.MainResourceDidChange)
+            WI.Frame.awaitEvent(WI.Frame.Event.MainResourceDidChange)
             .then((event) => {
-                let instances = WebInspector.domTreeManager.retainedObjectsWithPrototype(WebInspector.DOMTree);
+                let instances = WI.domTreeManager.retainedObjectsWithPrototype(WI.DOMTree);
                 InspectorTest.expectThat(instances.size === 0, "There should not be any DOMTrees listening to DOMTreeManager events after a main frame navigation.");
                 InspectorTest.log("DOMTree instance count: " + instances.size);
             })
diff --git a/LayoutTests/http/tests/inspector/dom/shapes-test.js b/LayoutTests/http/tests/inspector/dom/shapes-test.js
index bbbeea9..cd4014d 100644
--- a/LayoutTests/http/tests/inspector/dom/shapes-test.js
+++ b/LayoutTests/http/tests/inspector/dom/shapes-test.js
@@ -3,10 +3,10 @@
 InspectorTest.Shapes = {
     getShapeOutsideInfoForSelector: function(selector, callback)
     {
-        WebInspector.domTreeManager.requestDocument(requestDocumentCallback);
+        WI.domTreeManager.requestDocument(requestDocumentCallback);
 
         function requestDocumentCallback(node) {
-            InspectorTest.assert(node instanceof WebInspector.DOMNode, "Unexpected argument to requestDocument callback.")
+            InspectorTest.assert(node instanceof WI.DOMNode, "Unexpected argument to requestDocument callback.")
             DOMAgent.querySelector.invoke({nodeId: node.id, selector: selector}, querySelectorCallback);
         }
 
diff --git a/LayoutTests/http/tests/inspector/network/copy-as-curl.html b/LayoutTests/http/tests/inspector/network/copy-as-curl.html
index fe0b86a..3924b27 100644
--- a/LayoutTests/http/tests/inspector/network/copy-as-curl.html
+++ b/LayoutTests/http/tests/inspector/network/copy-as-curl.html
@@ -67,7 +67,7 @@
         name: "SimpleURLGenerateCURL",
         description: "Generate cURL command from a simple URL.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
@@ -87,7 +87,7 @@
         name: "SpecialURLGenerateCURL",
         description: "Generate cURL command from a URL containing special characters.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
@@ -104,7 +104,7 @@
         name: "SpecialHeadersGenerateCURLValidPOSIXOutput",
         description: "Generate cURL command from a request containing special characters in the headers and verify valid POSIX output.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
@@ -123,7 +123,7 @@
         name: "URLWithUTF8GenerateCURL",
         description: "Generate cURL command from a URL containing UTF8 characters.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
@@ -140,7 +140,7 @@
         name: "POSTRequestURLEncodedDataGenerateCURL",
         description: "Generate cURL command from a POST request with URL encoded data.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
@@ -159,7 +159,7 @@
         name: "POSTRequestURLEncodedDataUTF8GenerateCURL",
         description: "Generate cURL command from a POST request with URL encoded UTF8 data.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
@@ -177,7 +177,7 @@
         name: "PUTRequestWithJSONGenerateCURL",
         description: "Generate cURL command from a PUT request with JSON data.",
         test(resolve, reject) {
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 let resource = event.data.resource;
                 let curl = resource.generateCURLCommand().split(" \\\n");
diff --git a/LayoutTests/http/tests/inspector/network/fetch-network-data.html b/LayoutTests/http/tests/inspector/network/fetch-network-data.html
index f48b6d1..e3bc95b 100644
--- a/LayoutTests/http/tests/inspector/network/fetch-network-data.html
+++ b/LayoutTests/http/tests/inspector/network/fetch-network-data.html
@@ -12,22 +12,22 @@
         suite.addTestCase({
             name, test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+                WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.Fetch, "Resource should be Fetch type.");
+                    InspectorTest.expectEqual(resource.type, WI.Resource.Type.Fetch, "Resource should be Fetch type.");
                     if (loadedHandler) {
-                        resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFinish)
+                        resource.awaitEvent(WI.Resource.Event.LoadingDidFinish)
                             .then(() => { InspectorTest.pass("Resource should have loaded successfully.") })
                             .then(() => { loadedHandler(resource); })
                             .then(resolve, reject);
-                        resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFail)
+                        resource.awaitEvent(WI.Resource.Event.LoadingDidFail)
                             .then(() => { InspectorTest.fail("Resource should not have failed to load.") })
                             .then(reject, reject);
                     } else if (failedHandler) {
-                        resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFinish)
+                        resource.awaitEvent(WI.Resource.Event.LoadingDidFinish)
                             .then(() => { InspectorTest.fail("Resource should not have loaded successfully.") })
                             .then(resolve, reject);
-                        resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFail)
+                        resource.awaitEvent(WI.Resource.Event.LoadingDidFail)
                             .then(() => { InspectorTest.pass("Resource should have failed to load.") })
                             .then(() => { failedHandler(resource); })
                             .then(resolve, reject);
diff --git a/LayoutTests/http/tests/inspector/network/fetch-response-body.html b/LayoutTests/http/tests/inspector/network/fetch-response-body.html
index b2d678e..5001297 100644
--- a/LayoutTests/http/tests/inspector/network/fetch-response-body.html
+++ b/LayoutTests/http/tests/inspector/network/fetch-response-body.html
@@ -41,10 +41,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
                     .then((event) => {
                         let resource = event.data.resource;
-                        InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.Fetch, "Resource should be Fetch type.");
+                        InspectorTest.expectEqual(resource.type, WI.Resource.Type.Fetch, "Resource should be Fetch type.");
                         return resource.requestContent();
                     })
                     .then(contentHandler)
diff --git a/LayoutTests/http/tests/inspector/network/loadResource-insecure-resource.html b/LayoutTests/http/tests/inspector/network/loadResource-insecure-resource.html
index de96e3f..414bdf4 100644
--- a/LayoutTests/http/tests/inspector/network/loadResource-insecure-resource.html
+++ b/LayoutTests/http/tests/inspector/network/loadResource-insecure-resource.html
@@ -12,7 +12,7 @@
         description: "Ensure trying to load an https resource from a secure page succeeds.",
         test(resolve, reject) {
             const url = "https://127.0.0.1:8443/inspector/network/resources/data.json?1";
-            NetworkAgent.loadResource(WebInspector.frameResourceManager.mainFrame.id, url, (error, content, mimeType, status) => {
+            NetworkAgent.loadResource(WI.frameResourceManager.mainFrame.id, url, (error, content, mimeType, status) => {
                 InspectorTest.expectThat(!error, "Should not be an error loading a secure resource.");
                 InspectorTest.expectEqual(status, 200, "Should be a 200 OK status.");
                 resolve();
@@ -25,7 +25,7 @@
         description: "Ensure trying to load an http resource from a secure page fails.",
         test(resolve, reject) {
             const url = "http://127.0.0.0:8000/inspector/network/resources/data.json?2";
-            NetworkAgent.loadResource(WebInspector.frameResourceManager.mainFrame.id, url, (error, content, mimeType, status) => {
+            NetworkAgent.loadResource(WI.frameResourceManager.mainFrame.id, url, (error, content, mimeType, status) => {
                 InspectorTest.expectThat(error, "Should be an error loading an insecure resource.");
                 InspectorTest.pass(error);
                 resolve();
diff --git a/LayoutTests/http/tests/inspector/network/resource-metrics.html b/LayoutTests/http/tests/inspector/network/resource-metrics.html
index 586866a..e731bdc 100644
--- a/LayoutTests/http/tests/inspector/network/resource-metrics.html
+++ b/LayoutTests/http/tests/inspector/network/resource-metrics.html
@@ -21,16 +21,16 @@
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
                 Promise.all([
-                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
+                    WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                    WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
                     InspectorTest.awaitEvent("LoadComplete"),
                 ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) => {
                     let resource = resourceWasAddedEvent.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                     InspectorTest.expectEqual(resource, responseReceivedEvent.target, "Resource should receive a Response.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}.`);
                     InspectorTest.expectThat(resource.protocol === null || resource.protocol === protocol, `protocol should be null or ${protocol}.`);
-                    InspectorTest.expectThat(resource.priority === WebInspector.Resource.NetworkPriority.Unknown || resource.priority === priority, `priority should be ${String(WebInspector.Resource.NetworkPriority.Unknown)} or ${String(priority)}.`);
+                    InspectorTest.expectThat(resource.priority === WI.Resource.NetworkPriority.Unknown || resource.priority === priority, `priority should be ${String(WI.Resource.NetworkPriority.Unknown)} or ${String(priority)}.`);
                     InspectorTest.expectThat(resource.remoteAddress === null || typeof resource.protocol === remoteAddressType, `remoteAddressType should be null or a ${remoteAddressType}.`);
                     InspectorTest.expectThat(resource.connectionIdentifier === null || typeof resource.protocol === connectionIdentifierType, `connectionIdentifierType should be null or ${connectionIdentifierType}.`);
                 }).then(resolve, reject);
@@ -44,7 +44,7 @@
         expression: `triggerNetworkLoad()`,
         statusCode: 200,
         protocol: "http/1.1",
-        priority: WebInspector.Resource.NetworkPriority.Medium,
+        priority: WI.Resource.NetworkPriority.Medium,
         remoteAddressType: "string",
         connectionIdentifierType: "string",
     });
diff --git a/LayoutTests/http/tests/inspector/network/resource-mime-type.html b/LayoutTests/http/tests/inspector/network/resource-mime-type.html
index 0d594fb..faa1206 100644
--- a/LayoutTests/http/tests/inspector/network/resource-mime-type.html
+++ b/LayoutTests/http/tests/inspector/network/resource-mime-type.html
@@ -47,10 +47,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+                WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
-                    resource.singleFireEventListener(WebInspector.Resource.Event.ResponseReceived, (event) => {
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
+                    resource.singleFireEventListener(WI.Resource.Event.ResponseReceived, (event) => {
                         InspectorTest.expectEqual(resource.type, type, `Resource Type should be '${type}'.`);
                         InspectorTest.expectEqual(resource.mimeType, mimeType, `Resource mimeType should be '${mimeType}'.`);
                         InspectorTest.expectEqual(resource.syntheticMIMEType, synthetic, `Resource syntheticMIMEType should be '${synthetic}'.`);
@@ -66,10 +66,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ChildFrameWasAdded, (event) => {
+                WI.Frame.singleFireEventListener(WI.Frame.Event.ChildFrameWasAdded, (event) => {
                     // At this point the frame's resource has loaded.
                     let resource = event.data.childFrame.mainResource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Frame MainResource should be created.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Frame MainResource should be created.");
                     InspectorTest.expectEqual(resource.type, type, `Resource Type should be '${type}'.`);
                     InspectorTest.expectEqual(resource.mimeType, mimeType, `Resource mimeType should be '${mimeType}'.`);
                     InspectorTest.expectEqual(resource.syntheticMIMEType, synthetic, `Resource syntheticMIMEType should be '${synthetic}'.`);
@@ -95,7 +95,7 @@
     addTestCase({
         name: "Resource.MIMEType.Script.js",
         expression: `loadScriptWithURL("resources/script.js")`,
-        type: WebInspector.Resource.Type.Script,
+        type: WI.Resource.Type.Script,
         mimeType: mimeTypeForExtension.js,
         synthetic: mimeTypeForExtension.js,
     });
@@ -103,7 +103,7 @@
     addTestCase({
         name: "Resource.MIMEType.Script.txt",
         expression: `loadScriptWithURL("resources/script.txt")`,
-        type: WebInspector.Resource.Type.Script,
+        type: WI.Resource.Type.Script,
         mimeType: mimeTypeForExtension.txt,
         synthetic: "text/javascript",
     });
@@ -113,7 +113,7 @@
     addTestCase({
         name: "Resource.MIMEType.Stylesheet.css",
         expression: `loadStyleSheetWithURL("resources/stylesheet.css")`,
-        type: WebInspector.Resource.Type.Stylesheet,
+        type: WI.Resource.Type.Stylesheet,
         mimeType: mimeTypeForExtension.css,
         synthetic: mimeTypeForExtension.css,
     });
@@ -121,7 +121,7 @@
     addTestCase({
         name: "Resource.MIMEType.Stylesheet.txt",
         expression: `loadStyleSheetWithURL("resources/stylesheet.txt")`,
-        type: WebInspector.Resource.Type.Stylesheet,
+        type: WI.Resource.Type.Stylesheet,
         mimeType: mimeTypeForExtension.txt,
         synthetic: "text/css",
     });
@@ -131,7 +131,7 @@
     addTestCase({
         name: "Resource.MIMEType.Image.png",
         expression: `loadImageWithURL("/resources/square100.png")`,
-        type: WebInspector.Resource.Type.Image,
+        type: WI.Resource.Type.Image,
         mimeType: mimeTypeForExtension.png,
         synthetic: mimeTypeForExtension.png,
     });
@@ -139,7 +139,7 @@
     addTestCase({
         name: "Resource.MIMEType.Image.jpg",
         expression: `loadImageWithURL("/resources/square20.jpg")`,
-        type: WebInspector.Resource.Type.Image,
+        type: WI.Resource.Type.Image,
         mimeType: mimeTypeForExtension.jpg,
         synthetic: mimeTypeForExtension.jpg,
     });
@@ -149,7 +149,7 @@
     addTestCase({
         name: "Resource.MIMEType.XHR.js",
         expression: `loadXHRWithURL("resources/script.js")`,
-        type: WebInspector.Resource.Type.XHR,
+        type: WI.Resource.Type.XHR,
         mimeType: mimeTypeForExtension.js,
         synthetic: mimeTypeForExtension.js,
     });
@@ -157,7 +157,7 @@
     addTestCase({
         name: "Resource.MIMEType.XHR.css",
         expression: `loadXHRWithURL("resources/stylesheet.css")`,
-        type: WebInspector.Resource.Type.XHR,
+        type: WI.Resource.Type.XHR,
         mimeType: mimeTypeForExtension.css,
         synthetic: mimeTypeForExtension.css,
     });
@@ -165,7 +165,7 @@
     addTestCase({
         name: "Resource.MIMEType.XHR.png",
         expression: `loadXHRWithURL("/resources/square100.png")`,
-        type: WebInspector.Resource.Type.XHR,
+        type: WI.Resource.Type.XHR,
         mimeType: mimeTypeForExtension.png,
         synthetic: mimeTypeForExtension.png,
     });
@@ -173,7 +173,7 @@
     addTestCase({
         name: "Resource.MIMEType.XHR.txt",
         expression: `loadXHRWithURL("/resources/square20.jpg")`,
-        type: WebInspector.Resource.Type.XHR,
+        type: WI.Resource.Type.XHR,
         mimeType: mimeTypeForExtension.jpg,
         synthetic: mimeTypeForExtension.jpg,
     });
@@ -181,7 +181,7 @@
     addTestCase({
         name: "Resource.MIMEType.XHR.json",
         expression: `loadXHRWithURL("resources/json.php")`,
-        type: WebInspector.Resource.Type.XHR,
+        type: WI.Resource.Type.XHR,
         mimeType: mimeTypeForExtension.json,
         synthetic: mimeTypeForExtension.json,
     });
@@ -189,7 +189,7 @@
     addTestCase({
         name: "Resource.MIMEType.XHR.html",
         expression: `loadXHRWithURL("resources/data.html")`,
-        type: WebInspector.Resource.Type.XHR,
+        type: WI.Resource.Type.XHR,
         mimeType: mimeTypeForExtension.html,
         synthetic: mimeTypeForExtension.html,
     });
@@ -199,7 +199,7 @@
     addTestCase({
         name: "Resource.MIMEType.Fetch.js",
         expression: `loadFetchWithURL("resources/script.js")`,
-        type: WebInspector.Resource.Type.Fetch,
+        type: WI.Resource.Type.Fetch,
         mimeType: mimeTypeForExtension.js,
         synthetic: mimeTypeForExtension.js,
     });
@@ -207,7 +207,7 @@
     addTestCase({
         name: "Resource.MIMEType.Fetch.css",
         expression: `loadFetchWithURL("resources/stylesheet.css")`,
-        type: WebInspector.Resource.Type.Fetch,
+        type: WI.Resource.Type.Fetch,
         mimeType: mimeTypeForExtension.css,
         synthetic: mimeTypeForExtension.css,
     });
@@ -215,7 +215,7 @@
     addTestCase({
         name: "Resource.MIMEType.Fetch.png",
         expression: `loadFetchWithURL("/resources/square100.png")`,
-        type: WebInspector.Resource.Type.Fetch,
+        type: WI.Resource.Type.Fetch,
         mimeType: mimeTypeForExtension.png,
         synthetic: mimeTypeForExtension.png,
     });
@@ -223,7 +223,7 @@
     addTestCase({
         name: "Resource.MIMEType.Fetch.txt",
         expression: `loadFetchWithURL("/resources/square20.jpg")`,
-        type: WebInspector.Resource.Type.Fetch,
+        type: WI.Resource.Type.Fetch,
         mimeType: mimeTypeForExtension.jpg,
         synthetic: mimeTypeForExtension.jpg,
     });
@@ -231,7 +231,7 @@
     addTestCase({
         name: "Resource.MIMEType.Fetch.json",
         expression: `loadFetchWithURL("resources/json.php")`,
-        type: WebInspector.Resource.Type.Fetch,
+        type: WI.Resource.Type.Fetch,
         mimeType: mimeTypeForExtension.json,
         synthetic: mimeTypeForExtension.json,
     });
@@ -239,7 +239,7 @@
     addTestCase({
         name: "Resource.MIMEType.Fetch.html",
         expression: `loadFetchWithURL("resources/data.html")`,
-        type: WebInspector.Resource.Type.Fetch,
+        type: WI.Resource.Type.Fetch,
         mimeType: mimeTypeForExtension.html,
         synthetic: mimeTypeForExtension.html,
     });
@@ -249,7 +249,7 @@
     addDocumentResourceTestCase({
         name: "Resource.MIMEType.Document.js",
         expression: `loadDocumentWithURL("resources/script.js")`,
-        type: WebInspector.Resource.Type.Document,
+        type: WI.Resource.Type.Document,
         mimeType: mimeTypeForExtension.js,
         synthetic: mimeTypeForExtension.js,
     });
@@ -257,7 +257,7 @@
     addDocumentResourceTestCase({
         name: "Resource.MIMEType.Document.css",
         expression: `loadDocumentWithURL("resources/stylesheet.css")`,
-        type: WebInspector.Resource.Type.Document,
+        type: WI.Resource.Type.Document,
         mimeType: mimeTypeForExtension.css,
         synthetic: mimeTypeForExtension.css,
     });
@@ -265,7 +265,7 @@
     addDocumentResourceTestCase({
         name: "Resource.MIMEType.Document.png",
         expression: `loadDocumentWithURL("/resources/square100.png")`,
-        type: WebInspector.Resource.Type.Document,
+        type: WI.Resource.Type.Document,
         mimeType: mimeTypeForExtension.png,
         synthetic: mimeTypeForExtension.png,
     });
@@ -273,7 +273,7 @@
     addDocumentResourceTestCase({
         name: "Resource.MIMEType.Document.txt",
         expression: `loadDocumentWithURL("/resources/square20.jpg")`,
-        type: WebInspector.Resource.Type.Document,
+        type: WI.Resource.Type.Document,
         mimeType: mimeTypeForExtension.jpg,
         synthetic: mimeTypeForExtension.jpg,
     });
@@ -281,7 +281,7 @@
     addDocumentResourceTestCase({
         name: "Resource.MIMEType.Document.json",
         expression: `loadDocumentWithURL("resources/json.php")`,
-        type: WebInspector.Resource.Type.Document,
+        type: WI.Resource.Type.Document,
         mimeType: mimeTypeForExtension.json,
         synthetic: mimeTypeForExtension.json,
     });
@@ -289,7 +289,7 @@
     addDocumentResourceTestCase({
         name: "Resource.MIMEType.Document.html",
         expression: `loadDocumentWithURL("resources/data.html")`,
-        type: WebInspector.Resource.Type.Document,
+        type: WI.Resource.Type.Document,
         mimeType: mimeTypeForExtension.html,
         synthetic: mimeTypeForExtension.html,
     });
diff --git a/LayoutTests/http/tests/inspector/network/resource-request-headers.html b/LayoutTests/http/tests/inspector/network/resource-request-headers.html
index 610c20a..5e2c95f 100644
--- a/LayoutTests/http/tests/inspector/network/resource-request-headers.html
+++ b/LayoutTests/http/tests/inspector/network/resource-request-headers.html
@@ -50,13 +50,13 @@
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
                 Promise.all([
-                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
-                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFinish),
+                    WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                    WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+                    WI.Resource.awaitEvent(WI.Resource.Event.LoadingDidFinish),
                     InspectorTest.awaitEvent("LoadComplete"),
                 ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadingDidFinish, loadCompleteEvent]) => {
                     let resource = resourceWasAddedEvent.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                     InspectorTest.expectEqual(resource, responseReceivedEvent.target, "Resource should receive a Response.");
                     return loadHandler(resource);
                 }).then(resolve, reject);
diff --git a/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html b/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html
index a1e459a..1343538 100644
--- a/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html
+++ b/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html
@@ -29,12 +29,12 @@
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
                 Promise.all([
-                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
+                    WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                    WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
                     InspectorTest.awaitEvent("LoadComplete"),
                 ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) => {
                     let resource = resourceWasAddedEvent.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                     InspectorTest.expectEqual(resource, responseReceivedEvent.target, "Resource should receive a Response.");
                     if (statusCode)
                         InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
@@ -56,7 +56,7 @@
         name: "Resource.ResponseSource.DiskCache",
         description: "Load a resource from the disk cache",
         expression: `triggerDiskCacheLoad()`,
-        responseSource: WebInspector.Resource.ResponseSource.DiskCache,
+        responseSource: WI.Resource.ResponseSource.DiskCache,
         statusCode: 200,
     });
 
diff --git a/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html b/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html
index deb48dd..3704572 100644
--- a/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html
+++ b/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html
@@ -18,7 +18,7 @@
                 InspectorTest.reloadPage({ignoreCache, revalidateAllResources: true});
                 InspectorTest.awaitEvent("LoadComplete").then((event) => {
                     let resource = null;
-                    for (let item of WebInspector.frameResourceManager.mainFrame.resourceCollection.items) {
+                    for (let item of WI.frameResourceManager.mainFrame.resourceCollection.items) {
                         if (pattern.test(item.url)) {
                             resource = item;
                             break;
@@ -29,7 +29,7 @@
                         reject();
                         return;
                     }
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be exist.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be exist.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
                     InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
                 }).then(resolve, reject);
@@ -42,7 +42,7 @@
         description: "Load a resource from the memory cache by reloading this page.",
         pattern: /cached-script\.js$/,
         ignoreCache: false,
-        responseSource: WebInspector.Resource.ResponseSource.MemoryCache,
+        responseSource: WI.Resource.ResponseSource.MemoryCache,
         statusCode: 304,
     });
 
diff --git a/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html b/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html
index 1768308..86c6b9c 100644
--- a/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html
+++ b/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html
@@ -18,7 +18,7 @@
                 InspectorTest.reloadPage({ignoreCache});
                 InspectorTest.awaitEvent("LoadComplete").then((event) => {
                     let resource = null;
-                    for (let item of WebInspector.frameResourceManager.mainFrame.resourceCollection.items) {
+                    for (let item of WI.frameResourceManager.mainFrame.resourceCollection.items) {
                         if (pattern.test(item.url)) {
                             resource = item;
                             break;
@@ -29,7 +29,7 @@
                         reject();
                         return;
                     }
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be exist.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be exist.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
                     InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
                 }).then(resolve, reject);
@@ -42,7 +42,7 @@
         description: "Load a resource from the memory cache by reloading this page.",
         pattern: /cached-script\.js$/,
         ignoreCache: false,
-        responseSource: WebInspector.Resource.ResponseSource.MemoryCache,
+        responseSource: WI.Resource.ResponseSource.MemoryCache,
         statusCode: 200,
     });
 
diff --git a/LayoutTests/http/tests/inspector/network/resource-response-source-network.html b/LayoutTests/http/tests/inspector/network/resource-response-source-network.html
index 4941d21..c290e05 100644
--- a/LayoutTests/http/tests/inspector/network/resource-response-source-network.html
+++ b/LayoutTests/http/tests/inspector/network/resource-response-source-network.html
@@ -21,12 +21,12 @@
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
                 Promise.all([
-                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
+                    WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                    WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
                     InspectorTest.awaitEvent("LoadComplete"),
                 ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) => {
                     let resource = resourceWasAddedEvent.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                     InspectorTest.expectEqual(resource, responseReceivedEvent.target, "Resource should receive a Response.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
                     InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
@@ -39,7 +39,7 @@
         name: "Resource.ResponseSource.Network",
         description: "Load a resource from the network by giving a random URL.",
         expression: `triggerNetworkLoad()`,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         statusCode: 200,
     });
 
diff --git a/LayoutTests/http/tests/inspector/network/resource-sizes-disk-cache.html b/LayoutTests/http/tests/inspector/network/resource-sizes-disk-cache.html
index 28be5742..f3596bf 100644
--- a/LayoutTests/http/tests/inspector/network/resource-sizes-disk-cache.html
+++ b/LayoutTests/http/tests/inspector/network/resource-sizes-disk-cache.html
@@ -36,7 +36,7 @@
         url: "/resources/square100.png",
         statusCode: 200,
         compressed: false,
-        responseSource: WebInspector.Resource.ResponseSource.DiskCache,
+        responseSource: WI.Resource.ResponseSource.DiskCache,
         headers: false,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 0,
diff --git a/LayoutTests/http/tests/inspector/network/resource-sizes-memory-cache.html b/LayoutTests/http/tests/inspector/network/resource-sizes-memory-cache.html
index 703c307..9adb69b 100644
--- a/LayoutTests/http/tests/inspector/network/resource-sizes-memory-cache.html
+++ b/LayoutTests/http/tests/inspector/network/resource-sizes-memory-cache.html
@@ -17,7 +17,7 @@
         description: "Sizes of a cached script resource with a validation request",
         statusCode: 304,
         compressed: false,
-        responseSource: WebInspector.Resource.ResponseSource.MemoryCache,
+        responseSource: WI.Resource.ResponseSource.MemoryCache,
         headers: true,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 0,
@@ -29,7 +29,7 @@
             InspectorTest.reloadPage({ignoreCache, revalidateAllResources});
             return InspectorTest.awaitEvent("LoadComplete").then((event) => {
                 let resource = null;
-                for (let item of WebInspector.frameResourceManager.mainFrame.resourceCollection.items) {
+                for (let item of WI.frameResourceManager.mainFrame.resourceCollection.items) {
                     if (pattern.test(item.url)) {
                         resource = item;
                         break;
diff --git a/LayoutTests/http/tests/inspector/network/resource-sizes-network.html b/LayoutTests/http/tests/inspector/network/resource-sizes-network.html
index 8bbf8c4..c706a3a 100644
--- a/LayoutTests/http/tests/inspector/network/resource-sizes-network.html
+++ b/LayoutTests/http/tests/inspector/network/resource-sizes-network.html
@@ -35,7 +35,7 @@
         url: "resources/lorem.txt?" + Math.random(),
         statusCode: 200,
         compressed: false,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         headers: true,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 2955,
@@ -48,7 +48,7 @@
         url: "resources/gzipped-lorem.php?" + Math.random(),
         statusCode: 200,
         compressed: true,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         headers: true,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 1229,
@@ -61,7 +61,7 @@
         url: "resources/gzipped-lorem-no-content-length.php?" + Math.random(),
         statusCode: 200,
         compressed: true,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         headers: true,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 1229,
@@ -74,7 +74,7 @@
         url: "/resources/square100.png?" + Math.random(),
         statusCode: 200,
         compressed: false,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         headers: true,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 12940,
@@ -87,7 +87,7 @@
         url: "resources/404.php?" + Math.random(),
         statusCode: 404,
         compressed: false,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         headers: true,
         requestBodyTransferSize: 0,
         responseBodyTransferSize: 512,
@@ -99,7 +99,7 @@
         description: "Sizes of a resource with request data",
         statusCode: 200,
         compressed: false,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         headers: true,
         requestBodyTransferSize: 1027,
         responseBodyTransferSize: 28,
@@ -107,7 +107,7 @@
         resourceLoader() {
             InspectorTest.evaluateInPage(`triggerNetworkLoadWithRequestData()`);
             return Promise.all([
-                WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
+                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
                 InspectorTest.awaitEvent("LoadComplete"),
             ]).then(([resourceWasAddedEvent, loadCompleteEvent]) => {
                 return resourceWasAddedEvent.data.resource;
diff --git a/LayoutTests/http/tests/inspector/network/resource-timing.html b/LayoutTests/http/tests/inspector/network/resource-timing.html
index 9c503ca..304f905 100644
--- a/LayoutTests/http/tests/inspector/network/resource-timing.html
+++ b/LayoutTests/http/tests/inspector/network/resource-timing.html
@@ -19,19 +19,19 @@
         description: "Check if a resource has timing information.",
         test(resolve, reject) {
             Promise.all([
-                WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
-                WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFinish)
+                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+                WI.Resource.awaitEvent(WI.Resource.Event.LoadingDidFinish)
             ])
             .then(([resourceWasAddedEvent, responseReceivedEvent, loadingDidFinishEvent]) => {
                 let resource = resourceWasAddedEvent.data.resource;
 
-                InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                 InspectorTest.expectThat(resource === responseReceivedEvent.target, "Added Resource received a response.");
                 InspectorTest.expectThat(resource === loadingDidFinishEvent.target, "Added Resource did finish loading.");
 
                 let timingData = resource.timingData;
-                InspectorTest.expectThat(timingData instanceof WebInspector.ResourceTimingData, "Newly added resource should have a resource timing model.");
+                InspectorTest.expectThat(timingData instanceof WI.ResourceTimingData, "Newly added resource should have a resource timing model.");
                 InspectorTest.expectThat(timingData.startTime > 0, "Resource should have a start time.");
                 InspectorTest.expectThat(timingData.requestStart > 0, "Resource should have a request start time.");
                 InspectorTest.expectThat(timingData.responseStart > 0, "Resource should have a response start time.");
diff --git a/LayoutTests/http/tests/inspector/network/resources/resource-size-test.js b/LayoutTests/http/tests/inspector/network/resources/resource-size-test.js
index 8fcd5fa..75d0773 100644
--- a/LayoutTests/http/tests/inspector/network/resources/resource-size-test.js
+++ b/LayoutTests/http/tests/inspector/network/resources/resource-size-test.js
@@ -39,15 +39,15 @@
                 else {
                     InspectorTest.evaluateInPage(`fetch(${JSON.stringify(url)})`);
                     promise = Promise.all([
-                        WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                        WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFinish),
+                        WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                        WI.Resource.awaitEvent(WI.Resource.Event.LoadingDidFinish),
                     ]).then(([resourceWasAddedEvent, loadCompleteEvent]) => {
                         return resourceWasAddedEvent.data.resource;
                     });
                 }
 
                 promise.then((resource) => {
-                    InspectorTest.assert(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    InspectorTest.assert(resource instanceof WI.Resource, "Resource should be created.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}.`);
                     InspectorTest.expectEqual(resource.compressed, compressed, `compressed should be ${compressed}.`);
                     InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}.`);
diff --git a/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html b/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html
index 9138ee0..fcc6467 100644
--- a/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html
+++ b/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html
@@ -30,12 +30,12 @@
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
                 Promise.all([
-                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
+                    WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                    WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
                     InspectorTest.awaitEvent("LoadComplete"),
                 ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) => {
                     let resource = resourceWasAddedEvent.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                     InspectorTest.expectEqual(resource, responseReceivedEvent.target, "Resource should receive a Response.");
                     if (statusCode)
                         InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
@@ -57,7 +57,7 @@
         name: "SetResourceCachingDisabled.DiskCache",
         description: "Fail to load a resource from the disk cache when resource caching is disabled",
         expression: `triggerDiskCacheLoad()`,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         setup(resolve) { NetworkAgent.setResourceCachingDisabled(true); resolve(); },
         statusCode: 200,
     });
diff --git a/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html b/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html
index 4f922c1..d9a37b6 100644
--- a/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html
+++ b/LayoutTests/http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html
@@ -21,7 +21,7 @@
                 InspectorTest.reloadPage({ignoreCache});
                 InspectorTest.awaitEvent("LoadComplete").then((event) => {
                     let resource = null;
-                    for (let item of WebInspector.frameResourceManager.mainFrame.resourceCollection.items) {
+                    for (let item of WI.frameResourceManager.mainFrame.resourceCollection.items) {
                         if (pattern.test(item.url)) {
                             resource = item;
                             break;
@@ -32,7 +32,7 @@
                         reject();
                         return;
                     }
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be exist.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be exist.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
                     InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
                 }).then(resolve, reject);
@@ -46,7 +46,7 @@
         pattern: /cached-script\.js$/,
         setup(resolve) { NetworkAgent.setResourceCachingDisabled(true); resolve(); },
         ignoreCache: false,
-        responseSource: WebInspector.Resource.ResponseSource.Network,
+        responseSource: WI.Resource.ResponseSource.Network,
         statusCode: 200,
     });
 
diff --git a/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html b/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html
index ec9108b..ab1fcb2 100644
--- a/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html
+++ b/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html
@@ -19,14 +19,14 @@
         description: "XHR with request data is encoded correctly.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`createXHRResource()`);
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                 let resource = event.data.resource;
-                InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                 InspectorTest.expectThat(resource.requestData === "utf8=👍", "Request data should have expected content.");
-                resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFinish)
+                resource.awaitEvent(WI.Resource.Event.LoadingDidFinish)
                     .then((event) => { InspectorTest.pass("Resource load should finish.") })
                     .then(resolve, reject);
-                resource.awaitEvent(WebInspector.Resource.Event.LoadingDidFail)
+                resource.awaitEvent(WI.Resource.Event.LoadingDidFail)
                     .then(() => { InspectorTest.fail("Resource should not have failed to load.") })
                     .then(reject, reject);
             });
diff --git a/LayoutTests/http/tests/inspector/network/xhr-response-body.html b/LayoutTests/http/tests/inspector/network/xhr-response-body.html
index 785cfb3..4dfc736 100644
--- a/LayoutTests/http/tests/inspector/network/xhr-response-body.html
+++ b/LayoutTests/http/tests/inspector/network/xhr-response-body.html
@@ -47,10 +47,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
                     .then((event) => {
                         let resource = event.data.resource;
-                        InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.XHR, "Resource should be XHR type.");
+                        InspectorTest.expectEqual(resource.type, WI.Resource.Type.XHR, "Resource should be XHR type.");
                         return resource.requestContent();
                     })
                     .then(contentHandler)
diff --git a/LayoutTests/http/tests/inspector/resources/probe-test.js b/LayoutTests/http/tests/inspector/resources/probe-test.js
index 5853146..db18a9f 100644
--- a/LayoutTests/http/tests/inspector/resources/probe-test.js
+++ b/LayoutTests/http/tests/inspector/resources/probe-test.js
@@ -40,7 +40,7 @@
 
 ProtocolTest.Probe.stringifyProbeSample = function(ProbeSample)
 {
-    console.assert(ProbeSample instanceof WebInspector.ProbeSample, "Unexpected object type!");
+    console.assert(ProbeSample instanceof WI.ProbeSample, "Unexpected object type!");
     return JSON.stringify({
         "sampleId": ProbeSample.sampleId,
         "batchId": ProbeSample.batchId,
@@ -49,104 +49,104 @@
 
 ProtocolTest.Probe.installTracingListeners = function()
 {
-    if (!WebInspector.debuggerManager || !WebInspector.probeManager)
+    if (!WI.debuggerManager || !WI.probeManager)
         return;
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, function(event) {
         InspectorTest.log("Breakpoint was added.");
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointRemoved, function(event) {
         InspectorTest.log("Breakpoint was removed.");
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisabledStateDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint disabled state changed: " + breakpoint.disabled);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ResolvedStateDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint resolved state changed: " + breakpoint.resolved);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.AutoContinueDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint autocontinue state changed: " + breakpoint.autoContinue);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ConditionDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ConditionDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint condition changed: " + breakpoint.condition);
     });
 
-    WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange, function(event) {
+    WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ActionsDidChange, function(event) {
         var breakpoint = event.target;
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unexpected object type!");
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unexpected object type!");
 
         InspectorTest.log("Breakpoint actions changed. New count: " + breakpoint.actions.length);
     });
 
-    WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetAdded, function(event) {
+    WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetAdded, function(event) {
         var probeSet = event.data.probeSet;
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
-        InspectorTest.log("Probe set was added. New count: " + WebInspector.probeManager.probeSets.length);
+        InspectorTest.log("Probe set was added. New count: " + WI.probeManager.probeSets.length);
     });
 
-    WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetRemoved, function(event) {
+    WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetRemoved, function(event) {
         var probeSet = event.data.probeSet;
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
-        InspectorTest.log("Probe set was removed. New count: " + WebInspector.probeManager.probeSets.length);
+        InspectorTest.log("Probe set was removed. New count: " + WI.probeManager.probeSets.length);
     });
 
-    WebInspector.Probe.addEventListener(WebInspector.Probe.Event.ExpressionChanged, function(event) {
+    WI.Probe.addEventListener(WI.Probe.Event.ExpressionChanged, function(event) {
         var probe = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " changed expression: " + probe.expression);
     });
 
-    WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SampleAdded, function(event) {
+    WI.Probe.addEventListener(WI.Probe.Event.SampleAdded, function(event) {
         var probe = event.target;
         var sample = event.data;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
-        console.assert(sample instanceof WebInspector.ProbeSample, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
+        console.assert(sample instanceof WI.ProbeSample, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " added sample: " + sample);
     });
 
-    WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SamplesCleared, function(event) {
+    WI.Probe.addEventListener(WI.Probe.Event.SamplesCleared, function(event) {
         var probe = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " cleared all samples.");
     });
 
-    WebInspector.ProbeSet.addEventListener(WebInspector.ProbeSet.Event.ProbeAdded, function(event) {
+    WI.ProbeSet.addEventListener(WI.ProbeSet.Event.ProbeAdded, function(event) {
         var probe = event.data;
         var probeSet = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " was added to probe set.");
         InspectorTest.log("Probe set's probe count: " + probeSet.probes.length);
     });
 
-    WebInspector.ProbeSet.addEventListener(WebInspector.ProbeSet.Event.ProbeRemoved, function(event) {
+    WI.ProbeSet.addEventListener(WI.ProbeSet.Event.ProbeRemoved, function(event) {
         var probe = event.data;
         var probeSet = event.target;
-        console.assert(probe instanceof WebInspector.Probe, "Unexpected object type!");
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Unexpected object type!");
+        console.assert(probe instanceof WI.Probe, "Unexpected object type!");
+        console.assert(probeSet instanceof WI.ProbeSet, "Unexpected object type!");
 
         InspectorTest.log("Probe with identifier " + probe.id + " was removed from probe set.");
         InspectorTest.log("Probe set's probe count: " + probeSet.probes.length);
diff --git a/LayoutTests/http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html b/LayoutTests/http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
index c4a7dec..595115e 100644
--- a/LayoutTests/http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
+++ b/LayoutTests/http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
@@ -14,7 +14,7 @@
 function test()
 {
     let workerTarget;
-    let mainTarget = WebInspector.mainTarget;
+    let mainTarget = WI.mainTarget;
 
     function sanitizeURL(url) {
         if (!url)
@@ -36,7 +36,7 @@
 
     function dumpWorkerScripts() {
         InspectorTest.log("SCRIPTS:");
-        let targetData = WebInspector.debuggerManager.dataForTarget(workerTarget);
+        let targetData = WI.debuggerManager.dataForTarget(workerTarget);
         let urls = [];
         for (let script of targetData.scripts)
             urls.push(sanitizeURL(script.url));
@@ -59,21 +59,21 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerWorkerStart()");
 
-            WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+            WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                 workerTarget = event.data.target;
-                InspectorTest.assert(workerTarget instanceof WebInspector.Target);
-                InspectorTest.expectEqual(workerTarget.type, WebInspector.Target.Type.Worker, "Added Target should have Worker type.");
+                InspectorTest.assert(workerTarget instanceof WI.Target);
+                InspectorTest.expectEqual(workerTarget.type, WI.Target.Type.Worker, "Added Target should have Worker type.");
             });
 
             let seen = 0;
             const expected = 3;
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 if (event.data.script.target === workerTarget)
                     seen++;
                 if (seen !== expected)
                     return;
 
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, listener);
                 dumpWorkerResources();
                 dumpWorkerScripts();
                 resolve();
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html b/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html
index 51a0ce7..11e0f58 100644
--- a/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html
+++ b/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html
@@ -23,15 +23,15 @@
         let readyStateString = "";
 
         switch (readyState) {
-        case WebInspector.WebSocketResource.ReadyState.Closed:
+        case WI.WebSocketResource.ReadyState.Closed:
             readyStateString = "closed";
             break;
 
-        case WebInspector.WebSocketResource.ReadyState.Connecting:
+        case WI.WebSocketResource.ReadyState.Connecting:
             readyStateString = "connecting";
             break;
 
-        case WebInspector.WebSocketResource.ReadyState.Open:
+        case WI.WebSocketResource.ReadyState.Open:
             readyStateString = "open";
             break;
 
@@ -45,7 +45,7 @@
         description: "Test that the existing websocket is sent to the frontend when it is first opened.",
         test(resolve, reject) {
             const url = "ws://127.0.0.1:8880/websocket/tests/hybi/inspector/echo";
-            let webSocketResources = WebInspector.frameResourceManager.mainFrame.resourceCollectionForType(WebInspector.Resource.Type.WebSocket);
+            let webSocketResources = WI.frameResourceManager.mainFrame.resourceCollectionForType(WI.Resource.Type.WebSocket);
             InspectorTest.expectEqual(webSocketResources.items.size, 1, "Should have 1 WebSocketResource");
 
             let webSocketResource = webSocketResources.toArray()[0];
@@ -54,7 +54,7 @@
                 return;
             }
 
-            InspectorTest.expectThat(webSocketResource instanceof WebInspector.WebSocketResource, "Resource should be a WebSocket.");
+            InspectorTest.expectThat(webSocketResource instanceof WI.WebSocketResource, "Resource should be a WebSocket.");
             InspectorTest.expectEqual(webSocketResource.url, url, `Resource URL should be "${url}".`);
             InspectorTest.expectThat(!isEmptyObject(webSocketResource.requestHeaders), "Resource should have request headers.");
             InspectorTest.expectThat(!isEmptyObject(webSocketResource.responseHeaders), "Resource should have response headers.");
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html b/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html
index 7d8b160..7411545 100644
--- a/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html
+++ b/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html
@@ -47,13 +47,13 @@
         let lastMessageWalltime;
         let resource = event.data.resource;
 
-        resource.addEventListener(WebInspector.WebSocketResource.Event.FrameAdded, function(event) {
+        resource.addEventListener(WI.WebSocketResource.Event.FrameAdded, function(event) {
             let frame = event.data;
             frameAddedCount++;
 
             if (frameAddedCount <= 5) {
                 InspectorTest.expectEqual(frame.data, null, "Frame should not have data.");
-                InspectorTest.expectEqual(frame.opcode, WebInspector.WebSocketResource.OpCodes.BinaryFrame, "Frame should be binary.");
+                InspectorTest.expectEqual(frame.opcode, WI.WebSocketResource.OpCodes.BinaryFrame, "Frame should be binary.");
 
                 if (frameAddedCount === 1) {
                     InspectorTest.expectThat(frame.isOutgoing, "Frame should be outgoing.");
@@ -74,7 +74,7 @@
 
         let sizeDidChangeCount = 0;
 
-        resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, function(event) {
+        resource.addEventListener(WI.Resource.Event.SizeDidChange, function(event) {
             sizeDidChangeCount++;
 
             if (sizeDidChangeCount === 1)
@@ -95,7 +95,7 @@
         name: "WebSocket.BinaryBlob",
         description: "Should receive binary blob WebSocket messages.",
         test(resolve, reject) {
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, resourceWasAdded.bind(null, resolve, reject));
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, resourceWasAdded.bind(null, resolve, reject));
             InspectorTest.evaluateInPage(`createWebSocketConnection("blob")`);
         }
     });
@@ -104,7 +104,7 @@
         name: "WebSocket.ArrayBuffer",
         description: "Should receive ArrayBuffer WebSocket messages.",
         test(resolve, reject) {
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, resourceWasAdded.bind(null, resolve, reject));
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, resourceWasAdded.bind(null, resolve, reject));
             InspectorTest.evaluateInPage(`createWebSocketConnection("arraybuffer")`);
         }
     });
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html b/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html
index 728a3b5..ce85872 100644
--- a/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html
+++ b/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html
@@ -24,32 +24,32 @@
 
     suite.addTestCase({
         name: "WebSocket.ClientClose",
-        description: "WebInspector.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the client.",
+        description: "WI.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the client.",
         test(resolve, reject) {
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, function(event) {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, function(event) {
                 let resource = event.data.resource;
 
-                InspectorTest.expectThat(resource instanceof WebInspector.WebSocketResource, "WebSocketResource should be created.");
-                InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.WebSocket, "WebSocketResource should be a WebSocket type.");
-                InspectorTest.expectEqual(resource.readyState, WebInspector.WebSocketResource.ReadyState.Connecting, "WebSocketResource should be in a Connecting state.");
+                InspectorTest.expectThat(resource instanceof WI.WebSocketResource, "WebSocketResource should be created.");
+                InspectorTest.expectEqual(resource.type, WI.Resource.Type.WebSocket, "WebSocketResource should be a WebSocket type.");
+                InspectorTest.expectEqual(resource.readyState, WI.WebSocketResource.ReadyState.Connecting, "WebSocketResource should be in a Connecting state.");
 
                 let runCount = 0;
 
-                resource.addEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged, function(event) {
+                resource.addEventListener(WI.WebSocketResource.Event.ReadyStateChanged, function(event) {
                     let data = event.data;
                     runCount++;
 
                     if (runCount === 1) {
-                        InspectorTest.expectEqual(data.previousState, WebInspector.WebSocketResource.ReadyState.Connecting, "WebSocketResource previous state should be Connecting.");
-                        InspectorTest.expectEqual(data.state, WebInspector.WebSocketResource.ReadyState.Open, "WebSocketResource state should change to Open.");
-                        InspectorTest.expectEqual(resource.readyState, WebInspector.WebSocketResource.ReadyState.Open, "WebSocketResource should be in a Open state.");
+                        InspectorTest.expectEqual(data.previousState, WI.WebSocketResource.ReadyState.Connecting, "WebSocketResource previous state should be Connecting.");
+                        InspectorTest.expectEqual(data.state, WI.WebSocketResource.ReadyState.Open, "WebSocketResource state should change to Open.");
+                        InspectorTest.expectEqual(resource.readyState, WI.WebSocketResource.ReadyState.Open, "WebSocketResource should be in a Open state.");
                         return;
                     }
 
                     if (runCount === 2) {
-                        InspectorTest.expectEqual(data.previousState, WebInspector.WebSocketResource.ReadyState.Open, "WebSocketResource previous state should be Open.");
-                        InspectorTest.expectEqual(data.state, WebInspector.WebSocketResource.ReadyState.Closed, "WebSocketResource state should change to Closed.");
-                        InspectorTest.expectEqual(resource.readyState, WebInspector.WebSocketResource.ReadyState.Closed, "WebSocketResource should be in a Closed state.");
+                        InspectorTest.expectEqual(data.previousState, WI.WebSocketResource.ReadyState.Open, "WebSocketResource previous state should be Open.");
+                        InspectorTest.expectEqual(data.state, WI.WebSocketResource.ReadyState.Closed, "WebSocketResource state should change to Closed.");
+                        InspectorTest.expectEqual(resource.readyState, WI.WebSocketResource.ReadyState.Closed, "WebSocketResource should be in a Closed state.");
                         resolve();
                     }
                 });
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html b/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html
index 2baa3e4..b67bf95 100644
--- a/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html
+++ b/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html
@@ -24,7 +24,7 @@
         description: "Should return a valid response for the given request identifier.",
         test(resolve, reject) {
             const url = "ws://127.0.0.1:8880/websocket/tests/hybi/inspector/echo";
-            let webSocketResource = WebInspector.frameResourceManager.resourceForURL(url);
+            let webSocketResource = WI.frameResourceManager.resourceForURL(url);
             if (!webSocketResource) {
                 reject("Missing WebSocket resource.");
                 return;
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html b/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html
index aaa24e0..aaf0d12 100644
--- a/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html
+++ b/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html
@@ -30,39 +30,39 @@
         name: "SendAndReceive",
         description: "Should send and receive text frames.",
         test(resolve, reject) {
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, function(event) {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, function(event) {
 
                 let frameAddedCount = 0;
                 let lastMessageWalltime;
                 let resource = event.data.resource;
 
-                resource.addEventListener(WebInspector.WebSocketResource.Event.FrameAdded, function(event) {
+                resource.addEventListener(WI.WebSocketResource.Event.FrameAdded, function(event) {
                     let frame = event.data;
                     frameAddedCount++;
 
                     if (frameAddedCount === 1) {
 
                         InspectorTest.expectEqual(frame.data, "Hello World! Привет Мир!", "Frame data should be 'Hello World! Привет Мир!'");
-                        InspectorTest.expectEqual(frame.opcode, WebInspector.WebSocketResource.OpCodes.TextFrame, "Frame should be text.");
+                        InspectorTest.expectEqual(frame.opcode, WI.WebSocketResource.OpCodes.TextFrame, "Frame should be text.");
                         InspectorTest.expectThat(frame.isOutgoing, "Frame should be outgoing.");
                         InspectorTest.expectThat(typeof frame.walltime === "number", "Message is walltime.");
 
                     } else if (frameAddedCount === 2) {
 
                         InspectorTest.expectEqual(frame.data, "Hello World! Привет Мир!", "Frame data should be 'Hello World! Привет Мир!'");
-                        InspectorTest.expectEqual(frame.opcode, WebInspector.WebSocketResource.OpCodes.TextFrame, "Frame should be text.");
+                        InspectorTest.expectEqual(frame.opcode, WI.WebSocketResource.OpCodes.TextFrame, "Frame should be text.");
                         InspectorTest.expectThat(!frame.isOutgoing, "Frame should be incoming.");
                         InspectorTest.expectThat(frame.walltime > lastMessageWalltime, "Frame walltime should be greater than the previous one.");
 
                     } else if (frameAddedCount === 3) {
 
-                        InspectorTest.expectEqual(frame.opcode, WebInspector.WebSocketResource.OpCodes.ConnectionCloseFrame, "Frame should close connection.");
+                        InspectorTest.expectEqual(frame.opcode, WI.WebSocketResource.OpCodes.ConnectionCloseFrame, "Frame should close connection.");
                         InspectorTest.expectThat(frame.isOutgoing, "Frame should be outgoing.");
                         InspectorTest.expectThat(frame.walltime > lastMessageWalltime, "Frame walltime should be greater than the previous one.");
 
                     } else if (frameAddedCount === 4) {
 
-                        InspectorTest.expectEqual(frame.opcode, WebInspector.WebSocketResource.OpCodes.ConnectionCloseFrame, "Frame should close connection.");
+                        InspectorTest.expectEqual(frame.opcode, WI.WebSocketResource.OpCodes.ConnectionCloseFrame, "Frame should close connection.");
                         InspectorTest.expectThat(!frame.isOutgoing, "Frame should be incoming.");
                         InspectorTest.expectThat(frame.walltime > lastMessageWalltime, "Frame walltime should be greater than the previous one.");
                         resolve();
@@ -73,7 +73,7 @@
 
                 let sizeDidChangeCount = 0;
 
-                resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, function(event) {
+                resource.addEventListener(WI.Resource.Event.SizeDidChange, function(event) {
                     sizeDidChangeCount++;
 
                     if (sizeDidChangeCount === 1)
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/inspector/server-close.html b/LayoutTests/http/tests/websocket/tests/hybi/inspector/server-close.html
index 8cb0adc..1acbf85 100644
--- a/LayoutTests/http/tests/websocket/tests/hybi/inspector/server-close.html
+++ b/LayoutTests/http/tests/websocket/tests/hybi/inspector/server-close.html
@@ -14,32 +14,32 @@
 
     suite.addTestCase({
         name: "WebSocket.ServerClose",
-        description: "WebInspector.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the server.",
+        description: "WI.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the server.",
         test(resolve, reject) {
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, function(event) {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, function(event) {
                 let resource = event.data.resource;
 
-                InspectorTest.expectThat(resource instanceof WebInspector.WebSocketResource, "WebSocketResource should be created.");
-                InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.WebSocket, "WebSocketResource should be a WebSocket type.");
-                InspectorTest.expectEqual(resource.readyState, WebInspector.WebSocketResource.ReadyState.Connecting, "WebSocketResource should be in a Connecting state.");
+                InspectorTest.expectThat(resource instanceof WI.WebSocketResource, "WebSocketResource should be created.");
+                InspectorTest.expectEqual(resource.type, WI.Resource.Type.WebSocket, "WebSocketResource should be a WebSocket type.");
+                InspectorTest.expectEqual(resource.readyState, WI.WebSocketResource.ReadyState.Connecting, "WebSocketResource should be in a Connecting state.");
 
                 let runCount = 0;
 
-                resource.addEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged, function(event) {
+                resource.addEventListener(WI.WebSocketResource.Event.ReadyStateChanged, function(event) {
                     let data = event.data;
                     runCount++;
 
                     if (runCount === 1) {
-                        InspectorTest.expectEqual(data.previousState, WebInspector.WebSocketResource.ReadyState.Connecting, "WebSocketResource previous state should be Connecting.");
-                        InspectorTest.expectEqual(data.state, WebInspector.WebSocketResource.ReadyState.Open, "WebSocketResource state should change to Open.");
-                        InspectorTest.expectEqual(resource.readyState, WebInspector.WebSocketResource.ReadyState.Open, "WebSocketResource should be in a Open state.");
+                        InspectorTest.expectEqual(data.previousState, WI.WebSocketResource.ReadyState.Connecting, "WebSocketResource previous state should be Connecting.");
+                        InspectorTest.expectEqual(data.state, WI.WebSocketResource.ReadyState.Open, "WebSocketResource state should change to Open.");
+                        InspectorTest.expectEqual(resource.readyState, WI.WebSocketResource.ReadyState.Open, "WebSocketResource should be in a Open state.");
                         return;
                     }
 
                     if (runCount === 2) {
-                        InspectorTest.expectEqual(data.previousState, WebInspector.WebSocketResource.ReadyState.Open, "WebSocketResource previous state should be Open.");
-                        InspectorTest.expectEqual(data.state, WebInspector.WebSocketResource.ReadyState.Closed, "WebSocketResource state should change to Closed.");
-                        InspectorTest.expectEqual(resource.readyState, WebInspector.WebSocketResource.ReadyState.Closed, "WebSocketResource should be in a Closed state.");
+                        InspectorTest.expectEqual(data.previousState, WI.WebSocketResource.ReadyState.Open, "WebSocketResource previous state should be Open.");
+                        InspectorTest.expectEqual(data.state, WI.WebSocketResource.ReadyState.Closed, "WebSocketResource state should change to Closed.");
+                        InspectorTest.expectEqual(resource.readyState, WI.WebSocketResource.ReadyState.Closed, "WebSocketResource should be in a Closed state.");
                         resolve();
                     }
                 });
diff --git a/LayoutTests/inspector/canvas/context-attributes.html b/LayoutTests/inspector/canvas/context-attributes.html
index 22b62ce..b9cd98f 100644
--- a/LayoutTests/inspector/canvas/context-attributes.html
+++ b/LayoutTests/inspector/canvas/context-attributes.html
@@ -20,12 +20,12 @@
             name,
             description: "Check that created canvases have the correct type and attributes sent to the frontend.",
             test(resolve, reject) {
-                WebInspector.canvasManager.awaitEvent(WebInspector.CanvasManager.Event.CanvasWasAdded)
+                WI.canvasManager.awaitEvent(WI.CanvasManager.Event.CanvasWasAdded)
                 .then((event) => {
                     let canvas = event.data.canvas;
                     InspectorTest.log("Added canvas.");
 
-                    let contextDisplayName = WebInspector.Canvas.displayNameForContextType(contextType);
+                    let contextDisplayName = WI.Canvas.displayNameForContextType(contextType);
                     InspectorTest.expectEqual(canvas.contextType, contextType, `Canvas context should be "${contextDisplayName}".`);
                     InspectorTest.log(JSON.stringify(canvas.contextAttributes, null, 2));
 
@@ -34,7 +34,7 @@
                 })
                 .then(resolve, reject);
 
-                let type = contextType === WebInspector.Canvas.ContextType.Canvas2D ? "2d" : "webgl";
+                let type = contextType === WI.Canvas.ContextType.Canvas2D ? "2d" : "webgl";
                 let attributes = JSON.stringify(contextAttributes);
                 InspectorTest.evaluateInPage(`createCanvas("${type}", ${attributes})`);
             }
@@ -44,15 +44,15 @@
     const testCases = [
         {
             name: "Create2DCanvasContext",
-            contextType: WebInspector.Canvas.ContextType.Canvas2D,
+            contextType: WI.Canvas.ContextType.Canvas2D,
         },
         {
             name: "CreateWebGLCanvasContext",
-            contextType: WebInspector.Canvas.ContextType.WebGL,
+            contextType: WI.Canvas.ContextType.WebGL,
         },
         {
             name: "CreateWebGLCanvasContextWithAttributes",
-            contextType: WebInspector.Canvas.ContextType.WebGL,
+            contextType: WI.Canvas.ContextType.WebGL,
             contextAttributes: {alpha: false},
         }
     ];
diff --git a/LayoutTests/inspector/canvas/create-context-2d.html b/LayoutTests/inspector/canvas/create-context-2d.html
index 242b509..d51914b 100644
--- a/LayoutTests/inspector/canvas/create-context-2d.html
+++ b/LayoutTests/inspector/canvas/create-context-2d.html
@@ -11,16 +11,16 @@
     addSimpleTestCase({
         name: "Attached",
         expression: `createAttachedCanvas("2d")`,
-        contextType: WebInspector.Canvas.ContextType.Canvas2D,
+        contextType: WI.Canvas.ContextType.Canvas2D,
     });
 
     addSimpleTestCase({
         name: "Detached",
         expression: `createDetachedCanvas("2d")`,
-        contextType: WebInspector.Canvas.ContextType.Canvas2D,
+        contextType: WI.Canvas.ContextType.Canvas2D,
     });
 
-    addCSSCanvasTestCase(WebInspector.Canvas.ContextType.Canvas2D);
+    addCSSCanvasTestCase(WI.Canvas.ContextType.Canvas2D);
 
     suite.runTestCasesAndFinish();
 }
diff --git a/LayoutTests/inspector/canvas/create-context-webgl.html b/LayoutTests/inspector/canvas/create-context-webgl.html
index fdf1c68..2bd5d74 100644
--- a/LayoutTests/inspector/canvas/create-context-webgl.html
+++ b/LayoutTests/inspector/canvas/create-context-webgl.html
@@ -11,16 +11,16 @@
     addSimpleTestCase({
         name: "Attached",
         expression: `createAttachedCanvas("webgl")`,
-        contextType: WebInspector.Canvas.ContextType.WebGL,
+        contextType: WI.Canvas.ContextType.WebGL,
     });
 
     addSimpleTestCase({
         name: "Detached",
         expression: `createDetachedCanvas("webgl")`,
-        contextType: WebInspector.Canvas.ContextType.WebGL,
+        contextType: WI.Canvas.ContextType.WebGL,
     });
 
-    addCSSCanvasTestCase(WebInspector.Canvas.ContextType.WebGL);
+    addCSSCanvasTestCase(WI.Canvas.ContextType.WebGL);
 
     suite.runTestCasesAndFinish();
 }
diff --git a/LayoutTests/inspector/canvas/create-context-webgl2.html b/LayoutTests/inspector/canvas/create-context-webgl2.html
index 51c4274..e1ec7cc 100644
--- a/LayoutTests/inspector/canvas/create-context-webgl2.html
+++ b/LayoutTests/inspector/canvas/create-context-webgl2.html
@@ -14,16 +14,16 @@
     addSimpleTestCase({
         name: "Attached",
         expression: `createAttachedCanvas("webgl2")`,
-        contextType: WebInspector.Canvas.ContextType.WebGL2,
+        contextType: WI.Canvas.ContextType.WebGL2,
     });
 
     addSimpleTestCase({
         name: "Detached",
         expression: `createDetachedCanvas("webgl2")`,
-        contextType: WebInspector.Canvas.ContextType.WebGL2,
+        contextType: WI.Canvas.ContextType.WebGL2,
     });
 
-    addCSSCanvasTestCase(WebInspector.Canvas.ContextType.WebGL2);
+    addCSSCanvasTestCase(WI.Canvas.ContextType.WebGL2);
 
     suite.runTestCasesAndFinish();
 }
diff --git a/LayoutTests/inspector/canvas/create-context-webgpu.html b/LayoutTests/inspector/canvas/create-context-webgpu.html
index 495d26c..5a396b7 100644
--- a/LayoutTests/inspector/canvas/create-context-webgpu.html
+++ b/LayoutTests/inspector/canvas/create-context-webgpu.html
@@ -14,16 +14,16 @@
     addSimpleTestCase({
         name: "Attached",
         expression: `createAttachedCanvas("webgpu")`,
-        contextType: WebInspector.Canvas.ContextType.WebGPU,
+        contextType: WI.Canvas.ContextType.WebGPU,
     });
 
     addSimpleTestCase({
         name: "Detached",
         expression: `createDetachedCanvas("webgpu")`,
-        contextType: WebInspector.Canvas.ContextType.WebGPU,
+        contextType: WI.Canvas.ContextType.WebGPU,
     });
 
-    addCSSCanvasTestCase(WebInspector.Canvas.ContextType.WebGPU);
+    addCSSCanvasTestCase(WI.Canvas.ContextType.WebGPU);
 
     suite.runTestCasesAndFinish();
 }
diff --git a/LayoutTests/inspector/canvas/css-canvas-clients.html b/LayoutTests/inspector/canvas/css-canvas-clients.html
index c10baf0..7fbaf6a 100644
--- a/LayoutTests/inspector/canvas/css-canvas-clients.html
+++ b/LayoutTests/inspector/canvas/css-canvas-clients.html
@@ -40,7 +40,7 @@
         name: "Canvas.CSSCanvasClients.InitialLoad",
         description: "Check that the CanvasManager has one CSS canvas initially.",
         test(resolve, reject) {
-            let canvases = WebInspector.canvasManager.canvases;
+            let canvases = WI.canvasManager.canvases;
             InspectorTest.expectEqual(canvases.length, 1, "CanvasManager should have one canvas.");
             if (!canvases.length) {
                 reject("Missing canvas.");
@@ -60,7 +60,7 @@
         name: "Canvas.CSSCanvasClients.Create",
         description: "Check that creating a CSS canvas client node is tracked correctly.",
         test(resolve, reject) {
-            WebInspector.Canvas.awaitEvent(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged)
+            WI.Canvas.awaitEvent(WI.Canvas.Event.CSSCanvasClientNodesChanged)
             .then((event) => {
                 InspectorTest.expectEqual(event.target.cssCanvasName, "css-canvas", `Canvas with created client should have CSS name "css-canvas".`);
                 event.target.requestCSSCanvasClientNodes((clientNodes) => {
@@ -78,7 +78,7 @@
         name: "Canvas.CSSCanvasClients.Destroy",
         description: "Check that destroying a CSS canvas client node is tracked correctly.",
         test(resolve, reject) {
-            WebInspector.Canvas.awaitEvent(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged)
+            WI.Canvas.awaitEvent(WI.Canvas.Event.CSSCanvasClientNodesChanged)
             .then((event) => {
                 InspectorTest.expectEqual(event.target.cssCanvasName, "css-canvas", `Canvas with destroyed client should have CSS name "css-canvas".`);
                 event.target.requestCSSCanvasClientNodes((clientNodes) => {
diff --git a/LayoutTests/inspector/canvas/memory.html b/LayoutTests/inspector/canvas/memory.html
index 76df193..2a49e03 100644
--- a/LayoutTests/inspector/canvas/memory.html
+++ b/LayoutTests/inspector/canvas/memory.html
@@ -28,7 +28,7 @@
             // performed on that canvas that requires the image buffer.  A blank canvas that was
             // just created will not have a buffer, so its memory cost will be 0/NaN.
 
-            let canvases = WebInspector.canvasManager.canvases.filter((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.Canvas2D);
+            let canvases = WI.canvasManager.canvases.filter((canvas) => canvas.contextType === WI.Canvas.ContextType.Canvas2D);
             if (!canvases.length) {
                 reject("Missing 2D canvas.");
                 return;
@@ -45,7 +45,7 @@
         name: "Canvas.memory.canvasMemoryChanged",
         description: "Check that memory cost is updated when the backend value changes.",
         test(resolve, reject) {
-            let canvases = WebInspector.canvasManager.canvases.filter((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.Canvas2D);
+            let canvases = WI.canvasManager.canvases.filter((canvas) => canvas.contextType === WI.Canvas.ContextType.Canvas2D);
             if (!canvases.length) {
                 reject("Missing 2D canvas.");
                 return;
@@ -53,7 +53,7 @@
 
             InspectorTest.assert(canvases.length === 1, "There should only be one canvas-2d.");
 
-            canvases[0].awaitEvent(WebInspector.Canvas.Event.MemoryChanged)
+            canvases[0].awaitEvent(WI.Canvas.Event.MemoryChanged)
             .then((event) => {
                 InspectorTest.log(`Memory cost of canvas updated to ${event.target.memoryCost}.`);
             })
diff --git a/LayoutTests/inspector/canvas/recording-2d.html b/LayoutTests/inspector/canvas/recording-2d.html
index 195f790..7d89339 100644
--- a/LayoutTests/inspector/canvas/recording-2d.html
+++ b/LayoutTests/inspector/canvas/recording-2d.html
@@ -390,7 +390,7 @@
     let suite = InspectorTest.createAsyncSuite("Canvas.recording2D");
 
     function getCanvas() {
-        let canvases = WebInspector.canvasManager.canvases.filter((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.Canvas2D);
+        let canvases = WI.canvasManager.canvases.filter((canvas) => canvas.contextType === WI.Canvas.ContextType.Canvas2D);
         InspectorTest.assert(canvases.length === 1, "There should only be one canvas-2d.");
         if (canvases.length !== 1)
             return null;
@@ -404,7 +404,7 @@
             return;
         }
 
-        WebInspector.canvasManager.awaitEvent(WebInspector.CanvasManager.Event.RecordingFinished)
+        WI.canvasManager.awaitEvent(WI.CanvasManager.Event.RecordingFinished)
         .then((event) => {
             InspectorTest.evaluateInPage(`cancelActions()`);
 
@@ -468,7 +468,7 @@
                 return;
             }
 
-            WebInspector.canvasManager.awaitEvent(WebInspector.CanvasManager.Event.RecordingFinished)
+            WI.canvasManager.awaitEvent(WI.CanvasManager.Event.RecordingFinished)
             .then((event) => {
                 let recording = event.data.recording.toJSON();
 
diff --git a/LayoutTests/inspector/canvas/requestContent-2d.html b/LayoutTests/inspector/canvas/requestContent-2d.html
index 93da8e9..3a02e23 100644
--- a/LayoutTests/inspector/canvas/requestContent-2d.html
+++ b/LayoutTests/inspector/canvas/requestContent-2d.html
@@ -18,7 +18,7 @@
         name: "Canvas.requestContent2D.validCanvasId",
         description: "Get the base64 encoded data for the canvas on the page with the given type.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.Canvas2D);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.Canvas2D);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/requestContent-webgl.html b/LayoutTests/inspector/canvas/requestContent-webgl.html
index 69b2791..9ec6b8c 100644
--- a/LayoutTests/inspector/canvas/requestContent-webgl.html
+++ b/LayoutTests/inspector/canvas/requestContent-webgl.html
@@ -18,7 +18,7 @@
         name: "Canvas.requestContentWebGL.validCanvasId",
         description: "Get the base64 encoded data for the WebGL canvas on the page.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.WebGL);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/requestContent-webgl2.html b/LayoutTests/inspector/canvas/requestContent-webgl2.html
index 2b5f6ee..9af5894 100644
--- a/LayoutTests/inspector/canvas/requestContent-webgl2.html
+++ b/LayoutTests/inspector/canvas/requestContent-webgl2.html
@@ -21,7 +21,7 @@
         name: "Canvas.requestContentWebGL2.validCanvasId",
         description: "Get the base64 encoded data for the WebGL2 canvas on the page.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.WebGL2);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL2);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/requestNode.html b/LayoutTests/inspector/canvas/requestNode.html
index edcd098..0dcc8dc 100644
--- a/LayoutTests/inspector/canvas/requestNode.html
+++ b/LayoutTests/inspector/canvas/requestNode.html
@@ -18,7 +18,7 @@
         name: "Canvas.requestNode.missingDocument",
         description: "Getting the canvas node requires that WebInspector knows about the document.",
         test(resolve, reject) {
-            let canvases = WebInspector.canvasManager.canvases;
+            let canvases = WI.canvasManager.canvases;
             InspectorTest.expectEqual(canvases.length, 3, "The page should have three canvases.");
             if (!canvases.length) {
                 reject("Missing canvas.");
@@ -37,7 +37,7 @@
         name: "Canvas.requestNode.validCanvasId",
         description: "Get the node id for each canvas on the page.",
         test(resolve, reject) {
-            let canvases = WebInspector.canvasManager.canvases;
+            let canvases = WI.canvasManager.canvases;
             let expectedLength = canvases.length;
             InspectorTest.assert(expectedLength === 3, "The page has 3 canvases.");
 
@@ -63,14 +63,14 @@
             }
 
             canvases.forEach((canvas) => {
-                WebInspector.domTreeManager.requestDocument((documentNode) => {
+                WI.domTreeManager.requestDocument((documentNode) => {
                     CanvasAgent.requestNode(canvas.identifier, (error, nodeId) => {
                         if (error) {
                             reject(error);
                             return;
                         }
 
-                        nodesMap.set(canvas, WebInspector.domTreeManager.nodeForId(nodeId));
+                        nodesMap.set(canvas, WI.domTreeManager.nodeForId(nodeId));
                         if (nodesMap.size === expectedLength)
                             finish();
                     });
diff --git a/LayoutTests/inspector/canvas/resolveCanvasContext-2d.html b/LayoutTests/inspector/canvas/resolveCanvasContext-2d.html
index b3e2ebe..a2a35ed 100644
--- a/LayoutTests/inspector/canvas/resolveCanvasContext-2d.html
+++ b/LayoutTests/inspector/canvas/resolveCanvasContext-2d.html
@@ -17,7 +17,7 @@
         name: `Canvas.resolveCanvasContext2D.validIdentifier`,
         description: "Should return a valid object for the given canvas identifier.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.Canvas2D);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.Canvas2D);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/resolveCanvasContext-webgl.html b/LayoutTests/inspector/canvas/resolveCanvasContext-webgl.html
index 45098eb..6df42a0 100644
--- a/LayoutTests/inspector/canvas/resolveCanvasContext-webgl.html
+++ b/LayoutTests/inspector/canvas/resolveCanvasContext-webgl.html
@@ -17,7 +17,7 @@
         name: `Canvas.resolveCanvasContextWebGL.validIdentifier`,
         description: "Should return a valid object for the given canvas identifier.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.WebGL);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/resolveCanvasContext-webgl2.html b/LayoutTests/inspector/canvas/resolveCanvasContext-webgl2.html
index 5bcfbe2..e9a1eb9 100644
--- a/LayoutTests/inspector/canvas/resolveCanvasContext-webgl2.html
+++ b/LayoutTests/inspector/canvas/resolveCanvasContext-webgl2.html
@@ -20,7 +20,7 @@
         name: `Canvas.resolveCanvasContextWebGL2.validIdentifier`,
         description: "Should return a valid object for the given canvas identifier.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.WebGL2);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL2);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/resolveCanvasContext-webgpu.html b/LayoutTests/inspector/canvas/resolveCanvasContext-webgpu.html
index 78b68ff..1b0886f 100644
--- a/LayoutTests/inspector/canvas/resolveCanvasContext-webgpu.html
+++ b/LayoutTests/inspector/canvas/resolveCanvasContext-webgpu.html
@@ -20,7 +20,7 @@
         name: `Canvas.resolveCanvasContextWebGPU.validIdentifier`,
         description: "Should return a valid object for the given canvas identifier.",
         test(resolve, reject) {
-            let canvas = WebInspector.canvasManager.canvases.find((canvas) => canvas.contextType === WebInspector.Canvas.ContextType.WebGPU);
+            let canvas = WI.canvasManager.canvases.find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGPU);
             if (!canvas) {
                 reject(`Missing Canvas.`);
                 return;
diff --git a/LayoutTests/inspector/canvas/resources/create-context-utilities.js b/LayoutTests/inspector/canvas/resources/create-context-utilities.js
index e3a94ca..2168483 100644
--- a/LayoutTests/inspector/canvas/resources/create-context-utilities.js
+++ b/LayoutTests/inspector/canvas/resources/create-context-utilities.js
@@ -23,7 +23,7 @@
     contexts = [];
 
     // Force GC to make sure the canvas element is destroyed, otherwise the frontend
-    // does not receive WebInspector.CanvasManager.Event.CanvasWasRemoved events.
+    // does not receive WI.CanvasManager.Event.CanvasWasRemoved events.
     setTimeout(() => { GCController.collect(); }, 0);
 }
 
@@ -31,10 +31,10 @@
     let suite = null;
 
     function awaitCanvasAdded(contextType) {
-        return WebInspector.canvasManager.awaitEvent(WebInspector.CanvasManager.Event.CanvasWasAdded)
+        return WI.canvasManager.awaitEvent(WI.CanvasManager.Event.CanvasWasAdded)
         .then((event) => {
             let canvas = event.data.canvas;
-            let contextDisplayName = WebInspector.Canvas.displayNameForContextType(contextType);
+            let contextDisplayName = WI.Canvas.displayNameForContextType(contextType);
             InspectorTest.expectEqual(canvas.contextType, contextType, `Canvas context should be ${contextDisplayName}.`);
 
             return canvas;
@@ -42,7 +42,7 @@
     }
 
     function awaitCanvasRemoved(canvasIdentifier) {
-        return WebInspector.canvasManager.awaitEvent(WebInspector.CanvasManager.Event.CanvasWasRemoved)
+        return WI.canvasManager.awaitEvent(WI.CanvasManager.Event.CanvasWasRemoved)
         .then((event) => {
             let canvas = event.data.canvas;
             InspectorTest.expectEqual(canvas.identifier, canvasIdentifier, "Removed canvas has expected ID.");
@@ -56,7 +56,7 @@
             name: `${suite.name}.NoCanvases`,
             description: "Check that the CanvasManager has no canvases initially.",
             test(resolve, reject) {
-                InspectorTest.expectEqual(WebInspector.canvasManager.canvases.length, 0, "CanvasManager should have no canvases.");
+                InspectorTest.expectEqual(WI.canvasManager.canvases.length, 0, "CanvasManager should have no canvases.");
                 resolve();
             }
         });
@@ -104,7 +104,7 @@
                 })
                 .then(resolve, reject);
 
-                let contextId = contextType === WebInspector.Canvas.ContextType.Canvas2D ? "2d" : contextType;
+                let contextId = contextType === WI.Canvas.ContextType.Canvas2D ? "2d" : contextType;
                 InspectorTest.log(`Create CSS canvas from -webkit-canvas(css-canvas).`);
                 InspectorTest.evaluateInPage(`createCSSCanvas("${contextId}", "css-canvas")`);
             },
diff --git a/LayoutTests/inspector/codemirror/resources/prettyprinting/utilities.js b/LayoutTests/inspector/codemirror/resources/prettyprinting/utilities.js
index 5a3334b..3ef2e77 100644
--- a/LayoutTests/inspector/codemirror/resources/prettyprinting/utilities.js
+++ b/LayoutTests/inspector/codemirror/resources/prettyprinting/utilities.js
@@ -2,8 +2,8 @@
     function loadPrettyPrintingTestAndExpectedResults(testURL) {
         let expectedURL = testURL.replace(/\.([^\.]+)$/, "-expected.$1");
         return Promise.all([
-            NetworkAgent.loadResource(WebInspector.frameResourceManager.mainFrame.id, testURL),
-            NetworkAgent.loadResource(WebInspector.frameResourceManager.mainFrame.id, expectedURL)
+            NetworkAgent.loadResource(WI.frameResourceManager.mainFrame.id, testURL),
+            NetworkAgent.loadResource(WI.frameResourceManager.mainFrame.id, expectedURL)
         ]).then(function(results) {
             return Promise.resolve({testText: results[0].content, expectedText: results[1].content });
         });
@@ -21,7 +21,7 @@
             const end = {line: editor.lineCount() - 1};
             const indentString = "    ";
             let builder = new FormatterContentBuilder(indentString);
-            let formatter = new WebInspector.Formatter(editor, builder);
+            let formatter = new WI.Formatter(editor, builder);
             formatter.format(start, end);
 
             let pass = builder.formattedContent === expectedText;
@@ -45,7 +45,7 @@
     }
 
     window.addPrettyPrintingTests = function(suite, mode, tests) {
-        let testPageURL = WebInspector.frameResourceManager.mainFrame.mainResource.url;
+        let testPageURL = WI.frameResourceManager.mainFrame.mainResource.url;
         let testPageResourcesURL = testPageURL.substring(0, testPageURL.lastIndexOf("/"));            
 
         for (let test of tests) {
diff --git a/LayoutTests/inspector/console/addInspectedNode.html b/LayoutTests/inspector/console/addInspectedNode.html
index 8cba69e..8f86ed2 100644
--- a/LayoutTests/inspector/console/addInspectedNode.html
+++ b/LayoutTests/inspector/console/addInspectedNode.html
@@ -6,7 +6,7 @@
 function test()
 {
     function evaluate$0(callback) {
-        WebInspector.runtimeManager.evaluateInInspectedWindow("$0", {objectGroup: "test", includeCommandLineAPI: true}, callback);
+        WI.runtimeManager.evaluateInInspectedWindow("$0", {objectGroup: "test", includeCommandLineAPI: true}, callback);
     }
 
     let nodeA, nodeB;
@@ -74,14 +74,14 @@
 
     // FIXME: What should $0 be after reloading / navigating the page. Should it be cleared?
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#a", (contentNodeId) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
+        WI.domTreeManager.querySelector(documentNode.id, "#a", (contentNodeId) => {
             InspectorTest.assert(contentNodeId, "#a node should exist.");
-            nodeA = WebInspector.domTreeManager.nodeForId(contentNodeId);
+            nodeA = WI.domTreeManager.nodeForId(contentNodeId);
         });
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#b", (contentNodeId) => {
+        WI.domTreeManager.querySelector(documentNode.id, "#b", (contentNodeId) => {
             InspectorTest.assert(contentNodeId, "#b node should exist.");
-            nodeB = WebInspector.domTreeManager.nodeForId(contentNodeId);
+            nodeB = WI.domTreeManager.nodeForId(contentNodeId);
             suite.runTestCasesAndFinish();
         });
     });
diff --git a/LayoutTests/inspector/console/clearMessages.html b/LayoutTests/inspector/console/clearMessages.html
index 32bc95a..3e0b80e9 100644
--- a/LayoutTests/inspector/console/clearMessages.html
+++ b/LayoutTests/inspector/console/clearMessages.html
@@ -13,13 +13,13 @@
         test(resolve, reject) {
             ConsoleAgent.clearMessages();
 
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
                 InspectorTest.assert(false, "MessageAdded event should not fire.");
             })
             .then(reject, reject);
 
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.Cleared)
+            WI.logManager.awaitEvent(WI.LogManager.Event.Cleared)
             .then((event) => {
                 InspectorTest.expectThat(event, "Cleared event should fire.");
             })
diff --git a/LayoutTests/inspector/console/command-line-api-copy.html b/LayoutTests/inspector/console/command-line-api-copy.html
index 26c4a15..71ce560 100644
--- a/LayoutTests/inspector/console/command-line-api-copy.html
+++ b/LayoutTests/inspector/console/command-line-api-copy.html
@@ -23,9 +23,9 @@
 
     function commandLineAPICopyAndPaste(expression, callback) {
         InspectorTest.assert(typeof expression === "string", "Test requires string expression to evaluate on the page.");
-        WebInspector.runtimeManager.evaluateInInspectedWindow(`copy(${expression})`, {objectGroup: "test", includeCommandLineAPI: true}, () => {
+        WI.runtimeManager.evaluateInInspectedWindow(`copy(${expression})`, {objectGroup: "test", includeCommandLineAPI: true}, () => {
             InspectorTest.evaluateInPage("pasteAndReturnString()", (error, remoteObjectPayload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.assert(remoteObject.type === "string", "RemoteObject from pasteAndReturnString should return a string.");
                 callback(remoteObject.value);
             });
diff --git a/LayoutTests/inspector/console/command-line-api.html b/LayoutTests/inspector/console/command-line-api.html
index bf37eac..b7a13b8 100644
--- a/LayoutTests/inspector/console/command-line-api.html
+++ b/LayoutTests/inspector/console/command-line-api.html
@@ -68,7 +68,7 @@
                         reject();
                 }
 
-                WebInspector.runtimeManager.evaluateInInspectedWindow(`String(${input})`, {objectGroup: "test", includeCommandLineAPI: true}, callback);
+                WI.runtimeManager.evaluateInInspectedWindow(`String(${input})`, {objectGroup: "test", includeCommandLineAPI: true}, callback);
             }
         })
     }
@@ -80,9 +80,9 @@
 
     function listenForConsoleWarning(resolve, reject) {
         // Detect console warning for $('foo').
-        WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+        WI.logManager.singleFireEventListener(WI.LogManager.Event.MessageAdded, (event) => {
             let message = event.data.message;
-            InspectorTest.assert(message instanceof WebInspector.ConsoleMessage);
+            InspectorTest.assert(message instanceof WI.ConsoleMessage);
             InspectorTest.log(`CONSOLE: ${message.messageText}`);
         });
 
@@ -90,14 +90,14 @@
     }
 
     function selectElementForDollarZero(resolve, reject) {
-        WebInspector.domTreeManager.requestDocument((documentNode) => {
+        WI.domTreeManager.requestDocument((documentNode) => {
             if (!documentNode) {
                 InspectorTest.log("FAIL: DOM node not found.");
                 return reject();
             }
 
             // Select div#foo for $0.
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#foo", (contentNodeId) => {
+            WI.domTreeManager.querySelector(documentNode.id, "#foo", (contentNodeId) => {
                 if (!contentNodeId) {
                     InspectorTest.log("FAIL: DOM node not found.");
                     return reject();
diff --git a/LayoutTests/inspector/console/console-api.html b/LayoutTests/inspector/console/console-api.html
index 03ec6a4..a4c9417 100644
--- a/LayoutTests/inspector/console/console-api.html
+++ b/LayoutTests/inspector/console/console-api.html
@@ -57,9 +57,9 @@
         return value;
     }
 
-    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
+    WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, function(event) {
         var message = event.data.message;
-        InspectorTest.assert(message instanceof WebInspector.ConsoleMessage);
+        InspectorTest.assert(message instanceof WI.ConsoleMessage);
         InspectorTest.log("\nSTEP: " + steps[currentStepIndex]);
         InspectorTest.log(JSON.stringify(message, remoteObjectJSONFilter, "  "));
 
@@ -68,7 +68,7 @@
     });
 
     for (var step of steps)
-        WebInspector.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
+        WI.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
 }
 </script>
 </head>
diff --git a/LayoutTests/inspector/console/console-count.html b/LayoutTests/inspector/console/console-count.html
index 914f9a5..01307bb 100644
--- a/LayoutTests/inspector/console/console-count.html
+++ b/LayoutTests/inspector/console/console-count.html
@@ -31,12 +31,12 @@
         test(resolve, reject) {
             let seen = 0;
             const expected = 16;
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, handler);
             function handler(event) {
                 let message = event.data.message;
                 InspectorTest.log(message.messageText);
                 if (++seen === expected) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, handler);
                     resolve();
                 }
             }
@@ -52,12 +52,12 @@
         test(resolve, reject) {
             let seen = 0;
             const expected = 20;
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, handler);
             function handler(event) {
                 let message = event.data.message;
                 InspectorTest.log(message.messageText);
                 if (++seen === expected) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, handler);
                     resolve();
                 }
             }
diff --git a/LayoutTests/inspector/console/console-log-proxy.html b/LayoutTests/inspector/console/console-log-proxy.html
index e709d8b..bedf3db 100644
--- a/LayoutTests/inspector/console/console-log-proxy.html
+++ b/LayoutTests/inspector/console/console-log-proxy.html
@@ -42,7 +42,7 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerProxyConsoleLog()", () => {
                 InspectorTest.evaluateInPage("window.accessedHandlerGet", (error, result) => {
-                    let value = WebInspector.RemoteObject.fromPayload(result).value;
+                    let value = WI.RemoteObject.fromPayload(result).value;
                     InspectorTest.expectEqual(value, false, "Logging Proxy objects should not have triggered get trap.");
                     resolve();
                 });
@@ -56,7 +56,7 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerProxyAndPrimitiveConsoleLog()", () => {
                 InspectorTest.evaluateInPage("window.accessedHandlerGet", (error, result) => {
-                    let value = WebInspector.RemoteObject.fromPayload(result).value;
+                    let value = WI.RemoteObject.fromPayload(result).value;
                     InspectorTest.expectEqual(value, false, "Logging Proxy objects and primitives should not have triggered get trap.");
                     resolve();
                 });
diff --git a/LayoutTests/inspector/console/console-table.html b/LayoutTests/inspector/console/console-table.html
index 2b6fec4..ddd2a19 100644
--- a/LayoutTests/inspector/console/console-table.html
+++ b/LayoutTests/inspector/console/console-table.html
@@ -37,9 +37,9 @@
         return value;
     }
 
-    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
+    WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, function(event) {
         var message = event.data.message;
-        InspectorTest.assert(message instanceof WebInspector.ConsoleMessage);
+        InspectorTest.assert(message instanceof WI.ConsoleMessage);
         InspectorTest.log("\nSTEP: " + steps[currentStepIndex]);
         InspectorTest.log(JSON.stringify(message, remoteObjectJSONFilter, "  "));
 
@@ -48,7 +48,7 @@
     });
 
     for (var step of steps)
-        WebInspector.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
+        WI.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
 }
 </script>
 </head>
diff --git a/LayoutTests/inspector/console/console-time.html b/LayoutTests/inspector/console/console-time.html
index f15a8ba..59e52dc 100644
--- a/LayoutTests/inspector/console/console-time.html
+++ b/LayoutTests/inspector/console/console-time.html
@@ -13,13 +13,13 @@
         test(resolve, reject) {
             let seen = 0;
             const expected = 3;
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, handler);
             function handler(event) {
                 let message = event.data.message;
-                InspectorTest.expectThat(message.type === WebInspector.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
+                InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
                 InspectorTest.expectThat(message.messageText.includes("default"), "Message should contain the 'default' label name somewhere.");
                 if (++seen === expected) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, handler);
                     resolve();
                 }
             }
@@ -39,10 +39,10 @@
         name: "UserLabels",
         description: "Test that user labels works as expected.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
                 let message = event.data.message;
-                InspectorTest.expectThat(message.type === WebInspector.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
+                InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
                 InspectorTest.expectThat(message.messageText.includes("my-label"), "Message should contain the 'my-label' label name somewhere.");
             })
             .then(resolve, reject);
@@ -58,14 +58,14 @@
         test(resolve, reject) {
             let seen = 0;
             const expected = 2;
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, handler);
             function handler(event) {
                 let message = event.data.message;
                 let expectedLabel = seen === 0 ? "my-label-2" : "my-label-1";
-                InspectorTest.expectThat(message.type === WebInspector.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
+                InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
                 InspectorTest.expectThat(message.messageText.includes(expectedLabel), "Message should contain the '" + expectedLabel + "' label name somewhere.");
                 if (++seen === expected) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, handler);
                     resolve();
                 }
             }
@@ -81,17 +81,17 @@
         name: "WarnWhenExisting",
         description: "Test for a warning when trying to start an already started timer.",
         test(resolve, reject) {
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, handler);
             function handler(event) {
                 let message = event.data.message;
-                if (message.level === WebInspector.ConsoleMessage.MessageLevel.Warning) {
-                    InspectorTest.expectThat(message.type === WebInspector.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
+                if (message.level === WI.ConsoleMessage.MessageLevel.Warning) {
+                    InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
                     InspectorTest.pass("Should receive a Warning level message");
                     InspectorTest.expectThat(message.messageText.includes("default"), "Message should contain the 'default' label name somewhere.");
                     return;
                 }
-                if (message.type === WebInspector.ConsoleMessage.MessageType.Timing) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, handler);
+                if (message.type === WI.ConsoleMessage.MessageType.Timing) {
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, handler);
                     resolve();
                 }
             }
@@ -106,11 +106,11 @@
         name: "WarnWhenNotExisting",
         description: "Test for a warning when trying to start an already started timer.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
                 let message = event.data.message;
-                InspectorTest.expectThat(message.type === WebInspector.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
-                InspectorTest.expectThat(message.level === WebInspector.ConsoleMessage.MessageLevel.Warning, "Should receive a Warning level message.");
+                InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message.");
+                InspectorTest.expectThat(message.level === WI.ConsoleMessage.MessageLevel.Warning, "Should receive a Warning level message.");
                 InspectorTest.expectThat(message.messageText.includes("default"), "Message should contain the 'default' label name somewhere.");
             })
             .then(resolve, reject);
diff --git a/LayoutTests/inspector/console/js-isLikelyStackTrace-expected.txt b/LayoutTests/inspector/console/js-isLikelyStackTrace-expected.txt
index dbfd947..f4ddfa5 100644
--- a/LayoutTests/inspector/console/js-isLikelyStackTrace-expected.txt
+++ b/LayoutTests/inspector/console/js-isLikelyStackTrace-expected.txt
@@ -1,6 +1,6 @@
 Test stack trace detection heuristic.
 
-== Running test suite: WebInspector.StackTrace.isLikelyStackTrace
+== Running test suite: WI.StackTrace.isLikelyStackTrace
 -- Running test case: notStacktrace
 ASSERT: Should NOT be a stacktrace.
 
diff --git a/LayoutTests/inspector/console/js-isLikelyStackTrace.html b/LayoutTests/inspector/console/js-isLikelyStackTrace.html
index 6bd12c5..9b9d69e 100644
--- a/LayoutTests/inspector/console/js-isLikelyStackTrace.html
+++ b/LayoutTests/inspector/console/js-isLikelyStackTrace.html
@@ -41,12 +41,12 @@
 
 function test()
 {
-    let suite = InspectorTest.createAsyncSuite("WebInspector.StackTrace.isLikelyStackTrace");
+    let suite = InspectorTest.createAsyncSuite("WI.StackTrace.isLikelyStackTrace");
 
     suite.addTestCase({
         name: "notStacktrace",
         test(resolve, reject) {
-            var result = WebInspector.StackTrace.isLikelyStackTrace("Messages:42\nUnread:16");
+            var result = WI.StackTrace.isLikelyStackTrace("Messages:42\nUnread:16");
             InspectorTest.assert(result, "Should NOT be a stacktrace.");
             resolve();
         }
@@ -59,7 +59,7 @@
                 if (error)
                     reject(error);
 
-                InspectorTest.assert(WebInspector.StackTrace.isLikelyStackTrace(result), "Should be a stacktrace.");
+                InspectorTest.assert(WI.StackTrace.isLikelyStackTrace(result), "Should be a stacktrace.");
 
                 resolve();
             });
@@ -73,7 +73,7 @@
                 if (error)
                     reject(error);
 
-                InspectorTest.assert(WebInspector.StackTrace.isLikelyStackTrace(result), "Should be a stacktrace.");
+                InspectorTest.assert(WI.StackTrace.isLikelyStackTrace(result), "Should be a stacktrace.");
 
                 resolve();
             });
@@ -87,7 +87,7 @@
                 if (error)
                     reject(error);
 
-                InspectorTest.assert(WebInspector.StackTrace.isLikelyStackTrace(result), "Should be a stacktrace.");
+                InspectorTest.assert(WI.StackTrace.isLikelyStackTrace(result), "Should be a stacktrace.");
 
                 resolve();
             });
diff --git a/LayoutTests/inspector/console/message-stack-trace.html b/LayoutTests/inspector/console/message-stack-trace.html
index deb4986..db8b3be 100644
--- a/LayoutTests/inspector/console/message-stack-trace.html
+++ b/LayoutTests/inspector/console/message-stack-trace.html
@@ -56,9 +56,9 @@
         });
     }
 
-    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+    WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, (event) => {
         let message = event.data.message;
-        InspectorTest.assert(message instanceof WebInspector.ConsoleMessage);
+        InspectorTest.assert(message instanceof WI.ConsoleMessage);
         if (messageChecker && messageChecker(message)) {
             messageChecker = null;
             untilPromiseResolver(message);
@@ -83,42 +83,42 @@
         name: "Console.StackTrace.ConsoleTrace",
         description: "StackTrace from console.trace().",
         expression: `setTimeout(triggerConsoleTrace)`,
-        condition(message) { return message.type === WebInspector.ConsoleMessage.MessageType.Trace; },
+        condition(message) { return message.type === WI.ConsoleMessage.MessageType.Trace; },
     });
 
     addTestCase({
         name: "Console.StackTrace.ConsoleError",
         description: "StackTrace from console.error().",
         expression: `setTimeout(triggerConsoleError)`,
-        condition(message) { return message.level === WebInspector.ConsoleMessage.MessageLevel.Error; },
+        condition(message) { return message.level === WI.ConsoleMessage.MessageLevel.Error; },
     });
 
     addTestCase({
         name: "Console.StackTrace.UncaughtException",
         description: "StackTrace from an uncaught exception.",
         expression: `setTimeout(triggerUncaughtException)`,
-        condition(message) { return message.level === WebInspector.ConsoleMessage.MessageLevel.Error; },
+        condition(message) { return message.level === WI.ConsoleMessage.MessageLevel.Error; },
     });
 
     addTestCase({
         name: "Console.StackTrace.UnhandledPromiseRejection.PromiseReject",
         description: "StackTrace from an unhandled promise rejection via Promise.reject(...).",
         expression: `setTimeout(triggerUnhandledRejectionPromiseReject)`,
-        condition(message) { return message.level === WebInspector.ConsoleMessage.MessageLevel.Error; },
+        condition(message) { return message.level === WI.ConsoleMessage.MessageLevel.Error; },
     });
 
     addTestCase({
         name: "Console.StackTrace.UnhandledPromiseRejection.ExplicitReject",
         description: "StackTrace from an unhandled promise rejection via reject(...).",
         expression: `setTimeout(triggerUnhandledRejectionExplicit)`,
-        condition(message) { return message.level === WebInspector.ConsoleMessage.MessageLevel.Error; },
+        condition(message) { return message.level === WI.ConsoleMessage.MessageLevel.Error; },
     });
 
     addTestCase({
         name: "Console.StackTrace.UnhandledPromiseRejection.ImplicitReject",
         description: "StackTrace from an unhandled promise rejection due to an uncaught exception in a promise reaction.",
         expression: `setTimeout(triggerUnhandledRejectionImplicitWithException)`,
-        condition(message) { return message.level === WebInspector.ConsoleMessage.MessageLevel.Error; },
+        condition(message) { return message.level === WI.ConsoleMessage.MessageLevel.Error; },
     });
 
     suite.runTestCasesAndFinish();
diff --git a/LayoutTests/inspector/console/messageAdded-from-named-evaluations.html b/LayoutTests/inspector/console/messageAdded-from-named-evaluations.html
index dfd4924..0243529 100644
--- a/LayoutTests/inspector/console/messageAdded-from-named-evaluations.html
+++ b/LayoutTests/inspector/console/messageAdded-from-named-evaluations.html
@@ -21,7 +21,7 @@
         name: "TriggerMessageFromNameEvaluation",
         description: "Message from named evaluation should have a source location.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
                 let message = event.data.message;
                 let topCallFrame = message.stackTrace.callFrames[0];
@@ -37,7 +37,7 @@
         name: "TriggerExceptionFromNameFunctionConstructorEvaluation",
         description: "Exception message from named Function constructor evaluation should have a source location.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
                 let message = event.data.message;
                 let topCallFrame = message.stackTrace.callFrames[0];
diff --git a/LayoutTests/inspector/console/messageRepeatCountUpdated.html b/LayoutTests/inspector/console/messageRepeatCountUpdated.html
index 2fff41d..7cf86f6 100644
--- a/LayoutTests/inspector/console/messageRepeatCountUpdated.html
+++ b/LayoutTests/inspector/console/messageRepeatCountUpdated.html
@@ -14,16 +14,16 @@
         name: "AddTestMessage",
         description: "Add a new message, it should have a single repeat count.",
         test(resolve, reject) {
-            let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+            let listener = WI.logManager.singleFireEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
                 InspectorTest.assert(false, "Should not fire PreviousMessageRepeatCountUpdated yet.");
                 reject();
             });
 
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
-                InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+                InspectorTest.expectThat(event.data.message instanceof WI.ConsoleMessage, "MessageAdded event should fire.");
                 InspectorTest.expectThat(event.data.message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
-                WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
+                WI.logManager.removeEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
             })
             .then(resolve, reject);
 
@@ -36,16 +36,16 @@
             name: `RepeatTestMessage${i}`,
             description: "Repeat the last message, it should trigger messageRepeatCountUpdated.",
             test(resolve, reject) {
-                let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+                let listener = WI.logManager.singleFireEventListener(WI.LogManager.Event.MessageAdded, (event) => {
                     InspectorTest.assert(false, "Should not fire MessageAdded, this should be a repeat.");
                     reject();
                 });
 
-                WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated)
+                WI.logManager.awaitEvent(WI.LogManager.Event.PreviousMessageRepeatCountUpdated)
                 .then((event) => {
                     InspectorTest.expectThat(event, "PreviousMessageRepeatCountUpdated should fire.");
                     InspectorTest.expectThat(event.data.count === (i + 1), `Count should be ${i + 1}.`);
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, listener, null);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, listener, null);
                 })
                 .then(resolve, reject);
 
@@ -58,16 +58,16 @@
         name: "AddDifferentMessage",
         description: "Add a different message, it should reset the repeat count.",
         test(resolve, reject) {
-            let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+            let listener = WI.logManager.singleFireEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
                 InspectorTest.assert(false, "Should not fire PreviousMessageRepeatCountUpdated, this message is different.");
                 reject();
             });
 
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
-                InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+                InspectorTest.expectThat(event.data.message instanceof WI.ConsoleMessage, "MessageAdded event should fire.");
                 InspectorTest.expectThat(event.data.message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
-                WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
+                WI.logManager.removeEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
             })
             .then(resolve, reject);
 
@@ -79,16 +79,16 @@
         name: "RepeatDifferentMessage",
         description: "Repeat this different message, it should increment the repeat count.",
         test(resolve, reject) {
-            let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+            let listener = WI.logManager.singleFireEventListener(WI.LogManager.Event.MessageAdded, (event) => {
                 InspectorTest.assert(false, "Should not fire MessageAdded, this should be a repeat.");
                 reject();
             });
 
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated)
+            WI.logManager.awaitEvent(WI.LogManager.Event.PreviousMessageRepeatCountUpdated)
             .then((event) => {
                 InspectorTest.expectThat(event, "PreviousMessageRepeatCountUpdated should fire.");
                 InspectorTest.expectThat(event.data.count === 2, "Count should be 2.");
-                WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, listener, null);
+                WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, listener, null);
             })
             .then(resolve, reject);
 
@@ -100,16 +100,16 @@
         name: "AddTestMessageAgain",
         description: "Add the original message again, it should have a single repeat count.",
         test(resolve, reject) {
-            let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+            let listener = WI.logManager.singleFireEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
                 InspectorTest.assert(false, "Should not fire PreviousMessageRepeatCountUpdated yet.");
                 reject();
             });
 
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
-                InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+                InspectorTest.expectThat(event.data.message instanceof WI.ConsoleMessage, "MessageAdded event should fire.");
                 InspectorTest.expectThat(event.data.message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
-                WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
+                WI.logManager.removeEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
             })
             .then(resolve, reject);
 
@@ -123,7 +123,7 @@
         name: "MessagesWithEqualValuesRepeats",
         description: "Repeat messages with equal values should trigger messageRepeatCountUpdated.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated)
+            WI.logManager.awaitEvent(WI.LogManager.Event.PreviousMessageRepeatCountUpdated)
             .then((event) => {
                 InspectorTest.expectThat(event, "PreviousMessageRepeatCountUpdated should fire for repeat messages with equal values.");
             })
@@ -139,18 +139,18 @@
         name: "MessagesWithObjectsDoNotRepeat",
         description: "Repeat messages with objects should not trigger messageRepeatCountUpdated.",
         test(resolve, reject) {
-            let repeatListener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+            let repeatListener = WI.logManager.singleFireEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
                 InspectorTest.assert(false, "PreviousMessageRepeatCountUpdated should not fire for repeat messages with object arguments.");
                 reject();
             });
 
             let remaining = 2;
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function addListener(event) {
-                InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, function addListener(event) {
+                InspectorTest.expectThat(event.data.message instanceof WI.ConsoleMessage, "MessageAdded event should fire.");
                 remaining--;
                 if (!remaining) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, repeatListener, null);
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, addListener, null);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, repeatListener, null);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, addListener, null);
                     resolve();
                 }
             });
@@ -165,18 +165,18 @@
         name: "MessagesWithDifferentLevelsDoNotRepeat",
         description: "Repeat messages with different levels should not trigger messageRepeatCountUpdated.",
         test(resolve, reject) {
-            let repeatListener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+            let repeatListener = WI.logManager.singleFireEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
                 InspectorTest.assert(false, "PreviousMessageRepeatCountUpdated should not fire for repeat messages with different levels.");
                 reject();
             });
 
             let remaining = 2;
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function addListener(event) {
-                InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+            WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, function addListener(event) {
+                InspectorTest.expectThat(event.data.message instanceof WI.ConsoleMessage, "MessageAdded event should fire.");
                 remaining--;
                 if (!remaining) {
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, repeatListener, null);
-                    WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, addListener, null);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, repeatListener, null);
+                    WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, addListener, null);
                     resolve();
                 }
             });
diff --git a/LayoutTests/inspector/console/messagesCleared.html b/LayoutTests/inspector/console/messagesCleared.html
index 618cfb6..a3e652e 100644
--- a/LayoutTests/inspector/console/messagesCleared.html
+++ b/LayoutTests/inspector/console/messagesCleared.html
@@ -11,7 +11,7 @@
         name: "ClearViaConsoleClearMessagesAPI",
         description: "Calling Console.clearMessages should trigger Console.messagesCleared.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.Cleared)
+            WI.logManager.awaitEvent(WI.LogManager.Event.Cleared)
             .then((event) => {
                 InspectorTest.expectThat(event, "Cleared event should fire.");
             })
@@ -25,7 +25,7 @@
         name: "ClearViaConsoleAPI",
         description: "Calling console.clear() should trigger Console.messagesCleared.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.Cleared)
+            WI.logManager.awaitEvent(WI.LogManager.Event.Cleared)
             .then((event) => {
                 InspectorTest.expectThat(event, "Cleared event should fire.");
             })
@@ -39,13 +39,13 @@
         name: "ClearViaCommandLineAPI",
         description: "Calling `clear()` in the command line API should trigger Console.messagesCleared.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.Cleared)
+            WI.logManager.awaitEvent(WI.LogManager.Event.Cleared)
             .then((event) => {
                 InspectorTest.expectThat(event, "Cleared event should fire.");
             })
             .then(resolve, reject);
 
-            WebInspector.runtimeManager.evaluateInInspectedWindow("clear()", {objectGroup: "test", includeCommandLineAPI: true}, function(){});
+            WI.runtimeManager.evaluateInInspectedWindow("clear()", {objectGroup: "test", includeCommandLineAPI: true}, function(){});
         }
     });
 
@@ -53,7 +53,7 @@
         name: "ClearViaPageReload",
         description: "Reloading the page should trigger Console.messagesCleared.",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.Cleared)
+            WI.logManager.awaitEvent(WI.LogManager.Event.Cleared)
             .then((event) => {
                 InspectorTest.expectThat(event, "Cleared event should fire.");
             })
diff --git a/LayoutTests/inspector/controller/runtime-controller-import.html b/LayoutTests/inspector/controller/runtime-controller-import.html
index 3393021..4cc32e7 100644
--- a/LayoutTests/inspector/controller/runtime-controller-import.html
+++ b/LayoutTests/inspector/controller/runtime-controller-import.html
@@ -13,9 +13,9 @@
         description: "Test evaluating an import expression from console.",
         test(resolve, reject) {
             function testSource(expression, count) {
-                let promise = WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded);
+                let promise = WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded);
                 return new Promise((resolve, reject) => {
-                    WebInspector.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
+                    WI.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
                         promise.then(() => {
                             InspectorTest.log("Source: " + expression);
                             InspectorTest.expectThat(result.isUndefined(), "Transformed. Should log the value or an exception.");
diff --git a/LayoutTests/inspector/controller/runtime-controller.html b/LayoutTests/inspector/controller/runtime-controller.html
index 4ca23f3..824e5d2 100644
--- a/LayoutTests/inspector/controller/runtime-controller.html
+++ b/LayoutTests/inspector/controller/runtime-controller.html
@@ -33,7 +33,7 @@
         description: "Test evaluating an object literal string conveniently converts wraps it in parenthesis to avoid misinterpretation as a program with a block and labeled statement.",
         test(resolve, reject) {
             function testSource(expression, callback) {
-                WebInspector.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
+                WI.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
                     InspectorTest.log("Source: " + expression);
                     callback(result, wasThrown);
                 });
@@ -76,7 +76,7 @@
         description: "Test evaluating a simple await expression wraps it into an async function and eventually resolves the value.",
         test(resolve, reject) {
             function testSource(expression, callback) {
-                WebInspector.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
+                WI.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
                     InspectorTest.log("Source: " + expression);
                     callback(result, wasThrown);
                 });
@@ -112,13 +112,13 @@
 
             // We can resolve after receiving the expected number of console.info messages.
             let seen = 0;
-            let listener = WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+            let listener = WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, (event) => {
                 let consoleMessage = event.data.message;
-                if (consoleMessage.level !== WebInspector.ConsoleMessage.MessageLevel.Info)
+                if (consoleMessage.level !== WI.ConsoleMessage.MessageLevel.Info)
                     return;
                 if (++seen !== expected)
                     return;
-                WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, listener);
+                WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, listener);
                 resolve();
             });
         }
diff --git a/LayoutTests/inspector/css/add-rule.html b/LayoutTests/inspector/css/add-rule.html
index 889959f..09cbf67 100644
--- a/LayoutTests/inspector/css/add-rule.html
+++ b/LayoutTests/inspector/css/add-rule.html
@@ -9,7 +9,7 @@
 
     let suite = InspectorTest.createAsyncSuite("CSS.addRule");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
 
     function stringify(range) {
         return `${range.startLine}:${range.startColumn},${range.endLine}:${range.endColumn}`;
@@ -46,9 +46,9 @@
             }
 
             const doNotCreateIfMissing = true;
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, usedExistingInspectorStylesheet, doNotCreateIfMissing);
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, usedExistingInspectorStylesheet, doNotCreateIfMissing);
 
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, inspectorStyleSheetAvailable);
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, inspectorStyleSheetAvailable);
         }
     });
 
@@ -70,7 +70,7 @@
             }
 
             let inspectorStyleSheet = null;
-            for (let styleSheet of WebInspector.cssStyleManager.styleSheets) {
+            for (let styleSheet of WI.cssStyleManager.styleSheets) {
                 if (styleSheet.isInspectorStyleSheet()) {
                     if (inspectorStyleSheet) {
                         reject("There should only be one inspector style sheet");
@@ -106,7 +106,7 @@
             }
 
             let externalStyleSheet = null;
-            for (let styleSheet of WebInspector.cssStyleManager.styleSheets) {
+            for (let styleSheet of WI.cssStyleManager.styleSheets) {
                 if (styleSheet.displayName === "external.css") {
                     if (externalStyleSheet) {
                         reject("There should only be one external style sheet");
diff --git a/LayoutTests/inspector/css/createStyleSheet.html b/LayoutTests/inspector/css/createStyleSheet.html
index 2d42a7c..5f57265 100644
--- a/LayoutTests/inspector/css/createStyleSheet.html
+++ b/LayoutTests/inspector/css/createStyleSheet.html
@@ -6,7 +6,7 @@
 function test()
 {
     let addedStyleSheet;
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
 
     let suite = InspectorTest.createAsyncSuite("CSS.createStyleSheet");
 
@@ -14,7 +14,7 @@
         name: "CheckNoStyleSheets",
         description: "Ensure there are no stylesheets.",
         test(resolve, reject) {
-            InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
+            InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
             resolve();
         }
     });
@@ -24,10 +24,10 @@
             name: "CreateInspectorStyleSheetCall" + i,
             description: "Should create a new inspector stylesheet.",
             test(resolve, reject) {
-                WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetAdded)
+                WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
                 .then((event) => {
-                    InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === i, "Should increase the list of stylesheets.");
-                    InspectorTest.expectThat(event.data.styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "Added StyleSheet origin should be 'inspector'.");
+                    InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === i, "Should increase the list of stylesheets.");
+                    InspectorTest.expectThat(event.data.styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "Added StyleSheet origin should be 'inspector'.");
                     InspectorTest.expectThat(event.data.styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
                     InspectorTest.expectThat(event.data.styleSheet.parentFrame === mainFrame, "Added StyleSheet frame should be the main frame.");
                     if (addedStyleSheet)
@@ -41,7 +41,7 @@
         });
     }
 
-    WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetRemoved)
+    WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetRemoved)
     .then((event) => {
         InspectorTest.fail("Should not be removing any StyleSheets in this test.");
     });
diff --git a/LayoutTests/inspector/css/css-property.html b/LayoutTests/inspector/css/css-property.html
index d149d9b..c0ff559 100644
--- a/LayoutTests/inspector/css/css-property.html
+++ b/LayoutTests/inspector/css/css-property.html
@@ -148,14 +148,14 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "div#x", (contentNodeId) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
+        WI.domTreeManager.querySelector(documentNode.id, "div#x", (contentNodeId) => {
             if (contentNodeId) {
-                let domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-                nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+                let domNode = WI.domTreeManager.nodeForId(contentNodeId);
+                nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
                 if (nodeStyles.needsRefresh) {
-                    nodeStyles.singleFireEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, (event) => {
+                    nodeStyles.singleFireEventListener(WI.DOMNodeStyles.Event.Refreshed, (event) => {
                         suite.runTestCasesAndFinish()
                     });
                 } else
diff --git a/LayoutTests/inspector/css/generate-css-rule-string.html b/LayoutTests/inspector/css/generate-css-rule-string.html
index 56effd8..bdbeb45 100644
--- a/LayoutTests/inspector/css/generate-css-rule-string.html
+++ b/LayoutTests/inspector/css/generate-css-rule-string.html
@@ -44,18 +44,18 @@
         suite.runTestCasesAndFinish();
     }
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#test-node", (contentNodeId) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
+        WI.domTreeManager.querySelector(documentNode.id, "#test-node", (contentNodeId) => {
             if (!contentNodeId) {
                 InspectorTest.log("DOM node not found.");
                 InspectorTest.completeTest();
                 return;
             }
 
-            let domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-            nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+            let domNode = WI.domTreeManager.nodeForId(contentNodeId);
+            nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
             if (nodeStyles.needsRefresh) {
-                nodeStyles.awaitEvent(WebInspector.DOMNodeStyles.Event.Refreshed)
+                nodeStyles.awaitEvent(WI.DOMNodeStyles.Event.Refreshed)
                 .then(validateSelectors);
             } else
                 validateSelectors();
diff --git a/LayoutTests/inspector/css/getAllStyleSheets.html b/LayoutTests/inspector/css/getAllStyleSheets.html
index 5b1a51d..deabd25 100644
--- a/LayoutTests/inspector/css/getAllStyleSheets.html
+++ b/LayoutTests/inspector/css/getAllStyleSheets.html
@@ -23,9 +23,9 @@
         return url.replace(/^.*?LayoutTests\//, "");
     }
 
-    WebInspector.cssStyleManager.fetchStyleSheetsIfNeeded();
+    WI.cssStyleManager.fetchStyleSheetsIfNeeded();
     InspectorBackend.runAfterPendingDispatches(function() {
-        let styleSheets = WebInspector.cssStyleManager.styleSheets;
+        let styleSheets = WI.cssStyleManager.styleSheets;
         InspectorTest.expectThat(styleSheets.length === 4, "There should be four stylesheets.");
 
         for (let styleSheet of styleSheets) {
diff --git a/LayoutTests/inspector/css/manager-preferredInspectorStyleSheetForFrame.html b/LayoutTests/inspector/css/manager-preferredInspectorStyleSheetForFrame.html
index de3a2f4..e2a4161 100644
--- a/LayoutTests/inspector/css/manager-preferredInspectorStyleSheetForFrame.html
+++ b/LayoutTests/inspector/css/manager-preferredInspectorStyleSheetForFrame.html
@@ -5,7 +5,7 @@
 <script>
 function test()
 {
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
     let childFrames = mainFrame.childFrameCollection.toArray();
     InspectorTest.expectEqual(childFrames.length, 1, "Page should have a subframe.");
 
@@ -15,7 +15,7 @@
         name: "CheckNoStyleSheets",
         description: "Ensure there are no stylesheets.",
         test(resolve, reject) {
-            InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
+            InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
             resolve();
         }
     });
@@ -24,15 +24,15 @@
         name: "CreateMainFrameInspectorStyleSheet",
         description: "First request for main frame should create inspector stylesheet.",
         test(resolve, reject) {
-            WebInspector.cssStyleManager.singleFireEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, (event) => {
-                InspectorTest.expectThat(event.data.styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "Added StyleSheet origin should be 'inspector'.");
+            WI.cssStyleManager.singleFireEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, (event) => {
+                InspectorTest.expectThat(event.data.styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "Added StyleSheet origin should be 'inspector'.");
                 InspectorTest.expectThat(event.data.styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
                 InspectorTest.expectThat(event.data.styleSheet.parentFrame === mainFrame, "Added StyleSheet frame should be the main frame.");
             });
 
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, (styleSheet) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
-                InspectorTest.expectThat(styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "StyleSheet origin is inspector.");
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, (styleSheet) => {
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
+                InspectorTest.expectThat(styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "StyleSheet origin is inspector.");
                 InspectorTest.expectThat(styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
                 resolve();
             });
@@ -43,14 +43,14 @@
         name: "AnotherMainFrameRequestDoesNothing",
         description: "Second request for main frame should not create a new stylesheet.",
         test(resolve, reject) {
-            let listener = WebInspector.cssStyleManager.singleFireEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, (event) => {
+            let listener = WI.cssStyleManager.singleFireEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, (event) => {
                 InspectorTest.assert(false, "Should not create a new StyleSheet, should reuse the existing one");
             });
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, (styleSheet) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 1, "Should still be one stylesheet.");
-                InspectorTest.expectThat(styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(mainFrame, (styleSheet) => {
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 1, "Should still be one stylesheet.");
+                InspectorTest.expectThat(styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
                 InspectorTest.expectThat(styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
-                WebInspector.cssStyleManager.removeEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, listener, null);
+                WI.cssStyleManager.removeEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, listener, null);
                 resolve();
             });
         }
@@ -60,15 +60,15 @@
         name: "CreateSubFrameInspectorStyleSheet",
         description: "First request for subframe should create inspector stylesheet.",
         test(resolve, reject) {
-            WebInspector.cssStyleManager.singleFireEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, (event) => {
-                InspectorTest.expectThat(event.data.styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "Added StyleSheet origin should be 'inspector'.");
+            WI.cssStyleManager.singleFireEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, (event) => {
+                InspectorTest.expectThat(event.data.styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "Added StyleSheet origin should be 'inspector'.");
                 InspectorTest.expectThat(event.data.styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
                 InspectorTest.expectThat(event.data.styleSheet.parentFrame === childFrames[0], "Added StyleSheet frame should be a child frame.");
             });
 
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(childFrames[0], (styleSheet) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 2, "Should be two stylesheets.");
-                InspectorTest.expectThat(styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(childFrames[0], (styleSheet) => {
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 2, "Should be two stylesheets.");
+                InspectorTest.expectThat(styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
                 InspectorTest.expectThat(styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
                 resolve();
             });
@@ -79,20 +79,20 @@
         name: "AnotherSubFrameRequestDoesNothing",
         description: "Second request for main frame should not create a new stylesheet.",
         test(resolve, reject) {
-            let listener = WebInspector.cssStyleManager.singleFireEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, (event) => {
+            let listener = WI.cssStyleManager.singleFireEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, (event) => {
                 InspectorTest.assert(false, "Should not create a new StyleSheet, should reuse the existing one");
             });
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(childFrames[0], (styleSheet) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 2, "Should be two stylesheets.");
-                InspectorTest.expectThat(styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(childFrames[0], (styleSheet) => {
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 2, "Should be two stylesheets.");
+                InspectorTest.expectThat(styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
                 InspectorTest.expectThat(styleSheet.isInspectorStyleSheet(), "StyleSheet.isInspectorStyleSheet() should be true.");
-                WebInspector.cssStyleManager.removeEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, listener, null);
+                WI.cssStyleManager.removeEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, listener, null);
                 resolve();
             });
         }
     });
 
-    WebInspector.cssStyleManager.singleFireEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, function(event) {
+    WI.cssStyleManager.singleFireEventListener(WI.CSSStyleManager.Event.StyleSheetRemoved, function(event) {
         InspectorTest.assert(false, "Should not be removing any StyleSheets in this test.");
     });
 
diff --git a/LayoutTests/inspector/css/matched-style-properties.html b/LayoutTests/inspector/css/matched-style-properties.html
index 62772d6..56d7993 100644
--- a/LayoutTests/inspector/css/matched-style-properties.html
+++ b/LayoutTests/inspector/css/matched-style-properties.html
@@ -35,7 +35,7 @@
     {
         for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
             var rule = nodeStyles.matchedRules[i];
-            if (rule.type !== WebInspector.CSSStyleSheet.Type.Author)
+            if (rule.type !== WI.CSSStyleSheet.Type.Author)
                 continue;
 
             for (var j = 0; j < rule.style.properties.length; ++j) {
@@ -54,18 +54,18 @@
 
     function onStylesRefreshed()
     {
-        nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+        nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
         validateStyles();
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
             if (contentNodeId) {
-                var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-                nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+                var domNode = WI.domTreeManager.nodeForId(contentNodeId);
+                nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
                 if (nodeStyles.needsRefresh)
-                    nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+                    nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
                 else
                     validateStyles();
             } else {
diff --git a/LayoutTests/inspector/css/modify-rule-selector.html b/LayoutTests/inspector/css/modify-rule-selector.html
index fee89bb..c9d1a63 100644
--- a/LayoutTests/inspector/css/modify-rule-selector.html
+++ b/LayoutTests/inspector/css/modify-rule-selector.html
@@ -52,24 +52,24 @@
         ++index;
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
         if (!documentNode) {
             InspectorTest.log("ERROR: document not found.");
             InspectorTest.completeTest();
             return;
         }
 
-        WebInspector.domTreeManager.querySelector(documentNode.id, ".foo", function(contentNodeId) {
+        WI.domTreeManager.querySelector(documentNode.id, ".foo", function(contentNodeId) {
             if (!contentNodeId) {
                 InspectorTest.log("ERROR: DOM node not found.");
                 InspectorTest.completeTest();
                 return;
             }
 
-            var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-            nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+            var domNode = WI.domTreeManager.nodeForId(contentNodeId);
+            nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
-            nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+            nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
             if (!nodeStyles.needsRefresh)
                 onStylesRefreshed();
         });
diff --git a/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html b/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html
index 10917ac..1ad636b 100644
--- a/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html
+++ b/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html
@@ -30,15 +30,15 @@
         InspectorTest.completeTest();                
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(contentNodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#x", function(contentNodeId) {
+            var domNode = WI.domTreeManager.nodeForId(contentNodeId);
             InspectorTest.assert(domNode);
             var beforePseudoElementDOMNode = domNode.beforePseudoElement();
             InspectorTest.expectThat(beforePseudoElementDOMNode, "Got ::before pseudo element for #x");
             InspectorTest.log("Refreshing styles for ::before pseudo element");
-            nodeStyles = WebInspector.cssStyleManager.stylesForNode(beforePseudoElementDOMNode);
-            nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, validateStyles);
+            nodeStyles = WI.cssStyleManager.stylesForNode(beforePseudoElementDOMNode);
+            nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, validateStyles);
             nodeStyles.refresh();
         });
     });
diff --git a/LayoutTests/inspector/css/pseudo-element-matches.html b/LayoutTests/inspector/css/pseudo-element-matches.html
index 6d04e0f..4bb48ec 100644
--- a/LayoutTests/inspector/css/pseudo-element-matches.html
+++ b/LayoutTests/inspector/css/pseudo-element-matches.html
@@ -12,7 +12,7 @@
 
         for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
             var rule = nodeStyles.matchedRules[i];
-            if (rule.type !== WebInspector.CSSStyleSheet.Type.UserAgent)
+            if (rule.type !== WI.CSSStyleSheet.Type.UserAgent)
                 continue;
             if (rule.selectorText.indexOf("::-webkit-media-text-track-container") === -1)
                 continue;
@@ -35,15 +35,15 @@
 
     function onStylesRefreshed()
     {
-        nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+        nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
         validateMatchedSelectors();
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
             try { 
                 if (contentNodeId) {
-                    var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
+                    var domNode = WI.domTreeManager.nodeForId(contentNodeId);
                     domNode.getSubtree(1, function() {
                         var shadowRootDocument = domNode.children[0];
                         shadowRootDocument.getSubtree(2, function() {
@@ -51,9 +51,9 @@
                             for (var i = 0; i < shadowRoot.children.length; ++i) {
                                 var shadowNode = shadowRoot.children[i];
                                 if (shadowNode.getAttribute("pseudo") === "-webkit-media-text-track-container") {
-                                    nodeStyles = WebInspector.cssStyleManager.stylesForNode(shadowNode);
+                                    nodeStyles = WI.cssStyleManager.stylesForNode(shadowNode);
                                     if (nodeStyles.needsRefresh)
-                                        nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+                                        nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
                                     else
                                         validateMatchedSelectors();
                                     return;
diff --git a/LayoutTests/inspector/css/selector-dynamic-specificity.html b/LayoutTests/inspector/css/selector-dynamic-specificity.html
index 43cfa33..5794076 100644
--- a/LayoutTests/inspector/css/selector-dynamic-specificity.html
+++ b/LayoutTests/inspector/css/selector-dynamic-specificity.html
@@ -33,7 +33,7 @@
 
         for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
             var rule = nodeStyles.matchedRules[i];
-            if (rule.type !== WebInspector.CSSStyleSheet.Type.Author)
+            if (rule.type !== WI.CSSStyleSheet.Type.Author)
                 continue;
 
             if (seenRules.some(function(r) { return r.isEqualTo(rule); }))
@@ -57,7 +57,7 @@
 
     function onStylesRefreshed()
     {
-        nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+        nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
         validateSelectors();
     }
 
@@ -69,13 +69,13 @@
         }
 
         currentSelector = steps[currentStepIndex++];
-        WebInspector.domTreeManager.querySelector(documentNode.id, currentSelector, function(contentNodeId) {
+        WI.domTreeManager.querySelector(documentNode.id, currentSelector, function(contentNodeId) {
             if (contentNodeId) {
-                var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-                nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+                var domNode = WI.domTreeManager.nodeForId(contentNodeId);
+                nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
                 if (nodeStyles.needsRefresh)
-                    nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+                    nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
                 else
                     validateSelectors();
             } else {
@@ -85,7 +85,7 @@
         });
     }
 
-    WebInspector.domTreeManager.requestDocument(function(node) {
+    WI.domTreeManager.requestDocument(function(node) {
         documentNode = node;
         runNextStep();
     });
diff --git a/LayoutTests/inspector/css/selector-specificity.html b/LayoutTests/inspector/css/selector-specificity.html
index f71d1af..1f37e28 100644
--- a/LayoutTests/inspector/css/selector-specificity.html
+++ b/LayoutTests/inspector/css/selector-specificity.html
@@ -25,7 +25,7 @@
     {
         for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
             var rule = nodeStyles.matchedRules[i];
-            if (rule.type !== WebInspector.CSSStyleSheet.Type.Author)
+            if (rule.type !== WI.CSSStyleSheet.Type.Author)
                 continue;
 
             for (var selector of rule.selectors)
@@ -37,18 +37,18 @@
 
     function onStylesRefreshed()
     {
-        nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+        nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
         validateSelectors();
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
             if (contentNodeId) {
-                var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-                nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+                var domNode = WI.domTreeManager.nodeForId(contentNodeId);
+                nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
                 if (nodeStyles.needsRefresh)
-                    nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+                    nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
                 else
                     validateSelectors();
             } else {
diff --git a/LayoutTests/inspector/css/shadow-scoped-style.html b/LayoutTests/inspector/css/shadow-scoped-style.html
index 4016086..9e61f91 100644
--- a/LayoutTests/inspector/css/shadow-scoped-style.html
+++ b/LayoutTests/inspector/css/shadow-scoped-style.html
@@ -26,19 +26,19 @@
         name: "CSS.ShadowScopedStyle.HostStyles",
         description: "Ensure shadow root host element gets :host styles.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#shadow-host", (nodeId) => {
+            WI.domTreeManager.querySelector(documentNode.id, "#shadow-host", (nodeId) => {
                 if (!nodeId) {
                     InspectorTest.fail("DOM node #shadow-host not found in document.");
                     reject();
                     return;
                 }
 
-                hostNode = WebInspector.domTreeManager.nodeForId(nodeId);
-                let nodeStyles = WebInspector.cssStyleManager.stylesForNode(hostNode);
+                hostNode = WI.domTreeManager.nodeForId(nodeId);
+                let nodeStyles = WI.cssStyleManager.stylesForNode(hostNode);
                 nodeStyles.refresh().then(() => {
                     InspectorTest.expectThat(hostNode.hasShadowRoots(), "Node should have shadow roots.");
                     InspectorTest.expectFalse(hostNode.isInShadowTree(), "Node should not be in a shadow tree.");
-                    InspectorTest.expectThat(hostNode.shadowRoots()[0].shadowRootType() === WebInspector.DOMNode.ShadowRootType.Open, "Node should have an open shadow root.");
+                    InspectorTest.expectThat(hostNode.shadowRoots()[0].shadowRootType() === WI.DOMNode.ShadowRootType.Open, "Node should have an open shadow root.");
                     InspectorTest.expectThat(isEmptyObject(nodeStyles.pseudoElements), "Node should have no pseudo element styles.");
                     dumpStyleDeclarations(nodeStyles.orderedStyles);
                     resolve();
@@ -51,15 +51,15 @@
         name: "CSS.ShadowScopedStyle.ElementInShadowTree",
         description: "Ensure element in shadow tree gets shadow dom scoped styles.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(hostNode.shadowRoots()[0].id, "#shadow-node", (nodeId) => {
+            WI.domTreeManager.querySelector(hostNode.shadowRoots()[0].id, "#shadow-node", (nodeId) => {
                 if (!nodeId) {
                     InspectorTest.fail("DOM node #shadow-node not found in #shadow-host's shadowRoot.");
                     reject();
                     return;
                 }
 
-                let node = WebInspector.domTreeManager.nodeForId(nodeId);
-                let nodeStyles = WebInspector.cssStyleManager.stylesForNode(node);
+                let node = WI.domTreeManager.nodeForId(nodeId);
+                let nodeStyles = WI.cssStyleManager.stylesForNode(node);
                 nodeStyles.refresh().then(() => {
                     InspectorTest.expectFalse(node.hasShadowRoots(), "Node should not have shadow roots.");
                     InspectorTest.expectThat(node.isInShadowTree(), "Node should be in a shadow tree.");
@@ -73,7 +73,7 @@
     // Add Test: CSS.ShadowScopedStyle.SlottedElement
     // FIXME: <https://webkit.org/b/164249> Web Inspector: Ensure inspector shows :slotted() styles in sidebar
 
-    WebInspector.domTreeManager.requestDocument((node) => {
+    WI.domTreeManager.requestDocument((node) => {
         documentNode = node;
         suite.runTestCasesAndFinish();
     });
diff --git a/LayoutTests/inspector/css/stylesheet-events-basic.html b/LayoutTests/inspector/css/stylesheet-events-basic.html
index c0ac4f6..8c10741 100644
--- a/LayoutTests/inspector/css/stylesheet-events-basic.html
+++ b/LayoutTests/inspector/css/stylesheet-events-basic.html
@@ -54,7 +54,7 @@
         name: "CheckNoStyleSheets",
         description: "Ensure there are currently no stylesheets.",
         test(resolve, reject) {
-            InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
+            InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
             resolve();
         }
     });
@@ -67,10 +67,10 @@
         suite.addTestCase({
             name: `Add${title}`,
             test(resolve, reject) {
-                WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetAdded)
+                WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
                 .then((event) => {
                     addedStyleSheet = event.data.styleSheet;
-                    InspectorTest.expectThat(addedStyleSheet instanceof WebInspector.CSSStyleSheet, "StyleSheetAdded event should fire.");
+                    InspectorTest.expectThat(addedStyleSheet instanceof WI.CSSStyleSheet, "StyleSheetAdded event should fire.");
                     if (checkStyleSheetRemovedCallback)
                         checkStyleSheetAddedCallback(addedStyleSheet);
                 })
@@ -84,9 +84,9 @@
             name: `Disable${title}`,
             description: "Disable the newly added stylesheet.",
             test(resolve, reject) {
-                WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetRemoved)
+                WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetRemoved)
                 .then((event) => {
-                    InspectorTest.assert(event.data.styleSheet instanceof WebInspector.CSSStyleSheet, "Event data should be a CSSStyleSheet");
+                    InspectorTest.assert(event.data.styleSheet instanceof WI.CSSStyleSheet, "Event data should be a CSSStyleSheet");
                     InspectorTest.expectThat(addedStyleSheet === event.data.styleSheet, "StyleSheetRemoved event should fire for the same CSSStyleSheet.");
                 })
                 .then(resolve, reject);
@@ -99,9 +99,9 @@
             name: `Enable${title}`,
             description: "Enable the just disabled stylesheet.",
             test(resolve, reject) {
-                WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetAdded)
+                WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
                 .then((event) => {
-                    InspectorTest.assert(event.data.styleSheet instanceof WebInspector.CSSStyleSheet, "Event data should be a CSSStyleSheet");
+                    InspectorTest.assert(event.data.styleSheet instanceof WI.CSSStyleSheet, "Event data should be a CSSStyleSheet");
                     InspectorTest.expectThat(addedStyleSheet !== event.data.styleSheet, "StyleSheetAdded event should fire with a new CSSStyleSheet.");
                     addedStyleSheet = event.data.styleSheet;
                 })
@@ -118,9 +118,9 @@
             suite.addTestCase({
                 name: extraDisableTitle,
                 test(resolve, reject) {
-                    WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetRemoved)
+                    WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetRemoved)
                     .then((event) => {
-                        InspectorTest.assert(event.data.styleSheet instanceof WebInspector.CSSStyleSheet, "Event data should be a CSSStyleSheet");
+                        InspectorTest.assert(event.data.styleSheet instanceof WI.CSSStyleSheet, "Event data should be a CSSStyleSheet");
                         InspectorTest.expectThat(addedStyleSheet === event.data.styleSheet, "StyleSheetRemoved event should fire for the same CSSStyleSheet.");
                     })
                     .then(resolve, reject);
@@ -132,9 +132,9 @@
             suite.addTestCase({
                 name: extraEnableTitle,
                 test(resolve, reject) {
-                    WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetAdded)
+                    WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
                     .then((event) => {
-                        InspectorTest.assert(event.data.styleSheet instanceof WebInspector.CSSStyleSheet, "Event data should be a CSSStyleSheet");
+                        InspectorTest.assert(event.data.styleSheet instanceof WI.CSSStyleSheet, "Event data should be a CSSStyleSheet");
                         InspectorTest.expectThat(addedStyleSheet !== event.data.styleSheet, "StyleSheetAdded event should fire with a new CSSStyleSheet.");
                         addedStyleSheet = event.data.styleSheet;
                     })
@@ -148,9 +148,9 @@
         suite.addTestCase({
             name: `Remove${title}`,
             test(resolve, reject) {
-                WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetRemoved)
+                WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetRemoved)
                 .then((event) => {
-                    InspectorTest.expectThat(event.data.styleSheet instanceof WebInspector.CSSStyleSheet, "StyleSheetAdded event should fire.");
+                    InspectorTest.expectThat(event.data.styleSheet instanceof WI.CSSStyleSheet, "StyleSheetAdded event should fire.");
                     if (checkStyleSheetRemovedCallback)
                         checkStyleSheetRemovedCallback(event.data.styleSheet);
                     addedStyleSheet = null;
diff --git a/LayoutTests/inspector/css/stylesheet-events-imports.html b/LayoutTests/inspector/css/stylesheet-events-imports.html
index 50cf3dd..f2abf09 100644
--- a/LayoutTests/inspector/css/stylesheet-events-imports.html
+++ b/LayoutTests/inspector/css/stylesheet-events-imports.html
@@ -37,8 +37,8 @@
     }
 
     let currentStyleSheetAddedHandler, currentStyleSheetRemovedHandler;
-    WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, (event) => { currentStyleSheetAddedHandler(event); });
-    WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, (event) => { currentStyleSheetRemovedHandler(event); });
+    WI.cssStyleManager.addEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, (event) => { currentStyleSheetAddedHandler(event); });
+    WI.cssStyleManager.addEventListener(WI.CSSStyleManager.Event.StyleSheetRemoved, (event) => { currentStyleSheetRemovedHandler(event); });
 
     let suite = InspectorTest.createAsyncSuite("CSS.StyleSheetEvents.Imports");
 
@@ -46,7 +46,7 @@
         name: "CheckStyleSheets",
         description: "Ensure there are currently two stylesheets.",
         test(resolve, reject) {
-            let styleSheets = WebInspector.cssStyleManager.styleSheets;
+            let styleSheets = WI.cssStyleManager.styleSheets;
             InspectorTest.expectThat(styleSheets.length === 3, "Should be 3 stylesheets.");
             for (let styleSheet of styleSheets)
                 InspectorTest.log(sanitizeURL(styleSheet.url));
diff --git a/LayoutTests/inspector/css/stylesheet-events-inspector-stylesheet.html b/LayoutTests/inspector/css/stylesheet-events-inspector-stylesheet.html
index f3106c39..9e2524b5 100644
--- a/LayoutTests/inspector/css/stylesheet-events-inspector-stylesheet.html
+++ b/LayoutTests/inspector/css/stylesheet-events-inspector-stylesheet.html
@@ -11,7 +11,7 @@
         name: "CheckNoStyleSheets",
         description: "Ensure there are currently no stylesheets.",
         test(resolve, reject) {
-            InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
+            InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 0, "Should be no stylesheets.");
             resolve();
         }
     });
@@ -20,15 +20,15 @@
         name: "CreateInspectorStyleSheet",
         description: "Creating an inspector stylesheet adds a stylesheet.",
         test(resolve, reject) {
-            WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetAdded)
+            WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
             .then((event) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
-                InspectorTest.assert(event.data.styleSheet instanceof WebInspector.CSSStyleSheet, "Event data should be a CSSStyleSheet");
-                InspectorTest.expectThat(event.data.styleSheet.origin === WebInspector.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
+                InspectorTest.assert(event.data.styleSheet instanceof WI.CSSStyleSheet, "Event data should be a CSSStyleSheet");
+                InspectorTest.expectThat(event.data.styleSheet.origin === WI.CSSStyleSheet.Type.Inspector, "StyleSheet origin should be 'inspector'.");
             })
             .then(resolve, reject);
 
-            CSSAgent.createStyleSheet(WebInspector.frameResourceManager.mainFrame.id);
+            CSSAgent.createStyleSheet(WI.frameResourceManager.mainFrame.id);
         }
     });
 
diff --git a/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html b/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html
index 9be3e79..6662712 100644
--- a/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html
+++ b/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html
@@ -22,8 +22,8 @@
     }
 
     function logStyleSheets() {
-        WebInspector.cssStyleManager.styleSheets.sort((a, b) => a.url.localeCompare(b.url)).forEach((styleSheet) => {
-            let frameString = styleSheet.parentFrame.id === WebInspector.frameResourceManager.mainFrame.id ? "<mainframe>" : "<childframe>";
+        WI.cssStyleManager.styleSheets.sort((a, b) => a.url.localeCompare(b.url)).forEach((styleSheet) => {
+            let frameString = styleSheet.parentFrame.id === WI.frameResourceManager.mainFrame.id ? "<mainframe>" : "<childframe>";
             InspectorTest.log(`URL: ${sanitizeURL(styleSheet.url)} ${frameString}`);
         });
     }
@@ -34,7 +34,7 @@
         name: "CheckStyleSheets",
         description: "Ensure there is currently one stylesheet.",
         test(resolve, reject) {
-            InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 1, "Should be one stylesheets.");
+            InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 1, "Should be one stylesheets.");
             logStyleSheets();
             resolve();
         }
@@ -44,10 +44,10 @@
         name: "CheckStyleSheetsAfterAddingSubframe",
         description: "Ensure subframe stylesheets are added.",
         test(resolve, reject) {
-            WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetAdded)
+            WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetAdded)
             .then((event) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 2, "Should be two stylesheets.");
-                InspectorTest.expectThat(event.data.styleSheet.parentFrame !== WebInspector.frameResourceManager.mainFrame.id, "New StyleSheet is for a subframe");
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 2, "Should be two stylesheets.");
+                InspectorTest.expectThat(event.data.styleSheet.parentFrame !== WI.frameResourceManager.mainFrame.id, "New StyleSheet is for a subframe");
                 logStyleSheets();
             })
             .then(resolve, reject);
@@ -60,10 +60,10 @@
         name: "CheckStyleSheetsAfterRemovingSubframe",
         description: "Ensure subframe stylesheets are removed.",
         test(resolve, reject) {
-            WebInspector.cssStyleManager.awaitEvent(WebInspector.CSSStyleManager.Event.StyleSheetRemoved)
+            WI.cssStyleManager.awaitEvent(WI.CSSStyleManager.Event.StyleSheetRemoved)
             .then((event) => {
-                InspectorTest.expectThat(WebInspector.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
-                InspectorTest.expectThat(event.data.styleSheet.parentFrame !== WebInspector.frameResourceManager.mainFrame.id, "Removed StyleSheet is for a subframe");
+                InspectorTest.expectThat(WI.cssStyleManager.styleSheets.length === 1, "Should be one stylesheet.");
+                InspectorTest.expectThat(event.data.styleSheet.parentFrame !== WI.frameResourceManager.mainFrame.id, "Removed StyleSheet is for a subframe");
                 logStyleSheets();
             })
             .then(resolve, reject);
diff --git a/LayoutTests/inspector/css/stylesheet-with-mutations.html b/LayoutTests/inspector/css/stylesheet-with-mutations.html
index 944685d..42d932b 100644
--- a/LayoutTests/inspector/css/stylesheet-with-mutations.html
+++ b/LayoutTests/inspector/css/stylesheet-with-mutations.html
@@ -16,7 +16,7 @@
     {
         for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
             var rule = nodeStyles.matchedRules[i];
-            if (rule.type !== WebInspector.CSSStyleSheet.Type.Author)
+            if (rule.type !== WI.CSSStyleSheet.Type.Author)
                 continue;
 
             for (var selector of rule.selectors)
@@ -28,18 +28,18 @@
 
     function onStylesRefreshed()
     {
-        nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+        nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
         validateSelectors();
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, ".bar", function(contentNodeId) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, ".bar", function(contentNodeId) {
             if (contentNodeId) {
-                var domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-                nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+                var domNode = WI.domTreeManager.nodeForId(contentNodeId);
+                nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
                 if (nodeStyles.needsRefresh)
-                    nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
+                    nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
                 else
                     validateSelectors();
             } else {
diff --git a/LayoutTests/inspector/debugger/async-stack-trace.html b/LayoutTests/inspector/debugger/async-stack-trace.html
index b0a0460..4829403 100644
--- a/LayoutTests/inspector/debugger/async-stack-trace.html
+++ b/LayoutTests/inspector/debugger/async-stack-trace.html
@@ -82,13 +82,13 @@
                 function handlePaused() {
                     InspectorTest.log(`PAUSE #${++pauseCount}`);
                     logActiveStackTrace();
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.resume();
                 }
 
-                WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, handlePaused);
+                WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, handlePaused);
 
                 InspectorTest.singleFireEventListener("AfterTestFunction", () => {
-                    WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, handlePaused);
+                    WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, handlePaused);
                     resolve();
                 });
 
@@ -106,13 +106,13 @@
 
     function setup(resolve) {
         InspectorTest.log("Save DebuggerManager.asyncStackTraceDepth");
-        this.savedCallStackDepth = WebInspector.debuggerManager.asyncStackTraceDepth;
+        this.savedCallStackDepth = WI.debuggerManager.asyncStackTraceDepth;
         resolve();
     }
 
     function teardown(resolve) {
         InspectorTest.log("Restore DebuggerManager.asyncStackTraceDepth");
-        WebInspector.debuggerManager.asyncStackTraceDepth = this.savedCallStackDepth;
+        WI.debuggerManager.asyncStackTraceDepth = this.savedCallStackDepth;
         resolve();
     }
 
@@ -121,15 +121,15 @@
         setup,
         teardown,
         test(resolve, reject) {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
             .then((event) => {
                 let stackTrace = getActiveStackTrace();
                 let asyncStackTrace = stackTrace.parentStackTrace;
                 InspectorTest.expectNull(asyncStackTrace, "Async stack trace should be null.");
-                WebInspector.debuggerManager.resume().then(resolve, reject);
+                WI.debuggerManager.resume().then(resolve, reject);
             });
 
-            WebInspector.debuggerManager.asyncStackTraceDepth = 0;
+            WI.debuggerManager.asyncStackTraceDepth = 0;
             InspectorTest.evaluateInPage("testRequestAnimationFrame()");
         }
     });
@@ -151,7 +151,7 @@
                 const framesPerCallStack = 2;
                 const expectedStackTraceDepth = asyncStackTraceDepth + (asyncStackTraceDepth % framesPerCallStack);
 
-                WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused)
+                WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
                 .then((event) => {
                     let stackTrace = getActiveStackTrace();
                     InspectorTest.assert(stackTrace && stackTrace.callFrames);
@@ -169,11 +169,11 @@
                     InspectorTest.expectEqual(stackTraceDepth, expectedStackTraceDepth, "StackTrace should be truncated to the nearest call stack.");
 
                     logActiveStackTrace();
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
 
                 InspectorTest.log(`Set Debugger.asyncStackTraceDepth equal to ${asyncStackTraceDepth}`);
-                WebInspector.debuggerManager.asyncStackTraceDepth = asyncStackTraceDepth;
+                WI.debuggerManager.asyncStackTraceDepth = asyncStackTraceDepth;
 
                 let repeatCount = Math.floor(asyncStackTraceDepth / framesPerCallStack) + 1;
                 InspectorTest.evaluateInPage(`repeatingRequestAnimationFrame(${repeatCount})`);
diff --git a/LayoutTests/inspector/debugger/break-on-exception-throw-in-promise.html b/LayoutTests/inspector/debugger/break-on-exception-throw-in-promise.html
index 8e3682f..369e9de 100644
--- a/LayoutTests/inspector/debugger/break-on-exception-throw-in-promise.html
+++ b/LayoutTests/inspector/debugger/break-on-exception-throw-in-promise.html
@@ -8,7 +8,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("BreakOnAnyException.Promise");
 
@@ -17,16 +17,16 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                     InspectorTest.expectThat(targetData.pauseReason === "exception", "Should pause for exception.");
-                    let callFrame = WebInspector.debuggerManager.activeCallFrame;
+                    let callFrame = WI.debuggerManager.activeCallFrame;
                     let name = callFrame.functionName || "<anonymous>";
                     let location = callFrame.sourceCodeLocation;
                     let line = location.lineNumber + 1;
                     let column = location.columnNumber + 1;
                     InspectorTest.log(`PAUSE AT ${name}:${line}:${column}`);
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             }
         });
@@ -63,7 +63,7 @@
             InspectorTest.evaluateInPage("setTimeout(testThrowingInPromiseWithRethrowInCatch)");
 
             function logPauseLocation() {
-                let callFrame = WebInspector.debuggerManager.activeCallFrame;
+                let callFrame = WI.debuggerManager.activeCallFrame;
                 let name = callFrame.functionName || "<anonymous>";
                 let location = callFrame.sourceCodeLocation;
                 let line = location.lineNumber + 1;
@@ -72,19 +72,19 @@
             }
 
             let phase = 0;
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-                if (!WebInspector.debuggerManager.activeCallFrame)
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+                if (!WI.debuggerManager.activeCallFrame)
                     return;
 
                 phase++;
 
-                let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
 
                 // Pause at throw inside then.
                 if (phase === 1) {
                     InspectorTest.expectThat(targetData.pauseReason === "exception", "Should pause for exception.");
                     logPauseLocation();
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.resume();
                     return;
                 }
 
@@ -92,8 +92,8 @@
                 if (phase === 2) {
                     InspectorTest.expectThat(targetData.pauseReason === "exception", "Should pause for exception.");
                     logPauseLocation();
-                    WebInspector.debuggerManager.resume().then(() => {
-                        WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+                    WI.debuggerManager.resume().then(() => {
+                        WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.CallFramesDidChange, listener);
                         resolve();
                     }, reject);
                     return;
diff --git a/LayoutTests/inspector/debugger/break-on-exception.html b/LayoutTests/inspector/debugger/break-on-exception.html
index 34bd290..5a59e5b 100644
--- a/LayoutTests/inspector/debugger/break-on-exception.html
+++ b/LayoutTests/inspector/debugger/break-on-exception.html
@@ -8,7 +8,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("BreakOnAnyException");
 
@@ -17,16 +17,16 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                     InspectorTest.expectThat(targetData.pauseReason === "exception", "Should pause for exception.");
-                    let callFrame = WebInspector.debuggerManager.activeCallFrame;
+                    let callFrame = WI.debuggerManager.activeCallFrame;
                     let name = callFrame.functionName || "<anonymous>";
                     let location = callFrame.sourceCodeLocation;
                     let line = location.lineNumber + 1;
                     let column = location.columnNumber + 1;
                     InspectorTest.log(`PAUSE AT ${name}:${line}:${column}`);
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             }
         });
diff --git a/LayoutTests/inspector/debugger/break-on-uncaught-exception-throw-in-promise.html b/LayoutTests/inspector/debugger/break-on-uncaught-exception-throw-in-promise.html
index 8898e7d..7f4dacf 100644
--- a/LayoutTests/inspector/debugger/break-on-uncaught-exception-throw-in-promise.html
+++ b/LayoutTests/inspector/debugger/break-on-uncaught-exception-throw-in-promise.html
@@ -14,7 +14,7 @@
     // FIXME: <https://webkit.org/b/124066> Uncaught exceptions raised in promise completion functions are not printed to console
     // FIXME: <https://webkit.org/b/147502> Uncaught Exception in promise does not trigger break on uncaught exception breakpoint
 
-    WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("BreakOnUncaughtException.Promise");
 
@@ -25,15 +25,15 @@
                 InspectorTest.evaluateInPage(expression);
                 InspectorTest.evaluateInPage(`setTimeout(() => { TestPage.dispatchEventToFrontend("AfterTestFunction"); }, 50)`);
 
-                let listener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+                let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                     InspectorTest.fail("Should not have paused.");
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.resume();
                     reject();
                 });
 
                 InspectorTest.singleFireEventListener("AfterTestFunction", (event) => {
                     InspectorTest.pass("Should not pause, exception is 'caught' by Promise.");
-                    WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, listener);
+                    WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, listener);
                     resolve();
                 });
             }
diff --git a/LayoutTests/inspector/debugger/break-on-uncaught-exception.html b/LayoutTests/inspector/debugger/break-on-uncaught-exception.html
index c4b9987..89fa025 100644
--- a/LayoutTests/inspector/debugger/break-on-uncaught-exception.html
+++ b/LayoutTests/inspector/debugger/break-on-uncaught-exception.html
@@ -8,7 +8,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("BreakOnUncaughtException");
 
@@ -17,16 +17,16 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                     InspectorTest.expectThat(targetData.pauseReason === "exception", "Should pause for exception.");
-                    let callFrame = WebInspector.debuggerManager.activeCallFrame;
+                    let callFrame = WI.debuggerManager.activeCallFrame;
                     let name = callFrame.functionName || "<anonymous>";
                     let location = callFrame.sourceCodeLocation;
                     let line = location.lineNumber + 1;
                     let column = location.columnNumber + 1;
                     InspectorTest.log(`PAUSE AT ${name}:${line}:${column}`);
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             }
         });
@@ -59,15 +59,15 @@
                 TestPage.dispatchEventToFrontend("AfterTestFunction");
             })`);
 
-            let listener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 InspectorTest.fail("Should not have paused.");
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
                 reject();
             });
 
             InspectorTest.singleFireEventListener("AfterTestFunction", (event) => {
                 InspectorTest.pass("Should not pause, exception was caught.");
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, listener);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, listener);
                 resolve();
             });
         }
diff --git a/LayoutTests/inspector/debugger/breakpoint-action-eval.html b/LayoutTests/inspector/debugger/breakpoint-action-eval.html
index 8fac68b..7a605c81 100644
--- a/LayoutTests/inspector/debugger/breakpoint-action-eval.html
+++ b/LayoutTests/inspector/debugger/breakpoint-action-eval.html
@@ -19,7 +19,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         var scriptObject = event.data.script;
 
         if (!/script\-for\-breakpoint\-actions\.js$/.test(scriptObject.url))
@@ -27,11 +27,11 @@
 
         var location = scriptObject.createSourceCodeLocation(4, 0);
         // Create the breakpoint and its actions before sending anything to the backend.
-        var breakpoint = new WebInspector.Breakpoint(location);
+        var breakpoint = new WI.Breakpoint(location);
         breakpoint.autoContinue = true;
-        breakpoint.createAction(WebInspector.BreakpointAction.Type.Evaluate, null, "action(a, b)");
+        breakpoint.createAction(WI.BreakpointAction.Type.Evaluate, null, "action(a, b)");
 
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        WI.debuggerManager.addBreakpoint(breakpoint);
 
         InspectorTest.evaluateInPage("runBreakpointActions()");
     });
diff --git a/LayoutTests/inspector/debugger/breakpoint-action-log.html b/LayoutTests/inspector/debugger/breakpoint-action-log.html
index dbe51c1..20eee39 100644
--- a/LayoutTests/inspector/debugger/breakpoint-action-log.html
+++ b/LayoutTests/inspector/debugger/breakpoint-action-log.html
@@ -17,17 +17,17 @@
         name: "TemplateLiteralPlaceholders",
         description: "Evaluate breakpoint with logging actions that include placeholders.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 let scriptObject = event.data.script;
                 if (!/script\-for\-breakpoint\-actions\.js$/.test(scriptObject.url))
                     return;
 
                 let location = scriptObject.createSourceCodeLocation(4, 0);
-                let breakpoint = new WebInspector.Breakpoint(location);
+                let breakpoint = new WI.Breakpoint(location);
                 breakpoint.autoContinue = true;
 
                 function addLogAction(data) {
-                    breakpoint.createAction(WebInspector.BreakpointAction.Type.Log, breakpoint.actions.lastValue, data);
+                    breakpoint.createAction(WI.BreakpointAction.Type.Log, breakpoint.actions.lastValue, data);
                 }
 
                 addLogAction("`${a}`");
@@ -41,7 +41,7 @@
                 addLogAction("close curly brace in RegExp: ${/\\}/.test('}')}");
                 addLogAction("${a} and ${JSON.stringify(b)}");
 
-                WebInspector.debuggerManager.addBreakpoint(breakpoint);
+                WI.debuggerManager.addBreakpoint(breakpoint);
 
                 InspectorTest.evaluateInPage("runBreakpointActions()", resolve);
             });
diff --git a/LayoutTests/inspector/debugger/breakpoint-columns.html b/LayoutTests/inspector/debugger/breakpoint-columns.html
index e96de75..d02e8e3 100644
--- a/LayoutTests/inspector/debugger/breakpoint-columns.html
+++ b/LayoutTests/inspector/debugger/breakpoint-columns.html
@@ -38,17 +38,17 @@
         var testInfo = testInfoList[currentTestIndex];
         
         var location = currentScripts[testInfo.scriptIndex].createSourceCodeLocation(testInfo.line, testInfo.column);
-        var breakpoint = new WebInspector.Breakpoint(location);
+        var breakpoint = new WI.Breakpoint(location);
 
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        WI.debuggerManager.addBreakpoint(breakpoint);
 
         InspectorTest.evaluateInPage(testInfo.startFunc);
 
         currentTestIndex++;
     }        
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
 
         if (!activeCallFrame)
             return;
@@ -58,14 +58,14 @@
         InspectorTest.log("Hit breakpoint at " + stopLocation);
         InspectorTest.evaluateInPage("console.log('Paused at " + stopLocation + "')");
 
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
        runNextTest();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         var scriptObject = event.data.script;
         
         if (/column-breakpoints-1\.js$/.test(scriptObject.url)) {
diff --git a/LayoutTests/inspector/debugger/breakpoint-scope.html b/LayoutTests/inspector/debugger/breakpoint-scope.html
index f78a1d74..c646f70 100644
--- a/LayoutTests/inspector/debugger/breakpoint-scope.html
+++ b/LayoutTests/inspector/debugger/breakpoint-scope.html
@@ -29,16 +29,16 @@
 
         var testInfo = testInfoList[currentTestIndex];
         var location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
-        var breakpoint = new WebInspector.Breakpoint(location);
+        var breakpoint = new WI.Breakpoint(location);
 
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.evaluateInPage(testInfo.startFunc);
 
         currentTestIndex++;
     }
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
 
         if (!activeCallFrame)
             return;
@@ -48,7 +48,7 @@
         InspectorTest.log("Hit breakpoint at " + stopLocation);
         InspectorTest.evaluateInPage("console.log('Paused at " + stopLocation + "')");
 
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
         var scopeChain = activeCallFrame.scopeChain;
         var scopeTypes = [];
         var scopeTypeIndex = 0;
@@ -56,7 +56,7 @@
 
         for (var scope of scopeChain) {
             scopeTypes.push(scope.type);
-            if (scope.type !== WebInspector.ScopeChainNode.Type.Global) {
+            if (scope.type !== WI.ScopeChainNode.Type.Global) {
                 scope.objects[0].getAllPropertyDescriptors(function(properties) {
                     InspectorTest.log(scopeTypes[scopeTypeIndex++] + " properties:");
                     for (var propertyDescriptor of properties)
@@ -70,16 +70,16 @@
         }
 
         if (globalScopeCount != 1)
-            InspectorTest.log("Error: too many " + WebInspector.ScopeChainNode.Type.Global + " scopes");
+            InspectorTest.log("Error: too many " + WI.ScopeChainNode.Type.Global + " scopes");
 
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
        runNextTest();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         eventScriptObject = event.data.script;
         
         if (/scope\.js$/.test(eventScriptObject.url)) {
diff --git a/LayoutTests/inspector/debugger/breakpoints-disabled.html b/LayoutTests/inspector/debugger/breakpoints-disabled.html
index 9089cf3..5f550782 100644
--- a/LayoutTests/inspector/debugger/breakpoints-disabled.html
+++ b/LayoutTests/inspector/debugger/breakpoints-disabled.html
@@ -17,29 +17,29 @@
             description,
             test(resolve, reject) {
                 let didPause = false;
-                let listener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+                let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                     didPause = true;
                     InspectorTest.fail("Should not have paused.");
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.resume();
                     reject();
                 });
 
                 breakpoint.disabled = false;
-                WebInspector.debuggerManager.breakpointsEnabled = false;
+                WI.debuggerManager.breakpointsEnabled = false;
 
                 InspectorTest.evaluateInPage(expression, () => {
                     InspectorTest.expectFalse(didPause, "Should not pause.")
-                    WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, listener);
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, listener);
+                    WI.debuggerManager.resume();
                     resolve();
                 });
             }
         });
     }
 
-    addTestCase("AssertionsBreakpoint", "Should not pause on assertion failure.", "assertFalse()", WebInspector.debuggerManager.assertionsBreakpoint);
-    addTestCase("AllUncaughtExceptionsBreakpoint", "Should not pause on uncaught exception.", "doThrow()", WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint);
-    addTestCase("AllExceptionsBreakpoint", "Should not pause on caught exception.", "testCatch()", WebInspector.debuggerManager.allExceptionsBreakpoint);
+    addTestCase("AssertionsBreakpoint", "Should not pause on assertion failure.", "assertFalse()", WI.debuggerManager.assertionsBreakpoint);
+    addTestCase("AllUncaughtExceptionsBreakpoint", "Should not pause on uncaught exception.", "doThrow()", WI.debuggerManager.allUncaughtExceptionsBreakpoint);
+    addTestCase("AllExceptionsBreakpoint", "Should not pause on caught exception.", "testCatch()", WI.debuggerManager.allExceptionsBreakpoint);
 
     suite.runTestCasesAndFinish();
 }
diff --git a/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html b/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html
index 4beee23..53e6372 100644
--- a/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html
+++ b/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html
@@ -8,16 +8,16 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     function dumpCommandLineAPIValue(prefix) {
-        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
+        WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
             InspectorTest.log(prefix + ": $exception => " + result.description);
         });
     }
 
     function checkIfExceptionValueMatchesVariable(varName) {
-        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === " + varName, {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
+        WI.runtimeManager.evaluateInInspectedWindow("$exception === " + varName, {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
             InspectorTest.log("  CATCH: $exception === " + varName + " ? " + result.description);
         });
     }
@@ -29,7 +29,7 @@
         name: "EmptyBefore",
         description: "Without exceptions, $exception should be undefined",
         test(resolve, reject) {
-            WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+            WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
                 InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
                 resolve();
             });
@@ -43,8 +43,8 @@
             InspectorTest.evaluateInPage("setTimeout(nestedCatchBlocks, 0)");
 
             let phase = 0;
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-                if (!WebInspector.debuggerManager.activeCallFrame)
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+                if (!WI.debuggerManager.activeCallFrame)
                     return;
 
                 phase++;
@@ -52,14 +52,14 @@
                 // Skip past the first pause to the second pause.
                 if (phase === 1) {
                     dumpCommandLineAPIValue("OUTER 1");
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.resume();
                     return;
                 }
 
                 // Paused on the exception in the inner try, step over to get into the inner catch.
                 if (phase === 2) {
                     dumpCommandLineAPIValue("INNER 1");
-                    WebInspector.debuggerManager.stepOver();
+                    WI.debuggerManager.stepOver();
                     return;
                 }
 
@@ -67,7 +67,7 @@
                 if (phase === 3) {
                     dumpCommandLineAPIValue("INNER 2");
                     checkIfExceptionValueMatchesVariable("e2");
-                    WebInspector.debuggerManager.stepOver();
+                    WI.debuggerManager.stepOver();
                     return;
                 }
         
@@ -76,8 +76,8 @@
                     dumpCommandLineAPIValue("OUTER 2");
                     checkIfExceptionValueMatchesVariable("e1");
                     InspectorTest.singleFireEventListener("AfterTestFunction", resolve);
-                    WebInspector.debuggerManager.resume().then(() => {
-                        WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+                    WI.debuggerManager.resume().then(() => {
+                        WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.CallFramesDidChange, listener);
                     }, reject);
                     return;
                 }
@@ -89,7 +89,7 @@
         name: "EmptyAfter",
         description: "Without exceptions, $exception should be undefined",
         test(resolve, reject) {
-            WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+            WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
                 InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
                 resolve();
             });
diff --git a/LayoutTests/inspector/debugger/command-line-api-exception.html b/LayoutTests/inspector/debugger/command-line-api-exception.html
index b5063da..d982daa 100644
--- a/LayoutTests/inspector/debugger/command-line-api-exception.html
+++ b/LayoutTests/inspector/debugger/command-line-api-exception.html
@@ -9,7 +9,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("CommandLineAPI.$exception");
 
@@ -17,7 +17,7 @@
         suite.addTestCase({
             name, description: "Without exceptions, $exception should be undefined",
             test(resolve, reject) {
-                WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+                WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
                     InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
                     resolve();
                 });
@@ -30,10 +30,10 @@
             name, description: "Trigger an uncaught exception and check $exception.",
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(`setTimeout(${testFunction})`);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
                         InspectorTest.log("$exception => " + result.description);
-                        WebInspector.debuggerManager.resume().then(resolve, reject);
+                        WI.debuggerManager.resume().then(resolve, reject);
                     });
                 });
             }
@@ -49,27 +49,27 @@
                 let didStep = false;
                 let didEvaluate = false;
 
-                let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-                    if (!WebInspector.debuggerManager.activeCallFrame)
+                let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+                    if (!WI.debuggerManager.activeCallFrame)
                         return;
 
                     if (!didStep) {
                         didStep = true;
                         InspectorTest.pass("Paused, stepping out to catch block...");
-                        WebInspector.debuggerManager.stepOut();
+                        WI.debuggerManager.stepOut();
                         return;
                     }
 
                     if (!didEvaluate) {
                         didEvaluate = true;
-                        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === e", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+                        WI.runtimeManager.evaluateInInspectedWindow("$exception === e", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
                             InspectorTest.expectThat(result.description === "true", "`$exception` should be equal to `e`.");
                         });
-                        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+                        WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
                             InspectorTest.log("$exception => " + result.description);
                             InspectorTest.singleFireEventListener("AfterTestFunction", resolve);
-                            WebInspector.debuggerManager.resume().then(() => {
-                                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+                            WI.debuggerManager.resume().then(() => {
+                                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.CallFramesDidChange, listener);
                             }).catch(reject);
                         });
                         return;
diff --git a/LayoutTests/inspector/debugger/continueUntilNextRunLoop.html b/LayoutTests/inspector/debugger/continueUntilNextRunLoop.html
index e6cae51..e04d508 100644
--- a/LayoutTests/inspector/debugger/continueUntilNextRunLoop.html
+++ b/LayoutTests/inspector/debugger/continueUntilNextRunLoop.html
@@ -19,7 +19,7 @@
 function test()
 {
     function topCallFrameName() {
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.mainTarget);
+        let targetData = WI.debuggerManager.dataForTarget(WI.mainTarget);
         return targetData.callFrames[0].functionName;
     }
 
@@ -42,14 +42,14 @@
         description: "Debugger.continueUntilNextRunLoop should only work when paused.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerMultiplePauses()");
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 InspectorTest.pass("Received First Pause Event.");
                 InspectorTest.expectEqual(topCallFrameName(), "pause1", "Should be paused in pause1.");
-                WebInspector.debuggerManager.continueUntilNextRunLoop(WebInspector.mainTarget);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+                WI.debuggerManager.continueUntilNextRunLoop(WI.mainTarget);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                     InspectorTest.pass("Received Second Pause Event.");
                     InspectorTest.expectEqual(topCallFrameName(), "pause2", "Should be paused in pause2.");
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             });
         }
diff --git a/LayoutTests/inspector/debugger/csp-exceptions.html b/LayoutTests/inspector/debugger/csp-exceptions.html
index 2e75432..e68cdc7 100644
--- a/LayoutTests/inspector/debugger/csp-exceptions.html
+++ b/LayoutTests/inspector/debugger/csp-exceptions.html
@@ -26,13 +26,13 @@
         description: "Trigger a CSP Exception inside of script should pause.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("setTimeout(triggerCSPExceptionInsideScript)");
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 InspectorTest.pass("CSP Exception caused by script evaluation should pause.");
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
             });
 
-            WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
-                InspectorTest.assert(event.data.message.level === WebInspector.ConsoleMessage.MessageLevel.Error);
+            WI.logManager.singleFireEventListener(WI.LogManager.Event.MessageAdded, (event) => {
+                InspectorTest.assert(event.data.message.level === WI.ConsoleMessage.MessageLevel.Error);
                 InspectorTest.pass("CSP Exception Console Message: " + event.data.message.messageText);
                 resolve();
             });
@@ -45,15 +45,15 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("setTimeout(triggerCSPExceptionOutsideScript)");
             let didPause = false;
-            let tempPauseFailListener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            let tempPauseFailListener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 didPause = true;
                 InspectorTest.fail("CSP Exception caused outside of script evaluation should not pause, but did.");
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
                 reject();
             });
-            WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, tempPauseFailListener, null);
-                InspectorTest.assert(event.data.message.level === WebInspector.ConsoleMessage.MessageLevel.Error);
+            WI.logManager.singleFireEventListener(WI.LogManager.Event.MessageAdded, (event) => {
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, tempPauseFailListener, null);
+                InspectorTest.assert(event.data.message.level === WI.ConsoleMessage.MessageLevel.Error);
                 InspectorTest.expectFalse(didPause, "CSP Exception caused outside of script evaluation should not pause.");
                 InspectorTest.pass("CSP Exception Console Message: " + event.data.message.messageText);
                 resolve();
diff --git a/LayoutTests/inspector/debugger/debugger-stack-overflow.html b/LayoutTests/inspector/debugger/debugger-stack-overflow.html
index a0d04ce..4d957c8 100644
--- a/LayoutTests/inspector/debugger/debugger-stack-overflow.html
+++ b/LayoutTests/inspector/debugger/debugger-stack-overflow.html
@@ -15,25 +15,25 @@
         // 0 based indices.
         let testInfo = {line: 8, column: 8};
         let location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
-        let breakpoint = new WebInspector.Breakpoint(location);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        let breakpoint = new WI.Breakpoint(location);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.evaluateInPage("start()");
     }
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
         if (!activeCallFrame)
             return;
 
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
         InspectorTest.log("Tests done");
         InspectorTest.completeTest();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         eventScriptObject = event.data.script;
         
         if (/stack-overflow\.js$/.test(eventScriptObject.url)) {
diff --git a/LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html b/LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html
index fb77588..dbc19e9 100644
--- a/LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html
+++ b/LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html
@@ -51,23 +51,23 @@
     }
 
     function testEvaluateOnStrictCallFrame(expression, callback) {
-        let callFrame = WebInspector.debuggerManager.activeCallFrame; // bar
+        let callFrame = WI.debuggerManager.activeCallFrame; // bar
         testEvaluateOnCallFrame(callFrame, expression, callback);
     }
 
     function testEvaluateOnStrictCallFrameThrows(expression, callback) {
-        let callFrame = WebInspector.debuggerManager.activeCallFrame; // bar
+        let callFrame = WI.debuggerManager.activeCallFrame; // bar
         testEvaluateOnCallFrameThrows(callFrame, expression, callback);
     }
 
     function testEvaluateOnNonStrictCallFrame(expression, callback) {
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrame = targetData.callFrames[1]; // foo
         testEvaluateOnCallFrame(callFrame, expression, callback);
     }
 
     function testEvaluateOnNonStrictCallFrameThrows(expression, callback) {
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrame = targetData.callFrames[1]; // foo
         testEvaluateOnCallFrameThrows(callFrame, expression, callback);
     }
@@ -78,8 +78,8 @@
         name: "ValidateCallFrames",
         description: "Test6 evaluate can access CommandLineAPI methods.",
         test(resolve, reject) {
-            let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
-            InspectorTest.expectThat(WebInspector.debuggerManager.activeCallFrame.functionName === "bar", "Strict call frame is `bar`.");
+            let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
+            InspectorTest.expectThat(WI.debuggerManager.activeCallFrame.functionName === "bar", "Strict call frame is `bar`.");
             InspectorTest.expectThat(targetData.callFrames[1].functionName === "foo", "Non-strict call frame is `foo`.");
 
             testEvaluateOnStrictCallFrame("a", (x) => { InspectorTest.expectThat(x === 6, "`a` should be 5 in `bar`."); });
@@ -214,13 +214,13 @@
     suite.addTestCase({
         name: "Complete",
         test(resolve, reject) {
-            WebInspector.debuggerManager.resume();
+            WI.debuggerManager.resume();
             resolve();
         }
     })
 
     InspectorTest.evaluateInPage("triggerPause()");
-    WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+    WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
         suite.runTestCasesAndFinish();
     });
 }
diff --git a/LayoutTests/inspector/debugger/js-stacktrace.html b/LayoutTests/inspector/debugger/js-stacktrace.html
index d131b8a..9f0dc25 100644
--- a/LayoutTests/inspector/debugger/js-stacktrace.html
+++ b/LayoutTests/inspector/debugger/js-stacktrace.html
@@ -76,7 +76,7 @@
         return stackTrace;
     }
 
-    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+    WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, (event) => {
         InspectorTest.log("\nconsole.trace():");
 
         let stackTrace = [];
@@ -106,7 +106,7 @@
                 InspectorTest.evaluateInPage(expression, (error, result) => {
                     InspectorTest.assert(!error, error);
                     InspectorTest.log("\nError object:");
-                    let stackTrace = stripFilePaths(stripPayloadAfterGlobalCode(WebInspector.StackTrace._parseStackTrace(result.value)));
+                    let stackTrace = stripFilePaths(stripPayloadAfterGlobalCode(WI.StackTrace._parseStackTrace(result.value)));
                     InspectorTest.log(JSON.stringify(stackTrace, null, 4));
                     resolve();
                 });
diff --git a/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html b/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html
index 8403a38..ec9dc4a 100644
--- a/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html
+++ b/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html
@@ -18,7 +18,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("Debugger.OutOfMemoryException");
 
@@ -28,7 +28,7 @@
         test(resolve, reject) {
             let paused = false;
 
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 paused = true;
                 InspectorTest.fail("Should not pause.");
                 reject();
diff --git a/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html b/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html
index 52ed9dd..6136690 100644
--- a/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html
+++ b/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html
@@ -17,7 +17,7 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("Debugger.StackOverflowException");
 
@@ -27,7 +27,7 @@
         test(resolve, reject) {
             let paused = false;
 
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 paused = true;
                 InspectorTest.fail("Should not pause.");
                 reject();
diff --git a/LayoutTests/inspector/debugger/pause-reason.html b/LayoutTests/inspector/debugger/pause-reason.html
index 13b9a4e..c70a235 100644
--- a/LayoutTests/inspector/debugger/pause-reason.html
+++ b/LayoutTests/inspector/debugger/pause-reason.html
@@ -9,15 +9,15 @@
 
 function test()
 {
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
-    WebInspector.debuggerManager.assertionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.assertionsBreakpoint.disabled = false;
 
-    for (let script of WebInspector.debuggerManager.dataForTarget(WebInspector.mainTarget).scripts) {
+    for (let script of WI.debuggerManager.dataForTarget(WI.mainTarget).scripts) {
         if (!/pause-reasons\.js$/.test(script.url))
             continue;
         let sourceCodeLocation = script.createSourceCodeLocation(3, 0);
-        let breakpoint = new WebInspector.Breakpoint(sourceCodeLocation);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        let breakpoint = new WI.Breakpoint(sourceCodeLocation);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         break;
     }
 
@@ -44,8 +44,8 @@
                 expression += `;setTimeout(() => { TestPage.dispatchEventToFrontend("AfterTestFunction"); })`;
                 InspectorTest.evaluateInPage(expression);
 
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                     InspectorTest.log("PAUSE #" + (++pauses));
                     InspectorTest.log("  REASON: " + targetData.pauseReason);
                     if (targetData.pauseData)
@@ -53,11 +53,11 @@
                     else
                         InspectorTest.log("  NO DATA");
 
-                    WebInspector.debuggerManager.resume().catch(reject);
+                    WI.debuggerManager.resume().catch(reject);
                     InspectorTest.singleFireEventListener("AfterTestFunction", resolve);
                 });
 
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
                     InspectorTest.log("RESUMED");
                 });
             }
@@ -92,7 +92,7 @@
         name: "Debugger.PauseReason.PauseImmediately",
         description: "Pause for Debugger.pause command should have expected pause reason.",
         expression: "setTimeout(() => { 1 + 1 })",
-        setup() { WebInspector.debuggerManager.pause(); },
+        setup() { WI.debuggerManager.pause(); },
     });
 
     suite.runTestCasesAndFinish();
diff --git a/LayoutTests/inspector/debugger/paused-scopes.html b/LayoutTests/inspector/debugger/paused-scopes.html
index b077090..2dd1245 100644
--- a/LayoutTests/inspector/debugger/paused-scopes.html
+++ b/LayoutTests/inspector/debugger/paused-scopes.html
@@ -8,14 +8,14 @@
 {
     function scopeTypeName(type) {
         switch (type) {
-            case WebInspector.ScopeChainNode.Type.Local: return "Local";
-            case WebInspector.ScopeChainNode.Type.Global: return "Global";
-            case WebInspector.ScopeChainNode.Type.GlobalLexicalEnvironment: return "GlobalLexicalEnvironment";
-            case WebInspector.ScopeChainNode.Type.With: return "With";
-            case WebInspector.ScopeChainNode.Type.Closure: return "Closure";
-            case WebInspector.ScopeChainNode.Type.Catch: return "Catch";
-            case WebInspector.ScopeChainNode.Type.FunctionName: return "FunctionName";
-            case WebInspector.ScopeChainNode.Type.Block: return "Block";
+            case WI.ScopeChainNode.Type.Local: return "Local";
+            case WI.ScopeChainNode.Type.Global: return "Global";
+            case WI.ScopeChainNode.Type.GlobalLexicalEnvironment: return "GlobalLexicalEnvironment";
+            case WI.ScopeChainNode.Type.With: return "With";
+            case WI.ScopeChainNode.Type.Closure: return "Closure";
+            case WI.ScopeChainNode.Type.Catch: return "Catch";
+            case WI.ScopeChainNode.Type.FunctionName: return "FunctionName";
+            case WI.ScopeChainNode.Type.Block: return "Block";
             default: return "Unknown!";
         };
     }
@@ -31,7 +31,7 @@
         for (let scope of scopeChain) {
             let data = {scope, properties: []};
             scopeChainData.push(data);
-            if (scope.type === WebInspector.ScopeChainNode.Type.Global)
+            if (scope.type === WI.ScopeChainNode.Type.Global)
                 continue;
 
             for (let scopeObject of scope.objects) {
@@ -72,7 +72,7 @@
     }
 
     function dumpCallFrames() {
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrames = targetData.callFrames;
         let chain = Promise.resolve();
         for (let callFrame of callFrames)
@@ -88,7 +88,7 @@
         description: "Dump CallFrames and Scopes with the first pause.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("setTimeout(entry)");
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 dumpCallFrames().then(resolve, reject);
             });
         }
@@ -98,8 +98,8 @@
         name: "PausedCallFrameScope.TriggerSecondPause",
         description: "Dump CallFrames and Scopes with the second pause.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.resume();
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.resume();
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 dumpCallFrames().then(resolve, reject);
             });
         }
@@ -109,8 +109,8 @@
         name: "PausedCallFrameScope.TriggerThirdPause",
         description: "Dump CallFrames and Scopes with the third pause.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.resume();
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.resume();
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 dumpCallFrames().then(resolve, reject);
             });
         }
@@ -119,7 +119,7 @@
     suite.addTestCase({
         name: "PausedCallFrameScope.Complete",
         test(resolve, reject) {
-            WebInspector.debuggerManager.resume().then(resolve, reject);
+            WI.debuggerManager.resume().then(resolve, reject);
         }
     });
 
diff --git a/LayoutTests/inspector/debugger/probe-manager-add-remove-actions.html b/LayoutTests/inspector/debugger/probe-manager-add-remove-actions.html
index 59889d9..b3682e2 100644
--- a/LayoutTests/inspector/debugger/probe-manager-add-remove-actions.html
+++ b/LayoutTests/inspector/debugger/probe-manager-add-remove-actions.html
@@ -7,7 +7,7 @@
 <script>
 function test()
 {
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, function() {
+    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, function() {
         InspectorTest.startTracingBreakpoints();
         InspectorTest.startTracingProbes();
 
@@ -21,9 +21,9 @@
                 InspectorTest.completeTest();
         }
 
-        WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SampleAdded, incrementTick);
+        WI.Probe.addEventListener(WI.Probe.Event.SampleAdded, incrementTick);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
 
             var scriptObject = event.data.script;
 
@@ -32,14 +32,14 @@
 
             var location = scriptObject.createSourceCodeLocation(4, 0);
             // Create the breakpoint and its actions before sending anything to the backend.
-            var breakpoint = new WebInspector.Breakpoint(location);
+            var breakpoint = new WI.Breakpoint(location);
             breakpoint.autoContinue = true;
             for (var i of [0, 1])
-                breakpoint.createAction(WebInspector.BreakpointAction.Type.Probe, null, "a");
+                breakpoint.createAction(WI.BreakpointAction.Type.Probe, null, "a");
 
-            WebInspector.debuggerManager.addBreakpoint(breakpoint);
+            WI.debuggerManager.addBreakpoint(breakpoint);
 
-            breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, function() {
+            breakpoint.addEventListener(WI.Breakpoint.Event.ResolvedStateDidChange, function() {
                 InspectorTest.expectThat(breakpoint.resolved, "Breakpoint should be resolved.");
             });
 
diff --git a/LayoutTests/inspector/debugger/resources/log-active-stack-trace.js b/LayoutTests/inspector/debugger/resources/log-active-stack-trace.js
index 58d5c01..8b39616 100644
--- a/LayoutTests/inspector/debugger/resources/log-active-stack-trace.js
+++ b/LayoutTests/inspector/debugger/resources/log-active-stack-trace.js
@@ -1,17 +1,17 @@
 TestPage.registerInitializer(() => {
     window.getActiveStackTrace = function() {
-        InspectorTest.assert(WebInspector.debuggerManager.activeCallFrame, "Active call frame should exist.");
-        if (!WebInspector.debuggerManager.activeCallFrame)
+        InspectorTest.assert(WI.debuggerManager.activeCallFrame, "Active call frame should exist.");
+        if (!WI.debuggerManager.activeCallFrame)
             return null;
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         InspectorTest.assert(targetData, "Data for active call frame target should exist.");
         if (!targetData)
             return null;
 
         const topCallFrameIsBoundary = false;
         const truncated = false;
-        return new WebInspector.StackTrace(targetData.callFrames, topCallFrameIsBoundary, truncated, targetData.asyncStackTrace);
+        return new WI.StackTrace(targetData.callFrames, topCallFrameIsBoundary, truncated, targetData.asyncStackTrace);
     }
 
     window.logActiveStackTrace = function() {
diff --git a/LayoutTests/inspector/debugger/resources/log-pause-location.js b/LayoutTests/inspector/debugger/resources/log-pause-location.js
index f60e5d5..24abd4a 100644
--- a/LayoutTests/inspector/debugger/resources/log-pause-location.js
+++ b/LayoutTests/inspector/debugger/resources/log-pause-location.js
@@ -7,7 +7,7 @@
     }
 
     window.findScript = function(regex) {
-        let resources = WebInspector.frameResourceManager.mainFrame.resourceCollection.items;
+        let resources = WI.frameResourceManager.mainFrame.resourceCollection.items;
         for (let resource of resources) {
             if (regex.test(resource.url))
                 return resource.scripts[0];
@@ -28,12 +28,12 @@
     }
 
     window.loadMainPageContent = function() {
-        return loadLinesFromSourceCode(WebInspector.frameResourceManager.mainFrame.mainResource);
+        return loadLinesFromSourceCode(WI.frameResourceManager.mainFrame.mainResource);
     }
 
     window.setBreakpointsOnLinesWithBreakpointComment = function(resource) {
         if (!resource)
-            resource = WebInspector.frameResourceManager.mainFrame.mainResource;
+            resource = WI.frameResourceManager.mainFrame.mainResource;
 
         function createLocation(resource, lineNumber, columnNumber) {
             return {url: resource.url, lineNumber, columnNumber};
@@ -54,7 +54,7 @@
     }
 
     window.logResolvedBreakpointLinesWithContext = function(inputLocation, resolvedLocation, context) {
-        if (resolvedLocation.sourceCode !== linesSourceCode && !WebInspector.frameResourceManager.mainFrame.mainResource.scripts.includes(resolvedLocation.sourceCode)) {
+        if (resolvedLocation.sourceCode !== linesSourceCode && !WI.frameResourceManager.mainFrame.mainResource.scripts.includes(resolvedLocation.sourceCode)) {
             InspectorTest.log("--- Source Unavailable ---");
             return;
         }
@@ -95,7 +95,7 @@
     }
 
     window.logLinesWithContext = function(location, context) {
-        if (location.sourceCode !== linesSourceCode && !WebInspector.frameResourceManager.mainFrame.mainResource.scripts.includes(location.sourceCode)) {
+        if (location.sourceCode !== linesSourceCode && !WI.frameResourceManager.mainFrame.mainResource.scripts.includes(location.sourceCode)) {
             InspectorTest.log("--- Source Unavailable ---");
             return;
         }
@@ -116,7 +116,7 @@
     }
 
     window.logPauseLocation = function() {
-        let callFrame = WebInspector.debuggerManager.activeCallFrame;
+        let callFrame = WI.debuggerManager.activeCallFrame;
         let name = callFrame.functionName || "<anonymous>";
         let location = callFrame.sourceCodeLocation;
         let line = location.lineNumber + 1;
@@ -133,31 +133,31 @@
         switch (type) {
         case "in":
             InspectorTest.log("ACTION: step-in");
-            WebInspector.debuggerManager.stepInto();
+            WI.debuggerManager.stepInto();
             break;
         case "over":
             InspectorTest.log("ACTION: step-over");
-            WebInspector.debuggerManager.stepOver();
+            WI.debuggerManager.stepOver();
             break;
         case "out":
             InspectorTest.log("ACTION: step-out");
-            WebInspector.debuggerManager.stepOut();
+            WI.debuggerManager.stepOut();
             break;
         case "resume":
             InspectorTest.log("ACTION: resume");
-            WebInspector.debuggerManager.resume();
+            WI.debuggerManager.resume();
             break;
         default:
             InspectorTest.fail("Unhandled step.");
-            WebInspector.debuggerManager.resume();
+            WI.debuggerManager.resume();
             break;
         }
     }
 
     window.initializeSteppingTestSuite = function(testSuite) {
         suite = testSuite;
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-            if (!WebInspector.debuggerManager.activeCallFrame)
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+            if (!WI.debuggerManager.activeCallFrame)
                 return;
             logPauseLocation();
             step(currentSteps.shift());
@@ -171,16 +171,16 @@
                 // Setup.
                 currentSteps = steps;
                 InspectorTest.assert(steps[steps.length - 1] === "resume", "The test should always resume at the end to avoid timeouts.");
-                WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = pauseOnAllException ? false : true;
+                WI.debuggerManager.allExceptionsBreakpoint.disabled = pauseOnAllException ? false : true;
 
                 // Trigger entry and step through it.
                 InspectorTest.evaluateInPage(expression);
                 InspectorTest.log(`EXPRESSION: ${expression}`);
                 InspectorTest.log(`STEPS: ${steps.join(", ")}`);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    InspectorTest.log(`PAUSED (${WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target).pauseReason})`);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    InspectorTest.log(`PAUSED (${WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target).pauseReason})`);
                 });
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, (event) => {
                     InspectorTest.log("RESUMED");
                     InspectorTest.expectThat(steps.length === 0, "Should have used all steps.");
                     resolve();
diff --git a/LayoutTests/inspector/debugger/search-scripts.html b/LayoutTests/inspector/debugger/search-scripts.html
index c11be3b..c4c8161 100644
--- a/LayoutTests/inspector/debugger/search-scripts.html
+++ b/LayoutTests/inspector/debugger/search-scripts.html
@@ -25,7 +25,7 @@
     var scriptsCount = 0;
     const expectedScriptsCount = 5;
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         var script = event.data.script;
         if (!/LayoutTests/.test(script.url) && !/eval\d\.js/.test(script.sourceURL))
             return;
diff --git a/LayoutTests/inspector/debugger/setPauseOnAssertions.html b/LayoutTests/inspector/debugger/setPauseOnAssertions.html
index e4482d7..fe2e5ed 100644
--- a/LayoutTests/inspector/debugger/setPauseOnAssertions.html
+++ b/LayoutTests/inspector/debugger/setPauseOnAssertions.html
@@ -11,7 +11,7 @@
 function test()
 {
     // Pause on all exceptions should not affect pausing on assertions.
-    WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
 
     let suite = InspectorTest.createAsyncSuite("Debugger.setPauseOnAssertions");
 
@@ -19,16 +19,16 @@
         name: "Debugger.setPauseOnAssertions.Disabled",
         description: "Do not pause on assertions when disabled.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.assertionsBreakpoint.disabled = true;
+            WI.debuggerManager.assertionsBreakpoint.disabled = true;
 
-            let listener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 InspectorTest.fail("Should not have paused.");
                 reject();
             });
 
             InspectorTest.evaluateInPage("triggerAssertions()", () => {
                 InspectorTest.pass("Should not pause.");
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, listener);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, listener);
                 resolve();
             });
         }
@@ -38,12 +38,12 @@
         name: "Debugger.setPauseOnAssertions.Enabled",
         description: "Pause on assertions when enabled.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.assertionsBreakpoint.disabled = false;
+            WI.debuggerManager.assertionsBreakpoint.disabled = false;
 
             let didPause = false;
-            let listener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 InspectorTest.pass("Should paused.");
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
                 didPause = true;
             });
 
diff --git a/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html b/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html
index 23e93c1..17fcb67 100644
--- a/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html
+++ b/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html
@@ -39,7 +39,7 @@
         description: "Trigger multiple Function constructor calls with the same source and expect multiple Scripts added with sourceURLs.",
         test(resolve, reject) {
             let seen = 0;
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 if (event.data.script.sourceURL === "test-Function-constructor.js")
                     seen++;
             });
@@ -55,7 +55,7 @@
         description: "Trigger multiple program executions with the same source and expect multiple Scripts added with sourceURLs.",
         test(resolve, reject) {
             let seen = 0;
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 if (event.data.script.sourceURL === "test-program.js")
                     seen++;
             });
@@ -71,7 +71,7 @@
         description: "Trigger eval with the same source and expect multiple Scripts added with sourceURLs.",
         test(resolve, reject) {
             let seen = 0;
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 if (event.data.script.sourceURL === "test-eval.js")
                     seen++;
             });
diff --git a/LayoutTests/inspector/debugger/stepping/stepInto.html b/LayoutTests/inspector/debugger/stepping/stepInto.html
index 26d7e4d..0ba7a5d 100644
--- a/LayoutTests/inspector/debugger/stepping/stepInto.html
+++ b/LayoutTests/inspector/debugger/stepping/stepInto.html
@@ -43,11 +43,11 @@
     let suite = InspectorTest.createAsyncSuite("Debugger.stepInto");
 
     // Always step-in when call frames change.
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-        if (!WebInspector.debuggerManager.activeCallFrame)
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+        if (!WI.debuggerManager.activeCallFrame)
             return;
         logPauseLocation();
-        WebInspector.debuggerManager.stepInto();
+        WI.debuggerManager.stepInto();
     });
 
     function addTestCase({name, description, expression}) {
@@ -55,10 +55,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    InspectorTest.log(`PAUSED (${WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target).pauseReason})`);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    InspectorTest.log(`PAUSED (${WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target).pauseReason})`);
                 });
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, (event) => {
                     InspectorTest.log("RESUMED");
                     resolve();
                 });
diff --git a/LayoutTests/inspector/debugger/stepping/stepOut.html b/LayoutTests/inspector/debugger/stepping/stepOut.html
index c141cac..bcfa65c 100644
--- a/LayoutTests/inspector/debugger/stepping/stepOut.html
+++ b/LayoutTests/inspector/debugger/stepping/stepOut.html
@@ -41,11 +41,11 @@
     let suite = InspectorTest.createAsyncSuite("Debugger.stepOut");
 
     // Always step-out when call frames change.
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-        if (!WebInspector.debuggerManager.activeCallFrame)
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+        if (!WI.debuggerManager.activeCallFrame)
             return;
         logPauseLocation();
-        WebInspector.debuggerManager.stepOut();
+        WI.debuggerManager.stepOut();
     });
 
     function addTestCase({name, description, expression}) {
@@ -53,10 +53,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    InspectorTest.log(`PAUSED (${WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target).pauseReason})`);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    InspectorTest.log(`PAUSED (${WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target).pauseReason})`);
                 });
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, (event) => {
                     InspectorTest.log("RESUMED");
                     resolve();
                 });
diff --git a/LayoutTests/inspector/debugger/stepping/stepOver.html b/LayoutTests/inspector/debugger/stepping/stepOver.html
index 3aed45c..6b94923 100644
--- a/LayoutTests/inspector/debugger/stepping/stepOver.html
+++ b/LayoutTests/inspector/debugger/stepping/stepOver.html
@@ -43,11 +43,11 @@
     let suite = InspectorTest.createAsyncSuite("Debugger.stepOver");
 
     // Always step-over when call frames change.
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-        if (!WebInspector.debuggerManager.activeCallFrame)
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+        if (!WI.debuggerManager.activeCallFrame)
             return;
         logPauseLocation();
-        WebInspector.debuggerManager.stepOver();
+        WI.debuggerManager.stepOver();
     });
 
     function addTestCase({name, description, expression}) {
@@ -55,10 +55,10 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.evaluateInPage(expression);
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                    InspectorTest.log(`PAUSED (${WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target).pauseReason})`);
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    InspectorTest.log(`PAUSED (${WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target).pauseReason})`);
                 });
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, (event) => {
                     InspectorTest.log("RESUMED");
                     resolve();
                 });
diff --git a/LayoutTests/inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html b/LayoutTests/inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html
index 7e40717..5bd497d 100644
--- a/LayoutTests/inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html
+++ b/LayoutTests/inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html
@@ -22,25 +22,25 @@
         description: "Stepping through statements should still work after encountering an autoContinue breakpoint.",
         test(resolve, reject) {
             // Set autoContinue breakpoint.
-            let script = WebInspector.frameResourceManager.mainFrame.mainResource.scripts[0];
+            let script = WI.frameResourceManager.mainFrame.mainResource.scripts[0];
             var location = script.createSourceCodeLocation(8, 0);
-            var breakpoint = new WebInspector.Breakpoint(location);
+            var breakpoint = new WI.Breakpoint(location);
             breakpoint.autoContinue = true;
-            breakpoint.createAction(WebInspector.BreakpointAction.Type.Evaluate, null, "alert(1.5);");
-            WebInspector.debuggerManager.addBreakpoint(breakpoint);
+            breakpoint.createAction(WI.BreakpointAction.Type.Evaluate, null, "alert(1.5);");
+            WI.debuggerManager.addBreakpoint(breakpoint);
 
             // Step through the breakpoint.
             InspectorTest.evaluateInPage("setTimeout(entry)");
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
-                InspectorTest.log(`PAUSED (${WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target).pauseReason})`);
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                InspectorTest.log(`PAUSED (${WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target).pauseReason})`);
             });
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
-                if (!WebInspector.debuggerManager.activeCallFrame)
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
+                if (!WI.debuggerManager.activeCallFrame)
                     return;
                 logPauseLocation();
-                WebInspector.debuggerManager.stepInto();
+                WI.debuggerManager.stepInto();
             });
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, (event) => {
                 InspectorTest.log("RESUMED");
                 resolve();
             });
diff --git a/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html b/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html
index 09bef2f..a0f410c 100644
--- a/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html
+++ b/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html
@@ -23,13 +23,13 @@
         // 0 based indices.
         let testInfo = {line: 7, column: 4};
         let location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
-        let breakpoint = new WebInspector.Breakpoint(location);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        let breakpoint = new WI.Breakpoint(location);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.evaluateInPage("setTimeout(timeout, 0);");
     }
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
 
         if (!activeCallFrame)
             return;
@@ -46,7 +46,7 @@
             expectedFrames.push({functionName: 'bar', scope: ['i', i], isTailDeleted: i > 0 ? true : false});
         expectedFrames.push({functionName: 'timeout', scope: ['foo', 25], isTailDeleted: true});
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrames = targetData.callFrames;
 
         InspectorTest.assert(callFrames.length >= expectedFrames.length);
@@ -77,15 +77,15 @@
             });
         }
 
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
         InspectorTest.log("Tests done");
         InspectorTest.completeTest();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         let eventScriptObject = event.data.script;
         if (/tail-deleted-frames-from-vm-entry\.js$/.test(eventScriptObject.url)) {
             scriptObject = eventScriptObject;
diff --git a/LayoutTests/inspector/debugger/tail-deleted-frames-this-value.html b/LayoutTests/inspector/debugger/tail-deleted-frames-this-value.html
index 339e375..75a8763 100644
--- a/LayoutTests/inspector/debugger/tail-deleted-frames-this-value.html
+++ b/LayoutTests/inspector/debugger/tail-deleted-frames-this-value.html
@@ -15,13 +15,13 @@
         // 0 based indices.
         let testInfo = {line: 3, column: 4};
         let location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
-        let breakpoint = new WebInspector.Breakpoint(location);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        let breakpoint = new WI.Breakpoint(location);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.evaluateInPage("startABC()");
     }
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
 
         if (!activeCallFrame)
             return;
@@ -39,7 +39,7 @@
             {functionName: 'c', thisValue: ['cThis', 0], isTailDeleted: true}
         ];
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrames = targetData.callFrames;
 
         InspectorTest.assert(callFrames.length >= expectedFrames.length);
@@ -72,16 +72,16 @@
                 InspectorTest.pass(`Call Frame ${i} 'this' value is correct.`);
             }
 
-            WebInspector.debuggerManager.resume();
+            WI.debuggerManager.resume();
         });
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
         InspectorTest.log("Tests done");
         InspectorTest.completeTest();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         eventScriptObject = event.data.script;
         
         if (/tail-deleted-frames-this-value\.js$/.test(eventScriptObject.url)) {
diff --git a/LayoutTests/inspector/debugger/tail-deleted-frames.html b/LayoutTests/inspector/debugger/tail-deleted-frames.html
index b61d7aa..1de3163 100644
--- a/LayoutTests/inspector/debugger/tail-deleted-frames.html
+++ b/LayoutTests/inspector/debugger/tail-deleted-frames.html
@@ -23,13 +23,13 @@
         // 0 based indices.
         let testInfo = {line: 3, column: 4};
         let location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
-        let breakpoint = new WebInspector.Breakpoint(location);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        let breakpoint = new WI.Breakpoint(location);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.evaluateInPage("startABC()");
     }
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
 
         if (!activeCallFrame)
             return;
@@ -47,7 +47,7 @@
             {functionName: 'c', scope: ['z', 60], isTailDeleted: true}
         ];
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrames = targetData.callFrames;
 
         InspectorTest.assert(callFrames.length >= expectedFrames.length);
@@ -78,15 +78,15 @@
             });
         }
 
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
         InspectorTest.log("Tests done");
         InspectorTest.completeTest();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         eventScriptObject = event.data.script;
         
         if (/tail-deleted-frames\.js$/.test(eventScriptObject.url)) {
diff --git a/LayoutTests/inspector/debugger/tail-recursion.html b/LayoutTests/inspector/debugger/tail-recursion.html
index d3dfb25..4a41356 100644
--- a/LayoutTests/inspector/debugger/tail-recursion.html
+++ b/LayoutTests/inspector/debugger/tail-recursion.html
@@ -24,15 +24,15 @@
         var testInfos = [{line : 3, column : 8}, {line : 4, column : 8}];
         for (let testInfo of testInfos) {
             let location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
-            let breakpoint = new WebInspector.Breakpoint(location);
-            WebInspector.debuggerManager.addBreakpoint(breakpoint);
+            let breakpoint = new WI.Breakpoint(location);
+            WI.debuggerManager.addBreakpoint(breakpoint);
         }
         InspectorTest.evaluateInPage("startRecurse()");
     }
 
     let numBreakpointHits = 0;
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
 
         if (!activeCallFrame)
             return;
@@ -47,7 +47,7 @@
         InspectorTest.log("Going to look at the top " + numFramesToInspect + " frames.");
         InspectorTest.log("------------------------------------");
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+        let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
         let callFrames = targetData.callFrames;
 
         InspectorTest.assert(callFrames.length > numFramesToInspect); // We just look at top 50. This isn't a precise number. But it gets at the gist of the debugging experience.
@@ -79,17 +79,17 @@
             });
         }
 
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
         if (numBreakpointHits === 2) {
             InspectorTest.log("Tests done");
             InspectorTest.completeTest();
         }
     });
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         eventScriptObject = event.data.script;
         
         if (/tail-recursion\.js$/.test(eventScriptObject.url)) {
diff --git a/LayoutTests/inspector/debugger/truncate-async-stack-trace.html b/LayoutTests/inspector/debugger/truncate-async-stack-trace.html
index d42e95b..706e8c6 100644
--- a/LayoutTests/inspector/debugger/truncate-async-stack-trace.html
+++ b/LayoutTests/inspector/debugger/truncate-async-stack-trace.html
@@ -26,15 +26,15 @@
         name: "TruncateBranchingStackTrace",
         description: "Check that branching stack traces can be truncated.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
             .then((event) => {
                 InspectorTest.pass("Paused in branching stack trace.");
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
             });
 
             InspectorTest.awaitEvent("AfterTestFunction").then(resolve, reject);
 
-            let repeatCount = WebInspector.debuggerManager.asyncStackTraceDepth;
+            let repeatCount = WI.debuggerManager.asyncStackTraceDepth;
             InspectorTest.evaluateInPage(`testBranchingTruncate(${repeatCount})`);
         }
     });
diff --git a/LayoutTests/inspector/dom-debugger/dom-breakpoints.html b/LayoutTests/inspector/dom-debugger/dom-breakpoints.html
index 5047009..4c53099 100644
--- a/LayoutTests/inspector/dom-debugger/dom-breakpoints.html
+++ b/LayoutTests/inspector/dom-debugger/dom-breakpoints.html
@@ -29,9 +29,9 @@
     let suite = InspectorTest.createAsyncSuite("DOMBreakpoints");
 
     function teardown(resolve) {
-        let breakpoints = WebInspector.domDebuggerManager.domBreakpoints;
+        let breakpoints = WI.domDebuggerManager.domBreakpoints;
         for (let breakpoint of breakpoints)
-            WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);
+            WI.domDebuggerManager.removeDOMBreakpoint(breakpoint);
 
         resolve();
     }
@@ -50,9 +50,9 @@
 
     function rejectOnPause() {
         return new Promise((resolve, reject) => {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
             .then((event) => {
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
                 InspectorTest.fail("Should not pause.");
                 reject();
             });
@@ -61,20 +61,20 @@
 
     function awaitQuerySelector(selector) {
         return new Promise((resolve, reject) => {
-            WebInspector.domTreeManager.requestDocument((documentNode) => {
+            WI.domTreeManager.requestDocument((documentNode) => {
                 if (!documentNode) {
                     reject();
                     return;
                 }
 
-                WebInspector.domTreeManager.querySelector(documentNode.id, selector, (nodeId) => {
+                WI.domTreeManager.querySelector(documentNode.id, selector, (nodeId) => {
                     if (!nodeId) {
                         InspectorTest.fail("Selector returned no nodes.", selector);
                         reject();
                         return;
                     }
 
-                    let node = WebInspector.domTreeManager.nodeForId(nodeId);
+                    let node = WI.domTreeManager.nodeForId(nodeId);
                     InspectorTest.assert(node, "Missing node for id.", nodeId);
                     if (!node) {
                         reject();
@@ -91,14 +91,14 @@
         return new Promise((resolve, reject) => {
             awaitQuerySelector("#" + elementIdentifier)
             .then((node) => {
-                WebInspector.domDebuggerManager.awaitEvent(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded)
+                WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.DOMBreakpointAdded)
                 .then((event) => {
                     let breakpoint = event.data.breakpoint;
                     InspectorTest.pass(`Added '${type}' breakpoint.`);
                     resolve(event);
                 });
 
-                WebInspector.domDebuggerManager.addDOMBreakpoint(new WebInspector.DOMBreakpoint(node, type, disabled));
+                WI.domDebuggerManager.addDOMBreakpoint(new WI.DOMBreakpoint(node, type, disabled));
             });
         });
     }
@@ -116,15 +116,15 @@
 
                     InspectorTest.log("Call DOM operation.");
                     InspectorTest.evaluateInPage(expression);
-                    return WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused);
+                    return WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
                 })
                 .then(() => {
-                    let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                    let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                     InspectorTest.log("PAUSED:");
-                    InspectorTest.expectEqual(targetData.pauseReason, WebInspector.DebuggerManager.PauseReason.DOM, "Pause reason should be DOM.");
+                    InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.DOM, "Pause reason should be DOM.");
                     logActiveStackTrace();
 
-                    return WebInspector.debuggerManager.resume();
+                    return WI.debuggerManager.resume();
                 })
                 .then(resolve, reject);
             }
@@ -136,14 +136,14 @@
         description: "Check that breakpoint is in a valid initial state.",
         teardown,
         test(resolve, reject) {
-            addBreakpointForElementIdentifier(subtreeModifiedTestId, WebInspector.DOMBreakpoint.Type.SubtreeModified)
+            addBreakpointForElementIdentifier(subtreeModifiedTestId, WI.DOMBreakpoint.Type.SubtreeModified)
             .then((event) => {
                 let breakpoint = event.data.breakpoint;
                 InspectorTest.expectFalse(breakpoint.disabled, "Breakpoint should not be disabled.");
                 InspectorTest.expectThat(breakpoint.domNodeIdentifier, "Breakpoint should have node identifier.");
 
-                InspectorTest.assert(WebInspector.frameResourceManager.mainFrame, "Missing main frame.");
-                let documentURL = WebInspector.frameResourceManager.mainFrame.url;
+                InspectorTest.assert(WI.frameResourceManager.mainFrame, "Missing main frame.");
+                let documentURL = WI.frameResourceManager.mainFrame.url;
                 InspectorTest.expectEqual(breakpoint.url, documentURL, "Breakpoint URL should match document URL.");
             })
             .then(resolve, reject);
@@ -153,21 +153,21 @@
     addSimpleTestCase({
         name: "SubtreeModified",
         elementIdentifier: subtreeModifiedTestId,
-        type: WebInspector.DOMBreakpoint.Type.SubtreeModified,
+        type: WI.DOMBreakpoint.Type.SubtreeModified,
         expression: "subtreeModifiedTest()",
     });
 
     addSimpleTestCase({
         name: "AttributeModified",
         elementIdentifier: attributeModifiedTestId,
-        type: WebInspector.DOMBreakpoint.Type.AttributeModified,
+        type: WI.DOMBreakpoint.Type.AttributeModified,
         expression: "attributeModifiedTest()",
     });
 
     addSimpleTestCase({
         name: "NodeRemoved",
         elementIdentifier: nodeRemovedTestId,
-        type: WebInspector.DOMBreakpoint.Type.NodeRemoved,
+        type: WI.DOMBreakpoint.Type.NodeRemoved,
         expression: "nodeRemovedTest()",
     });
 
@@ -177,7 +177,7 @@
         teardown,
         test(resolve, reject) {
             const disabled = true;
-            addBreakpointForElementIdentifier(subtreeModifiedTestId, WebInspector.DOMBreakpoint.Type.SubtreeModified, disabled)
+            addBreakpointForElementIdentifier(subtreeModifiedTestId, WI.DOMBreakpoint.Type.SubtreeModified, disabled)
             .then(() => Promise.race([awaitEvaluateInPage("modifySubtreeTest()"), rejectOnPause()]))
             .then(() => {
                 InspectorTest.pass("Should not pause for disabled breakpoint.");
@@ -192,13 +192,13 @@
         description: "Check that debugger does not pause for removed breakpoint.",
         teardown,
         test(resolve, reject) {
-            addBreakpointForElementIdentifier(subtreeModifiedTestId, WebInspector.DOMBreakpoint.Type.SubtreeModified)
+            addBreakpointForElementIdentifier(subtreeModifiedTestId, WI.DOMBreakpoint.Type.SubtreeModified)
             .then((event) => {
-                let promise = WebInspector.domDebuggerManager.awaitEvent(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved);
+                let promise = WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved);
                 let breakpoint = event.data.breakpoint;
 
                 InspectorTest.log("Remove breakpoint.");
-                WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);
+                WI.domDebuggerManager.removeDOMBreakpoint(breakpoint);
                 return promise;
             })
             .then(() => Promise.race([awaitEvaluateInPage("modifySubtreeTest()"), rejectOnPause()]))
@@ -215,7 +215,7 @@
         description: "Check that debugger does not pause for removed breakpoints on node.",
         teardown,
         test(resolve, reject) {
-            let breakpointTypes = Object.values(WebInspector.DOMBreakpoint.Type);
+            let breakpointTypes = Object.values(WI.DOMBreakpoint.Type);
             let breakpointPromises = breakpointTypes.map(type => addBreakpointForElementIdentifier(multipleBreakpointsTestId, type));
 
             Promise.all(breakpointPromises)
@@ -227,7 +227,7 @@
                     return;
                 }
 
-                let node = WebInspector.domTreeManager.nodeForId(breakpoints[0].domNodeIdentifier);
+                let node = WI.domTreeManager.nodeForId(breakpoints[0].domNodeIdentifier);
                 if (!node) {
                     InspectorTest.fail("No DOM node associated with breakpoint.");
                     reject();
@@ -240,16 +240,16 @@
                     if (++breakpointsRemoved === breakpoints.length) {
                         InspectorTest.pass(`Removed ${breakpointsRemoved} breakpoints.`);
 
-                        let nodeBreakpoints = WebInspector.domDebuggerManager.domBreakpointsForNode(node);
+                        let nodeBreakpoints = WI.domDebuggerManager.domBreakpointsForNode(node);
                         InspectorTest.expectThat(!nodeBreakpoints.length, "DOM node should have no breakpoints.");
 
-                        WebInspector.domDebuggerManager.removeEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved, breakpointRemoved);
+                        WI.domDebuggerManager.removeEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved, breakpointRemoved);
                         resolve();
                     }
                 }
 
-                WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved, breakpointRemoved);
-                WebInspector.domDebuggerManager.removeDOMBreakpointsForNode(node);
+                WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved, breakpointRemoved);
+                WI.domDebuggerManager.removeDOMBreakpointsForNode(node);
             })
             .then(resolve, reject);
         }
@@ -262,7 +262,7 @@
         test(resolve, reject) {
             InspectorTest.log("Attempting to set breakpoint.");
 
-            DOMDebuggerAgent.setDOMBreakpoint(0, WebInspector.DOMBreakpoint.Type.SubtreeModified, (error) => {
+            DOMDebuggerAgent.setDOMBreakpoint(0, WI.DOMBreakpoint.Type.SubtreeModified, (error) => {
                 InspectorTest.log("Protocol result: " + error);
                 InspectorTest.expectThat(error, "Protocol should return an error.")
                 resolve();
@@ -295,7 +295,7 @@
         test(resolve, reject) {
             InspectorTest.log("Attempting to remove breakpoint.");
 
-            DOMDebuggerAgent.removeDOMBreakpoint(0, WebInspector.DOMBreakpoint.Type.SubtreeModified, (error) => {
+            DOMDebuggerAgent.removeDOMBreakpoint(0, WI.DOMBreakpoint.Type.SubtreeModified, (error) => {
                 InspectorTest.log("Protocol result: " + error);
                 InspectorTest.expectThat(error, "Protocol should return an error.")
                 resolve();
diff --git a/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html b/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html
index 28c5276..e1591c3 100644
--- a/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html
+++ b/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html
@@ -10,11 +10,11 @@
     let suite = InspectorTest.createAsyncSuite("XHRBreakpoints");
 
     function teardown(resolve) {
-        let breakpoints = WebInspector.domDebuggerManager.xhrBreakpoints;
+        let breakpoints = WI.domDebuggerManager.xhrBreakpoints;
         for (let breakpoint of breakpoints)
-            WebInspector.domDebuggerManager.removeXHRBreakpoint(breakpoint);
+            WI.domDebuggerManager.removeXHRBreakpoint(breakpoint);
 
-        WebInspector.domDebuggerManager.allRequestsBreakpoint.disabled = true;
+        WI.domDebuggerManager.allRequestsBreakpoint.disabled = true;
         resolve();
     }
 
@@ -32,9 +32,9 @@
 
     function rejectOnPause() {
         return new Promise((resolve, reject) => {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
             .then((event) => {
-                WebInspector.debuggerManager.resume();
+                WI.debuggerManager.resume();
                 InspectorTest.fail("Should not pause.");
                 reject();
             });
@@ -43,20 +43,20 @@
 
     function addBreakpoint(type, url) {
         return new Promise((resolve, reject) => {
-            let mainFrame = WebInspector.frameResourceManager.mainFrame;
+            let mainFrame = WI.frameResourceManager.mainFrame;
             InspectorTest.assert(mainFrame, "Missing main frame.");
             if (!mainFrame)
                 reject();
 
-            let breakpoint = new WebInspector.XHRBreakpoint(type, url);
-            WebInspector.domDebuggerManager.awaitEvent(WebInspector.DOMDebuggerManager.Event.XHRBreakpointAdded)
+            let breakpoint = new WI.XHRBreakpoint(type, url);
+            WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.XHRBreakpointAdded)
             .then(() => {
                 InspectorTest.pass("Added breakpoint for URL: " + url);
                 InspectorTest.expectFalse(breakpoint.disabled, "Breakpoint should not be disabled initially.");
                 resolve(breakpoint);
             });
 
-            WebInspector.domDebuggerManager.addXHRBreakpoint(breakpoint);
+            WI.domDebuggerManager.addXHRBreakpoint(breakpoint);
         });
     }
 
@@ -66,21 +66,21 @@
         teardown,
         test(resolve, reject) {
             InspectorTest.log("Set pause on all XMLHttpRequests.");
-            WebInspector.domDebuggerManager.allRequestsBreakpoint.disabled = false;
+            WI.domDebuggerManager.allRequestsBreakpoint.disabled = false;
 
             InspectorTest.log("Sending XMLHttpRequest.");
             InspectorTest.evaluateInPage("loadResourceXHR()");
 
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
             .then(() => {
-                let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                 InspectorTest.log("PAUSED:");
-                InspectorTest.expectEqual(targetData.pauseReason, WebInspector.DebuggerManager.PauseReason.XHR, "Pause reason should be XHR.");
+                InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.XHR, "Pause reason should be XHR.");
                 InspectorTest.expectFalse(targetData.pauseData.breakpointURL, "Pause data URL should be empty.");
 
                 logActiveStackTrace();
 
-                return WebInspector.debuggerManager.resume();
+                return WI.debuggerManager.resume();
             })
             .then(resolve, reject);
         }
@@ -92,23 +92,23 @@
         teardown,
         test(resolve, reject) {
             let expectedBreakpointURL;
-            addBreakpoint(WebInspector.XHRBreakpoint.Type.Text, "data")
+            addBreakpoint(WI.XHRBreakpoint.Type.Text, "data")
             .then((breakpoint) => {
                 expectedBreakpointURL = breakpoint.url;
 
                 InspectorTest.log("Sending XMLHttpRequest.");
                 InspectorTest.evaluateInPage("loadResourceXHR()");
-                return WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused);
+                return WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
             })
             .then(() => {
-                let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                 InspectorTest.log("PAUSED:");
-                InspectorTest.expectEqual(targetData.pauseReason, WebInspector.DebuggerManager.PauseReason.XHR, "Pause reason should be XHR.");
+                InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.XHR, "Pause reason should be XHR.");
                 InspectorTest.expectEqual(targetData.pauseData.breakpointURL, expectedBreakpointURL, "Pause data URL should match breakpoint URL.");
 
                 logActiveStackTrace();
 
-                return WebInspector.debuggerManager.resume();
+                return WI.debuggerManager.resume();
             })
             .then(resolve, reject);
         }
@@ -120,23 +120,23 @@
         teardown,
         test(resolve, reject) {
             let expectedBreakpointURL;
-            addBreakpoint(WebInspector.XHRBreakpoint.Type.RegularExpression, "data[A-Z]*\.(json|txt|png)")
+            addBreakpoint(WI.XHRBreakpoint.Type.RegularExpression, "data[A-Z]*\.(json|txt|png)")
             .then((breakpoint) => {
                 expectedBreakpointURL = breakpoint.url;
 
                 InspectorTest.log("Sending XMLHttpRequest.");
                 InspectorTest.evaluateInPage("loadResourceXHR()");
-                return WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Paused);
+                return WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
             })
             .then(() => {
-                let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.debuggerManager.activeCallFrame.target);
+                let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
                 InspectorTest.log("PAUSED:");
-                InspectorTest.expectEqual(targetData.pauseReason, WebInspector.DebuggerManager.PauseReason.XHR, "Pause reason should be XHR.");
+                InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.XHR, "Pause reason should be XHR.");
                 InspectorTest.expectEqual(targetData.pauseData.breakpointURL, expectedBreakpointURL, "Pause data URL should match breakpoint URL.");
 
                 logActiveStackTrace();
 
-                return WebInspector.debuggerManager.resume();
+                return WI.debuggerManager.resume();
             })
             .then(resolve, reject);
         }
@@ -147,7 +147,7 @@
         description: "Check that debugger does not pause for disabled breakpoint.",
         teardown,
         test(resolve, reject) {
-            addBreakpoint(WebInspector.XHRBreakpoint.Type.Text, "data")
+            addBreakpoint(WI.XHRBreakpoint.Type.Text, "data")
             .then((breakpoint) => {
                 breakpoint.disabled = true;
                 InspectorTest.log("Breakpoint disabled.");
@@ -168,7 +168,7 @@
         description: "Check that debugger does not pause for breakpoint with different URL.",
         teardown,
         test(resolve, reject) {
-            addBreakpoint(WebInspector.XHRBreakpoint.Type.Text, "nonexistant-url")
+            addBreakpoint(WI.XHRBreakpoint.Type.Text, "nonexistant-url")
             .then((breakpoint) => {
                 InspectorTest.log("Sending XMLHttpRequest.");
                 return Promise.race([awaitEvaluateInPage("loadResourceXHR()"), rejectOnPause()]);
@@ -186,9 +186,9 @@
         description: "Check that debugger does not pause for removed breakpoint.",
         teardown,
         test(resolve, reject) {
-            addBreakpoint(WebInspector.XHRBreakpoint.Type.Text, "data")
+            addBreakpoint(WI.XHRBreakpoint.Type.Text, "data")
             .then((breakpoint) => {
-                WebInspector.domDebuggerManager.removeXHRBreakpoint(breakpoint);
+                WI.domDebuggerManager.removeXHRBreakpoint(breakpoint);
                 InspectorTest.log("Breakpoint removed.");
 
                 return Promise.race([awaitEvaluateInPage("loadResourceXHR()"), rejectOnPause()]);
@@ -205,12 +205,12 @@
         name: "RemoveDisabledBreakpoint",
         description: "Check that a disabled breakpoint can be removed.",
         test(resolve, reject) {
-            addBreakpoint(WebInspector.XHRBreakpoint.Type.Text, "data")
+            addBreakpoint(WI.XHRBreakpoint.Type.Text, "data")
             .then((breakpoint) => {
                 breakpoint.disabled = true;
                 InspectorTest.log("Breakpoint disabled.");
 
-                WebInspector.domDebuggerManager.removeXHRBreakpoint(breakpoint);
+                WI.domDebuggerManager.removeXHRBreakpoint(breakpoint);
                 InspectorTest.log("Breakpoint removed.");
 
                 return Promise.race([awaitEvaluateInPage("loadResourceXHR()"), rejectOnPause()]);
diff --git a/LayoutTests/inspector/dom/content-flow-content-nodes.html b/LayoutTests/inspector/dom/content-flow-content-nodes.html
index 22a0702..aec117c 100644
--- a/LayoutTests/inspector/dom/content-flow-content-nodes.html
+++ b/LayoutTests/inspector/dom/content-flow-content-nodes.html
@@ -29,7 +29,7 @@
 
     function onRootDOMNodeInvalidated()
     {
-        WebInspector.frameResourceManager.mainFrame.domTree.requestContentFlowList();
+        WI.frameResourceManager.mainFrame.domTree.requestContentFlowList();
     }
 
     function onContentFlowWasAdded(event)
@@ -40,8 +40,8 @@
         InspectorTest.expectThat(contentFlow.contentNodes[0].getAttribute("id") === "contentStatic", "ContentFlow.contentNodes[0].id is \"#contentStatic\".");
         InspectorTest.expectThat(contentFlow.contentNodes[1].getAttribute("id") === "contentRemoved", "ContentFlow.contentNodes[1].id is \"#contentRemoved\".");
 
-        contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, onContentNodeWasAdded, null);
-        contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, onContentNodeWasRemoved, null);
+        contentFlow.addEventListener(WI.ContentFlow.Event.ContentNodeWasAdded, onContentNodeWasAdded, null);
+        contentFlow.addEventListener(WI.ContentFlow.Event.ContentNodeWasRemoved, onContentNodeWasRemoved, null);
 
         InspectorTest.evaluateInPage("changeFlowContent()");
     }
@@ -69,10 +69,10 @@
         InspectorTest.completeTest();
     }
 
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, function(event) {
-        var domTree = WebInspector.frameResourceManager.mainFrame.domTree;
-        domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated, null);
-        domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded, null);
+    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, function(event) {
+        var domTree = WI.frameResourceManager.mainFrame.domTree;
+        domTree.addEventListener(WI.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated, null);
+        domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded, null);
         domTree.requestContentFlowList();
     });
 
diff --git a/LayoutTests/inspector/dom/content-flow-content-removal.html b/LayoutTests/inspector/dom/content-flow-content-removal.html
index 1668716..046c93a 100644
--- a/LayoutTests/inspector/dom/content-flow-content-removal.html
+++ b/LayoutTests/inspector/dom/content-flow-content-removal.html
@@ -20,7 +20,7 @@
 
     function onRootDOMNodeInvalidated()
     {
-        WebInspector.frameResourceManager.mainFrame.domTree.requestContentFlowList();
+        WI.frameResourceManager.mainFrame.domTree.requestContentFlowList();
     }
 
     function onContentFlowWasAdded(event)
@@ -31,7 +31,7 @@
         InspectorTest.expectThat(contentFlow.contentNodes[0].getAttribute("id") === "contentStatic", "ContentFlow.contentNodes[0].id is \"#contentStatic\".");
         InspectorTest.expectThat(contentFlow.contentNodes[1].getAttribute("id") === "contentRemoved", "ContentFlow.contentNodes[1].id is \"#contentRemoved\".");
 
-        contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, onContentNodeWasRemoved, null);
+        contentFlow.addEventListener(WI.ContentFlow.Event.ContentNodeWasRemoved, onContentNodeWasRemoved, null);
 
         InspectorTest.evaluateInPage("changeFlowContent()");
     }
@@ -43,10 +43,10 @@
         InspectorTest.completeTest();
     }
 
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, function() {
-        var domTree = WebInspector.frameResourceManager.mainFrame.domTree;
-        domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated, null);
-        domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded, null);
+    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, function() {
+        var domTree = WI.frameResourceManager.mainFrame.domTree;
+        domTree.addEventListener(WI.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated, null);
+        domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded, null);
         domTree.requestContentFlowList();
     });
 
diff --git a/LayoutTests/inspector/dom/content-flow-list.html b/LayoutTests/inspector/dom/content-flow-list.html
index ca94311..db67343 100644
--- a/LayoutTests/inspector/dom/content-flow-list.html
+++ b/LayoutTests/inspector/dom/content-flow-list.html
@@ -43,11 +43,11 @@
         InspectorTest.completeTest();
     }
 
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, function() {
-        domTree = WebInspector.frameResourceManager.mainFrame.domTree;
-        domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated);
-        domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded);
-        domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved, onContentFlowWasRemoved);
+    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, function() {
+        domTree = WI.frameResourceManager.mainFrame.domTree;
+        domTree.addEventListener(WI.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated);
+        domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded);
+        domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasRemoved, onContentFlowWasRemoved);
         domTree.requestContentFlowList();
     });
 
diff --git a/LayoutTests/inspector/dom/content-node-region-info.html b/LayoutTests/inspector/dom/content-node-region-info.html
index a2ee684..58a3dde 100644
--- a/LayoutTests/inspector/dom/content-node-region-info.html
+++ b/LayoutTests/inspector/dom/content-node-region-info.html
@@ -27,13 +27,13 @@
 <script>
 function test()
 {
-    let displayNameGetter = Object.getOwnPropertyDescriptor(WebInspector.DOMNode.prototype, "displayName").get;
+    let displayNameGetter = Object.getOwnPropertyDescriptor(WI.DOMNode.prototype, "displayName").get;
     let queryList = ["#flow", ".contentNode1", ".contentNode2", "body", "#region1", "#region2"];
     let documentNodeId = null;
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
         documentNodeId = documentNode.id;
-        WebInspector.domTreeManager.getNamedFlowCollection(documentNodeId);
+        WI.domTreeManager.getNamedFlowCollection(documentNodeId);
         next();
     });
 
@@ -45,13 +45,13 @@
     function query(selector, callback)
     {
         InspectorTest.log("\nSelector: " + selector);
-        WebInspector.domTreeManager.querySelector(documentNodeId, selector, function(contentNodeId) {
+        WI.domTreeManager.querySelector(documentNodeId, selector, function(contentNodeId) {
             if (!contentNodeId) {
                 InspectorTest.log("DOM node not found.");
                 callback();
             }
-            let domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
-            WebInspector.domTreeManager.getNodeContentFlowInfo(domNode, function(error, result) {
+            let domNode = WI.domTreeManager.nodeForId(contentNodeId);
+            WI.domTreeManager.getNodeContentFlowInfo(domNode, function(error, result) {
                 console.assert(!error);
                 if (result) {
                     InspectorTest.log("Region flow name: " + (result.regionFlow ? result.regionFlow.name : "none"));
diff --git a/LayoutTests/inspector/dom/csp-big5-hash.html b/LayoutTests/inspector/dom/csp-big5-hash.html
index 057cc1c..d9df6fb 100644
--- a/LayoutTests/inspector/dom/csp-big5-hash.html
+++ b/LayoutTests/inspector/dom/csp-big5-hash.html
@@ -9,10 +9,10 @@
        {selector: "#stylesheet-1", hash: "sha256-duNBvCmzrFc3RVVqS8ufweBf2QOq1THuEh3UZWP7ZpU="},
        {selector: "#script-1", hash: "sha256-0eDk4my9q3qcCQTZ02clVW0RxDNPW9n9lXTCdyGY4Js="},
     ];
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
         for (let {selector, hash} of testCases) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, selector, function(nodeId) {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, selector, function(nodeId) {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.log("");
                 InspectorTest.expectThat(domNode, `Got DOMNode for ${selector}`);
                 InspectorTest.expectThat(domNode.contentSecurityPolicyHash() === hash, `DOMNode has hash ${hash}`);
diff --git a/LayoutTests/inspector/dom/csp-hash.html b/LayoutTests/inspector/dom/csp-hash.html
index 4879d78..36c7b4d 100644
--- a/LayoutTests/inspector/dom/csp-hash.html
+++ b/LayoutTests/inspector/dom/csp-hash.html
@@ -19,10 +19,10 @@
         {selector: "#paragraph", hash: undefined},
     ];
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+    WI.domTreeManager.requestDocument(function(documentNode) {
         for (let {selector, hash} of testCases) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, selector, function(nodeId) {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, selector, function(nodeId) {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.log("");
                 InspectorTest.expectThat(domNode, `Got DOMNode for ${selector}`);
                 InspectorTest.expectThat(domNode.contentSecurityPolicyHash() === hash, `DOMNode has hash ${hash}`);
diff --git a/LayoutTests/inspector/dom/customElementState.html b/LayoutTests/inspector/dom/customElementState.html
index 72e0ecc..476a3bd 100644
--- a/LayoutTests/inspector/dom/customElementState.html
+++ b/LayoutTests/inspector/dom/customElementState.html
@@ -14,8 +14,8 @@
     suite.addTestCase({
         name: "CustomElementState.Builtin",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#builtin", (nodeId) => {
-                const node = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "#builtin", (nodeId) => {
+                const node = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.expectEqual(node.customElementState(), "builtin", "#builtin should be CustomElementState.Builtin.");
                 resolve();
             });
@@ -25,8 +25,8 @@
     suite.addTestCase({
         name: "CustomElementState.Custom.Constructed",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "constructed-element", (nodeId) => {
-                const node = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "constructed-element", (nodeId) => {
+                const node = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.expectEqual(node.customElementState(), "custom", "constructed-element should be CustomElementState.Custom.");
                 resolve();
             });
@@ -36,8 +36,8 @@
     suite.addTestCase({
         name: "CustomElementState.Custom.Upgraded",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "upgraded-element", (nodeId) => {
-                const node = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "upgraded-element", (nodeId) => {
+                const node = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.expectEqual(node.customElementState(), "custom", "upgraded-element should be CustomElementState.Custom.");
                 resolve();
             });
@@ -47,8 +47,8 @@
     suite.addTestCase({
         name: "CustomElementState.Waiting",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "undefined-element", (nodeId) => {
-                const node = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "undefined-element", (nodeId) => {
+                const node = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.expectEqual(node.customElementState(), "waiting", "undefined-element should be CustomElementState.Waiting.");
                 resolve();
             });
@@ -58,15 +58,15 @@
     suite.addTestCase({
         name: "CustomElementState.Failed",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "failed-element", (nodeId) => {
-                const node = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "failed-element", (nodeId) => {
+                const node = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.expectEqual(node.customElementState(), "failed", "failed-element should be CustomElementState.Failed.");
                 resolve();
             });
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((node) => {
+    WI.domTreeManager.requestDocument((node) => {
         documentNode = node;
         suite.runTestCasesAndFinish();
     });
diff --git a/LayoutTests/inspector/dom/domutilities-csspath-expected.txt b/LayoutTests/inspector/dom/domutilities-csspath-expected.txt
index c1b22f8..21d9f4e 100644
--- a/LayoutTests/inspector/dom/domutilities-csspath-expected.txt
+++ b/LayoutTests/inspector/dom/domutilities-csspath-expected.txt
@@ -1,38 +1,38 @@
-Test for WebInspector.cssPath.
+Test for WI.cssPath.
 
 
-== Running test suite: WebInspector.cssPath
--- Running test case: WebInspector.cssPath.TopLevelNode
+== Running test suite: WI.cssPath
+-- Running test case: WI.cssPath.TopLevelNode
 PASS: HTML element should have simple selector 'html'.
 PASS: BODY element should have simple selector 'body'.
 PASS: HEAD element should have simple selector 'head'.
 
--- Running test case: WebInspector.cssPath.ElementWithID
+-- Running test case: WI.cssPath.ElementWithID
 PASS: Element with id should have simple selector '#id-test'.
 PASS: Element inside element with id should have path from id.
 
--- Running test case: WebInspector.cssPath.InputElementFlair
+-- Running test case: WI.cssPath.InputElementFlair
 PASS: Input element should include type.
 
--- Running test case: WebInspector.cssPath.UniqueTagName
+-- Running test case: WI.cssPath.UniqueTagName
 PASS: Elements with unique tag name should not need nth-child().
 
--- Running test case: WebInspector.cssPath.NonUniqueTagName
+-- Running test case: WI.cssPath.NonUniqueTagName
 PASS: Elements with non-unique tag name should need nth-child().
 
--- Running test case: WebInspector.cssPath.UniqueClassName
+-- Running test case: WI.cssPath.UniqueClassName
 PASS: Elements with unique class names should include their class names.
 
--- Running test case: WebInspector.cssPath.NonUniqueClassName
+-- Running test case: WI.cssPath.NonUniqueClassName
 PASS: Elements with non-unique class names should not include their class names.
 
--- Running test case: WebInspector.cssPath.UniqueTagAndClassName
+-- Running test case: WI.cssPath.UniqueTagAndClassName
 PASS: Elements with unique tag and class names should just have simple tag.
 
--- Running test case: WebInspector.cssPath.DeepPath
+-- Running test case: WI.cssPath.DeepPath
 PASS: Should be able to create path for deep elements.
 
--- Running test case: WebInspector.cssPath.PseudoElement
+-- Running test case: WI.cssPath.PseudoElement
 PASS: Should be able to create path for ::before pseudo elements.
 PASS: Should be able to create path for ::after pseudo elements.
 
diff --git a/LayoutTests/inspector/dom/domutilities-csspath.html b/LayoutTests/inspector/dom/domutilities-csspath.html
index 24f54a6..5a1b175 100644
--- a/LayoutTests/inspector/dom/domutilities-csspath.html
+++ b/LayoutTests/inspector/dom/domutilities-csspath.html
@@ -8,132 +8,132 @@
     let documentNode;
 
     function nodeForSelector(selector, callback) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, selector, (nodeId) => {
-            callback(WebInspector.domTreeManager.nodeForId(nodeId));
+        WI.domTreeManager.querySelector(documentNode.id, selector, (nodeId) => {
+            callback(WI.domTreeManager.nodeForId(nodeId));
         });
     }
 
-    let suite = InspectorTest.createAsyncSuite("WebInspector.cssPath");
+    let suite = InspectorTest.createAsyncSuite("WI.cssPath");
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.TopLevelNode",
+        name: "WI.cssPath.TopLevelNode",
         description: "Top level nodes like html, body, and head are unique.",
         test(resolve, reject) {
             nodeForSelector("html", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "html", "HTML element should have simple selector 'html'.");
+                InspectorTest.expectEqual(WI.cssPath(node), "html", "HTML element should have simple selector 'html'.");
             });
             nodeForSelector("html > body", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "body", "BODY element should have simple selector 'body'.");
+                InspectorTest.expectEqual(WI.cssPath(node), "body", "BODY element should have simple selector 'body'.");
             });
             nodeForSelector("html > head", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "head", "HEAD element should have simple selector 'head'.");
+                InspectorTest.expectEqual(WI.cssPath(node), "head", "HEAD element should have simple selector 'head'.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.ElementWithID",
+        name: "WI.cssPath.ElementWithID",
         description: "Element with ID is unique (#id). Path does not need to go past it.",
         test(resolve, reject) {
             nodeForSelector("#id-test", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#id-test", "Element with id should have simple selector '#id-test'.");
+                InspectorTest.expectEqual(WI.cssPath(node), "#id-test", "Element with id should have simple selector '#id-test'.");
             });
             nodeForSelector("#id-test > div", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#id-test > div", "Element inside element with id should have path from id.");
+                InspectorTest.expectEqual(WI.cssPath(node), "#id-test > div", "Element inside element with id should have path from id.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.InputElementFlair",
+        name: "WI.cssPath.InputElementFlair",
         description: "Input elements include their type.",
         test(resolve, reject) {
             nodeForSelector("#input-test input", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#input-test > input[type=\"password\"]", "Input element should include type.");
+                InspectorTest.expectEqual(WI.cssPath(node), "#input-test > input[type=\"password\"]", "Input element should include type.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.UniqueTagName",
+        name: "WI.cssPath.UniqueTagName",
         description: "Elements with unique tag name do not need nth-child.",
         test(resolve, reject) {
             nodeForSelector("#unique-tag-test > span", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#unique-tag-test > span", "Elements with unique tag name should not need nth-child().");
+                InspectorTest.expectEqual(WI.cssPath(node), "#unique-tag-test > span", "Elements with unique tag name should not need nth-child().");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.NonUniqueTagName",
+        name: "WI.cssPath.NonUniqueTagName",
         description: "Elements with non-unique tag name need nth-child.",
         test(resolve, reject) {
             nodeForSelector("#non-unique-tag-test > span ~ span", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#non-unique-tag-test > span:nth-child(3)", "Elements with non-unique tag name should need nth-child().");
+                InspectorTest.expectEqual(WI.cssPath(node), "#non-unique-tag-test > span:nth-child(3)", "Elements with non-unique tag name should need nth-child().");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.UniqueClassName",
+        name: "WI.cssPath.UniqueClassName",
         description: "Elements with unique class names should include their class names.",
         test(resolve, reject) {
             nodeForSelector("#unique-class-test > .beta", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#unique-class-test > div.alpha.beta", "Elements with unique class names should include their class names.");
+                InspectorTest.expectEqual(WI.cssPath(node), "#unique-class-test > div.alpha.beta", "Elements with unique class names should include their class names.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.NonUniqueClassName",
+        name: "WI.cssPath.NonUniqueClassName",
         description: "Elements with non-unique class names should not include their class names.",
         test(resolve, reject) {
             nodeForSelector("#non-unique-class-test > div ~ div", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#non-unique-class-test > div:nth-child(2)", "Elements with non-unique class names should not include their class names.");
+                InspectorTest.expectEqual(WI.cssPath(node), "#non-unique-class-test > div:nth-child(2)", "Elements with non-unique class names should not include their class names.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.UniqueTagAndClassName",
+        name: "WI.cssPath.UniqueTagAndClassName",
         description: "Elements with unique tag and class name just use tag for simplicity.",
         test(resolve, reject) {
             nodeForSelector("#unique-tag-and-class-test > .alpha", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "#unique-tag-and-class-test > div", "Elements with unique tag and class names should just have simple tag.");
+                InspectorTest.expectEqual(WI.cssPath(node), "#unique-tag-and-class-test > div", "Elements with unique tag and class names should just have simple tag.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.DeepPath",
+        name: "WI.cssPath.DeepPath",
         description: "Tests for element with complex path.",
         test(resolve, reject) {
             nodeForSelector("small", (node) => {
-                InspectorTest.expectEqual(WebInspector.cssPath(node), "body > div > div.deep-path-test > ul > li > div:nth-child(4) > ul > li.active > a > small", "Should be able to create path for deep elements.");
+                InspectorTest.expectEqual(WI.cssPath(node), "body > div > div.deep-path-test > ul > li > div:nth-child(4) > ul > li.active > a > small", "Should be able to create path for deep elements.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.cssPath.PseudoElement",
+        name: "WI.cssPath.PseudoElement",
         description: "For a pseudo element we should get the path of the parent and append the pseudo element selector.",
         test(resolve, reject) {
             nodeForSelector("#pseudo-element-test > div ~ div", (node) => {
                 let pseudoElementBefore = node.beforePseudoElement();
                 InspectorTest.assert(pseudoElementBefore);
-                InspectorTest.expectEqual(WebInspector.cssPath(pseudoElementBefore), "#pseudo-element-test > div:nth-child(3)::before", "Should be able to create path for ::before pseudo elements.");
+                InspectorTest.expectEqual(WI.cssPath(pseudoElementBefore), "#pseudo-element-test > div:nth-child(3)::before", "Should be able to create path for ::before pseudo elements.");
                 let pseudoElementAfter = node.afterPseudoElement();
                 InspectorTest.assert(pseudoElementAfter);
-                InspectorTest.expectEqual(WebInspector.cssPath(pseudoElementAfter), "#pseudo-element-test > div:nth-child(3)::after", "Should be able to create path for ::after pseudo elements.");
+                InspectorTest.expectEqual(WI.cssPath(pseudoElementAfter), "#pseudo-element-test > div:nth-child(3)::after", "Should be able to create path for ::after pseudo elements.");
                 resolve();
             });
         }
@@ -141,7 +141,7 @@
 
     // FIXME: Write tests for nodes inside a Shadow DOM Tree.
 
-    WebInspector.domTreeManager.requestDocument((node) => {
+    WI.domTreeManager.requestDocument((node) => {
         documentNode = node;
         suite.runTestCasesAndFinish();
     });
@@ -149,7 +149,7 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Test for WebInspector.cssPath.</p>
+<p>Test for WI.cssPath.</p>
 <!-- If display:none pseudo elements are not created. -->
 <div style="visibility:hidden">
     <div id="id-test">
diff --git a/LayoutTests/inspector/dom/domutilities-path-dump-expected.txt b/LayoutTests/inspector/dom/domutilities-path-dump-expected.txt
index 1b8477b..acf6111 100644
--- a/LayoutTests/inspector/dom/domutilities-path-dump-expected.txt
+++ b/LayoutTests/inspector/dom/domutilities-path-dump-expected.txt
@@ -1,4 +1,4 @@
-Test for WebInspector.cssPath.
+Test for WI.cssPath.
 
 ид
 класс
diff --git a/LayoutTests/inspector/dom/domutilities-path-dump.html b/LayoutTests/inspector/dom/domutilities-path-dump.html
index c6d7777..73379e0 100644
--- a/LayoutTests/inspector/dom/domutilities-path-dump.html
+++ b/LayoutTests/inspector/dom/domutilities-path-dump.html
@@ -39,22 +39,22 @@
         }
     }
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
         // Push all the nodes to the frontend.
-        WebInspector.domTreeManager.querySelector(documentNode.id, "html", (nodeId) => {
-            let htmlNode = WebInspector.domTreeManager.nodeForId(nodeId);
+        WI.domTreeManager.querySelector(documentNode.id, "html", (nodeId) => {
+            let htmlNode = WI.domTreeManager.nodeForId(nodeId);
             htmlNode.getSubtree(10, () => {
                 buildNodeList(htmlNode, 0);
 
                 InspectorTest.log("");
                 InspectorTest.log("-- CSS Selector Paths --");
-                processList(WebInspector.cssPath, (selector) => {
+                processList(WI.cssPath, (selector) => {
                     InspectorTest.evaluateInPage("verifySelector(" + JSON.stringify(selector) + ")");
                 });
 
                 InspectorTest.log("");
                 InspectorTest.log("-- XPaths --");
-                processList(WebInspector.xpath, (xpath) => {
+                processList(WI.xpath, (xpath) => {
                     InspectorTest.evaluateInPage("verifyXPath(" + JSON.stringify(xpath) + ")");
                 });
 
@@ -68,7 +68,7 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Test for WebInspector.cssPath.</p>
+<p>Test for WI.cssPath.</p>
 
 <article></article>
 <article></article>
diff --git a/LayoutTests/inspector/dom/domutilities-xpath-expected.txt b/LayoutTests/inspector/dom/domutilities-xpath-expected.txt
index 136a75a..c31a550 100644
--- a/LayoutTests/inspector/dom/domutilities-xpath-expected.txt
+++ b/LayoutTests/inspector/dom/domutilities-xpath-expected.txt
@@ -1,29 +1,29 @@
-Test for WebInspector.xpath.
+Test for WI.xpath.
 
 
 
 
-== Running test suite: WebInspector.xpath
--- Running test case: WebInspector.xpath.TopLevelNode
+== Running test suite: WI.xpath
+-- Running test case: WI.xpath.TopLevelNode
 PASS: HTML element should have simple XPath '/html'.
 PASS: BODY element should have simple XPath '/html/body'.
 PASS: HEAD element should have simple XPath '/html/head'.
 
--- Running test case: WebInspector.xpath.ElementWithID
+-- Running test case: WI.xpath.ElementWithID
 PASS: Element with id should have a single path component '//*[@id="id-test"]'.
 PASS: Element inside element with id should have path from id.
 
--- Running test case: WebInspector.xpath.UniqueTagName
+-- Running test case: WI.xpath.UniqueTagName
 PASS: Elements with unique tag name should not need XPath index.
 
--- Running test case: WebInspector.xpath.NonUniqueTagName
+-- Running test case: WI.xpath.NonUniqueTagName
 PASS: Elements with non-unique tag name should need XPath index.
 
--- Running test case: WebInspector.xpath.DeepPath
+-- Running test case: WI.xpath.DeepPath
 /html/body/div/div[7]/ul/li/div[3]/ul/li[2]/a/small
 PASS: Should be able to get XPath for deep elements.
 
--- Running test case: WebInspector.xpath.TextAndCommentNode
+-- Running test case: WI.xpath.TextAndCommentNode
 PASS: Should be able to get XPath for TEXT_NODE.
 PASS: Should be able to get XPath for COMMENT_NODE.
 
diff --git a/LayoutTests/inspector/dom/domutilities-xpath.html b/LayoutTests/inspector/dom/domutilities-xpath.html
index d38192a..78521b7 100644
--- a/LayoutTests/inspector/dom/domutilities-xpath.html
+++ b/LayoutTests/inspector/dom/domutilities-xpath.html
@@ -8,88 +8,88 @@
     let documentNode;
 
     function nodeForSelector(selector, callback) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, selector, (nodeId) => {
-            callback(WebInspector.domTreeManager.nodeForId(nodeId));
+        WI.domTreeManager.querySelector(documentNode.id, selector, (nodeId) => {
+            callback(WI.domTreeManager.nodeForId(nodeId));
         });
     }
 
-    let suite = InspectorTest.createAsyncSuite("WebInspector.xpath");
+    let suite = InspectorTest.createAsyncSuite("WI.xpath");
 
     suite.addTestCase({
-        name: "WebInspector.xpath.TopLevelNode",
+        name: "WI.xpath.TopLevelNode",
         description: "Top level nodes like html, body, and head are unique.",
         test(resolve, reject) {
             nodeForSelector("html", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "/html", "HTML element should have simple XPath '/html'.");
+                InspectorTest.expectEqual(WI.xpath(node), "/html", "HTML element should have simple XPath '/html'.");
             });
             nodeForSelector("html > body", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "/html/body", "BODY element should have simple XPath '/html/body'.");
+                InspectorTest.expectEqual(WI.xpath(node), "/html/body", "BODY element should have simple XPath '/html/body'.");
             });
             nodeForSelector("html > head", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "/html/head", "HEAD element should have simple XPath '/html/head'.");
+                InspectorTest.expectEqual(WI.xpath(node), "/html/head", "HEAD element should have simple XPath '/html/head'.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.xpath.ElementWithID",
+        name: "WI.xpath.ElementWithID",
         description: "Element with ID is unique (#id). Path does not need to go past it.",
         test(resolve, reject) {
             nodeForSelector("#id-test", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "//*[@id=\"id-test\"]", "Element with id should have a single path component '//*[@id=\"id-test\"]'.");
+                InspectorTest.expectEqual(WI.xpath(node), "//*[@id=\"id-test\"]", "Element with id should have a single path component '//*[@id=\"id-test\"]'.");
             });
             nodeForSelector("#id-test > div", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "//*[@id=\"id-test\"]/div", "Element inside element with id should have path from id.");
+                InspectorTest.expectEqual(WI.xpath(node), "//*[@id=\"id-test\"]/div", "Element inside element with id should have path from id.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.xpath.UniqueTagName",
+        name: "WI.xpath.UniqueTagName",
         description: "Elements with unique tag name do not need nth-child.",
         test(resolve, reject) {
             nodeForSelector("#unique-tag-test > span", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "//*[@id=\"unique-tag-test\"]/span", "Elements with unique tag name should not need XPath index.");
+                InspectorTest.expectEqual(WI.xpath(node), "//*[@id=\"unique-tag-test\"]/span", "Elements with unique tag name should not need XPath index.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.xpath.NonUniqueTagName",
+        name: "WI.xpath.NonUniqueTagName",
         description: "Elements with non-unique tag name need index.",
         test(resolve, reject) {
             nodeForSelector("#non-unique-tag-test > span ~ span", (node) => {
-                InspectorTest.expectEqual(WebInspector.xpath(node), "//*[@id=\"non-unique-tag-test\"]/span[2]", "Elements with non-unique tag name should need XPath index.");
+                InspectorTest.expectEqual(WI.xpath(node), "//*[@id=\"non-unique-tag-test\"]/span[2]", "Elements with non-unique tag name should need XPath index.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.xpath.DeepPath",
+        name: "WI.xpath.DeepPath",
         description: "Tests for element with complex path.",
         test(resolve, reject) {
             nodeForSelector("small", (node) => {
-                InspectorTest.log(WebInspector.xpath(node));
-                InspectorTest.expectEqual(WebInspector.xpath(node), "/html/body/div/div[7]/ul/li/div[3]/ul/li[2]/a/small", "Should be able to get XPath for deep elements.");
+                InspectorTest.log(WI.xpath(node));
+                InspectorTest.expectEqual(WI.xpath(node), "/html/body/div/div[7]/ul/li/div[3]/ul/li[2]/a/small", "Should be able to get XPath for deep elements.");
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.xpath.TextAndCommentNode",
+        name: "WI.xpath.TextAndCommentNode",
         description: "Tests for non-Element nodes.",
         test(resolve, reject) {
             nodeForSelector("#non-element-test > p > br", (node) => {
                 let paragraphChildren = node.parentNode.children;
                 let lastTextChild = paragraphChildren[paragraphChildren.length - 1];
                 let lastCommentChild = paragraphChildren[paragraphChildren.length - 2];
-                InspectorTest.expectEqual(WebInspector.xpath(lastTextChild), "//*[@id=\"non-element-test\"]/p/text()[3]", "Should be able to get XPath for TEXT_NODE.");
-                InspectorTest.expectEqual(WebInspector.xpath(lastCommentChild), "//*[@id=\"non-element-test\"]/p/comment()", "Should be able to get XPath for COMMENT_NODE.");
+                InspectorTest.expectEqual(WI.xpath(lastTextChild), "//*[@id=\"non-element-test\"]/p/text()[3]", "Should be able to get XPath for TEXT_NODE.");
+                InspectorTest.expectEqual(WI.xpath(lastCommentChild), "//*[@id=\"non-element-test\"]/p/comment()", "Should be able to get XPath for COMMENT_NODE.");
                 resolve();
             });
         }
@@ -98,7 +98,7 @@
     // FIXME: Write tests for nodes inside a Shadow DOM Tree.
     // FIXME: Write test for CDATA.
 
-    WebInspector.domTreeManager.requestDocument((node) => {
+    WI.domTreeManager.requestDocument((node) => {
         documentNode = node;
         suite.runTestCasesAndFinish();
     });
@@ -106,7 +106,7 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Test for WebInspector.xpath.</p>
+<p>Test for WI.xpath.</p>
 <!-- If display:none pseudo elements are not created. -->
 <div style="visibility:hidden">
     <div id="id-test">
diff --git a/LayoutTests/inspector/dom/getEventListenersForNode.html b/LayoutTests/inspector/dom/getEventListenersForNode.html
index 380d33f..8edb81e 100644
--- a/LayoutTests/inspector/dom/getEventListenersForNode.html
+++ b/LayoutTests/inspector/dom/getEventListenersForNode.html
@@ -19,7 +19,7 @@
                 }
 
                 for (let eventListener of eventListeners) {
-                    let node = WebInspector.domTreeManager.nodeForId(eventListener.nodeId);
+                    let node = WI.domTreeManager.nodeForId(eventListener.nodeId);
 
 
                     InspectorTest.log(`Event: ${eventListener.type}`);
@@ -43,15 +43,15 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "div#x", (contentNodeId) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
+        WI.domTreeManager.querySelector(documentNode.id, "div#x", (contentNodeId) => {
             if (!contentNodeId) {
                 InspectorTest.fail("DOM node not found.");
                 InspectorTest.completeTest();
                 return;
             }
 
-            domNode = WebInspector.domTreeManager.nodeForId(contentNodeId);
+            domNode = WI.domTreeManager.nodeForId(contentNodeId);
 
             suite.runTestCasesAndFinish();
         });
diff --git a/LayoutTests/inspector/dom/getOuterHTML.html b/LayoutTests/inspector/dom/getOuterHTML.html
index 816ff54..ed55eb6 100644
--- a/LayoutTests/inspector/dom/getOuterHTML.html
+++ b/LayoutTests/inspector/dom/getOuterHTML.html
@@ -11,9 +11,9 @@
         name: "GetOuterHTML",
         description: "Get the OuterHTML of the target element.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.requestDocument(function(documentNode) {
-                WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
-                    let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.requestDocument(function(documentNode) {
+                WI.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
+                    let domNode = WI.domTreeManager.nodeForId(nodeId);
                     InspectorTest.assert(domNode, "DOMNode exists");
                     domNode.getOuterHTML(function(error, outerHTML) {
                         InspectorTest.expectNoError(error);
diff --git a/LayoutTests/inspector/dom/hideHighlight.html b/LayoutTests/inspector/dom/hideHighlight.html
index 355491c..f622aaf 100644
--- a/LayoutTests/inspector/dom/hideHighlight.html
+++ b/LayoutTests/inspector/dom/hideHighlight.html
@@ -72,7 +72,7 @@
         name: "HighlightRect",
         description: "Call highlightRect to create a highlight.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 100, 100);
+            let rect = new WI.Rect(0, 0, 100, 100);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -85,7 +85,7 @@
         name: "HighlightQuad",
         description: "Call highlightQuad to create a highlight.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
+            let quad = new WI.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -106,8 +106,8 @@
                 marginColor: {r: 255, g: 255, b: 255},
             };
 
-            WebInspector.domTreeManager.requestDocument((documentNode) => {
-                WebInspector.domTreeManager.querySelector(documentNode.id, "#target", (nodeId) => {
+            WI.domTreeManager.requestDocument((documentNode) => {
+                WI.domTreeManager.querySelector(documentNode.id, "#target", (nodeId) => {
                     DOMAgent.highlightNode(highlightConfig, nodeId, (error) => {
                         InspectorTest.assert(!error, "Should not have an error.");
                         dumpHighlight(resolve);
diff --git a/LayoutTests/inspector/dom/highlightFrame.html b/LayoutTests/inspector/dom/highlightFrame.html
index 1c40a8a..37ebab2 100644
--- a/LayoutTests/inspector/dom/highlightFrame.html
+++ b/LayoutTests/inspector/dom/highlightFrame.html
@@ -7,7 +7,7 @@
 {
     let suite = InspectorTest.createAsyncSuite("DOM.highlightFrame");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
     let childFrames = mainFrame.childFrameCollection.toArray();
     InspectorTest.expectEqual(childFrames.length, 2, "Page should have subframes.");
 
diff --git a/LayoutTests/inspector/dom/highlightNode.html b/LayoutTests/inspector/dom/highlightNode.html
index bce536d..d0d6a45 100644
--- a/LayoutTests/inspector/dom/highlightNode.html
+++ b/LayoutTests/inspector/dom/highlightNode.html
@@ -7,7 +7,7 @@
 {
     let suite = InspectorTest.createAsyncSuite("DOM.highlightNode");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
     let childFrames = mainFrame.childFrameCollection.toArray();
     InspectorTest.expectEqual(childFrames.length, 1, "Page should have a subframe.");
 
@@ -54,8 +54,8 @@
         name: "MainFrameNodeViaNodeId",
         description: "Should highlight a node in the main frame using node id.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(mainFrameDocumentNodeId, "#id-one", function(nodeId) {
-                mainFrameTargetNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(mainFrameDocumentNodeId, "#id-one", function(nodeId) {
+                mainFrameTargetNode = WI.domTreeManager.nodeForId(nodeId);
                 DOMAgent.highlightNode(highlightConfig, mainFrameTargetNode.id, undefined, (error) => {
                     InspectorTest.assert(!error, "Should not have an error.");
                     dumpHighlight(resolve);
@@ -68,8 +68,8 @@
         name: "ChildFrameNodeViaNodeId",
         description: "Should highlight a node in the child frame using node id.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(childFrameDocumentNodeId, "#id-one", function(nodeId) {
-                childFrameTargetNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(childFrameDocumentNodeId, "#id-one", function(nodeId) {
+                childFrameTargetNode = WI.domTreeManager.nodeForId(nodeId);
                 DOMAgent.highlightNode(highlightConfig, childFrameTargetNode.id, undefined, (error) => {
                     InspectorTest.assert(!error, "Should not have an error.");
                     dumpHighlight(resolve);
@@ -82,7 +82,7 @@
         name: "MainFrameNodeViaObjectId",
         description: "Should highlight a node in the main frame using object id.",
         test(resolve, reject) {
-            WebInspector.RemoteObject.resolveNode(mainFrameTargetNode, "test", (remoteObject) => {
+            WI.RemoteObject.resolveNode(mainFrameTargetNode, "test", (remoteObject) => {
                 DOMAgent.highlightNode(highlightConfig, undefined, remoteObject.objectId, (error) => {
                     InspectorTest.assert(!error, "Should not have an error.");
                     dumpHighlight(resolve);
@@ -95,7 +95,7 @@
         name: "ChildFrameNodeViaObjectId",
         description: "Should highlight a node in the child frame using object id.",
         test(resolve, reject) {
-            WebInspector.RemoteObject.resolveNode(childFrameTargetNode, "test", (remoteObject) => {
+            WI.RemoteObject.resolveNode(childFrameTargetNode, "test", (remoteObject) => {
                 DOMAgent.highlightNode(highlightConfig, undefined, remoteObject.objectId, (error) => {
                     InspectorTest.assert(!error, "Should not have an error.");
                     dumpHighlight(resolve);
@@ -142,10 +142,10 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
         mainFrameDocumentNodeId = documentNode.id;
         RuntimeAgent.evaluate.invoke({expression: "document", objectGroup: "test", contextId: childFrames[0].pageExecutionContext.id}, (error, remoteObjectPayload) => {
-            let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload)
+            let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload)
             remoteObject.pushNodeToFrontend((documentNodeId) => {
                 childFrameDocumentNodeId = documentNodeId
 
diff --git a/LayoutTests/inspector/dom/highlightNodeList.html b/LayoutTests/inspector/dom/highlightNodeList.html
index bf00e85..402bfe4 100644
--- a/LayoutTests/inspector/dom/highlightNodeList.html
+++ b/LayoutTests/inspector/dom/highlightNodeList.html
@@ -7,7 +7,7 @@
 {
     let suite = InspectorTest.createAsyncSuite("DOM.highlightNodeList");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
     let childFrames = mainFrame.childFrameCollection.toArray();
     InspectorTest.expectEqual(childFrames.length, 1, "Page should have a subframe.");
 
@@ -73,7 +73,7 @@
         name: "DOM.highlightNodeList.mainFrameNode",
         description: "Should highlight all div in the main frame.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelectorAll(mainFrameDocumentNodeId, "div", (nodeIds) => {
+            WI.domTreeManager.querySelectorAll(mainFrameDocumentNodeId, "div", (nodeIds) => {
                 DOMAgent.highlightNodeList(nodeIds, highlightConfig, (error) => {
                     if (error) {
                         reject(error);
@@ -91,7 +91,7 @@
         name: "DOM.highlightNodeList.childFrameNode",
         description: "Should highlight all div in the child frame.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelectorAll(childFrameDocumentNodeId, "div", (nodeIds) => {
+            WI.domTreeManager.querySelectorAll(childFrameDocumentNodeId, "div", (nodeIds) => {
                 DOMAgent.highlightNodeList(nodeIds, highlightConfig, (error) => {
                     if (error) {
                         reject(error);
@@ -137,10 +137,10 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
         mainFrameDocumentNodeId = documentNode.id;
         RuntimeAgent.evaluate.invoke({expression: "document", objectGroup: "test", contextId: childFrames[0].pageExecutionContext.id}, (error, remoteObjectPayload) => {
-            let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload)
+            let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload)
             remoteObject.pushNodeToFrontend((documentNodeId) => {
                 childFrameDocumentNodeId = documentNodeId;
 
diff --git a/LayoutTests/inspector/dom/highlightQuad.html b/LayoutTests/inspector/dom/highlightQuad.html
index 0a1b18e..5bffd20 100644
--- a/LayoutTests/inspector/dom/highlightQuad.html
+++ b/LayoutTests/inspector/dom/highlightQuad.html
@@ -43,7 +43,7 @@
         name: "HighlightSmallRectWithQuad",
         description: "Should create a highlight using viewport coordinates.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([0, 0, 100, 0, 100, 100, 100, 0]);
+            let quad = new WI.Quad([0, 0, 100, 0, 100, 100, 100, 0]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -54,7 +54,7 @@
         name: "HighlightSmallQuadViewportCoordinates",
         description: "Should create a highlight using viewport coordinates.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
+            let quad = new WI.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, useViewportCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -65,7 +65,7 @@
         name: "HighlightSmallQuadPageCoordinates",
         description: "Should create a highlight using page coordinates.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
+            let quad = new WI.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, usePageCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -76,7 +76,7 @@
         name: "HighlightSmallUnspecifiedCoordinatesUsesViewportCoordinates",
         description: "Should create a highlight using page coordinates.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
+            let quad = new WI.Quad([100, 100, 150, 150, 100, 200, 50, 150]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -87,7 +87,7 @@
         name: "HighlightLargeQuadViewportCoordinates",
         description: "Should create a highlight using viewport coordinates.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([0, 0, 500, 0, 1000, 1000, 0, 2000]);
+            let quad = new WI.Quad([0, 0, 500, 0, 1000, 1000, 0, 2000]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, useViewportCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -98,7 +98,7 @@
         name: "HighlightLargeQuadPageCoordinates",
         description: "Should create a highlight using viewport coordinates.",
         test(resolve, reject) {
-            let quad = new WebInspector.Quad([0, 0, 500, 0, 1000, 1000, 0, 2000]);
+            let quad = new WI.Quad([0, 0, 500, 0, 1000, 1000, 0, 2000]);
             DOMAgent.highlightQuad(quad.toProtocol(), color, outlineColor, usePageCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
diff --git a/LayoutTests/inspector/dom/highlightRect.html b/LayoutTests/inspector/dom/highlightRect.html
index f9ccc89..85ff5c7 100644
--- a/LayoutTests/inspector/dom/highlightRect.html
+++ b/LayoutTests/inspector/dom/highlightRect.html
@@ -43,7 +43,7 @@
         name: "HighlightSmallRectViewportCoordinates",
         description: "Should create a highlight using viewport coordinates.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 100, 200);
+            let rect = new WI.Rect(0, 0, 100, 200);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, useViewportCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -54,7 +54,7 @@
         name: "HighlightSmallRectPageCoordinates",
         description: "Should create a highlight using page coordinates.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 100, 200);
+            let rect = new WI.Rect(0, 0, 100, 200);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, usePageCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -65,7 +65,7 @@
         name: "HighlightSmallRectUnspecifiedCoordinatesUsesViewportCoordinates",
         description: "Should create a highlight using viewport coordinates if unspecified.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 100, 200);
+            let rect = new WI.Rect(0, 0, 100, 200);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -76,7 +76,7 @@
         name: "HighlightLargeRectViewportCoordinates",
         description: "Should create a large highlight using viewport coordinates.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 100000, 200000);
+            let rect = new WI.Rect(0, 0, 100000, 200000);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, useViewportCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -87,7 +87,7 @@
         name: "HighlightLargeRectPageCoordinates",
         description: "Should create a large highlight using page coordinates.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 100000, 200000);
+            let rect = new WI.Rect(0, 0, 100000, 200000);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, usePageCoordinates, (error) => {
                 dumpHighlightRects(resolve);
             });
@@ -98,7 +98,7 @@
         name: "HighlightEmptyRect",
         description: "Should create an empty highlight.",
         test(resolve, reject) {
-            let rect = new WebInspector.Rect(0, 0, 0, 0);
+            let rect = new WI.Rect(0, 0, 0, 0);
             DOMAgent.highlightRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, color, outlineColor, false, (error) => {
                 dumpHighlightRects(resolve);
             });
diff --git a/LayoutTests/inspector/dom/highlightSelector.html b/LayoutTests/inspector/dom/highlightSelector.html
index 9f25783..c047e88 100644
--- a/LayoutTests/inspector/dom/highlightSelector.html
+++ b/LayoutTests/inspector/dom/highlightSelector.html
@@ -7,7 +7,7 @@
 {
     let suite = InspectorTest.createAsyncSuite("DOM.highlightSelector");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
     let childFrames = mainFrame.childFrameCollection.toArray();
     InspectorTest.expectEqual(childFrames.length, 1, "Page should have a subframe.");
 
diff --git a/LayoutTests/inspector/dom/pseudo-element-dynamic.html b/LayoutTests/inspector/dom/pseudo-element-dynamic.html
index 12a815a..fd9b049 100644
--- a/LayoutTests/inspector/dom/pseudo-element-dynamic.html
+++ b/LayoutTests/inspector/dom/pseudo-element-dynamic.html
@@ -25,7 +25,7 @@
 
                 InspectorTest.expectThat(insertedOrRemovedDOMNode === testDOMNode.beforePseudoElement(), "New DOMNode is the beforePseudoElement");
                 InspectorTest.expectThat(insertedOrRemovedDOMNode.parentNode === testDOMNode, "New DOMNode is a child of #x");
-                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WebInspector.DOMNode.PseudoElementType.Before, "New DOMNode is a before pseudo element");
+                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WI.DOMNode.PseudoElementType.Before, "New DOMNode is a before pseudo element");
 
                 previousInsertedDOMNode = insertedOrRemovedDOMNode;
                 next();
@@ -47,7 +47,7 @@
 
                 InspectorTest.expectThat(insertedOrRemovedDOMNode === previousInsertedDOMNode, "Removed DOMNode was the before pseudo element");
                 InspectorTest.expectThat(insertedOrRemovedDOMNode.parentNode === null, "Removed DOMNode has no parent");
-                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WebInspector.DOMNode.PseudoElementType.Before, "Removed DOMNode was a before pseudo element");
+                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WI.DOMNode.PseudoElementType.Before, "Removed DOMNode was a before pseudo element");
 
                 previousInsertedDOMNode = null;
                 next();
@@ -69,7 +69,7 @@
 
                 InspectorTest.expectThat(insertedOrRemovedDOMNode === testDOMNode.afterPseudoElement(), "New DOMNode is the afterPseudoElement");
                 InspectorTest.expectThat(insertedOrRemovedDOMNode.parentNode === testDOMNode, "New DOMNode is a child of #x");
-                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WebInspector.DOMNode.PseudoElementType.After, "New DOMNode is an after pseudo element");
+                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WI.DOMNode.PseudoElementType.After, "New DOMNode is an after pseudo element");
 
                 previousInsertedDOMNode = insertedOrRemovedDOMNode;
                 next();
@@ -91,7 +91,7 @@
 
                 InspectorTest.expectThat(insertedOrRemovedDOMNode === previousInsertedDOMNode, "Removed DOMNode was the after pseudo element");
                 InspectorTest.expectThat(insertedOrRemovedDOMNode.parentNode === null, "Removed DOMNode has no parent");
-                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WebInspector.DOMNode.PseudoElementType.After, "Removed DOMNode was an after pseudo element");
+                InspectorTest.expectThat(insertedOrRemovedDOMNode.pseudoType() === WI.DOMNode.PseudoElementType.After, "Removed DOMNode was an after pseudo element");
 
                 previousInsertedDOMNode = null;
                 next();
@@ -111,9 +111,9 @@
         InspectorTest.completeTest();
     }
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
-            testDOMNode = WebInspector.domTreeManager.nodeForId(nodeId);
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
+            testDOMNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.log("");
             InspectorTest.expectThat(testDOMNode, "Got DOMNode for #x");
             InspectorTest.assert(!testDOMNode.pseudoType());
@@ -125,7 +125,7 @@
         });
     });
 
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeInserted, function(event) {
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeInserted, function(event) {
         // Test logging will add nodes to the test page. Ignore any elements added that are not children of our test node.
         if (event.data.parent !== testDOMNode)
             return;
@@ -135,7 +135,7 @@
         next();
     });
 
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved, function(event) {
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeRemoved, function(event) {
         InspectorTest.log("EVENT: NodeRemoved");
         insertedOrRemovedDOMNode = event.data.node;
         next();
diff --git a/LayoutTests/inspector/dom/pseudo-element-static.html b/LayoutTests/inspector/dom/pseudo-element-static.html
index ad21cbe..5ba5eab 100644
--- a/LayoutTests/inspector/dom/pseudo-element-static.html
+++ b/LayoutTests/inspector/dom/pseudo-element-static.html
@@ -3,9 +3,9 @@
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script>
 function test() {
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#none", function(nodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#none", function(nodeId) {
+            var domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.log("");
             InspectorTest.expectThat(domNode, "Got DOMNode for #none");
             InspectorTest.assert(!domNode.pseudoType());
@@ -15,8 +15,8 @@
             InspectorTest.assert(!domNode.afterPseudoElement());
         });
 
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#b", function(nodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+        WI.domTreeManager.querySelector(documentNode.id, "#b", function(nodeId) {
+            var domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.log("");
             InspectorTest.expectThat(domNode, "Got DOMNode for #b");
             InspectorTest.assert(!domNode.pseudoType());
@@ -24,11 +24,11 @@
             InspectorTest.expectThat(domNode.pseudoElements().size === 1, "DOMNode has 1 pseudo elements");
             InspectorTest.expectThat(domNode.beforePseudoElement(), "DOMNode has a before pseudo element");
             InspectorTest.expectThat(!domNode.afterPseudoElement(), "DOMNode does not have an after pseudo element");
-            InspectorTest.expectThat(domNode.beforePseudoElement().pseudoType() === WebInspector.DOMNode.PseudoElementType.Before, "DOMNode for before pseudo element has the right type");
+            InspectorTest.expectThat(domNode.beforePseudoElement().pseudoType() === WI.DOMNode.PseudoElementType.Before, "DOMNode for before pseudo element has the right type");
         });
 
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#a", function(nodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+        WI.domTreeManager.querySelector(documentNode.id, "#a", function(nodeId) {
+            var domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.log("");
             InspectorTest.expectThat(domNode, "Got DOMNode for #a");
             InspectorTest.assert(!domNode.pseudoType());
@@ -36,11 +36,11 @@
             InspectorTest.expectThat(domNode.pseudoElements().size === 1, "DOMNode has 1 pseudo elements");
             InspectorTest.expectThat(!domNode.beforePseudoElement(), "DOMNode does not have a before pseudo element");
             InspectorTest.expectThat(domNode.afterPseudoElement(), "DOMNode has an after pseudo element");
-            InspectorTest.expectThat(domNode.afterPseudoElement().pseudoType() === WebInspector.DOMNode.PseudoElementType.After, "DOMNode for after pseudo element has the right type");
+            InspectorTest.expectThat(domNode.afterPseudoElement().pseudoType() === WI.DOMNode.PseudoElementType.After, "DOMNode for after pseudo element has the right type");
         });
 
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+        WI.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
+            var domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.log("");
             InspectorTest.expectThat(domNode, "Got DOMNode for #x");
             InspectorTest.assert(!domNode.pseudoType());
@@ -48,8 +48,8 @@
             InspectorTest.expectThat(domNode.pseudoElements().size === 2, "DOMNode has 2 pseudo elements");
             InspectorTest.expectThat(domNode.beforePseudoElement(), "DOMNode has a before pseudo element");
             InspectorTest.expectThat(domNode.afterPseudoElement(), "DOMNode has an after pseudo element");
-            InspectorTest.expectThat(domNode.beforePseudoElement().pseudoType() === WebInspector.DOMNode.PseudoElementType.Before, "DOMNode for before pseudo element has the right type");
-            InspectorTest.expectThat(domNode.afterPseudoElement().pseudoType() === WebInspector.DOMNode.PseudoElementType.After, "DOMNode for after pseudo element has the right type");
+            InspectorTest.expectThat(domNode.beforePseudoElement().pseudoType() === WI.DOMNode.PseudoElementType.Before, "DOMNode for before pseudo element has the right type");
+            InspectorTest.expectThat(domNode.afterPseudoElement().pseudoType() === WI.DOMNode.PseudoElementType.After, "DOMNode for after pseudo element has the right type");
             InspectorTest.completeTest();
         });
     });
diff --git a/LayoutTests/inspector/dom/push-node-by-path-to-frontend.html b/LayoutTests/inspector/dom/push-node-by-path-to-frontend.html
index 4b08d65..ed13f85 100644
--- a/LayoutTests/inspector/dom/push-node-by-path-to-frontend.html
+++ b/LayoutTests/inspector/dom/push-node-by-path-to-frontend.html
@@ -12,13 +12,13 @@
             name, description,
             test(resolve, reject) {
                 InspectorTest.log("Push node with path: " + path);
-                WebInspector.domTreeManager.pushNodeByPathToFrontend(path, (nodeIdentifier) => {
+                WI.domTreeManager.pushNodeByPathToFrontend(path, (nodeIdentifier) => {
                     if (!nodeIdentifier) {
                         reject();
                         return;
                     }
 
-                    let node = WebInspector.domTreeManager.nodeForId(nodeIdentifier);
+                    let node = WI.domTreeManager.nodeForId(nodeIdentifier);
                     InspectorTest.expectEqual(node.path(), path, "Pushed node has correct path.");
                     resolve();
                 });
diff --git a/LayoutTests/inspector/dom/setOuterHTML-no-document-element.html b/LayoutTests/inspector/dom/setOuterHTML-no-document-element.html
index a0413d2..ff5f3b3 100644
--- a/LayoutTests/inspector/dom/setOuterHTML-no-document-element.html
+++ b/LayoutTests/inspector/dom/setOuterHTML-no-document-element.html
@@ -19,7 +19,7 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
         documentNodeId = documentNode.id;
         suite.runTestCasesAndFinish();
     });
diff --git a/LayoutTests/inspector/dom/setOuterHTML.html b/LayoutTests/inspector/dom/setOuterHTML.html
index 3ecc370..b5944d0 100644
--- a/LayoutTests/inspector/dom/setOuterHTML.html
+++ b/LayoutTests/inspector/dom/setOuterHTML.html
@@ -71,9 +71,9 @@
         });
     });
 
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
-            domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#x", function(nodeId) {
+            domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.assert(domNode, "DOMNode exists.");
             suite.runTestCasesAndFinish();
         });
diff --git a/LayoutTests/inspector/dom/shadow-and-non-shadow-children.html b/LayoutTests/inspector/dom/shadow-and-non-shadow-children.html
index 36d497e..7bc9e4c 100644
--- a/LayoutTests/inspector/dom/shadow-and-non-shadow-children.html
+++ b/LayoutTests/inspector/dom/shadow-and-non-shadow-children.html
@@ -16,8 +16,8 @@
         name: "DOMNode.ShadowAndNonShadowChildren.VideoWithSource",
         description: "Check for all children of a video with a source child.",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNodeId, "#test-video", (nodeId) => {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNodeId, "#test-video", (nodeId) => {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.expectEqual(domNode.nodeName(), "VIDEO", "DOMNode should be a `video` element.");
                 InspectorTest.expectThat(domNode.hasChildNodes(), "DOMNode should have child nodes.");
                 InspectorTest.expectThat(domNode.childNodeCount, "DOMNode should indicate it has 2 child nodes.");
@@ -33,7 +33,7 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((documentNode) => {
+    WI.domTreeManager.requestDocument((documentNode) => {
         documentNodeId = documentNode.id;
         suite.runTestCasesAndFinish();
     });
diff --git a/LayoutTests/inspector/dom/shadowRootType.html b/LayoutTests/inspector/dom/shadowRootType.html
index 07de2cc..550e9c8 100644
--- a/LayoutTests/inspector/dom/shadowRootType.html
+++ b/LayoutTests/inspector/dom/shadowRootType.html
@@ -12,11 +12,11 @@
     suite.addTestCase({
         name: "ShadowRootType.UserAgent",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#host-user-agent", (nodeId) => {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "#host-user-agent", (nodeId) => {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.assert(domNode, "Got DOMNode for #host-user-agent");
                 InspectorTest.expectThat(domNode.shadowRoots().length === 1, "DOMNode has a single shadow root.");
-                InspectorTest.expectThat(domNode.shadowRoots()[0].shadowRootType() === WebInspector.DOMNode.ShadowRootType.UserAgent, "DOMNode has UserAgent shadow root type.");
+                InspectorTest.expectThat(domNode.shadowRoots()[0].shadowRootType() === WI.DOMNode.ShadowRootType.UserAgent, "DOMNode has UserAgent shadow root type.");
                 InspectorTest.expectThat(domNode.shadowRoots()[0].isInUserAgentShadowTree(), "DOMNode is in a UserAgent shadow tree.");
                 resolve();
             });
@@ -26,11 +26,11 @@
     suite.addTestCase({
         name: "ShadowRootType.Closed",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#host-closed", (nodeId) => {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "#host-closed", (nodeId) => {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.assert(domNode, "Got DOMNode for #host-closed");
                 InspectorTest.expectThat(domNode.shadowRoots().length === 1, "DOMNode has a single shadow root.");
-                InspectorTest.expectThat(domNode.shadowRoots()[0].shadowRootType() === WebInspector.DOMNode.ShadowRootType.Closed, "DOMNode has Closed shadow root type.");
+                InspectorTest.expectThat(domNode.shadowRoots()[0].shadowRootType() === WI.DOMNode.ShadowRootType.Closed, "DOMNode has Closed shadow root type.");
                 InspectorTest.expectThat(!domNode.shadowRoots()[0].isInUserAgentShadowTree(), "DOMNode is not in a UserAgent shadow tree.");
                 resolve();
             });
@@ -40,11 +40,11 @@
     suite.addTestCase({
         name: "ShadowRootType.Open",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#host-open", (nodeId) => {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "#host-open", (nodeId) => {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.assert(domNode, "Got DOMNode for #host-open");
                 InspectorTest.expectThat(domNode.shadowRoots().length === 1, "DOMNode has a single shadow root.");
-                InspectorTest.expectThat(domNode.shadowRoots()[0].shadowRootType() === WebInspector.DOMNode.ShadowRootType.Open, "DOMNode has Open shadow root type.");
+                InspectorTest.expectThat(domNode.shadowRoots()[0].shadowRootType() === WI.DOMNode.ShadowRootType.Open, "DOMNode has Open shadow root type.");
                 InspectorTest.expectThat(!domNode.shadowRoots()[0].isInUserAgentShadowTree(), "DOMNode is not in a UserAgent shadow tree.");
                 resolve();
             });
@@ -54,8 +54,8 @@
     suite.addTestCase({
         name: "NoShadowRootType",
         test(resolve, reject) {
-            WebInspector.domTreeManager.querySelector(documentNode.id, "#no-host", (nodeId) => {
-                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            WI.domTreeManager.querySelector(documentNode.id, "#no-host", (nodeId) => {
+                let domNode = WI.domTreeManager.nodeForId(nodeId);
                 InspectorTest.assert(domNode, "Got DOMNode for #no-host");
                 InspectorTest.expectThat(domNode.shadowRoots().length === 0, "DOMNode has no shadow roots.");
                 InspectorTest.expectThat(domNode.shadowRootType() === undefined, "DOMNode has no shadow root type.");
@@ -64,7 +64,7 @@
         }
     });
 
-    WebInspector.domTreeManager.requestDocument((node) => {
+    WI.domTreeManager.requestDocument((node) => {
         documentNode = node;
         suite.runTestCasesAndFinish();
     });
diff --git a/LayoutTests/inspector/dom/template-content.html b/LayoutTests/inspector/dom/template-content.html
index 089bba6..f340ffb 100644
--- a/LayoutTests/inspector/dom/template-content.html
+++ b/LayoutTests/inspector/dom/template-content.html
@@ -3,15 +3,15 @@
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script>
 function test() {
-    WebInspector.domTreeManager.requestDocument(function(documentNode) {
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#div", function(nodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+    WI.domTreeManager.requestDocument(function(documentNode) {
+        WI.domTreeManager.querySelector(documentNode.id, "#div", function(nodeId) {
+            var domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.expectThat(domNode, "Got DOMNode for div element");
             InspectorTest.expectThat(!domNode.templateContent(), "DOMNode does not have template content");
         });
 
-        WebInspector.domTreeManager.querySelector(documentNode.id, "#template", function(nodeId) {
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+        WI.domTreeManager.querySelector(documentNode.id, "#template", function(nodeId) {
+            var domNode = WI.domTreeManager.nodeForId(nodeId);
             InspectorTest.log("");
             InspectorTest.expectThat(domNode, "Got DOMNode for template element");
             InspectorTest.expectThat(domNode.templateContent(), "DOMNode has template content");
diff --git a/LayoutTests/inspector/formatting/formatting-json.html b/LayoutTests/inspector/formatting/formatting-json.html
index ad9a435..0c8731e 100644
--- a/LayoutTests/inspector/formatting/formatting-json.html
+++ b/LayoutTests/inspector/formatting/formatting-json.html
@@ -36,7 +36,7 @@
 
     const isModule = false;
     const indentString = "    ";
-    let workerProxy = WebInspector.FormatterWorkerProxy.singleton();
+    let workerProxy = WI.FormatterWorkerProxy.singleton();
 
     suite.addTestCase({
         name: "EsprimaFormatter.ValidJSON",
diff --git a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities-expected.js b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities-expected.js
index 95d3c91..5e6c226 100644
--- a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities-expected.js
+++ b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities-expected.js
@@ -920,8 +920,8 @@
         let ms = seconds * 1000;
 
         if (higherResolution)
-            return WebInspector.UIString("%.2fms").format(ms);
-        return WebInspector.UIString("%.1fms").format(ms);
+            return WI.UIString("%.2fms").format(ms);
+        return WI.UIString("%.1fms").format(ms);
     }
 });
 
@@ -933,36 +933,36 @@
 
         if (Math.abs(ms) < 10) {
             if (higherResolution)
-                return WebInspector.UIString("%.3fms").format(ms);
-            return WebInspector.UIString("%.2fms").format(ms);
+                return WI.UIString("%.3fms").format(ms);
+            return WI.UIString("%.2fms").format(ms);
         }
 
         if (Math.abs(ms) < 100) {
             if (higherResolution)
-                return WebInspector.UIString("%.2fms").format(ms);
-            return WebInspector.UIString("%.1fms").format(ms);
+                return WI.UIString("%.2fms").format(ms);
+            return WI.UIString("%.1fms").format(ms);
         }
 
         if (Math.abs(ms) < 1000) {
             if (higherResolution)
-                return WebInspector.UIString("%.1fms").format(ms);
-            return WebInspector.UIString("%.0fms").format(ms);
+                return WI.UIString("%.1fms").format(ms);
+            return WI.UIString("%.0fms").format(ms);
         }
 
         // Do not go over seconds when in high resolution mode.
         if (higherResolution || Math.abs(seconds) < 60)
-            return WebInspector.UIString("%.2fs").format(seconds);
+            return WI.UIString("%.2fs").format(seconds);
 
         let minutes = seconds / 60;
         if (Math.abs(minutes) < 60)
-            return WebInspector.UIString("%.1fmin").format(minutes);
+            return WI.UIString("%.1fmin").format(minutes);
 
         let hours = minutes / 60;
         if (Math.abs(hours) < 24)
-            return WebInspector.UIString("%.1fhrs").format(hours);
+            return WI.UIString("%.1fhrs").format(hours);
 
         let days = hours / 24;
-        return WebInspector.UIString("%.1f days").format(days);
+        return WI.UIString("%.1f days").format(days);
     }
 });
 
@@ -974,19 +974,19 @@
             higherResolution = true;
 
         if (Math.abs(bytes) < 1024)
-            return WebInspector.UIString("%.0f B").format(bytes);
+            return WI.UIString("%.0f B").format(bytes);
 
         let kilobytes = bytes / 1024;
         if (Math.abs(kilobytes) < 1024) {
             if (higherResolution || Math.abs(kilobytes) < 10)
-                return WebInspector.UIString("%.2f KB").format(kilobytes);
-            return WebInspector.UIString("%.1f KB").format(kilobytes);
+                return WI.UIString("%.2f KB").format(kilobytes);
+            return WI.UIString("%.1f KB").format(kilobytes);
         }
 
         let megabytes = kilobytes / 1024;
         if (higherResolution || Math.abs(megabytes) < 10)
-            return WebInspector.UIString("%.2f MB").format(megabytes);
-        return WebInspector.UIString("%.1f MB").format(megabytes);
+            return WI.UIString("%.2f MB").format(megabytes);
+        return WI.UIString("%.1f MB").format(megabytes);
     }
 });
 
diff --git a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities.js b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities.js
index 65b86d6..b0aa25d 100644
--- a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities.js
+++ b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-normal-utilities.js
@@ -902,8 +902,8 @@
         let ms = seconds * 1000;
 
         if (higherResolution)
-            return WebInspector.UIString("%.2fms").format(ms);
-        return WebInspector.UIString("%.1fms").format(ms);
+            return WI.UIString("%.2fms").format(ms);
+        return WI.UIString("%.1fms").format(ms);
     }
 });
 
@@ -915,36 +915,36 @@
 
         if (Math.abs(ms) < 10) {
             if (higherResolution)
-                return WebInspector.UIString("%.3fms").format(ms);
-            return WebInspector.UIString("%.2fms").format(ms);
+                return WI.UIString("%.3fms").format(ms);
+            return WI.UIString("%.2fms").format(ms);
         }
 
         if (Math.abs(ms) < 100) {
             if (higherResolution)
-                return WebInspector.UIString("%.2fms").format(ms);
-            return WebInspector.UIString("%.1fms").format(ms);
+                return WI.UIString("%.2fms").format(ms);
+            return WI.UIString("%.1fms").format(ms);
         }
 
         if (Math.abs(ms) < 1000) {
             if (higherResolution)
-                return WebInspector.UIString("%.1fms").format(ms);
-            return WebInspector.UIString("%.0fms").format(ms);
+                return WI.UIString("%.1fms").format(ms);
+            return WI.UIString("%.0fms").format(ms);
         }
 
         // Do not go over seconds when in high resolution mode.
         if (higherResolution || Math.abs(seconds) < 60)
-            return WebInspector.UIString("%.2fs").format(seconds);
+            return WI.UIString("%.2fs").format(seconds);
 
         let minutes = seconds / 60;
         if (Math.abs(minutes) < 60)
-            return WebInspector.UIString("%.1fmin").format(minutes);
+            return WI.UIString("%.1fmin").format(minutes);
 
         let hours = minutes / 60;
         if (Math.abs(hours) < 24)
-            return WebInspector.UIString("%.1fhrs").format(hours);
+            return WI.UIString("%.1fhrs").format(hours);
 
         let days = hours / 24;
-        return WebInspector.UIString("%.1f days").format(days);
+        return WI.UIString("%.1f days").format(days);
     }
 });
 
@@ -956,19 +956,19 @@
             higherResolution = true;
 
         if (Math.abs(bytes) < 1024)
-            return WebInspector.UIString("%.0f B").format(bytes);
+            return WI.UIString("%.0f B").format(bytes);
 
         let kilobytes = bytes / 1024;
         if (Math.abs(kilobytes) < 1024) {
             if (higherResolution || Math.abs(kilobytes) < 10)
-                return WebInspector.UIString("%.2f KB").format(kilobytes);
-            return WebInspector.UIString("%.1f KB").format(kilobytes);
+                return WI.UIString("%.2f KB").format(kilobytes);
+            return WI.UIString("%.1f KB").format(kilobytes);
         }
 
         let megabytes = kilobytes / 1024;
         if (higherResolution || Math.abs(megabytes) < 10)
-            return WebInspector.UIString("%.2f MB").format(megabytes);
-        return WebInspector.UIString("%.1f MB").format(megabytes);
+            return WI.UIString("%.2f MB").format(megabytes);
+        return WI.UIString("%.1f MB").format(megabytes);
     }
 });
 
diff --git a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object-expected.js b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object-expected.js
index 4508e14..73b6015 100644
--- a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object-expected.js
+++ b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object-expected.js
@@ -1,4 +1,4 @@
-WebInspector.Object = class WebInspectorObject
+WI.Object = class WebInspectorObject
 {
     constructor()
     {
@@ -75,27 +75,27 @@
     }
     addEventListener()
     {
-        return WebInspector.Object.addEventListener.apply(this, arguments);
+        return WI.Object.addEventListener.apply(this, arguments);
     }
     singleFireEventListener()
     {
-        return WebInspector.Object.singleFireEventListener.apply(this, arguments);
+        return WI.Object.singleFireEventListener.apply(this, arguments);
     }
     removeEventListener()
     {
-        return WebInspector.Object.removeEventListener.apply(this, arguments);
+        return WI.Object.removeEventListener.apply(this, arguments);
     }
     hasEventListeners()
     {
-        return WebInspector.Object.hasEventListeners.apply(this, arguments);
+        return WI.Object.hasEventListeners.apply(this, arguments);
     }
     retainedObjectsWithPrototype()
     {
-        return WebInspector.Object.retainedObjectsWithPrototype.apply(this, arguments);
+        return WI.Object.retainedObjectsWithPrototype.apply(this, arguments);
     }
     dispatchEventToListeners(eventType, eventData)
     {
-        let event = new WebInspector.Event(this, eventType, eventData);
+        let event = new WI.Event(this, eventType, eventData);
         function dispatch(object)
         {
             if (!object || event._stoppedPropagation)
@@ -127,7 +127,7 @@
     }
 }
 ;
-WebInspector.Event = class Event
+WI.Event = class Event
 {
     constructor(target, type, data)
     {
@@ -147,8 +147,8 @@
     }
 }
 ;
-WebInspector.notifications = new WebInspector.Object;
-WebInspector.Notification = {
+WI.notifications = new WI.Object;
+WI.Notification = {
     GlobalModifierKeysDidChange: "global-modifiers-did-change",
     PageArchiveStarted: "page-archive-started",
     PageArchiveEnded: "page-archive-ended",
diff --git a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object.js b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object.js
index a33398a..dc4df49 100644
--- a/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object.js
+++ b/LayoutTests/inspector/formatting/resources/javascript-tests/sample-webinspector-object.js
@@ -1,4 +1,4 @@
-WebInspector.Object=class WebInspectorObject
+WI.Object=class WebInspectorObject
 {constructor()
 {this._listeners=null;} 
 static addEventListener(eventType,listener,thisObject)
@@ -22,13 +22,13 @@
 {let results=new Set;if(this._listeners){this._listeners.forEach(function(listenersTable,eventType){listenersTable.forEach(function(pair){let thisObject=pair[0];if(thisObject instanceof proto)
 results.add(thisObject);});});}
 return results;} 
-addEventListener(){return WebInspector.Object.addEventListener.apply(this,arguments);}
-singleFireEventListener(){return WebInspector.Object.singleFireEventListener.apply(this,arguments);}
-removeEventListener(){return WebInspector.Object.removeEventListener.apply(this,arguments);}
-hasEventListeners(){return WebInspector.Object.hasEventListeners.apply(this,arguments);}
-retainedObjectsWithPrototype(){return WebInspector.Object.retainedObjectsWithPrototype.apply(this,arguments);}
+addEventListener(){return WI.Object.addEventListener.apply(this,arguments);}
+singleFireEventListener(){return WI.Object.singleFireEventListener.apply(this,arguments);}
+removeEventListener(){return WI.Object.removeEventListener.apply(this,arguments);}
+hasEventListeners(){return WI.Object.hasEventListeners.apply(this,arguments);}
+retainedObjectsWithPrototype(){return WI.Object.retainedObjectsWithPrototype.apply(this,arguments);}
 dispatchEventToListeners(eventType,eventData)
-{let event=new WebInspector.Event(this,eventType,eventData);function dispatch(object)
+{let event=new WI.Event(this,eventType,eventData);function dispatch(object)
 {if(!object||event._stoppedPropagation)
 return;let listenerTypesMap=object._listeners;if(!listenerTypesMap||!object.hasOwnProperty("_listeners"))
 return;let listenersTable=listenerTypesMap.get(eventType);if(!listenersTable)
@@ -36,10 +36,10 @@
 break;}}
 dispatch(this);event._stoppedPropagation=false;let constructor=this.constructor;while(constructor){dispatch(constructor);if(!constructor.prototype.__proto__)
 break;constructor=constructor.prototype.__proto__.constructor;}
-return event.defaultPrevented;}};WebInspector.Event=class Event
+return event.defaultPrevented;}};WI.Event=class Event
 {constructor(target,type,data)
 {this.target=target;this.type=type;this.data=data;this.defaultPrevented=false;this._stoppedPropagation=false;}
 stopPropagation()
 {this._stoppedPropagation=true;}
 preventDefault()
-{this.defaultPrevented=true;}};WebInspector.notifications=new WebInspector.Object;WebInspector.Notification={GlobalModifierKeysDidChange:"global-modifiers-did-change",PageArchiveStarted:"page-archive-started",PageArchiveEnded:"page-archive-ended",ExtraDomainsActivated:"extra-domains-activated",TabTypesChanged:"tab-types-changed",DebugUIEnabledDidChange:"debug-ui-enabled-did-change",};
+{this.defaultPrevented=true;}};WI.notifications=new WI.Object;WI.Notification={GlobalModifierKeysDidChange:"global-modifiers-did-change",PageArchiveStarted:"page-archive-started",PageArchiveEnded:"page-archive-ended",ExtraDomainsActivated:"extra-domains-activated",TabTypesChanged:"tab-types-changed",DebugUIEnabledDidChange:"debug-ui-enabled-did-change",};
diff --git a/LayoutTests/inspector/formatting/resources/utilities.js b/LayoutTests/inspector/formatting/resources/utilities.js
index 9e03666..fdd7d93 100644
--- a/LayoutTests/inspector/formatting/resources/utilities.js
+++ b/LayoutTests/inspector/formatting/resources/utilities.js
@@ -2,8 +2,8 @@
     function loadFormattingTestAndExpectedResults(testURL) {
         let expectedURL = testURL.replace(/\.([^\.]+)$/, "-expected.$1");
         return Promise.all([
-            NetworkAgent.loadResource(WebInspector.frameResourceManager.mainFrame.id, testURL),
-            NetworkAgent.loadResource(WebInspector.frameResourceManager.mainFrame.id, expectedURL)
+            NetworkAgent.loadResource(WI.frameResourceManager.mainFrame.id, testURL),
+            NetworkAgent.loadResource(WI.frameResourceManager.mainFrame.id, expectedURL)
         ]).then(function(results) {
             return Promise.resolve({testText: results[0].content, expectedText: results[1].content });
         });
@@ -14,7 +14,7 @@
             let {testText, expectedText} = results;
             return new Promise(function(resolve, reject) {
                 const indentString = "    ";
-                let workerProxy = WebInspector.FormatterWorkerProxy.singleton();
+                let workerProxy = WI.FormatterWorkerProxy.singleton();
                 let isModule = /^module/.test(testName);
                 workerProxy.formatJavaScript(testText, isModule, indentString, ({formattedText, sourceMapData}) => {
                     let pass = formattedText === expectedText;
@@ -42,7 +42,7 @@
     }
 
     window.addFormattingTests = function(suite, mode, tests) {
-        let testPageURL = WebInspector.frameResourceManager.mainFrame.mainResource.url;
+        let testPageURL = WI.frameResourceManager.mainFrame.mainResource.url;
         let testPageResourcesURL = testPageURL.substring(0, testPageURL.lastIndexOf("/"));            
 
         for (let test of tests) {
diff --git a/LayoutTests/inspector/heap/garbageCollected.html b/LayoutTests/inspector/heap/garbageCollected.html
index d0de959..9d550d2 100644
--- a/LayoutTests/inspector/heap/garbageCollected.html
+++ b/LayoutTests/inspector/heap/garbageCollected.html
@@ -41,13 +41,13 @@
 
             let seenFull = false;
             let seenPartial = false;
-            WebInspector.heapManager.addEventListener(WebInspector.HeapManager.Event.GarbageCollected, (event) => {
+            WI.heapManager.addEventListener(WI.HeapManager.Event.GarbageCollected, (event) => {
                 if (seenFull && seenPartial)
                     return;
 
-                if (event.data.collection.type === WebInspector.GarbageCollection.Type.Full)
+                if (event.data.collection.type === WI.GarbageCollection.Type.Full)
                     seenFull = true;
-                else if (event.data.collection.type === WebInspector.GarbageCollection.Type.Partial)
+                else if (event.data.collection.type === WI.GarbageCollection.Type.Partial)
                     seenPartial = true;
 
                 if (seenFull && seenPartial) {
diff --git a/LayoutTests/inspector/heap/gc.html b/LayoutTests/inspector/heap/gc.html
index ea58b59..4bf3d64 100644
--- a/LayoutTests/inspector/heap/gc.html
+++ b/LayoutTests/inspector/heap/gc.html
@@ -13,12 +13,12 @@
         test(resolve, reject) {
             HeapAgent.gc();
             let resolving = false;
-            WebInspector.heapManager.addEventListener(WebInspector.HeapManager.Event.GarbageCollected, (event) => {
+            WI.heapManager.addEventListener(WI.HeapManager.Event.GarbageCollected, (event) => {
                 // Due to the asynchronous nature of Heap.garbageCollected events, we may see
                 // non-Full GC events before we see the Full collection triggered by HeapAgent.gc.
-                if (!resolving && event.data.collection.type === WebInspector.GarbageCollection.Type.Full) {
-                    InspectorTest.expectThat(event.data.collection instanceof WebInspector.GarbageCollection, "Event should have GarbageCollection data.");
-                    InspectorTest.expectThat(event.data.collection.type === WebInspector.GarbageCollection.Type.Full, "GarbageCollection type should be Full.");
+                if (!resolving && event.data.collection.type === WI.GarbageCollection.Type.Full) {
+                    InspectorTest.expectThat(event.data.collection instanceof WI.GarbageCollection, "Event should have GarbageCollection data.");
+                    InspectorTest.expectThat(event.data.collection.type === WI.GarbageCollection.Type.Full, "GarbageCollection type should be Full.");
                     resolving = true;
                     resolve();
                 }
diff --git a/LayoutTests/inspector/heap/getPreview.html b/LayoutTests/inspector/heap/getPreview.html
index 4257f4b..99fdde2 100644
--- a/LayoutTests/inspector/heap/getPreview.html
+++ b/LayoutTests/inspector/heap/getPreview.html
@@ -52,9 +52,9 @@
                 InspectorTest.evaluateInPage("triggerCreateStringObject()");
                 HeapAgent.snapshot((error, timestamp, snapshotStringData) => { // Newly created objects.
                     InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                    let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                    let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                     workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                        let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                        let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                         snapshot.instancesWithClassName("string", (strings) => {
                             let heapSnapshotNode = strings.reduce((result, x) => result.id < x.id ? x : result, strings[0]);
                             HeapAgent.getPreview(heapSnapshotNode.id, (error, string, functionDetails, objectPreviewPayload) => {
@@ -77,9 +77,9 @@
                 InspectorTest.evaluateInPage("triggerCreateFunctionObject()");
                 HeapAgent.snapshot((error, timestamp, snapshotStringData) => { // Newly created objects.
                     InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                    let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                    let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                     workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                        let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                        let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                         snapshot.instancesWithClassName("Function", (functions) => {
                             let heapSnapshotNode = functions.reduce((result, x) => result.id < x.id ? x : result, functions[0]);
                             HeapAgent.getPreview(heapSnapshotNode.id, (error, string, functionDetails, objectPreviewPayload) => {
@@ -102,9 +102,9 @@
                 InspectorTest.evaluateInPage("triggerCreateMapObject()");
                 HeapAgent.snapshot((error, timestamp, snapshotStringData) => { // Newly created objects.
                     InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                    let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                    let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                     workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                        let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                        let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                         snapshot.instancesWithClassName("Map", (maps) => {
                             let heapSnapshotNode = maps.reduce((result, x) => result.id < x.id ? x : result, maps[0]);
                             HeapAgent.getPreview(heapSnapshotNode.id, (error, string, functionDetails, objectPreviewPayload) => {
@@ -142,9 +142,9 @@
                 InspectorTest.evaluateInPage("triggerCreateMapObject()");
                 HeapAgent.snapshot((error, timestamp, snapshotStringData) => { // Newly created objects.
                     InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                    let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                    let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                     workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                        let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                        let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
 
                         InspectorTest.evaluateInPage("triggerDeleteMapObject()");
                         HeapAgent.gc();
diff --git a/LayoutTests/inspector/heap/getRemoteObject.html b/LayoutTests/inspector/heap/getRemoteObject.html
index bc9c035..c7338e7 100644
--- a/LayoutTests/inspector/heap/getRemoteObject.html
+++ b/LayoutTests/inspector/heap/getRemoteObject.html
@@ -33,16 +33,16 @@
         test(resolve, reject) {
             HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
                 InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                    let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                    let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                     snapshot.instancesWithClassName("Window", (windows) => {
                         let heapSnapshotNode = windows[0];
                         InspectorTest.expectThat(heapSnapshotNode, "Should should include at least one 'Window' instance.");
 
                         HeapAgent.getRemoteObject(heapSnapshotNode.id, "test", (error, remoteObjectPayload) => {
                             InspectorTest.expectThat(!error, "Should not have an error getting remote object.");
-                            let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                            let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                             InspectorTest.log(remoteObject.description);
                             resolve();
                         });
@@ -75,9 +75,9 @@
                 InspectorTest.evaluateInPage("triggerCreateMapObject()");
                 HeapAgent.snapshot((error, timestamp, snapshotStringData) => { // Newly created objects.
                     InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                    let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                    let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                     workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                        let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                        let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                         snapshot.instancesWithClassName("Map", (maps) => {
                             InspectorTest.expectThat(maps.length, "Should should include at least one 'Map' instance.");
 
diff --git a/LayoutTests/inspector/heap/snapshot.html b/LayoutTests/inspector/heap/snapshot.html
index 96072ae..80a82c3 100644
--- a/LayoutTests/inspector/heap/snapshot.html
+++ b/LayoutTests/inspector/heap/snapshot.html
@@ -13,9 +13,9 @@
         test(resolve, reject) {
             HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
                 InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                    let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                    let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                     InspectorTest.expectThat(snapshot.totalSize > 1024, "Snapshot size should be greater than 1kb.");
                     InspectorTest.expectThat(snapshot.totalObjectCount > 100, "Snapshot object count should be greater than 100.");
                     InspectorTest.expectThat(snapshot.categories.get("Window"), "Snapshot should include a class category for 'Window'.");
diff --git a/LayoutTests/inspector/indexeddb/clearObjectStore.html b/LayoutTests/inspector/indexeddb/clearObjectStore.html
index 14a7e33..90f8f28 100644
--- a/LayoutTests/inspector/indexeddb/clearObjectStore.html
+++ b/LayoutTests/inspector/indexeddb/clearObjectStore.html
@@ -14,7 +14,7 @@
         test(resolve, reject) {
             // FIXME: Remove any existing IndexedDB databases that might exist to workaround:
             // <https://webkit.org/b/148006> Each test should run with its own clean data store
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
             });
         }
@@ -25,11 +25,11 @@
         description: "Ensure that clearing an object store clears entries in that object store.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createDatabaseWithStores('CompleteDatabase', 1)");
-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "CompleteDatabase", (error, database) => {
+            IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "CompleteDatabase", (error, database) => {
                 InspectorTest.expectNoError(error);
 
                 function expectObjectStoreEntryCount(objectStore, expectedCount, message) {
-                    const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                    const securityOrigin = WI.frameResourceManager.mainFrame.securityOrigin;
                     const indexName = "";
                     const skipCount = 0;
                     const pageSize = 10;
@@ -39,7 +39,7 @@
                     });
                 }
 
-                let securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                let securityOrigin = WI.frameResourceManager.mainFrame.securityOrigin;
                 let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
 
                 expectObjectStoreEntryCount(emptyObjectStore, 0, "'Empty' object store should always be empty.");
@@ -72,8 +72,8 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "EmptyDatabase", (error, database) => {
-                    IndexedDBAgent.clearObjectStore(WebInspector.frameResourceManager.mainFrame.securityOrigin, database.name, "NoSuchObjectStore", (error) => {
+                IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "EmptyDatabase", (error, database) => {
+                    IndexedDBAgent.clearObjectStore(WI.frameResourceManager.mainFrame.securityOrigin, database.name, "NoSuchObjectStore", (error) => {
                         InspectorTest.expectThat(error, "Should be an error attempting to clear an object store that does not exist.");
                         resolve();
                     });
diff --git a/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html b/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html
index f832c5f..5b1fe64 100644
--- a/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html
+++ b/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html
@@ -14,7 +14,7 @@
         test(resolve, reject) {
             // FIXME: Remove any existing IndexedDB databases that might exist to workaround:
             // <https://webkit.org/b/148006> Each test should run with its own clean data store
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
             });
         }
@@ -24,7 +24,7 @@
         name: "EnsureNoDatabases",
         description: "Ensure no databases exist at the start.",
         test(resolve, reject) {
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.expectNoError(error);
                 InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially.");
                 resolve();
@@ -38,7 +38,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+                IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                     InspectorTest.expectNoError(error);
                     InspectorTest.expectThat(names.length === 1, "A single IndexedDB database should exist.");
                     InspectorTest.log(JSON.stringify(names));
@@ -55,7 +55,7 @@
         description: "Delete the database.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("deleteDatabaseNames(['Database With Space'])");
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.expectNoError(error);
                 InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist because we just deleted them.");
                 InspectorTest.log(JSON.stringify(names));
diff --git a/LayoutTests/inspector/indexeddb/requestData.html b/LayoutTests/inspector/indexeddb/requestData.html
index 6eefa6e..05e2b7c 100644
--- a/LayoutTests/inspector/indexeddb/requestData.html
+++ b/LayoutTests/inspector/indexeddb/requestData.html
@@ -22,7 +22,7 @@
         test(resolve, reject) {
             // FIXME: Remove any existing IndexedDB databases that might exist to workaround:
             // <https://webkit.org/b/148006> Each test should run with its own clean data store
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
             });
         }
@@ -33,11 +33,11 @@
         description: "Request data for an object store with different indexes.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createDatabaseWithStores('Database1', 1)");
-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "Database1", (error, database) => {
+            IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "Database1", (error, database) => {
                 InspectorTest.expectNoError(error);
 
                 let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
-                const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                const securityOrigin = WI.frameResourceManager.mainFrame.securityOrigin;
                 const skipCount = 0;
                 const pageSize = 10;
 
@@ -52,8 +52,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Thirsty Hamster", "Jamming Peacock", "Bustling Badger", "Monstrous Beaver"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -71,9 +71,9 @@
                     let expectedNamesOrderedByName = expectedKeysOrderedByName;
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let key = WebInspector.RemoteObject.fromPayload(entryPayload.key);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let key = WI.RemoteObject.fromPayload(entryPayload.key);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by name: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(key.value === expectedKeysOrderedByName[i], `Key should be ordered by name: '${expectedKeysOrderedByName[i]}'`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByName[i], `Value should be a remote object for: '${expectedNamesOrderedByName[i]}'`);
@@ -92,9 +92,9 @@
                     let expectedNamesOrderedByEmail = ["Bustling Badger", "Monstrous Beaver", "Thirsty Hamster", "Jamming Peacock"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let key = WebInspector.RemoteObject.fromPayload(entryPayload.key);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let key = WI.RemoteObject.fromPayload(entryPayload.key);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by email: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(key.value === expectedKeysOrderedByEmail[i], `Key should be ordered by email: '${expectedKeysOrderedByEmail[i]}'`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByEmail[i], `Value should be a remote object for: '${expectedNamesOrderedByEmail[i]}'`);
@@ -111,11 +111,11 @@
         description: "Request data for an object store with paginated requests.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createDatabaseWithStores('Database2', 1)");
-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "Database2", (error, database) => {
+            IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "Database2", (error, database) => {
                 InspectorTest.expectNoError(error);
 
                 let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
-                const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                const securityOrigin = WI.frameResourceManager.mainFrame.securityOrigin;
                 const indexName = "";
                 const pageSize = 2;
 
@@ -130,8 +130,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Thirsty Hamster", "Jamming Peacock"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -148,8 +148,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Bustling Badger", "Monstrous Beaver"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -165,11 +165,11 @@
         description: "Request key range bounded data for an object store.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createDatabaseWithStores('Database3', 1)");
-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "Database3", (error, database) => {
+            IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "Database3", (error, database) => {
                 InspectorTest.expectNoError(error);
 
                 let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
-                const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                const securityOrigin = WI.frameResourceManager.mainFrame.securityOrigin;
                 const indexName = "Name Index";
                 const skipCount = 0;
                 const pageSize = 10;
@@ -196,8 +196,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Monstrous Beaver", "Thirsty Hamster"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -217,8 +217,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Monstrous Beaver", "Thirsty Hamster"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -238,8 +238,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Thirsty Hamster"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -259,8 +259,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Bustling Badger", "Jamming Peacock"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -280,8 +280,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Bustling Badger", "Jamming Peacock", "Monstrous Beaver"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -301,8 +301,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Bustling Badger", "Jamming Peacock"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
@@ -322,8 +322,8 @@
                     let expectedNamesOrderedByPrimaryKey = ["Monstrous Beaver"];
                     for (let i = 0; i < entries.length; ++i) {
                         let entryPayload = entries[i];
-                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        let primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WI.RemoteObject.fromPayload(entryPayload.value);
                         InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
                         InspectorTest.expectThat(objectPropertyPreview(value, "name").value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
                     }
diff --git a/LayoutTests/inspector/indexeddb/requestDatabase.html b/LayoutTests/inspector/indexeddb/requestDatabase.html
index e2892fd..cf68c99 100644
--- a/LayoutTests/inspector/indexeddb/requestDatabase.html
+++ b/LayoutTests/inspector/indexeddb/requestDatabase.html
@@ -14,7 +14,7 @@
         test(resolve, reject) {
             // FIXME: Remove any existing IndexedDB databases that might exist to workaround:
             // <https://webkit.org/b/148006> Each test should run with its own clean data store
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
             });
         }
@@ -25,7 +25,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "EmptyDatabase", (error, databaseWithObjectStores) => {
+                IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "EmptyDatabase", (error, databaseWithObjectStores) => {
                     InspectorTest.expectNoError(error);
                     InspectorTest.expectThat(databaseWithObjectStores.name === "EmptyDatabase", "Database name should be 'EmptyDatabase'.");
                     InspectorTest.expectThat(databaseWithObjectStores.version === 123, "Database version should be 123.");
@@ -43,7 +43,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "CompleteDatabase", (error, databaseWithObjectStores) => {
+                IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "CompleteDatabase", (error, databaseWithObjectStores) => {
                     InspectorTest.expectNoError(error);
                     let objectStores = databaseWithObjectStores.objectStores;
                     InspectorTest.expectThat(databaseWithObjectStores.name === "CompleteDatabase", "Database name should be 'EmptyDatabase'.");
@@ -83,7 +83,7 @@
     //     name: "NoSuchDatabase",
     //     description: "Request a database that does not exist.",
     //     test(resolve, reject) {
-    //         IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "NameDoesNotExist", (error, databaseWithObjectStores) => {
+    //         IndexedDBAgent.requestDatabase(WI.frameResourceManager.mainFrame.securityOrigin, "NameDoesNotExist", (error, databaseWithObjectStores) => {
     //             InspectorTest.expectThat(error, "Should be an error trying to request a database that does not exist.");
     //             InspectorTest.log(JSON.stringify(databaseWithObjectStores));
     //             resolve();
diff --git a/LayoutTests/inspector/indexeddb/requestDatabaseNames.html b/LayoutTests/inspector/indexeddb/requestDatabaseNames.html
index 2bcf871..82e82e2 100644
--- a/LayoutTests/inspector/indexeddb/requestDatabaseNames.html
+++ b/LayoutTests/inspector/indexeddb/requestDatabaseNames.html
@@ -14,7 +14,7 @@
         test(resolve, reject) {
             // FIXME: Remove any existing IndexedDB databases that might exist to workaround:
             // <https://webkit.org/b/148006> Each test should run with its own clean data store
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
             });
         }
@@ -24,7 +24,7 @@
         name: "EnsureNoDatabases",
         description: "Ensure no databases exist at the start.",
         test(resolve, reject) {
-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+            IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                 InspectorTest.expectNoError(error);
                 InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially.");
                 resolve();
@@ -38,7 +38,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+                IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                     InspectorTest.expectNoError(error);
                     InspectorTest.expectThat(names.length === 1, "A single IndexedDB database should exist.");
                     InspectorTest.log(JSON.stringify(names));
@@ -56,7 +56,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+                IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                     InspectorTest.expectNoError(error);
                     names.sort();
                     InspectorTest.expectThat(names.length === 2, "Two IndexedDB databases should exist.");
@@ -75,7 +75,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+                IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                     InspectorTest.expectNoError(error);
                     names.sort();
                     InspectorTest.expectThat(names.length === 3, "Three IndexedDB databases should exist.");
@@ -94,7 +94,7 @@
         test(resolve, reject) {
             InspectorTest.awaitEvent("DatabaseCreated")
             .then((event) => {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+                IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
                     InspectorTest.expectNoError(error);
                     names.sort();
                     InspectorTest.expectThat(names.length === 4, "Four IndexedDB databases should exist.");
diff --git a/LayoutTests/inspector/injected-script/observable.html b/LayoutTests/inspector/injected-script/observable.html
index 463fe16..3fbc802 100644
--- a/LayoutTests/inspector/injected-script/observable.html
+++ b/LayoutTests/inspector/injected-script/observable.html
@@ -45,11 +45,11 @@
                 resolve();
             });
 
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 InspectorTest.pass("Paused.");
-                WebInspector.debuggerManager.resume().catch(reject);
+                WI.debuggerManager.resume().catch(reject);
             });
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, (event) => {
                 InspectorTest.pass("Resumed.");
             });
         }
diff --git a/LayoutTests/inspector/model/color-expected.txt b/LayoutTests/inspector/model/color-expected.txt
index fc2f2c4..e761e3d 100644
--- a/LayoutTests/inspector/model/color-expected.txt
+++ b/LayoutTests/inspector/model/color-expected.txt
@@ -1,8 +1,8 @@
-Tests for the WebInspector.Color model object.
+Tests for the WI.Color model object.
 
 
-== Running test suite: WebInspector.Color
--- Running test case: WebInspector.Color.fromString
+== Running test suite: WI.Color
+-- Running test case: WI.Color.fromString
 PASS: '#000' should be detected
 PASS: '#000' was the expected 'Short HEX' format
 PASS: '#a0A' should be detected
@@ -77,7 +77,7 @@
 PASS: 'hsla(0, 0%, 50%, 1, 2)' should not be detected
 PASS: 'superblue' should not be detected
 
--- Running test case: WebInspector.Color properties
+-- Running test case: WI.Color properties
 PASS: 'red' should have alpha of 1.
 PASS: 'red' should be simple.
 PASS: 'red' should be a keyword.
@@ -103,13 +103,13 @@
 PASS: '#11223344' should be serializable as a short Hex
 PASS: '#11223345' should not be serializable as a short Hex
 
--- Running test case: WebInspector.Color.prototype.nextFormat
+-- Running test case: WI.Color.prototype.nextFormat
 PASS: All format phases of 'transparent' should be as expected.
 PASS: All format phases of 'red' should be as expected.
 PASS: All format phases of 'rgb(100, 150, 200)' should be as expected.
 PASS: All format phases of 'rgba(100, 150, 200, 0.5)' should be as expected.
 
--- Running test case: WebInspector.Color.prototype.toString
+-- Running test case: WI.Color.prototype.toString
 PASS: Color as 'Original' should be 'RED'
 PASS: Color as 'Keyword' should be 'red'
 PASS: Color as 'Short HEX' should be '#f00'
diff --git a/LayoutTests/inspector/model/color.html b/LayoutTests/inspector/model/color.html
index 902787a..e6bbff7 100644
--- a/LayoutTests/inspector/model/color.html
+++ b/LayoutTests/inspector/model/color.html
@@ -7,85 +7,85 @@
 {
     function formatToString(format) {
         switch (format) {
-        case WebInspector.Color.Format.Original:
+        case WI.Color.Format.Original:
             return "Original";
-        case WebInspector.Color.Format.Keyword:
+        case WI.Color.Format.Keyword:
             return "Keyword";
-        case WebInspector.Color.Format.HEX:
+        case WI.Color.Format.HEX:
             return "HEX";
-        case WebInspector.Color.Format.ShortHEX:
+        case WI.Color.Format.ShortHEX:
             return "Short HEX";
-        case WebInspector.Color.Format.HEXAlpha:
+        case WI.Color.Format.HEXAlpha:
             return "HEX with Alpha";
-        case WebInspector.Color.Format.ShortHEXAlpha:
+        case WI.Color.Format.ShortHEXAlpha:
             return "Short HEX with Alpha";
-        case WebInspector.Color.Format.RGB:
+        case WI.Color.Format.RGB:
             return "RGB";
-        case WebInspector.Color.Format.RGBA:
+        case WI.Color.Format.RGBA:
             return "RGBA";
-        case WebInspector.Color.Format.HSL:
+        case WI.Color.Format.HSL:
             return "HSL";
-        case WebInspector.Color.Format.HSLA:
+        case WI.Color.Format.HSLA:
             return "HSLA";
         default:
             return "Unexpected format";
         }
     }
 
-    let suite = InspectorTest.createAsyncSuite("WebInspector.Color");
+    let suite = InspectorTest.createAsyncSuite("WI.Color");
 
     suite.addTestCase({
-        name: "WebInspector.Color.fromString",
+        name: "WI.Color.fromString",
         description: "Test we can detect colors from strings.",
         test(resolve, reject) {
             function testGood(string, expectedFormat) {
-                let color = WebInspector.Color.fromString(string);
-                InspectorTest.expectThat(color instanceof WebInspector.Color, `'${string}' should be detected`);
+                let color = WI.Color.fromString(string);
+                InspectorTest.expectThat(color instanceof WI.Color, `'${string}' should be detected`);
                 InspectorTest.expectThat(color && color.format === expectedFormat, `'${string}' was the expected '${formatToString(expectedFormat)}' format`);
             }
 
             function testBad(string) {
-                let color = WebInspector.Color.fromString(string);
+                let color = WI.Color.fromString(string);
                 InspectorTest.expectThat(color === null, `'${string}' should not be detected`);
                 if (color) InspectorTest.log(`'${string}' detected with format '${formatToString(color.format)}'`);
             }
 
-            testGood("#000", WebInspector.Color.Format.ShortHEX);
-            testGood("#a0A", WebInspector.Color.Format.ShortHEX);
-            testGood("#000000", WebInspector.Color.Format.HEX);
-            testGood("#a0Aa0A", WebInspector.Color.Format.HEX);
+            testGood("#000", WI.Color.Format.ShortHEX);
+            testGood("#a0A", WI.Color.Format.ShortHEX);
+            testGood("#000000", WI.Color.Format.HEX);
+            testGood("#a0Aa0A", WI.Color.Format.HEX);
 
-            testGood("#0000", WebInspector.Color.Format.ShortHEXAlpha);
-            testGood("#a0Af", WebInspector.Color.Format.ShortHEXAlpha);
-            testGood("#00000000", WebInspector.Color.Format.HEXAlpha);
-            testGood("#a0Aa0Aff", WebInspector.Color.Format.HEXAlpha);
+            testGood("#0000", WI.Color.Format.ShortHEXAlpha);
+            testGood("#a0Af", WI.Color.Format.ShortHEXAlpha);
+            testGood("#00000000", WI.Color.Format.HEXAlpha);
+            testGood("#a0Aa0Aff", WI.Color.Format.HEXAlpha);
 
-            testGood("rgb(1,2,3)", WebInspector.Color.Format.RGB);
-            testGood("RGB(1,2,3)", WebInspector.Color.Format.RGB);
-            testGood("rgb(999, 999, 999)", WebInspector.Color.Format.RGB);
-            testGood("rgb( 1 , 1 , 1 )", WebInspector.Color.Format.RGB);
+            testGood("rgb(1,2,3)", WI.Color.Format.RGB);
+            testGood("RGB(1,2,3)", WI.Color.Format.RGB);
+            testGood("rgb(999, 999, 999)", WI.Color.Format.RGB);
+            testGood("rgb( 1 , 1 , 1 )", WI.Color.Format.RGB);
 
-            testGood("rgba(1,2,3,0)", WebInspector.Color.Format.RGBA);
-            testGood("RGBA(1,2,3,0)", WebInspector.Color.Format.RGBA);
-            testGood("rgba(999, 999, 999, 999)", WebInspector.Color.Format.RGBA);
-            testGood("rgba( 1 , 1 , 1 , 0.5 )", WebInspector.Color.Format.RGBA);
+            testGood("rgba(1,2,3,0)", WI.Color.Format.RGBA);
+            testGood("RGBA(1,2,3,0)", WI.Color.Format.RGBA);
+            testGood("rgba(999, 999, 999, 999)", WI.Color.Format.RGBA);
+            testGood("rgba( 1 , 1 , 1 , 0.5 )", WI.Color.Format.RGBA);
 
-            testGood("hsl(0, 0%, 50%)", WebInspector.Color.Format.HSL);
-            testGood("HSL(0, 0%, 50%)", WebInspector.Color.Format.HSL);
-            testGood("hsl(999, 999%, 999%)", WebInspector.Color.Format.HSL);
-            testGood("hsl( 0 , 0% , 50% )", WebInspector.Color.Format.HSL);
+            testGood("hsl(0, 0%, 50%)", WI.Color.Format.HSL);
+            testGood("HSL(0, 0%, 50%)", WI.Color.Format.HSL);
+            testGood("hsl(999, 999%, 999%)", WI.Color.Format.HSL);
+            testGood("hsl( 0 , 0% , 50% )", WI.Color.Format.HSL);
             
-            testGood("hsla(0, 0%, 50%, 0)", WebInspector.Color.Format.HSLA);
-            testGood("HSLA(0, 0%, 50%, 0)", WebInspector.Color.Format.HSLA);
-            testGood("hsla(999, 999%, 999%, 999)", WebInspector.Color.Format.HSLA);
-            testGood("hsla( 0 , 0% , 50% , 0.5 )", WebInspector.Color.Format.HSLA);
+            testGood("hsla(0, 0%, 50%, 0)", WI.Color.Format.HSLA);
+            testGood("HSLA(0, 0%, 50%, 0)", WI.Color.Format.HSLA);
+            testGood("hsla(999, 999%, 999%, 999)", WI.Color.Format.HSLA);
+            testGood("hsla( 0 , 0% , 50% , 0.5 )", WI.Color.Format.HSLA);
 
-            testGood("blue", WebInspector.Color.Format.Keyword);
-            testGood("BLuE", WebInspector.Color.Format.Keyword);
-            testGood("midnightblue", WebInspector.Color.Format.Keyword);
-            testGood("royalblue", WebInspector.Color.Format.Keyword);
-            testGood("steelblue", WebInspector.Color.Format.Keyword);
-            testGood("transparent", WebInspector.Color.Format.Keyword);
+            testGood("blue", WI.Color.Format.Keyword);
+            testGood("BLuE", WI.Color.Format.Keyword);
+            testGood("midnightblue", WI.Color.Format.Keyword);
+            testGood("royalblue", WI.Color.Format.Keyword);
+            testGood("steelblue", WI.Color.Format.Keyword);
+            testGood("transparent", WI.Color.Format.Keyword);
 
             InspectorTest.log("");
 
@@ -112,7 +112,7 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Color properties",
+        name: "WI.Color properties",
         description: "Test different color properties.",
         test(resolve, reject) {
             function shallowEqual(arr1, arr2) {
@@ -129,7 +129,7 @@
 
             let color;
 
-            color = WebInspector.Color.fromString("red");
+            color = WI.Color.fromString("red");
             InspectorTest.expectThat(color.alpha === 1, "'red' should have alpha of 1.");
             InspectorTest.expectThat(color.simple === true, "'red' should be simple.");
             InspectorTest.expectThat(color.isKeyword() === true, "'red' should be a keyword.");
@@ -139,7 +139,7 @@
             InspectorTest.expectThat(shallowEqual(color.hsla, [0, 100, 50, 1]), "'red' has hsla of [0, 100, 50, 1].");
             InspectorTest.expectThat(color.canBeSerializedAsShortHEX() === true, "'red' should be serializable as a short Hex");
 
-            color = WebInspector.Color.fromString("transparent");
+            color = WI.Color.fromString("transparent");
             InspectorTest.expectThat(color.alpha === 0, "'transparent' should have alpha of 0.");
             InspectorTest.expectThat(color.simple === false, "'transparent' should not be simple.");
             InspectorTest.expectThat(color.isKeyword() === true, "'transparent' should be a keyword.");
@@ -149,7 +149,7 @@
             InspectorTest.expectThat(shallowEqual(color.hsla, [0, 0, 0, 0]), "'transparent' has hsla of [0, 0, 0, 0].");
             InspectorTest.expectThat(color.canBeSerializedAsShortHEX() === true, "'transparent' should be serializable as a short Hex");
 
-            color = WebInspector.Color.fromString("#11122233");
+            color = WI.Color.fromString("#11122233");
             InspectorTest.expectThat(color.alpha !== 0, "'#11122233' should not have alpha of 0.");
             InspectorTest.expectThat(color.simple === false, "'#11122233' should be not be simple.");
             InspectorTest.expectThat(color.isKeyword() === false, "'#11122233' should not be a keyword.");
@@ -157,10 +157,10 @@
             InspectorTest.expectThat(shallowEqual(color.hsla, [236, 33, 10, 0.2]), "'#11122233' has hsla of [236, 33, 10, 0.2].");
             InspectorTest.expectThat(color.canBeSerializedAsShortHEX() === false, "'#11122233' should not be serializable as a short Hex");
 
-            color = WebInspector.Color.fromString("#11223344");
+            color = WI.Color.fromString("#11223344");
             InspectorTest.expectThat(color.canBeSerializedAsShortHEX() === true, "'#11223344' should be serializable as a short Hex");
 
-            color = WebInspector.Color.fromString("#11223345");
+            color = WI.Color.fromString("#11223345");
             InspectorTest.expectThat(color.canBeSerializedAsShortHEX() === false, "'#11223345' should not be serializable as a short Hex");
 
             resolve();
@@ -168,12 +168,12 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Color.prototype.nextFormat",
+        name: "WI.Color.prototype.nextFormat",
         description: "Test we can cycle through color formats for different colors.",
         test(resolve, reject) {
             function test(string, phases) {
-                let color = WebInspector.Color.fromString(string);
-                color.format = WebInspector.Color.Format.Original;
+                let color = WI.Color.fromString(string);
+                color.format = WI.Color.Format.Original;
 
                 let pass = true;
                 for (let expectedNextFormat of phases) {
@@ -188,34 +188,34 @@
 
             // All with alpha.
             test("transparent", [
-                WebInspector.Color.Format.RGBA,
-                WebInspector.Color.Format.HSLA,
-                WebInspector.Color.Format.Keyword,
-                WebInspector.Color.Format.ShortHEXAlpha,
-                WebInspector.Color.Format.HEXAlpha,
+                WI.Color.Format.RGBA,
+                WI.Color.Format.HSLA,
+                WI.Color.Format.Keyword,
+                WI.Color.Format.ShortHEXAlpha,
+                WI.Color.Format.HEXAlpha,
             ]);
 
             // All without alpha.
             test("red", [
-                WebInspector.Color.Format.RGB,
-                WebInspector.Color.Format.HSL,
-                WebInspector.Color.Format.Keyword,
-                WebInspector.Color.Format.ShortHEX,
-                WebInspector.Color.Format.HEX,
+                WI.Color.Format.RGB,
+                WI.Color.Format.HSL,
+                WI.Color.Format.Keyword,
+                WI.Color.Format.ShortHEX,
+                WI.Color.Format.HEX,
             ]);
 
             // No short hex or keyword.
             test("rgb(100, 150, 200)", [
-                WebInspector.Color.Format.RGB,
-                WebInspector.Color.Format.HSL,
-                WebInspector.Color.Format.HEX,
+                WI.Color.Format.RGB,
+                WI.Color.Format.HSL,
+                WI.Color.Format.HEX,
             ]);
 
             // No short hex alpha or keyword.
             test("rgba(100, 150, 200, 0.5)", [
-                WebInspector.Color.Format.RGBA,
-                WebInspector.Color.Format.HSLA,
-                WebInspector.Color.Format.HEXAlpha,
+                WI.Color.Format.RGBA,
+                WI.Color.Format.HSLA,
+                WI.Color.Format.HEXAlpha,
             ]);
 
             resolve();
@@ -223,7 +223,7 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Color.prototype.toString",
+        name: "WI.Color.prototype.toString",
         description: "Test the different toString outputs.",
         test(resolve, reject) {
             let color;
@@ -234,30 +234,30 @@
             }
 
             // A color with all formats.
-            color = WebInspector.Color.fromString("RED");
-            test("RED", WebInspector.Color.Format.Original);
-            test("red", WebInspector.Color.Format.Keyword);
-            test("#f00", WebInspector.Color.Format.ShortHEX);
-            test("#ff0000", WebInspector.Color.Format.HEX);
-            test("#f00f", WebInspector.Color.Format.ShortHEXAlpha);
-            test("#ff0000ff", WebInspector.Color.Format.HEXAlpha);
-            test("rgb(255, 0, 0)", WebInspector.Color.Format.RGB);
-            test("rgba(255, 0, 0, 1)", WebInspector.Color.Format.RGBA);
-            test("hsl(0, 100%, 50%)", WebInspector.Color.Format.HSL);
-            test("hsla(0, 100%, 50%, 1)", WebInspector.Color.Format.HSLA);
+            color = WI.Color.fromString("RED");
+            test("RED", WI.Color.Format.Original);
+            test("red", WI.Color.Format.Keyword);
+            test("#f00", WI.Color.Format.ShortHEX);
+            test("#ff0000", WI.Color.Format.HEX);
+            test("#f00f", WI.Color.Format.ShortHEXAlpha);
+            test("#ff0000ff", WI.Color.Format.HEXAlpha);
+            test("rgb(255, 0, 0)", WI.Color.Format.RGB);
+            test("rgba(255, 0, 0, 1)", WI.Color.Format.RGBA);
+            test("hsl(0, 100%, 50%)", WI.Color.Format.HSL);
+            test("hsla(0, 100%, 50%, 1)", WI.Color.Format.HSLA);
 
             // A color which cannot be some formats, those fallback to something else.
-            color = WebInspector.Color.fromString("rGbA(  100, 200, 255, 0.5  )");
-            test("rgba(100, 200, 255, 0.5)", WebInspector.Color.Format.Original); // Original text ignored for some formats.
-            test("rgba(100, 200, 255, 0.5)", WebInspector.Color.Format.Keyword); // fallback (rgba)
-            test("rgba(100, 200, 255, 0.5)", WebInspector.Color.Format.ShortHEX); // fallback (rgba)
-            test("rgba(100, 200, 255, 0.5)", WebInspector.Color.Format.HEX); // fallback (rgba)
-            test("#64c8ff80", WebInspector.Color.Format.ShortHEXAlpha); // fallback (hex alpha)
-            test("#64c8ff80", WebInspector.Color.Format.HEXAlpha);
-            test("rgba(100, 200, 255, 0.5)", WebInspector.Color.Format.RGB); // fallback (rgba)
-            test("rgba(100, 200, 255, 0.5)", WebInspector.Color.Format.RGBA);
-            test("hsla(201, 100%, 70%, 0.5)", WebInspector.Color.Format.HSL); // fallback (hsla)
-            test("hsla(201, 100%, 70%, 0.5)", WebInspector.Color.Format.HSLA);
+            color = WI.Color.fromString("rGbA(  100, 200, 255, 0.5  )");
+            test("rgba(100, 200, 255, 0.5)", WI.Color.Format.Original); // Original text ignored for some formats.
+            test("rgba(100, 200, 255, 0.5)", WI.Color.Format.Keyword); // fallback (rgba)
+            test("rgba(100, 200, 255, 0.5)", WI.Color.Format.ShortHEX); // fallback (rgba)
+            test("rgba(100, 200, 255, 0.5)", WI.Color.Format.HEX); // fallback (rgba)
+            test("#64c8ff80", WI.Color.Format.ShortHEXAlpha); // fallback (hex alpha)
+            test("#64c8ff80", WI.Color.Format.HEXAlpha);
+            test("rgba(100, 200, 255, 0.5)", WI.Color.Format.RGB); // fallback (rgba)
+            test("rgba(100, 200, 255, 0.5)", WI.Color.Format.RGBA);
+            test("hsla(201, 100%, 70%, 0.5)", WI.Color.Format.HSL); // fallback (hsla)
+            test("hsla(201, 100%, 70%, 0.5)", WI.Color.Format.HSLA);
 
             // FIXME: Should we clamp rgb(300, 300, 300) => rgb(255, 255, 255) in toStrings?
             // FIXME: Should we always stash the original string, no matter how poor?
@@ -271,6 +271,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Tests for the WebInspector.Color model object.</p>
+<p>Tests for the WI.Color model object.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/frame-extra-scripts-expected.txt b/LayoutTests/inspector/model/frame-extra-scripts-expected.txt
index 3d5ce89..a53ffcf 100644
--- a/LayoutTests/inspector/model/frame-extra-scripts-expected.txt
+++ b/LayoutTests/inspector/model/frame-extra-scripts-expected.txt
@@ -1,8 +1,8 @@
 CONSOLE MESSAGE: line 1: dynamically added script element
-WebInspector.Frame.extraScriptCollection.
+WI.Frame.extraScriptCollection.
 
 
-== Running test suite: WebInspector.Frame.extraScriptCollection
+== Running test suite: WI.Frame.extraScriptCollection
 -- Running test case: FrameHasNoExtraScriptsYet
 PASS: Main frame should have no dynamic scripts.
 
diff --git a/LayoutTests/inspector/model/frame-extra-scripts.html b/LayoutTests/inspector/model/frame-extra-scripts.html
index bf46982..4e02484 100644
--- a/LayoutTests/inspector/model/frame-extra-scripts.html
+++ b/LayoutTests/inspector/model/frame-extra-scripts.html
@@ -11,9 +11,9 @@
 
 function test()
 {
-    let suite = InspectorTest.createAsyncSuite("WebInspector.Frame.extraScriptCollection");
+    let suite = InspectorTest.createAsyncSuite("WI.Frame.extraScriptCollection");
 
-    let mainFrame = WebInspector.frameResourceManager.mainFrame;
+    let mainFrame = WI.frameResourceManager.mainFrame;
 
     suite.addTestCase({
         name: "FrameHasNoExtraScriptsYet",
@@ -28,7 +28,7 @@
         name: "AddExtraScript",
         description: "Add extra script.",
         test(resolve, reject) {
-            WebInspector.frameResourceManager.mainFrame.awaitEvent(WebInspector.Frame.Event.ExtraScriptAdded)
+            WI.frameResourceManager.mainFrame.awaitEvent(WI.Frame.Event.ExtraScriptAdded)
             .then((event) => {
                 InspectorTest.pass("ExtraScriptAdded event fired.");
                 InspectorTest.expectThat(event.data.script.dynamicallyAddedScriptElement, "Script should identify as dynamic.");
@@ -45,6 +45,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>WebInspector.Frame.extraScriptCollection.</p>
+<p>WI.Frame.extraScriptCollection.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/gradient-expected.txt b/LayoutTests/inspector/model/gradient-expected.txt
index b5cd495..7040308 100644
--- a/LayoutTests/inspector/model/gradient-expected.txt
+++ b/LayoutTests/inspector/model/gradient-expected.txt
@@ -1,8 +1,8 @@
-Tests for the WebInspector.Gradient model object.
+Tests for the WI.Gradient model object.
 
 
-== Running test suite: WebInspector.Gradient
--- Running test case: WebInspector.Gradient.fromString
+== Running test suite: WI.Gradient
+-- Running test case: WI.Gradient.fromString
 PASS: 'linear-gradient(red, blue)' is valid
 PASS: 'linear-gradient(red, blue)' is the expected subclass 'LinearGradient'
 PASS: 'linear-gradient(0deg, red, blue)' is valid
@@ -37,7 +37,7 @@
 PASS: 'radial-gradient(red, blue' is not valid
 PASS: 'radial-gradient(red, blue,)' is not valid
 
--- Running test case: WebInspector.Gradient.prototype.toString
+-- Running test case: WI.Gradient.prototype.toString
 PASS: 'linear-gradient(0deg, red, blue)' is valid
 PASS: toString() output matches 'linear-gradient(to top, red, blue)'
 PASS: 'linear-gradient(to top, red, blue)' is valid
@@ -55,7 +55,7 @@
 PASS: 'repeating-radial-gradient(red, blue)' is valid
 PASS: toString() output matches 'repeating-radial-gradient(red, blue)'
 
--- Running test case: WebInspector.LinearGradient.prototype.set angleUnits
+-- Running test case: WI.LinearGradient.prototype.set angleUnits
 PASS: Gradient has angle value of '180'
 PASS: Gradient has angle units of 'deg'
 PASS: toString() returns the same value regardless of angle units
diff --git a/LayoutTests/inspector/model/gradient.html b/LayoutTests/inspector/model/gradient.html
index 8bfc638..1432bbb 100644
--- a/LayoutTests/inspector/model/gradient.html
+++ b/LayoutTests/inspector/model/gradient.html
@@ -5,36 +5,36 @@
 <script>
 function test()
 {
-    let suite = InspectorTest.createAsyncSuite("WebInspector.Gradient");
+    let suite = InspectorTest.createAsyncSuite("WI.Gradient");
 
     suite.addTestCase({
-        name: "WebInspector.Gradient.fromString",
+        name: "WI.Gradient.fromString",
         description: "Test we can detect gradients from strings.",
         test(resolve, reject) {
             function testGood(string, expectedSubclass) {
-                let gradient = WebInspector.Gradient.fromString(string);
-                InspectorTest.expectThat(gradient instanceof WebInspector.Gradient, `'${string}' is valid`);
+                let gradient = WI.Gradient.fromString(string);
+                InspectorTest.expectThat(gradient instanceof WI.Gradient, `'${string}' is valid`);
                 InspectorTest.expectThat(gradient && gradient instanceof expectedSubclass, `'${string}' is the expected subclass '${expectedSubclass.name}'`);
             }
 
             function testBad(string) {
-                let gradient = WebInspector.Gradient.fromString(string);
+                let gradient = WI.Gradient.fromString(string);
                 InspectorTest.expectThat(!gradient, `'${string}' is not valid`);
                 if (gradient)
                     InspectorTest.fail(`'${string}' is valid with subclass '${gradient.constructor.name}'`);
             }
 
-            testGood("linear-gradient(red, blue)", WebInspector.LinearGradient);
-            testGood("linear-gradient(0deg, red, blue)", WebInspector.LinearGradient);
-            testGood("linear-gradient(to top, red, blue)", WebInspector.LinearGradient);
-            testGood("linear-gradient(to top, red, green 50%, blue)", WebInspector.LinearGradient);
-            testGood("repeating-linear-gradient(0deg, red, blue)", WebInspector.LinearGradient);
+            testGood("linear-gradient(red, blue)", WI.LinearGradient);
+            testGood("linear-gradient(0deg, red, blue)", WI.LinearGradient);
+            testGood("linear-gradient(to top, red, blue)", WI.LinearGradient);
+            testGood("linear-gradient(to top, red, green 50%, blue)", WI.LinearGradient);
+            testGood("repeating-linear-gradient(0deg, red, blue)", WI.LinearGradient);
 
-            testGood("radial-gradient(red, blue)", WebInspector.RadialGradient);
-            testGood("radial-gradient(0deg, red, blue)", WebInspector.RadialGradient);
-            testGood("radial-gradient(ellipse, red, blue)", WebInspector.RadialGradient);
-            testGood("radial-gradient(ellipse, red, green 50%, blue)", WebInspector.RadialGradient);
-            testGood("repeating-radial-gradient(red, blue)", WebInspector.RadialGradient);
+            testGood("radial-gradient(red, blue)", WI.RadialGradient);
+            testGood("radial-gradient(0deg, red, blue)", WI.RadialGradient);
+            testGood("radial-gradient(ellipse, red, blue)", WI.RadialGradient);
+            testGood("radial-gradient(ellipse, red, green 50%, blue)", WI.RadialGradient);
+            testGood("repeating-radial-gradient(red, blue)", WI.RadialGradient);
 
             InspectorTest.log("");
 
@@ -58,12 +58,12 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Gradient.prototype.toString",
+        name: "WI.Gradient.prototype.toString",
         description: "Test the different toString outputs.",
         test(resolve, reject) {
             function test(string, expected = string) {
-                let gradient = WebInspector.Gradient.fromString(string);
-                InspectorTest.expectThat(gradient instanceof WebInspector.Gradient, `'${string}' is valid`);
+                let gradient = WI.Gradient.fromString(string);
+                InspectorTest.expectThat(gradient instanceof WI.Gradient, `'${string}' is valid`);
                 InspectorTest.expectEqual(gradient && gradient.toString(), expected, `toString() output matches '${expected}'`);
             }
 
@@ -82,10 +82,10 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.LinearGradient.prototype.set angleUnits",
+        name: "WI.LinearGradient.prototype.set angleUnits",
         description: "Test the recalculation of the angle value when changing angle units.",
         test(resolve, reject) {
-            let gradient = WebInspector.Gradient.fromString("linear-gradient(red, blue)");
+            let gradient = WI.Gradient.fromString("linear-gradient(red, blue)");
             if (!gradient) {
                 InspectorTest.fail("'linear-gradient(red, blue)' is not valid");
                 reject();
@@ -97,19 +97,19 @@
                 InspectorTest.expectEqual(gradient.toString(), "linear-gradient(red, blue)", "toString() returns the same value regardless of angle units");
             }
 
-            test(180, WebInspector.LinearGradient.AngleUnits.DEG);
+            test(180, WI.LinearGradient.AngleUnits.DEG);
 
-            gradient.angleUnits = WebInspector.LinearGradient.AngleUnits.RAD;
+            gradient.angleUnits = WI.LinearGradient.AngleUnits.RAD;
 
-            test(3.14, WebInspector.LinearGradient.AngleUnits.RAD);
+            test(3.14, WI.LinearGradient.AngleUnits.RAD);
 
-            gradient.angleUnits = WebInspector.LinearGradient.AngleUnits.GRAD;
+            gradient.angleUnits = WI.LinearGradient.AngleUnits.GRAD;
 
-            test(200, WebInspector.LinearGradient.AngleUnits.GRAD);
+            test(200, WI.LinearGradient.AngleUnits.GRAD);
 
-            gradient.angleUnits = WebInspector.LinearGradient.AngleUnits.TURN;
+            gradient.angleUnits = WI.LinearGradient.AngleUnits.TURN;
 
-            test(0.5, WebInspector.LinearGradient.AngleUnits.TURN);
+            test(0.5, WI.LinearGradient.AngleUnits.TURN);
 
             resolve();
         }
@@ -120,6 +120,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Tests for the WebInspector.Gradient model object.</p>
+<p>Tests for the WI.Gradient model object.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/parse-script-syntax-tree.html b/LayoutTests/inspector/model/parse-script-syntax-tree.html
index 2ddebc6..03a817e 100644
--- a/LayoutTests/inspector/model/parse-script-syntax-tree.html
+++ b/LayoutTests/inspector/model/parse-script-syntax-tree.html
@@ -8,16 +8,16 @@
     function makeNode(text, isExpression, isModule)
     {
         const target = null, url = null;
-        let sourceType = isModule ? WebInspector.Script.SourceType.Module : WebInspector.Script.SourceType.Program;
-        let script = new WebInspector.Script(target, 1, new WebInspector.TextRange(0, text.length), url, sourceType);
-        let scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(text, script);
+        let sourceType = isModule ? WI.Script.SourceType.Module : WI.Script.SourceType.Program;
+        let script = new WI.Script(target, 1, new WI.TextRange(0, text.length), url, sourceType);
+        let scriptSyntaxTree = new WI.ScriptSyntaxTree(text, script);
         let syntaxTree = scriptSyntaxTree._syntaxTree;
 
         InspectorTest.assert(scriptSyntaxTree.parsedSuccessfully, "ScriptSyntaxTree should be able to parse: \"" + text + "\"");
-        InspectorTest.assert(syntaxTree.type === WebInspector.ScriptSyntaxTree.NodeType.Program, "Should be program.");
+        InspectorTest.assert(syntaxTree.type === WI.ScriptSyntaxTree.NodeType.Program, "Should be program.");
         InspectorTest.assert(syntaxTree.body.length === 1, "Calling makeNode should return one node in the program.");
         if (isExpression) {
-            InspectorTest.assert(syntaxTree.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
+            InspectorTest.assert(syntaxTree.body[0].type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
             return syntaxTree.body[0].expression;
         } else if (isModule) {
             InspectorTest.assert(syntaxTree.sourceType === "module");
@@ -36,20 +36,20 @@
     let node = null;
 
     node = makeNode("x = 20;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.AssignmentExpression);
     InspectorTest.assert(node.left);
-    InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.left.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.right);
-    InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.right.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.operator === "=");
     node = makeNode("[x, y] = foo;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.AssignmentExpression);
     InspectorTest.assert(node.left);
-    InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern);
+    InspectorTest.assert(node.left.type === WI.ScriptSyntaxTree.NodeType.ArrayPattern);
     InspectorTest.assert(node.left.elements.length === 2);
-    InspectorTest.assert(node.left.elements[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.left.elements[0].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.left.elements[0].name === "x");
-    InspectorTest.assert(node.left.elements[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.left.elements[1].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.left.elements[1].name === "y");
     node = makeNode("x += 20;", true);
     InspectorTest.assert(node.operator === "+=");
@@ -58,22 +58,22 @@
     InspectorTest.log("passed AssignmentExpression");
 
     node = makeNode("[1, 2]", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ArrayExpression);
     InspectorTest.assert(Array.isArray(node.elements));
     InspectorTest.assert(node.elements.length === 2);
-    InspectorTest.assert(node.elements[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
-    InspectorTest.assert(node.elements[1].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.elements[0].type === WI.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.elements[1].type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.log("passed ArrayExpression");
 
     node = makeNode("{foo();}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.assert(node.body);
     InspectorTest.assert(node.body.length === 1);
-    InspectorTest.assert(node.body[0].expression.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
+    InspectorTest.assert(node.body[0].expression.type === WI.ScriptSyntaxTree.NodeType.CallExpression);
     InspectorTest.log("passed BlockStatement");
 
     node = makeNode("2 + 2", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.BinaryExpression);
     InspectorTest.assert(node.left);
     InspectorTest.assert(node.right);
     InspectorTest.assert(node.operator === "+");
@@ -96,163 +96,163 @@
     InspectorTest.log("passed BinaryExpression");
 
     node = makeNode("label:while(true) {break label;}", false);
-    InspectorTest.assert(node.body.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.BreakStatement);
-    InspectorTest.assert(node.body.body.body[0].label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.body.body.body[0].type === WI.ScriptSyntaxTree.NodeType.BreakStatement);
+    InspectorTest.assert(node.body.body.body[0].label.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.body.body.body[0].label.name === "label");
     InspectorTest.log("passed BreakStatement");
 
     node = makeNode("foo(20, 25)", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.CallExpression);
     InspectorTest.assert(node.arguments);
     InspectorTest.assert(node.arguments.length === 2);
-    InspectorTest.assert(node.arguments[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
-    InspectorTest.assert(node.arguments[1].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.arguments[0].type === WI.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.arguments[1].type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.log("passed CallExpression");
 
     node = makeNode("try {} catch(e) {} ", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.TryStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.TryStatement);
     InspectorTest.log("passed TryStatement");
-    InspectorTest.assert(node.handler.type === WebInspector.ScriptSyntaxTree.NodeType.CatchClause);
+    InspectorTest.assert(node.handler.type === WI.ScriptSyntaxTree.NodeType.CatchClause);
     InspectorTest.log("passed CatchClause");
 
     node = makeNode("foo ? bar : baz;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ConditionalExpression);
     InspectorTest.assert(node.test);
     InspectorTest.assert(node.consequent);
     InspectorTest.assert(node.alternate);
-    InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.consequent.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.alternate.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.test.type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.consequent.type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.alternate.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.log("passed ConditionalExpression");
 
     node = makeNode("label:while(true) {continue label;}", false);
-    InspectorTest.assert(node.body.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement);
-    InspectorTest.assert(node.body.body.body[0].label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.body.body.body[0].type === WI.ScriptSyntaxTree.NodeType.ContinueStatement);
+    InspectorTest.assert(node.body.body.body[0].label.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.body.body.body[0].label.name === "label");
     InspectorTest.log("passed ContinueStatement");
 
     node = makeNode("do{}while(true);", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.DoWhileStatement);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.DoWhileStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.assert(node.body.body.length === 0);
     InspectorTest.assert(node.test);
-    InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.test.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.log("passed DoWhileStatement");
 
     node = makeNode("debugger;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.DebuggerStatement);
     InspectorTest.log("passed DebuggerStatement");
 
     node = makeNode(";", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.EmptyStatement);
     InspectorTest.log("passed EmptyStatement");
 
     node = makeNode("2 + 2", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
     InspectorTest.assert(node.expression);
-    InspectorTest.assert(node.expression.type === WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression);
+    InspectorTest.assert(node.expression.type === WI.ScriptSyntaxTree.NodeType.BinaryExpression);
     InspectorTest.log("passed ExpressionStatement");
 
     node = makeNode("for(x = 0;x < 20;x++){}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ForStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ForStatement);
     InspectorTest.assert(node.init);
-    InspectorTest.assert(node.init.type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression);
+    InspectorTest.assert(node.init.type === WI.ScriptSyntaxTree.NodeType.AssignmentExpression);
     InspectorTest.assert(node.test);
-    InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression);
+    InspectorTest.assert(node.test.type === WI.ScriptSyntaxTree.NodeType.BinaryExpression);
     InspectorTest.assert(node.update);
-    InspectorTest.assert(node.update.type === WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression);
+    InspectorTest.assert(node.update.type === WI.ScriptSyntaxTree.NodeType.UpdateExpression);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     node = makeNode("for(x = 0;x < 20;x++);", false);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.EmptyStatement);
     InspectorTest.log("passed ForStatement");
 
     node = makeNode("for(var x in {}){}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ForInStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ForInStatement);
     InspectorTest.assert(node.left);
-    InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.left.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.right);
-    InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.right.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     node = makeNode("for(var x in {});", false);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.EmptyStatement);
     InspectorTest.log("passed ForInStatement");
 
     node = makeNode("for(var x of {});", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ForOfStatement);
     InspectorTest.assert(node.left);
-    InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.left.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.right);
-    InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.right.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.EmptyStatement);
     node = makeNode("for(var {x} of {});", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ForOfStatement);
     InspectorTest.assert(node.left);
-    InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
-    InspectorTest.assert(node.left.declarations[0].id.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern);
+    InspectorTest.assert(node.left.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.left.declarations[0].id.type === WI.ScriptSyntaxTree.NodeType.ObjectPattern);
     InspectorTest.assert(node.left.declarations[0].id.properties[0].value.name === "x");
     InspectorTest.log("passed ForOfStatement");
 
     node = makeNode("function foo(x,y){}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration);
     InspectorTest.assert(node.params);
     InspectorTest.assert(node.params.length === 2);
-    InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.params[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[0].type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[1].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.assert(!node.generator);
     node = makeNode("x = {get foo(){return 20}}", true);
-    InspectorTest.assert(node.right.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.right.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     node = makeNode("x = {set foo(x){return 20}}", true);
-    InspectorTest.assert(node.right.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.right.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.log("passed FunctionDeclaration");
 
     node = makeNode("foo(function(x,y){})", true);
-    InspectorTest.assert(node.arguments[0].type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.arguments[0].type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.assert(node.arguments[0].params);
     InspectorTest.assert(node.arguments[0].params.length === 2);
-    InspectorTest.assert(node.arguments[0].params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.arguments[0].params[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.arguments[0].params[0].type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.arguments[0].params[1].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.arguments[0].body);
-    InspectorTest.assert(node.arguments[0].body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.arguments[0].body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.assert(!node.arguments[0].generator);
     InspectorTest.log("passed FunctionExpression");
 
     node = makeNode("foo;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.name);
     InspectorTest.assert(node.name === "foo");
     InspectorTest.log("passed Identifier");
 
     node = makeNode("if (true) baz; else bar;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.IfStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.IfStatement);
     InspectorTest.assert(node.test);
-    InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.test.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.consequent);
-    InspectorTest.assert(node.consequent.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.consequent.type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
     InspectorTest.assert(node.alternate);
-    InspectorTest.assert(node.alternate.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.alternate.type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
     InspectorTest.log("passed IfStatement");
 
     node = makeNode("true;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.value === true);
     InspectorTest.assert(node.raw === "true");
     node = makeNode("false;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.value === false);
     InspectorTest.assert(node.raw === "false");
     node = makeNode("20;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.value === 20);
     InspectorTest.assert(node.raw === "20");
     node = makeNode("'20';", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.value === '20');
     InspectorTest.assert(node.raw === "'20'");
     node = makeNode("null;", true);
@@ -274,39 +274,39 @@
     InspectorTest.log("passed Literal");
 
     node = makeNode("label:while(true)20;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.LabeledStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.LabeledStatement);
     InspectorTest.assert(node.label);
-    InspectorTest.assert(node.label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.label.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.label.name === "label");
     InspectorTest.log("passed LabeledStatement");
 
     node = makeNode("x && 20", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.LogicalExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.LogicalExpression);
     InspectorTest.assert(node.left);
-    InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.left.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.right);
-    InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.right.type === WI.ScriptSyntaxTree.NodeType.Literal);
     //InspectorTest.assert(node.operator === "&&");
     node = makeNode("x || 20", true);
     InspectorTest.assert(node.operator === "||");
     InspectorTest.log("passed LogicalExpression");
 
     node = makeNode("foo[20]", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.MemberExpression);
     InspectorTest.assert(node.computed);
     InspectorTest.assert(node.object);
-    InspectorTest.assert(node.object.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.object.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.property);
-    InspectorTest.assert(node.property.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.property.type === WI.ScriptSyntaxTree.NodeType.Literal);
     node = makeNode("foo.bar", true);
     InspectorTest.assert(!node.computed);
-    InspectorTest.assert(node.property.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.property.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.log("passed MemberExpression");
 
     node = makeNode("new Foo(20)", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.NewExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.NewExpression);
     InspectorTest.assert(node.callee);
-    InspectorTest.assert(node.callee.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.callee.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.arguments);
     InspectorTest.assert(node.arguments.length === 1);
     node = makeNode("new Foo", true);
@@ -315,7 +315,7 @@
     InspectorTest.log("passed NewExpression");
 
     node = makeNode("x = {foo:bar};", true);
-    InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.right.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.right.properties);
     InspectorTest.assert(node.right.properties.length === 1);
     InspectorTest.log("passed ObjectExpression");
@@ -323,63 +323,63 @@
     // Program is tested in makeNode
 
     node = makeNode("x = {foo:20};", true);
-    InspectorTest.assert(node.right.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
+    InspectorTest.assert(node.right.properties[0].type === WI.ScriptSyntaxTree.NodeType.Property);
     InspectorTest.assert(node.right.properties[0].key);
-    InspectorTest.assert(node.right.properties[0].key.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.right.properties[0].key.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.right.properties[0].value);
-    InspectorTest.assert(node.right.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.right.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.Literal);
     node = makeNode("x = {'foo':20};", true);
     InspectorTest.assert(node.right.properties[0].key);
-    InspectorTest.assert(node.right.properties[0].key.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.right.properties[0].key.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.log("passed Property");
 
     node = makeNode("function foo(...things) { return things; }", false);
     InspectorTest.assert(node.params.length === 1);
-    InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.RestElement);
-    InspectorTest.assert(node.params[0].argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[0].type === WI.ScriptSyntaxTree.NodeType.RestElement);
+    InspectorTest.assert(node.params[0].argument.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.params[0].argument.name === "things");
     InspectorTest.log("passed RestStatement");
 
     node = makeNode("function foo() { return 20; }", false);
-    InspectorTest.assert(node.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement);
-    InspectorTest.assert(node.body.body[0].argument.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.body.body[0].type === WI.ScriptSyntaxTree.NodeType.ReturnStatement);
+    InspectorTest.assert(node.body.body[0].argument.type === WI.ScriptSyntaxTree.NodeType.Literal);
     node = makeNode("function foo() { return; }", false);
     InspectorTest.assert(node.body.body[0].argument === null);
     InspectorTest.log("passed ReturnStatement");
 
     node = makeNode("(x, y)", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.SequenceExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.SequenceExpression);
     InspectorTest.assert(node.expressions);
     InspectorTest.assert(node.expressions.length === 2);
-    InspectorTest.assert(node.expressions[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.expressions[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.expressions[0].type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.expressions[1].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.log("passed SequenceExpression");
 
     node = makeNode("switch(x){case y:break;}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement);
-    InspectorTest.assert(node.discriminant.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.SwitchStatement);
+    InspectorTest.assert(node.discriminant.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.log("passed SwitchStatement");
-    InspectorTest.assert(node.cases[0].type === WebInspector.ScriptSyntaxTree.NodeType.SwitchCase);
-    InspectorTest.assert(node.cases[0].test.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.cases[0].type === WI.ScriptSyntaxTree.NodeType.SwitchCase);
+    InspectorTest.assert(node.cases[0].test.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.cases[0].consequent);
     InspectorTest.assert(Array.isArray(node.cases[0].consequent));
     InspectorTest.assert(node.cases[0].consequent.length === 1);
     InspectorTest.log("passed SwitchCase");
 
     node = makeNode("this;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ThisExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ThisExpression);
     InspectorTest.log("passed ThisExpression");
 
     node = makeNode("throw new Error;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ThrowStatement);
     InspectorTest.assert(node.argument);
-    InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.NewExpression);
+    InspectorTest.assert(node.argument.type === WI.ScriptSyntaxTree.NodeType.NewExpression);
     InspectorTest.log("passed ThrowStatement");
 
     node = makeNode("!foo;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.UnaryExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.UnaryExpression);
     InspectorTest.assert(node.argument);
-    InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.argument.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.operator === "!");
     node = makeNode("~foo;", true);
     InspectorTest.assert(node.operator === "~");
@@ -388,15 +388,15 @@
     InspectorTest.log("passed UnaryExpression");
 
     node = makeNode("foo++;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.UpdateExpression);
     InspectorTest.assert(node.argument);
-    InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.argument.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.operator === "++");
     InspectorTest.assert(node.prefix === false);
     node = makeNode("++foo;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.UpdateExpression);
     InspectorTest.assert(node.argument);
-    InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.argument.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.prefix === true);
     InspectorTest.assert(node.operator === "++");
     node = makeNode("--foo;", true);
@@ -406,191 +406,191 @@
     InspectorTest.log("passed UpdateExpression");
 
     node = makeNode("var foo = 20;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.declarations);
     InspectorTest.assert(node.declarations.length === 1);
     InspectorTest.log("passed VariableDeclaration");
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
     InspectorTest.assert(node.declarations[0].id);
     InspectorTest.assert(node.declarations[0].id.type);
-    InspectorTest.assert(node.declarations[0].id.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.declarations[0].id.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.declarations[0].init);
-    InspectorTest.assert(node.declarations[0].init.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.declarations[0].init.type === WI.ScriptSyntaxTree.NodeType.Literal);
     node = makeNode("var foo;", false);
     InspectorTest.assert(node.declarations[0].init === null);
     node = makeNode("var {x, y: foo} = bar;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.declarations.length === 1);
     node = node.declarations[0].id;
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ObjectPattern);
     InspectorTest.assert(node.properties.length === 2);
-    InspectorTest.assert(node.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
-    InspectorTest.assert(node.properties[0].key.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.properties[0].type === WI.ScriptSyntaxTree.NodeType.Property);
+    InspectorTest.assert(node.properties[0].key.type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.properties[0].key.name === node.properties[0].value.name && node.properties[0].key.name === "x");
-    InspectorTest.assert(node.properties[1].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
-    InspectorTest.assert(node.properties[1].key.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
-    InspectorTest.assert(node.properties[1].value.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.properties[1].type === WI.ScriptSyntaxTree.NodeType.Property);
+    InspectorTest.assert(node.properties[1].key.type === WI.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.properties[1].value.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.properties[1].key.name === "y");
     InspectorTest.assert(node.properties[1].value.name === "foo");
     node = makeNode("var [x, y] = foo;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.declarations.length === 1);
     node = node.declarations[0].id;
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ArrayPattern);
     InspectorTest.assert(node.elements.length === 2);
-    InspectorTest.assert(node.elements[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.elements[0].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.elements[0].name === "x");
-    InspectorTest.assert(node.elements[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.elements[1].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.elements[1].name === "y");
     InspectorTest.log("passed VariableDeclarator");
 
     node = makeNode("while(true)boo;", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.WhileStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.WhileStatement);
     InspectorTest.assert(node.test);
-    InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.test.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
     node = makeNode("while(true){}", false);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.log("passed WhileStatement");
 
     node = makeNode("with(o) {}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.WithStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.WithStatement);
     InspectorTest.assert(node.object);
-    InspectorTest.assert(node.object.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.object.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.body);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.log("passed WithStatement");
 
     node = makeNode("function* gen() { yield 1; yield* [1,2]; }", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration);
     InspectorTest.assert(node.generator);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.assert(node.body.body.length === 2);
-    InspectorTest.assert(node.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
-    InspectorTest.assert(node.body.body[0].expression.type === WebInspector.ScriptSyntaxTree.NodeType.YieldExpression);
+    InspectorTest.assert(node.body.body[0].type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.body.body[0].expression.type === WI.ScriptSyntaxTree.NodeType.YieldExpression);
     InspectorTest.assert(!node.body.body[0].expression.delegate);
-    InspectorTest.assert(node.body.body[0].expression.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
-    InspectorTest.assert(node.body.body[1].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
-    InspectorTest.assert(node.body.body[1].expression.type === WebInspector.ScriptSyntaxTree.NodeType.YieldExpression);
+    InspectorTest.assert(node.body.body[0].expression.argument.type === WI.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.body.body[1].type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.body.body[1].expression.type === WI.ScriptSyntaxTree.NodeType.YieldExpression);
     InspectorTest.assert(node.body.body[1].expression.delegate);
-    InspectorTest.assert(node.body.body[1].expression.argument.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression);
+    InspectorTest.assert(node.body.body[1].expression.argument.type === WI.ScriptSyntaxTree.NodeType.ArrayExpression);
     InspectorTest.log("passed YieldExpression");
 
     node = makeNode("class C { constructor() { super(); new.target; } }", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.ClassBody);
-    InspectorTest.assert(node.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition);
-    InspectorTest.assert(node.body.body[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
-    InspectorTest.assert(node.body.body[0].value.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ClassDeclaration);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.ClassBody);
+    InspectorTest.assert(node.body.body[0].type === WI.ScriptSyntaxTree.NodeType.MethodDefinition);
+    InspectorTest.assert(node.body.body[0].value.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.body.body[0].value.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.assert(node.body.body[0].value.body.body.length === 2);
-    InspectorTest.assert(node.body.body[0].value.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
-    InspectorTest.assert(node.body.body[0].value.body.body[0].expression.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
-    InspectorTest.assert(node.body.body[0].value.body.body[0].expression.callee.type === WebInspector.ScriptSyntaxTree.NodeType.Super);
-    InspectorTest.assert(node.body.body[0].value.body.body[1].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
-    InspectorTest.assert(node.body.body[0].value.body.body[1].expression.type === WebInspector.ScriptSyntaxTree.NodeType.MetaProperty);
+    InspectorTest.assert(node.body.body[0].value.body.body[0].type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.body.body[0].value.body.body[0].expression.type === WI.ScriptSyntaxTree.NodeType.CallExpression);
+    InspectorTest.assert(node.body.body[0].value.body.body[0].expression.callee.type === WI.ScriptSyntaxTree.NodeType.Super);
+    InspectorTest.assert(node.body.body[0].value.body.body[1].type === WI.ScriptSyntaxTree.NodeType.ExpressionStatement);
+    InspectorTest.assert(node.body.body[0].value.body.body[1].expression.type === WI.ScriptSyntaxTree.NodeType.MetaProperty);
     InspectorTest.assert(node.body.body[0].value.body.body[1].expression.meta.name === "new");
     InspectorTest.assert(node.body.body[0].value.body.body[1].expression.property.name === "target");
     InspectorTest.log("passed ClassStatement, Super, MetaProperty");
 
     node = makeNode("import('./Cocoa.js')", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
-    InspectorTest.assert(node.callee.type === WebInspector.ScriptSyntaxTree.NodeType.Import);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.CallExpression);
+    InspectorTest.assert(node.callee.type === WI.ScriptSyntaxTree.NodeType.Import);
     InspectorTest.assert(node.arguments);
     InspectorTest.assert(node.arguments.length === 1);
-    InspectorTest.assert(node.arguments[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.arguments[0].type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.log("passed Import");
 
     node = makeNode("let { ...rest } = { x: 1, y: 0 }", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.kind === "let");
     InspectorTest.assert(node.declarations.length === 1);
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
-    InspectorTest.assert(node.declarations[0].id.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].id.type === WI.ScriptSyntaxTree.NodeType.ObjectPattern);
     InspectorTest.assert(node.declarations[0].id.properties.length === 1);
-    InspectorTest.assert(node.declarations[0].id.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.RestProperty);
-    InspectorTest.assert(node.declarations[0].id.properties[0].argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.declarations[0].id.properties[0].type === WI.ScriptSyntaxTree.NodeType.RestProperty);
+    InspectorTest.assert(node.declarations[0].id.properties[0].argument.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.declarations[0].id.properties[0].argument.name === "rest");
     InspectorTest.log("passed RestProperty");
 
     node = makeNode("let n = { ...spread }", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.kind === "let");
     InspectorTest.assert(node.declarations.length === 1);
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
-    InspectorTest.assert(node.declarations[0].init.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].init.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.declarations[0].init.properties.length === 1);
-    InspectorTest.assert(node.declarations[0].init.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.SpreadProperty);
-    InspectorTest.assert(node.declarations[0].init.properties[0].argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.declarations[0].init.properties[0].type === WI.ScriptSyntaxTree.NodeType.SpreadProperty);
+    InspectorTest.assert(node.declarations[0].init.properties[0].argument.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.declarations[0].init.properties[0].argument.name === "spread");
     InspectorTest.log("passed SpreadProperty");
 
     node = makeNode("let [x=20] = [];", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.kind === "let");
     InspectorTest.assert(node.declarations.length === 1);
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
-    InspectorTest.assert(node.declarations[0].id.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].id.type === WI.ScriptSyntaxTree.NodeType.ArrayPattern);
     InspectorTest.assert(node.declarations[0].id.elements.length === 1);
-    InspectorTest.assert(node.declarations[0].id.elements[0].type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern);
-    InspectorTest.assert(node.declarations[0].id.elements[0].left.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.declarations[0].id.elements[0].type === WI.ScriptSyntaxTree.NodeType.AssignmentPattern);
+    InspectorTest.assert(node.declarations[0].id.elements[0].left.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.declarations[0].id.elements[0].left.name === "x");
-    InspectorTest.assert(node.declarations[0].id.elements[0].right.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.declarations[0].id.elements[0].right.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.declarations[0].id.elements[0].right.value === 20);
     InspectorTest.log("passed AssignmentPattern");
 
     node = makeNode("(x) => x;", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
     InspectorTest.assert(node.params.length === 1);
-    InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[0].type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.params[0].name === "x");
     InspectorTest.assert(node.expression === true);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.Identifier);
 
     node = makeNode("(x = 20) => { return x; };", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
     InspectorTest.assert(node.params.length === 1);
-    InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern);
-    InspectorTest.assert(node.params[0].left.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[0].type === WI.ScriptSyntaxTree.NodeType.AssignmentPattern);
+    InspectorTest.assert(node.params[0].left.type === WI.ScriptSyntaxTree.NodeType.Identifier);
     InspectorTest.assert(node.params[0].left.name === "x");
-    InspectorTest.assert(node.params[0].right.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.params[0].right.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.params[0].right.value === 20);
     InspectorTest.assert(node.expression === false);
-    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.assert(node.body.type === WI.ScriptSyntaxTree.NodeType.BlockStatement);
     InspectorTest.log("passed ArrowFunctionExpression");
 
     node = makeNode("async function foo() {}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration);
     InspectorTest.assert(node.async);
     node = makeNode("function foo() {}", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration);
     InspectorTest.assert(!node.async);
     node = makeNode("(async function() {})", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.assert(node.async);
     node = makeNode("(function() {})", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.assert(!node.async);
     node = makeNode("async () => {}", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
     InspectorTest.assert(node.async);
     node = makeNode("() => {}", true);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
     InspectorTest.assert(!node.async);
     InspectorTest.log("passed Async Functions");
 
     node = makeNode("async function foo() { await foo(); }", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration);
     InspectorTest.assert(node.async);
-    InspectorTest.assert(node.body.body[0].expression.type === WebInspector.ScriptSyntaxTree.NodeType.AwaitExpression);
-    InspectorTest.assert(node.body.body[0].expression.argument.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
+    InspectorTest.assert(node.body.body[0].expression.type === WI.ScriptSyntaxTree.NodeType.AwaitExpression);
+    InspectorTest.assert(node.body.body[0].expression.argument.type === WI.ScriptSyntaxTree.NodeType.CallExpression);
     node = makeNode("async function foo() { await 1; }", false);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration);
     InspectorTest.assert(node.async);
-    InspectorTest.assert(node.body.body[0].expression.type === WebInspector.ScriptSyntaxTree.NodeType.AwaitExpression);
-    InspectorTest.assert(node.body.body[0].expression.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.body.body[0].expression.type === WI.ScriptSyntaxTree.NodeType.AwaitExpression);
+    InspectorTest.assert(node.body.body[0].expression.argument.type === WI.ScriptSyntaxTree.NodeType.Literal);
     InspectorTest.assert(node.body.body[0].expression.argument.value === 1);
     InspectorTest.log("passed AwaitExpression");
 
@@ -598,56 +598,56 @@
     // Modules
 
     node = makeNodeForModule(`import {a,b as x,c} from "module.js"`);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ImportDeclaration);
     InspectorTest.assert(node.source.value === "module.js");
     InspectorTest.assert(node.specifiers.length === 3);
-    InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier);
+    InspectorTest.assert(node.specifiers[0].type === WI.ScriptSyntaxTree.NodeType.ImportSpecifier);
     InspectorTest.assert(node.specifiers[0].local.name === "a");
     InspectorTest.assert(node.specifiers[0].imported.name === "a");
-    InspectorTest.assert(node.specifiers[1].type === WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier);
+    InspectorTest.assert(node.specifiers[1].type === WI.ScriptSyntaxTree.NodeType.ImportSpecifier);
     InspectorTest.assert(node.specifiers[1].local.name === "x");
     InspectorTest.assert(node.specifiers[1].imported.name === "b");
-    InspectorTest.assert(node.specifiers[2].type === WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier);
+    InspectorTest.assert(node.specifiers[2].type === WI.ScriptSyntaxTree.NodeType.ImportSpecifier);
     InspectorTest.assert(node.specifiers[2].local.name === "c");
     InspectorTest.assert(node.specifiers[2].imported.name === "c");
     InspectorTest.log("passed ImportDeclaration, ImportSpecifier");
 
     node = makeNodeForModule(`import x from "module.js"`);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ImportDeclaration);
     InspectorTest.assert(node.source.value === "module.js");
     InspectorTest.assert(node.specifiers.length === 1);
-    InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier);
+    InspectorTest.assert(node.specifiers[0].type === WI.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier);
     InspectorTest.log("passed ImportDefaultSpecifier");
 
     node = makeNodeForModule(`import * as A from "module.js"`);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ImportDeclaration);
     InspectorTest.assert(node.source.value === "module.js");
     InspectorTest.assert(node.specifiers.length === 1);
-    InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier);
+    InspectorTest.assert(node.specifiers[0].type === WI.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier);
     InspectorTest.assert(node.specifiers[0].local.name === "A");
     InspectorTest.log("passed ImportNamespaceSpecifier");
 
     node = makeNodeForModule(`export {a, b as x, c}`);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ExportNamedDeclaration);
     InspectorTest.assert(node.specifiers.length === 3);
-    InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier);
+    InspectorTest.assert(node.specifiers[0].type === WI.ScriptSyntaxTree.NodeType.ExportSpecifier);
     InspectorTest.assert(node.specifiers[0].local.name === "a");
     InspectorTest.assert(node.specifiers[0].exported.name === "a");
-    InspectorTest.assert(node.specifiers[1].type === WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier);
+    InspectorTest.assert(node.specifiers[1].type === WI.ScriptSyntaxTree.NodeType.ExportSpecifier);
     InspectorTest.assert(node.specifiers[1].local.name === "b");
     InspectorTest.assert(node.specifiers[1].exported.name === "x");
-    InspectorTest.assert(node.specifiers[2].type === WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier);
+    InspectorTest.assert(node.specifiers[2].type === WI.ScriptSyntaxTree.NodeType.ExportSpecifier);
     InspectorTest.assert(node.specifiers[2].local.name === "c");
     InspectorTest.assert(node.specifiers[2].exported.name === "c");
     InspectorTest.log("passed ExportNamedDeclaration, ExportSpecifier");
 
     node = makeNodeForModule(`export default x`);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration);
     InspectorTest.assert(node.declaration.name === "x");
     InspectorTest.log("passed ExportDefaultDeclaration");
 
     node = makeNodeForModule(`export * from "module.js"`);
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.ExportAllDeclaration);
     InspectorTest.assert(node.source.value === "module.js");
     InspectorTest.log("passed ExportAllDeclaration");
 
@@ -657,45 +657,45 @@
     node = makeNode("var o = {['c']() { }};", false);
     //                        ^
     //                 type profiling return divot.
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.declarations.length === 1);
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
-    InspectorTest.assert(node.declarations[0].init.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].init.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.declarations[0].init.properties.length === 1);
-    InspectorTest.assert(node.declarations[0].init.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
+    InspectorTest.assert(node.declarations[0].init.properties[0].type === WI.ScriptSyntaxTree.NodeType.Property);
     InspectorTest.assert(!!node.declarations[0].init.properties[0].method);
     InspectorTest.assert(!!node.declarations[0].init.properties[0].computed);
-    InspectorTest.assert(node.declarations[0].init.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.declarations[0].init.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.assert(node.declarations[0].init.properties[0].value.typeProfilingReturnDivot === 9);
     InspectorTest.log("passed computed method on object literal");
 
     node = makeNode("var o = { m(){ } };", false);
     //                         ^
     //                 type profiling return divot.
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.declarations.length === 1);
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
-    InspectorTest.assert(node.declarations[0].init.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].init.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.declarations[0].init.properties.length === 1);
-    InspectorTest.assert(node.declarations[0].init.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
+    InspectorTest.assert(node.declarations[0].init.properties[0].type === WI.ScriptSyntaxTree.NodeType.Property);
     InspectorTest.assert(!!node.declarations[0].init.properties[0].method);
     InspectorTest.assert(!node.declarations[0].init.properties[0].computed);
-    InspectorTest.assert(node.declarations[0].init.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.declarations[0].init.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.assert(node.declarations[0].init.properties[0].value.typeProfilingReturnDivot === 10);
     InspectorTest.log("passed method on object literal");
 
     node = makeNode("var o = {['c']: function(){ } };", false);
     //                               ^
     //                    type profiling return divot.
-    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
+    InspectorTest.assert(node.type === WI.ScriptSyntaxTree.NodeType.VariableDeclaration);
     InspectorTest.assert(node.declarations.length === 1);
-    InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
-    InspectorTest.assert(node.declarations[0].init.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
+    InspectorTest.assert(node.declarations[0].type === WI.ScriptSyntaxTree.NodeType.VariableDeclarator);
+    InspectorTest.assert(node.declarations[0].init.type === WI.ScriptSyntaxTree.NodeType.ObjectExpression);
     InspectorTest.assert(node.declarations[0].init.properties.length === 1);
-    InspectorTest.assert(node.declarations[0].init.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
+    InspectorTest.assert(node.declarations[0].init.properties[0].type === WI.ScriptSyntaxTree.NodeType.Property);
     InspectorTest.assert(!node.declarations[0].init.properties[0].method);
     InspectorTest.assert(!!node.declarations[0].init.properties[0].computed);
-    InspectorTest.assert(node.declarations[0].init.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
+    InspectorTest.assert(node.declarations[0].init.properties[0].value.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression);
     InspectorTest.assert(node.declarations[0].init.properties[0].value.typeProfilingReturnDivot === 16);
     InspectorTest.log("passed computed method property on object literal");
 
diff --git a/LayoutTests/inspector/model/recording-expected.txt b/LayoutTests/inspector/model/recording-expected.txt
index 5791504..450849d 100644
--- a/LayoutTests/inspector/model/recording-expected.txt
+++ b/LayoutTests/inspector/model/recording-expected.txt
@@ -1,4 +1,4 @@
-Testing the fault-tolerance of WebInspector.Recording.
+Testing the fault-tolerance of WI.Recording.
 
 
 == Running test suite: Recording
diff --git a/LayoutTests/inspector/model/recording.html b/LayoutTests/inspector/model/recording.html
index 39abef1..300bb63 100644
--- a/LayoutTests/inspector/model/recording.html
+++ b/LayoutTests/inspector/model/recording.html
@@ -11,7 +11,7 @@
         suite.addTestCase({
             name,
             test() {
-                let recording = WebInspector.Recording.fromPayload(payload);
+                let recording = WI.Recording.fromPayload(payload);
                 InspectorTest.log(recording ? JSON.stringify(recording.toJSON(), null, 2) : recording);
                 return true;
             }
@@ -157,6 +157,6 @@
 </script>
 </head>
 <body onload="runTest()">
-    <p>Testing the fault-tolerance of WebInspector.Recording.</p>
+    <p>Testing the fault-tolerance of WI.Recording.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/remote-object-dom.html b/LayoutTests/inspector/model/remote-object-dom.html
index 2dab462..f4fc0d0 100644
--- a/LayoutTests/inspector/model/remote-object-dom.html
+++ b/LayoutTests/inspector/model/remote-object-dom.html
@@ -28,7 +28,7 @@
         {expression: `document.querySelectorAll(".my-test")`}, // Non-Live NodeList
     ];
 
-    if (!window.WebInspector) {
+    if (!window.WI) {
         window.steps = steps;
         return;
     }
diff --git a/LayoutTests/inspector/model/remote-object-fake-object.html b/LayoutTests/inspector/model/remote-object-fake-object.html
index ce88ed7..cb30974 100644
--- a/LayoutTests/inspector/model/remote-object-fake-object.html
+++ b/LayoutTests/inspector/model/remote-object-fake-object.html
@@ -5,12 +5,12 @@
 <script>
 function test()
 {
-    let fakeObject = WebInspector.RemoteObject.createFakeRemoteObject();
+    let fakeObject = WI.RemoteObject.createFakeRemoteObject();
 
-    InspectorTest.assert(fakeObject instanceof WebInspector.RemoteObject);
-    InspectorTest.assert(fakeObject.objectId === WebInspector.RemoteObject.FakeRemoteObjectId);
+    InspectorTest.assert(fakeObject instanceof WI.RemoteObject);
+    InspectorTest.assert(fakeObject.objectId === WI.RemoteObject.FakeRemoteObjectId);
     InspectorTest.expectThat(fakeObject.type === "object" && !fakeObject.subtype, "A fake remote object should have object type.");
-    InspectorTest.expectThat(fakeObject !== WebInspector.RemoteObject.createFakeRemoteObject(), "Each fake remote object instance should be unique.");
+    InspectorTest.expectThat(fakeObject !== WI.RemoteObject.createFakeRemoteObject(), "Each fake remote object instance should be unique.");
 
     fakeObject.getOwnPropertyDescriptors(function(properties) {
         InspectorTest.expectThat(Array.isArray(properties) && !properties.length, "A fake remote object should have an empty list of own properties.");
diff --git a/LayoutTests/inspector/model/remote-object-get-properties.html b/LayoutTests/inspector/model/remote-object-get-properties.html
index 634bee6..bb5b72e 100644
--- a/LayoutTests/inspector/model/remote-object-get-properties.html
+++ b/LayoutTests/inspector/model/remote-object-get-properties.html
@@ -79,8 +79,8 @@
         InspectorTest.log("-----------------------------------------------------");
         InspectorTest.log("EXPRESSION: " + step.expression);
 
-        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true}, function(remoteObject, wasThrown) {
-            InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
+        WI.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true}, function(remoteObject, wasThrown) {
+            InspectorTest.assert(remoteObject instanceof WI.RemoteObject);
             InspectorTest.log("type: " + remoteObject.type);
             if (remoteObject.subtype)
                 InspectorTest.log("subtype: " + remoteObject.subtype);
@@ -88,7 +88,7 @@
             remoteObject.getOwnPropertyDescriptors(function(properties) {
                 InspectorTest.log("\nOWN PROPERTIES:");
                 for (var property of properties) {
-                    InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
+                    InspectorTest.assert(property instanceof WI.PropertyDescriptor);
                     InspectorTest.log("    " + property.name);
                 }
             });
@@ -96,7 +96,7 @@
             remoteObject.getDisplayablePropertyDescriptors(function(properties) {
                 InspectorTest.log("\nDISPLAYABLE PROPERTIES:");
                 for (var property of properties) {
-                    InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
+                    InspectorTest.assert(property instanceof WI.PropertyDescriptor);
                     InspectorTest.log("    " + property.name);
                 }
             });
@@ -104,7 +104,7 @@
             remoteObject.getAllPropertyDescriptors(function(properties) {
                 InspectorTest.log("\nALL PROPERTIES:");
                 for (var property of properties) {
-                    InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
+                    InspectorTest.assert(property instanceof WI.PropertyDescriptor);
                     InspectorTest.log("    " + property.name);
                 }
 
diff --git a/LayoutTests/inspector/model/remote-object-mutated-iterators.html b/LayoutTests/inspector/model/remote-object-mutated-iterators.html
index 299c43b..f56b842 100644
--- a/LayoutTests/inspector/model/remote-object-mutated-iterators.html
+++ b/LayoutTests/inspector/model/remote-object-mutated-iterators.html
@@ -27,7 +27,7 @@
         {expression: `argumentsIter.__proto__.next = function(){}; argumentsIter`},
     ];
 
-    if (!window.WebInspector) {
+    if (!window.WI) {
         window.steps = steps;
         return;
     }
diff --git a/LayoutTests/inspector/model/remote-object-weak-collection.html b/LayoutTests/inspector/model/remote-object-weak-collection.html
index 650a211..4b64f98 100644
--- a/LayoutTests/inspector/model/remote-object-weak-collection.html
+++ b/LayoutTests/inspector/model/remote-object-weak-collection.html
@@ -54,14 +54,14 @@
 
         // Run the expression, and then run a garbage collection on a different
         // event loop so no objects are kept alive by the stack.
-        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(remoteObject, wasThrown) {
-            WebInspector.runtimeManager.evaluateInInspectedWindow("GCController.collect()", {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true}, function() {
-                InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
+        WI.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(remoteObject, wasThrown) {
+            WI.runtimeManager.evaluateInInspectedWindow("GCController.collect()", {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true}, function() {
+                InspectorTest.assert(remoteObject instanceof WI.RemoteObject);
                 remoteObject.getCollectionEntries(0, 100, function(entries) {
                     InspectorTest.log("ENTRIES:");
                     entries.sort((a, b) => a.value.value - b.value.value);
                     for (let entry of entries)
-                        InspectorTest.assert(entry instanceof WebInspector.CollectionEntry);
+                        InspectorTest.assert(entry instanceof WI.CollectionEntry);
                     InspectorTest.log(JSON.stringify(entries, remoteObjectJSONFilter, "  "));
                     remoteObject.releaseWeakCollectionEntries();
                     runNextStep();
diff --git a/LayoutTests/inspector/model/remote-object.html b/LayoutTests/inspector/model/remote-object.html
index 573fb05..9a43ed9 100644
--- a/LayoutTests/inspector/model/remote-object.html
+++ b/LayoutTests/inspector/model/remote-object.html
@@ -171,7 +171,7 @@
         {expression: `Object.freeze({})`},
     ];
 
-    if (!window.WebInspector) {
+    if (!window.WI) {
         window.steps = steps;
         return;
     }
diff --git a/LayoutTests/inspector/model/resources/remote-object-utilities.js b/LayoutTests/inspector/model/resources/remote-object-utilities.js
index 72581cf..5b4b07a 100644
--- a/LayoutTests/inspector/model/resources/remote-object-utilities.js
+++ b/LayoutTests/inspector/model/resources/remote-object-utilities.js
@@ -37,11 +37,11 @@
                 continue;
             }
 
-            WebInspector.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, (remoteObject, wasThrown) => {
+            WI.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, (remoteObject, wasThrown) => {
                 InspectorTest.log("");
                 InspectorTest.log("-----------------------------------------------------");
                 InspectorTest.log("EXPRESSION: " + expression);
-                InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
+                InspectorTest.assert(remoteObject instanceof WI.RemoteObject);
                 InspectorTest.log(JSON.stringify(remoteObject, remoteObjectJSONFilter, 2));
                 checkComplete();
             });
diff --git a/LayoutTests/inspector/model/scope-chain-node-expected.txt b/LayoutTests/inspector/model/scope-chain-node-expected.txt
index 14ea9ba..4988da8 100644
--- a/LayoutTests/inspector/model/scope-chain-node-expected.txt
+++ b/LayoutTests/inspector/model/scope-chain-node-expected.txt
@@ -18,11 +18,11 @@
 CONSOLE MESSAGE: line 130: class (method)
 CONSOLE MESSAGE: line 139: class (static)
 CONSOLE MESSAGE: line 145: normal
-Tests for the WebInspector.ScopeChainNode model object.
+Tests for the WI.ScopeChainNode model object.
 
 
-== Running test suite: WebInspector.ScopeChainNode
--- Running test case: WebInspector.ScopeChainNode.AllTypes
+== Running test suite: WI.ScopeChainNode
+-- Running test case: WI.ScopeChainNode.AllTypes
 PASS: ScopeChain should have 13 scopes.
 SCOPE CHAIN:
     Closure
@@ -52,7 +52,7 @@
       - lexicalGlobalVariable: 2
     Global
 
--- Running test case: WebInspector.ScopeChainNode.FunctionNameInFunctionExpression
+-- Running test case: WI.ScopeChainNode.FunctionNameInFunctionExpression
 SCOPE CHAIN:
     Closure
       (empty)
@@ -64,7 +64,7 @@
       - lexicalGlobalVariable: 2
     Global
 
--- Running test case: WebInspector.ScopeChainNode.FunctionNameInClassMethod
+-- Running test case: WI.ScopeChainNode.FunctionNameInClassMethod
 SCOPE CHAIN:
     Closure
       (empty)
@@ -76,7 +76,7 @@
       - lexicalGlobalVariable: 2
     Global
 
--- Running test case: WebInspector.ScopeChainNode.BlockScopes
+-- Running test case: WI.ScopeChainNode.BlockScopes
 PASS: Pause #1 - Top scope should be normal function Closure/Local scope.
 PASS: Pause #2 - Top scope should be Block scope.
 PASS: Pause #3 - Top scope should be Block scope.
diff --git a/LayoutTests/inspector/model/scope-chain-node.html b/LayoutTests/inspector/model/scope-chain-node.html
index c671bd8..78c26b3 100644
--- a/LayoutTests/inspector/model/scope-chain-node.html
+++ b/LayoutTests/inspector/model/scope-chain-node.html
@@ -16,8 +16,8 @@
     }
 
     function scopeTypeToString(type) {
-        for (let key in WebInspector.ScopeChainNode.Type) {
-            if (WebInspector.ScopeChainNode.Type[key] === type)
+        for (let key in WI.ScopeChainNode.Type) {
+            if (WI.ScopeChainNode.Type[key] === type)
                 return key;
         }
         return "Unexpected Scope Type";
@@ -27,7 +27,7 @@
         let promises = [];
         for (let scope of scopeChain) {
             promises.push(new Promise((resolve, reject) => {
-                if (scope.type === WebInspector.ScopeChainNode.Type.Global)
+                if (scope.type === WI.ScopeChainNode.Type.Global)
                     resolve({scope, propertyDescriptors: []});
                 else {
                     scope.objects[0].getDisplayablePropertyDescriptors((propertyDescriptors) => {
@@ -45,7 +45,7 @@
             InspectorTest.log("SCOPE CHAIN:");
             for (let {scope, propertyDescriptors} of results) {
                 InspectorTest.log(`    ${scopeTypeToString(scope.type)}`);
-                if (scope.type === WebInspector.ScopeChainNode.Type.Global)
+                if (scope.type === WI.ScopeChainNode.Type.Global)
                     continue;
 
                 if (!propertyDescriptors.length) {
@@ -62,21 +62,21 @@
     }
 
 
-    let suite = InspectorTest.createAsyncSuite("WebInspector.ScopeChainNode");
+    let suite = InspectorTest.createAsyncSuite("WI.ScopeChainNode");
 
     suite.addTestCase({
-        name: "WebInspector.ScopeChainNode.AllTypes",
+        name: "WI.ScopeChainNode.AllTypes",
         description: "Tests for each of the different scope chain node types.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.CallFramesDidChange)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.CallFramesDidChange)
             .then((event) => {
-                let scopeChain = WebInspector.debuggerManager.activeCallFrame.scopeChain;
+                let scopeChain = WI.debuggerManager.activeCallFrame.scopeChain;
                 InspectorTest.expectThat(scopeChain.length === 13, "ScopeChain should have 13 scopes.");
                 return logScopeChain(scopeChain);
             })
             .then((result) => {
-                let promise = WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Resumed);
-                WebInspector.debuggerManager.resume();
+                let promise = WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Resumed);
+                WI.debuggerManager.resume();
                 return promise;
             })
             .then(resolve, reject);
@@ -86,17 +86,17 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.ScopeChainNode.FunctionNameInFunctionExpression",
+        name: "WI.ScopeChainNode.FunctionNameInFunctionExpression",
         description: "Tests that there should be a FunctionName scope inside a function expression.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.CallFramesDidChange)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.CallFramesDidChange)
             .then((event) => {
-                let scopeChain = WebInspector.debuggerManager.activeCallFrame.scopeChain;
+                let scopeChain = WI.debuggerManager.activeCallFrame.scopeChain;
                 return logScopeChain(scopeChain);
             })
             .then((result) => {
-                let promise = WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Resumed);
-                WebInspector.debuggerManager.resume();
+                let promise = WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Resumed);
+                WI.debuggerManager.resume();
                 return promise;
             })
             .then(resolve, reject);
@@ -106,17 +106,17 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.ScopeChainNode.FunctionNameInClassMethod",
+        name: "WI.ScopeChainNode.FunctionNameInClassMethod",
         description: "Tests that there should be a FunctionName scope inside a class method.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.CallFramesDidChange)
+            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.CallFramesDidChange)
             .then((event) => {
-                let scopeChain = WebInspector.debuggerManager.activeCallFrame.scopeChain;
+                let scopeChain = WI.debuggerManager.activeCallFrame.scopeChain;
                 return logScopeChain(scopeChain);
             })
             .then((result) => {
-                let promise = WebInspector.debuggerManager.awaitEvent(WebInspector.DebuggerManager.Event.Resumed);
-                WebInspector.debuggerManager.resume();
+                let promise = WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Resumed);
+                WI.debuggerManager.resume();
                 return promise;
             })
             .then(resolve, reject);
@@ -126,51 +126,51 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.ScopeChainNode.BlockScopes",
+        name: "WI.ScopeChainNode.BlockScopes",
         description: "Tests for a Block scope inside all the different types of blocks.",
         test(resolve, reject) {
             let pauseCount = 0;
             let pauseEventsExpected = 19;
             function callFramesDidChangeListener(event) {
-                if (!WebInspector.debuggerManager.activeCallFrame)
+                if (!WI.debuggerManager.activeCallFrame)
                     return;
 
                 pauseCount++;
-                let scopeChain = WebInspector.debuggerManager.activeCallFrame.scopeChain;
+                let scopeChain = WI.debuggerManager.activeCallFrame.scopeChain;
 
                 // First, normal function scope.
                 if (pauseCount === 1) {
-                    InspectorTest.expectThat(scopeChain[0].type === WebInspector.ScopeChainNode.Type.Closure, "Pause #1 - Top scope should be normal function Closure/Local scope.");
-                    WebInspector.debuggerManager.resume();
+                    InspectorTest.expectThat(scopeChain[0].type === WI.ScopeChainNode.Type.Closure, "Pause #1 - Top scope should be normal function Closure/Local scope.");
+                    WI.debuggerManager.resume();
                     return;
                 }
 
                 // Last, normal function scope.
                 if (pauseCount === pauseEventsExpected) {
-                    InspectorTest.expectThat(scopeChain[0].type === WebInspector.ScopeChainNode.Type.Closure, `Pause #${pauseCount} - Top scope should be normal function Closure/Local scope.`);
-                    WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, callFramesDidChangeListener);
-                    WebInspector.debuggerManager.resume();
+                    InspectorTest.expectThat(scopeChain[0].type === WI.ScopeChainNode.Type.Closure, `Pause #${pauseCount} - Top scope should be normal function Closure/Local scope.`);
+                    WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, callFramesDidChangeListener);
+                    WI.debuggerManager.resume();
                     resolve();
                     return;
                 }
 
                 // The first 15 cases the top scope should be a Block scope.
                 if (pauseCount <= 15) {
-                    InspectorTest.expectThat(scopeChain[0].type === WebInspector.ScopeChainNode.Type.Block, `Pause #${pauseCount} - Top scope should be Block scope.`);
-                    WebInspector.debuggerManager.resume();
+                    InspectorTest.expectThat(scopeChain[0].type === WI.ScopeChainNode.Type.Block, `Pause #${pauseCount} - Top scope should be Block scope.`);
+                    WI.debuggerManager.resume();
                     return;
                 }
 
                 // Print out the full scope of the last few where there are nested or buried block scopes.
-                InspectorTest.expectThat(scopeChain.some((scopeChain) => scopeChain.type === WebInspector.ScopeChainNode.Type.Block), `Pause #${pauseCount} - Contains a Block scope.`);
+                InspectorTest.expectThat(scopeChain.some((scopeChain) => scopeChain.type === WI.ScopeChainNode.Type.Block), `Pause #${pauseCount} - Contains a Block scope.`);
 
                 logScopeChain(scopeChain)
                 .then((result) => {
-                    WebInspector.debuggerManager.resume();
+                    WI.debuggerManager.resume();
                 });
             }
 
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, callFramesDidChangeListener);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, callFramesDidChangeListener);
             InspectorTest.evaluateInPage("setTimeout(testBlockScopes)");
         }
     });
@@ -180,6 +180,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Tests for the WebInspector.ScopeChainNode model object.</p>
+<p>Tests for the WI.ScopeChainNode model object.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/script-resource-relationship-expected.txt b/LayoutTests/inspector/model/script-resource-relationship-expected.txt
index 850a61c..984dcc1 100644
--- a/LayoutTests/inspector/model/script-resource-relationship-expected.txt
+++ b/LayoutTests/inspector/model/script-resource-relationship-expected.txt
@@ -1,7 +1,7 @@
-WebInspector.Script and WebInspector.Resource relationship.
+WI.Script and WI.Resource relationship.
 
 
-== Running test suite: WebInspector.Script and WebInspector.Resource relationship
+== Running test suite: WI.Script and WI.Resource relationship
 -- Running test case: ScriptWithResource
 PASS: Only one Script should be added.
 PASS: Resource and Script have the same URL.
diff --git a/LayoutTests/inspector/model/script-resource-relationship.html b/LayoutTests/inspector/model/script-resource-relationship.html
index cc00705..0f6849f 100644
--- a/LayoutTests/inspector/model/script-resource-relationship.html
+++ b/LayoutTests/inspector/model/script-resource-relationship.html
@@ -34,7 +34,7 @@
 
 function test()
 {
-    let suite = InspectorTest.createAsyncSuite("WebInspector.Script and WebInspector.Resource relationship");
+    let suite = InspectorTest.createAsyncSuite("WI.Script and WI.Resource relationship");
 
     function validateNormalRelationship(resource, script) {
         InspectorTest.expectThat(resource.url === script.url, "Resource and Script have the same URL.");
@@ -50,8 +50,8 @@
             let script = null;
             let resource = null;
             
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener);
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 resource = event.data.resource;
                 validateRelationship();
@@ -74,7 +74,7 @@
                 validateNormalRelationship(resource, script);
                 InspectorTest.expectThat(!script.sourceURL, "Script should not have a sourceURL.");
 
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener, null);
                 resolve();
             }
 
@@ -89,8 +89,8 @@
             let script = null;
             let resource = null;
 
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener);
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
             .then((event) => {
                 resource = event.data.resource;
                 validateRelationship();
@@ -112,7 +112,7 @@
 
                 validateNormalRelationship(resource, script);
                 InspectorTest.expectThat(script.sourceURL === "foo.js", "Script should have a sourceURL.");
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener, null);
                 resolve();
             }
 
@@ -124,8 +124,8 @@
         name: "ScriptWithoutResource",
         description: "A named eval does not have a resource.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
-            let resourceListener = WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener);
+            let resourceListener = WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                 InspectorTest.fail("Resource should not be added.");
                 reject();
             });
@@ -140,8 +140,8 @@
                 InspectorTest.expectThat(script.resource === null, "Script should not be associated with a Resource.");
                 InspectorTest.expectThat(script.sourceURL === "script-only.js", "Script should have a sourceURL.");
 
-                WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.ResourceWasAdded, resourceListener, null);
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+                WI.Frame.removeEventListener(WI.Frame.Event.ResourceWasAdded, resourceListener, null);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener, null);
                 resolve();
             }
 
@@ -153,7 +153,7 @@
         name: "DynamicallyAddedScriptElementNoResource",
         description: "A dynamically added script element has no resource.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener);
 
             function scriptListener(event) {
                 if (event.data.script.sourceURL !== "dynamically-added-script-element.js")
@@ -164,7 +164,7 @@
                 InspectorTest.expectThat(script.dynamicallyAddedScriptElement, "Script should identify as a dynamically added script element.");
                 InspectorTest.expectThat(script.resource === null, "Script should not be associated when a resource.");
 
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, scriptListener, null);
                 resolve();
             }
 
@@ -176,7 +176,7 @@
         name: "DocumentWithInlineScripts",
         description: "A document resource may be associated with multiple inline scripts.",
         test(resolve, reject) {
-            let mainResource = WebInspector.frameResourceManager.mainFrame.mainResource;
+            let mainResource = WI.frameResourceManager.mainFrame.mainResource;
             let scripts = mainResource.scripts.slice().sort((a, b) => a.range.startLine - b.range.startLine);
 
             // Scripts are:
@@ -205,6 +205,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>WebInspector.Script and WebInspector.Resource relationship.</p>
+<p>WI.Script and WI.Resource relationship.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/script-sourceType-expected.txt b/LayoutTests/inspector/model/script-sourceType-expected.txt
index 5aec25f..8b77a06 100644
--- a/LayoutTests/inspector/model/script-sourceType-expected.txt
+++ b/LayoutTests/inspector/model/script-sourceType-expected.txt
@@ -1,11 +1,11 @@
-Tests for WebInspector.Script.SourceType.
+Tests for WI.Script.SourceType.
 
 
-== Running test suite: WebInspector.Script.SourceType
--- Running test case: WebInspector.Script.SourceType.Program
+== Running test suite: WI.Script.SourceType
+-- Running test case: WI.Script.SourceType.Program
 PASS: <script> should be SourceType.Program.
 
--- Running test case: WebInspector.Script.SourceType.Module
+-- Running test case: WI.Script.SourceType.Module
 PASS: imported module should be SourceType.Module.
 PASS: <script type="module"> should be SourceType.Module.
 
diff --git a/LayoutTests/inspector/model/script-sourceType.html b/LayoutTests/inspector/model/script-sourceType.html
index a083f25..ee44dfe 100644
--- a/LayoutTests/inspector/model/script-sourceType.html
+++ b/LayoutTests/inspector/model/script-sourceType.html
@@ -18,42 +18,42 @@
 
 function test()
 {
-    let suite = InspectorTest.createAsyncSuite("WebInspector.Script.SourceType");
+    let suite = InspectorTest.createAsyncSuite("WI.Script.SourceType");
 
     suite.addTestCase({
-        name: "WebInspector.Script.SourceType.Program",
+        name: "WI.Script.SourceType.Program",
         description: "Normal <script src> should be Program.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerProgramScript()");
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 let script = event.data.script;
                 if (!/program.js$/.test(script.url))
                     return;
 
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
-                InspectorTest.expectEqual(script.sourceType, WebInspector.Script.SourceType.Program, `<script> should be SourceType.Program.`);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, listener);
+                InspectorTest.expectEqual(script.sourceType, WI.Script.SourceType.Program, `<script> should be SourceType.Program.`);
                 resolve();
             });
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.Script.SourceType.Module",
+        name: "WI.Script.SourceType.Module",
         description: "Module <script type=module> should be Module.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerModuleScript()");
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 let script = event.data.script;
                 if (!/module.js$/.test(script.url))
                     return;
 
                 if (/other-module.js$/.test(script.url)) {
-                    InspectorTest.expectEqual(script.sourceType, WebInspector.Script.SourceType.Module, `imported module should be SourceType.Module.`);
+                    InspectorTest.expectEqual(script.sourceType, WI.Script.SourceType.Module, `imported module should be SourceType.Module.`);
                     return;
                 }
 
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
-                InspectorTest.expectEqual(script.sourceType, WebInspector.Script.SourceType.Module, `<script type="module"> should be SourceType.Module.`);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, listener);
+                InspectorTest.expectEqual(script.sourceType, WI.Script.SourceType.Module, `<script type="module"> should be SourceType.Module.`);
                 resolve();
             });
         }
@@ -64,6 +64,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Tests for WebInspector.Script.SourceType.</p>
+<p>Tests for WI.Script.SourceType.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/model/stack-trace-expected.txt b/LayoutTests/inspector/model/stack-trace-expected.txt
index 97f8846..28de476 100644
--- a/LayoutTests/inspector/model/stack-trace-expected.txt
+++ b/LayoutTests/inspector/model/stack-trace-expected.txt
@@ -1,8 +1,8 @@
-Tests for the WebInspector.StackTrace model object.
+Tests for the WI.StackTrace model object.
 
 
-== Running test suite: WebInspector.StackTrace
--- Running test case: WebInspector.ConsoleMessage.StackTrace
+== Running test suite: WI.StackTrace
+-- Running test case: WI.ConsoleMessage.StackTrace
 PASS: ConsoleMessage type should be Trace.
 PASS: ConsoleMessage should have StackTrace.
 PASS: CallFrame in StackTrace has no identifier.
diff --git a/LayoutTests/inspector/model/stack-trace.html b/LayoutTests/inspector/model/stack-trace.html
index f29c8ef..130218d 100644
--- a/LayoutTests/inspector/model/stack-trace.html
+++ b/LayoutTests/inspector/model/stack-trace.html
@@ -25,19 +25,19 @@
         }
     }
 
-    let suite = InspectorTest.createAsyncSuite("WebInspector.StackTrace");
+    let suite = InspectorTest.createAsyncSuite("WI.StackTrace");
 
     suite.addTestCase({
-        name: "WebInspector.ConsoleMessage.StackTrace",
+        name: "WI.ConsoleMessage.StackTrace",
         description: "Test we can create a StackTrace from console messages (Console.StackTrace).",
         test(resolve, reject) {
-            WebInspector.logManager.awaitEvent(WebInspector.LogManager.Event.MessageAdded)
+            WI.logManager.awaitEvent(WI.LogManager.Event.MessageAdded)
             .then((event) => {
                 // Trace message should always have a stack trace.
                 let consoleMessage = event.data.message;
                 let stackTrace = consoleMessage.stackTrace;
-                InspectorTest.expectThat(consoleMessage.type === WebInspector.ConsoleMessage.MessageType.Trace, "ConsoleMessage type should be Trace.");
-                InspectorTest.expectThat(stackTrace instanceof WebInspector.StackTrace, "ConsoleMessage should have StackTrace.");
+                InspectorTest.expectThat(consoleMessage.type === WI.ConsoleMessage.MessageType.Trace, "ConsoleMessage type should be Trace.");
+                InspectorTest.expectThat(stackTrace instanceof WI.StackTrace, "ConsoleMessage should have StackTrace.");
 
                 // Console message stack trace call frame's do not have debugging information.
                 InspectorTest.expectThat(stackTrace.callFrames[0].id === null, "CallFrame in StackTrace has no identifier.");
@@ -57,6 +57,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Tests for the WebInspector.StackTrace model object.</p>
+<p>Tests for the WI.StackTrace model object.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/network/client-blocked-load.html b/LayoutTests/inspector/network/client-blocked-load.html
index f1b1374..1ad94a4 100644
--- a/LayoutTests/inspector/network/client-blocked-load.html
+++ b/LayoutTests/inspector/network/client-blocked-load.html
@@ -20,11 +20,11 @@
         description: "Trigger a blocked resource load and ensure we get notified of the request.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createBlockedResourceLoad()");
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                 let resource = event.data.resource;
-                InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
                 InspectorTest.expectThat(resource.url === "", "Request url should be rewritten to the null string.");
-                resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFail, (event) => {
+                resource.singleFireEventListener(WI.Resource.Event.LoadingDidFail, (event) => {
                     InspectorTest.pass("Resource load should fail.");
                     resolve();
                 });
diff --git a/LayoutTests/inspector/network/xhr-json-blob-has-content.html b/LayoutTests/inspector/network/xhr-json-blob-has-content.html
index 010cc59..4ed3efa 100644
--- a/LayoutTests/inspector/network/xhr-json-blob-has-content.html
+++ b/LayoutTests/inspector/network/xhr-json-blob-has-content.html
@@ -27,10 +27,10 @@
         description: "Ensure an XMLHttpRequest with JSON content still gives us text.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createJSONXHR()");
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                 let resource = event.data.resource;
-                InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
-                resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFinish, (event) => {
+                InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
+                resource.singleFireEventListener(WI.Resource.Event.LoadingDidFinish, (event) => {
                     InspectorTest.pass("Resource should complete loading.");
                     resource.requestContent().then(() => {
                         InspectorTest.expectThat(resource.content === jsonContent, "Resource has expected content.");
@@ -45,10 +45,10 @@
         description: "Ensure an XMLHttpRequest with JSON content and a responseType of blob still gives us text.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createJSONBlobXHR()");
-            WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+            WI.Frame.singleFireEventListener(WI.Frame.Event.ResourceWasAdded, (event) => {
                 let resource = event.data.resource;
-                InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
-                resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFinish, (event) => {
+                InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
+                resource.singleFireEventListener(WI.Resource.Event.LoadingDidFinish, (event) => {
                     InspectorTest.pass("Resource should complete loading.");
                     resource.requestContent().then(() => {
                         InspectorTest.expectThat(resource.content === jsonContent, "Resource has expected content.");
diff --git a/LayoutTests/inspector/page/filter-cookies-for-domain.html b/LayoutTests/inspector/page/filter-cookies-for-domain.html
index d2938aa..43fa809 100644
--- a/LayoutTests/inspector/page/filter-cookies-for-domain.html
+++ b/LayoutTests/inspector/page/filter-cookies-for-domain.html
@@ -164,7 +164,7 @@
 
             for (let cookieDomain in testcasesByCookieDomain) {
                 for (let expected of testcasesByCookieDomain[cookieDomain]) {
-                    let output = WebInspector.CookieStorageObject.cookieDomainMatchesResourceDomain(cookieDomain, expected.input);
+                    let output = WI.CookieStorageObject.cookieDomainMatchesResourceDomain(cookieDomain, expected.input);
                     let verdictText = expected.output ? "should match" : "should not match";
                     InspectorTest.expectThat(output === expected.output, `${cookieDomain} ${verdictText} ${expected.input}`);
                 }
diff --git a/LayoutTests/inspector/page/main-frame-resource.html b/LayoutTests/inspector/page/main-frame-resource.html
index db17a92..963ac93 100644
--- a/LayoutTests/inspector/page/main-frame-resource.html
+++ b/LayoutTests/inspector/page/main-frame-resource.html
@@ -5,8 +5,8 @@
 <script>
 function test()
 {
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, function(event) {
-        var url = WebInspector.frameResourceManager.mainFrame.url;
+    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, function(event) {
+        var url = WI.frameResourceManager.mainFrame.url;
         InspectorTest.log("Main frame: " + url.substring(url.lastIndexOf("/") + 1));
         InspectorTest.completeTest();
     });
diff --git a/LayoutTests/inspector/runtime/change-execution-context-identifier.html b/LayoutTests/inspector/runtime/change-execution-context-identifier.html
index 3960ad2..fef50b4 100644
--- a/LayoutTests/inspector/runtime/change-execution-context-identifier.html
+++ b/LayoutTests/inspector/runtime/change-execution-context-identifier.html
@@ -13,7 +13,7 @@
         name: "InitialScriptExecutionContext",
         description: "Test that the initial value of activeExecutionContext is the main context.",
         test(resolve, reject) {
-            InspectorTest.expectThat(WebInspector.runtimeManager.activeExecutionContext === WebInspector.mainTarget.executionContext, "The initial active execution context should be the main execution context.");
+            InspectorTest.expectThat(WI.runtimeManager.activeExecutionContext === WI.mainTarget.executionContext, "The initial active execution context should be the main execution context.");
             resolve();
         }
     });
@@ -22,7 +22,7 @@
         name: "ScriptExecutionContextMainContext",
         description: "Test that evaluateInInspectedWindow works when activeExecutionContext is the main execution context.",
         test(resolve, reject) {
-            WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+            WI.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
                 InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
                 InspectorTest.expectEqual(remoteObject.value, "coldwater", "The passphrase should match the phrase defined in the main frame.");
                 resolve();
@@ -34,8 +34,8 @@
         name: "ScriptExecutionContextMainFrameContext",
         description: "Test that evaluateInInspectedWindow works when activeExecutionContext is the main frame execution context. This is equivalent to the main context.",
         test(resolve, reject) {
-            WebInspector.runtimeManager.activeExecutionContext = WebInspector.frameResourceManager.mainFrame.pageExecutionContext;
-            WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+            WI.runtimeManager.activeExecutionContext = WI.frameResourceManager.mainFrame.pageExecutionContext;
+            WI.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
                 InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
                 InspectorTest.expectEqual(remoteObject.value, "coldwater", "The passphrase should match the phrase defined in the main frame.");
                 resolve();
@@ -47,12 +47,12 @@
         name: "ScriptExecutionContextSubFrame",
         description: "Test that evaluateInInspectedWindow works when activeExecutionContext is a subframe context.",
         test(resolve, reject) {
-            let mainFrame = WebInspector.frameResourceManager.mainFrame;
-            let subframes = WebInspector.frameResourceManager.frames.filter((frame) => frame !== mainFrame);
+            let mainFrame = WI.frameResourceManager.mainFrame;
+            let subframes = WI.frameResourceManager.frames.filter((frame) => frame !== mainFrame);
             InspectorTest.expectEqual(subframes.length, 1, "The test page should only have one sub-frame.");
 
-            WebInspector.runtimeManager.activeExecutionContext = subframes[0].pageExecutionContext;
-            WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+            WI.runtimeManager.activeExecutionContext = subframes[0].pageExecutionContext;
+            WI.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
                 InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
                 InspectorTest.expectEqual(remoteObject.value, "rosewater", "The passphrase should match the phrase defined in the subframe.");
                 resolve();
@@ -64,10 +64,10 @@
         name: "ScriptExecutionContextMainFrameAgain",
         description: "Test that evaluateInInspectedWindow works when activeExecutionContext switches back to the main frame execution context.",
         test(resolve, reject) {
-            let mainFrame = WebInspector.frameResourceManager.mainFrame;
+            let mainFrame = WI.frameResourceManager.mainFrame;
 
-            WebInspector.runtimeManager.activeExecutionContext = mainFrame.pageExecutionContext;
-            WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+            WI.runtimeManager.activeExecutionContext = mainFrame.pageExecutionContext;
+            WI.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
                 InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
                 InspectorTest.expectEqual(remoteObject.value, "coldwater", "The passphrase should match the phrase defined in the main frame.");
                 resolve();
@@ -79,20 +79,20 @@
         name: "ScriptExecutionContextRemoveSubframe",
         description: "Test that evaluateInInspectedWindow works when the activeExecutionContext is destroyed and reverts to the top-level context.",
         test(resolve, reject) {
-            let mainFrame = WebInspector.frameResourceManager.mainFrame;
-            let subframes = WebInspector.frameResourceManager.frames.filter((frame) => frame !== mainFrame);
+            let mainFrame = WI.frameResourceManager.mainFrame;
+            let subframes = WI.frameResourceManager.frames.filter((frame) => frame !== mainFrame);
             InspectorTest.expectEqual(subframes.length, 1, "The test page should only have one sub-frame.");
 
             // Set the execution context to the subframe so we can switch away from it when the frame is detached.
-            WebInspector.runtimeManager.activeExecutionContext = subframes[0].pageExecutionContext;
+            WI.runtimeManager.activeExecutionContext = subframes[0].pageExecutionContext;
 
             // Force-override the contextId, otherwise we won't be able to access the iframe's DOM element when evaluating in the iframe execution context.
             let expression = `document.getElementById("subframe").remove();`;
             let objectGroup = "test";
-            let contextId = WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier;
+            let contextId = WI.RuntimeManager.TopLevelExecutionContextIdentifier;
             RuntimeAgent.evaluate.invoke({expression, objectGroup, contextId}, () => {
-                InspectorTest.expectEqual(WebInspector.frameResourceManager.frames.length, 1, "The test page should now have no sub-frames.");
-                InspectorTest.expectEqual(WebInspector.runtimeManager.activeExecutionContext.id, WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier, "When a selected non-top-level execution context is removed, the active execution context should revert to the main frame context.");
+                InspectorTest.expectEqual(WI.frameResourceManager.frames.length, 1, "The test page should now have no sub-frames.");
+                InspectorTest.expectEqual(WI.runtimeManager.activeExecutionContext.id, WI.RuntimeManager.TopLevelExecutionContextIdentifier, "When a selected non-top-level execution context is removed, the active execution context should revert to the main frame context.");
                 resolve();
             });
         }
diff --git a/LayoutTests/inspector/runtime/getPreview.html b/LayoutTests/inspector/runtime/getPreview.html
index c05e4606..2271e2f 100644
--- a/LayoutTests/inspector/runtime/getPreview.html
+++ b/LayoutTests/inspector/runtime/getPreview.html
@@ -15,11 +15,11 @@
         test(resolve, reject) {
             RuntimeAgent.evaluate.invoke({expression: `({a:1, b:2})`, objectGroup: "test", generatePreview: false}, (error, remoteObjectPayload) => {
                 InspectorTest.assert(!error, "Should not be a protocol error.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(!remoteObject.preview, "RemoteObject should not have a preview.");
                 InspectorTest.expectThat(remoteObject.canLoadPreview(), "RemoteObject should be able to load a preview.");
                 remoteObject.updatePreview((preview) => {
-                    InspectorTest.expectThat(preview instanceof WebInspector.ObjectPreview, "RemoteObject.updatePreview should produce an ObjectPreview.");
+                    InspectorTest.expectThat(preview instanceof WI.ObjectPreview, "RemoteObject.updatePreview should produce an ObjectPreview.");
                     InspectorTest.expectEqual(remoteObject.preview, preview, "RemoteObject.preview should be the same object as the callback.");
                     InspectorTest.expectEqual(remoteObject.preview.propertyPreviews.length, 2, "Preview should have 2 properties.");
                     resolve();
@@ -34,14 +34,14 @@
         test(resolve, reject) {
             RuntimeAgent.evaluate.invoke({expression: `window.alpha = ({a:1, b:2, c:3})`, objectGroup: "test", generatePreview: true}, (error, remoteObjectPayload) => {
                 InspectorTest.assert(!error, "Should not be a protocol error.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 let originalPreview = remoteObject.preview;
                 InspectorTest.expectThat(remoteObject.preview, "RemoteObject should have a preview.");
                 InspectorTest.expectThat(remoteObject.canLoadPreview(), "RemoteObject should be able to load a preview.");
                 InspectorTest.expectEqual(originalPreview.propertyPreviews.length, 3, "Original preview should have 3 properties.");
                 InspectorTest.evaluateInPage(`window.alpha.d = 4`, () => {
                     remoteObject.updatePreview((preview) => {
-                        InspectorTest.expectThat(preview instanceof WebInspector.ObjectPreview, "RemoteObject.updatePreview should produce an ObjectPreview.");
+                        InspectorTest.expectThat(preview instanceof WI.ObjectPreview, "RemoteObject.updatePreview should produce an ObjectPreview.");
                         InspectorTest.expectEqual(remoteObject.preview, preview, "RemoteObject.preview should be the same object as the callback.");
                         InspectorTest.expectEqual(remoteObject.preview.propertyPreviews.length, 4, "Preview should now have 4 properties.");
                         resolve();
@@ -62,10 +62,10 @@
                 });
             }
 
-            testRemoteObject(WebInspector.RemoteObject.fromPrimitiveValue(true));
-            testRemoteObject(WebInspector.RemoteObject.fromPrimitiveValue(100));
-            testRemoteObject(WebInspector.RemoteObject.fromPrimitiveValue("str"));
-            testRemoteObject(WebInspector.RemoteObject.createFakeRemoteObject(), "fake object");
+            testRemoteObject(WI.RemoteObject.fromPrimitiveValue(true));
+            testRemoteObject(WI.RemoteObject.fromPrimitiveValue(100));
+            testRemoteObject(WI.RemoteObject.fromPrimitiveValue("str"));
+            testRemoteObject(WI.RemoteObject.createFakeRemoteObject(), "fake object");
             InspectorBackend.runAfterPendingDispatches(resolve);
         }
     });
@@ -75,7 +75,7 @@
         description: "Non-object RemoteObjects should not request a preview.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`Symbol.iterator`, (error, remoteObjectPayload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${remoteObject.type} RemoteObject.`);
                 remoteObject.updatePreview((preview) => {
                     InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${remoteObject.type} RemoteObject.`);
@@ -90,7 +90,7 @@
         description: "Non-object RemoteObjects should not request a preview.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`function f() {}; f`, (error, remoteObjectPayload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${remoteObject.type} RemoteObject.`);
                 remoteObject.updatePreview((preview) => {
                     InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${remoteObject.type} RemoteObject.`);
@@ -105,7 +105,7 @@
         description: "Non-object RemoteObjects should not request a preview.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`null`, (error, remoteObjectPayload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${remoteObject.subtype} RemoteObject.`);
                 remoteObject.updatePreview((preview) => {
                     InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${remoteObject.subtype} RemoteObject.`);
@@ -122,7 +122,7 @@
         description: "Runtime.getPreview should return an empty preview for non-objects.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`Symbol.iterator`, (error, remoteObjectPayload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 RuntimeAgent.getPreview(remoteObject.objectId, (error, result) => {
                     InspectorTest.log(JSON.stringify(result));
                     resolve();
@@ -136,7 +136,7 @@
         description: "Runtime.getPreview should return an empty preview for non-objects.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`function f() {}; f`, (error, remoteObjectPayload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 RuntimeAgent.getPreview(remoteObject.objectId, (error, result) => {
                     InspectorTest.log(JSON.stringify(result));
                     resolve();
diff --git a/LayoutTests/inspector/runtime/saveResult.html b/LayoutTests/inspector/runtime/saveResult.html
index 731ac25..f756bf3 100644
--- a/LayoutTests/inspector/runtime/saveResult.html
+++ b/LayoutTests/inspector/runtime/saveResult.html
@@ -17,7 +17,7 @@
         InspectorTest.evaluateInPage("(" + JSON.stringify(simpleObject) + ")", callback);
     }
 
-    let contextId = WebInspector.frameResourceManager.mainFrame.pageExecutionContext.id;
+    let contextId = WI.frameResourceManager.mainFrame.pageExecutionContext.id;
     let remoteObject1;
 
     let suite = InspectorTest.createAsyncSuite("Runtime.saveResult");
@@ -67,7 +67,7 @@
         test(resolve, reject) {
             RuntimeAgent.evaluate.invoke({expression: "$1", objectGroup: "test", includeCommandLineAPI: true}, (error, remoteObjectPayload, wasThrown, savedResultIndex) => {
                 InspectorTest.assert(!error, "Should not be a protocol error.");
-                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
+                let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
                 InspectorTest.assert(remoteObject.hasValue(), "RemoteObject for $1 should be a value, not an object.");
                 InspectorTest.expectThat(remoteObject.value === 123, "$1 value should be 123.");
                 resolve();
diff --git a/LayoutTests/inspector/sampling-profiler/basic.html b/LayoutTests/inspector/sampling-profiler/basic.html
index 1d9a1bc..d4737de 100644
--- a/LayoutTests/inspector/sampling-profiler/basic.html
+++ b/LayoutTests/inspector/sampling-profiler/basic.html
@@ -29,7 +29,7 @@
         description: "Sample some basic code.",
         test(resolve, reject) {
             InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
-                let tree = WebInspector.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
+                let tree = WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
                 let trace = [
                     {name: "foo"},
                     {name: "runFor"}
diff --git a/LayoutTests/inspector/sampling-profiler/call-frame-with-dom-functions.html b/LayoutTests/inspector/sampling-profiler/call-frame-with-dom-functions.html
index 3a19146..a78b1e0 100644
--- a/LayoutTests/inspector/sampling-profiler/call-frame-with-dom-functions.html
+++ b/LayoutTests/inspector/sampling-profiler/call-frame-with-dom-functions.html
@@ -30,7 +30,7 @@
         description: "Sample some basic code.",
         test(resolve, reject) {
             InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
-                let tree = WebInspector.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
+                let tree = WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
 
                 let trace = [
                     {name: "createElement"},
diff --git a/LayoutTests/inspector/sampling-profiler/eval-source-url.html b/LayoutTests/inspector/sampling-profiler/eval-source-url.html
index f66d024..ff9b2b3 100644
--- a/LayoutTests/inspector/sampling-profiler/eval-source-url.html
+++ b/LayoutTests/inspector/sampling-profiler/eval-source-url.html
@@ -34,7 +34,7 @@
         description: "Sample some basic code.",
         test(resolve, reject) {
             InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
-                let tree = WebInspector.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
+                let tree = WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
 
                 let trace = [
                     {name: "foo"},
diff --git a/LayoutTests/inspector/sampling-profiler/expression-location-info.html b/LayoutTests/inspector/sampling-profiler/expression-location-info.html
index 2e100ca..f1e36dc 100644
--- a/LayoutTests/inspector/sampling-profiler/expression-location-info.html
+++ b/LayoutTests/inspector/sampling-profiler/expression-location-info.html
@@ -37,7 +37,7 @@
         description: "Make sure we properly collect location information.",
         test(resolve, reject) {
             InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
-                let tree = WebInspector.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
+                let tree = WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
                 let foundLine19Column14 = false;
                 let foundLine25Column14 = false;
                 tree.forEachNode((node) => {
diff --git a/LayoutTests/inspector/sampling-profiler/many-call-frames.html b/LayoutTests/inspector/sampling-profiler/many-call-frames.html
index 38f46ef..1a6d01d 100644
--- a/LayoutTests/inspector/sampling-profiler/many-call-frames.html
+++ b/LayoutTests/inspector/sampling-profiler/many-call-frames.html
@@ -36,7 +36,7 @@
         description: "Sample some basic code.",
         test(resolve, reject) {
             InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
-                let tree = WebInspector.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
+                let tree = WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
 
                 let trace = [
                     {name: "top"},
diff --git a/LayoutTests/inspector/sampling-profiler/named-function-expression.html b/LayoutTests/inspector/sampling-profiler/named-function-expression.html
index 5c23c4b..063bc23 100644
--- a/LayoutTests/inspector/sampling-profiler/named-function-expression.html
+++ b/LayoutTests/inspector/sampling-profiler/named-function-expression.html
@@ -33,7 +33,7 @@
         description: "Sample some basic code.",
         test(resolve, reject) {
             InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
-                let tree = WebInspector.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
+                let tree = WI.CallingContextTree.__test_makeTreeFromProtocolMessageObject(messageObject);
                 let trace = [
                     {name: "bar"},
                     {name: "foo"},
diff --git a/LayoutTests/inspector/storage/domStorage-events-expected.txt b/LayoutTests/inspector/storage/domStorage-events-expected.txt
index a396836..c7c21ef 100644
--- a/LayoutTests/inspector/storage/domStorage-events-expected.txt
+++ b/LayoutTests/inspector/storage/domStorage-events-expected.txt
@@ -4,33 +4,33 @@
 == Running test suite: DOMStorage.Events
 -- Running test case: TestSessionStorage
 PASS: Should have a DOMStorageObject for sessionStorage.
-PASS: WebInspector.DOMStorageObject.Event.ItemAdded
+PASS: WI.DOMStorageObject.Event.ItemAdded
 PASS: Should add key 'foo'.
 PASS: Should have value 'value1'.
-PASS: WebInspector.DOMStorageObject.Event.ItemAdded
+PASS: WI.DOMStorageObject.Event.ItemAdded
 PASS: Should add key 'x'.
 PASS: Should have value 'xvalue'.
-PASS: WebInspector.DOMStorageObject.Event.ItemUpdated
+PASS: WI.DOMStorageObject.Event.ItemUpdated
 PASS: Should update key 'x'.
 PASS: Should have oldValue 'value1'.
 PASS: Should have new value 'value2'.
-PASS: WebInspector.DOMStorageObject.Event.ItemRemoved
+PASS: WI.DOMStorageObject.Event.ItemRemoved
 PASS: Should remove key 'x'.
-PASS: WebInspector.DOMStorageObject.Event.ItemsCleared
+PASS: WI.DOMStorageObject.Event.ItemsCleared
 
 -- Running test case: TestLocalStorage
 PASS: Should have a DOMStorageObject for localStorage.
-PASS: WebInspector.DOMStorageObject.Event.ItemAdded
+PASS: WI.DOMStorageObject.Event.ItemAdded
 PASS: Should add key 'foo'.
 PASS: Should have value 'value1'.
-PASS: WebInspector.DOMStorageObject.Event.ItemAdded
+PASS: WI.DOMStorageObject.Event.ItemAdded
 PASS: Should add key 'x'.
 PASS: Should have value 'xvalue'.
-PASS: WebInspector.DOMStorageObject.Event.ItemUpdated
+PASS: WI.DOMStorageObject.Event.ItemUpdated
 PASS: Should update key 'x'.
 PASS: Should have oldValue 'value1'.
 PASS: Should have new value 'value2'.
-PASS: WebInspector.DOMStorageObject.Event.ItemRemoved
+PASS: WI.DOMStorageObject.Event.ItemRemoved
 PASS: Should remove key 'x'.
-PASS: WebInspector.DOMStorageObject.Event.ItemsCleared
+PASS: WI.DOMStorageObject.Event.ItemsCleared
 
diff --git a/LayoutTests/inspector/storage/domStorage-events.html b/LayoutTests/inspector/storage/domStorage-events.html
index 97166b3..2f38c14 100644
--- a/LayoutTests/inspector/storage/domStorage-events.html
+++ b/LayoutTests/inspector/storage/domStorage-events.html
@@ -20,44 +20,44 @@
 {
     function testStorageEvents(storageObject, callback) {
         let count = 0;
-        storageObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemAdded, (event) => {
+        storageObject.addEventListener(WI.DOMStorageObject.Event.ItemAdded, (event) => {
             count++;
 
             if (count === 1) {
-                InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemAdded");
+                InspectorTest.pass("WI.DOMStorageObject.Event.ItemAdded");
                 InspectorTest.expectThat(event.data.key === "foo", "Should add key 'foo'.");
                 InspectorTest.expectThat(event.data.value === "value1", "Should have value 'value1'.");
                 return;
             }
 
             if (count === 2) {
-                InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemAdded");
+                InspectorTest.pass("WI.DOMStorageObject.Event.ItemAdded");
                 InspectorTest.expectThat(event.data.key === "x", "Should add key 'x'.");
                 InspectorTest.expectThat(event.data.value === "xvalue", "Should have value 'xvalue'.");
                 return;
             }
 
-            InspectorTest.fail("Unexpected WebInspector.DOMStorageObject.Event.ItemAdded");
+            InspectorTest.fail("Unexpected WI.DOMStorageObject.Event.ItemAdded");
         });
 
-        storageObject.awaitEvent(WebInspector.DOMStorageObject.Event.ItemRemoved)
+        storageObject.awaitEvent(WI.DOMStorageObject.Event.ItemRemoved)
         .then((event) => {
-            InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemRemoved");
+            InspectorTest.pass("WI.DOMStorageObject.Event.ItemRemoved");
             InspectorTest.expectThat(event.data.key === "foo", "Should remove key 'x'.");
         });
 
-        storageObject.awaitEvent(WebInspector.DOMStorageObject.Event.ItemUpdated)
+        storageObject.awaitEvent(WI.DOMStorageObject.Event.ItemUpdated)
         .then((event) => {
-            InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemUpdated");
+            InspectorTest.pass("WI.DOMStorageObject.Event.ItemUpdated");
             InspectorTest.expectThat(event.data.key === "foo", "Should update key 'x'.");
             InspectorTest.expectThat(event.data.oldValue === "value1", "Should have oldValue 'value1'.");
             InspectorTest.expectThat(event.data.value === "value2", "Should have new value 'value2'.");
         });
 
-        storageObject.awaitEvent(WebInspector.DOMStorageObject.Event.ItemsCleared)
+        storageObject.awaitEvent(WI.DOMStorageObject.Event.ItemsCleared)
         .then((event) => {
-            InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemsCleared");
-            storageObject.removeEventListener(WebInspector.DOMStorageObject.Event.ItemAdded, null, null);
+            InspectorTest.pass("WI.DOMStorageObject.Event.ItemsCleared");
+            storageObject.removeEventListener(WI.DOMStorageObject.Event.ItemAdded, null, null);
             callback();
         });
     }
@@ -69,7 +69,7 @@
         description: "Test backend generated DOMStorage added, removed, updated, and cleared events for sessionStorage.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerActions(sessionStorage)");
-            let sessionStorage = WebInspector.storageManager.domStorageObjects.find((x) => !x.isLocalStorage());
+            let sessionStorage = WI.storageManager.domStorageObjects.find((x) => !x.isLocalStorage());
             InspectorTest.expectThat(sessionStorage, "Should have a DOMStorageObject for sessionStorage.");
             testStorageEvents(sessionStorage, resolve);
         }
@@ -80,7 +80,7 @@
         description: "Test backend generated DOMStorage added, removed, updated, and cleared events for localStorage.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerActions(localStorage)");
-            let localStorage = WebInspector.storageManager.domStorageObjects.find((x) => x.isLocalStorage());
+            let localStorage = WI.storageManager.domStorageObjects.find((x) => x.isLocalStorage());
             InspectorTest.expectThat(localStorage, "Should have a DOMStorageObject for localStorage.");
             testStorageEvents(localStorage, resolve);
         }
diff --git a/LayoutTests/inspector/timeline/debugger-paused-while-recording.html b/LayoutTests/inspector/timeline/debugger-paused-while-recording.html
index 3589018..7cf68b4 100644
--- a/LayoutTests/inspector/timeline/debugger-paused-while-recording.html
+++ b/LayoutTests/inspector/timeline/debugger-paused-while-recording.html
@@ -28,41 +28,41 @@
 function test()
 {
     // First, set up the breakpoint, start timeline capturing, and trigger execution of installTimer().
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         var scriptObject = event.data.script;
 
         if (!/timeline-helper\.js$/.test(scriptObject.url))
             return;
 
         var location = scriptObject.createSourceCodeLocation(17, 0);  // Inside timeline-helper.js:hook()
-        var breakpoint = new WebInspector.Breakpoint(location);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        var breakpoint = new WI.Breakpoint(location);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.addResult("Added a breakpoint inside hook().")
 
-        WebInspector.timelineManager.startCapturing();
+        WI.timelineManager.startCapturing();
         InspectorTest.evaluateInPage("installTimer()");
     });
 
     // Second, the debugger will pause during timeline capturing. Resume, then stop timeline capturing.
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, function(event) {
             InspectorTest.addResult("Debugger paused; resuming...");
 
-            WebInspector.debuggerManager.resume().then(function() {
+            WI.debuggerManager.resume().then(function() {
                 InspectorTest.addResult("Debugger resumed; stopping timeline capture.");
-                WebInspector.timelineManager.stopCapturing();
+                WI.timelineManager.stopCapturing();
             })
     });
 
     // When timeline capturing stops, inspect the resulting timeline records for a profile.
-    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, function(event) {
-        var recording = WebInspector.timelineManager.activeRecording;
-        var scriptTimeline = recording.timelines.get(WebInspector.TimelineRecord.Type.Script);
+    WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, function(event) {
+        var recording = WI.timelineManager.activeRecording;
+        var scriptTimeline = recording.timelines.get(WI.TimelineRecord.Type.Script);
         console.assert(scriptTimeline);
 
         InspectorTest.addResult("Timeline capturing stopped. Inspecting the active recording....");
 
         for (var record of scriptTimeline.records) {
-            if (record.eventType !== WebInspector.ScriptTimelineRecord.EventType.TimerFired)
+            if (record.eventType !== WI.ScriptTimelineRecord.EventType.TimerFired)
                 continue;
 
             var result = record.profile ? "TRUE" : "FALSE";
diff --git a/LayoutTests/inspector/timeline/exception-in-injected-script-while-recording.html b/LayoutTests/inspector/timeline/exception-in-injected-script-while-recording.html
index 7e275b1..381820b 100644
--- a/LayoutTests/inspector/timeline/exception-in-injected-script-while-recording.html
+++ b/LayoutTests/inspector/timeline/exception-in-injected-script-while-recording.html
@@ -28,47 +28,47 @@
 function test()
 {
     // First, set up the breakpoint, start timeline capturing, and trigger execution of installTimer().
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
         var scriptObject = event.data.script;
 
         if (!/timeline-helper\.js$/.test(scriptObject.url))
             return;
 
         var location = scriptObject.createSourceCodeLocation(17, 0);  // Inside timeline-helper.js:hook()
-        var breakpoint = new WebInspector.Breakpoint(location);
-        WebInspector.debuggerManager.addBreakpoint(breakpoint);
+        var breakpoint = new WI.Breakpoint(location);
+        WI.debuggerManager.addBreakpoint(breakpoint);
         InspectorTest.addResult("Added a breakpoint inside hook().")
 
-        WebInspector.timelineManager.startCapturing();
+        WI.timelineManager.startCapturing();
         InspectorTest.evaluateInPage("installTimer()");
     });
 
     // Second, the debugger will pause during timeline capturing. Resume, then stop timeline capturing.
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, function(event) {
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, function(event) {
         InspectorTest.addResult("Debugger paused;");
         checkIfExceptionLoopsForever();
     });
 
     function checkIfExceptionLoopsForever() {
-        WebInspector.runtimeManager.evaluateInInspectedWindow("({}).x.x", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
+        WI.runtimeManager.evaluateInInspectedWindow("({}).x.x", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
             InspectorTest.addResult("An exception was " + (wasThrown ? "" : "not ") + "thrown from the injected script.");
-            WebInspector.debuggerManager.resume().then(function() {
+            WI.debuggerManager.resume().then(function() {
                 InspectorTest.addResult("Debugger resumed; stopping timeline capture.");
-                WebInspector.timelineManager.stopCapturing();
+                WI.timelineManager.stopCapturing();
             });
         });
     }
 
     // When timeline capturing stops, inspect the resulting timeline records for a profile.
-    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, function(event) {
-        var recording = WebInspector.timelineManager.activeRecording;
-        var scriptTimeline = recording.timelines.get(WebInspector.TimelineRecord.Type.Script);
+    WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, function(event) {
+        var recording = WI.timelineManager.activeRecording;
+        var scriptTimeline = recording.timelines.get(WI.TimelineRecord.Type.Script);
         console.assert(scriptTimeline);
 
         InspectorTest.addResult("Timeline capturing stopped. Inspecting the active recording....");
 
         for (var record of scriptTimeline.records) {
-            if (record.eventType !== WebInspector.ScriptTimelineRecord.EventType.TimerFired)
+            if (record.eventType !== WI.ScriptTimelineRecord.EventType.TimerFired)
                 continue;
 
             var result = record.profile ? "TRUE" : "FALSE";
diff --git a/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html b/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html
index 17443f8..fd159b3 100644
--- a/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html
+++ b/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html
@@ -13,7 +13,7 @@
         InspectorTest.log((condition ? "PASS" : "FAIL") + ": " + message);
     }
 
-    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, function(event) {
+    WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, function(event) {
         InspectorTest.assert(typeof event.data.startTime === "number");
         InspectorTest.assert(event.data.startTime > 0);
 
@@ -29,7 +29,7 @@
         recordingStartTime = event.data.startTime;
     });
 
-    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, function(event) {
+    WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, function(event) {
         InspectorTest.assert(typeof event.data.endTime === "number");
         InspectorTest.assert(event.data.endTime > 0);
 
diff --git a/LayoutTests/inspector/unit-tests/breakpoint-log-message-lexer.html b/LayoutTests/inspector/unit-tests/breakpoint-log-message-lexer.html
index 9d28564..dc2b31c 100644
--- a/LayoutTests/inspector/unit-tests/breakpoint-log-message-lexer.html
+++ b/LayoutTests/inspector/unit-tests/breakpoint-log-message-lexer.html
@@ -17,7 +17,7 @@
         suite.addTestCase({
             name,
             test() {
-                let lexer = new WebInspector.BreakpointLogMessageLexer;
+                let lexer = new WI.BreakpointLogMessageLexer;
                 let tokens = lexer.tokenize(input);
                 InspectorTest.log("Input: " + input);
                 InspectorTest.expectShallowEqual(tokens, expectedTokens, "Token stream should match expected tokens.");
@@ -37,7 +37,7 @@
         input: "hello world",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.PlainText,
+                type: WI.BreakpointLogMessageLexer.TokenType.PlainText,
                 data: "hello world",
             }
         ]
@@ -48,7 +48,7 @@
         input: "${x}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "x",
             }
         ]
@@ -59,7 +59,7 @@
         input: "${'x' + `${'y'}`}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "'x' + `${'y'}`",
             }
         ]
@@ -70,11 +70,11 @@
         input: "abc ${x}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.PlainText,
+                type: WI.BreakpointLogMessageLexer.TokenType.PlainText,
                 data: "abc ",
             },
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "x",
             },
         ]
@@ -85,11 +85,11 @@
         input: "${x} abc",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "x",
             },
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.PlainText,
+                type: WI.BreakpointLogMessageLexer.TokenType.PlainText,
                 data: " abc",
             },
         ]
@@ -100,7 +100,7 @@
         input: "${({a: '${}'}).a}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "({a: '${}'}).a",
             }
         ]
@@ -111,7 +111,7 @@
         input: "${/\\}/.test('${')}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "/\\}/.test('${')",
             }
         ]
@@ -122,15 +122,15 @@
         input: "${1} ${2}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "1",
             },
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.PlainText,
+                type: WI.BreakpointLogMessageLexer.TokenType.PlainText,
                 data: " ",
             },
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "2",
             }
         ]
@@ -141,11 +141,11 @@
         input: "${1}{2}",
         expectedTokens: [
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.Expression,
+                type: WI.BreakpointLogMessageLexer.TokenType.Expression,
                 data: "1",
             },
             {
-                type: WebInspector.BreakpointLogMessageLexer.TokenType.PlainText,
+                type: WI.BreakpointLogMessageLexer.TokenType.PlainText,
                 data: "{2}",
             },
         ]
diff --git a/LayoutTests/inspector/unit-tests/collection-expected.txt b/LayoutTests/inspector/unit-tests/collection-expected.txt
index 2e4c517..d5b47e7 100644
--- a/LayoutTests/inspector/unit-tests/collection-expected.txt
+++ b/LayoutTests/inspector/unit-tests/collection-expected.txt
@@ -2,19 +2,19 @@
 
 
 == Running test suite: Collection
--- Running test case: WebInspector.Collection.prototype.add
+-- Running test case: WI.Collection.prototype.add
 ["one","two"]
 ["one","two",3]
 
--- Running test case: WebInspector.Collection.prototype.remove
+-- Running test case: WI.Collection.prototype.remove
 ["one","two"]
 ["two"]
 
--- Running test case: WebInspector.Collection.prototype.clear
+-- Running test case: WI.Collection.prototype.clear
 ["one","two",3]
 []
 
--- Running test case: WebInspector.Collection.prototype.get typeVerifier
+-- Running test case: WI.Collection.prototype.get typeVerifier
 ["one","two"]
 ["one","two"]
 PASS: typeVerifier is the given function.
diff --git a/LayoutTests/inspector/unit-tests/collection.html b/LayoutTests/inspector/unit-tests/collection.html
index 3225a47..62b33e8 100644
--- a/LayoutTests/inspector/unit-tests/collection.html
+++ b/LayoutTests/inspector/unit-tests/collection.html
@@ -8,9 +8,9 @@
     let suite = InspectorTest.createAsyncSuite("Collection");
 
     suite.addTestCase({
-        name: "WebInspector.Collection.prototype.add",
+        name: "WI.Collection.prototype.add",
         test(resolve, reject) {
-            let collection = new WebInspector.Collection;
+            let collection = new WI.Collection;
             collection.add("one");
             collection.add("two");
 
@@ -25,11 +25,11 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Collection.prototype.remove",
+        name: "WI.Collection.prototype.remove",
         test(resolve, reject) {
             let item = "one";
 
-            let collection = new WebInspector.Collection;
+            let collection = new WI.Collection;
             collection.add(item);
             collection.add("two");
 
@@ -44,9 +44,9 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Collection.prototype.clear",
+        name: "WI.Collection.prototype.clear",
         test(resolve, reject) {
-            let collection = new WebInspector.Collection;
+            let collection = new WI.Collection;
             collection.add("one");
             collection.add("two");
             collection.add(3);
@@ -62,13 +62,13 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Collection.prototype.get typeVerifier",
+        name: "WI.Collection.prototype.get typeVerifier",
         test(resolve, reject) {
             function stringVerifier(object) {
                 return typeof object === "string";
             }
 
-            let collection = new WebInspector.Collection(stringVerifier);
+            let collection = new WI.Collection(stringVerifier);
             collection.add("one");
             collection.add("two");
 
diff --git a/LayoutTests/inspector/unit-tests/event-listener-expected.txt b/LayoutTests/inspector/unit-tests/event-listener-expected.txt
index f140c08..aff8700 100644
--- a/LayoutTests/inspector/unit-tests/event-listener-expected.txt
+++ b/LayoutTests/inspector/unit-tests/event-listener-expected.txt
@@ -1,4 +1,4 @@
-Testing basic functionality of WebInspector.EventListener.
+Testing basic functionality of WI.EventListener.
 
 Connecting the listener.
 Invoked callback for kaboom event.
diff --git a/LayoutTests/inspector/unit-tests/event-listener-set-expected.txt b/LayoutTests/inspector/unit-tests/event-listener-set-expected.txt
index 658f1aa..8151e2e 100644
--- a/LayoutTests/inspector/unit-tests/event-listener-set-expected.txt
+++ b/LayoutTests/inspector/unit-tests/event-listener-set-expected.txt
@@ -1,4 +1,4 @@
-Testing basic functionality of WebInspector.EventListenerSet.
+Testing basic functionality of WI.EventListenerSet.
 
 Registering listeners.
 Installing listeners.
diff --git a/LayoutTests/inspector/unit-tests/event-listener-set.html b/LayoutTests/inspector/unit-tests/event-listener-set.html
index 95b44b9..db567bb 100644
--- a/LayoutTests/inspector/unit-tests/event-listener-set.html
+++ b/LayoutTests/inspector/unit-tests/event-listener-set.html
@@ -8,10 +8,10 @@
     const FooEvent = "foo";
     const BarEvent = "bar";
     const BazEvent = "baz";
-    var emitter1 = new WebInspector.Object();
-    var emitter2 = new WebInspector.Object();
-    var context1 = new WebInspector.Object();
-    var context2 = new WebInspector.Object();
+    var emitter1 = new WI.Object();
+    var emitter2 = new WI.Object();
+    var context1 = new WI.Object();
+    var context2 = new WI.Object();
     var data1 = [1, 2, 3];
     var data2 = [4, 6, 8];
 
@@ -44,7 +44,7 @@
 
     // Test for multiple firings of listeners in the set.
 
-    var listenerSet = new WebInspector.EventListenerSet(context1);
+    var listenerSet = new WI.EventListenerSet(context1);
     InspectorTest.assert(!emitter1.hasEventListeners(FooEvent), "Emitter should not have any listeners.");
     emitter1.dispatchEventToListeners(FooEvent, data1); // Should not fire anything.
 
@@ -112,6 +112,6 @@
 </script>
 </head>
 <body onload="runTest()">
-    <p>Testing basic functionality of WebInspector.EventListenerSet.</p>
+    <p>Testing basic functionality of WI.EventListenerSet.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/unit-tests/event-listener.html b/LayoutTests/inspector/unit-tests/event-listener.html
index f353e55..75a1894 100644
--- a/LayoutTests/inspector/unit-tests/event-listener.html
+++ b/LayoutTests/inspector/unit-tests/event-listener.html
@@ -6,8 +6,8 @@
 function test()
 {
     const KaboomEvent = "kaboom";
-    var emitter = new WebInspector.Object();
-    var context = new WebInspector.Object();
+    var emitter = new WI.Object();
+    var context = new WI.Object();
     var data = [1, 2, 3];
 
     function kaboomCallback(event) {
@@ -20,7 +20,7 @@
 
     // Test for multiple firings of the listener.
 
-    var listener = new WebInspector.EventListener(context);
+    var listener = new WI.EventListener(context);
     InspectorTest.assert(!emitter.hasEventListeners(KaboomEvent), "Emitter should not have any listeners.");
     emitter.dispatchEventToListeners(KaboomEvent, data); // Should not fire anything.
 
@@ -52,7 +52,7 @@
 
     // Test for single firing of the listener.
 
-    var singleListener = new WebInspector.EventListener(context, true);
+    var singleListener = new WI.EventListener(context, true);
     InspectorTest.assert(!emitter.hasEventListeners(KaboomEvent), "Emitter should not have any listeners.");
     emitter.dispatchEventToListeners(KaboomEvent, data); // Should not fire anything.
 
@@ -68,13 +68,13 @@
 
     // Test for various error cases and abuse.
 
-    var badListener = new WebInspector.EventListener(context);
+    var badListener = new WI.EventListener(context);
     badListener.connect(data, data, data); // Should complain about non-callable callback.
     badListener.connect(null, KaboomEvent, kaboomCallback); // Should complain about non-callable callback.
     badListener.connect(emitter, KaboomEvent, null); // Should complain about non-callable callback.
     badListener.connect(emitter, null, kaboomCallback); // Should complain about null event.
 
-    var badListener2 = new WebInspector.EventListener(context);
+    var badListener2 = new WI.EventListener(context);
     badListener2.disconnect(); // Should complain about already disconnected.
     badListener2.connect(emitter, KaboomEvent, kaboomCallback);
     badListener2.connect(emitter, KaboomEvent, kaboomCallback); // Should complain about already connected.
@@ -88,6 +88,6 @@
 </script>
 </head>
 <body onload="runTest()">
-    <p>Testing basic functionality of WebInspector.EventListener.</p>
+    <p>Testing basic functionality of WI.EventListener.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/unit-tests/heap-snapshot-collection-event.html b/LayoutTests/inspector/unit-tests/heap-snapshot-collection-event.html
index 086d362..dff6d00 100644
--- a/LayoutTests/inspector/unit-tests/heap-snapshot-collection-event.html
+++ b/LayoutTests/inspector/unit-tests/heap-snapshot-collection-event.html
@@ -25,9 +25,9 @@
             InspectorTest.evaluateInPage("triggerCreateObjects()");
             HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
                 InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                    snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                    snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                     InspectorTest.expectThat(snapshot, "Should create HeapSnapshotProxy snapshot.");
                     resolve();
                 });
@@ -40,7 +40,7 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerRemoveObjects()");
 
-            let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+            let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
             HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
                 InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
                 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
diff --git a/LayoutTests/inspector/unit-tests/heap-snapshot.html b/LayoutTests/inspector/unit-tests/heap-snapshot.html
index 470c579..60bf289 100644
--- a/LayoutTests/inspector/unit-tests/heap-snapshot.html
+++ b/LayoutTests/inspector/unit-tests/heap-snapshot.html
@@ -7,7 +7,7 @@
 {
     // Simple HeapSnapshot representation.
 
-    WebInspector.TestHeapSnapshotNode = class TestHeapSnapshotNode
+    WI.TestHeapSnapshotNode = class TestHeapSnapshotNode
     {
         constructor(identifier, className, size, internal)
         {
@@ -21,7 +21,7 @@
         }
     }
 
-    WebInspector.TestHeapSnapshotEdge = class TestHeapSnapshotEdge
+    WI.TestHeapSnapshotEdge = class TestHeapSnapshotEdge
     {
         constructor(from, to, type, data)
         {
@@ -32,12 +32,12 @@
         }
     };
 
-    WebInspector.TestHeapSnapshot = class TestHeapSnapshot
+    WI.TestHeapSnapshot = class TestHeapSnapshot
     {
         constructor(rootNode, nodes, nodeMap)
         {
-            console.assert(rootNode instanceof WebInspector.TestHeapSnapshotNode);
-            console.assert(nodes.every((n) => n instanceof WebInspector.TestHeapSnapshotNode));
+            console.assert(rootNode instanceof WI.TestHeapSnapshotNode);
+            console.assert(nodes.every((n) => n instanceof WI.TestHeapSnapshotNode));
 
             this.rootNode = rootNode;
             this.nodes = nodes;
@@ -61,7 +61,7 @@
                 let classNameIndex = nodes[i++];
                 let internal = nodes[i++];
 
-                let node = new WebInspector.TestHeapSnapshotNode(id, nodeClassNames[classNameIndex], size, !!internal);
+                let node = new WI.TestHeapSnapshotNode(id, nodeClassNames[classNameIndex], size, !!internal);
                 nodeMap.set(id, node);
                 processedNodes.push(node);
             }
@@ -79,7 +79,7 @@
                 if (type === "Property" || type === "Variable")
                     data = edgeNames[data];
 
-                let edge = new WebInspector.TestHeapSnapshotEdge(from, to, type, data);
+                let edge = new WI.TestHeapSnapshotEdge(from, to, type, data);
                 from.outgoingEdges.push(edge);
                 to.incomingEdges.push(edge);
             }
@@ -95,7 +95,7 @@
             for (let i = 0, length = rootNodeEdges.length; i < length; ++i)
                 rootNodeEdges[i].to.gcRoot = true;
 
-            return new WebInspector.TestHeapSnapshot(rootNode, processedNodes, nodeMap);
+            return new WI.TestHeapSnapshot(rootNode, processedNodes, nodeMap);
         }
 
         // Public
@@ -135,10 +135,10 @@
         test(resolve, reject) {
             HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
                 InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
-                testSnapshot = WebInspector.TestHeapSnapshot.fromPayload(JSON.parse(snapshotStringData));
-                let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+                testSnapshot = WI.TestHeapSnapshot.fromPayload(JSON.parse(snapshotStringData));
+                let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
                 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                    snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                    snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                     InspectorTest.assert(testSnapshot, "Created TestHeapSnapshot");
                     InspectorTest.assert(snapshot, "Created HeapSnapshotProxy");
                     InspectorTest.expectThat(snapshot.totalSize === testSnapshot.totalSize, "Snapshots totalSize should match.");
diff --git a/LayoutTests/inspector/unit-tests/object-expected.txt b/LayoutTests/inspector/unit-tests/object-expected.txt
index 6f1e9c9..288e44b 100644
--- a/LayoutTests/inspector/unit-tests/object-expected.txt
+++ b/LayoutTests/inspector/unit-tests/object-expected.txt
@@ -1,11 +1,11 @@
-Testing WebInspector.Object.
+Testing WI.Object.
 
 
 == Running test suite: Object
--- Running test case: WebInspector.Object.prototype.dispatchEventToListeners
+-- Running test case: WI.Object.prototype.dispatchEventToListeners
 Dispatch count: 1
 
--- Running test case: WebInspector.Object.prototype.awaitEvent
+-- Running test case: WI.Object.prototype.awaitEvent
 PASS: Await event handler should be dispatched just once.
 Dispatch count: 1
 
diff --git a/LayoutTests/inspector/unit-tests/object.html b/LayoutTests/inspector/unit-tests/object.html
index b8c5f90..f44434a 100644
--- a/LayoutTests/inspector/unit-tests/object.html
+++ b/LayoutTests/inspector/unit-tests/object.html
@@ -8,10 +8,10 @@
     let suite = InspectorTest.createAsyncSuite("Object");
 
     suite.addTestCase({
-        name: "WebInspector.Object.prototype.dispatchEventToListeners",
-        description: "WebInspector.Object shouldn't dispatch constructor-level events multiple times",
+        name: "WI.Object.prototype.dispatchEventToListeners",
+        description: "WI.Object shouldn't dispatch constructor-level events multiple times",
         test(resolve, reject) {
-            class Parent extends WebInspector.Object {}
+            class Parent extends WI.Object {}
             class Child extends Parent {}
 
             const eventName = "clicked";
@@ -29,13 +29,13 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.Object.prototype.awaitEvent",
+        name: "WI.Object.prototype.awaitEvent",
         description: "awaitEvent should only trigger once",
         test(resolve, reject) {
             const eventName = "test";
             let dispatchCount = 0;
 
-            let object = new WebInspector.Object;
+            let object = new WI.Object;
 
             object.awaitEvent(eventName).then(() => {
                 dispatchCount++;
@@ -60,6 +60,6 @@
 </script>
 </head>
 <body onload="runTest()">
-    <p>Testing WebInspector.Object.</p>
+    <p>Testing WI.Object.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/unit-tests/resource-collection-expected.txt b/LayoutTests/inspector/unit-tests/resource-collection-expected.txt
index 28bea09..51bc966 100644
--- a/LayoutTests/inspector/unit-tests/resource-collection-expected.txt
+++ b/LayoutTests/inspector/unit-tests/resource-collection-expected.txt
@@ -2,15 +2,15 @@
 
 
 == Running test suite: ResourceCollection
--- Running test case: WebInspector.ResourceCollection.verifierForType
+-- Running test case: WI.ResourceCollection.verifierForType
 ["two"]
 
--- Running test case: WebInspector.ResourceCollection.prototype.resourceCollectionForType
+-- Running test case: WI.ResourceCollection.prototype.resourceCollectionForType
 ["one","three"]
 ["one","three"]
 PASS: resourceCollectionForType will return `this` if a type is specified.
 
--- Running test case: WebInspector.ResourceCollection.prototype._resourceTypeDidChange
+-- Running test case: WI.ResourceCollection.prototype._resourceTypeDidChange
 ["one"]
 []
 ["one"]
diff --git a/LayoutTests/inspector/unit-tests/resource-collection.html b/LayoutTests/inspector/unit-tests/resource-collection.html
index 6d54c30..e39aaa5 100644
--- a/LayoutTests/inspector/unit-tests/resource-collection.html
+++ b/LayoutTests/inspector/unit-tests/resource-collection.html
@@ -8,7 +8,7 @@
     let suite = InspectorTest.createAsyncSuite("ResourceCollection");
 
     function createResource(url, type) {
-        return new WebInspector.Resource(url, null, type);
+        return new WI.Resource(url, null, type);
     }
 
     function logResourceNames(collection) {
@@ -17,11 +17,11 @@
     }
 
     suite.addTestCase({
-        name: "WebInspector.ResourceCollection.verifierForType",
+        name: "WI.ResourceCollection.verifierForType",
         test(resolve, reject) {
-            let collection = new WebInspector.ResourceCollection(WebInspector.Resource.Type.Image);
+            let collection = new WI.ResourceCollection(WI.Resource.Type.Image);
             collection.add(createResource("one"));
-            collection.add(createResource("two", WebInspector.Resource.Type.Image));
+            collection.add(createResource("two", WI.Resource.Type.Image));
             collection.add(3);
 
             logResourceNames(collection);
@@ -31,48 +31,48 @@
     });
 
     suite.addTestCase({
-        name: "WebInspector.ResourceCollection.prototype.resourceCollectionForType",
+        name: "WI.ResourceCollection.prototype.resourceCollectionForType",
         test(resolve, reject) {
-            let collection = new WebInspector.ResourceCollection;
-            collection.add(createResource("one", WebInspector.Resource.Type.Image));
-            collection.add(createResource("two", WebInspector.Resource.Type.Stylesheet));
-            collection.add(createResource("three", WebInspector.Resource.Type.Image));
-            collection.add(createResource("four", WebInspector.Resource.Type.Document));
-            collection.add(createResource("five", WebInspector.Resource.Type.Stylesheet));
+            let collection = new WI.ResourceCollection;
+            collection.add(createResource("one", WI.Resource.Type.Image));
+            collection.add(createResource("two", WI.Resource.Type.Stylesheet));
+            collection.add(createResource("three", WI.Resource.Type.Image));
+            collection.add(createResource("four", WI.Resource.Type.Document));
+            collection.add(createResource("five", WI.Resource.Type.Stylesheet));
 
-            logResourceNames(collection.resourceCollectionForType(WebInspector.Resource.Type.Image));
+            logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Image));
 
-            let typedCollection = new WebInspector.ResourceCollection(WebInspector.Resource.Type.Image);
-            typedCollection.add(createResource("one", WebInspector.Resource.Type.Image));
-            typedCollection.add(createResource("two", WebInspector.Resource.Type.Stylesheet));
-            typedCollection.add(createResource("three", WebInspector.Resource.Type.Image));
+            let typedCollection = new WI.ResourceCollection(WI.Resource.Type.Image);
+            typedCollection.add(createResource("one", WI.Resource.Type.Image));
+            typedCollection.add(createResource("two", WI.Resource.Type.Stylesheet));
+            typedCollection.add(createResource("three", WI.Resource.Type.Image));
 
             logResourceNames(typedCollection);
-            InspectorTest.expectEqual(typedCollection.resourceCollectionForType(WebInspector.Resource.Type.Image), typedCollection, "resourceCollectionForType will return `this` if a type is specified.")
+            InspectorTest.expectEqual(typedCollection.resourceCollectionForType(WI.Resource.Type.Image), typedCollection, "resourceCollectionForType will return `this` if a type is specified.")
 
             resolve();
         }
     });
 
     suite.addTestCase({
-        name: "WebInspector.ResourceCollection.prototype._resourceTypeDidChange",
+        name: "WI.ResourceCollection.prototype._resourceTypeDidChange",
         test(resolve, reject) {
             let imageResource = createResource("one");
 
-            let collection = new WebInspector.ResourceCollection;
+            let collection = new WI.ResourceCollection;
             collection.add(imageResource);
 
             logResourceNames(collection);
-            logResourceNames(collection.resourceCollectionForType(WebInspector.Resource.Type.Image));
-            logResourceNames(collection.resourceCollectionForType(WebInspector.Resource.Type.Other));
+            logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Image));
+            logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Other));
 
             // Dispatch a type change.
-            imageResource._type = WebInspector.Resource.Type.Image;
-            imageResource.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange, {oldType: WebInspector.Resource.Type.Image});
+            imageResource._type = WI.Resource.Type.Image;
+            imageResource.dispatchEventToListeners(WI.Resource.Event.TypeDidChange, {oldType: WI.Resource.Type.Image});
 
             logResourceNames(collection);
-            logResourceNames(collection.resourceCollectionForType(WebInspector.Resource.Type.Image));
-            logResourceNames(collection.resourceCollectionForType(WebInspector.Resource.Type.Other));
+            logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Image));
+            logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Other));
 
             resolve();
         }
diff --git a/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt b/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt
index 880eb31..4419842 100644
--- a/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt
+++ b/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt
@@ -1,4 +1,4 @@
-Testing WebInspector.ResourceQueryController.
+Testing WI.ResourceQueryController.
 
 
 == Running test suite: ResourceQueryController
diff --git a/LayoutTests/inspector/unit-tests/resource-query-controller.html b/LayoutTests/inspector/unit-tests/resource-query-controller.html
index db3a3ab..d5ba2f3 100644
--- a/LayoutTests/inspector/unit-tests/resource-query-controller.html
+++ b/LayoutTests/inspector/unit-tests/resource-query-controller.html
@@ -11,7 +11,7 @@
         name: "FindSpecialCharacterIndices",
         description: "Should correctly find special filename characters.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let tests = [
                 {
                     filename: "Abcd",
@@ -70,7 +70,7 @@
         name: "ExecuteQueryAgainstNoResources",
         description: "Should return no results if no resources were added to the controller.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let results = matcher.executeQuery("abcde");
             InspectorTest.expectThat(!results.length, "Should return no results.")
         }
@@ -81,8 +81,8 @@
         description: "Empty queries and queries containing only whitespace should return no results.",
         test() {
             const whitespaceCharacters = " \t\r\n";
-            let matcher = new WebInspector.ResourceQueryController;
-            matcher.addResource(new WebInspector.Resource("abcde"));
+            let matcher = new WI.ResourceQueryController;
+            matcher.addResource(new WI.Resource("abcde"));
 
             for (let query of whitespaceCharacters) {
                 let results = matcher.executeQuery(query);
@@ -98,8 +98,8 @@
         name: "ExecuteQueryContainingWhitespace",
         description: "Whitespace within a query should be ignored.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
-            matcher.addResource(new WebInspector.Resource("abcde"));
+            let matcher = new WI.ResourceQueryController;
+            matcher.addResource(new WI.Resource("abcde"));
 
             for (let query of [" abcde", "abcde ", " abcde ", "a b c d e", "a  b  c  d  e"]) {
                 let results = matcher.executeQuery(query);
@@ -112,7 +112,7 @@
         name: "ExecuteQueryMatchNone",
         description: "Should not find a match.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let tests = [
                 {query: "abcde", filename: "abcd"},
                 {query: "abcd-", filename: "abcde"},
@@ -121,7 +121,7 @@
 
             for (let {query, filename} of tests) {
                 matcher.reset();
-                matcher.addResource(new WebInspector.Resource(filename));
+                matcher.addResource(new WI.Resource(filename));
                 let results = matcher.executeQuery(query);
                 InspectorTest.expectThat(!results.length, `Query "${query}" shouldn't match "${filename}".`);
             }
@@ -132,7 +132,7 @@
         name: "ExecuteQueryMatchesExpectedCharacters",
         description: "Should match the expected query characters.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let tests = [
                 {
                     query: "abcd",
@@ -188,7 +188,7 @@
 
             for (let {query, filename, expected} of tests) {
                 matcher.reset();
-                matcher.addResource(new WebInspector.Resource(filename));
+                matcher.addResource(new WI.Resource(filename));
 
                 let results = matcher.executeQuery(query);
                 InspectorTest.assert(results.length === 1, "Should return exactly one match.");
@@ -223,7 +223,7 @@
         name: "ExecuteQueryShouldIgnoreCase",
         description: "Queries that differ only in case should return identical results.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let tests = [
                 {
                     query: "abcd",
@@ -256,7 +256,7 @@
                 InspectorTest.log(`All case permutations of query "${query}" should match "${expected}" in "${filename}".`);
 
                 matcher.reset();
-                matcher.addResource(new WebInspector.Resource(filename));
+                matcher.addResource(new WI.Resource(filename));
 
                 for (let queryPermutation of casePermutations(query)) {
                     let results = matcher.executeQuery(queryPermutation);
@@ -272,8 +272,8 @@
         description: "Check that query results are ranked by descending relevance.",
         test() {
             let filenames = ["AbCdE", "AbcDe", "abcde", "AxbcDe", "AxBxCxDxEx", "AxbxcDe", "xabcde"]; // Filenames in order of descending rank.
-            let matcher = new WebInspector.ResourceQueryController;
-            filenames.forEach((filename) => matcher.addResource(new WebInspector.Resource(filename)));
+            let matcher = new WI.ResourceQueryController;
+            filenames.forEach((filename) => matcher.addResource(new WI.Resource(filename)));
 
             let query = "abcde";
             let results = matcher.executeQuery(query);
@@ -287,8 +287,8 @@
         description: "Check that matches close to the beginning of the filename rank higher.",
         test() {
             let filenames = ["bcd", "BxCxDx", "AxBxCxDx", "abcd", "xxxAxxxBxxxCxxxD"]; // Filenames in order of descending rank.
-            let matcher = new WebInspector.ResourceQueryController;
-            filenames.forEach((filename) => matcher.addResource(new WebInspector.Resource(filename)));
+            let matcher = new WI.ResourceQueryController;
+            filenames.forEach((filename) => matcher.addResource(new WI.Resource(filename)));
 
             let query = "bcd";
             let results = matcher.executeQuery(query);
@@ -301,7 +301,7 @@
         name: "ExecuteQueryConsecutiveRankings",
         description: "Check that consecutive matches rank higher.",
         test() {
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let tests = [
                 {
                     filenames: ["Color.js", "HighlightColor.js", "CxxOxxLxxOxxR.js"],
@@ -320,7 +320,7 @@
             let passed = true;
             for (let {filenames, query} of tests) {
                 matcher.reset();
-                filenames.forEach((filename) => matcher.addResource(new WebInspector.Resource(filename)));
+                filenames.forEach((filename) => matcher.addResource(new WI.Resource(filename)));
 
                 let results = matcher.executeQuery(query);
                 let resultFilenames = results.map((result) => result.resource.displayName);
@@ -337,10 +337,10 @@
         description: "Check that query result TextRanges are correct.",
         test() {
             function textRange(start, end) {
-                return new WebInspector.TextRange(0, start, 0, end);
+                return new WI.TextRange(0, start, 0, end);
             }
 
-            let matcher = new WebInspector.ResourceQueryController;
+            let matcher = new WI.ResourceQueryController;
             let tests = [
                 {filename: "a", ranges: []},
                 {filename: "abcde", ranges: [textRange(0, 5)]},
@@ -349,7 +349,7 @@
 
             for (let {filename, ranges} of tests) {
                 matcher.reset();
-                matcher.addResource(new WebInspector.Resource(filename));
+                matcher.addResource(new WI.Resource(filename));
 
                 let results = matcher.executeQuery("abcde");
                 let resultTextRanges = results.length ? results[0].matchingTextRanges : [];
@@ -363,6 +363,6 @@
 </script>
 </head>
 <body onload="runTest()">
-    <p>Testing WebInspector.ResourceQueryController.</p>
+    <p>Testing WI.ResourceQueryController.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/unit-tests/target-manager-expected.txt b/LayoutTests/inspector/unit-tests/target-manager-expected.txt
index bc6f9ed..608f237 100644
--- a/LayoutTests/inspector/unit-tests/target-manager-expected.txt
+++ b/LayoutTests/inspector/unit-tests/target-manager-expected.txt
@@ -1,4 +1,4 @@
-Test for TargetManager and other global WebInspector.Target objects.
+Test for TargetManager and other global WI.Target objects.
 
 
 == Running test suite: TargetManager
diff --git a/LayoutTests/inspector/unit-tests/target-manager.html b/LayoutTests/inspector/unit-tests/target-manager.html
index 822800d..42bcec1 100644
--- a/LayoutTests/inspector/unit-tests/target-manager.html
+++ b/LayoutTests/inspector/unit-tests/target-manager.html
@@ -17,9 +17,9 @@
 {
     function typeString(type) {
         switch (type) {
-        case WebInspector.Target.Type.Main:
+        case WI.Target.Type.Main:
             return "Main";
-        case WebInspector.Target.Type.Worker:
+        case WI.Target.Type.Worker:
             return "Worker";
         default:
             return "Unknown";
@@ -27,7 +27,7 @@
     }
 
     function dumpTargets() {
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             InspectorTest.log(`Target - ${typeString(target.type)} - ${target.displayName}`);
     }
 
@@ -38,11 +38,11 @@
         name: "TargetManager.MainTarget",
         description: "We should always have the main target.",
         test(resolve, reject) {
-            InspectorTest.assert(WebInspector.targets === WebInspector.targetManager.targets);
-            InspectorTest.expectEqual(WebInspector.targets.size, 1, "Targets list should always start out with the main target.");
-            InspectorTest.expectEqual([...WebInspector.targets][0], WebInspector.mainTarget, "Target list should always contain the main target.");
-            InspectorTest.expectNotNull(WebInspector.mainTarget.executionContext, "Main target should have an ExecutionContext.");
-            InspectorTest.expectEqual(WebInspector.mainTarget.RuntimeAgent, RuntimeAgent, "Main target should have the global RuntimeAgent.");
+            InspectorTest.assert(WI.targets === WI.targetManager.targets);
+            InspectorTest.expectEqual(WI.targets.size, 1, "Targets list should always start out with the main target.");
+            InspectorTest.expectEqual([...WI.targets][0], WI.mainTarget, "Target list should always contain the main target.");
+            InspectorTest.expectNotNull(WI.mainTarget.executionContext, "Main target should have an ExecutionContext.");
+            InspectorTest.expectEqual(WI.mainTarget.RuntimeAgent, RuntimeAgent, "Main target should have the global RuntimeAgent.");
             dumpTargets();
             resolve();
         }
@@ -53,10 +53,10 @@
         description: "Creating a Worker should create a new Worker Target.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("createWorker()");
-            WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+            WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                 let target = event.data.target;
-                InspectorTest.assert(target instanceof WebInspector.Target);
-                InspectorTest.expectEqual(target.type, WebInspector.Target.Type.Worker, "Added Target should have Worker type.");
+                InspectorTest.assert(target instanceof WI.Target);
+                InspectorTest.expectEqual(target.type, WI.Target.Type.Worker, "Added Target should have Worker type.");
                 InspectorTest.expectNotNull(target.executionContext, "Added Target should have an ExecutionContext.");
                 InspectorTest.expectNotNull(target.RuntimeAgent, "Added Target should have a RuntimeAgent.");
                 InspectorTest.expectNotEqual(target.RuntimeAgent, RuntimeAgent, "Added Target RuntimeAgent should not be the global RuntimeAgent.");
@@ -71,10 +71,10 @@
         description: "Creating a Worker should create a new Worker Target.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage("terminateWorker()");
-            WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetRemoved, (event) => {
+            WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetRemoved, (event) => {
                 let target = event.data.target;
-                InspectorTest.assert(target instanceof WebInspector.Target);
-                InspectorTest.expectEqual(target.type, WebInspector.Target.Type.Worker, "Removed Target should have Worker type.");
+                InspectorTest.assert(target instanceof WI.Target);
+                InspectorTest.expectEqual(target.type, WI.Target.Type.Worker, "Removed Target should have Worker type.");
                 dumpTargets();
                 resolve();
             });
@@ -86,6 +86,6 @@
 </script>
 </head>
 <body onload="runTest()">
-<p>Test for TargetManager and other global WebInspector.Target objects.</p>
+<p>Test for TargetManager and other global WI.Target objects.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/unit-tests/test-harness-expect-functions.html b/LayoutTests/inspector/unit-tests/test-harness-expect-functions.html
index 28d1434..124305b 100644
--- a/LayoutTests/inspector/unit-tests/test-harness-expect-functions.html
+++ b/LayoutTests/inspector/unit-tests/test-harness-expect-functions.html
@@ -58,8 +58,8 @@
 
     let object1 = {a: 1, b: 2};
     let object2 = {a: 1, b: 2};
-    let customObject1 = new WebInspector.CSSStyleDeclaration;
-    let customObject2 = new WebInspector.CSSRule;
+    let customObject1 = new WI.CSSStyleDeclaration;
+    let customObject2 = new WI.CSSRule;
     let expectEqualTestCase = {
         functionName: "expectEqual",
         passingInputs: [
diff --git a/LayoutTests/inspector/unit-tests/text-utilities-expected.txt b/LayoutTests/inspector/unit-tests/text-utilities-expected.txt
index 4df880c..1774ea5 100644
--- a/LayoutTests/inspector/unit-tests/text-utilities-expected.txt
+++ b/LayoutTests/inspector/unit-tests/text-utilities-expected.txt
@@ -2,7 +2,7 @@
 
 
 == Running test suite: TextUtilities
--- Running test case: WebInspector.rangeForNextCSSNameOrValue
+-- Running test case: WI.rangeForNextCSSNameOrValue
 PASS: Next name/value token in "" starting at index 0 is "" [0, 0]
 PASS: Next name/value token in "" starting at index 2 is "" [0, 0]
 PASS: Next name/value token in "foo" starting at index 0 is "foo" [0, 3]
diff --git a/LayoutTests/inspector/unit-tests/text-utilities.html b/LayoutTests/inspector/unit-tests/text-utilities.html
index 1bf753a..8aaccee 100644
--- a/LayoutTests/inspector/unit-tests/text-utilities.html
+++ b/LayoutTests/inspector/unit-tests/text-utilities.html
@@ -8,10 +8,10 @@
     let suite = InspectorTest.createSyncSuite("TextUtilities");
 
     suite.addTestCase({
-        name: "WebInspector.rangeForNextCSSNameOrValue",
+        name: "WI.rangeForNextCSSNameOrValue",
         test() {
             function testValid(text, index, expected) {
-                let actual = WebInspector.rangeForNextCSSNameOrValue(text, index);
+                let actual = WI.rangeForNextCSSNameOrValue(text, index);
                 InspectorTest.expectShallowEqual(actual, expected, `Next name/value token in "${text}" starting at index ${index} is "${text.substring(actual.from, actual.to)}" [${actual.from}, ${actual.to}]`);
             }
 
diff --git a/LayoutTests/inspector/unit-tests/wrapped-promise.html b/LayoutTests/inspector/unit-tests/wrapped-promise.html
index 62af887..f958a45 100644
--- a/LayoutTests/inspector/unit-tests/wrapped-promise.html
+++ b/LayoutTests/inspector/unit-tests/wrapped-promise.html
@@ -11,7 +11,7 @@
         name: "WrappedPromise.constructor resolve",
         description: "Should be able to resolve the promise using the 'resolve' callback argument.",
         test(resolve, reject) {
-            let result = new WebInspector.WrappedPromise((resolve, reject) => {
+            let result = new WI.WrappedPromise((resolve, reject) => {
                 resolve();
             });
 
@@ -23,7 +23,7 @@
         name: "WrappedPromise.constructor reject",
         description: "Should be able to reject the promise using the 'reject' callback argument.",
         test(resolve, reject) {
-            let result = new WebInspector.WrappedPromise((resolve, reject) => {
+            let result = new WI.WrappedPromise((resolve, reject) => {
                 reject();
             });
 
@@ -35,7 +35,7 @@
         name: "WrappedPromise.prototype.resolve",
         description: "Should be able to resolve the promise using resolve().",
         test(resolve, reject) {
-            let result = new WebInspector.WrappedPromise;
+            let result = new WI.WrappedPromise;
             result.promise.then(resolve, reject);
 
             result.resolve();
@@ -46,7 +46,7 @@
         name: "WrappedPromise.prototype.reject",
         description: "Should be able to reject the promise using reject().",
         test(resolve, reject) {
-            let result = new WebInspector.WrappedPromise;
+            let result = new WI.WrappedPromise;
             result.promise.then(reject, resolve);
 
             result.reject();
@@ -57,7 +57,7 @@
         name: "WrappedPromise.prototype.get settled",
         description: "Should be able to see that the promise is settled.",
         test(resolve, reject) {
-            let result = new WebInspector.WrappedPromise;
+            let result = new WI.WrappedPromise;
             InspectorTest.expectFalse(result.settled, "Should not be settled yet.");
 
             result.promise.then(() => {
diff --git a/LayoutTests/inspector/unit-tests/yieldable-task-expected.txt b/LayoutTests/inspector/unit-tests/yieldable-task-expected.txt
index 697b310..84ad6d0 100644
--- a/LayoutTests/inspector/unit-tests/yieldable-task-expected.txt
+++ b/LayoutTests/inspector/unit-tests/yieldable-task-expected.txt
@@ -1,4 +1,4 @@
-Testing WebInspector.YieldableTask.
+Testing WI.YieldableTask.
 
 
 == Running test suite: YieldableTask
diff --git a/LayoutTests/inspector/unit-tests/yieldable-task.html b/LayoutTests/inspector/unit-tests/yieldable-task.html
index 8e94689..5814052 100644
--- a/LayoutTests/inspector/unit-tests/yieldable-task.html
+++ b/LayoutTests/inspector/unit-tests/yieldable-task.html
@@ -33,7 +33,7 @@
                 }
             };
 
-            new WebInspector.YieldableTask(delegate, expectedItems.slice(), options).start();
+            new WI.YieldableTask(delegate, expectedItems.slice(), options).start();
         }
     });
 
@@ -66,7 +66,7 @@
                 }
             };
 
-            new WebInspector.YieldableTask(delegate, createTaskItems(40), options).start();
+            new WI.YieldableTask(delegate, createTaskItems(40), options).start();
         }
     });
 
@@ -88,7 +88,7 @@
                 }
             };
 
-            new WebInspector.YieldableTask(delegate, items, options).start();
+            new WI.YieldableTask(delegate, items, options).start();
         }
     });
 
@@ -112,7 +112,7 @@
                 }
             };
 
-            new WebInspector.YieldableTask(delegate, createTaskItems(50)).start();
+            new WI.YieldableTask(delegate, createTaskItems(50)).start();
         }
     });
 
@@ -133,7 +133,7 @@
                     }
                 };
 
-                new WebInspector.YieldableTask(delegate, iterable).start();
+                new WI.YieldableTask(delegate, iterable).start();
             }
         });
     }
@@ -162,6 +162,6 @@
 </script>
 </head>
 <body onload="runTest()">
-    <p>Testing WebInspector.YieldableTask.</p>
+    <p>Testing WI.YieldableTask.</p>
 </body>
 </html>
diff --git a/LayoutTests/inspector/worker/console-basic.html b/LayoutTests/inspector/worker/console-basic.html
index 1b358bd..6a59d22 100644
--- a/LayoutTests/inspector/worker/console-basic.html
+++ b/LayoutTests/inspector/worker/console-basic.html
@@ -33,15 +33,15 @@
         });
     }
 
-    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
+    WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, function(event) {
         let message = event.data.message;
-        InspectorTest.assert(message instanceof WebInspector.ConsoleMessage);
+        InspectorTest.assert(message instanceof WI.ConsoleMessage);
         if (triggerNextConsoleMessage)
             triggerNextConsoleMessage(message);
     });
 
-    let mainTarget = WebInspector.mainTarget;
-    let workerTarget = Array.from(WebInspector.targets).find((target) => target.type === WebInspector.Target.Type.Worker);
+    let mainTarget = WI.mainTarget;
+    let workerTarget = Array.from(WI.targets).find((target) => target.type === WI.Target.Type.Worker);
     if (!workerTarget) {
         InspectorTest.fail("Missing Worker Target");
         InspectorTest.completeTest();
diff --git a/LayoutTests/inspector/worker/debugger-multiple-targets-pause.html b/LayoutTests/inspector/worker/debugger-multiple-targets-pause.html
index 6f4cd39..73c7631 100644
--- a/LayoutTests/inspector/worker/debugger-multiple-targets-pause.html
+++ b/LayoutTests/inspector/worker/debugger-multiple-targets-pause.html
@@ -25,13 +25,13 @@
 
 function test()
 {
-    let mainTarget = WebInspector.mainTarget;
+    let mainTarget = WI.mainTarget;
     let workerTarget1;
     let workerTarget2;
 
     function areAllTargetsPaused() {
-        for (let target of WebInspector.targets) {
-            let targetData = WebInspector.debuggerManager.dataForTarget(target);
+        for (let target of WI.targets) {
+            let targetData = WI.debuggerManager.dataForTarget(target);
             if (!targetData.paused)
                 return false;
         }
@@ -39,8 +39,8 @@
     }
 
     function areAllTargetsUnpaused() {
-        for (let target of WebInspector.targets) {
-            let targetData = WebInspector.debuggerManager.dataForTarget(target);
+        for (let target of WI.targets) {
+            let targetData = WI.debuggerManager.dataForTarget(target);
             if (targetData.paused)
                 return false;
         }
@@ -49,13 +49,13 @@
 
     function dumpCallFrames() {
         InspectorTest.log("");
-        for (let target of WebInspector.targets) {
+        for (let target of WI.targets) {
             InspectorTest.log(`TARGET: ${target.displayName}`);
-            let targetData = WebInspector.debuggerManager.dataForTarget(target);
+            let targetData = WI.debuggerManager.dataForTarget(target);
             let callFrames = targetData.callFrames;
             for (let i = 0; i < callFrames.length; ++i) {
                 let callFrame = callFrames[i];
-                let active = callFrame === WebInspector.debuggerManager.activeCallFrame;
+                let active = callFrame === WI.debuggerManager.activeCallFrame;
                 InspectorTest.log(` ${active ? "*" : " "} CALL FRAME #${i + 1}: ${callFrame.functionName}`);
             }
         }
@@ -76,10 +76,10 @@
         description: "Spawn multiple targets.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`triggerStartWorkers()`);
-            WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+            WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                 InspectorTest.pass("Created Worker 1");
                 workerTarget1 = event.data.target;
-                WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+                WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                     InspectorTest.pass("Created Worker 2");
                     workerTarget2 = event.data.target;
                     resolve();
@@ -98,19 +98,19 @@
             let receivedPauseBeforeCallFramesDidChange = false;
             let otherTargetsPausing = false;
 
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 receivedPauseBeforeCallFramesDidChange = !receivedCallFramesDidChange;
-                otherTargetsPausing = WebInspector.debuggerManager.dataForTarget(mainTarget).pausing && WebInspector.debuggerManager.dataForTarget(workerTarget2).pausing;
+                otherTargetsPausing = WI.debuggerManager.dataForTarget(mainTarget).pausing && WI.debuggerManager.dataForTarget(workerTarget2).pausing;
             });
 
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
                 receivedCallFramesDidChange = true;
                 if (!areAllTargetsPaused())
                     return;
 
-                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.CallFramesDidChange, listener);
 
-                let activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+                let activeCallFrame = WI.debuggerManager.activeCallFrame;
                 InspectorTest.assert(activeCallFrame.target === workerTarget1);
 
                 InspectorTest.expectThat(receivedPauseBeforeCallFramesDidChange, "Paused event should happen before CallFramesDidChange event.");
@@ -128,9 +128,9 @@
             name, description: "Should be able to evaluate in different threads while paused.",
             test(resolve, reject) {
                 let target = targetResolver();
-                let targetData = WebInspector.debuggerManager.dataForTarget(target);
-                WebInspector.debuggerManager.activeCallFrame = targetData.callFrames[0];
-                WebInspector.runtimeManager.evaluateInInspectedWindow("testVariable", {objectGroup: "test", includeCommandLineAPI: true}, (remoteObject) => {
+                let targetData = WI.debuggerManager.dataForTarget(target);
+                WI.debuggerManager.activeCallFrame = targetData.callFrames[0];
+                WI.runtimeManager.evaluateInInspectedWindow("testVariable", {objectGroup: "test", includeCommandLineAPI: true}, (remoteObject) => {
                     InspectorTest.expectEqual(remoteObject.description, expected, `Evaluated result in ${target.displayName} should be ${JSON.stringify(expected)}.`)
                     resolve();
                 });
@@ -160,10 +160,10 @@
         name: "Worker.Debugger.Threads.Paused.Worker1.StepOut",
         description: "Should be able to step in individual threads and not affect the others.",
         test(resolve, reject) {
-            let targetData = WebInspector.debuggerManager.dataForTarget(workerTarget1);
-            WebInspector.debuggerManager.activeCallFrame = targetData.callFrames[0];
-            WebInspector.debuggerManager.stepOut();
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+            let targetData = WI.debuggerManager.dataForTarget(workerTarget1);
+            WI.debuggerManager.activeCallFrame = targetData.callFrames[0];
+            WI.debuggerManager.stepOut();
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
                 InspectorTest.expectEqual(event.data.target, workerTarget1, "Should receive CallFramesDidChange for Worker 1.");
                 dumpCallFrames();
                 resolve();
@@ -175,12 +175,12 @@
         name: "Worker.Debugger.Threads.Paused.Worker2.ResumeThread",
         description: "Should be able to resume an individual thread and not affect the others.",
         test(resolve, reject) {
-            let targetData = WebInspector.debuggerManager.dataForTarget(workerTarget2);
-            WebInspector.debuggerManager.continueUntilNextRunLoop(workerTarget2);
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+            let targetData = WI.debuggerManager.dataForTarget(workerTarget2);
+            WI.debuggerManager.continueUntilNextRunLoop(workerTarget2);
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
                 InspectorTest.expectEqual(event.data.target, workerTarget2, "Should Receive CallFramesDidChange for Worker 2.");
                 InspectorTest.expectThat(targetData.pausing, "Worker 2 should be pausing.");
-                WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+                WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
                     InspectorTest.expectEqual(event.data.target, workerTarget2, "Should Receive CallFramesDidChange for Worker 2.");
                     InspectorTest.expectThat(targetData.paused, "Worker 2 should be paused.");
                     dumpCallFrames();
@@ -195,8 +195,8 @@
         description: "Resume all threads for the test to complete.",
         test(resolve, reject) {
             okayToReceiveMainThreadEvent = true;
-            WebInspector.debuggerManager.resume();
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, () => {
+            WI.debuggerManager.resume();
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Resumed, () => {
                 InspectorTest.pass("Received Resume event.");
                 InspectorTest.expectThat(areAllTargetsUnpaused(), "All Targets should be unpaused.");
                 resolve();
diff --git a/LayoutTests/inspector/worker/debugger-pause.html b/LayoutTests/inspector/worker/debugger-pause.html
index b8c2d6a..c745c80 100644
--- a/LayoutTests/inspector/worker/debugger-pause.html
+++ b/LayoutTests/inspector/worker/debugger-pause.html
@@ -11,8 +11,8 @@
 
 function test()
 {
-    let workerTarget = Array.from(WebInspector.targets).find((target) => target.type === WebInspector.Target.Type.Worker);
-    let workerDebuggerData = WebInspector.debuggerManager.dataForTarget(workerTarget);
+    let workerTarget = Array.from(WI.targets).find((target) => target.type === WI.Target.Type.Worker);
+    let workerDebuggerData = WI.debuggerManager.dataForTarget(workerTarget);
     if (!workerTarget) {
         InspectorTest.fail("Missing Worker Target");
         InspectorTest.completeTest();
@@ -34,8 +34,8 @@
         });
     }
 
-    WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
-    WebInspector.debuggerManager.assertionsBreakpoint.disabled = false;
+    WI.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
+    WI.debuggerManager.assertionsBreakpoint.disabled = false;
 
 
     let suite = InspectorTest.createAsyncSuite("Worker.Debugger.Pause");
@@ -45,13 +45,13 @@
         description: "Worker should pause on debugger statement.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`worker.postMessage("triggerDebuggerStatement")`);
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 pauseTheMainThread().then(() => {
                     InspectorTest.pass("Paused");
-                    InspectorTest.expectEqual(WebInspector.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
-                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WebInspector.DebuggerManager.PauseReason.DebuggerStatement, "Pause reason should be a debugger statement.");
+                    InspectorTest.expectEqual(WI.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
+                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WI.DebuggerManager.PauseReason.DebuggerStatement, "Pause reason should be a debugger statement.");
                     logPauseLocation();
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             });
         }
@@ -62,16 +62,16 @@
         description: "Worker should pause on breakpoint.",
         test(resolve, reject) {
             let location = workerTarget.mainResource.createSourceCodeLocation(8, 0);
-            let breakpoint = new WebInspector.Breakpoint(location);
-            WebInspector.debuggerManager.addBreakpoint(breakpoint);
+            let breakpoint = new WI.Breakpoint(location);
+            WI.debuggerManager.addBreakpoint(breakpoint);
             InspectorTest.evaluateInPage(`worker.postMessage("triggerBreakpoint")`);
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 pauseTheMainThread().then(() => {
                     InspectorTest.pass("Paused");
-                    InspectorTest.expectEqual(WebInspector.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
-                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WebInspector.DebuggerManager.PauseReason.Breakpoint, "Pause reason should be a breakpoint.");
+                    InspectorTest.expectEqual(WI.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
+                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WI.DebuggerManager.PauseReason.Breakpoint, "Pause reason should be a breakpoint.");
                     logPauseLocation();
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             });
         }
@@ -82,13 +82,13 @@
         description: "Worker should pause on exception.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`worker.postMessage("triggerException")`);
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 pauseTheMainThread().then(() => {
                     InspectorTest.pass("Paused");
-                    InspectorTest.expectEqual(WebInspector.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
-                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WebInspector.DebuggerManager.PauseReason.Exception, "Pause reason should be an exception.");
+                    InspectorTest.expectEqual(WI.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
+                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WI.DebuggerManager.PauseReason.Exception, "Pause reason should be an exception.");
                     logPauseLocation();
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             });
         }
@@ -99,13 +99,13 @@
         description: "Worker should pause on assert.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`worker.postMessage("triggerAssertion")`);
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 pauseTheMainThread().then(() => {
                     InspectorTest.pass("Paused");
-                    InspectorTest.expectEqual(WebInspector.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
-                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WebInspector.DebuggerManager.PauseReason.Assertion, "Pause reason should be an exception.");
+                    InspectorTest.expectEqual(WI.debuggerManager.activeCallFrame.target, workerTarget, "Should be paused in a Worker CallFrame.");
+                    InspectorTest.expectEqual(workerDebuggerData.pauseReason, WI.DebuggerManager.PauseReason.Assertion, "Pause reason should be an exception.");
                     logPauseLocation();
-                    WebInspector.debuggerManager.resume().then(resolve, reject);
+                    WI.debuggerManager.resume().then(resolve, reject);
                 });
             });
         }
diff --git a/LayoutTests/inspector/worker/debugger-scripts.html b/LayoutTests/inspector/worker/debugger-scripts.html
index 36be502..a584756 100644
--- a/LayoutTests/inspector/worker/debugger-scripts.html
+++ b/LayoutTests/inspector/worker/debugger-scripts.html
@@ -11,10 +11,10 @@
         return url.replace(/^.*?LayoutTests\//, "");
     }
 
-    let mainTarget = WebInspector.mainTarget;
-    let workerTarget = Array.from(WebInspector.targets).find((target) => target.type === WebInspector.Target.Type.Worker);
-    let mainDebuggerData = WebInspector.debuggerManager.dataForTarget(mainTarget);
-    let workerDebuggerData = WebInspector.debuggerManager.dataForTarget(workerTarget);
+    let mainTarget = WI.mainTarget;
+    let workerTarget = Array.from(WI.targets).find((target) => target.type === WI.Target.Type.Worker);
+    let mainDebuggerData = WI.debuggerManager.dataForTarget(mainTarget);
+    let workerDebuggerData = WI.debuggerManager.dataForTarget(workerTarget);
     if (!workerTarget) {
         InspectorTest.fail("Missing Worker Target");
         InspectorTest.completeTest();
@@ -28,7 +28,7 @@
         description: "Worker main resource should be a script tied to the Worker.",
         test(resolve, reject) {
             let script = workerTarget.mainResource;
-            InspectorTest.expectThat(script instanceof WebInspector.Script, "Worker target's main resource should be a Script.");
+            InspectorTest.expectThat(script instanceof WI.Script, "Worker target's main resource should be a Script.");
             InspectorTest.expectEqual(script.target, workerTarget, "Worker target's main resource should be owned by a Worker target.");
             InspectorTest.expectThat(workerDebuggerData.scripts.includes(script), "Worker DebuggerData should include script.");
             InspectorTest.expectThat(workerDebuggerData.scriptForIdentifier(script.id), "Worker DebuggerData should include script by identifier.");
@@ -47,7 +47,7 @@
         description: "Worker should be told of all scripts, like imported scripts.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`worker.postMessage("triggerImportScripts")`);
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 let script = event.data.script;
                 if (!/worker-import-1\.js$/.test(script.url))
                     return;
@@ -61,7 +61,7 @@
                 script.requestContent()
                     .then(({content}) => {
                         InspectorTest.expectThat(content.includes("workerImport1"), "Imported script content should have 'workerImport1'.");
-                        WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
+                        WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, listener);
                         resolve();
                     }).catch(reject);
             });
@@ -73,7 +73,7 @@
         description: "Worker should be told of all scripts, like named evaluations.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`worker.postMessage("triggerEvalScript")`);
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
                 let script = event.data.script;
                 if (!/worker-eval\.js$/.test(script.sourceURL))
                     return;
@@ -86,7 +86,7 @@
                 script.requestContent()
                     .then(({content}) => {
                         InspectorTest.expectThat(content.includes("workerEval"), "Eval script content should have 'workerEval'.");
-                        WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
+                        WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, listener);
                         resolve();
                     }).catch(reject);
             });
diff --git a/LayoutTests/inspector/worker/debugger-shared-breakpoint.html b/LayoutTests/inspector/worker/debugger-shared-breakpoint.html
index c89f62b..01672bc 100644
--- a/LayoutTests/inspector/worker/debugger-shared-breakpoint.html
+++ b/LayoutTests/inspector/worker/debugger-shared-breakpoint.html
@@ -45,8 +45,8 @@
     }
 
     function areAllTargetsPaused() {
-        for (let target of WebInspector.targets) {
-            let targetData = WebInspector.debuggerManager.dataForTarget(target);
+        for (let target of WI.targets) {
+            let targetData = WI.debuggerManager.dataForTarget(target);
             if (!targetData.paused)
                 return false;
         }
@@ -56,9 +56,9 @@
     function whenAllTargetsPaused() {
         InspectorTest.assert(!areAllTargetsPaused());
         return new Promise((resolve, reject) => {
-            let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+            let listener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
                 if (areAllTargetsPaused()) {
-                    WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+                    WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.CallFramesDidChange, listener);
                     resolve();
                 }
             });
@@ -72,9 +72,9 @@
         description: "Create multiple workers.",
         test(resolve, reject) {
             InspectorTest.evaluateInPage(`triggerCreateWorkers(); triggerWorkerResponse();`);
-            WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+            WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                 workerTarget1 = event.data.target;
-                WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+                WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                     workerTarget2 = event.data.target;
                     InspectorTest.pass("Two Workers created.");
                 });
@@ -92,24 +92,24 @@
         name: "Worker.Debugger.SharedBreakpoint.BreakpointAdded",
         description: "All workers should pause on the breakpoint after adding it.",
         test(resolve, reject) {
-            InspectorTest.assert(workerTarget1.mainResource instanceof WebInspector.Script);
+            InspectorTest.assert(workerTarget1.mainResource instanceof WI.Script);
             let location = workerTarget1.mainResource.createSourceCodeLocation(8, 0);
-            breakpoint = new WebInspector.Breakpoint(location);
-            WebInspector.debuggerManager.addBreakpoint(breakpoint);
+            breakpoint = new WI.Breakpoint(location);
+            WI.debuggerManager.addBreakpoint(breakpoint);
 
             InspectorTest.evaluateInPage(`triggerWorkerBreakpointPauses()`);
-            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+            WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
                 pauseTheMainThread();
                 whenAllTargetsPaused().then(() => {
-                    let target = WebInspector.debuggerManager.activeCallFrame.target;
-                    let targetData = WebInspector.debuggerManager.dataForTarget(target);
+                    let target = WI.debuggerManager.activeCallFrame.target;
+                    let targetData = WI.debuggerManager.dataForTarget(target);
 
                     InspectorTest.pass("All Targets paused.");
-                    InspectorTest.expectEqual(target.type, WebInspector.Target.Type.Worker, "Active CalleFrame should be in a Worker.");
-                    InspectorTest.expectEqual(targetData.pauseReason, WebInspector.DebuggerManager.PauseReason.Breakpoint, "Pause reason should be a breakpoint.");
+                    InspectorTest.expectEqual(target.type, WI.Target.Type.Worker, "Active CalleFrame should be in a Worker.");
+                    InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.Breakpoint, "Pause reason should be a breakpoint.");
                     window.loadLinesFromSourceCode(target.mainResource).then(() => {
                         logPauseLocation();
-                        WebInspector.debuggerManager.resume().then(resolve, reject);
+                        WI.debuggerManager.resume().then(resolve, reject);
                     });
                 });
             });
@@ -120,7 +120,7 @@
         name: "Worker.Debugger.SharedBreakpoint.BreakpointRemoved",
         description: "No worker should pause on the breakpoint after removing it.",
         test(resolve, reject) {
-            WebInspector.debuggerManager.removeBreakpoint(breakpoint);
+            WI.debuggerManager.removeBreakpoint(breakpoint);
 
             InspectorTest.evaluateInPage(`triggerWorkerBreakpointPauses()`);
             InspectorTest.evaluateInPage(`triggerWorkerResponse()`);
diff --git a/LayoutTests/inspector/worker/resources-in-worker.html b/LayoutTests/inspector/worker/resources-in-worker.html
index 0ef2a53..c194085 100644
--- a/LayoutTests/inspector/worker/resources-in-worker.html
+++ b/LayoutTests/inspector/worker/resources-in-worker.html
@@ -37,7 +37,7 @@
 function test()
 {
     let workerTarget = null;
-    let mainTarget = WebInspector.mainTarget;
+    let mainTarget = WI.mainTarget;
 
     function sanitizeURL(url) {
         return url.replace(/^.*?LayoutTests\//, "");
@@ -59,10 +59,10 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerWorkerStart()");
 
-            WebInspector.targetManager.singleFireEventListener(WebInspector.TargetManager.Event.TargetAdded, (event) => {
+            WI.targetManager.singleFireEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                 workerTarget = event.data.target;
-                InspectorTest.assert(workerTarget instanceof WebInspector.Target);
-                InspectorTest.expectEqual(workerTarget.type, WebInspector.Target.Type.Worker, "Added Target should have Worker type.");
+                InspectorTest.assert(workerTarget instanceof WI.Target);
+                InspectorTest.expectEqual(workerTarget.type, WI.Target.Type.Worker, "Added Target should have Worker type.");
             });
 
             InspectorTest.singleFireEventListener("WorkerIsReady", () => {
@@ -77,11 +77,11 @@
         test(resolve, reject) {
             InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 1, "Worker Target should have 1 resource.");
             InspectorTest.evaluateInPage("triggerWorkerResourceLoadXHR()");
-            workerTarget.awaitEvent(WebInspector.Target.Event.ResourceAdded)
+            workerTarget.awaitEvent(WI.Target.Event.ResourceAdded)
                 .then((event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Worker Target should dispatch ResourceAdded event.");
-                    InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.XHR, "Resource should be XHR.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Worker Target should dispatch ResourceAdded event.");
+                    InspectorTest.expectEqual(resource.type, WI.Resource.Type.XHR, "Resource should be XHR.");
                     InspectorTest.expectEqual(resource.target, workerTarget, "Resource should be tied to the Worker Target.");
                     InspectorTest.expectNull(resource.parentFrame, "Resource has no parent frame.");
                     InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 2, "Worker Target should have 2 resources.");
@@ -97,13 +97,13 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerMainResourceLoadXHR()");
             InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 2, "Worker Target should still have 2 resources.");
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
                 .then((event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Frame should dispatch ResourceWasAdded event.");
-                    InspectorTest.expectEqual(resource.type, WebInspector.Resource.Type.XHR, "Resource should be XHR.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Frame should dispatch ResourceWasAdded event.");
+                    InspectorTest.expectEqual(resource.type, WI.Resource.Type.XHR, "Resource should be XHR.");
                     InspectorTest.expectEqual(resource.target, mainTarget, "Resource should be tied to the Main Target.");
-                    InspectorTest.expectEqual(resource.parentFrame, WebInspector.frameResourceManager.mainFrame, "Resource parentFrame is the main frame.");
+                    InspectorTest.expectEqual(resource.parentFrame, WI.frameResourceManager.mainFrame, "Resource parentFrame is the main frame.");
                     InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 2, "Worker Target should still have 2 resources.");
                     dumpWorkerResources();
                     resolve();
@@ -117,10 +117,10 @@
         test(resolve, reject) {
             InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 2, "Worker Target should have 2 resources.");
             InspectorTest.evaluateInPage("triggerWorkerResourceLoadFetch()");
-            workerTarget.awaitEvent(WebInspector.Target.Event.ResourceAdded)
+            workerTarget.awaitEvent(WI.Target.Event.ResourceAdded)
                 .then((event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Worker Target should dispatch ResourceAdded event.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Worker Target should dispatch ResourceAdded event.");
                     // FIXME: Add resource type for Fetch that is not XHR?
                     InspectorTest.expectEqual(resource.target, workerTarget, "Resource should be tied to the Worker Target.");
                     InspectorTest.expectNull(resource.parentFrame, "Resource has no parent frame.");
@@ -137,13 +137,13 @@
         test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerMainResourceLoadFetch()");
             InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 3, "Worker Target should still have 3 resources.");
-            WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded)
+            WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
                 .then((event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Frame should dispatch ResourceWasAdded event.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Frame should dispatch ResourceWasAdded event.");
                     // FIXME: Add resource type for Fetch that is not XHR?
                     InspectorTest.expectEqual(resource.target, mainTarget, "Resource should be tied to the Main Target.");
-                    InspectorTest.expectEqual(resource.parentFrame, WebInspector.frameResourceManager.mainFrame, "Resource parentFrame is the main frame.");
+                    InspectorTest.expectEqual(resource.parentFrame, WI.frameResourceManager.mainFrame, "Resource parentFrame is the main frame.");
                     InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 3, "Worker Target should still have 3 resources.");
                     dumpWorkerResources();
                     resolve();
@@ -157,10 +157,10 @@
         test(resolve, reject) {
             InspectorTest.expectEqual(workerTarget.resourceCollection.items.size, 3, "Worker Target should still have 3 resources.");
             InspectorTest.evaluateInPage("triggerWorkerImportScript()");
-            workerTarget.awaitEvent(WebInspector.Target.Event.ResourceAdded)
+            workerTarget.awaitEvent(WI.Target.Event.ResourceAdded)
                 .then((event) => {
                     let resource = event.data.resource;
-                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Worker Target should dispatch ResourceAdded event.");
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Worker Target should dispatch ResourceAdded event.");
                     // FIXME: <https://webkit.org/b/164425> Worker Script Loads (new Worker(...), importScripts(...)) should be classified as Scripts not Raw requests
                     InspectorTest.expectEqual(resource.target, workerTarget, "Resource should be tied to the Worker Target.");
                     InspectorTest.expectNull(resource.parentFrame, "Resource has no parent frame.");
diff --git a/LayoutTests/inspector/worker/runtime-basic.html b/LayoutTests/inspector/worker/runtime-basic.html
index ecbc620..5783185 100644
--- a/LayoutTests/inspector/worker/runtime-basic.html
+++ b/LayoutTests/inspector/worker/runtime-basic.html
@@ -12,8 +12,8 @@
         return url.replace(/^.*?LayoutTests\//, "");
     }
 
-    let mainTarget = WebInspector.mainTarget;
-    let workerTarget = Array.from(WebInspector.targets).find((target) => target.type === WebInspector.Target.Type.Worker);
+    let mainTarget = WI.mainTarget;
+    let workerTarget = Array.from(WI.targets).find((target) => target.type === WI.Target.Type.Worker);
     if (!workerTarget) {
         InspectorTest.fail("Missing Worker Target");
         InspectorTest.completeTest();
@@ -27,7 +27,7 @@
         description: "Main target evaluation.",
         test(resolve, reject) {
             mainTarget.RuntimeAgent.evaluate("passphrase").then((payload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(payload.result, mainTarget);
+                let remoteObject = WI.RemoteObject.fromPayload(payload.result, mainTarget);
                 InspectorTest.log(`Target - ${mainTarget.displayName} - passphrase - ${remoteObject.description}`);
                 resolve();
             }).catch(reject);
@@ -39,7 +39,7 @@
         description: "Worker target evaluation.",
         test(resolve, reject) {
             workerTarget.RuntimeAgent.evaluate("passphrase").then((payload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(payload.result, workerTarget);
+                let remoteObject = WI.RemoteObject.fromPayload(payload.result, workerTarget);
                 InspectorTest.log(`Target - ${workerTarget.displayName} - passphrase - ${remoteObject.description}`);
                 resolve();
             }).catch(reject);
@@ -51,7 +51,7 @@
         description: "Should be able to dig further into RemoteObjects.",
         test(resolve, reject) {
             mainTarget.RuntimeAgent.evaluate("location").then((payload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(payload.result, mainTarget);
+                let remoteObject = WI.RemoteObject.fromPayload(payload.result, mainTarget);
                 remoteObject.getDisplayablePropertyDescriptors((propertyDescriptors) => {
                     let hrefPropertyDescriptor = propertyDescriptors.find((p) => p.name === "href");
                     let hrefValue = sanitizeURL(hrefPropertyDescriptor.value.description);
@@ -67,7 +67,7 @@
         description: "Should be able to dig further into RemoteObjects.",
         test(resolve, reject) {
             workerTarget.RuntimeAgent.evaluate("location").then((payload) => {
-                let remoteObject = WebInspector.RemoteObject.fromPayload(payload.result, workerTarget);
+                let remoteObject = WI.RemoteObject.fromPayload(payload.result, workerTarget);
                 remoteObject.getDisplayablePropertyDescriptors((propertyDescriptors) => {
                     let hrefPropertyDescriptor = propertyDescriptors.find((p) => p.name === "href");
                     let hrefValue = sanitizeURL(hrefPropertyDescriptor.value.description);
diff --git a/Source/WebInspectorUI/.eslintrc b/Source/WebInspectorUI/.eslintrc
index e0d431d..6647229 100644
--- a/Source/WebInspectorUI/.eslintrc
+++ b/Source/WebInspectorUI/.eslintrc
@@ -72,7 +72,7 @@
         "SyncTestSuite": true,
         "TestHarness": true,
         "TestSuite": true,
-        "WebInspector": true,
+        "WI": true,
 
         // Externals
         "CodeMirror": true,
diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog
index 18c5b4e..8914307 100644
--- a/Source/WebInspectorUI/ChangeLog
+++ b/Source/WebInspectorUI/ChangeLog
@@ -1,5 +1,29 @@
 2017-08-01  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: simplify WebInspector with WI
+        https://bugs.webkit.org/show_bug.cgi?id=175058
+
+        Reviewed by Joseph Pecoraro.
+
+        * .eslintrc:
+
+        * Tools/PrettyPrinting/FormatterDebug.js:
+        * Tools/PrettyPrinting/index.html:
+
+        * UserInterface/Main.html:
+        * UserInterface/Test.html:
+
+        * UserInterface/Base/*.js:
+        * UserInterface/Controllers/*.js:
+        * UserInterface/Debug/*.js:
+        * UserInterface/Models/*.js:
+        * UserInterface/Protocol/*.js:
+        * UserInterface/Proxies/*.js:
+        * UserInterface/Test/*.js:
+        * UserInterface/Views/*.js:
+
+2017-08-01  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: create Recording tab for displaying recordings
         https://bugs.webkit.org/show_bug.cgi?id=174484
 
diff --git a/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js b/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js
index 62bf6da..4d9f71c 100644
--- a/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js
+++ b/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js
@@ -1,4 +1,4 @@
-WebInspector.Formatter.prototype.debug = function(from, to)
+WI.Formatter.prototype.debug = function(from, to)
 {
     var debug = "";
     var outerMode = this._codeMirror.getMode();
diff --git a/Source/WebInspectorUI/Tools/PrettyPrinting/index.html b/Source/WebInspectorUI/Tools/PrettyPrinting/index.html
index 0e9b631..ddd9ebb 100644
--- a/Source/WebInspectorUI/Tools/PrettyPrinting/index.html
+++ b/Source/WebInspectorUI/Tools/PrettyPrinting/index.html
@@ -208,7 +208,7 @@
         // Setup.
         const indentString = "    ";
         var builder = new FormatterContentBuilder(indentString);
-        var formatter = new WebInspector.Formatter(cm, builder);
+        var formatter = new WI.Formatter(cm, builder);
 
         // Time the formatter.
         var startTime = Date.now();
@@ -328,7 +328,7 @@
             const end = {line: editor.lineCount() - 1};
             const indentString = "    ";
             var builder = new FormatterContentBuilder(indentString);
-            var formatter = new WebInspector.Formatter(editor, builder);
+            var formatter = new WI.Formatter(editor, builder);
             formatter.format(start, end);
 
             // Compare results.
diff --git a/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js b/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js
index fc99002..9f32906 100644
--- a/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js
@@ -29,7 +29,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.roleSelectorForNode = function(node)
+WI.roleSelectorForNode = function(node)
 {
     // This is proposed syntax for CSS 4 computed role selector :role(foo) and subject to change.
     // See http://lists.w3.org/Archives/Public/www-style/2013Jul/0104.html
@@ -40,24 +40,24 @@
     return title;
 };
 
-WebInspector.linkifyAccessibilityNodeReference = function(node)
+WI.linkifyAccessibilityNodeReference = function(node)
 {
     if (!node)
         return null;
     // Same as linkifyNodeReference except the link text has the classnames removed...
     // ...for list brevity, and both text and title have roleSelectorForNode appended.
-    var link = WebInspector.linkifyNodeReference(node);
+    var link = WI.linkifyNodeReference(node);
     var tagIdSelector = link.title;
     var classSelectorIndex = tagIdSelector.indexOf(".");
     if (classSelectorIndex > -1)
         tagIdSelector = tagIdSelector.substring(0, classSelectorIndex);
-    var roleSelector = WebInspector.roleSelectorForNode(node);
+    var roleSelector = WI.roleSelectorForNode(node);
     link.textContent = tagIdSelector + roleSelector;
     link.title += roleSelector;
     return link;
 };
 
-WebInspector.linkifyNodeReference = function(node, options = {})
+WI.linkifyNodeReference = function(node, options = {})
 {
     let displayName = node.displayName;
     if (!isNaN(options.maxLength))
@@ -65,10 +65,10 @@
 
     let link = document.createElement("span");
     link.append(displayName);
-    return WebInspector.linkifyNodeReferenceElement(node, link, Object.shallowMerge(options, {displayName}));
+    return WI.linkifyNodeReferenceElement(node, link, Object.shallowMerge(options, {displayName}));
 };
 
-WebInspector.linkifyNodeReferenceElement = function(node, element, options = {})
+WI.linkifyNodeReferenceElement = function(node, element, options = {})
 {
     element.setAttribute("role", "link");
     element.title = options.displayName || node.displayName;
@@ -77,12 +77,12 @@
     if ((nodeType !== Node.DOCUMENT_NODE || node.parentNode) && nodeType !== Node.TEXT_NODE)
         element.classList.add("node-link");
 
-    element.addEventListener("click", WebInspector.domTreeManager.inspectElement.bind(WebInspector.domTreeManager, node.id));
-    element.addEventListener("mouseover", WebInspector.domTreeManager.highlightDOMNode.bind(WebInspector.domTreeManager, node.id, "all"));
-    element.addEventListener("mouseout", WebInspector.domTreeManager.hideDOMNodeHighlight.bind(WebInspector.domTreeManager));
+    element.addEventListener("click", WI.domTreeManager.inspectElement.bind(WI.domTreeManager, node.id));
+    element.addEventListener("mouseover", WI.domTreeManager.highlightDOMNode.bind(WI.domTreeManager, node.id, "all"));
+    element.addEventListener("mouseout", WI.domTreeManager.hideDOMNodeHighlight.bind(WI.domTreeManager));
     element.addEventListener("contextmenu", (event) => {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
-        WebInspector.appendContextMenuItemsForDOMNode(contextMenu, node, options);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
+        WI.appendContextMenuItemsForDOMNode(contextMenu, node, options);
     });
 
     return element;
@@ -93,9 +93,9 @@
     return document.createElementNS("http://www.w3.org/2000/svg", tagName);
 }
 
-WebInspector.cssPath = function(node)
+WI.cssPath = function(node)
 {
-    console.assert(node instanceof WebInspector.DOMNode, "Expected a DOMNode.");
+    console.assert(node instanceof WI.DOMNode, "Expected a DOMNode.");
     if (node.nodeType() !== Node.ELEMENT_NODE)
         return "";
 
@@ -107,7 +107,7 @@
 
     let components = [];
     while (node) {
-        let component = WebInspector.cssPathComponent(node);
+        let component = WI.cssPathComponent(node);
         if (!component)
             break;
         components.push(component);
@@ -120,9 +120,9 @@
     return components.map((x) => x.value).join(" > ") + suffix;
 };
 
-WebInspector.cssPathComponent = function(node)
+WI.cssPathComponent = function(node)
 {
-    console.assert(node instanceof WebInspector.DOMNode, "Expected a DOMNode.");
+    console.assert(node instanceof WI.DOMNode, "Expected a DOMNode.");
     console.assert(!node.isPseudoElement());
     if (node.nodeType() !== Node.ELEMENT_NODE)
         return null;
@@ -192,16 +192,16 @@
     return {value: selector, done: false};
 };
 
-WebInspector.xpath = function(node)
+WI.xpath = function(node)
 {
-    console.assert(node instanceof WebInspector.DOMNode, "Expected a DOMNode.");
+    console.assert(node instanceof WI.DOMNode, "Expected a DOMNode.");
 
     if (node.nodeType() === Node.DOCUMENT_NODE)
         return "/";
 
     let components = [];
     while (node) {
-        let component = WebInspector.xpathComponent(node);
+        let component = WI.xpathComponent(node);
         if (!component)
             break;
         components.push(component);
@@ -216,11 +216,11 @@
     return prefix + components.map((x) => x.value).join("/");
 };
 
-WebInspector.xpathComponent = function(node)
+WI.xpathComponent = function(node)
 {
-    console.assert(node instanceof WebInspector.DOMNode, "Expected a DOMNode.");
+    console.assert(node instanceof WI.DOMNode, "Expected a DOMNode.");
 
-    let index = WebInspector.xpathIndex(node);
+    let index = WI.xpathIndex(node);
     if (index === -1)
         return null;
 
@@ -259,7 +259,7 @@
     return {value, done: false};
 };
 
-WebInspector.xpathIndex = function(node)
+WI.xpathIndex = function(node)
 {
     // Root node.
     if (!node.parentNode)
diff --git a/Source/WebInspectorUI/UserInterface/Base/EventListener.js b/Source/WebInspectorUI/UserInterface/Base/EventListener.js
index b009f88..239386d 100644
--- a/Source/WebInspectorUI/UserInterface/Base/EventListener.js
+++ b/Source/WebInspectorUI/UserInterface/Base/EventListener.js
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.EventListener = class EventListener
+WI.EventListener = class EventListener
 {
     constructor(thisObject, fireOnce)
     {
@@ -41,8 +41,8 @@
         console.assert(!this._emitter && !this._callback, "EventListener already bound to a callback.", this);
         console.assert(callback, "Missing callback for event: " + type);
         console.assert(emitter, "Missing event emitter for event: " + type);
-        var emitterIsValid = emitter && (emitter instanceof WebInspector.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
-        console.assert(emitterIsValid, "Event emitter ", emitter, " (type:" + type + ") is null or does not implement Node or WebInspector.Object!");
+        var emitterIsValid = emitter && (emitter instanceof WI.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
+        console.assert(emitterIsValid, "Event emitter ", emitter, " (type:" + type + ") is null or does not implement Node or WI.Object!");
 
         if (!emitterIsValid || !type || !callback)
             return;
diff --git a/Source/WebInspectorUI/UserInterface/Base/EventListenerSet.js b/Source/WebInspectorUI/UserInterface/Base/EventListenerSet.js
index bc392c4..5be3fb3 100644
--- a/Source/WebInspectorUI/UserInterface/Base/EventListenerSet.js
+++ b/Source/WebInspectorUI/UserInterface/Base/EventListenerSet.js
@@ -29,7 +29,7 @@
 // Use `install()` and `uninstall()` to enable or disable all listeners
 // in the set at once.
 
-WebInspector.EventListenerSet = class EventListenerSet
+WI.EventListenerSet = class EventListenerSet
 {
     constructor(defaultThisObject, name)
     {
@@ -46,13 +46,13 @@
     {
         console.assert(callback, "Missing callback for event: " + type);
         console.assert(type, "Tried to register listener for unknown event: " + type);
-        var emitterIsValid = emitter && (emitter instanceof WebInspector.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
-        console.assert(emitterIsValid, "Event emitter ", emitter, " (type:" + type + ") is null or does not implement Node or WebInspector.Object!");
+        var emitterIsValid = emitter && (emitter instanceof WI.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
+        console.assert(emitterIsValid, "Event emitter ", emitter, " (type:" + type + ") is null or does not implement Node or WI.Object!");
 
         if (!emitterIsValid || !type || !callback)
             return;
 
-        this._listeners.push({listener: new WebInspector.EventListener(thisObject || this._defaultThisObject), emitter, type, callback, usesCapture});
+        this._listeners.push({listener: new WI.EventListener(thisObject || this._defaultThisObject), emitter, type, callback, usesCapture});
     }
 
     unregister()
diff --git a/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js b/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js
index 94e716e..883fdef 100644
--- a/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.saveDataToFile = function(saveData, forceSaveAs)
+WI.saveDataToFile = function(saveData, forceSaveAs)
 {
     console.assert(saveData);
     if (!saveData)
@@ -41,10 +41,10 @@
     let url = saveData.url || "";
     let suggestedName = parseURL(url).lastPathComponent;
     if (!suggestedName) {
-        suggestedName = WebInspector.UIString("Untitled");
+        suggestedName = WI.UIString("Untitled");
         let dataURLTypeMatch = /^data:([^;]+)/.exec(url);
         if (dataURLTypeMatch)
-            suggestedName += WebInspector.fileExtensionForMIMEType(dataURLTypeMatch[1]) || "";
+            suggestedName += WI.fileExtensionForMIMEType(dataURLTypeMatch[1]) || "";
     }
 
     if (typeof saveData.content === "string") {
@@ -63,7 +63,7 @@
     });
 };
 
-WebInspector.loadDataFromFile = function(callback)
+WI.loadDataFromFile = function(callback)
 {
     let inputElement = document.createElement("input");
     inputElement.type = "file";
diff --git a/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js b/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js
index f3d3599..95c2899 100644
--- a/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js
+++ b/Source/WebInspectorUI/UserInterface/Base/LoadLocalizedStrings.js
@@ -24,7 +24,7 @@
  */
 
 (function() {
-    if (WebInspector.dontLocalizeUserInterface)
+    if (WI.dontLocalizeUserInterface)
         return;
 
     let localizedStringsURL = InspectorFrontendHost.localizedStringsURL();
@@ -33,7 +33,7 @@
         document.write("<script src=\"" + localizedStringsURL + "\"></script>");
 })();
 
-WebInspector.unlocalizedString = function(string)
+WI.unlocalizedString = function(string)
 {
     // Intentionally do nothing, since this is for engineering builds
     // (such as in Debug UI) or in text that is standardized in English.
@@ -41,9 +41,9 @@
     return string;
 };
 
-WebInspector.UIString = function(string, vararg)
+WI.UIString = function(string, vararg)
 {
-    if (WebInspector.dontLocalizeUserInterface)
+    if (WI.dontLocalizeUserInterface)
         return string;
 
     if (window.localizedStrings && string in window.localizedStrings)
diff --git a/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js b/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js
index 42bced5..98f3f4f 100644
--- a/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.fileExtensionForURL = function(url)
+WI.fileExtensionForURL = function(url)
 {
     var lastPathComponent = parseURL(url).lastPathComponent;
     if (!lastPathComponent)
@@ -36,7 +36,7 @@
     return lastPathComponent.substr(index + 1);
 };
 
-WebInspector.mimeTypeForFileExtension = function(extension)
+WI.mimeTypeForFileExtension = function(extension)
 {
     const extensionToMIMEType = {
         // Document types.
@@ -79,7 +79,7 @@
     return extensionToMIMEType[extension] || null;
 };
 
-WebInspector.fileExtensionForMIMEType = function(mimeType)
+WI.fileExtensionForMIMEType = function(mimeType)
 {
     const mimeTypeToExtension = {
         // Document types.
diff --git a/Source/WebInspectorUI/UserInterface/Base/Main.js b/Source/WebInspectorUI/UserInterface/Base/Main.js
index e7a82f7..1aed2eb4 100644
--- a/Source/WebInspectorUI/UserInterface/Base/Main.js
+++ b/Source/WebInspectorUI/UserInterface/Base/Main.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentViewCookieType = {
+WI.ContentViewCookieType = {
     ApplicationCache: "application-cache",
     CookieStorage: "cookie-storage",
     Database: "database",
@@ -33,109 +33,109 @@
     Timelines: "timelines"
 };
 
-WebInspector.DebuggableType = {
+WI.DebuggableType = {
     Web: "web",
     JavaScript: "javascript"
 };
 
-WebInspector.SelectedSidebarPanelCookieKey = "selected-sidebar-panel";
-WebInspector.TypeIdentifierCookieKey = "represented-object-type";
+WI.SelectedSidebarPanelCookieKey = "selected-sidebar-panel";
+WI.TypeIdentifierCookieKey = "represented-object-type";
 
-WebInspector.StateRestorationType = {
+WI.StateRestorationType = {
     Load: "state-restoration-load",
     Navigation: "state-restoration-navigation",
     Delayed: "state-restoration-delayed",
 };
 
-WebInspector.LayoutDirection = {
+WI.LayoutDirection = {
     System: "system",
     LTR: "ltr",
     RTL: "rtl",
 };
 
-WebInspector.loaded = function()
+WI.loaded = function()
 {
-    this.debuggableType = InspectorFrontendHost.debuggableType() === "web" ? WebInspector.DebuggableType.Web : WebInspector.DebuggableType.JavaScript;
+    this.debuggableType = InspectorFrontendHost.debuggableType() === "web" ? WI.DebuggableType.Web : WI.DebuggableType.JavaScript;
     this.hasExtraDomains = false;
 
     // Register observers for events from the InspectorBackend.
     if (InspectorBackend.registerInspectorDispatcher)
-        InspectorBackend.registerInspectorDispatcher(new WebInspector.InspectorObserver);
+        InspectorBackend.registerInspectorDispatcher(new WI.InspectorObserver);
     if (InspectorBackend.registerPageDispatcher)
-        InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);
+        InspectorBackend.registerPageDispatcher(new WI.PageObserver);
     if (InspectorBackend.registerConsoleDispatcher)
-        InspectorBackend.registerConsoleDispatcher(new WebInspector.ConsoleObserver);
+        InspectorBackend.registerConsoleDispatcher(new WI.ConsoleObserver);
     if (InspectorBackend.registerNetworkDispatcher)
-        InspectorBackend.registerNetworkDispatcher(new WebInspector.NetworkObserver);
+        InspectorBackend.registerNetworkDispatcher(new WI.NetworkObserver);
     if (InspectorBackend.registerDOMDispatcher)
-        InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);
+        InspectorBackend.registerDOMDispatcher(new WI.DOMObserver);
     if (InspectorBackend.registerDebuggerDispatcher)
-        InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerObserver);
+        InspectorBackend.registerDebuggerDispatcher(new WI.DebuggerObserver);
     if (InspectorBackend.registerHeapDispatcher)
-        InspectorBackend.registerHeapDispatcher(new WebInspector.HeapObserver);
+        InspectorBackend.registerHeapDispatcher(new WI.HeapObserver);
     if (InspectorBackend.registerMemoryDispatcher)
-        InspectorBackend.registerMemoryDispatcher(new WebInspector.MemoryObserver);
+        InspectorBackend.registerMemoryDispatcher(new WI.MemoryObserver);
     if (InspectorBackend.registerDatabaseDispatcher)
-        InspectorBackend.registerDatabaseDispatcher(new WebInspector.DatabaseObserver);
+        InspectorBackend.registerDatabaseDispatcher(new WI.DatabaseObserver);
     if (InspectorBackend.registerDOMStorageDispatcher)
-        InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageObserver);
+        InspectorBackend.registerDOMStorageDispatcher(new WI.DOMStorageObserver);
     if (InspectorBackend.registerApplicationCacheDispatcher)
-        InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheObserver);
+        InspectorBackend.registerApplicationCacheDispatcher(new WI.ApplicationCacheObserver);
     if (InspectorBackend.registerScriptProfilerDispatcher)
-        InspectorBackend.registerScriptProfilerDispatcher(new WebInspector.ScriptProfilerObserver);
+        InspectorBackend.registerScriptProfilerDispatcher(new WI.ScriptProfilerObserver);
     if (InspectorBackend.registerTimelineDispatcher)
-        InspectorBackend.registerTimelineDispatcher(new WebInspector.TimelineObserver);
+        InspectorBackend.registerTimelineDispatcher(new WI.TimelineObserver);
     if (InspectorBackend.registerCSSDispatcher)
-        InspectorBackend.registerCSSDispatcher(new WebInspector.CSSObserver);
+        InspectorBackend.registerCSSDispatcher(new WI.CSSObserver);
     if (InspectorBackend.registerLayerTreeDispatcher)
-        InspectorBackend.registerLayerTreeDispatcher(new WebInspector.LayerTreeObserver);
+        InspectorBackend.registerLayerTreeDispatcher(new WI.LayerTreeObserver);
     if (InspectorBackend.registerRuntimeDispatcher)
-        InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeObserver);
+        InspectorBackend.registerRuntimeDispatcher(new WI.RuntimeObserver);
     if (InspectorBackend.registerWorkerDispatcher)
-        InspectorBackend.registerWorkerDispatcher(new WebInspector.WorkerObserver);
+        InspectorBackend.registerWorkerDispatcher(new WI.WorkerObserver);
     if (InspectorBackend.registerCanvasDispatcher)
-        InspectorBackend.registerCanvasDispatcher(new WebInspector.CanvasObserver);
+        InspectorBackend.registerCanvasDispatcher(new WI.CanvasObserver);
 
     // Main backend target.
-    WebInspector.mainTarget = new WebInspector.MainTarget;
+    WI.mainTarget = new WI.MainTarget;
 
     // Enable agents.
     InspectorAgent.enable();
 
     // Perform one-time tasks.
-    WebInspector.CSSCompletions.requestCSSCompletions();
+    WI.CSSCompletions.requestCSSCompletions();
 
     // Listen for the ProvisionalLoadStarted event before registering for events so our code gets called before any managers or sidebars.
     // This lets us save a state cookie before any managers or sidebars do any resets that would affect state (namely TimelineManager).
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
+    WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
 
     // Populate any UIStrings that must be done early after localized strings have loaded.
-    WebInspector.KeyboardShortcut.Key.Space._displayName = WebInspector.UIString("Space");
+    WI.KeyboardShortcut.Key.Space._displayName = WI.UIString("Space");
 
     // Create the singleton managers next, before the user interface elements, so the user interface can register
     // as event listeners on these managers.
-    this.targetManager = new WebInspector.TargetManager;
-    this.branchManager = new WebInspector.BranchManager;
-    this.frameResourceManager = new WebInspector.FrameResourceManager;
-    this.storageManager = new WebInspector.StorageManager;
-    this.domTreeManager = new WebInspector.DOMTreeManager;
-    this.cssStyleManager = new WebInspector.CSSStyleManager;
-    this.logManager = new WebInspector.LogManager;
-    this.issueManager = new WebInspector.IssueManager;
-    this.analyzerManager = new WebInspector.AnalyzerManager;
-    this.runtimeManager = new WebInspector.RuntimeManager;
-    this.heapManager = new WebInspector.HeapManager;
-    this.memoryManager = new WebInspector.MemoryManager;
-    this.applicationCacheManager = new WebInspector.ApplicationCacheManager;
-    this.timelineManager = new WebInspector.TimelineManager;
-    this.debuggerManager = new WebInspector.DebuggerManager;
-    this.sourceMapManager = new WebInspector.SourceMapManager;
-    this.layerTreeManager = new WebInspector.LayerTreeManager;
-    this.dashboardManager = new WebInspector.DashboardManager;
-    this.probeManager = new WebInspector.ProbeManager;
-    this.workerManager = new WebInspector.WorkerManager;
-    this.domDebuggerManager = new WebInspector.DOMDebuggerManager;
-    this.canvasManager = new WebInspector.CanvasManager;
+    this.targetManager = new WI.TargetManager;
+    this.branchManager = new WI.BranchManager;
+    this.frameResourceManager = new WI.FrameResourceManager;
+    this.storageManager = new WI.StorageManager;
+    this.domTreeManager = new WI.DOMTreeManager;
+    this.cssStyleManager = new WI.CSSStyleManager;
+    this.logManager = new WI.LogManager;
+    this.issueManager = new WI.IssueManager;
+    this.analyzerManager = new WI.AnalyzerManager;
+    this.runtimeManager = new WI.RuntimeManager;
+    this.heapManager = new WI.HeapManager;
+    this.memoryManager = new WI.MemoryManager;
+    this.applicationCacheManager = new WI.ApplicationCacheManager;
+    this.timelineManager = new WI.TimelineManager;
+    this.debuggerManager = new WI.DebuggerManager;
+    this.sourceMapManager = new WI.SourceMapManager;
+    this.layerTreeManager = new WI.LayerTreeManager;
+    this.dashboardManager = new WI.DashboardManager;
+    this.probeManager = new WI.ProbeManager;
+    this.workerManager = new WI.WorkerManager;
+    this.domDebuggerManager = new WI.DOMDebuggerManager;
+    this.canvasManager = new WI.CanvasManager;
 
     // Enable the Console Agent after creating the singleton managers.
     ConsoleAgent.enable();
@@ -148,55 +148,55 @@
     }, 0);
 
     // Register for events.
-    this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
-    this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
-    this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.InspectModeStateChanged, this._inspectModeStateChanged, this);
-    this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this);
-    this.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected, this._storageWasInspected, this);
-    this.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasInspected, this._storageWasInspected, this);
-    this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
-    this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
+    this.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
+    this.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
+    this.domTreeManager.addEventListener(WI.DOMTreeManager.Event.InspectModeStateChanged, this._inspectModeStateChanged, this);
+    this.domTreeManager.addEventListener(WI.DOMTreeManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this);
+    this.storageManager.addEventListener(WI.StorageManager.Event.DOMStorageObjectWasInspected, this._storageWasInspected, this);
+    this.storageManager.addEventListener(WI.StorageManager.Event.DatabaseWasInspected, this._storageWasInspected, this);
+    this.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
+    this.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
 
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
     document.addEventListener("DOMContentLoaded", this.contentLoaded.bind(this));
 
     // Create settings.
-    this._showingSplitConsoleSetting = new WebInspector.Setting("showing-split-console", false);
+    this._showingSplitConsoleSetting = new WI.Setting("showing-split-console", false);
 
-    this._openTabsSetting = new WebInspector.Setting("open-tab-types", ["elements", "network", "resources", "timeline", "debugger", "storage", "console"]);
-    this._selectedTabIndexSetting = new WebInspector.Setting("selected-tab-index", 0);
+    this._openTabsSetting = new WI.Setting("open-tab-types", ["elements", "network", "resources", "timeline", "debugger", "storage", "console"]);
+    this._selectedTabIndexSetting = new WI.Setting("selected-tab-index", 0);
 
-    this.showShadowDOMSetting = new WebInspector.Setting("show-shadow-dom", false);
+    this.showShadowDOMSetting = new WI.Setting("show-shadow-dom", false);
 
     // COMPATIBILITY (iOS 8): Page.enableTypeProfiler did not exist.
-    this.showJavaScriptTypeInformationSetting = new WebInspector.Setting("show-javascript-type-information", false);
-    this.showJavaScriptTypeInformationSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
+    this.showJavaScriptTypeInformationSetting = new WI.Setting("show-javascript-type-information", false);
+    this.showJavaScriptTypeInformationSetting.addEventListener(WI.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
     if (this.showJavaScriptTypeInformationSetting.value && window.RuntimeAgent && RuntimeAgent.enableTypeProfiler)
         RuntimeAgent.enableTypeProfiler();
 
-    this.enableControlFlowProfilerSetting = new WebInspector.Setting("enable-control-flow-profiler", false);
-    this.enableControlFlowProfilerSetting.addEventListener(WebInspector.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
+    this.enableControlFlowProfilerSetting = new WI.Setting("enable-control-flow-profiler", false);
+    this.enableControlFlowProfilerSetting.addEventListener(WI.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
     if (this.enableControlFlowProfilerSetting.value && window.RuntimeAgent && RuntimeAgent.enableControlFlowProfiler)
         RuntimeAgent.enableControlFlowProfiler();
 
     // COMPATIBILITY (iOS 8): Page.setShowPaintRects did not exist.
-    this.showPaintRectsSetting = new WebInspector.Setting("show-paint-rects", false);
+    this.showPaintRectsSetting = new WI.Setting("show-paint-rects", false);
     if (this.showPaintRectsSetting.value && window.PageAgent && PageAgent.setShowPaintRects)
         PageAgent.setShowPaintRects(true);
 
-    this.showPrintStylesSetting = new WebInspector.Setting("show-print-styles", false);
+    this.showPrintStylesSetting = new WI.Setting("show-print-styles", false);
     if (this.showPrintStylesSetting.value && window.PageAgent)
         PageAgent.setEmulatedMedia("print");
 
     // COMPATIBILITY (iOS 10.3): Network.setDisableResourceCaching did not exist.
-    this.resourceCachingDisabledSetting = new WebInspector.Setting("disable-resource-caching", false);
+    this.resourceCachingDisabledSetting = new WI.Setting("disable-resource-caching", false);
     if (window.NetworkAgent && NetworkAgent.setResourceCachingDisabled && this.resourceCachingDisabledSetting.value) {
         NetworkAgent.setResourceCachingDisabled(true);
-        this.resourceCachingDisabledSetting.addEventListener(WebInspector.Setting.Event.Changed, this._resourceCachingDisabledSettingChanged, this);
+        this.resourceCachingDisabledSetting.addEventListener(WI.Setting.Event.Changed, this._resourceCachingDisabledSettingChanged, this);
     }
 
-    this.setZoomFactor(WebInspector.settings.zoomFactor.value);
+    this.setZoomFactor(WI.settings.zoomFactor.value);
 
     this.mouseCoords = {
         x: 0,
@@ -208,7 +208,7 @@
     this._windowKeydownListeners = [];
 };
 
-WebInspector.contentLoaded = function()
+WI.contentLoaded = function()
 {
     // If there was an uncaught exception earlier during loading, then
     // abort loading more content. We could be in an inconsistent state.
@@ -221,7 +221,7 @@
 
     document.addEventListener("click", this._mouseWasClicked.bind(this));
     document.addEventListener("dragover", this._dragOver.bind(this));
-    document.addEventListener("focus", WebInspector._focusChanged.bind(this), true);
+    document.addEventListener("focus", WI._focusChanged.bind(this), true);
 
     window.addEventListener("focus", this._windowFocused.bind(this));
     window.addEventListener("blur", this._windowBlurred.bind(this));
@@ -234,14 +234,14 @@
     window.addEventListener("contextmenu", this._contextMenuRequested.bind(this));
 
     // Add platform style classes so the UI can be tweaked per-platform.
-    document.body.classList.add(WebInspector.Platform.name + "-platform");
-    if (WebInspector.Platform.isNightlyBuild)
+    document.body.classList.add(WI.Platform.name + "-platform");
+    if (WI.Platform.isNightlyBuild)
         document.body.classList.add("nightly-build");
 
-    if (WebInspector.Platform.name === "mac") {
-        document.body.classList.add(WebInspector.Platform.version.name);
+    if (WI.Platform.name === "mac") {
+        document.body.classList.add(WI.Platform.version.name);
 
-        if (WebInspector.Platform.version.release >= 11)
+        if (WI.Platform.version.release >= 11)
             document.body.classList.add("latest-mac");
         else
             document.body.classList.add("legacy-mac");
@@ -251,175 +251,175 @@
     document.body.setAttribute("dir", this.resolvedLayoutDirection());
 
     function setTabSize() {
-        document.body.style.tabSize = WebInspector.settings.tabSize.value;
+        document.body.style.tabSize = WI.settings.tabSize.value;
     }
-    WebInspector.settings.tabSize.addEventListener(WebInspector.Setting.Event.Changed, setTabSize);
+    WI.settings.tabSize.addEventListener(WI.Setting.Event.Changed, setTabSize);
     setTabSize();
 
     function setInvalidCharacterClassName() {
-        document.body.classList.toggle("show-invalid-characters", WebInspector.settings.showInvalidCharacters.value);
+        document.body.classList.toggle("show-invalid-characters", WI.settings.showInvalidCharacters.value);
     }
-    WebInspector.settings.showInvalidCharacters.addEventListener(WebInspector.Setting.Event.Changed, setInvalidCharacterClassName);
+    WI.settings.showInvalidCharacters.addEventListener(WI.Setting.Event.Changed, setInvalidCharacterClassName);
     setInvalidCharacterClassName();
 
     function setWhitespaceCharacterClassName() {
-        document.body.classList.toggle("show-whitespace-characters", WebInspector.settings.showWhitespaceCharacters.value);
+        document.body.classList.toggle("show-whitespace-characters", WI.settings.showWhitespaceCharacters.value);
     }
-    WebInspector.settings.showWhitespaceCharacters.addEventListener(WebInspector.Setting.Event.Changed, setWhitespaceCharacterClassName);
+    WI.settings.showWhitespaceCharacters.addEventListener(WI.Setting.Event.Changed, setWhitespaceCharacterClassName);
     setWhitespaceCharacterClassName();
 
-    this.settingsTabContentView = new WebInspector.SettingsTabContentView;
+    this.settingsTabContentView = new WI.SettingsTabContentView;
 
-    this._settingsKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Comma, this._showSettingsTab.bind(this));
+    this._settingsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Comma, this._showSettingsTab.bind(this));
 
     // Create the user interface elements.
-    this.toolbar = new WebInspector.Toolbar(document.getElementById("toolbar"));
+    this.toolbar = new WI.Toolbar(document.getElementById("toolbar"));
 
-    this.tabBar = new WebInspector.TabBar(document.getElementById("tab-bar"));
-    this.tabBar.addEventListener(WebInspector.TabBar.Event.OpenDefaultTab, this._openDefaultTab, this);
+    this.tabBar = new WI.TabBar(document.getElementById("tab-bar"));
+    this.tabBar.addEventListener(WI.TabBar.Event.OpenDefaultTab, this._openDefaultTab, this);
 
     this._contentElement = document.getElementById("content");
     this._contentElement.setAttribute("role", "main");
-    this._contentElement.setAttribute("aria-label", WebInspector.UIString("Content"));
+    this._contentElement.setAttribute("aria-label", WI.UIString("Content"));
 
-    this.consoleDrawer = new WebInspector.ConsoleDrawer(document.getElementById("console-drawer"));
-    this.consoleDrawer.addEventListener(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged, this._consoleDrawerCollapsedStateDidChange, this);
-    this.consoleDrawer.addEventListener(WebInspector.ConsoleDrawer.Event.Resized, this._consoleDrawerDidResize, this);
+    this.consoleDrawer = new WI.ConsoleDrawer(document.getElementById("console-drawer"));
+    this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._consoleDrawerCollapsedStateDidChange, this);
+    this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.Resized, this._consoleDrawerDidResize, this);
 
-    this.clearKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "K", this._clear.bind(this));
+    this.clearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "K", this._clear.bind(this));
 
-    this.quickConsole = new WebInspector.QuickConsole(document.getElementById("quick-console"));
+    this.quickConsole = new WI.QuickConsole(document.getElementById("quick-console"));
 
-    this._consoleRepresentedObject = new WebInspector.LogObject;
+    this._consoleRepresentedObject = new WI.LogObject;
     this.consoleContentView = this.consoleDrawer.contentViewForRepresentedObject(this._consoleRepresentedObject);
     this.consoleLogViewController = this.consoleContentView.logViewController;
-    this.breakpointPopoverController = new WebInspector.BreakpointPopoverController;
+    this.breakpointPopoverController = new WI.BreakpointPopoverController;
 
     // FIXME: The sidebars should be flipped in RTL languages.
-    this.navigationSidebar = new WebInspector.Sidebar(document.getElementById("navigation-sidebar"), WebInspector.Sidebar.Sides.Left);
-    this.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
+    this.navigationSidebar = new WI.Sidebar(document.getElementById("navigation-sidebar"), WI.Sidebar.Sides.Left);
+    this.navigationSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
 
-    this.detailsSidebar = new WebInspector.Sidebar(document.getElementById("details-sidebar"), WebInspector.Sidebar.Sides.Right, null, null, WebInspector.UIString("Details"), true);
-    this.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
+    this.detailsSidebar = new WI.Sidebar(document.getElementById("details-sidebar"), WI.Sidebar.Sides.Right, null, null, WI.UIString("Details"), true);
+    this.detailsSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
 
-    this.searchKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "F", this._focusSearchField.bind(this));
-    this._findKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "F", this._find.bind(this));
-    this._saveKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this));
-    this._saveAsKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._saveAs.bind(this));
+    this.searchKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "F", this._focusSearchField.bind(this));
+    this._findKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "F", this._find.bind(this));
+    this._saveKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this));
+    this._saveAsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "S", this._saveAs.bind(this));
 
-    this.openResourceKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "O", this._showOpenResourceDialog.bind(this));
-    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "P", this._showOpenResourceDialog.bind(this));
+    this.openResourceKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "O", this._showOpenResourceDialog.bind(this));
+    new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "P", this._showOpenResourceDialog.bind(this));
 
-    this.navigationSidebarKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "0", this.toggleNavigationSidebar.bind(this));
-    this.detailsSidebarKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Option, "0", this.toggleDetailsSidebar.bind(this));
+    this.navigationSidebarKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "0", this.toggleNavigationSidebar.bind(this));
+    this.detailsSidebarKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "0", this.toggleDetailsSidebar.bind(this));
 
     let boundIncreaseZoom = this._increaseZoom.bind(this);
     let boundDecreaseZoom = this._decreaseZoom.bind(this);
-    this._increaseZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
-    this._decreaseZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
-    this._increaseZoomKeyboardShortcut2 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, WebInspector.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
-    this._decreaseZoomKeyboardShortcut2 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, WebInspector.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
-    this._resetZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "0", this._resetZoom.bind(this));
+    this._increaseZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
+    this._decreaseZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
+    this._increaseZoomKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
+    this._decreaseZoomKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
+    this._resetZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "0", this._resetZoom.bind(this));
 
-    this._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Option, `${i}`, this._showTabAtIndex.bind(this, i)));
-    this._openNewTabKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Option, "T", this.showNewTabTab.bind(this));
+    this._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, `${i}`, this._showTabAtIndex.bind(this, i)));
+    this._openNewTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "T", this.showNewTabTab.bind(this));
 
-    this.tabBrowser = new WebInspector.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
-    this.tabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
+    this.tabBrowser = new WI.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
+    this.tabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
 
-    this._reloadPageKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "R", this._reloadPage.bind(this));
-    this._reloadPageIgnoringCacheKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "R", this._reloadPageIgnoringCache.bind(this));
+    this._reloadPageKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "R", this._reloadPage.bind(this));
+    this._reloadPageIgnoringCacheKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "R", this._reloadPageIgnoringCache.bind(this));
     this._reloadPageKeyboardShortcut.implicitlyPreventsDefault = this._reloadPageIgnoringCacheKeyboardShortcut.implicitlyPreventsDefault = false;
 
-    this._consoleTabKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "C", this._showConsoleTab.bind(this));
-    this._quickConsoleKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, WebInspector.KeyboardShortcut.Key.Apostrophe, this._focusConsolePrompt.bind(this));
+    this._consoleTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.CommandOrControl, "C", this._showConsoleTab.bind(this));
+    this._quickConsoleKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, WI.KeyboardShortcut.Key.Apostrophe, this._focusConsolePrompt.bind(this));
 
-    this._inspectModeKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "C", this._toggleInspectMode.bind(this));
+    this._inspectModeKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "C", this._toggleInspectMode.bind(this));
 
-    this._undoKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "Z", this._undoKeyboardShortcut.bind(this));
-    this._redoKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "Z", this._redoKeyboardShortcut.bind(this));
+    this._undoKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "Z", this._undoKeyboardShortcut.bind(this));
+    this._redoKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "Z", this._redoKeyboardShortcut.bind(this));
     this._undoKeyboardShortcut.implicitlyPreventsDefault = this._redoKeyboardShortcut.implicitlyPreventsDefault = false;
 
-    this.toggleBreakpointsKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "Y", this.debuggerToggleBreakpoints.bind(this));
-    this.pauseOrResumeKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "Y", this.debuggerPauseResumeToggle.bind(this));
-    this.stepOverKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.F6, this.debuggerStepOver.bind(this));
-    this.stepIntoKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.F7, this.debuggerStepInto.bind(this));
-    this.stepOutKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.F8, this.debuggerStepOut.bind(this));
+    this.toggleBreakpointsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "Y", this.debuggerToggleBreakpoints.bind(this));
+    this.pauseOrResumeKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control | WI.KeyboardShortcut.Modifier.CommandOrControl, "Y", this.debuggerPauseResumeToggle.bind(this));
+    this.stepOverKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F6, this.debuggerStepOver.bind(this));
+    this.stepIntoKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F7, this.debuggerStepInto.bind(this));
+    this.stepOutKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F8, this.debuggerStepOut.bind(this));
 
-    this.pauseOrResumeAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Backslash, this.debuggerPauseResumeToggle.bind(this));
-    this.stepOverAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.SingleQuote, this.debuggerStepOver.bind(this));
-    this.stepIntoAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Semicolon, this.debuggerStepInto.bind(this));
-    this.stepOutAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Semicolon, this.debuggerStepOut.bind(this));
+    this.pauseOrResumeAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Backslash, this.debuggerPauseResumeToggle.bind(this));
+    this.stepOverAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.SingleQuote, this.debuggerStepOver.bind(this));
+    this.stepIntoAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Semicolon, this.debuggerStepInto.bind(this));
+    this.stepOutAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Semicolon, this.debuggerStepOut.bind(this));
 
-    this._closeToolbarButton = new WebInspector.ControlToolbarItem("dock-close", WebInspector.UIString("Close"), "Images/Close.svg", 16, 14);
-    this._closeToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this.close, this);
+    this._closeToolbarButton = new WI.ControlToolbarItem("dock-close", WI.UIString("Close"), "Images/Close.svg", 16, 14);
+    this._closeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this.close, this);
 
-    this._undockToolbarButton = new WebInspector.ButtonToolbarItem("undock", WebInspector.UIString("Detach into separate window"), null, "Images/Undock.svg");
-    this._undockToolbarButton.element.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);
-    this._undockToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._undock, this);
+    this._undockToolbarButton = new WI.ButtonToolbarItem("undock", WI.UIString("Detach into separate window"), null, "Images/Undock.svg");
+    this._undockToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
+    this._undockToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._undock, this);
 
-    let dockImage = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "Images/DockLeft.svg" : "Images/DockRight.svg";
-    this._dockToSideToolbarButton = new WebInspector.ButtonToolbarItem("dock-right", WebInspector.UIString("Dock to side of window"), null, dockImage);
-    this._dockToSideToolbarButton.element.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);
+    let dockImage = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "Images/DockLeft.svg" : "Images/DockRight.svg";
+    this._dockToSideToolbarButton = new WI.ButtonToolbarItem("dock-right", WI.UIString("Dock to side of window"), null, dockImage);
+    this._dockToSideToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
 
-    let dockToSideCallback = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? this._dockLeft : this._dockRight;
-    this._dockToSideToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, dockToSideCallback, this);
+    let dockToSideCallback = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? this._dockLeft : this._dockRight;
+    this._dockToSideToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, dockToSideCallback, this);
 
-    this._dockBottomToolbarButton = new WebInspector.ButtonToolbarItem("dock-bottom", WebInspector.UIString("Dock to bottom of window"), null, "Images/DockBottom.svg");
-    this._dockBottomToolbarButton.element.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);
-    this._dockBottomToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._dockBottom, this);
+    this._dockBottomToolbarButton = new WI.ButtonToolbarItem("dock-bottom", WI.UIString("Dock to bottom of window"), null, "Images/DockBottom.svg");
+    this._dockBottomToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
+    this._dockBottomToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._dockBottom, this);
 
-    this._togglePreviousDockConfigurationKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "D", this._togglePreviousDockConfiguration.bind(this));
+    this._togglePreviousDockConfigurationKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "D", this._togglePreviousDockConfiguration.bind(this));
 
     var toolTip;
-    if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript)
-        toolTip = WebInspector.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);
+    if (WI.debuggableType === WI.DebuggableType.JavaScript)
+        toolTip = WI.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);
     else
-        toolTip = WebInspector.UIString("Reload this page (%s)\nReload ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName, this._reloadPageIgnoringCacheKeyboardShortcut.displayName);
+        toolTip = WI.UIString("Reload this page (%s)\nReload ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName, this._reloadPageIgnoringCacheKeyboardShortcut.displayName);
 
-    this._reloadToolbarButton = new WebInspector.ButtonToolbarItem("reload", toolTip, null, "Images/ReloadToolbar.svg");
-    this._reloadToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._reloadPageClicked, this);
+    this._reloadToolbarButton = new WI.ButtonToolbarItem("reload", toolTip, null, "Images/ReloadToolbar.svg");
+    this._reloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._reloadPageClicked, this);
 
-    this._downloadToolbarButton = new WebInspector.ButtonToolbarItem("download", WebInspector.UIString("Download Web Archive"), null, "Images/DownloadArrow.svg");
-    this._downloadToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._downloadWebArchive, this);
+    this._downloadToolbarButton = new WI.ButtonToolbarItem("download", WI.UIString("Download Web Archive"), null, "Images/DownloadArrow.svg");
+    this._downloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._downloadWebArchive, this);
 
     this._updateReloadToolbarButton();
     this._updateDownloadToolbarButton();
 
     // The toolbar button for node inspection.
-    if (this.debuggableType === WebInspector.DebuggableType.Web) {
-        var toolTip = WebInspector.UIString("Start element selection (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);
-        var activatedToolTip = WebInspector.UIString("Stop element selection (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);
-        this._inspectModeToolbarButton = new WebInspector.ActivateButtonToolbarItem("inspect", toolTip, activatedToolTip, null, "Images/Crosshair.svg");
-        this._inspectModeToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleInspectMode, this);
+    if (this.debuggableType === WI.DebuggableType.Web) {
+        var toolTip = WI.UIString("Start element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
+        var activatedToolTip = WI.UIString("Stop element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
+        this._inspectModeToolbarButton = new WI.ActivateButtonToolbarItem("inspect", toolTip, activatedToolTip, null, "Images/Crosshair.svg");
+        this._inspectModeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleInspectMode, this);
     }
 
-    this._dashboardContainer = new WebInspector.DashboardContainerView;
+    this._dashboardContainer = new WI.DashboardContainerView;
     this._dashboardContainer.showDashboardViewForRepresentedObject(this.dashboardManager.dashboards.default);
 
-    this._searchToolbarItem = new WebInspector.SearchBar("inspector-search", WebInspector.UIString("Search"), null, true);
-    this._searchToolbarItem.addEventListener(WebInspector.SearchBar.Event.TextChanged, this._searchTextDidChange, this);
+    this._searchToolbarItem = new WI.SearchBar("inspector-search", WI.UIString("Search"), null, true);
+    this._searchToolbarItem.addEventListener(WI.SearchBar.Event.TextChanged, this._searchTextDidChange, this);
 
-    this.toolbar.addToolbarItem(this._closeToolbarButton, WebInspector.Toolbar.Section.Control);
+    this.toolbar.addToolbarItem(this._closeToolbarButton, WI.Toolbar.Section.Control);
 
-    this.toolbar.addToolbarItem(this._undockToolbarButton, WebInspector.Toolbar.Section.Left);
-    this.toolbar.addToolbarItem(this._dockToSideToolbarButton, WebInspector.Toolbar.Section.Left);
-    this.toolbar.addToolbarItem(this._dockBottomToolbarButton, WebInspector.Toolbar.Section.Left);
+    this.toolbar.addToolbarItem(this._undockToolbarButton, WI.Toolbar.Section.Left);
+    this.toolbar.addToolbarItem(this._dockToSideToolbarButton, WI.Toolbar.Section.Left);
+    this.toolbar.addToolbarItem(this._dockBottomToolbarButton, WI.Toolbar.Section.Left);
 
-    this.toolbar.addToolbarItem(this._reloadToolbarButton, WebInspector.Toolbar.Section.CenterLeft);
-    this.toolbar.addToolbarItem(this._downloadToolbarButton, WebInspector.Toolbar.Section.CenterLeft);
+    this.toolbar.addToolbarItem(this._reloadToolbarButton, WI.Toolbar.Section.CenterLeft);
+    this.toolbar.addToolbarItem(this._downloadToolbarButton, WI.Toolbar.Section.CenterLeft);
 
-    this.toolbar.addToolbarItem(this._dashboardContainer.toolbarItem, WebInspector.Toolbar.Section.Center);
+    this.toolbar.addToolbarItem(this._dashboardContainer.toolbarItem, WI.Toolbar.Section.Center);
 
     if (this._inspectModeToolbarButton)
-        this.toolbar.addToolbarItem(this._inspectModeToolbarButton, WebInspector.Toolbar.Section.CenterRight);
+        this.toolbar.addToolbarItem(this._inspectModeToolbarButton, WI.Toolbar.Section.CenterRight);
 
-    this.toolbar.addToolbarItem(this._searchToolbarItem, WebInspector.Toolbar.Section.Right);
+    this.toolbar.addToolbarItem(this._searchToolbarItem, WI.Toolbar.Section.Right);
 
     this.modifierKeys = {altKey: false, metaKey: false, shiftKey: false};
 
     let dockedResizerElement = document.getElementById("docked-resizer");
-    dockedResizerElement.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);
+    dockedResizerElement.classList.add(WI.Popover.IgnoreAutoDismissClassName);
     dockedResizerElement.addEventListener("mousedown", this._dockedResizerMouseDown.bind(this));
 
     this._dockingAvailable = false;
@@ -430,17 +430,17 @@
     // These tabs are always available for selecting, modulo isTabAllowed().
     // Other tabs may be engineering-only or toggled at runtime if incomplete.
     let productionTabClasses = [
-        WebInspector.ConsoleTabContentView,
-        WebInspector.DebuggerTabContentView,
-        WebInspector.ElementsTabContentView,
-        WebInspector.NetworkTabContentView,
-        WebInspector.NewTabContentView,
-        WebInspector.RecordingTabContentView,
-        WebInspector.ResourcesTabContentView,
-        WebInspector.SearchTabContentView,
-        WebInspector.SettingsTabContentView,
-        WebInspector.StorageTabContentView,
-        WebInspector.TimelineTabContentView,
+        WI.ConsoleTabContentView,
+        WI.DebuggerTabContentView,
+        WI.ElementsTabContentView,
+        WI.NetworkTabContentView,
+        WI.NewTabContentView,
+        WI.RecordingTabContentView,
+        WI.ResourcesTabContentView,
+        WI.SearchTabContentView,
+        WI.SettingsTabContentView,
+        WI.StorageTabContentView,
+        WI.TimelineTabContentView,
     ];
 
     this._knownTabClassesByType = new Map;
@@ -473,7 +473,7 @@
         this.tabBrowser.addTabForContentView(tabContentView, {suppressAnimations: true});
     }
 
-    this._restoreCookieForOpenTabs(WebInspector.StateRestorationType.Load);
+    this._restoreCookieForOpenTabs(WI.StateRestorationType.Load);
 
     this.tabBar.selectedTabBarItem = this._selectedTabIndexSetting.value;
 
@@ -484,9 +484,9 @@
         this.showNewTabTab({suppressAnimations: true});
 
     // Listen to the events after restoring the saved tabs to avoid recursion.
-    this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._rememberOpenTabs, this);
-    this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved, this._rememberOpenTabs, this);
-    this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemsReordered, this._rememberOpenTabs, this);
+    this.tabBar.addEventListener(WI.TabBar.Event.TabBarItemAdded, this._rememberOpenTabs, this);
+    this.tabBar.addEventListener(WI.TabBar.Event.TabBarItemRemoved, this._rememberOpenTabs, this);
+    this.tabBar.addEventListener(WI.TabBar.Event.TabBarItemsReordered, this._rememberOpenTabs, this);
 
     // Signal that the frontend is now ready to receive messages.
     InspectorFrontendAPI.loadCompleted();
@@ -507,23 +507,23 @@
 
 // This function returns a lazily constructed instance of a class scoped to this WebInspector
 // instance. In the unlikely event that we ever need to construct multiple WebInspector instances
-// this allows us to scope objects within the WebInspector.
+// this allows us to scope objects within the WI.
 // Classes can prevent usage of this function via a static `disallowInstanceForClass` function that
 // returns true. It is then their responsibility to ensure that the returned value is tracked.
 // Currently it is only used for sidebars.
-WebInspector.instanceForClass = function(constructor)
+WI.instanceForClass = function(constructor)
 {
     console.assert(typeof constructor === "function");
     if (typeof constructor.disallowInstanceForClass === "function" && constructor.disallowInstanceForClass())
         return new constructor;
 
     let key = `__${constructor.name}`;
-    if (!WebInspector[key])
-        WebInspector[key] = new constructor;
-    return WebInspector[key];
+    if (!WI[key])
+        WI[key] = new constructor;
+    return WI[key];
 };
 
-WebInspector.isTabTypeAllowed = function(tabType)
+WI.isTabTypeAllowed = function(tabType)
 {
     let tabClass = this._knownTabClassesByType.get(tabType);
     if (!tabClass)
@@ -532,15 +532,15 @@
     return tabClass.isTabAllowed();
 };
 
-WebInspector.knownTabClasses = function()
+WI.knownTabClasses = function()
 {
     return new Set(this._knownTabClassesByType.values());
 };
 
-WebInspector._showOpenResourceDialog = function()
+WI._showOpenResourceDialog = function()
 {
     if (!this._openResourceDialog)
-        this._openResourceDialog = new WebInspector.OpenResourceDialog(this);
+        this._openResourceDialog = new WI.OpenResourceDialog(this);
 
     if (this._openResourceDialog.visible)
         return;
@@ -548,7 +548,7 @@
     this._openResourceDialog.present(this._contentElement);
 };
 
-WebInspector._createTabContentViewForType = function(tabType)
+WI._createTabContentViewForType = function(tabType)
 {
     let tabClass = this._knownTabClassesByType.get(tabType);
     if (!tabClass) {
@@ -556,18 +556,18 @@
         return null;
     }
 
-    console.assert(WebInspector.TabContentView.isPrototypeOf(tabClass));
+    console.assert(WI.TabContentView.isPrototypeOf(tabClass));
     return new tabClass;
 };
 
-WebInspector._rememberOpenTabs = function()
+WI._rememberOpenTabs = function()
 {
     let seenTabTypes = new Set;
     let openTabs = [];
 
     for (let tabBarItem of this.tabBar.tabBarItems) {
         let tabContentView = tabBarItem.representedObject;
-        if (!(tabContentView instanceof WebInspector.TabContentView))
+        if (!(tabContentView instanceof WI.TabContentView))
             continue;
         if (!tabContentView.constructor.shouldSaveTab())
             continue;
@@ -587,17 +587,17 @@
     this._openTabsSetting.value = openTabs;
 };
 
-WebInspector._openDefaultTab = function(event)
+WI._openDefaultTab = function(event)
 {
     this.showNewTabTab({suppressAnimations: true});
 };
 
-WebInspector._showSettingsTab = function(event)
+WI._showSettingsTab = function(event)
 {
     this.tabBrowser.showTabForContentView(this.settingsTabContentView);
 };
 
-WebInspector._tryToRestorePendingTabs = function()
+WI._tryToRestorePendingTabs = function()
 {
     let stillPendingOpenTabs = [];
     for (let {tabType, index} of this._pendingOpenTabs) {
@@ -615,7 +615,7 @@
             insertionIndex: index,
         });
 
-        tabContentView.restoreStateFromCookie(WebInspector.StateRestorationType.Load);
+        tabContentView.restoreStateFromCookie(WI.StateRestorationType.Load);
     }
 
     this._pendingOpenTabs = stillPendingOpenTabs;
@@ -623,18 +623,18 @@
     this.tabBrowser.tabBar.updateNewTabTabBarItemState();
 };
 
-WebInspector.showNewTabTab = function(options)
+WI.showNewTabTab = function(options)
 {
-    if (!this.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type))
+    if (!this.isNewTabWithTypeAllowed(WI.NewTabContentView.Type))
         return;
 
-    let tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.NewTabContentView);
+    let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.NewTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.NewTabContentView;
+        tabContentView = new WI.NewTabContentView;
     this.tabBrowser.showTabForContentView(tabContentView, options);
 };
 
-WebInspector.isNewTabWithTypeAllowed = function(tabType)
+WI.isNewTabWithTypeAllowed = function(tabType)
 {
     let tabClass = this._knownTabClassesByType.get(tabType);
     if (!tabClass || !tabClass.isTabAllowed())
@@ -643,28 +643,28 @@
     // Only allow one tab per class for now.
     for (let tabBarItem of this.tabBar.tabBarItems) {
         let tabContentView = tabBarItem.representedObject;
-        if (!(tabContentView instanceof WebInspector.TabContentView))
+        if (!(tabContentView instanceof WI.TabContentView))
             continue;
         if (tabContentView.constructor === tabClass)
             return false;
     }
 
-    if (tabClass === WebInspector.NewTabContentView) {
+    if (tabClass === WI.NewTabContentView) {
         let allTabs = Array.from(this.knownTabClasses());
         let addableTabs = allTabs.filter((tabClass) => !tabClass.isEphemeral());
-        let canMakeNewTab = addableTabs.some((tabClass) => WebInspector.isNewTabWithTypeAllowed(tabClass.Type));
+        let canMakeNewTab = addableTabs.some((tabClass) => WI.isNewTabWithTypeAllowed(tabClass.Type));
         return canMakeNewTab;
     }
 
     return true;
 };
 
-WebInspector.createNewTabWithType = function(tabType, options = {})
+WI.createNewTabWithType = function(tabType, options = {})
 {
     console.assert(this.isNewTabWithTypeAllowed(tabType));
 
     let {referencedView, shouldReplaceTab, shouldShowNewTab} = options;
-    console.assert(!referencedView || referencedView instanceof WebInspector.TabContentView, referencedView);
+    console.assert(!referencedView || referencedView instanceof WI.TabContentView, referencedView);
     console.assert(!shouldReplaceTab || referencedView, "Must provide a reference view to replace a tab.");
 
     let tabContentView = this._createTabContentViewForType(tabType);
@@ -681,10 +681,10 @@
         this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.registerTabClass = function(tabClass)
+WI.registerTabClass = function(tabClass)
 {
-    console.assert(WebInspector.TabContentView.isPrototypeOf(tabClass));
-    if (!WebInspector.TabContentView.isPrototypeOf(tabClass))
+    console.assert(WI.TabContentView.isPrototypeOf(tabClass));
+    if (!WI.TabContentView.isPrototypeOf(tabClass))
         return;
 
     if (this._knownTabClassesByType.has(tabClass.Type))
@@ -693,10 +693,10 @@
     this._knownTabClassesByType.set(tabClass.Type, tabClass);
 
     this._tryToRestorePendingTabs();
-    this.notifications.dispatchEventToListeners(WebInspector.Notification.TabTypesChanged);
+    this.notifications.dispatchEventToListeners(WI.Notification.TabTypesChanged);
 };
 
-WebInspector.activateExtraDomains = function(domains)
+WI.activateExtraDomains = function(domains)
 {
     this.hasExtraDomains = true;
 
@@ -706,16 +706,16 @@
             agent.enable();
     }
 
-    this.notifications.dispatchEventToListeners(WebInspector.Notification.ExtraDomainsActivated, {"domains": domains});
+    this.notifications.dispatchEventToListeners(WI.Notification.ExtraDomainsActivated, {"domains": domains});
 
-    WebInspector.CSSCompletions.requestCSSCompletions();
+    WI.CSSCompletions.requestCSSCompletions();
 
     this._updateReloadToolbarButton();
     this._updateDownloadToolbarButton();
     this._tryToRestorePendingTabs();
 };
 
-WebInspector.updateWindowTitle = function()
+WI.updateWindowTitle = function()
 {
     var mainFrame = this.frameResourceManager.mainFrame;
     if (!mainFrame)
@@ -745,14 +745,14 @@
     InspectorFrontendHost.inspectedURLChanged(title);
 };
 
-WebInspector.updateDockingAvailability = function(available)
+WI.updateDockingAvailability = function(available)
 {
     this._dockingAvailable = available;
 
     this._updateDockNavigationItems();
 };
 
-WebInspector.updateDockedState = function(side)
+WI.updateDockedState = function(side)
 {
     if (this._dockConfiguration === side)
         return;
@@ -760,29 +760,29 @@
     this._previousDockConfiguration = this._dockConfiguration;
 
     if (!this._previousDockConfiguration) {
-        if (side === WebInspector.DockConfiguration.Right || side === WebInspector.DockConfiguration.Left)
-            this._previousDockConfiguration = WebInspector.DockConfiguration.Bottom;
+        if (side === WI.DockConfiguration.Right || side === WI.DockConfiguration.Left)
+            this._previousDockConfiguration = WI.DockConfiguration.Bottom;
         else
-            this._previousDockConfiguration = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? WebInspector.DockConfiguration.Left : WebInspector.DockConfiguration.Right;
+            this._previousDockConfiguration = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? WI.DockConfiguration.Left : WI.DockConfiguration.Right;
     }
 
     this._dockConfiguration = side;
 
-    this.docked = side !== WebInspector.DockConfiguration.Undocked;
+    this.docked = side !== WI.DockConfiguration.Undocked;
 
     this._ignoreToolbarModeDidChangeEvents = true;
 
-    if (side === WebInspector.DockConfiguration.Bottom) {
-        document.body.classList.add("docked", WebInspector.DockConfiguration.Bottom);
-        document.body.classList.remove("window-inactive", WebInspector.DockConfiguration.Right, WebInspector.DockConfiguration.Left);
-    } else if (side === WebInspector.DockConfiguration.Right) {
-        document.body.classList.add("docked", WebInspector.DockConfiguration.Right);
-        document.body.classList.remove("window-inactive", WebInspector.DockConfiguration.Bottom, WebInspector.DockConfiguration.Left);
-    } else if (side === WebInspector.DockConfiguration.Left) {
-        document.body.classList.add("docked", WebInspector.DockConfiguration.Left);
-        document.body.classList.remove("window-inactive", WebInspector.DockConfiguration.Bottom, WebInspector.DockConfiguration.Right);
+    if (side === WI.DockConfiguration.Bottom) {
+        document.body.classList.add("docked", WI.DockConfiguration.Bottom);
+        document.body.classList.remove("window-inactive", WI.DockConfiguration.Right, WI.DockConfiguration.Left);
+    } else if (side === WI.DockConfiguration.Right) {
+        document.body.classList.add("docked", WI.DockConfiguration.Right);
+        document.body.classList.remove("window-inactive", WI.DockConfiguration.Bottom, WI.DockConfiguration.Left);
+    } else if (side === WI.DockConfiguration.Left) {
+        document.body.classList.add("docked", WI.DockConfiguration.Left);
+        document.body.classList.remove("window-inactive", WI.DockConfiguration.Bottom, WI.DockConfiguration.Right);
     } else
-        document.body.classList.remove("docked", WebInspector.DockConfiguration.Right, WebInspector.DockConfiguration.Left, WebInspector.DockConfiguration.Bottom);
+        document.body.classList.remove("docked", WI.DockConfiguration.Right, WI.DockConfiguration.Left, WI.DockConfiguration.Bottom);
 
     this._ignoreToolbarModeDidChangeEvents = false;
 
@@ -792,19 +792,19 @@
         this.hideSplitConsole();
 };
 
-WebInspector.updateVisibilityState = function(visible)
+WI.updateVisibilityState = function(visible)
 {
     this.visible = visible;
-    this.notifications.dispatchEventToListeners(WebInspector.Notification.VisibilityStateDidChange);
+    this.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange);
 };
 
-WebInspector.handlePossibleLinkClick = function(event, frame, options = {})
+WI.handlePossibleLinkClick = function(event, frame, options = {})
 {
     var anchorElement = event.target.enclosingNodeOrSelfWithNodeName("a");
     if (!anchorElement || !anchorElement.href)
         return false;
 
-    if (WebInspector.isBeingEdited(anchorElement)) {
+    if (WI.isBeingEdited(anchorElement)) {
         // Don't follow the link when it is being edited.
         return false;
     }
@@ -818,7 +818,7 @@
     return true;
 };
 
-WebInspector.openURL = function(url, frame, options = {})
+WI.openURL = function(url, frame, options = {})
 {
     console.assert(url);
     if (!url)
@@ -843,11 +843,11 @@
 
     console.assert(frame);
 
-    // WebInspector.Frame.resourceForURL does not check the main resource, only sub-resources. So check both.
+    // WI.Frame.resourceForURL does not check the main resource, only sub-resources. So check both.
     let simplifiedURL = removeURLFragment(url);
     var resource = frame.url === simplifiedURL ? frame.mainResource : frame.resourceForURL(simplifiedURL, searchChildFrames);
     if (resource) {
-        let positionToReveal = new WebInspector.SourceCodePosition(options.lineNumber, 0);
+        let positionToReveal = new WI.SourceCodePosition(options.lineNumber, 0);
         this.showSourceCode(resource, Object.shallowMerge(options, {positionToReveal}));
         return;
     }
@@ -855,7 +855,7 @@
     InspectorFrontendHost.openInNewTab(url);
 };
 
-WebInspector.close = function()
+WI.close = function()
 {
     if (this._isClosing)
         return;
@@ -865,28 +865,28 @@
     InspectorFrontendHost.closeWindow();
 };
 
-WebInspector.isConsoleFocused = function()
+WI.isConsoleFocused = function()
 {
     return this.quickConsole.prompt.focused;
 };
 
-WebInspector.isShowingSplitConsole = function()
+WI.isShowingSplitConsole = function()
 {
     return !this.consoleDrawer.collapsed;
 };
 
-WebInspector.dockedConfigurationSupportsSplitContentBrowser = function()
+WI.dockedConfigurationSupportsSplitContentBrowser = function()
 {
-    return this._dockConfiguration !== WebInspector.DockConfiguration.Bottom;
+    return this._dockConfiguration !== WI.DockConfiguration.Bottom;
 };
 
-WebInspector.doesCurrentTabSupportSplitContentBrowser = function()
+WI.doesCurrentTabSupportSplitContentBrowser = function()
 {
     var currentContentView = this.tabBrowser.selectedTabContentView;
     return !currentContentView || currentContentView.supportsSplitContentBrowser;
 };
 
-WebInspector.toggleSplitConsole = function()
+WI.toggleSplitConsole = function()
 {
     if (!this.doesCurrentTabSupportSplitContentBrowser()) {
         this.showConsoleTab();
@@ -899,7 +899,7 @@
         this.showSplitConsole();
 };
 
-WebInspector.showSplitConsole = function()
+WI.showSplitConsole = function()
 {
     if (!this.doesCurrentTabSupportSplitContentBrowser()) {
         this.showConsoleTab();
@@ -918,7 +918,7 @@
     this.consoleDrawer.showContentView(this.consoleContentView);
 };
 
-WebInspector.hideSplitConsole = function()
+WI.hideSplitConsole = function()
 {
     if (!this.isShowingSplitConsole())
         return;
@@ -926,9 +926,9 @@
     this.consoleDrawer.collapsed = true;
 };
 
-WebInspector.showConsoleTab = function(requestedScope)
+WI.showConsoleTab = function(requestedScope)
 {
-    requestedScope = requestedScope || WebInspector.LogContentView.Scopes.All;
+    requestedScope = requestedScope || WI.LogContentView.Scopes.All;
 
     this.hideSplitConsole();
 
@@ -939,26 +939,26 @@
     console.assert(this.isShowingConsoleTab());
 };
 
-WebInspector.isShowingConsoleTab = function()
+WI.isShowingConsoleTab = function()
 {
-    return this.tabBrowser.selectedTabContentView instanceof WebInspector.ConsoleTabContentView;
+    return this.tabBrowser.selectedTabContentView instanceof WI.ConsoleTabContentView;
 };
 
-WebInspector.showElementsTab = function()
+WI.showElementsTab = function()
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.ElementsTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.ElementsTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.ElementsTabContentView;
+        tabContentView = new WI.ElementsTabContentView;
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.showDebuggerTab = function(options)
+WI.showDebuggerTab = function(options)
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.DebuggerTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.DebuggerTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.DebuggerTabContentView;
+        tabContentView = new WI.DebuggerTabContentView;
 
-    if (options.breakpointToSelect instanceof WebInspector.Breakpoint)
+    if (options.breakpointToSelect instanceof WI.Breakpoint)
         tabContentView.revealAndSelectBreakpoint(options.breakpointToSelect);
 
     if (options.showScopeChainSidebar)
@@ -967,62 +967,62 @@
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.isShowingDebuggerTab = function()
+WI.isShowingDebuggerTab = function()
 {
-    return this.tabBrowser.selectedTabContentView instanceof WebInspector.DebuggerTabContentView;
+    return this.tabBrowser.selectedTabContentView instanceof WI.DebuggerTabContentView;
 };
 
-WebInspector.showResourcesTab = function()
+WI.showResourcesTab = function()
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.ResourcesTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.ResourcesTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.ResourcesTabContentView;
+        tabContentView = new WI.ResourcesTabContentView;
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.isShowingResourcesTab = function()
+WI.isShowingResourcesTab = function()
 {
-    return this.tabBrowser.selectedTabContentView instanceof WebInspector.ResourcesTabContentView;
+    return this.tabBrowser.selectedTabContentView instanceof WI.ResourcesTabContentView;
 };
 
-WebInspector.showStorageTab = function()
+WI.showStorageTab = function()
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.StorageTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.StorageTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.StorageTabContentView;
+        tabContentView = new WI.StorageTabContentView;
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.showNetworkTab = function()
+WI.showNetworkTab = function()
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.NetworkTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.NetworkTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.NetworkTabContentView;
+        tabContentView = new WI.NetworkTabContentView;
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.showTimelineTab = function()
+WI.showTimelineTab = function()
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.TimelineTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.TimelineTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.TimelineTabContentView;
+        tabContentView = new WI.TimelineTabContentView;
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
-WebInspector.indentString = function()
+WI.indentString = function()
 {
-    if (WebInspector.settings.indentWithTabs.value)
+    if (WI.settings.indentWithTabs.value)
         return "\t";
-    return " ".repeat(WebInspector.settings.indentUnit.value);
+    return " ".repeat(WI.settings.indentUnit.value);
 };
 
-WebInspector.restoreFocusFromElement = function(element)
+WI.restoreFocusFromElement = function(element)
 {
     if (element && element.isSelfOrAncestor(this.currentFocusElement))
         this.previousFocusElement.focus();
 };
 
-WebInspector.toggleNavigationSidebar = function(event)
+WI.toggleNavigationSidebar = function(event)
 {
     if (!this.navigationSidebar.collapsed || !this.navigationSidebar.sidebarPanels.length) {
         this.navigationSidebar.collapsed = true;
@@ -1034,7 +1034,7 @@
     this.navigationSidebar.collapsed = false;
 };
 
-WebInspector.toggleDetailsSidebar = function(event)
+WI.toggleDetailsSidebar = function(event)
 {
     if (!this.detailsSidebar.collapsed || !this.detailsSidebar.sidebarPanels.length) {
         this.detailsSidebar.collapsed = true;
@@ -1046,51 +1046,51 @@
     this.detailsSidebar.collapsed = false;
 };
 
-WebInspector.tabContentViewClassForRepresentedObject = function(representedObject)
+WI.tabContentViewClassForRepresentedObject = function(representedObject)
 {
-    if (representedObject instanceof WebInspector.DOMTree)
-        return WebInspector.ElementsTabContentView;
+    if (representedObject instanceof WI.DOMTree)
+        return WI.ElementsTabContentView;
 
-    if (representedObject instanceof WebInspector.TimelineRecording)
-        return WebInspector.TimelineTabContentView;
+    if (representedObject instanceof WI.TimelineRecording)
+        return WI.TimelineTabContentView;
 
     // We only support one console tab right now. So this isn't an instanceof check.
     if (representedObject === this._consoleRepresentedObject)
-        return WebInspector.ConsoleTabContentView;
+        return WI.ConsoleTabContentView;
 
-    if (WebInspector.debuggerManager.paused) {
-        if (representedObject instanceof WebInspector.Script)
-            return WebInspector.DebuggerTabContentView;
+    if (WI.debuggerManager.paused) {
+        if (representedObject instanceof WI.Script)
+            return WI.DebuggerTabContentView;
 
-        if (representedObject instanceof WebInspector.Resource && (representedObject.type === WebInspector.Resource.Type.Document || representedObject.type === WebInspector.Resource.Type.Script))
-            return WebInspector.DebuggerTabContentView;
+        if (representedObject instanceof WI.Resource && (representedObject.type === WI.Resource.Type.Document || representedObject.type === WI.Resource.Type.Script))
+            return WI.DebuggerTabContentView;
     }
 
-    if (representedObject instanceof WebInspector.Frame
-        || representedObject instanceof WebInspector.Resource
-        || representedObject instanceof WebInspector.Script
-        || representedObject instanceof WebInspector.CSSStyleSheet
-        || representedObject instanceof WebInspector.Canvas)
-        return WebInspector.ResourcesTabContentView;
+    if (representedObject instanceof WI.Frame
+        || representedObject instanceof WI.Resource
+        || representedObject instanceof WI.Script
+        || representedObject instanceof WI.CSSStyleSheet
+        || representedObject instanceof WI.Canvas)
+        return WI.ResourcesTabContentView;
 
     // FIXME: Move Content Flows to the Elements tab?
-    if (representedObject instanceof WebInspector.ContentFlow)
-        return WebInspector.ResourcesTabContentView;
+    if (representedObject instanceof WI.ContentFlow)
+        return WI.ResourcesTabContentView;
 
     // FIXME: Move these to a Storage tab.
-    if (representedObject instanceof WebInspector.DOMStorageObject || representedObject instanceof WebInspector.CookieStorageObject ||
-        representedObject instanceof WebInspector.DatabaseTableObject || representedObject instanceof WebInspector.DatabaseObject ||
-        representedObject instanceof WebInspector.ApplicationCacheFrame || representedObject instanceof WebInspector.IndexedDatabaseObjectStore ||
-        representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
-        return WebInspector.ResourcesTabContentView;
+    if (representedObject instanceof WI.DOMStorageObject || representedObject instanceof WI.CookieStorageObject ||
+        representedObject instanceof WI.DatabaseTableObject || representedObject instanceof WI.DatabaseObject ||
+        representedObject instanceof WI.ApplicationCacheFrame || representedObject instanceof WI.IndexedDatabaseObjectStore ||
+        representedObject instanceof WI.IndexedDatabaseObjectStoreIndex)
+        return WI.ResourcesTabContentView;
 
-    if (representedObject instanceof WebInspector.Recording)
-        return WebInspector.RecordingTabContentView;
+    if (representedObject instanceof WI.Recording)
+        return WI.RecordingTabContentView;
 
     return null;
 };
 
-WebInspector.tabContentViewForRepresentedObject = function(representedObject, options = {})
+WI.tabContentViewForRepresentedObject = function(representedObject, options = {})
 {
     let tabContentView = this.tabBrowser.bestTabContentViewForRepresentedObject(representedObject, options);
     if (tabContentView)
@@ -1109,7 +1109,7 @@
     return tabContentView;
 };
 
-WebInspector.showRepresentedObject = function(representedObject, cookie, options = {})
+WI.showRepresentedObject = function(representedObject, cookie, options = {})
 {
     let tabContentView = this.tabContentViewForRepresentedObject(representedObject, options);
     console.assert(tabContentView);
@@ -1120,17 +1120,17 @@
     tabContentView.showRepresentedObject(representedObject, cookie);
 };
 
-WebInspector.showMainFrameDOMTree = function(nodeToSelect, options = {})
+WI.showMainFrameDOMTree = function(nodeToSelect, options = {})
 {
-    console.assert(WebInspector.frameResourceManager.mainFrame);
-    if (!WebInspector.frameResourceManager.mainFrame)
+    console.assert(WI.frameResourceManager.mainFrame);
+    if (!WI.frameResourceManager.mainFrame)
         return;
-    this.showRepresentedObject(WebInspector.frameResourceManager.mainFrame.domTree, {nodeToSelect}, options);
+    this.showRepresentedObject(WI.frameResourceManager.mainFrame.domTree, {nodeToSelect}, options);
 };
 
-WebInspector.showSourceCodeForFrame = function(frameIdentifier, options = {})
+WI.showSourceCodeForFrame = function(frameIdentifier, options = {})
 {
-    var frame = WebInspector.frameResourceManager.frameForIdentifier(frameIdentifier);
+    var frame = WI.frameResourceManager.frameForIdentifier(frameIdentifier);
     if (!frame) {
         this._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier;
         return;
@@ -1141,14 +1141,14 @@
     this.showRepresentedObject(frame, null, options);
 };
 
-WebInspector.showSourceCode = function(sourceCode, options = {})
+WI.showSourceCode = function(sourceCode, options = {})
 {
     const positionToReveal = options.positionToReveal;
 
-    console.assert(!positionToReveal || positionToReveal instanceof WebInspector.SourceCodePosition, positionToReveal);
+    console.assert(!positionToReveal || positionToReveal instanceof WI.SourceCodePosition, positionToReveal);
     var representedObject = sourceCode;
 
-    if (representedObject instanceof WebInspector.Script) {
+    if (representedObject instanceof WI.Script) {
         // A script represented by a resource should always show the resource.
         representedObject = representedObject.resource || representedObject;
     }
@@ -1157,14 +1157,14 @@
     this.showRepresentedObject(representedObject, cookie, options);
 };
 
-WebInspector.showSourceCodeLocation = function(sourceCodeLocation, options = {})
+WI.showSourceCodeLocation = function(sourceCodeLocation, options = {})
 {
     this.showSourceCode(sourceCodeLocation.displaySourceCode, Object.shallowMerge(options, {
         positionToReveal: sourceCodeLocation.displayPosition(),
     }));
 };
 
-WebInspector.showOriginalUnformattedSourceCodeLocation = function(sourceCodeLocation, options = {})
+WI.showOriginalUnformattedSourceCodeLocation = function(sourceCodeLocation, options = {})
 {
     this.showSourceCode(sourceCodeLocation.sourceCode, Object.shallowMerge(options, {
         positionToReveal: sourceCodeLocation.position(),
@@ -1172,14 +1172,14 @@
     }));
 };
 
-WebInspector.showOriginalOrFormattedSourceCodeLocation = function(sourceCodeLocation, options = {})
+WI.showOriginalOrFormattedSourceCodeLocation = function(sourceCodeLocation, options = {})
 {
     this.showSourceCode(sourceCodeLocation.sourceCode, Object.shallowMerge(options, {
         positionToReveal: sourceCodeLocation.formattedPosition(),
     }));
 };
 
-WebInspector.showOriginalOrFormattedSourceCodeTextRange = function(sourceCodeTextRange, options = {})
+WI.showOriginalOrFormattedSourceCodeTextRange = function(sourceCodeTextRange, options = {})
 {
     var textRangeToSelect = sourceCodeTextRange.formattedTextRange;
     this.showSourceCode(sourceCodeTextRange.sourceCode, Object.shallowMerge(options, {
@@ -1188,44 +1188,44 @@
     }));
 };
 
-WebInspector.showResourceRequest = function(resource, options = {})
+WI.showResourceRequest = function(resource, options = {})
 {
-    this.showRepresentedObject(resource, {[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WebInspector.ResourceClusterContentView.RequestIdentifier}, options);
+    this.showRepresentedObject(resource, {[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WI.ResourceClusterContentView.RequestIdentifier}, options);
 };
 
-WebInspector.debuggerToggleBreakpoints = function(event)
+WI.debuggerToggleBreakpoints = function(event)
 {
-    WebInspector.debuggerManager.breakpointsEnabled = !WebInspector.debuggerManager.breakpointsEnabled;
+    WI.debuggerManager.breakpointsEnabled = !WI.debuggerManager.breakpointsEnabled;
 };
 
-WebInspector.debuggerPauseResumeToggle = function(event)
+WI.debuggerPauseResumeToggle = function(event)
 {
-    if (WebInspector.debuggerManager.paused)
-        WebInspector.debuggerManager.resume();
+    if (WI.debuggerManager.paused)
+        WI.debuggerManager.resume();
     else
-        WebInspector.debuggerManager.pause();
+        WI.debuggerManager.pause();
 };
 
-WebInspector.debuggerStepOver = function(event)
+WI.debuggerStepOver = function(event)
 {
-    WebInspector.debuggerManager.stepOver();
+    WI.debuggerManager.stepOver();
 };
 
-WebInspector.debuggerStepInto = function(event)
+WI.debuggerStepInto = function(event)
 {
-    WebInspector.debuggerManager.stepInto();
+    WI.debuggerManager.stepInto();
 };
 
-WebInspector.debuggerStepOut = function(event)
+WI.debuggerStepOut = function(event)
 {
-    WebInspector.debuggerManager.stepOut();
+    WI.debuggerManager.stepOut();
 };
 
-WebInspector._searchTextDidChange = function(event)
+WI._searchTextDidChange = function(event)
 {
-    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.SearchTabContentView);
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.SearchTabContentView);
     if (!tabContentView)
-        tabContentView = new WebInspector.SearchTabContentView;
+        tabContentView = new WI.SearchTabContentView;
 
     var searchQuery = this._searchToolbarItem.text;
     this._searchToolbarItem.text = "";
@@ -1235,9 +1235,9 @@
     tabContentView.performSearch(searchQuery);
 };
 
-WebInspector._focusSearchField = function(event)
+WI._focusSearchField = function(event)
 {
-    if (this.tabBrowser.selectedTabContentView instanceof WebInspector.SearchTabContentView) {
+    if (this.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView) {
         this.tabBrowser.selectedTabContentView.focusSearchField();
         return;
     }
@@ -1245,13 +1245,13 @@
     this._searchToolbarItem.focus();
 };
 
-WebInspector._focusChanged = function(event)
+WI._focusChanged = function(event)
 {
     // Make a caret selection inside the focused element if there isn't a range selection and there isn't already
     // a caret selection inside. This is needed (at least) to remove caret from console when focus is moved.
     // The selection change should not apply to text fields and text areas either.
 
-    if (WebInspector.isEventTargetAnEditableField(event)) {
+    if (WI.isEventTargetAnEditableField(event)) {
         // Still update the currentFocusElement if inside of a CodeMirror editor.
         var codeMirrorEditorElement = event.target.enclosingNodeOrSelfWithClass("CodeMirror");
         if (codeMirrorEditorElement && codeMirrorEditorElement !== this.currentFocusElement) {
@@ -1259,11 +1259,11 @@
             this.currentFocusElement = codeMirrorEditorElement;
         }
 
-        // Due to the change in WebInspector.isEventTargetAnEditableField (r196271), this return
-        // will also get run when WebInspector.startEditing is called on an element. We do not want
-        // to return early in this case, as WebInspector.EditingConfig handles its own editing
-        // completion, so only return early if the focus change target is not from WebInspector.startEditing.
-        if (!WebInspector.isBeingEdited(event.target))
+        // Due to the change in WI.isEventTargetAnEditableField (r196271), this return
+        // will also get run when WI.startEditing is called on an element. We do not want
+        // to return early in this case, as WI.EditingConfig handles its own editing
+        // completion, so only return early if the focus change target is not from WI.startEditing.
+        if (!WI.isBeingEdited(event.target))
             return;
     }
 
@@ -1289,19 +1289,19 @@
     selection.addRange(selectionRange);
 };
 
-WebInspector._mouseWasClicked = function(event)
+WI._mouseWasClicked = function(event)
 {
     this.handlePossibleLinkClick(event);
 };
 
-WebInspector._dragOver = function(event)
+WI._dragOver = function(event)
 {
     // Do nothing if another event listener handled the event already.
     if (event.defaultPrevented)
         return;
 
     // Allow dropping into editable areas.
-    if (WebInspector.isEventTargetAnEditableField(event))
+    if (WI.isEventTargetAnEditableField(event))
         return;
 
     // Prevent the drop from being accepted.
@@ -1309,21 +1309,21 @@
     event.preventDefault();
 };
 
-WebInspector._debuggerDidPause = function(event)
+WI._debuggerDidPause = function(event)
 {
-    this.showDebuggerTab({showScopeChainSidebar: WebInspector.settings.showScopeChainOnPause.value});
+    this.showDebuggerTab({showScopeChainSidebar: WI.settings.showScopeChainOnPause.value});
 
     this._dashboardContainer.showDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger);
 
     InspectorFrontendHost.bringToFront();
 };
 
-WebInspector._debuggerDidResume = function(event)
+WI._debuggerDidResume = function(event)
 {
     this._dashboardContainer.closeDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger);
 };
 
-WebInspector._frameWasAdded = function(event)
+WI._frameWasAdded = function(event)
 {
     if (!this._frameIdentifierToShowSourceCodeWhenAvailable)
         return;
@@ -1346,14 +1346,14 @@
     setTimeout(delayedWork.bind(this));
 };
 
-WebInspector._mainFrameDidChange = function(event)
+WI._mainFrameDidChange = function(event)
 {
     this._updateDownloadToolbarButton();
 
     this.updateWindowTitle();
 };
 
-WebInspector._mainResourceDidChange = function(event)
+WI._mainResourceDidChange = function(event)
 {
     if (!event.target.isMainFrame())
         return;
@@ -1362,14 +1362,14 @@
 
     // Run cookie restoration after we are sure all of the Tabs and NavigationSidebarPanels
     // have updated with respect to the main resource change.
-    setTimeout(this._restoreCookieForOpenTabs.bind(this, WebInspector.StateRestorationType.Navigation));
+    setTimeout(this._restoreCookieForOpenTabs.bind(this, WI.StateRestorationType.Navigation));
 
     this._updateDownloadToolbarButton();
 
     this.updateWindowTitle();
 };
 
-WebInspector._provisionalLoadStarted = function(event)
+WI._provisionalLoadStarted = function(event)
 {
     if (!event.target.isMainFrame())
         return;
@@ -1379,27 +1379,27 @@
     this._inProvisionalLoad = true;
 };
 
-WebInspector._restoreCookieForOpenTabs = function(restorationType)
+WI._restoreCookieForOpenTabs = function(restorationType)
 {
     for (var tabBarItem of this.tabBar.tabBarItems) {
         var tabContentView = tabBarItem.representedObject;
-        if (!(tabContentView instanceof WebInspector.TabContentView))
+        if (!(tabContentView instanceof WI.TabContentView))
             continue;
         tabContentView.restoreStateFromCookie(restorationType);
     }
 };
 
-WebInspector._saveCookieForOpenTabs = function()
+WI._saveCookieForOpenTabs = function()
 {
     for (var tabBarItem of this.tabBar.tabBarItems) {
         var tabContentView = tabBarItem.representedObject;
-        if (!(tabContentView instanceof WebInspector.TabContentView))
+        if (!(tabContentView instanceof WI.TabContentView))
             continue;
         tabContentView.saveStateToCookie();
     }
 };
 
-WebInspector._windowFocused = function(event)
+WI._windowFocused = function(event)
 {
     if (event.target.document.nodeType !== Node.DOCUMENT_NODE)
         return;
@@ -1408,7 +1408,7 @@
     document.body.classList.remove(this.docked ? "window-docked-inactive" : "window-inactive");
 };
 
-WebInspector._windowBlurred = function(event)
+WI._windowBlurred = function(event)
 {
     if (event.target.document.nodeType !== Node.DOCUMENT_NODE)
         return;
@@ -1417,40 +1417,40 @@
     document.body.classList.add(this.docked ? "window-docked-inactive" : "window-inactive");
 };
 
-WebInspector._windowResized = function(event)
+WI._windowResized = function(event)
 {
-    this.toolbar.updateLayout(WebInspector.View.LayoutReason.Resize);
-    this.tabBar.updateLayout(WebInspector.View.LayoutReason.Resize);
+    this.toolbar.updateLayout(WI.View.LayoutReason.Resize);
+    this.tabBar.updateLayout(WI.View.LayoutReason.Resize);
     this._tabBrowserSizeDidChange();
 };
 
-WebInspector._updateModifierKeys = function(event)
+WI._updateModifierKeys = function(event)
 {
     var didChange = this.modifierKeys.altKey !== event.altKey || this.modifierKeys.metaKey !== event.metaKey || this.modifierKeys.shiftKey !== event.shiftKey;
 
     this.modifierKeys = {altKey: event.altKey, metaKey: event.metaKey, shiftKey: event.shiftKey};
 
     if (didChange)
-        this.notifications.dispatchEventToListeners(WebInspector.Notification.GlobalModifierKeysDidChange, event);
+        this.notifications.dispatchEventToListeners(WI.Notification.GlobalModifierKeysDidChange, event);
 };
 
-WebInspector._windowKeyDown = function(event)
+WI._windowKeyDown = function(event)
 {
     this._updateModifierKeys(event);
 };
 
-WebInspector._windowKeyUp = function(event)
+WI._windowKeyUp = function(event)
 {
     this._updateModifierKeys(event);
 };
 
-WebInspector._mouseDown = function(event)
+WI._mouseDown = function(event)
 {
     if (this.toolbar.element.isSelfOrAncestor(event.target))
         this._toolbarMouseDown(event);
 };
 
-WebInspector._mouseMoved = function(event)
+WI._mouseMoved = function(event)
 {
     this._updateModifierKeys(event);
     this.mouseCoords = {
@@ -1459,85 +1459,85 @@
     };
 };
 
-WebInspector._pageHidden = function(event)
+WI._pageHidden = function(event)
 {
     this._saveCookieForOpenTabs();
 };
 
-WebInspector._contextMenuRequested = function(event)
+WI._contextMenuRequested = function(event)
 {
     let proposedContextMenu;
 
     // This is setting is only defined in engineering builds.
-    if (WebInspector.isDebugUIEnabled()) {
-        proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event);
+    if (WI.isDebugUIEnabled()) {
+        proposedContextMenu = WI.ContextMenu.createFromEvent(event);
         proposedContextMenu.appendSeparator();
-        proposedContextMenu.appendItem(WebInspector.unlocalizedString("Reload Web Inspector"), () => {
+        proposedContextMenu.appendItem(WI.unlocalizedString("Reload Web Inspector"), () => {
             window.location.reload();
         });
 
-        let protocolSubMenu = proposedContextMenu.appendSubMenuItem(WebInspector.unlocalizedString("Protocol Debugging"), null, false);
-        let isCapturingTraffic = InspectorBackend.activeTracer instanceof WebInspector.CapturingProtocolTracer;
+        let protocolSubMenu = proposedContextMenu.appendSubMenuItem(WI.unlocalizedString("Protocol Debugging"), null, false);
+        let isCapturingTraffic = InspectorBackend.activeTracer instanceof WI.CapturingProtocolTracer;
 
-        protocolSubMenu.appendCheckboxItem(WebInspector.unlocalizedString("Capture Trace"), () => {
+        protocolSubMenu.appendCheckboxItem(WI.unlocalizedString("Capture Trace"), () => {
             if (isCapturingTraffic)
                 InspectorBackend.activeTracer = null;
             else
-                InspectorBackend.activeTracer = new WebInspector.CapturingProtocolTracer;
+                InspectorBackend.activeTracer = new WI.CapturingProtocolTracer;
         }, isCapturingTraffic);
 
         protocolSubMenu.appendSeparator();
 
-        protocolSubMenu.appendItem(WebInspector.unlocalizedString("Export Trace\u2026"), () => {
+        protocolSubMenu.appendItem(WI.unlocalizedString("Export Trace\u2026"), () => {
             const forceSaveAs = true;
-            WebInspector.saveDataToFile(InspectorBackend.activeTracer.trace.saveData, forceSaveAs);
+            WI.saveDataToFile(InspectorBackend.activeTracer.trace.saveData, forceSaveAs);
         }, !isCapturingTraffic);
     } else {
         const onlyExisting = true;
-        proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event, onlyExisting);
+        proposedContextMenu = WI.ContextMenu.createFromEvent(event, onlyExisting);
     }
 
     if (proposedContextMenu)
         proposedContextMenu.show();
 };
 
-WebInspector.isDebugUIEnabled = function()
+WI.isDebugUIEnabled = function()
 {
-    return WebInspector.showDebugUISetting && WebInspector.showDebugUISetting.value;
+    return WI.showDebugUISetting && WI.showDebugUISetting.value;
 };
 
-WebInspector._undock = function(event)
+WI._undock = function(event)
 {
-    InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Undocked);
+    InspectorFrontendHost.requestSetDockSide(WI.DockConfiguration.Undocked);
 };
 
-WebInspector._dockBottom = function(event)
+WI._dockBottom = function(event)
 {
-    InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Bottom);
+    InspectorFrontendHost.requestSetDockSide(WI.DockConfiguration.Bottom);
 };
 
-WebInspector._dockRight = function(event)
+WI._dockRight = function(event)
 {
-    InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Right);
+    InspectorFrontendHost.requestSetDockSide(WI.DockConfiguration.Right);
 };
 
-WebInspector._dockLeft = function(event)
+WI._dockLeft = function(event)
 {
-    InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Left);
+    InspectorFrontendHost.requestSetDockSide(WI.DockConfiguration.Left);
 };
 
-WebInspector._togglePreviousDockConfiguration = function(event)
+WI._togglePreviousDockConfiguration = function(event)
 {
     InspectorFrontendHost.requestSetDockSide(this._previousDockConfiguration);
 };
 
-WebInspector._updateDockNavigationItems = function()
+WI._updateDockNavigationItems = function()
 {
     if (this._dockingAvailable || this.docked) {
         this._closeToolbarButton.hidden = !this.docked;
-        this._undockToolbarButton.hidden = this._dockConfiguration === WebInspector.DockConfiguration.Undocked;
-        this._dockBottomToolbarButton.hidden = this._dockConfiguration === WebInspector.DockConfiguration.Bottom;
-        this._dockToSideToolbarButton.hidden = this._dockConfiguration === WebInspector.DockConfiguration.Right || this._dockConfiguration === WebInspector.DockConfiguration.Left;
+        this._undockToolbarButton.hidden = this._dockConfiguration === WI.DockConfiguration.Undocked;
+        this._dockBottomToolbarButton.hidden = this._dockConfiguration === WI.DockConfiguration.Bottom;
+        this._dockToSideToolbarButton.hidden = this._dockConfiguration === WI.DockConfiguration.Right || this._dockConfiguration === WI.DockConfiguration.Left;
     } else {
         this._closeToolbarButton.hidden = true;
         this._undockToolbarButton.hidden = true;
@@ -1546,33 +1546,33 @@
     }
 };
 
-WebInspector._tabBrowserSizeDidChange = function()
+WI._tabBrowserSizeDidChange = function()
 {
-    this.tabBrowser.updateLayout(WebInspector.View.LayoutReason.Resize);
-    this.consoleDrawer.updateLayout(WebInspector.View.LayoutReason.Resize);
-    this.quickConsole.updateLayout(WebInspector.View.LayoutReason.Resize);
+    this.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);
+    this.consoleDrawer.updateLayout(WI.View.LayoutReason.Resize);
+    this.quickConsole.updateLayout(WI.View.LayoutReason.Resize);
 };
 
-WebInspector._consoleDrawerCollapsedStateDidChange = function(event)
+WI._consoleDrawerCollapsedStateDidChange = function(event)
 {
-    this._showingSplitConsoleSetting.value = WebInspector.isShowingSplitConsole();
+    this._showingSplitConsoleSetting.value = WI.isShowingSplitConsole();
 
-    WebInspector._consoleDrawerDidResize();
+    WI._consoleDrawerDidResize();
 };
 
-WebInspector._consoleDrawerDidResize = function(event)
+WI._consoleDrawerDidResize = function(event)
 {
-    this.tabBrowser.updateLayout(WebInspector.View.LayoutReason.Resize);
+    this.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);
 };
 
-WebInspector._sidebarWidthDidChange = function(event)
+WI._sidebarWidthDidChange = function(event)
 {
     this._tabBrowserSizeDidChange();
 };
 
-WebInspector._setupViewHierarchy = function()
+WI._setupViewHierarchy = function()
 {
-    let rootView = WebInspector.View.rootView();
+    let rootView = WI.View.rootView();
     rootView.addSubview(this.toolbar);
     rootView.addSubview(this.tabBar);
     rootView.addSubview(this.navigationSidebar);
@@ -1582,7 +1582,7 @@
     rootView.addSubview(this.detailsSidebar);
 };
 
-WebInspector._tabBrowserSelectedTabContentViewDidChange = function(event)
+WI._tabBrowserSelectedTabContentViewDidChange = function(event)
 {
     if (this.tabBar.selectedTabBarItem && this.tabBar.selectedTabBarItem.representedObject.constructor.shouldSaveTab())
         this._selectedTabIndexSetting.value = this.tabBar.tabBarItems.indexOf(this.tabBar.selectedTabBarItem);
@@ -1599,12 +1599,12 @@
     this.hideSplitConsole();
 };
 
-WebInspector._toolbarMouseDown = function(event)
+WI._toolbarMouseDown = function(event)
 {
     if (event.ctrlKey)
         return;
 
-    if (this._dockConfiguration === WebInspector.DockConfiguration.Right || this._dockConfiguration === WebInspector.DockConfiguration.Left)
+    if (this._dockConfiguration === WI.DockConfiguration.Right || this._dockConfiguration === WI.DockConfiguration.Left)
         return;
 
     if (this.docked)
@@ -1613,7 +1613,7 @@
         this._moveWindowMouseDown(event);
 };
 
-WebInspector._dockedResizerMouseDown = function(event)
+WI._dockedResizerMouseDown = function(event)
 {
     if (event.button !== 0 || event.ctrlKey)
         return;
@@ -1626,11 +1626,11 @@
         !event.target.classList.contains("flexible-space") && !event.target.classList.contains("item-section"))
         return;
 
-    event[WebInspector.Popover.EventPreventDismissSymbol] = true;
+    event[WI.Popover.EventPreventDismissSymbol] = true;
 
-    let windowProperty = this._dockConfiguration === WebInspector.DockConfiguration.Bottom ? "innerHeight" : "innerWidth";
-    let eventScreenProperty = this._dockConfiguration === WebInspector.DockConfiguration.Bottom ? "screenY" : "screenX";
-    let eventClientProperty = this._dockConfiguration === WebInspector.DockConfiguration.Bottom ? "clientY" : "clientX";
+    let windowProperty = this._dockConfiguration === WI.DockConfiguration.Bottom ? "innerHeight" : "innerWidth";
+    let eventScreenProperty = this._dockConfiguration === WI.DockConfiguration.Bottom ? "screenY" : "screenX";
+    let eventClientProperty = this._dockConfiguration === WI.DockConfiguration.Bottom ? "clientY" : "clientX";
 
     var resizerElement = event.target;
     var firstClientPosition = event[eventClientProperty];
@@ -1647,7 +1647,7 @@
 
         lastScreenPosition = position;
 
-        if (this._dockConfiguration === WebInspector.DockConfiguration.Left) {
+        if (this._dockConfiguration === WI.DockConfiguration.Left) {
             // If the mouse is travelling rightward but is positioned left of the resizer, ignore the event.
             if (delta > 0 && clientPosition < firstClientPosition)
                 return;
@@ -1674,7 +1674,7 @@
         // width or height should be the same in device pixels regardless of the document zoom.
         dimension *= this.getZoomFactor();
 
-        if (this._dockConfiguration === WebInspector.DockConfiguration.Bottom)
+        if (this._dockConfiguration === WI.DockConfiguration.Bottom)
             InspectorFrontendHost.setAttachedWindowHeight(dimension);
         else
             InspectorFrontendHost.setAttachedWindowWidth(dimension);
@@ -1685,13 +1685,13 @@
         if (event.button !== 0)
             return;
 
-        WebInspector.elementDragEnd(event);
+        WI.elementDragEnd(event);
     }
 
-    WebInspector.elementDragStart(resizerElement, dockedResizerDrag.bind(this), dockedResizerDragEnd.bind(this), event, this._dockConfiguration === WebInspector.DockConfiguration.Bottom ? "row-resize" : "col-resize");
+    WI.elementDragStart(resizerElement, dockedResizerDrag.bind(this), dockedResizerDragEnd.bind(this), event, this._dockConfiguration === WI.DockConfiguration.Bottom ? "row-resize" : "col-resize");
 };
 
-WebInspector._moveWindowMouseDown = function(event)
+WI._moveWindowMouseDown = function(event)
 {
     console.assert(!this.docked);
 
@@ -1703,18 +1703,18 @@
         !event.target.classList.contains("item-section"))
         return;
 
-    event[WebInspector.Popover.EventPreventDismissSymbol] = true;
+    event[WI.Popover.EventPreventDismissSymbol] = true;
 
-    if (WebInspector.Platform.name === "mac") {
+    if (WI.Platform.name === "mac") {
         // New Mac releases can start a window drag.
-        if (WebInspector.Platform.version.release >= 11) {
+        if (WI.Platform.version.release >= 11) {
             InspectorFrontendHost.startWindowDrag();
             event.preventDefault();
             return;
         }
 
         // Ignore dragging on the top of the toolbar on Mac if the system handles it.
-        if (WebInspector.Platform.version.release === 10) {
+        if (WI.Platform.version.release === 10) {
             const windowDragHandledTitleBarHeight = 22;
             if (event.pageY < windowDragHandledTitleBarHeight) {
                 event.preventDefault();
@@ -1745,18 +1745,18 @@
         if (event.button !== 0)
             return;
 
-        WebInspector.elementDragEnd(event);
+        WI.elementDragEnd(event);
     }
 
-    WebInspector.elementDragStart(event.target, toolbarDrag, toolbarDragEnd, event, "default");
+    WI.elementDragStart(event.target, toolbarDrag, toolbarDragEnd, event, "default");
 };
 
-WebInspector._storageWasInspected = function(event)
+WI._storageWasInspected = function(event)
 {
     this.showStorageTab();
 };
 
-WebInspector._domNodeWasInspected = function(event)
+WI._domNodeWasInspected = function(event)
 {
     this.domTreeManager.highlightDOMNodeForTwoSeconds(event.data.node.id);
 
@@ -1766,22 +1766,22 @@
     this.showMainFrameDOMTree(event.data.node);
 };
 
-WebInspector._inspectModeStateChanged = function(event)
+WI._inspectModeStateChanged = function(event)
 {
     this._inspectModeToolbarButton.activated = this.domTreeManager.inspectModeEnabled;
 };
 
-WebInspector._toggleInspectMode = function(event)
+WI._toggleInspectMode = function(event)
 {
     this.domTreeManager.inspectModeEnabled = !this.domTreeManager.inspectModeEnabled;
 };
 
-WebInspector._downloadWebArchive = function(event)
+WI._downloadWebArchive = function(event)
 {
     this.archiveMainFrame();
 };
 
-WebInspector._reloadPage = function(event)
+WI._reloadPage = function(event)
 {
     if (!window.PageAgent)
         return;
@@ -1790,13 +1790,13 @@
     event.preventDefault();
 };
 
-WebInspector._reloadPageClicked = function(event)
+WI._reloadPageClicked = function(event)
 {
     // Ignore cache when the shift key is pressed.
     PageAgent.reload.invoke({shouldIgnoreCache: window.event ? window.event.shiftKey : false});
 };
 
-WebInspector._reloadPageIgnoringCache = function(event)
+WI._reloadPageIgnoringCache = function(event)
 {
     if (!window.PageAgent)
         return;
@@ -1805,7 +1805,7 @@
     event.preventDefault();
 };
 
-WebInspector._updateReloadToolbarButton = function()
+WI._updateReloadToolbarButton = function()
 {
     if (!window.PageAgent) {
         this._reloadToolbarButton.hidden = true;
@@ -1815,10 +1815,10 @@
     this._reloadToolbarButton.hidden = false;
 };
 
-WebInspector._updateDownloadToolbarButton = function()
+WI._updateDownloadToolbarButton = function()
 {
     // COMPATIBILITY (iOS 7): Page.archive did not exist yet.
-    if (!window.PageAgent || !PageAgent.archive || this.debuggableType !== WebInspector.DebuggableType.Web) {
+    if (!window.PageAgent || !PageAgent.archive || this.debuggableType !== WI.DebuggableType.Web) {
         this._downloadToolbarButton.hidden = true;
         return;
     }
@@ -1831,84 +1831,84 @@
     this._downloadToolbarButton.enabled = this.canArchiveMainFrame();
 };
 
-WebInspector._toggleInspectMode = function(event)
+WI._toggleInspectMode = function(event)
 {
     this.domTreeManager.inspectModeEnabled = !this.domTreeManager.inspectModeEnabled;
 };
 
-WebInspector._showConsoleTab = function(event)
+WI._showConsoleTab = function(event)
 {
     this.showConsoleTab();
 };
 
-WebInspector._focusConsolePrompt = function(event)
+WI._focusConsolePrompt = function(event)
 {
     this.quickConsole.prompt.focus();
 };
 
-WebInspector._focusedContentBrowser = function()
+WI._focusedContentBrowser = function()
 {
     if (this.tabBrowser.element.isSelfOrAncestor(this.currentFocusElement) || document.activeElement === document.body) {
         var tabContentView = this.tabBrowser.selectedTabContentView;
-        if (tabContentView instanceof WebInspector.ContentBrowserTabContentView)
+        if (tabContentView instanceof WI.ContentBrowserTabContentView)
             return tabContentView.contentBrowser;
         return null;
     }
 
     if (this.consoleDrawer.element.isSelfOrAncestor(this.currentFocusElement)
-        || (WebInspector.isShowingSplitConsole() && this.quickConsole.element.isSelfOrAncestor(this.currentFocusElement)))
+        || (WI.isShowingSplitConsole() && this.quickConsole.element.isSelfOrAncestor(this.currentFocusElement)))
         return this.consoleDrawer;
 
     return null;
 };
 
-WebInspector._focusedContentView = function()
+WI._focusedContentView = function()
 {
     if (this.tabBrowser.element.isSelfOrAncestor(this.currentFocusElement) || document.activeElement === document.body) {
         var tabContentView = this.tabBrowser.selectedTabContentView;
-        if (tabContentView instanceof WebInspector.ContentBrowserTabContentView)
+        if (tabContentView instanceof WI.ContentBrowserTabContentView)
             return tabContentView.contentBrowser.currentContentView;
         return tabContentView;
     }
 
     if (this.consoleDrawer.element.isSelfOrAncestor(this.currentFocusElement)
-        || (WebInspector.isShowingSplitConsole() && this.quickConsole.element.isSelfOrAncestor(this.currentFocusElement)))
+        || (WI.isShowingSplitConsole() && this.quickConsole.element.isSelfOrAncestor(this.currentFocusElement)))
         return this.consoleDrawer.currentContentView;
 
     return null;
 };
 
-WebInspector._focusedOrVisibleContentBrowser = function()
+WI._focusedOrVisibleContentBrowser = function()
 {
     let focusedContentBrowser = this._focusedContentBrowser();
     if (focusedContentBrowser)
         return focusedContentBrowser;
 
     var tabContentView = this.tabBrowser.selectedTabContentView;
-    if (tabContentView instanceof WebInspector.ContentBrowserTabContentView)
+    if (tabContentView instanceof WI.ContentBrowserTabContentView)
         return tabContentView.contentBrowser;
 
     return null;
 };
 
-WebInspector.focusedOrVisibleContentView = function()
+WI.focusedOrVisibleContentView = function()
 {
     let focusedContentView = this._focusedContentView();
     if (focusedContentView)
         return focusedContentView;
 
     var tabContentView = this.tabBrowser.selectedTabContentView;
-    if (tabContentView instanceof WebInspector.ContentBrowserTabContentView)
+    if (tabContentView instanceof WI.ContentBrowserTabContentView)
         return tabContentView.contentBrowser.currentContentView;
     return tabContentView;
 };
 
-WebInspector._beforecopy = function(event)
+WI._beforecopy = function(event)
 {
     var selection = window.getSelection();
 
     // If there is no selection, see if the focused element or focused ContentView can handle the copy event.
-    if (selection.isCollapsed && !WebInspector.isEventTargetAnEditableField(event)) {
+    if (selection.isCollapsed && !WI.isEventTargetAnEditableField(event)) {
         var focusedCopyHandler = this.currentFocusElement && this.currentFocusElement.copyHandler;
         if (focusedCopyHandler && typeof focusedCopyHandler.handleBeforeCopyEvent === "function") {
             focusedCopyHandler.handleBeforeCopyEvent(event);
@@ -1932,7 +1932,7 @@
     event.preventDefault();
 };
 
-WebInspector._find = function(event)
+WI._find = function(event)
 {
     let contentBrowser = this._focusedOrVisibleContentBrowser();
     if (!contentBrowser)
@@ -1941,25 +1941,25 @@
     contentBrowser.showFindBanner();
 };
 
-WebInspector._save = function(event)
+WI._save = function(event)
 {
     var contentView = this.focusedOrVisibleContentView();
     if (!contentView || !contentView.supportsSave)
         return;
 
-    WebInspector.saveDataToFile(contentView.saveData);
+    WI.saveDataToFile(contentView.saveData);
 };
 
-WebInspector._saveAs = function(event)
+WI._saveAs = function(event)
 {
     var contentView = this.focusedOrVisibleContentView();
     if (!contentView || !contentView.supportsSave)
         return;
 
-    WebInspector.saveDataToFile(contentView.saveData, true);
+    WI.saveDataToFile(contentView.saveData, true);
 };
 
-WebInspector._clear = function(event)
+WI._clear = function(event)
 {
     let contentView = this.focusedOrVisibleContentView();
     if (!contentView || typeof contentView.handleClearShortcut !== "function") {
@@ -1972,12 +1972,12 @@
     contentView.handleClearShortcut(event);
 };
 
-WebInspector._copy = function(event)
+WI._copy = function(event)
 {
     var selection = window.getSelection();
 
     // If there is no selection, pass the copy event on to the focused element or focused ContentView.
-    if (selection.isCollapsed && !WebInspector.isEventTargetAnEditableField(event)) {
+    if (selection.isCollapsed && !WI.isEventTargetAnEditableField(event)) {
         var focusedCopyHandler = this.currentFocusElement && this.currentFocusElement.copyHandler;
         if (focusedCopyHandler && typeof focusedCopyHandler.handleCopyEvent === "function") {
             focusedCopyHandler.handleCopyEvent(event);
@@ -2009,7 +2009,7 @@
     event.preventDefault();
 };
 
-WebInspector._increaseZoom = function(event)
+WI._increaseZoom = function(event)
 {
     const epsilon = 0.0001;
     const maximumZoom = 2.4;
@@ -2022,7 +2022,7 @@
     this.setZoomFactor(Math.min(maximumZoom, currentZoom + 0.2));
 };
 
-WebInspector._decreaseZoom = function(event)
+WI._decreaseZoom = function(event)
 {
     const epsilon = 0.0001;
     const minimumZoom = 0.6;
@@ -2035,134 +2035,134 @@
     this.setZoomFactor(Math.max(minimumZoom, currentZoom - 0.2));
 };
 
-WebInspector._resetZoom = function(event)
+WI._resetZoom = function(event)
 {
     this.setZoomFactor(1);
 };
 
-WebInspector.getZoomFactor = function()
+WI.getZoomFactor = function()
 {
-    return WebInspector.settings.zoomFactor.value;
+    return WI.settings.zoomFactor.value;
 };
 
-WebInspector.setZoomFactor = function(factor)
+WI.setZoomFactor = function(factor)
 {
     InspectorFrontendHost.setZoomFactor(factor);
     // Round-trip through the frontend host API in case the requested factor is not used.
-    WebInspector.settings.zoomFactor.value = InspectorFrontendHost.zoomFactor();
+    WI.settings.zoomFactor.value = InspectorFrontendHost.zoomFactor();
 };
 
-WebInspector.resolvedLayoutDirection = function()
+WI.resolvedLayoutDirection = function()
 {
-    let layoutDirection = WebInspector.settings.layoutDirection.value;
-    if (layoutDirection === WebInspector.LayoutDirection.System)
+    let layoutDirection = WI.settings.layoutDirection.value;
+    if (layoutDirection === WI.LayoutDirection.System)
         layoutDirection = InspectorFrontendHost.userInterfaceLayoutDirection();
 
     return layoutDirection;
 };
 
-WebInspector.setLayoutDirection = function(value)
+WI.setLayoutDirection = function(value)
 {
-    if (!Object.values(WebInspector.LayoutDirection).includes(value))
-        WebInspector.reportInternalError("Unknown layout direction requested: " + value);
+    if (!Object.values(WI.LayoutDirection).includes(value))
+        WI.reportInternalError("Unknown layout direction requested: " + value);
 
-    if (value === WebInspector.settings.layoutDirection.value)
+    if (value === WI.settings.layoutDirection.value)
         return;
 
-    WebInspector.settings.layoutDirection.value = value;
+    WI.settings.layoutDirection.value = value;
 
-    if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL && this._dockConfiguration === WebInspector.DockConfiguration.Right)
+    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL && this._dockConfiguration === WI.DockConfiguration.Right)
         this._dockLeft();
 
-    if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.LTR && this._dockConfiguration === WebInspector.DockConfiguration.Left)
+    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR && this._dockConfiguration === WI.DockConfiguration.Left)
         this._dockRight();
 
     window.location.reload();
 };
 
-WebInspector._showTabAtIndex = function(i, event)
+WI._showTabAtIndex = function(i, event)
 {
-    if (i <= WebInspector.tabBar.tabBarItems.length)
-        WebInspector.tabBar.selectedTabBarItem = i - 1;
+    if (i <= WI.tabBar.tabBarItems.length)
+        WI.tabBar.selectedTabBarItem = i - 1;
 };
 
-WebInspector._showJavaScriptTypeInformationSettingChanged = function(event)
+WI._showJavaScriptTypeInformationSettingChanged = function(event)
 {
     if (this.showJavaScriptTypeInformationSetting.value) {
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.RuntimeAgent.enableTypeProfiler();
     } else {
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.RuntimeAgent.disableTypeProfiler();
     }
 };
 
-WebInspector._enableControlFlowProfilerSettingChanged = function(event)
+WI._enableControlFlowProfilerSettingChanged = function(event)
 {
     if (this.enableControlFlowProfilerSetting.value) {
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.RuntimeAgent.enableControlFlowProfiler();
     } else {
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.RuntimeAgent.disableControlFlowProfiler();
     }
 };
 
-WebInspector._resourceCachingDisabledSettingChanged = function(event)
+WI._resourceCachingDisabledSettingChanged = function(event)
 {
     NetworkAgent.setResourceCachingDisabled(this.resourceCachingDisabledSetting.value);
 }
 
-WebInspector.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor, eventTarget)
+WI.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor, eventTarget)
 {
-    if (WebInspector._elementDraggingEventListener || WebInspector._elementEndDraggingEventListener)
-        WebInspector.elementDragEnd(event);
+    if (WI._elementDraggingEventListener || WI._elementEndDraggingEventListener)
+        WI.elementDragEnd(event);
 
     if (element) {
         // Install glass pane
-        if (WebInspector._elementDraggingGlassPane)
-            WebInspector._elementDraggingGlassPane.remove();
+        if (WI._elementDraggingGlassPane)
+            WI._elementDraggingGlassPane.remove();
 
         var glassPane = document.createElement("div");
         glassPane.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;opacity:0;z-index:1";
         glassPane.id = "glass-pane-for-drag";
         element.ownerDocument.body.appendChild(glassPane);
-        WebInspector._elementDraggingGlassPane = glassPane;
+        WI._elementDraggingGlassPane = glassPane;
     }
 
-    WebInspector._elementDraggingEventListener = dividerDrag;
-    WebInspector._elementEndDraggingEventListener = elementDragEnd;
+    WI._elementDraggingEventListener = dividerDrag;
+    WI._elementEndDraggingEventListener = elementDragEnd;
 
     var targetDocument = event.target.ownerDocument;
 
-    WebInspector._elementDraggingEventTarget = eventTarget || targetDocument;
-    WebInspector._elementDraggingEventTarget.addEventListener("mousemove", dividerDrag, true);
-    WebInspector._elementDraggingEventTarget.addEventListener("mouseup", elementDragEnd, true);
+    WI._elementDraggingEventTarget = eventTarget || targetDocument;
+    WI._elementDraggingEventTarget.addEventListener("mousemove", dividerDrag, true);
+    WI._elementDraggingEventTarget.addEventListener("mouseup", elementDragEnd, true);
 
     targetDocument.body.style.cursor = cursor;
 
     event.preventDefault();
 };
 
-WebInspector.elementDragEnd = function(event)
+WI.elementDragEnd = function(event)
 {
-    WebInspector._elementDraggingEventTarget.removeEventListener("mousemove", WebInspector._elementDraggingEventListener, true);
-    WebInspector._elementDraggingEventTarget.removeEventListener("mouseup", WebInspector._elementEndDraggingEventListener, true);
+    WI._elementDraggingEventTarget.removeEventListener("mousemove", WI._elementDraggingEventListener, true);
+    WI._elementDraggingEventTarget.removeEventListener("mouseup", WI._elementEndDraggingEventListener, true);
 
     event.target.ownerDocument.body.style.removeProperty("cursor");
 
-    if (WebInspector._elementDraggingGlassPane)
-        WebInspector._elementDraggingGlassPane.remove();
+    if (WI._elementDraggingGlassPane)
+        WI._elementDraggingGlassPane.remove();
 
-    delete WebInspector._elementDraggingGlassPane;
-    delete WebInspector._elementDraggingEventTarget;
-    delete WebInspector._elementDraggingEventListener;
-    delete WebInspector._elementEndDraggingEventListener;
+    delete WI._elementDraggingGlassPane;
+    delete WI._elementDraggingEventTarget;
+    delete WI._elementDraggingEventListener;
+    delete WI._elementEndDraggingEventListener;
 
     event.preventDefault();
 };
 
-WebInspector.createMessageTextView = function(message, isError)
+WI.createMessageTextView = function(message, isError)
 {
     var messageElement = document.createElement("div");
     messageElement.className = "message-text-view";
@@ -2174,7 +2174,7 @@
     return messageElement;
 };
 
-WebInspector.createGoToArrowButton = function()
+WI.createGoToArrowButton = function()
 {
     var button = document.createElement("button");
     button.addEventListener("mousedown", (event) => { event.stopPropagation(); }, true);
@@ -2183,7 +2183,7 @@
     return button;
 };
 
-WebInspector.createSourceCodeLocationLink = function(sourceCodeLocation, options = {})
+WI.createSourceCodeLocationLink = function(sourceCodeLocation, options = {})
 {
     console.assert(sourceCodeLocation);
     if (!sourceCodeLocation)
@@ -2191,11 +2191,11 @@
 
     var linkElement = document.createElement("a");
     linkElement.className = "go-to-link";
-    WebInspector.linkifyElement(linkElement, sourceCodeLocation, options);
+    WI.linkifyElement(linkElement, sourceCodeLocation, options);
     sourceCodeLocation.populateLiveDisplayLocationTooltip(linkElement);
 
     if (options.useGoToArrowButton)
-        linkElement.appendChild(WebInspector.createGoToArrowButton());
+        linkElement.appendChild(WI.createGoToArrowButton());
     else
         sourceCodeLocation.populateLiveDisplayLocationString(linkElement, "textContent", options.columnStyle, options.nameStyle, options.prefix);
 
@@ -2205,9 +2205,9 @@
     return linkElement;
 };
 
-WebInspector.linkifyLocation = function(url, sourceCodePosition, options = {})
+WI.linkifyLocation = function(url, sourceCodePosition, options = {})
 {
-    var sourceCode = WebInspector.sourceCodeForURL(url);
+    var sourceCode = WI.sourceCodeForURL(url);
 
     if (!sourceCode) {
         var anchor = document.createElement("a");
@@ -2215,18 +2215,18 @@
         anchor.lineNumber = sourceCodePosition.lineNumber;
         if (options.className)
             anchor.className = options.className;
-        anchor.append(WebInspector.displayNameForURL(url) + ":" + sourceCodePosition.lineNumber);
+        anchor.append(WI.displayNameForURL(url) + ":" + sourceCodePosition.lineNumber);
         return anchor;
     }
 
     let sourceCodeLocation = sourceCode.createSourceCodeLocation(sourceCodePosition.lineNumber, sourceCodePosition.columnNumber);
-    let linkElement = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, Object.shallowMerge(options, {dontFloat: true}));
+    let linkElement = WI.createSourceCodeLocationLink(sourceCodeLocation, Object.shallowMerge(options, {dontFloat: true}));
     if (options.className)
         linkElement.classList.add(options.className);
     return linkElement;
 };
 
-WebInspector.linkifyElement = function(linkElement, sourceCodeLocation, options = {}) {
+WI.linkifyElement = function(linkElement, sourceCodeLocation, options = {}) {
     console.assert(sourceCodeLocation);
 
     function showSourceCodeLocation(event)
@@ -2242,23 +2242,23 @@
 
     linkElement.addEventListener("click", showSourceCodeLocation.bind(this));
     linkElement.addEventListener("contextmenu", (event) => {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
-        WebInspector.appendContextMenuItemsForSourceCode(contextMenu, sourceCodeLocation);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
+        WI.appendContextMenuItemsForSourceCode(contextMenu, sourceCodeLocation);
     });
 };
 
-WebInspector.sourceCodeForURL = function(url)
+WI.sourceCodeForURL = function(url)
 {
-    var sourceCode = WebInspector.frameResourceManager.resourceForURL(url);
+    var sourceCode = WI.frameResourceManager.resourceForURL(url);
     if (!sourceCode) {
-        sourceCode = WebInspector.debuggerManager.scriptsForURL(url, WebInspector.assumingMainTarget())[0];
+        sourceCode = WI.debuggerManager.scriptsForURL(url, WI.assumingMainTarget())[0];
         if (sourceCode)
             sourceCode = sourceCode.resource || sourceCode;
     }
     return sourceCode || null;
 };
 
-WebInspector.linkifyURLAsNode = function(url, linkText, classes)
+WI.linkifyURLAsNode = function(url, linkText, classes)
 {
     if (!linkText)
         linkText = url;
@@ -2275,7 +2275,7 @@
     return a;
 };
 
-WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linkifier)
+WI.linkifyStringAsFragmentWithCustomLinkifier = function(string, linkifier)
 {
     var container = document.createDocumentFragment();
     var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|www\.)[\w$\-_+*'=\|\/\\(){}[\]%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({%@&#~]/;
@@ -2318,28 +2318,28 @@
     return container;
 };
 
-WebInspector.linkifyStringAsFragment = function(string)
+WI.linkifyStringAsFragment = function(string)
 {
     function linkifier(title, url, lineNumber)
     {
-        var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined);
+        var urlNode = WI.linkifyURLAsNode(url, title, undefined);
         if (lineNumber !== undefined)
             urlNode.lineNumber = lineNumber;
 
         return urlNode;
     }
 
-    return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string, linkifier);
+    return WI.linkifyStringAsFragmentWithCustomLinkifier(string, linkifier);
 };
 
-WebInspector.createResourceLink = function(resource, className)
+WI.createResourceLink = function(resource, className)
 {
     function handleClick(event)
     {
         event.stopPropagation();
         event.preventDefault();
 
-        WebInspector.showRepresentedObject(resource);
+        WI.showRepresentedObject(resource);
     }
 
     let linkNode = document.createElement("a");
@@ -2350,7 +2350,7 @@
     return linkNode;
 };
 
-WebInspector._undoKeyboardShortcut = function(event)
+WI._undoKeyboardShortcut = function(event)
 {
     if (!this.isEditingAnyField() && !this.isEventTargetAnEditableField(event)) {
         this.undo();
@@ -2358,7 +2358,7 @@
     }
 };
 
-WebInspector._redoKeyboardShortcut = function(event)
+WI._redoKeyboardShortcut = function(event)
 {
     if (!this.isEditingAnyField() && !this.isEventTargetAnEditableField(event)) {
         this.redo();
@@ -2366,17 +2366,17 @@
     }
 };
 
-WebInspector.undo = function()
+WI.undo = function()
 {
     DOMAgent.undo();
 };
 
-WebInspector.redo = function()
+WI.redo = function()
 {
     DOMAgent.redo();
 };
 
-WebInspector.highlightRangesWithStyleClass = function(element, resultRanges, styleClass, changes)
+WI.highlightRangesWithStyleClass = function(element, resultRanges, styleClass, changes)
 {
     changes = changes || [];
     var highlightNodes = [];
@@ -2455,7 +2455,7 @@
     return highlightNodes;
 };
 
-WebInspector.revertDomChanges = function(domChanges)
+WI.revertDomChanges = function(domChanges)
 {
     for (var i = domChanges.length - 1; i >= 0; --i) {
         var entry = domChanges[i];
@@ -2470,7 +2470,7 @@
     }
 };
 
-WebInspector.archiveMainFrame = function()
+WI.archiveMainFrame = function()
 {
     this._downloadingPage = true;
     this._updateDownloadToolbarButton();
@@ -2482,7 +2482,7 @@
         if (error)
             return;
 
-        let mainFrame = WebInspector.frameResourceManager.mainFrame;
+        let mainFrame = WI.frameResourceManager.mainFrame;
         let archiveName = mainFrame.mainResource.urlComponents.host || mainFrame.mainResource.displayName || "Archive";
         let url = "web-inspector:///" + encodeURI(archiveName) + ".webarchive";
 
@@ -2490,19 +2490,19 @@
     });
 };
 
-WebInspector.canArchiveMainFrame = function()
+WI.canArchiveMainFrame = function()
 {
     // COMPATIBILITY (iOS 7): Page.archive did not exist yet.
-    if (!PageAgent.archive || this.debuggableType !== WebInspector.DebuggableType.Web)
+    if (!PageAgent.archive || this.debuggableType !== WI.DebuggableType.Web)
         return false;
 
-    if (!WebInspector.frameResourceManager.mainFrame || !WebInspector.frameResourceManager.mainFrame.mainResource)
+    if (!WI.frameResourceManager.mainFrame || !WI.frameResourceManager.mainFrame.mainResource)
         return false;
 
-    return WebInspector.Resource.typeFromMIMEType(WebInspector.frameResourceManager.mainFrame.mainResource.mimeType) === WebInspector.Resource.Type.Document;
+    return WI.Resource.typeFromMIMEType(WI.frameResourceManager.mainFrame.mainResource.mimeType) === WI.Resource.Type.Document;
 };
 
-WebInspector.addWindowKeydownListener = function(listener)
+WI.addWindowKeydownListener = function(listener)
 {
     if (typeof listener.handleKeydownEvent !== "function")
         return;
@@ -2512,25 +2512,25 @@
     this._updateWindowKeydownListener();
 };
 
-WebInspector.removeWindowKeydownListener = function(listener)
+WI.removeWindowKeydownListener = function(listener)
 {
     this._windowKeydownListeners.remove(listener);
 
     this._updateWindowKeydownListener();
 };
 
-WebInspector._updateWindowKeydownListener = function()
+WI._updateWindowKeydownListener = function()
 {
     if (this._windowKeydownListeners.length === 1)
-        window.addEventListener("keydown", WebInspector._sharedWindowKeydownListener, true);
+        window.addEventListener("keydown", WI._sharedWindowKeydownListener, true);
     else if (!this._windowKeydownListeners.length)
-        window.removeEventListener("keydown", WebInspector._sharedWindowKeydownListener, true);
+        window.removeEventListener("keydown", WI._sharedWindowKeydownListener, true);
 };
 
-WebInspector._sharedWindowKeydownListener = function(event)
+WI._sharedWindowKeydownListener = function(event)
 {
-    for (var i = WebInspector._windowKeydownListeners.length - 1; i >= 0; --i) {
-        if (WebInspector._windowKeydownListeners[i].handleKeydownEvent(event)) {
+    for (var i = WI._windowKeydownListeners.length - 1; i >= 0; --i) {
+        if (WI._windowKeydownListeners[i].handleKeydownEvent(event)) {
             event.stopImmediatePropagation();
             event.preventDefault();
             break;
@@ -2538,7 +2538,7 @@
     }
 };
 
-WebInspector.reportInternalError = function(errorOrString, details={})
+WI.reportInternalError = function(errorOrString, details={})
 {
     // The 'details' object includes additional information from the caller as free-form string keys and values.
     // Each key and value will be shown in the uncaught exception reporter, console error message, or in
@@ -2548,7 +2548,7 @@
     error.details = details;
 
     // The error will be displayed in the Uncaught Exception Reporter sheet if DebugUI is enabled.
-    if (WebInspector.isDebugUIEnabled()) {
+    if (WI.isDebugUIEnabled()) {
         // This assert allows us to stop the debugger at an internal exception. It doesn't re-throw
         // exceptions because the original exception would be lost through window.onerror.
         // This workaround can be removed once <https://webkit.org/b/158192> is fixed.
@@ -2558,7 +2558,7 @@
         console.error(error);
 };
 
-Object.defineProperty(WebInspector, "targets",
+Object.defineProperty(WI, "targets",
 {
     get() { return this.targetManager.targets; }
 });
@@ -2567,23 +2567,23 @@
 // used by reached by Worker debugging. Eventually, once all
 // Worker domains have been implemented, all of these must be
 // handled properly.
-WebInspector.assumingMainTarget = function()
+WI.assumingMainTarget = function()
 {
-    return WebInspector.mainTarget;
+    return WI.mainTarget;
 };
 
 // OpenResourceDialog delegate
 
-WebInspector.dialogWasDismissed = function(dialog)
+WI.dialogWasDismissed = function(dialog)
 {
     let representedObject = dialog.representedObject;
     if (!representedObject)
         return;
 
-    WebInspector.showRepresentedObject(representedObject, dialog.cookie);
+    WI.showRepresentedObject(representedObject, dialog.cookie);
 };
 
-WebInspector.DockConfiguration = {
+WI.DockConfiguration = {
     Right: "right",
     Left: "left",
     Bottom: "bottom",
diff --git a/Source/WebInspectorUI/UserInterface/Base/Object.js b/Source/WebInspectorUI/UserInterface/Base/Object.js
index 2a91983..e9e5172 100644
--- a/Source/WebInspectorUI/UserInterface/Base/Object.js
+++ b/Source/WebInspectorUI/UserInterface/Base/Object.js
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Object = class WebInspectorObject
+WI.Object = class WebInspectorObject
 {
     constructor()
     {
@@ -100,7 +100,7 @@
 
     static awaitEvent(eventType)
     {
-        let wrapper = new WebInspector.WrappedPromise;
+        let wrapper = new WI.WrappedPromise;
         this.singleFireEventListener(eventType, (event) => wrapper.resolve(event));
         return wrapper.promise;
     }
@@ -135,16 +135,16 @@
 
     // Public
 
-    addEventListener() { return WebInspector.Object.addEventListener.apply(this, arguments); }
-    singleFireEventListener() { return WebInspector.Object.singleFireEventListener.apply(this, arguments); }
-    removeEventListener() { return WebInspector.Object.removeEventListener.apply(this, arguments); }
-    awaitEvent() { return WebInspector.Object.awaitEvent.apply(this, arguments); }
-    hasEventListeners() { return WebInspector.Object.hasEventListeners.apply(this, arguments); }
-    retainedObjectsWithPrototype() { return WebInspector.Object.retainedObjectsWithPrototype.apply(this, arguments); }
+    addEventListener() { return WI.Object.addEventListener.apply(this, arguments); }
+    singleFireEventListener() { return WI.Object.singleFireEventListener.apply(this, arguments); }
+    removeEventListener() { return WI.Object.removeEventListener.apply(this, arguments); }
+    awaitEvent() { return WI.Object.awaitEvent.apply(this, arguments); }
+    hasEventListeners() { return WI.Object.hasEventListeners.apply(this, arguments); }
+    retainedObjectsWithPrototype() { return WI.Object.retainedObjectsWithPrototype.apply(this, arguments); }
 
     dispatchEventToListeners(eventType, eventData)
     {
-        let event = new WebInspector.Event(this, eventType, eventData);
+        let event = new WI.Event(this, eventType, eventData);
 
         function dispatch(object)
         {
@@ -194,7 +194,7 @@
     }
 };
 
-WebInspector.Event = class Event
+WI.Event = class Event
 {
     constructor(target, type, data)
     {
@@ -216,9 +216,9 @@
     }
 };
 
-WebInspector.notifications = new WebInspector.Object;
+WI.notifications = new WI.Object;
 
-WebInspector.Notification = {
+WI.Notification = {
     GlobalModifierKeysDidChange: "global-modifiers-did-change",
     PageArchiveStarted: "page-archive-started",
     PageArchiveEnded: "page-archive-ended",
diff --git a/Source/WebInspectorUI/UserInterface/Base/Platform.js b/Source/WebInspectorUI/UserInterface/Base/Platform.js
index 65764ec..6ab082c 100644
--- a/Source/WebInspectorUI/UserInterface/Base/Platform.js
+++ b/Source/WebInspectorUI/UserInterface/Base/Platform.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Platform = {
+WI.Platform = {
     name: InspectorFrontendHost.platform(),
     isNightlyBuild: false,
     version: {
@@ -37,24 +37,24 @@
     // Check for a nightly build by looking for a plus in the version number and a small number of stylesheets (indicating combined resources).
     var versionMatch = / AppleWebKit\/([^ ]+)/.exec(navigator.userAgent);
     if (versionMatch && versionMatch[1].indexOf("+") !== -1 && document.styleSheets.length < 10)
-        WebInspector.Platform.isNightlyBuild = true;
+        WI.Platform.isNightlyBuild = true;
 
     var osVersionMatch = / Mac OS X (\d+)_(\d+)/.exec(navigator.appVersion);
     if (osVersionMatch && osVersionMatch[1] === "10") {
-        WebInspector.Platform.version.base = 10;
-        WebInspector.Platform.version.release = parseInt(osVersionMatch[2]);
+        WI.Platform.version.base = 10;
+        WI.Platform.version.release = parseInt(osVersionMatch[2]);
         switch (osVersionMatch[2]) {
         case "12":
-            WebInspector.Platform.version.name = "sierra";
+            WI.Platform.version.name = "sierra";
             break;
         case "11":
-            WebInspector.Platform.version.name = "el-capitan";
+            WI.Platform.version.name = "el-capitan";
             break;
         case "10":
-            WebInspector.Platform.version.name = "yosemite";
+            WI.Platform.version.name = "yosemite";
             break;
         default:
-            WebInspector.Platform.version.name = "unknown-mac";
+            WI.Platform.version.name = "unknown-mac";
             break;
         }
     }
diff --git a/Source/WebInspectorUI/UserInterface/Base/Setting.js b/Source/WebInspectorUI/UserInterface/Base/Setting.js
index 82b7206..623acd5 100644
--- a/Source/WebInspectorUI/UserInterface/Base/Setting.js
+++ b/Source/WebInspectorUI/UserInterface/Base/Setting.js
@@ -29,7 +29,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Setting = class Setting extends WebInspector.Object
+WI.Setting = class Setting extends WI.Object
 {
     constructor(name, defaultValue)
     {
@@ -88,7 +88,7 @@
             }
         }
 
-        this.dispatchEventToListeners(WebInspector.Setting.Event.Changed, this._value, {name: this._name});
+        this.dispatchEventToListeners(WI.Setting.Event.Changed, this._value, {name: this._name});
     }
 
     reset()
@@ -98,31 +98,31 @@
     }
 };
 
-WebInspector.Setting.Event = {
+WI.Setting.Event = {
     Changed: "setting-changed"
 };
 
-WebInspector.settings = {
-    autoLogProtocolMessages: new WebInspector.Setting("auto-collect-protocol-messages", false),
-    autoLogTimeStats: new WebInspector.Setting("auto-collect-time-stats", false),
-    enableUncaughtExceptionReporter: new WebInspector.Setting("enable-uncaught-exception-reporter", true),
-    enableLineWrapping: new WebInspector.Setting("enable-line-wrapping", false),
-    indentUnit: new WebInspector.Setting("indent-unit", 4),
-    tabSize: new WebInspector.Setting("tab-size", 4),
-    indentWithTabs: new WebInspector.Setting("indent-with-tabs", false),
-    showWhitespaceCharacters: new WebInspector.Setting("show-whitespace-characters", false),
-    showInvalidCharacters: new WebInspector.Setting("show-invalid-characters", false),
-    clearLogOnNavigate: new WebInspector.Setting("clear-log-on-navigate", true),
-    clearNetworkOnNavigate: new WebInspector.Setting("clear-network-on-navigate", true),
-    zoomFactor: new WebInspector.Setting("zoom-factor", 1),
-    layoutDirection: new WebInspector.Setting("layout-direction-override", "system"),
-    stylesShowInlineWarnings: new WebInspector.Setting("styles-show-inline-warning", true),
-    stylesInsertNewline: new WebInspector.Setting("styles-insert-newline", true),
-    stylesSelectOnFirstClick: new WebInspector.Setting("styles-select-on-first-click", true),
-    showScopeChainOnPause: new WebInspector.Setting("show-scope-chain-sidebar", true),
-    showImageGrid: new WebInspector.Setting("show-image-grid", false),
+WI.settings = {
+    autoLogProtocolMessages: new WI.Setting("auto-collect-protocol-messages", false),
+    autoLogTimeStats: new WI.Setting("auto-collect-time-stats", false),
+    enableUncaughtExceptionReporter: new WI.Setting("enable-uncaught-exception-reporter", true),
+    enableLineWrapping: new WI.Setting("enable-line-wrapping", false),
+    indentUnit: new WI.Setting("indent-unit", 4),
+    tabSize: new WI.Setting("tab-size", 4),
+    indentWithTabs: new WI.Setting("indent-with-tabs", false),
+    showWhitespaceCharacters: new WI.Setting("show-whitespace-characters", false),
+    showInvalidCharacters: new WI.Setting("show-invalid-characters", false),
+    clearLogOnNavigate: new WI.Setting("clear-log-on-navigate", true),
+    clearNetworkOnNavigate: new WI.Setting("clear-network-on-navigate", true),
+    zoomFactor: new WI.Setting("zoom-factor", 1),
+    layoutDirection: new WI.Setting("layout-direction-override", "system"),
+    stylesShowInlineWarnings: new WI.Setting("styles-show-inline-warning", true),
+    stylesInsertNewline: new WI.Setting("styles-insert-newline", true),
+    stylesSelectOnFirstClick: new WI.Setting("styles-select-on-first-click", true),
+    showScopeChainOnPause: new WI.Setting("show-scope-chain-sidebar", true),
+    showImageGrid: new WI.Setting("show-image-grid", false),
 
     // Experimental
-    experimentalShowCanvasContextsInResources: new WebInspector.Setting("experimental-show-canvas-contexts-in-resources", false),
-    experimentalSpreadsheetStyleEditor: new WebInspector.Setting("experimental-spreadsheet-style-editor", false),
+    experimentalShowCanvasContextsInResources: new WI.Setting("experimental-show-canvas-contexts-in-resources", false),
+    experimentalSpreadsheetStyleEditor: new WI.Setting("experimental-spreadsheet-style-editor", false),
 };
diff --git a/Source/WebInspectorUI/UserInterface/Base/TextUtilities.js b/Source/WebInspectorUI/UserInterface/Base/TextUtilities.js
index 403154a..bad1c4e 100644
--- a/Source/WebInspectorUI/UserInterface/Base/TextUtilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/TextUtilities.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.rangeForNextCSSNameOrValue = function(text, index = 0) {
+WI.rangeForNextCSSNameOrValue = function(text, index = 0) {
     let from = 0;
     let to = 0;
 
diff --git a/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js b/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js
index e3935f5..0ab64369 100644
--- a/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js
@@ -219,10 +219,10 @@
     return parameters;
 }
 
-WebInspector.displayNameForURL = function(url, urlComponents)
+WI.displayNameForURL = function(url, urlComponents)
 {
     if (url.startsWith("data:"))
-        return WebInspector.truncateURL(url);
+        return WI.truncateURL(url);
 
     if (!urlComponents)
         urlComponents = parseURL(url);
@@ -234,10 +234,10 @@
         displayName = urlComponents.lastPathComponent;
     }
 
-    return displayName || WebInspector.displayNameForHost(urlComponents.host) || url;
+    return displayName || WI.displayNameForHost(urlComponents.host) || url;
 };
 
-WebInspector.truncateURL = function(url, multiline = false, dataURIMaxSize = 6)
+WI.truncateURL = function(url, multiline = false, dataURIMaxSize = 6)
 {
     if (!url.startsWith("data:"))
         return url;
@@ -258,7 +258,7 @@
     return header + firstChunk + middleChunk + lastChunk;
 };
 
-WebInspector.displayNameForHost = function(host)
+WI.displayNameForHost = function(host)
 {
     // FIXME <rdar://problem/11237413>: This should decode punycode hostnames.
     return host;
diff --git a/Source/WebInspectorUI/UserInterface/Base/Utilities.js b/Source/WebInspectorUI/UserInterface/Base/Utilities.js
index 5025285..cd1dec0 100644
--- a/Source/WebInspectorUI/UserInterface/Base/Utilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/Utilities.js
@@ -1023,8 +1023,8 @@
         let ms = seconds * 1000;
 
         if (higherResolution)
-            return WebInspector.UIString("%.2fms").format(ms);
-        return WebInspector.UIString("%.1fms").format(ms);
+            return WI.UIString("%.2fms").format(ms);
+        return WI.UIString("%.1fms").format(ms);
     }
 });
 
@@ -1034,40 +1034,40 @@
     {
         let ms = seconds * 1000;
         if (!ms)
-            return WebInspector.UIString("%.0fms").format(0);
+            return WI.UIString("%.0fms").format(0);
 
         if (Math.abs(ms) < 10) {
             if (higherResolution)
-                return WebInspector.UIString("%.3fms").format(ms);
-            return WebInspector.UIString("%.2fms").format(ms);
+                return WI.UIString("%.3fms").format(ms);
+            return WI.UIString("%.2fms").format(ms);
         }
 
         if (Math.abs(ms) < 100) {
             if (higherResolution)
-                return WebInspector.UIString("%.2fms").format(ms);
-            return WebInspector.UIString("%.1fms").format(ms);
+                return WI.UIString("%.2fms").format(ms);
+            return WI.UIString("%.1fms").format(ms);
         }
 
         if (Math.abs(ms) < 1000) {
             if (higherResolution)
-                return WebInspector.UIString("%.1fms").format(ms);
-            return WebInspector.UIString("%.0fms").format(ms);
+                return WI.UIString("%.1fms").format(ms);
+            return WI.UIString("%.0fms").format(ms);
         }
 
         // Do not go over seconds when in high resolution mode.
         if (higherResolution || Math.abs(seconds) < 60)
-            return WebInspector.UIString("%.2fs").format(seconds);
+            return WI.UIString("%.2fs").format(seconds);
 
         let minutes = seconds / 60;
         if (Math.abs(minutes) < 60)
-            return WebInspector.UIString("%.1fmin").format(minutes);
+            return WI.UIString("%.1fmin").format(minutes);
 
         let hours = minutes / 60;
         if (Math.abs(hours) < 24)
-            return WebInspector.UIString("%.1fhrs").format(hours);
+            return WI.UIString("%.1fhrs").format(hours);
 
         let days = hours / 24;
-        return WebInspector.UIString("%.1f days").format(days);
+        return WI.UIString("%.1f days").format(days);
     }
 });
 
@@ -1079,26 +1079,26 @@
             higherResolution = true;
 
         if (Math.abs(bytes) < 1024)
-            return WebInspector.UIString("%.0f B").format(bytes);
+            return WI.UIString("%.0f B").format(bytes);
 
         let kilobytes = bytes / 1024;
         if (Math.abs(kilobytes) < 1024) {
             if (higherResolution || Math.abs(kilobytes) < 10)
-                return WebInspector.UIString("%.2f KB").format(kilobytes);
-            return WebInspector.UIString("%.1f KB").format(kilobytes);
+                return WI.UIString("%.2f KB").format(kilobytes);
+            return WI.UIString("%.1f KB").format(kilobytes);
         }
 
         let megabytes = kilobytes / 1024;
         if (Math.abs(megabytes) < 1024) {
             if (higherResolution || Math.abs(megabytes) < 10)
-                return WebInspector.UIString("%.2f MB").format(megabytes);
-            return WebInspector.UIString("%.1f MB").format(megabytes);
+                return WI.UIString("%.2f MB").format(megabytes);
+            return WI.UIString("%.1f MB").format(megabytes);
         }
 
         let gigabytes = megabytes / 1024;
         if (higherResolution || Math.abs(gigabytes) < 10)
-            return WebInspector.UIString("%.2f GB").format(gigabytes);
-        return WebInspector.UIString("%.1f GB").format(gigabytes);
+            return WI.UIString("%.2f GB").format(gigabytes);
+        return WI.UIString("%.1f GB").format(gigabytes);
     }
 });
 
@@ -1110,12 +1110,12 @@
             return num.toLocaleString();
 
         if (num < 1000000)
-            return WebInspector.UIString("%.1fK").format(Math.round(num / 100) / 10);
+            return WI.UIString("%.1fK").format(Math.round(num / 100) / 10);
 
         if (num < 1000000000)
-            return WebInspector.UIString("%.1fM").format(Math.round(num / 100000) / 10);
+            return WI.UIString("%.1fM").format(Math.round(num / 100000) / 10);
 
-        return WebInspector.UIString("%.1fB").format(Math.round(num / 100000000) / 10);
+        return WI.UIString("%.1fB").format(Math.round(num / 100000000) / 10);
     }
 });
 
diff --git a/Source/WebInspectorUI/UserInterface/Base/WebInspector.js b/Source/WebInspectorUI/UserInterface/Base/WebInspector.js
index 15460bb..3e41b27 100644
--- a/Source/WebInspectorUI/UserInterface/Base/WebInspector.js
+++ b/Source/WebInspectorUI/UserInterface/Base/WebInspector.js
@@ -23,4 +23,4 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-var WebInspector = {}; // Namespace
+var WI = {}; // Namespace
diff --git a/Source/WebInspectorUI/UserInterface/Base/YieldableTask.js b/Source/WebInspectorUI/UserInterface/Base/YieldableTask.js
index f6306e3..b303419a 100644
--- a/Source/WebInspectorUI/UserInterface/Base/YieldableTask.js
+++ b/Source/WebInspectorUI/UserInterface/Base/YieldableTask.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.YieldableTask = class YieldableTask
+WI.YieldableTask = class YieldableTask
 {
     constructor(delegate, items, options={})
     {
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/AnalyzerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/AnalyzerManager.js
index 99c6273..ced17bc 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/AnalyzerManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/AnalyzerManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.AnalyzerManager = class AnalyzerManager extends WebInspector.Object
+WI.AnalyzerManager = class AnalyzerManager extends WI.Object
 {
     constructor()
     {
@@ -63,7 +63,7 @@
 
         this._sourceCodeMessagesMap = new WeakMap;
 
-        WebInspector.SourceCode.addEventListener(WebInspector.SourceCode.Event.ContentDidChange, this._handleSourceCodeContentDidChange, this);
+        WI.SourceCode.addEventListener(WI.SourceCode.Event.ContentDidChange, this._handleSourceCodeContentDidChange, this);
     }
 
     // Public
@@ -71,7 +71,7 @@
     getAnalyzerMessagesForSourceCode(sourceCode)
     {
         return new Promise(function(resolve, reject) {
-            var analyzer = WebInspector.AnalyzerManager._typeAnalyzerMap.get(sourceCode.type);
+            var analyzer = WI.AnalyzerManager._typeAnalyzerMap.get(sourceCode.type);
             if (!analyzer) {
                 reject(new Error("This resource type cannot be analyzed."));
                 return;
@@ -89,7 +89,7 @@
 
                 // Raw line and column numbers are one-based. SourceCodeLocation expects them to be zero-based so we subtract 1 from each.
                 for (var rawAnalyzerMessage of rawAnalyzerMessages)
-                    analyzerMessages.push(new WebInspector.AnalyzerMessage(new WebInspector.SourceCodeLocation(sourceCode, rawAnalyzerMessage.line - 1, rawAnalyzerMessage.column - 1), rawAnalyzerMessage.message, rawAnalyzerMessage.ruleId));
+                    analyzerMessages.push(new WI.AnalyzerMessage(new WI.SourceCodeLocation(sourceCode, rawAnalyzerMessage.line - 1, rawAnalyzerMessage.column - 1), rawAnalyzerMessage.message, rawAnalyzerMessage.ruleId));
 
                 this._sourceCodeMessagesMap.set(sourceCode, analyzerMessages);
 
@@ -102,7 +102,7 @@
 
     sourceCodeCanBeAnalyzed(sourceCode)
     {
-        return sourceCode.type === WebInspector.Resource.Type.Script;
+        return sourceCode.type === WI.Resource.Type.Script;
     }
 
     // Private
@@ -116,7 +116,7 @@
     }
 };
 
-WebInspector.AnalyzerManager._typeAnalyzerMap = new Map;
+WI.AnalyzerManager._typeAnalyzerMap = new Map;
 
 // <https://webkit.org/b/136515> Web Inspector: JavaScript source text editor should have a linter
-// WebInspector.AnalyzerManager._typeAnalyzerMap.set(WebInspector.Resource.Type.Script, eslint);
+// WI.AnalyzerManager._typeAnalyzerMap.set(WI.Resource.Type.Script, eslint);
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/Annotator.js b/Source/WebInspectorUI/UserInterface/Controllers/Annotator.js
index 3e87bb5..c95a87d 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/Annotator.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/Annotator.js
@@ -24,13 +24,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Annotator = class Annotator extends WebInspector.Object
+WI.Annotator = class Annotator extends WI.Object
 {
     constructor(sourceCodeTextEditor)
     {
         super();
 
-        console.assert(sourceCodeTextEditor instanceof WebInspector.SourceCodeTextEditor, sourceCodeTextEditor);
+        console.assert(sourceCodeTextEditor instanceof WI.SourceCodeTextEditor, sourceCodeTextEditor);
 
         this._sourceCodeTextEditor = sourceCodeTextEditor;
         this._timeoutIdentifier = null;
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js b/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js
index 61a55a9..b313de9 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheManager = class ApplicationCacheManager extends WebInspector.Object
+WI.ApplicationCacheManager = class ApplicationCacheManager extends WI.Object
 {
     constructor()
     {
@@ -32,8 +32,8 @@
         if (window.ApplicationCacheAgent)
             ApplicationCacheAgent.enable();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
 
         this._online = true;
 
@@ -62,7 +62,7 @@
     {
         this._online = isNowOnline;
 
-        this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.NetworkStateUpdated, {online: this._online});
+        this.dispatchEventToListeners(WI.ApplicationCacheManager.Event.NetworkStateUpdated, {online: this._online});
     }
 
     get online()
@@ -72,7 +72,7 @@
 
     applicationCacheStatusUpdated(frameId, manifestURL, status)
     {
-        var frame = WebInspector.frameResourceManager.frameForIdentifier(frameId);
+        var frame = WI.frameResourceManager.frameForIdentifier(frameId);
         if (!frame)
             return;
 
@@ -98,13 +98,13 @@
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (event.target.isMainFrame()) {
             // If we are dealing with the main frame, we want to clear our list of objects, because we are navigating to a new page.
             this.initialize();
 
-            this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.Cleared);
+            this.dispatchEventToListeners(WI.ApplicationCacheManager.Event.Cleared);
 
             return;
         }
@@ -123,7 +123,7 @@
         if (error)
             return;
 
-        var frame = WebInspector.frameResourceManager.frameForIdentifier(frameId);
+        var frame = WI.frameResourceManager.frameForIdentifier(frameId);
         if (!frame)
             return;
 
@@ -137,7 +137,7 @@
             return;
 
         for (var i = 0; i < framesWithManifests.length; ++i) {
-            var frame = WebInspector.frameResourceManager.frameForIdentifier(framesWithManifests[i].frameId);
+            var frame = WI.frameResourceManager.frameForIdentifier(framesWithManifests[i].frameId);
             if (!frame)
                 continue;
 
@@ -147,7 +147,7 @@
 
     _frameManifestUpdated(frame, manifestURL, status)
     {
-        if (status === WebInspector.ApplicationCacheManager.Status.Uncached) {
+        if (status === WI.ApplicationCacheManager.Status.Uncached) {
             this._frameManifestRemoved(frame);
             return;
         }
@@ -165,14 +165,14 @@
             manifestFrame.status = status;
 
         if (!this._applicationCacheObjects[frame.id]) {
-            var cacheManifest = new WebInspector.ApplicationCacheManifest(manifestURL);
-            this._applicationCacheObjects[frame.id] = new WebInspector.ApplicationCacheFrame(frame, cacheManifest, status);
+            var cacheManifest = new WI.ApplicationCacheManifest(manifestURL);
+            this._applicationCacheObjects[frame.id] = new WI.ApplicationCacheFrame(frame, cacheManifest, status);
 
-            this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.FrameManifestAdded, {frameManifest: this._applicationCacheObjects[frame.id]});
+            this.dispatchEventToListeners(WI.ApplicationCacheManager.Event.FrameManifestAdded, {frameManifest: this._applicationCacheObjects[frame.id]});
         }
 
         if (statusChanged)
-            this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged, {frameManifest: this._applicationCacheObjects[frame.id]});
+            this.dispatchEventToListeners(WI.ApplicationCacheManager.Event.FrameManifestStatusChanged, {frameManifest: this._applicationCacheObjects[frame.id]});
     }
 
     _frameManifestRemoved(frame)
@@ -182,11 +182,11 @@
 
         delete this._applicationCacheObjects[frame.id];
 
-        this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved, {frame});
+        this.dispatchEventToListeners(WI.ApplicationCacheManager.Event.FrameManifestRemoved, {frame});
     }
 };
 
-WebInspector.ApplicationCacheManager.Event = {
+WI.ApplicationCacheManager.Event = {
     Cleared: "application-cache-manager-cleared",
     FrameManifestAdded: "application-cache-manager-frame-manifest-added",
     FrameManifestRemoved: "application-cache-manager-frame-manifest-removed",
@@ -194,7 +194,7 @@
     NetworkStateUpdated: "application-cache-manager-network-state-updated"
 };
 
-WebInspector.ApplicationCacheManager.Status = {
+WI.ApplicationCacheManager.Status = {
     Uncached: 0,
     Idle: 1,
     Checking: 2,
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js b/Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js
index b4b86f9d..a7837abe 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BasicBlockAnnotator = class BasicBlockAnnotator extends WebInspector.Annotator
+WI.BasicBlockAnnotator = class BasicBlockAnnotator extends WI.Annotator
 {
     constructor(sourceCodeTextEditor, script)
     {
@@ -108,7 +108,7 @@
         if (this._isTextRangeOnlyClosingBrace(startPosition, endPosition))
             return null;
 
-        var marker = this.sourceCodeTextEditor.addStyleToTextRange(startPosition, endPosition, WebInspector.BasicBlockAnnotator.HasNotExecutedClassName);
+        var marker = this.sourceCodeTextEditor.addStyleToTextRange(startPosition, endPosition, WI.BasicBlockAnnotator.HasNotExecutedClassName);
         return marker;
     }
 
@@ -128,4 +128,4 @@
     }
 };
 
-WebInspector.BasicBlockAnnotator.HasNotExecutedClassName = "basic-block-has-not-executed";
+WI.BasicBlockAnnotator.HasNotExecutedClassName = "basic-block-has-not-executed";
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js b/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js
index 6dc8de1..5b6776e 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BranchManager = class BranchManager extends WebInspector.Object
+WI.BranchManager = class BranchManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
         this.initialize();
     }
@@ -38,8 +38,8 @@
 
     initialize()
     {
-        this._originalBranch = new WebInspector.Branch(WebInspector.UIString("Original"), null, true);
-        this._currentBranch = this._originalBranch.fork(WebInspector.UIString("Working Copy"));
+        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];
     }
 
@@ -55,8 +55,8 @@
 
     set currentBranch(branch)
     {
-        console.assert(branch instanceof WebInspector.Branch);
-        if (!(branch instanceof WebInspector.Branch))
+        console.assert(branch instanceof WI.Branch);
+        if (!(branch instanceof WI.Branch))
             return;
 
         this._currentBranch.revert();
@@ -71,8 +71,8 @@
         if (!fromBranch)
             fromBranch = this._originalBranch;
 
-        console.assert(fromBranch instanceof WebInspector.Branch);
-        if (!(fromBranch instanceof WebInspector.Branch))
+        console.assert(fromBranch instanceof WI.Branch);
+        if (!(fromBranch instanceof WI.Branch))
             return null;
 
         var newBranch = fromBranch.fork(displayName);
@@ -82,8 +82,8 @@
 
     deleteBranch(branch)
     {
-        console.assert(branch instanceof WebInspector.Branch);
-        if (!(branch instanceof WebInspector.Branch))
+        console.assert(branch instanceof WI.Branch);
+        if (!(branch instanceof WI.Branch))
             return;
 
         console.assert(branch !== this._originalBranch);
@@ -100,7 +100,7 @@
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (!event.target.isMainFrame())
             return;
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/BreakpointLogMessageLexer.js b/Source/WebInspectorUI/UserInterface/Controllers/BreakpointLogMessageLexer.js
index 071704a..9b8e254 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/BreakpointLogMessageLexer.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/BreakpointLogMessageLexer.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BreakpointLogMessageLexer = class BreakpointLogMessageLexer extends WebInspector.Object
+WI.BreakpointLogMessageLexer = class BreakpointLogMessageLexer extends WI.Object
 {
     constructor()
     {
         super();
 
         this._stateFunctions = {
-            [WebInspector.BreakpointLogMessageLexer.State.Expression]: this._expression,
-            [WebInspector.BreakpointLogMessageLexer.State.PlainText]: this._plainText,
-            [WebInspector.BreakpointLogMessageLexer.State.PossiblePlaceholder]: this._possiblePlaceholder,
-            [WebInspector.BreakpointLogMessageLexer.State.RegExpOrStringLiteral]: this._regExpOrStringLiteral,
+            [WI.BreakpointLogMessageLexer.State.Expression]: this._expression,
+            [WI.BreakpointLogMessageLexer.State.PlainText]: this._plainText,
+            [WI.BreakpointLogMessageLexer.State.PossiblePlaceholder]: this._possiblePlaceholder,
+            [WI.BreakpointLogMessageLexer.State.RegExpOrStringLiteral]: this._regExpOrStringLiteral,
         };
 
         this.reset();
@@ -69,7 +69,7 @@
         this._buffer = "";
 
         this._index = 0;
-        this._states = [WebInspector.BreakpointLogMessageLexer.State.PlainText];
+        this._states = [WI.BreakpointLogMessageLexer.State.PlainText];
         this._literalStartCharacter = "";
         this._curlyBraceDepth = 0;
         this._tokens = [];
@@ -79,12 +79,12 @@
 
      _finishPlainText()
     {
-        this._appendToken(WebInspector.BreakpointLogMessageLexer.TokenType.PlainText);
+        this._appendToken(WI.BreakpointLogMessageLexer.TokenType.PlainText);
     }
 
     _finishExpression()
     {
-        this._appendToken(WebInspector.BreakpointLogMessageLexer.TokenType.Expression);
+        this._appendToken(WI.BreakpointLogMessageLexer.TokenType.Expression);
     }
 
     _appendToken(type)
@@ -120,7 +120,7 @@
             if (this._curlyBraceDepth === 0) {
                 this._finishExpression();
 
-                console.assert(this._states.lastValue === WebInspector.BreakpointLogMessageLexer.State.Expression);
+                console.assert(this._states.lastValue === WI.BreakpointLogMessageLexer.State.Expression);
                 this._states.pop();
                 return;
             }
@@ -132,7 +132,7 @@
 
         if (character === "/" || character === "\"" || character === "'") {
             this._literalStartCharacter = character;
-            this._states.push(WebInspector.BreakpointLogMessageLexer.State.RegExpOrStringLiteral);
+            this._states.push(WI.BreakpointLogMessageLexer.State.RegExpOrStringLiteral);
         } else if (character === "{")
             this._curlyBraceDepth++;
     }
@@ -142,7 +142,7 @@
         let character = this._peek();
 
         if (character === "$")
-            this._states.push(WebInspector.BreakpointLogMessageLexer.State.PossiblePlaceholder);
+            this._states.push(WI.BreakpointLogMessageLexer.State.PossiblePlaceholder);
         else {
             this._buffer += character;
             this._consume();
@@ -155,13 +155,13 @@
         console.assert(character === "$");
         let nextCharacter = this._peek();
 
-        console.assert(this._states.lastValue === WebInspector.BreakpointLogMessageLexer.State.PossiblePlaceholder);
+        console.assert(this._states.lastValue === WI.BreakpointLogMessageLexer.State.PossiblePlaceholder);
         this._states.pop();
 
         if (nextCharacter === "{") {
             this._finishPlainText();
             this._consume();
-            this._states.push(WebInspector.BreakpointLogMessageLexer.State.Expression);
+            this._states.push(WI.BreakpointLogMessageLexer.State.Expression);
         } else
             this._buffer += character;
     }
@@ -178,20 +178,20 @@
         }
 
         if (character === this._literalStartCharacter) {
-            console.assert(this._states.lastValue === WebInspector.BreakpointLogMessageLexer.State.RegExpOrStringLiteral);
+            console.assert(this._states.lastValue === WI.BreakpointLogMessageLexer.State.RegExpOrStringLiteral);
             this._states.pop();
         }
     }
 };
 
-WebInspector.BreakpointLogMessageLexer.State = {
+WI.BreakpointLogMessageLexer.State = {
     Expression: Symbol("expression"),
     PlainText: Symbol("plain-text"),
     PossiblePlaceholder: Symbol("possible-placeholder"),
     RegExpOrStringLiteral: Symbol("regexp-or-string-literal"),
 };
 
-WebInspector.BreakpointLogMessageLexer.TokenType = {
+WI.BreakpointLogMessageLexer.TokenType = {
     PlainText: "token-type-plain-text",
     Expression: "token-type-expression",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js b/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js
index 96c3e15..68f995f 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BreakpointPopoverController = class BreakpointPopoverController extends WebInspector.Object
+WI.BreakpointPopoverController = class BreakpointPopoverController extends WI.Object
 {
     constructor()
     {
@@ -46,16 +46,16 @@
                 return;
 
             this._createPopoverContent(breakpoint);
-            this._popover = new WebInspector.Popover(this);
+            this._popover = new WI.Popover(this);
             this._popover.content = this._popoverContentElement;
 
-            let bounds = WebInspector.Rect.rectFromClientRect(breakpointDisplayElement.getBoundingClientRect());
+            let bounds = WI.Rect.rectFromClientRect(breakpointDisplayElement.getBoundingClientRect());
             bounds.origin.x -= 1; // Move the anchor left one pixel so it looks more centered.
-            this._popover.present(bounds.pad(2), [WebInspector.RectEdge.MAX_Y]);
+            this._popover.present(bounds.pad(2), [WI.RectEdge.MAX_Y]);
         };
 
         const removeBreakpoint = () => {
-            WebInspector.debuggerManager.removeBreakpoint(breakpoint);
+            WI.debuggerManager.removeBreakpoint(breakpoint);
         };
 
         const toggleBreakpoint = () => {
@@ -71,31 +71,31 @@
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             };
-            WebInspector.showOriginalOrFormattedSourceCodeLocation(breakpoint.sourceCodeLocation, options);
+            WI.showOriginalOrFormattedSourceCodeLocation(breakpoint.sourceCodeLocation, options);
         };
 
-        if (WebInspector.debuggerManager.isBreakpointEditable(breakpoint))
-            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpoint);
+        if (WI.debuggerManager.isBreakpointEditable(breakpoint))
+            contextMenu.appendItem(WI.UIString("Edit Breakpoint…"), editBreakpoint);
 
         if (breakpoint.autoContinue && !breakpoint.disabled) {
-            contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), toggleBreakpoint);
-            contextMenu.appendItem(WebInspector.UIString("Cancel Automatic Continue"), toggleAutoContinue);
+            contextMenu.appendItem(WI.UIString("Disable Breakpoint"), toggleBreakpoint);
+            contextMenu.appendItem(WI.UIString("Cancel Automatic Continue"), toggleAutoContinue);
         } else if (!breakpoint.disabled)
-            contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), toggleBreakpoint);
+            contextMenu.appendItem(WI.UIString("Disable Breakpoint"), toggleBreakpoint);
         else
-            contextMenu.appendItem(WebInspector.UIString("Enable Breakpoint"), toggleBreakpoint);
+            contextMenu.appendItem(WI.UIString("Enable Breakpoint"), toggleBreakpoint);
 
         if (!breakpoint.autoContinue && !breakpoint.disabled && breakpoint.actions.length)
-            contextMenu.appendItem(WebInspector.UIString("Set to Automatically Continue"), toggleAutoContinue);
+            contextMenu.appendItem(WI.UIString("Set to Automatically Continue"), toggleAutoContinue);
 
-        if (WebInspector.debuggerManager.isBreakpointRemovable(breakpoint)) {
+        if (WI.debuggerManager.isBreakpointRemovable(breakpoint)) {
             contextMenu.appendSeparator();
-            contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"), removeBreakpoint);
+            contextMenu.appendItem(WI.UIString("Delete Breakpoint"), removeBreakpoint);
         }
 
         if (breakpoint._sourceCodeLocation.hasMappedLocation()) {
             contextMenu.appendSeparator();
-            contextMenu.appendItem(WebInspector.UIString("Reveal in Original Resource"), revealOriginalSourceCodeLocation);
+            contextMenu.appendItem(WI.UIString("Reveal in Original Resource"), revealOriginalSourceCodeLocation);
         }
     }
 
@@ -134,16 +134,16 @@
         let conditionHeader = conditionRow.appendChild(document.createElement("th"));
         let conditionData = conditionRow.appendChild(document.createElement("td"));
         let conditionLabel = conditionHeader.appendChild(document.createElement("label"));
-        conditionLabel.textContent = WebInspector.UIString("Condition");
+        conditionLabel.textContent = WI.UIString("Condition");
         let conditionEditorElement = conditionData.appendChild(document.createElement("div"));
-        conditionEditorElement.classList.add("edit-breakpoint-popover-condition", WebInspector.SyntaxHighlightedStyleClassName);
+        conditionEditorElement.classList.add("edit-breakpoint-popover-condition", WI.SyntaxHighlightedStyleClassName);
 
-        this._conditionCodeMirror = WebInspector.CodeMirrorEditor.create(conditionEditorElement, {
+        this._conditionCodeMirror = WI.CodeMirrorEditor.create(conditionEditorElement, {
             extraKeys: {Tab: false},
             lineWrapping: false,
             mode: "text/javascript",
             matchBrackets: true,
-            placeholder: WebInspector.UIString("Conditional expression"),
+            placeholder: WI.UIString("Conditional expression"),
             scrollbarStyle: null,
             value: this._breakpoint.condition || "",
         });
@@ -161,8 +161,8 @@
         this._conditionCodeMirror.on("change", this._conditionCodeMirrorChanged.bind(this));
         this._conditionCodeMirror.on("beforeChange", this._conditionCodeMirrorBeforeChange.bind(this));
 
-        let completionController = new WebInspector.CodeMirrorCompletionController(this._conditionCodeMirror, this);
-        completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
+        let completionController = new WI.CodeMirrorCompletionController(this._conditionCodeMirror, this);
+        completionController.addExtendedCompletionProvider("javascript", WI.javaScriptRuntimeCompletionProvider);
 
         // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
         setTimeout(() => {
@@ -188,7 +188,7 @@
                 this._ignoreCountInput.addEventListener("change", this._popoverIgnoreInputChanged.bind(this));
 
                 ignoreCountLabel.setAttribute("for", this._ignoreCountInput.id);
-                ignoreCountLabel.textContent = WebInspector.UIString("Ignore");
+                ignoreCountLabel.textContent = WI.UIString("Ignore");
 
                 this._ignoreCountText = ignoreCountData.appendChild(document.createElement("span"));
                 this._updateIgnoreCountText();
@@ -198,21 +198,21 @@
             let actionHeader = actionRow.appendChild(document.createElement("th"));
             let actionData = this._actionsContainer = actionRow.appendChild(document.createElement("td"));
             let actionLabel = actionHeader.appendChild(document.createElement("label"));
-            actionLabel.textContent = WebInspector.UIString("Action");
+            actionLabel.textContent = WI.UIString("Action");
 
             if (!this._breakpoint.actions.length)
                 this._popoverActionsCreateAddActionButton();
             else {
-                this._popoverContentElement.classList.add(WebInspector.BreakpointPopoverController.WidePopoverClassName);
+                this._popoverContentElement.classList.add(WI.BreakpointPopoverController.WidePopoverClassName);
                 for (let i = 0; i < this._breakpoint.actions.length; ++i) {
-                    let breakpointActionView = new WebInspector.BreakpointActionView(this._breakpoint.actions[i], this, true);
+                    let breakpointActionView = new WI.BreakpointActionView(this._breakpoint.actions[i], this, true);
                     this._popoverActionsInsertBreakpointActionView(breakpointActionView, i);
                 }
             }
 
             let optionsRow = this._popoverOptionsRowElement = table.appendChild(document.createElement("tr"));
             if (!this._breakpoint.actions.length)
-                optionsRow.classList.add(WebInspector.BreakpointPopoverController.HiddenStyleClassName);
+                optionsRow.classList.add(WI.BreakpointPopoverController.HiddenStyleClassName);
             let optionsHeader = optionsRow.appendChild(document.createElement("th"));
             let optionsData = optionsRow.appendChild(document.createElement("td"));
             let optionsLabel = optionsHeader.appendChild(document.createElement("label"));
@@ -222,9 +222,9 @@
             optionsCheckbox.type = "checkbox";
             optionsCheckbox.checked = this._breakpoint.autoContinue;
             optionsCheckbox.addEventListener("change", this._popoverToggleAutoContinueCheckboxChanged.bind(this));
-            optionsLabel.textContent = WebInspector.UIString("Options");
+            optionsLabel.textContent = WI.UIString("Options");
             optionsCheckboxLabel.setAttribute("for", optionsCheckbox.id);
-            optionsCheckboxLabel.textContent = WebInspector.UIString("Automatically continue after evaluating");
+            optionsCheckboxLabel.textContent = WI.UIString("Automatically continue after evaluating");
         }
 
         this._popoverContentElement.appendChild(checkboxLabel);
@@ -281,23 +281,23 @@
 
     _popoverActionsCreateAddActionButton()
     {
-        this._popoverContentElement.classList.remove(WebInspector.BreakpointPopoverController.WidePopoverClassName);
+        this._popoverContentElement.classList.remove(WI.BreakpointPopoverController.WidePopoverClassName);
         this._actionsContainer.removeChildren();
 
         let addActionButton = this._actionsContainer.appendChild(document.createElement("button"));
-        addActionButton.textContent = WebInspector.UIString("Add Action");
+        addActionButton.textContent = WI.UIString("Add Action");
         addActionButton.addEventListener("click", this._popoverActionsAddActionButtonClicked.bind(this));
     }
 
     _popoverActionsAddActionButtonClicked(event)
     {
-        this._popoverContentElement.classList.add(WebInspector.BreakpointPopoverController.WidePopoverClassName);
+        this._popoverContentElement.classList.add(WI.BreakpointPopoverController.WidePopoverClassName);
         this._actionsContainer.removeChildren();
 
-        let newAction = this._breakpoint.createAction(WebInspector.Breakpoint.DefaultBreakpointActionType);
-        let newBreakpointActionView = new WebInspector.BreakpointActionView(newAction, this);
+        let newAction = this._breakpoint.createAction(WI.Breakpoint.DefaultBreakpointActionType);
+        let newBreakpointActionView = new WI.BreakpointActionView(newAction, this);
         this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, -1);
-        this._popoverOptionsRowElement.classList.remove(WebInspector.BreakpointPopoverController.HiddenStyleClassName);
+        this._popoverOptionsRowElement.classList.remove(WI.BreakpointPopoverController.HiddenStyleClassName);
         this._popover.update();
     }
 
@@ -314,14 +314,14 @@
     _updateIgnoreCountText()
     {
         if (this._breakpoint.ignoreCount === 1)
-            this._ignoreCountText.textContent = WebInspector.UIString("time before stopping");
+            this._ignoreCountText.textContent = WI.UIString("time before stopping");
         else
-            this._ignoreCountText.textContent = WebInspector.UIString("times before stopping");
+            this._ignoreCountText.textContent = WI.UIString("times before stopping");
     }
 
     breakpointActionViewAppendActionView(breakpointActionView, newAction)
     {
-        let newBreakpointActionView = new WebInspector.BreakpointActionView(newAction, this);
+        let newBreakpointActionView = new WI.BreakpointActionView(newAction, this);
 
         let index = 0;
         let children = this._actionsContainer.children;
@@ -333,7 +333,7 @@
         }
 
         this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, index);
-        this._popoverOptionsRowElement.classList.remove(WebInspector.BreakpointPopoverController.HiddenStyleClassName);
+        this._popoverOptionsRowElement.classList.remove(WI.BreakpointPopoverController.HiddenStyleClassName);
 
         this._popover.update();
     }
@@ -344,7 +344,7 @@
 
         if (!this._actionsContainer.children.length) {
             this._popoverActionsCreateAddActionButton();
-            this._popoverOptionsRowElement.classList.add(WebInspector.BreakpointPopoverController.HiddenStyleClassName);
+            this._popoverOptionsRowElement.classList.add(WI.BreakpointPopoverController.HiddenStyleClassName);
             this._popoverOptionsCheckboxElement.checked = false;
         }
 
@@ -370,7 +370,7 @@
     {
         // Remove Evaluate and Probe actions that have no data.
         let emptyActions = this._breakpoint.actions.filter(function(action) {
-            if (action.type !== WebInspector.BreakpointAction.Type.Evaluate && action.type !== WebInspector.BreakpointAction.Type.Probe)
+            if (action.type !== WI.BreakpointAction.Type.Evaluate && action.type !== WI.BreakpointAction.Type.Probe)
                 return false;
             return !(action.data && action.data.trim());
         });
@@ -382,5 +382,5 @@
     }
 };
 
-WebInspector.BreakpointPopoverController.WidePopoverClassName = "wide";
-WebInspector.BreakpointPopoverController.HiddenStyleClassName = "hidden";
+WI.BreakpointPopoverController.WidePopoverClassName = "wide";
+WI.BreakpointPopoverController.HiddenStyleClassName = "hidden";
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js b/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js
index e3c3169..4912f2d 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleManager = class CSSStyleManager extends WebInspector.Object
+WI.CSSStyleManager = class CSSStyleManager extends WI.Object
 {
     constructor()
     {
@@ -32,16 +32,16 @@
         if (window.CSSAgent)
             CSSAgent.enable();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
-        WebInspector.Resource.addEventListener(WebInspector.SourceCode.Event.ContentDidChange, this._resourceContentDidChange, this);
-        WebInspector.Resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
+        WI.Resource.addEventListener(WI.SourceCode.Event.ContentDidChange, this._resourceContentDidChange, this);
+        WI.Resource.addEventListener(WI.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
 
-        WebInspector.DOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeModified, this._nodeAttributesDidChange, this);
-        WebInspector.DOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved, this._nodeAttributesDidChange, this);
-        WebInspector.DOMNode.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged, this._nodePseudoClassesDidChange, this);
+        WI.DOMNode.addEventListener(WI.DOMNode.Event.AttributeModified, this._nodeAttributesDidChange, this);
+        WI.DOMNode.addEventListener(WI.DOMNode.Event.AttributeRemoved, this._nodeAttributesDidChange, this);
+        WI.DOMNode.addEventListener(WI.DOMNode.Event.EnabledPseudoClassesChanged, this._nodePseudoClassesDidChange, this);
 
-        this._colorFormatSetting = new WebInspector.Setting("default-color-format", WebInspector.Color.Format.Original);
+        this._colorFormatSetting = new WI.Setting("default-color-format", WI.Color.Format.Original);
 
         this._styleSheetIdentifierMap = new Map;
         this._styleSheetFrameURLMap = new Map;
@@ -58,13 +58,13 @@
     {
         switch (origin) {
         case CSSAgent.StyleSheetOrigin.Regular:
-            return WebInspector.CSSStyleSheet.Type.Author;
+            return WI.CSSStyleSheet.Type.Author;
         case CSSAgent.StyleSheetOrigin.User:
-            return WebInspector.CSSStyleSheet.Type.User;
+            return WI.CSSStyleSheet.Type.User;
         case CSSAgent.StyleSheetOrigin.UserAgent:
-            return WebInspector.CSSStyleSheet.Type.UserAgent;
+            return WI.CSSStyleSheet.Type.UserAgent;
         case CSSAgent.StyleSheetOrigin.Inspector:
-            return WebInspector.CSSStyleSheet.Type.Inspector;
+            return WI.CSSStyleSheet.Type.Inspector;
         default:
             console.assert(false, "Unknown CSS.StyleSheetOrigin", origin);
             return CSSAgent.StyleSheetOrigin.Regular;
@@ -75,16 +75,16 @@
     {
         switch (source) {
         case CSSAgent.CSSMediaSource.MediaRule:
-            return WebInspector.CSSMedia.Type.MediaRule;
+            return WI.CSSMedia.Type.MediaRule;
         case CSSAgent.CSSMediaSource.ImportRule:
-            return WebInspector.CSSMedia.Type.ImportRule;
+            return WI.CSSMedia.Type.ImportRule;
         case CSSAgent.CSSMediaSource.LinkedSheet:
-            return WebInspector.CSSMedia.Type.LinkedStyleSheet;
+            return WI.CSSMedia.Type.LinkedStyleSheet;
         case CSSAgent.CSSMediaSource.InlineSheet:
-            return WebInspector.CSSMedia.Type.InlineStyleSheet;
+            return WI.CSSMedia.Type.InlineStyleSheet;
         default:
             console.assert(false, "Unknown CSS.CSSMediaSource", source);
-            return WebInspector.CSSMedia.Type.MediaRule;
+            return WI.CSSMedia.Type.MediaRule;
         }
     }
 
@@ -152,7 +152,7 @@
         if (styleSheet)
             return styleSheet;
 
-        styleSheet = new WebInspector.CSSStyleSheet(id);
+        styleSheet = new WI.CSSStyleSheet(id);
         this._styleSheetIdentifierMap.set(id, styleSheet);
         return styleSheet;
     }
@@ -162,7 +162,7 @@
         if (node.id in this._nodeStylesMap)
             return this._nodeStylesMap[node.id];
 
-        var styles = new WebInspector.DOMNodeStyles(node);
+        var styles = new WI.DOMNodeStyles(node);
         this._nodeStylesMap[node.id] = styles;
         return styles;
     }
@@ -171,7 +171,7 @@
     {
         var inspectorStyleSheets = this._inspectorStyleSheetsForFrame(frame);
         for (let styleSheet of inspectorStyleSheets) {
-            if (styleSheet[WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol]) {
+            if (styleSheet[WI.CSSStyleManager.PreferredInspectorStyleSheetSymbol]) {
                 callback(styleSheet);
                 return;
             }
@@ -182,8 +182,8 @@
 
         if (CSSAgent.createStyleSheet) {
             CSSAgent.createStyleSheet(frame.id, function(error, styleSheetId) {
-                let styleSheet = WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId);
-                styleSheet[WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol] = true;
+                let styleSheet = WI.cssStyleManager.styleSheetForIdentifier(styleSheetId);
+                styleSheet[WI.CSSStyleManager.PreferredInspectorStyleSheetSymbol] = true;
                 callback(styleSheet);
             });
             return;
@@ -205,7 +205,7 @@
                 return;
             }
 
-            let remoteObject = WebInspector.RemoteObject.fromPayload(documentRemoteObjectPayload);
+            let remoteObject = WI.RemoteObject.fromPayload(documentRemoteObjectPayload);
             remoteObject.pushNodeToFrontend(documentNodeAvailable.bind(null, remoteObject));
         }
 
@@ -241,13 +241,13 @@
             }
 
             let styleSheetId = payload.ruleId.styleSheetId;
-            let styleSheet = WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId);
+            let styleSheet = WI.cssStyleManager.styleSheetForIdentifier(styleSheetId);
             if (!styleSheet) {
                 callback(null);
                 return;
             }
 
-            styleSheet[WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol] = true;
+            styleSheet[WI.CSSStyleManager.PreferredInspectorStyleSheetSymbol] = true;
 
             console.assert(styleSheet.isInspectorStyleSheet());
             console.assert(styleSheet.parentFrame === frame);
@@ -266,7 +266,7 @@
 
     mediaQueryResultChanged()
     {
-        // Called from WebInspector.CSSObserver.
+        // Called from WI.CSSObserver.
 
         for (var key in this._nodeStylesMap)
             this._nodeStylesMap[key].mediaQueryResultDidChange();
@@ -274,7 +274,7 @@
 
     styleSheetChanged(styleSheetIdentifier)
     {
-        // Called from WebInspector.CSSObserver.
+        // Called from WI.CSSObserver.
         var styleSheet = this.styleSheetForIdentifier(styleSheetIdentifier);
         console.assert(styleSheet);
 
@@ -290,11 +290,11 @@
     {
         console.assert(!this._styleSheetIdentifierMap.has(styleSheetInfo.styleSheetId), "Attempted to add a CSSStyleSheet but identifier was already in use");
         let styleSheet = this.styleSheetForIdentifier(styleSheetInfo.styleSheetId);
-        let parentFrame = WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId);
-        let origin = WebInspector.CSSStyleManager.protocolStyleSheetOriginToEnum(styleSheetInfo.origin);
+        let parentFrame = WI.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId);
+        let origin = WI.CSSStyleManager.protocolStyleSheetOriginToEnum(styleSheetInfo.origin);
         styleSheet.updateInfo(styleSheetInfo.sourceURL, parentFrame, origin, styleSheetInfo.isInline, styleSheetInfo.startLine, styleSheetInfo.startColumn);
 
-        this.dispatchEventToListeners(WebInspector.CSSStyleManager.Event.StyleSheetAdded, {styleSheet});
+        this.dispatchEventToListeners(WI.CSSStyleManager.Event.StyleSheetAdded, {styleSheet});
     }
 
     styleSheetRemoved(styleSheetIdentifier)
@@ -306,7 +306,7 @@
 
         this._styleSheetIdentifierMap.delete(styleSheetIdentifier);
 
-        this.dispatchEventToListeners(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, {styleSheet});
+        this.dispatchEventToListeners(WI.CSSStyleManager.Event.StyleSheetRemoved, {styleSheet});
     }
 
     // Private
@@ -349,7 +349,7 @@
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (!event.target.isMainFrame())
             return;
@@ -364,12 +364,12 @@
 
     _resourceAdded(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         var resource = event.data.resource;
         console.assert(resource);
 
-        if (resource.type !== WebInspector.Resource.Type.Stylesheet)
+        if (resource.type !== WI.Resource.Type.Stylesheet)
             return;
 
         this._clearStyleSheetsForResource(resource);
@@ -377,10 +377,10 @@
 
     _resourceTypeDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Resource);
+        console.assert(event.target instanceof WI.Resource);
 
         var resource = event.target;
-        if (resource.type !== WebInspector.Resource.Type.Stylesheet)
+        if (resource.type !== WI.Resource.Type.Stylesheet)
             return;
 
         this._clearStyleSheetsForResource(resource);
@@ -405,7 +405,7 @@
 
     _lookupStyleSheet(frame, url, callback)
     {
-        console.assert(frame instanceof WebInspector.Frame);
+        console.assert(frame instanceof WI.Frame);
 
         let key = this._frameURLMapKey(frame, url);
 
@@ -435,8 +435,8 @@
             }
 
             for (let styleSheetInfo of styleSheets) {
-                let parentFrame = WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId);
-                let origin = WebInspector.CSSStyleManager.protocolStyleSheetOriginToEnum(styleSheetInfo.origin);
+                let parentFrame = WI.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId);
+                let origin = WI.CSSStyleManager.protocolStyleSheetOriginToEnum(styleSheetInfo.origin);
 
                 // COMPATIBILITY (iOS 9): The info did not have 'isInline', 'startLine', and 'startColumn', so make false and 0 in these cases.
                 let isInline = styleSheetInfo.isInline || false;
@@ -463,7 +463,7 @@
             return;
 
         // Ignore if it isn't a CSS stylesheet.
-        if (resource.type !== WebInspector.Resource.Type.Stylesheet || resource.syntheticMIMEType !== "text/css")
+        if (resource.type !== WI.Resource.Type.Stylesheet || resource.syntheticMIMEType !== "text/css")
             return;
 
         function applyStyleSheetChanges()
@@ -480,7 +480,7 @@
                 // ignore the next _updateResourceContent call.
                 resource.__ignoreNextUpdateResourceContent = true;
 
-                WebInspector.branchManager.currentBranch.revisionForRepresentedObject(styleSheet).content = resource.content;
+                WI.branchManager.currentBranch.revisionForRepresentedObject(styleSheet).content = resource.content;
             }
 
             this._lookupStyleSheetForResource(resource, styleSheetFound.bind(this));
@@ -511,7 +511,7 @@
 
                 // Only try to update stylesheet resources. Other resources, like documents, can contain
                 // multiple stylesheets and we don't have the source ranges to update those.
-                if (representedObject.type !== WebInspector.Resource.Type.Stylesheet)
+                if (representedObject.type !== WI.Resource.Type.Stylesheet)
                     return;
             }
 
@@ -522,10 +522,10 @@
 
             this._ignoreResourceContentDidChangeEventForResource = representedObject;
 
-            let revision = WebInspector.branchManager.currentBranch.revisionForRepresentedObject(representedObject);
+            let revision = WI.branchManager.currentBranch.revisionForRepresentedObject(representedObject);
             if (styleSheet.isInspectorStyleSheet()) {
                 revision.content = representedObject.content;
-                styleSheet.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);
+                styleSheet.dispatchEventToListeners(WI.SourceCode.Event.ContentDidChange);
             } else
                 revision.content = parameters.content;
 
@@ -551,11 +551,11 @@
     }
 };
 
-WebInspector.CSSStyleManager.Event = {
+WI.CSSStyleManager.Event = {
     StyleSheetAdded: "css-style-manager-style-sheet-added",
     StyleSheetRemoved: "css-style-manager-style-sheet-removed",
 };
 
-WebInspector.CSSStyleManager.PseudoElementNames = ["before", "after"];
-WebInspector.CSSStyleManager.ForceablePseudoClasses = ["active", "focus", "hover", "visited"];
-WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol = Symbol("css-style-manager-preferred-inspector-stylesheet");
+WI.CSSStyleManager.PseudoElementNames = ["before", "after"];
+WI.CSSStyleManager.ForceablePseudoClasses = ["active", "focus", "hover", "visited"];
+WI.CSSStyleManager.PreferredInspectorStyleSheetSymbol = Symbol("css-style-manager-preferred-inspector-stylesheet");
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js b/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
index 26044c0..cc5d0a5 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CanvasManager = class CanvasManager extends WebInspector.Object
+WI.CanvasManager = class CanvasManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
         this._canvasIdentifierMap = new Map;
 
@@ -46,21 +46,21 @@
 
     canvasAdded(canvasPayload)
     {
-        // Called from WebInspector.CanvasObserver.
+        // Called from WI.CanvasObserver.
 
         console.assert(!this._canvasIdentifierMap.has(canvasPayload.canvasId), `Canvas already exists with id ${canvasPayload.canvasId}.`);
 
-        let canvas = WebInspector.Canvas.fromPayload(canvasPayload);
+        let canvas = WI.Canvas.fromPayload(canvasPayload);
         this._canvasIdentifierMap.set(canvas.identifier, canvas);
 
         canvas.frame.canvasCollection.add(canvas);
 
-        this.dispatchEventToListeners(WebInspector.CanvasManager.Event.CanvasWasAdded, {canvas});
+        this.dispatchEventToListeners(WI.CanvasManager.Event.CanvasWasAdded, {canvas});
     }
 
     canvasRemoved(canvasIdentifier)
     {
-        // Called from WebInspector.CanvasObserver.
+        // Called from WI.CanvasObserver.
 
         let canvas = this._canvasIdentifierMap.take(canvasIdentifier);
         console.assert(canvas);
@@ -69,12 +69,12 @@
 
         canvas.frame.canvasCollection.remove(canvas);
 
-        this.dispatchEventToListeners(WebInspector.CanvasManager.Event.CanvasWasRemoved, {canvas});
+        this.dispatchEventToListeners(WI.CanvasManager.Event.CanvasWasRemoved, {canvas});
     }
 
     canvasMemoryChanged(canvasIdentifier, memoryCost)
     {
-        // Called from WebInspector.CanvasObserver.
+        // Called from WI.CanvasObserver.
 
         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
         console.assert(canvas);
@@ -86,7 +86,7 @@
 
     cssCanvasClientNodesChanged(canvasIdentifier)
     {
-        // Called from WebInspector.CanvasObserver.
+        // Called from WI.CanvasObserver.
 
         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
         console.assert(canvas);
@@ -98,37 +98,37 @@
 
     recordingFinished(canvasIdentifier, recordingPayload)
     {
-        // Called from WebInspector.CanvasObserver.
+        // Called from WI.CanvasObserver.
 
         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
         console.assert(canvas);
         if (!canvas)
             return;
 
-        let recording = WebInspector.Recording.fromPayload(recordingPayload);
+        let recording = WI.Recording.fromPayload(recordingPayload);
         recording.source = canvas;
 
-        this.dispatchEventToListeners(WebInspector.CanvasManager.Event.RecordingFinished, {canvas, recording});
+        this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingFinished, {canvas, recording});
     }
 
     // Private
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
         if (!event.target.isMainFrame())
             return;
 
-        WebInspector.Canvas.resetUniqueDisplayNameNumbers();
+        WI.Canvas.resetUniqueDisplayNameNumbers();
 
         if (this._canvasIdentifierMap.size) {
             this._canvasIdentifierMap.clear();
-            this.dispatchEventToListeners(WebInspector.CanvasManager.Event.Cleared);
+            this.dispatchEventToListeners(WI.CanvasManager.Event.Cleared);
         }
     }
 };
 
-WebInspector.CanvasManager.Event = {
+WI.CanvasManager.Event = {
     Cleared: "canvas-manager-cleared",
     CanvasWasAdded: "canvas-manager-canvas-was-added",
     CanvasWasRemoved: "canvas-manager-canvas-was-removed",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js
index 717989d..b0877cd 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorBezierEditingController = class CodeMirrorBezierEditingController extends WebInspector.CodeMirrorEditingController
+WI.CodeMirrorBezierEditingController = class CodeMirrorBezierEditingController extends WI.CodeMirrorEditingController
 {
     // Public
 
     get initialValue()
     {
-        return WebInspector.CubicBezier.fromString(this.text);
+        return WI.CubicBezier.fromString(this.text);
     }
 
     get cssClassName()
@@ -39,8 +39,8 @@
 
     popoverWillPresent(popover)
     {
-        this._bezierEditor = new WebInspector.BezierEditor;
-        this._bezierEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged, this._bezierEditorBezierChanged, this);
+        this._bezierEditor = new WI.BezierEditor;
+        this._bezierEditor.addEventListener(WI.BezierEditor.Event.BezierChanged, this._bezierEditorBezierChanged, this);
         popover.content = this._bezierEditor.element;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorColorEditingController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorColorEditingController.js
index 3848c46..3c9995c 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorColorEditingController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorColorEditingController.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorColorEditingController = class CodeMirrorColorEditingController extends WebInspector.CodeMirrorEditingController
+WI.CodeMirrorColorEditingController = class CodeMirrorColorEditingController extends WI.CodeMirrorEditingController
 {
     // Public
 
     get initialValue()
     {
-        return WebInspector.Color.fromString(this.text);
+        return WI.Color.fromString(this.text);
     }
 
     get cssClassName()
@@ -39,9 +39,9 @@
 
     popoverWillPresent(popover)
     {
-        this._colorPicker = new WebInspector.ColorPicker;
-        this._colorPicker.addEventListener(WebInspector.ColorPicker.Event.ColorChanged, this._colorPickerColorChanged, this);
-        this._colorPicker.addEventListener(WebInspector.ColorPicker.Event.FormatChanged, (event) => popover.update());
+        this._colorPicker = new WI.ColorPicker;
+        this._colorPicker.addEventListener(WI.ColorPicker.Event.ColorChanged, this._colorPickerColorChanged, this);
+        this._colorPicker.addEventListener(WI.ColorPicker.Event.FormatChanged, (event) => popover.update());
         popover.content = this._colorPicker.element;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js
index 33d7ccb..21ad726 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorCompletionController = class CodeMirrorCompletionController extends WebInspector.Object
+WI.CodeMirrorCompletionController = class CodeMirrorCompletionController extends WI.Object
 {
     constructor(codeMirror, delegate, stopCharactersRegex)
     {
@@ -43,7 +43,7 @@
         this._completions = [];
         this._extendedCompletionProviders = {};
 
-        this._suggestionsView = new WebInspector.CompletionSuggestionsView(this);
+        this._suggestionsView = new WI.CompletionSuggestionsView(this);
 
         this._keyMap = {
             "Up": this._handleUpKey.bind(this),
@@ -104,7 +104,7 @@
 
         var firstCharCoords = this._codeMirror.cursorCoords(from);
         var lastCharCoords = this._codeMirror.cursorCoords(to);
-        var bounds = new WebInspector.Rect(firstCharCoords.left, firstCharCoords.top, lastCharCoords.right - firstCharCoords.left, firstCharCoords.bottom - firstCharCoords.top);
+        var bounds = new WI.Rect(firstCharCoords.left, firstCharCoords.top, lastCharCoords.right - firstCharCoords.left, firstCharCoords.bottom - firstCharCoords.top);
 
         // Try to restore the previous selected index, otherwise just select the first.
         var index = this._currentCompletion ? completions.indexOf(this._currentCompletion) : 0;
@@ -128,12 +128,12 @@
 
         this._applyCompletionHint(completions[index]);
 
-        this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.CompletionsFound);
+        this._resolveUpdatePromise(WI.CodeMirrorCompletionController.UpdatePromise.CompletionsFound);
     }
 
     isCompletionChange(change)
     {
-        return this._ignoreChange || change.origin === WebInspector.CodeMirrorCompletionController.CompletionOrigin || change.origin === WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin;
+        return this._ignoreChange || change.origin === WI.CodeMirrorCompletionController.CompletionOrigin || change.origin === WI.CodeMirrorCompletionController.DeleteCompletionOrigin;
     }
 
     isShowingCompletions()
@@ -163,7 +163,7 @@
         delete this._currentCompletion;
         delete this._ignoreNextCursorActivity;
 
-        this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound);
+        this._resolveUpdatePromise(WI.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound);
     }
 
     close()
@@ -178,9 +178,9 @@
 
     completeAtCurrentPositionIfNeeded(force)
     {
-        this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.Canceled);
+        this._resolveUpdatePromise(WI.CodeMirrorCompletionController.UpdatePromise.Canceled);
 
-        var update = this._updatePromise = new WebInspector.WrappedPromise;
+        var update = this._updatePromise = new WI.WrappedPromise;
 
         this._completeAtCurrentPosition(force);
 
@@ -242,13 +242,13 @@
 
         if (this._notifyCompletionsHiddenIfNeededTimeout)
             clearTimeout(this._notifyCompletionsHiddenIfNeededTimeout);
-        this._notifyCompletionsHiddenIfNeededTimeout = setTimeout(notify.bind(this), WebInspector.CodeMirrorCompletionController.CompletionsHiddenDelay);
+        this._notifyCompletionsHiddenIfNeededTimeout = setTimeout(notify.bind(this), WI.CodeMirrorCompletionController.CompletionsHiddenDelay);
     }
 
     _createCompletionHintMarker(position, text)
     {
         var container = document.createElement("span");
-        container.classList.add(WebInspector.CodeMirrorCompletionController.CompletionHintStyleClassName);
+        container.classList.add(WI.CodeMirrorCompletionController.CompletionHintStyleClassName);
         container.textContent = text;
 
         this._completionHintMarker = this._codeMirror.setUniqueBookmark(position, {widget: container, insertLeft: true});
@@ -300,7 +300,7 @@
             if (isClosing !== -1)
                 to.ch -= 1 + this._implicitSuffix.length;
 
-            this._codeMirror.replaceRange(replacementText, from, cursor, WebInspector.CodeMirrorCompletionController.CompletionOrigin);
+            this._codeMirror.replaceRange(replacementText, from, cursor, WI.CodeMirrorCompletionController.CompletionOrigin);
 
             // Don't call _removeLastChangeFromHistory here to allow the committed completion to be undone.
 
@@ -365,7 +365,7 @@
             var from = {line: this._lineNumber, ch: this._startOffset};
             var to = {line: this._lineNumber, ch: this._endOffset};
 
-            this._codeMirror.replaceRange(this._prefix, from, to, WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin);
+            this._codeMirror.replaceRange(this._prefix, from, to, WI.CodeMirrorCompletionController.DeleteCompletionOrigin);
             this._removeLastChangeFromHistory();
         }
 
@@ -385,7 +385,7 @@
     {
         console.assert(direction === -1 || direction === 1);
 
-        var stopCharactersRegex = stopCharactersRegex || this._stopCharactersRegex || WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap[modeName] || WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex;
+        var stopCharactersRegex = stopCharactersRegex || this._stopCharactersRegex || WI.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap[modeName] || WI.CodeMirrorCompletionController.GenericStopCharactersRegex;
 
         function isStopCharacter(character)
         {
@@ -394,17 +394,17 @@
 
         function isOpenBracketCharacter(character)
         {
-            return WebInspector.CodeMirrorCompletionController.OpenBracketCharactersRegex.test(character);
+            return WI.CodeMirrorCompletionController.OpenBracketCharactersRegex.test(character);
         }
 
         function isCloseBracketCharacter(character)
         {
-            return WebInspector.CodeMirrorCompletionController.CloseBracketCharactersRegex.test(character);
+            return WI.CodeMirrorCompletionController.CloseBracketCharactersRegex.test(character);
         }
 
         function matchingBracketCharacter(character)
         {
-            return WebInspector.CodeMirrorCompletionController.MatchingBrackets[character];
+            return WI.CodeMirrorCompletionController.MatchingBrackets[character];
         }
 
         var endOffset = Math.min(startOffset, string.length);
@@ -499,7 +499,7 @@
         this._implicitSuffix = "";
         this._forced = force;
 
-        var baseExpressionStopCharactersRegex = WebInspector.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap[modeName];
+        var baseExpressionStopCharactersRegex = WI.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap[modeName];
         if (baseExpressionStopCharactersRegex)
             var baseScanResult = this._scanStringForExpression(modeName, lineString, this._startOffset, -1, true, false, true, baseExpressionStopCharactersRegex);
 
@@ -577,7 +577,7 @@
             if (this._implicitSuffix === suffix)
                 this._implicitSuffix = "";
 
-            let completions = WebInspector.CSSKeywordCompletions.forProperty(propertyName).startsWith(this._prefix);
+            let completions = WI.CSSKeywordCompletions.forProperty(propertyName).startsWith(this._prefix);
 
             if (suffix.startsWith("("))
                 completions = completions.map((x) => x.replace(/\(\)$/, ""));
@@ -588,7 +588,7 @@
         this._implicitSuffix = suffix !== ":" ? ": " : "";
 
         // Complete property names.
-        return WebInspector.CSSCompletions.cssNameCompletions.startsWith(this._prefix);
+        return WI.CSSCompletions.cssNameCompletions.startsWith(this._prefix);
     }
 
     _generateJavaScriptCompletions(mainToken, base, suffix)
@@ -856,20 +856,20 @@
     }
 };
 
-WebInspector.CodeMirrorCompletionController.UpdatePromise = {
+WI.CodeMirrorCompletionController.UpdatePromise = {
     Canceled: "code-mirror-completion-controller-canceled",
     CompletionsFound: "code-mirror-completion-controller-completions-found",
     NoCompletionsFound: "code-mirror-completion-controller-no-completions-found"
 };
 
-WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex = /[\s=:;,]/;
-WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap = {"css": /[\s:;,{}()]/, "javascript": /[\s=:;,!+\-*/%&|^~?<>.{}()[\]]/};
-WebInspector.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap = {"javascript": /[\s=:;,!+\-*/%&|^~?<>]/};
-WebInspector.CodeMirrorCompletionController.OpenBracketCharactersRegex = /[({[]/;
-WebInspector.CodeMirrorCompletionController.CloseBracketCharactersRegex = /[)}\]]/;
-WebInspector.CodeMirrorCompletionController.MatchingBrackets = {"{": "}", "(": ")", "[": "]", "}": "{", ")": "(", "]": "["};
-WebInspector.CodeMirrorCompletionController.CompletionHintStyleClassName = "completion-hint";
-WebInspector.CodeMirrorCompletionController.CompletionsHiddenDelay = 250;
-WebInspector.CodeMirrorCompletionController.CompletionTypingDelay = 250;
-WebInspector.CodeMirrorCompletionController.CompletionOrigin = "+completion";
-WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin = "+delete-completion";
+WI.CodeMirrorCompletionController.GenericStopCharactersRegex = /[\s=:;,]/;
+WI.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap = {"css": /[\s:;,{}()]/, "javascript": /[\s=:;,!+\-*/%&|^~?<>.{}()[\]]/};
+WI.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap = {"javascript": /[\s=:;,!+\-*/%&|^~?<>]/};
+WI.CodeMirrorCompletionController.OpenBracketCharactersRegex = /[({[]/;
+WI.CodeMirrorCompletionController.CloseBracketCharactersRegex = /[)}\]]/;
+WI.CodeMirrorCompletionController.MatchingBrackets = {"{": "}", "(": ")", "[": "]", "}": "{", ")": "(", "]": "["};
+WI.CodeMirrorCompletionController.CompletionHintStyleClassName = "completion-hint";
+WI.CodeMirrorCompletionController.CompletionsHiddenDelay = 250;
+WI.CodeMirrorCompletionController.CompletionTypingDelay = 250;
+WI.CodeMirrorCompletionController.CompletionOrigin = "+completion";
+WI.CodeMirrorCompletionController.DeleteCompletionOrigin = "+delete-completion";
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorDragToAdjustNumberController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorDragToAdjustNumberController.js
index a810599..2d55048 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorDragToAdjustNumberController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorDragToAdjustNumberController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorDragToAdjustNumberController = class CodeMirrorDragToAdjustNumberController extends WebInspector.Object
+WI.CodeMirrorDragToAdjustNumberController = class CodeMirrorDragToAdjustNumberController extends WI.Object
 {
     constructor(codeMirror)
     {
@@ -31,7 +31,7 @@
 
         this._codeMirror = codeMirror;
 
-        this._dragToAdjustController = new WebInspector.DragToAdjustController(this);
+        this._dragToAdjustController = new WI.DragToAdjustController(this);
     }
 
     // Public
@@ -116,6 +116,6 @@
 
 CodeMirror.defineOption("dragToAdjustNumbers", true, function(codeMirror, value, oldValue) {
     if (!codeMirror.dragToAdjustNumberController)
-        codeMirror.dragToAdjustNumberController = new WebInspector.CodeMirrorDragToAdjustNumberController(codeMirror);
+        codeMirror.dragToAdjustNumberController = new WI.CodeMirrorDragToAdjustNumberController(codeMirror);
     codeMirror.dragToAdjustNumberController.enabled = value;
 });
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js
index 3496ac4..e3ce593 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorEditingController = class CodeMirrorEditingController extends WebInspector.Object
+WI.CodeMirrorEditingController = class CodeMirrorEditingController extends WI.Object
 {
     constructor(codeMirror, marker)
     {
@@ -38,7 +38,7 @@
         // The value must support .toString() and .copy() methods.
         this._value = this.initialValue;
 
-        this._keyboardShortcutEsc = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape);
+        this._keyboardShortcutEsc = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape);
     }
 
     // Public
@@ -90,7 +90,7 @@
         var lines = text.split("\n");
         var endLine = this._range.startLine + lines.length - 1;
         var endColumn = lines.length > 1 ? lines.lastValue.length : this._range.startColumn + text.length;
-        this._range = new WebInspector.TextRange(this._range.startLine, this._range.startColumn, endLine, endColumn);
+        this._range = new WI.TextRange(this._range.startLine, this._range.startColumn, endLine, endColumn);
     }
 
     get initialValue()
@@ -114,12 +114,12 @@
     {
         // Best to display the popover to the left or above the edited range since its end position may change, but not its start
         // position. This way we minimize the chances of overlaying the edited range as it changes.
-        return [WebInspector.RectEdge.MIN_X, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MAX_X];
+        return [WI.RectEdge.MIN_X, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_Y, WI.RectEdge.MAX_X];
     }
 
     popoverTargetFrameWithRects(rects)
     {
-        return WebInspector.Rect.unionOfRects(rects);
+        return WI.Rect.unionOfRects(rects);
     }
 
     presentHoverMenu()
@@ -127,7 +127,7 @@
         if (!this.cssClassName)
             return;
 
-        this._hoverMenu = new WebInspector.HoverMenu(this);
+        this._hoverMenu = new WI.HoverMenu(this);
         this._hoverMenu.element.classList.add(this.cssClassName);
         this._rects = this._marker.rects;
         this._hoverMenu.present(this._rects);
@@ -171,12 +171,12 @@
 
     hoverMenuButtonWasPressed(hoverMenu)
     {
-        this._popover = new WebInspector.Popover(this);
+        this._popover = new WI.Popover(this);
         this.popoverWillPresent(this._popover);
         this._popover.present(this.popoverTargetFrameWithRects(this._rects).pad(2), this.popoverPreferredEdges);
         this.popoverDidPresent(this._popover);
 
-        WebInspector.addWindowKeydownListener(this);
+        WI.addWindowKeydownListener(this);
 
         hoverMenu.dismiss();
 
@@ -191,7 +191,7 @@
         delete this._popover;
         delete this._originalValue;
 
-        WebInspector.removeWindowKeydownListener(this);
+        WI.removeWindowKeydownListener(this);
         this.popoverDidDismiss();
 
         if (this._delegate && typeof this._delegate.editingControllerDidFinishEditing === "function")
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorGradientEditingController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorGradientEditingController.js
index 1f9efd7..df2fcaa 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorGradientEditingController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorGradientEditingController.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorGradientEditingController = class CodeMirrorGradientEditingController extends WebInspector.CodeMirrorEditingController
+WI.CodeMirrorGradientEditingController = class CodeMirrorGradientEditingController extends WI.CodeMirrorEditingController
 {
     // Public
 
     get initialValue()
     {
-        return WebInspector.Gradient.fromString(this.text);
+        return WI.Gradient.fromString(this.text);
     }
 
     get cssClassName()
@@ -41,7 +41,7 @@
     {
         // Since the gradient editor can resize to be quite tall, let's avoid displaying the popover
         // above the edited value so that it may not change which edge it attaches to upon editing a stop.
-        return [WebInspector.RectEdge.MIN_X, WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MAX_X];
+        return [WI.RectEdge.MIN_X, WI.RectEdge.MAX_Y, WI.RectEdge.MAX_X];
     }
 
     popoverTargetFrameWithRects(rects)
@@ -58,9 +58,9 @@
             popover.update();
         }
 
-        this._gradientEditor = new WebInspector.GradientEditor;
-        this._gradientEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged, this._gradientEditorGradientChanged, this);
-        this._gradientEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled, handleColorPickerToggled, this);
+        this._gradientEditor = new WI.GradientEditor;
+        this._gradientEditor.addEventListener(WI.GradientEditor.Event.GradientChanged, this._gradientEditorGradientChanged, this);
+        this._gradientEditor.addEventListener(WI.GradientEditor.Event.ColorPickerToggled, handleColorPickerToggled, this);
         popover.content = this._gradientEditor.element;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorSpringEditingController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorSpringEditingController.js
index 7f1f91f..3104ed1 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorSpringEditingController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorSpringEditingController.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorSpringEditingController = class CodeMirrorSpringEditingController extends WebInspector.CodeMirrorEditingController
+WI.CodeMirrorSpringEditingController = class CodeMirrorSpringEditingController extends WI.CodeMirrorEditingController
 {
     // Public
 
     get initialValue()
     {
-        return WebInspector.Spring.fromString(this.text);
+        return WI.Spring.fromString(this.text);
     }
 
     get cssClassName()
@@ -39,8 +39,8 @@
 
     popoverWillPresent(popover)
     {
-        this._springEditor = new WebInspector.SpringEditor;
-        this._springEditor.addEventListener(WebInspector.SpringEditor.Event.SpringChanged, this._springEditorSpringChanged, this);
+        this._springEditor = new WI.SpringEditor;
+        this._springEditor.addEventListener(WI.SpringEditor.Event.SpringChanged, this._springEditorSpringChanged, this);
         popover.content = this._springEditor.element;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTextKillController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTextKillController.js
index 8cd0b73..efce2c8 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTextKillController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTextKillController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorTextKillController = class CodeMirrorTextKillController extends WebInspector.Object
+WI.CodeMirrorTextKillController = class CodeMirrorTextKillController extends WI.Object
 {
     constructor(codeMirror)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js
index 4d4fdac..dce4b96 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController extends WebInspector.Object
+WI.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController extends WI.Object
 {
     constructor(codeMirror, delegate)
     {
@@ -33,7 +33,7 @@
 
         this._codeMirror = codeMirror;
         this._delegate = delegate || null;
-        this._mode = WebInspector.CodeMirrorTokenTrackingController.Mode.None;
+        this._mode = WI.CodeMirrorTokenTrackingController.Mode.None;
 
         this._mouseOverDelayDuration = 0;
         this._mouseOutReleaseDelayDuration = 0;
@@ -82,7 +82,7 @@
         if (enabled) {
             wrapper.addEventListener("mouseenter", this);
             wrapper.addEventListener("mouseleave", this);
-            this._updateHoveredTokenInfo({left: WebInspector.mouseCoords.x, top: WebInspector.mouseCoords.y});
+            this._updateHoveredTokenInfo({left: WI.mouseCoords.x, top: WI.mouseCoords.y});
             this._startTracking();
         } else {
             wrapper.removeEventListener("mouseenter", this);
@@ -100,7 +100,7 @@
     {
         var oldMode = this._mode;
 
-        this._mode = mode || WebInspector.CodeMirrorTokenTrackingController.Mode.None;
+        this._mode = mode || WI.CodeMirrorTokenTrackingController.Mode.None;
 
         if (oldMode !== this._mode && this._tracking && this._previousTokenInfo)
             this._processNewHoveredToken(this._previousTokenInfo);
@@ -166,8 +166,8 @@
             var highlightedRange = this._codeMirrorMarkedText.find();
             if (!highlightedRange)
                 return;
-            if (WebInspector.compareCodeMirrorPositions(highlightedRange.from, range.start) === 0 &&
-                WebInspector.compareCodeMirrorPositions(highlightedRange.to, range.end) === 0)
+            if (WI.compareCodeMirrorPositions(highlightedRange.from, range.start) === 0 &&
+                WI.compareCodeMirrorPositions(highlightedRange.to, range.end) === 0)
                 return;
         }
 
@@ -261,7 +261,7 @@
     _handleCommandEnterKey(codeMirror)
     {
         const tokenInfo = this._getTokenInfoForPosition(codeMirror.getCursor("head"));
-        tokenInfo.triggeredBy = WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard;
+        tokenInfo.triggeredBy = WI.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard;
         this._processNewHoveredToken(tokenInfo);
     }
 
@@ -289,7 +289,7 @@
 
     _mouseMovedWithMarkedText(event)
     {
-        if (this._candidate && this._candidate.triggeredBy === WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard)
+        if (this._candidate && this._candidate.triggeredBy === WI.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard)
             return;
 
         var shouldRelease = !event.target.classList.contains(this._classNameForHighlightedRange);
@@ -445,14 +445,14 @@
         this._candidate = null;
 
         switch (this._mode) {
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:
+        case WI.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:
             this._candidate = this._processNonSymbolToken(tokenInfo);
             break;
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:
+        case WI.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:
+        case WI.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:
             this._candidate = this._processJavaScriptExpression(tokenInfo);
             break;
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens:
+        case WI.CodeMirrorTokenTrackingController.Mode.MarkedTokens:
             this._candidate = this._processMarkedToken(tokenInfo);
             break;
         }
@@ -533,7 +533,7 @@
             let shorthand = false;
             let mode = tokenInfo.innerMode.mode;
             let position = {line: tokenInfo.position.line, ch: tokenInfo.token.end};
-            WebInspector.walkTokens(this._codeMirror, mode, position, function(tokenType, string) {
+            WI.walkTokens(this._codeMirror, mode, position, function(tokenType, string) {
                 if (tokenType)
                     return false;
                 if (string === "(")
@@ -602,9 +602,9 @@
     }
 };
 
-WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName = "jump-to-symbol-highlight";
+WI.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName = "jump-to-symbol-highlight";
 
-WebInspector.CodeMirrorTokenTrackingController.Mode = {
+WI.CodeMirrorTokenTrackingController.Mode = {
     None: "none",
     NonSymbolTokens: "non-symbol-tokens",
     JavaScriptExpression: "javascript-expression",
@@ -612,7 +612,7 @@
     MarkedTokens: "marked-tokens"
 };
 
-WebInspector.CodeMirrorTokenTrackingController.TriggeredBy = {
+WI.CodeMirrorTokenTrackingController.TriggeredBy = {
     Keyboard: "keyboard",
     Hover: "hover"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DOMBreakpointTreeController.js b/Source/WebInspectorUI/UserInterface/Controllers/DOMBreakpointTreeController.js
index 9cc37a7..9e8aba7 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/DOMBreakpointTreeController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/DOMBreakpointTreeController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMBreakpointTreeController = class DOMBreakpointsTreeController extends WebInspector.Object
+WI.DOMBreakpointTreeController = class DOMBreakpointsTreeController extends WI.Object
 {
     constructor(treeOutline)
     {
@@ -33,34 +33,34 @@
         this._breakpointTreeElements = new Map;
         this._domNodeTreeElements = new Map;
 
-        WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange, this._domBreakpointResolvedStateDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.DOMBreakpoint.addEventListener(WI.DOMBreakpoint.Event.ResolvedStateDidChange, this._domBreakpointResolvedStateDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
-        WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded, this._domBreakpointAdded, this);
-        WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved, this._domBreakpointRemoved, this);
+        WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointAdded, this._domBreakpointAdded, this);
+        WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved, this._domBreakpointRemoved, this);
     }
 
     // Static
 
     static appendBreakpointContextMenuItems(contextMenu, domNode, allowEditing)
     {
-        console.assert(WebInspector.domDebuggerManager.supported);
+        console.assert(WI.domDebuggerManager.supported);
 
-        let subMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Break on…"));
+        let subMenu = contextMenu.appendSubMenuItem(WI.UIString("Break on…"));
 
-        let breakpoints = WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);
+        let breakpoints = WI.domDebuggerManager.domBreakpointsForNode(domNode);
         let keyValuePairs = breakpoints.map((breakpoint) => [breakpoint.type, breakpoint]);
         let breakpointsByType = new Map(keyValuePairs);
 
-        for (let type of Object.values(WebInspector.DOMBreakpoint.Type)) {
-            let label = WebInspector.DOMBreakpointTreeElement.displayNameForType(type);
+        for (let type of Object.values(WI.DOMBreakpoint.Type)) {
+            let label = WI.DOMBreakpointTreeElement.displayNameForType(type);
             let breakpoint = breakpointsByType.get(type);
 
             subMenu.appendCheckboxItem(label, function() {
                 if (breakpoint)
-                    WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);
+                    WI.domDebuggerManager.removeDOMBreakpoint(breakpoint);
                 else
-                    WebInspector.domDebuggerManager.addDOMBreakpoint(new WebInspector.DOMBreakpoint(domNode, type));
+                    WI.domDebuggerManager.addDOMBreakpoint(new WI.DOMBreakpoint(domNode, type));
             }, !!breakpoint, false);
         }
 
@@ -68,13 +68,13 @@
             contextMenu.appendSeparator();
 
             let shouldEnable = breakpoints.some((breakpoint) => breakpoint.disabled);
-            let label = shouldEnable ? WebInspector.UIString("Enable Breakpoints") : WebInspector.UIString("Disable Breakpoints");
+            let label = shouldEnable ? WI.UIString("Enable Breakpoints") : WI.UIString("Disable Breakpoints");
             contextMenu.appendItem(label, () => {
                 breakpoints.forEach((breakpoint) => breakpoint.disabled = !shouldEnable);
             });
 
-            contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), function() {
-                WebInspector.domDebuggerManager.removeDOMBreakpointsForNode(domNode);
+            contextMenu.appendItem(WI.UIString("Delete Breakpoints"), function() {
+                WI.domDebuggerManager.removeDOMBreakpointsForNode(domNode);
             });
         }
     }
@@ -83,9 +83,9 @@
 
     disconnect()
     {
-        WebInspector.DOMBreakpoint.removeEventListener(null, null, this);
-        WebInspector.Frame.removeEventListener(null, null, this);
-        WebInspector.domDebuggerManager.removeEventListener(null, null, this);
+        WI.DOMBreakpoint.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
+        WI.domDebuggerManager.removeEventListener(null, null, this);
     }
 
     // Private
@@ -97,17 +97,17 @@
         let shouldExpandParent = false;
 
         if (!parentTreeElement) {
-            let domNode = WebInspector.domTreeManager.nodeForId(nodeIdentifier);
+            let domNode = WI.domTreeManager.nodeForId(nodeIdentifier);
             console.assert(domNode, "Missing DOMNode for identifier", nodeIdentifier);
 
-            parentTreeElement = new WebInspector.DOMNodeTreeElement(domNode);
+            parentTreeElement = new WI.DOMNodeTreeElement(domNode);
             this._treeOutline.appendChild(parentTreeElement);
             this._domNodeTreeElements.set(nodeIdentifier, parentTreeElement);
 
             shouldExpandParent = true;
         }
 
-        let treeElement = new WebInspector.DOMBreakpointTreeElement(breakpoint);
+        let treeElement = new WI.DOMBreakpointTreeElement(breakpoint);
         parentTreeElement.appendChild(treeElement);
 
         if (shouldExpandParent)
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js
index 84b144a..abe48b0 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js
@@ -23,43 +23,43 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMDebuggerManager = class DOMDebuggerManager extends WebInspector.Object
+WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        this._domBreakpointsSetting = new WebInspector.Setting("dom-breakpoints", []);
+        this._domBreakpointsSetting = new WI.Setting("dom-breakpoints", []);
         this._domBreakpointURLMap = new Map;
         this._domBreakpointFrameIdentifierMap = new Map;
 
-        this._xhrBreakpointsSetting = new WebInspector.Setting("xhr-breakpoints", []);
+        this._xhrBreakpointsSetting = new WI.Setting("xhr-breakpoints", []);
         this._xhrBreakpoints = [];
-        this._allRequestsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-requests", false);
+        this._allRequestsBreakpointEnabledSetting = new WI.Setting("break-on-all-requests", false);
 
-        this._allRequestsBreakpoint = new WebInspector.XHRBreakpoint(null, null, !this._allRequestsBreakpointEnabledSetting.value);
+        this._allRequestsBreakpoint = new WI.XHRBreakpoint(null, null, !this._allRequestsBreakpointEnabledSetting.value);
 
-        WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange, this._domBreakpointDisabledStateDidChange, this);
-        WebInspector.XHRBreakpoint.addEventListener(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange, this._xhrBreakpointDisabledStateDidChange, this);
+        WI.DOMBreakpoint.addEventListener(WI.DOMBreakpoint.Event.DisabledStateDidChange, this._domBreakpointDisabledStateDidChange, this);
+        WI.XHRBreakpoint.addEventListener(WI.XHRBreakpoint.Event.DisabledStateDidChange, this._xhrBreakpointDisabledStateDidChange, this);
 
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeInserted, this._nodeInserted, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeInserted, this._nodeInserted, this);
 
-        WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
+        WI.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
         if (this.supported) {
             this._restoringBreakpoints = true;
 
             for (let cookie of this._domBreakpointsSetting.value) {
-                let breakpoint = new WebInspector.DOMBreakpoint(cookie, cookie.type, cookie.disabled);
+                let breakpoint = new WI.DOMBreakpoint(cookie, cookie.type, cookie.disabled);
                 this.addDOMBreakpoint(breakpoint);
             }
 
             for (let cookie of this._xhrBreakpointsSetting.value) {
-                let breakpoint = new WebInspector.XHRBreakpoint(cookie.type, cookie.url, cookie.disabled);
+                let breakpoint = new WI.XHRBreakpoint(cookie.type, cookie.url, cookie.disabled);
                 this.addXHRBreakpoint(breakpoint);
             }
 
@@ -82,7 +82,7 @@
 
     get domBreakpoints()
     {
-        let mainFrame = WebInspector.frameResourceManager.mainFrame;
+        let mainFrame = WI.frameResourceManager.mainFrame;
         if (!mainFrame)
             return [];
 
@@ -111,7 +111,7 @@
 
     domBreakpointsForNode(node)
     {
-        console.assert(node instanceof WebInspector.DOMNode);
+        console.assert(node instanceof WI.DOMNode);
 
         if (!node)
             return [];
@@ -126,7 +126,7 @@
 
     addDOMBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.DOMBreakpoint);
+        console.assert(breakpoint instanceof WI.DOMBreakpoint);
         if (!breakpoint || !breakpoint.url)
             return;
 
@@ -140,14 +140,14 @@
         if (breakpoint.domNodeIdentifier)
             this._resolveDOMBreakpoint(breakpoint, breakpoint.domNodeIdentifier);
 
-        this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded, {breakpoint});
+        this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.DOMBreakpointAdded, {breakpoint});
 
         this._saveDOMBreakpoints();
     }
 
     removeDOMBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.DOMBreakpoint);
+        console.assert(breakpoint instanceof WI.DOMBreakpoint);
         if (!breakpoint)
             return;
 
@@ -167,7 +167,7 @@
         if (!urlBreakpoints.length)
             this._domBreakpointURLMap.delete(breakpoint.url);
 
-        this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved, {breakpoint});
+        this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved, {breakpoint});
 
         breakpoint.domNodeIdentifier = null;
 
@@ -191,7 +191,7 @@
 
     addXHRBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.XHRBreakpoint);
+        console.assert(breakpoint instanceof WI.XHRBreakpoint);
         if (!breakpoint)
             return;
 
@@ -204,7 +204,7 @@
 
         this._xhrBreakpoints.push(breakpoint);
 
-        this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.XHRBreakpointAdded, {breakpoint});
+        this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.XHRBreakpointAdded, {breakpoint});
 
         this._resolveXHRBreakpoint(breakpoint);
         this._saveXHRBreakpoints();
@@ -212,7 +212,7 @@
 
     removeXHRBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.XHRBreakpoint);
+        console.assert(breakpoint instanceof WI.XHRBreakpoint);
         if (!breakpoint)
             return;
 
@@ -222,7 +222,7 @@
         this._xhrBreakpoints.remove(breakpoint, true);
 
         this._saveXHRBreakpoints();
-        this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.XHRBreakpointRemoved, {breakpoint});
+        this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.XHRBreakpointRemoved, {breakpoint});
 
         if (breakpoint.disabled)
             return;
@@ -238,7 +238,7 @@
     _detachDOMBreakpoint(breakpoint)
     {
         let nodeIdentifier = breakpoint.domNodeIdentifier;
-        let node = WebInspector.domTreeManager.nodeForId(nodeIdentifier);
+        let node = WI.domTreeManager.nodeForId(nodeIdentifier);
         console.assert(node, "Missing DOM node for breakpoint.", breakpoint);
         if (!node)
             return;
@@ -281,7 +281,7 @@
 
     _speculativelyResolveBreakpoints()
     {
-        let mainFrame = WebInspector.frameResourceManager.mainFrame;
+        let mainFrame = WI.frameResourceManager.mainFrame;
         if (!mainFrame)
             return;
 
@@ -291,7 +291,7 @@
                 if (breakpoint.domNodeIdentifier)
                     continue;
 
-                WebInspector.domTreeManager.pushNodeByPathToFrontend(breakpoint.path, (nodeIdentifier) => {
+                WI.domTreeManager.pushNodeByPathToFrontend(breakpoint.path, (nodeIdentifier) => {
                     if (!nodeIdentifier)
                         return;
 
@@ -306,7 +306,7 @@
 
     _resolveDOMBreakpoint(breakpoint, nodeIdentifier)
     {
-        let node = WebInspector.domTreeManager.nodeForId(nodeIdentifier);
+        let node = WI.domTreeManager.nodeForId(nodeIdentifier);
         console.assert(node, "Missing DOM node for nodeIdentifier.", nodeIdentifier);
         if (!node)
             return;
@@ -361,7 +361,7 @@
         if (breakpoint.disabled)
             DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url, breakpointUpdated);
         else {
-            let isRegex = breakpoint.type === WebInspector.XHRBreakpoint.Type.RegularExpression;
+            let isRegex = breakpoint.type === WI.XHRBreakpoint.Type.RegularExpression;
             DOMDebuggerAgent.setXHRBreakpoint(breakpoint.url, isRegex, breakpointUpdated);
         }
     }
@@ -372,7 +372,7 @@
             return;
 
         this._updateXHRBreakpoint(breakpoint, () => {
-            breakpoint.dispatchEventToListeners(WebInspector.XHRBreakpoint.Event.ResolvedStateDidChange);
+            breakpoint.dispatchEventToListeners(WI.XHRBreakpoint.Event.ResolvedStateDidChange);
         });
     }
 
@@ -485,7 +485,7 @@
     }
 };
 
-WebInspector.DOMDebuggerManager.Event = {
+WI.DOMDebuggerManager.Event = {
     DOMBreakpointAdded: "dom-debugger-manager-dom-breakpoint-added",
     DOMBreakpointRemoved: "dom-debugger-manager-dom-breakpoint-removed",
     XHRBreakpointAdded: "dom-debugger-manager-xhr-breakpoint-added",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js
index 64500e9..e950a19 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js
@@ -30,7 +30,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeManager = class DOMTreeManager extends WebInspector.Object
+WI.DOMTreeManager = class DOMTreeManager extends WI.Object
 {
     constructor()
     {
@@ -44,7 +44,7 @@
         this._restoreSelectedNodeIsAllowed = true;
         this._loadNodeAttributesTimeout = 0;
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     }
 
     // Static
@@ -137,8 +137,8 @@
             return;
 
         node._setAttribute(name, value);
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.AttributeModified, {node, name});
-        node.dispatchEventToListeners(WebInspector.DOMNode.Event.AttributeModified, {name});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.AttributeModified, {node, name});
+        node.dispatchEventToListeners(WI.DOMNode.Event.AttributeModified, {name});
     }
 
     _attributeRemoved(nodeId, name)
@@ -148,8 +148,8 @@
             return;
 
         node._removeAttribute(name);
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.AttributeRemoved, {node, name});
-        node.dispatchEventToListeners(WebInspector.DOMNode.Event.AttributeRemoved, {name});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.AttributeRemoved, {node, name});
+        node.dispatchEventToListeners(WI.DOMNode.Event.AttributeRemoved, {name});
     }
 
     _inlineStyleInvalidated(nodeIds)
@@ -172,8 +172,8 @@
             var node = this._idToDOMNode[nodeId];
             if (node) {
                 node._setAttributesPayload(attributes);
-                this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.AttributeModified, {node, name: "style"});
-                node.dispatchEventToListeners(WebInspector.DOMNode.Event.AttributeModified, {name: "style"});
+                this.dispatchEventToListeners(WI.DOMTreeManager.Event.AttributeModified, {node, name: "style"});
+                node.dispatchEventToListeners(WI.DOMNode.Event.AttributeModified, {name: "style"});
             }
         }
 
@@ -190,7 +190,7 @@
     {
         var node = this._idToDOMNode[nodeId];
         node._nodeValue = newValue;
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.CharacterDataModified, {node});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.CharacterDataModified, {node});
     }
 
     nodeForId(nodeId)
@@ -209,18 +209,18 @@
 
         let newDocument = null;
         if (payload && "nodeId" in payload)
-            newDocument = new WebInspector.DOMNode(this, null, false, payload);
+            newDocument = new WI.DOMNode(this, null, false, payload);
 
         if (this._document === newDocument)
             return;
 
         this._document = newDocument;
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.DocumentUpdated, {document: this._document});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.DocumentUpdated, {document: this._document});
     }
 
     _setDetachedRoot(payload)
     {
-        new WebInspector.DOMNode(this, null, false, payload);
+        new WI.DOMNode(this, null, false, payload);
     }
 
     _setChildNodes(parentId, payloads)
@@ -238,7 +238,7 @@
     {
         var node = this._idToDOMNode[nodeId];
         node.childNodeCount = newValue;
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ChildNodeCountUpdated, node);
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.ChildNodeCountUpdated, node);
     }
 
     _childNodeInserted(parentId, prevId, payload)
@@ -247,7 +247,7 @@
         var prev = this._idToDOMNode[prevId];
         var node = parent._insertChild(prev, payload);
         this._idToDOMNode[node.id] = node;
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeInserted, {node, parent});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.NodeInserted, {node, parent});
     }
 
     _childNodeRemoved(parentId, nodeId)
@@ -256,14 +256,14 @@
         var node = this._idToDOMNode[nodeId];
         parent._removeChild(node);
         this._unbind(node);
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeRemoved, {node, parent});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.NodeRemoved, {node, parent});
     }
 
     _customElementStateChanged(elementId, newState)
     {
         const node = this._idToDOMNode[elementId];
         node._customElementState = newState;
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.CustomElementStateChanged, {node});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.CustomElementStateChanged, {node});
     }
 
     _pseudoElementAdded(parentId, pseudoElement)
@@ -272,12 +272,12 @@
         if (!parent)
             return;
 
-        var node = new WebInspector.DOMNode(this, parent.ownerDocument, false, pseudoElement);
+        var node = new WI.DOMNode(this, parent.ownerDocument, false, pseudoElement);
         node.parentNode = parent;
         this._idToDOMNode[node.id] = node;
         console.assert(!parent.pseudoElements().get(node.pseudoType()));
         parent.pseudoElements().set(node.pseudoType(), node);
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeInserted, {node, parent});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.NodeInserted, {node, parent});
     }
 
     _pseudoElementRemoved(parentId, pseudoElementId)
@@ -294,7 +294,7 @@
 
         parent._removeChild(pseudoElement);
         this._unbind(pseudoElement);
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeRemoved, {node: pseudoElement, parent});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.NodeRemoved, {node: pseudoElement, parent});
     }
 
     _unbind(node)
@@ -327,10 +327,10 @@
         if (!node || !node.ownerDocument)
             return;
 
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, {node});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.DOMNodeWasInspected, {node});
 
         this._inspectModeEnabled = false;
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.InspectModeStateChanged);
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.InspectModeStateChanged);
     }
 
     inspectNodeObject(remoteObject)
@@ -349,12 +349,12 @@
 
             // Re-resolve the node in the console's object group when adding to the console.
             let domNode = this.nodeForId(nodeId);
-            WebInspector.RemoteObject.resolveNode(domNode, WebInspector.RuntimeManager.ConsoleObjectGroup, function(remoteObject) {
+            WI.RemoteObject.resolveNode(domNode, WI.RuntimeManager.ConsoleObjectGroup, function(remoteObject) {
                 if (!remoteObject)
                     return;
                 let specialLogStyles = true;
                 let shouldRevealConsole = false;
-                WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(WebInspector.UIString("Selected Element"), remoteObject, specialLogStyles, shouldRevealConsole);
+                WI.consoleLogViewController.appendImmediateExecutionWithResult(WI.UIString("Selected Element"), remoteObject, specialLogStyles, shouldRevealConsole);
             });
         }
 
@@ -490,7 +490,7 @@
 
         DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), (error) => {
             this._inspectModeEnabled = error ? false : enabled;
-            this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.InspectModeStateChanged);
+            this.dispatchEventToListeners(WI.DOMTreeManager.Event.InspectModeStateChanged);
         });
     }
 
@@ -516,7 +516,7 @@
     _createContentFlowFromPayload(flowPayload)
     {
         // FIXME: Collect the regions from the payload.
-        var flow = new WebInspector.ContentFlow(flowPayload.documentNodeId, flowPayload.name, flowPayload.overset, flowPayload.content.map(this.nodeForId.bind(this)));
+        var flow = new WI.ContentFlow(flowPayload.documentNodeId, flowPayload.name, flowPayload.overset, flowPayload.content.map(this.nodeForId.bind(this)));
 
         for (var contentNode of flow.contentNodes) {
             console.assert(!this._contentNodesToFlowsMap.has(contentNode.id));
@@ -545,7 +545,7 @@
             var contentFlows = [];
             for (var i = 0; i < flows.length; ++i) {
                 var flowPayload = flows[i];
-                var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);
+                var flowKey = WI.DOMTreeManager._flowPayloadHashKey(flowPayload);
                 var contentFlow = this._flows.get(flowKey);
                 if (contentFlow)
                     this._updateContentFlowFromPayload(contentFlow, flowPayload);
@@ -555,7 +555,7 @@
                 }
                 contentFlows.push(contentFlow);
             }
-            this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated, {documentNodeIdentifier, flows: contentFlows});
+            this.dispatchEventToListeners(WI.DOMTreeManager.Event.ContentFlowListWasUpdated, {documentNodeIdentifier, flows: contentFlows});
         }
 
         if (window.CSSAgent)
@@ -564,16 +564,16 @@
 
     namedFlowCreated(flowPayload)
     {
-        var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);
+        var flowKey = WI.DOMTreeManager._flowPayloadHashKey(flowPayload);
         console.assert(!this._flows.has(flowKey));
         var contentFlow = this._createContentFlowFromPayload(flowPayload);
         this._flows.set(flowKey, contentFlow);
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded, {flow: contentFlow});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.ContentFlowWasAdded, {flow: contentFlow});
     }
 
     namedFlowRemoved(documentNodeIdentifier, flowName)
     {
-        var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName});
+        var flowKey = WI.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName});
         var contentFlow = this._flows.get(flowKey);
         console.assert(contentFlow);
         this._flows.delete(flowKey);
@@ -582,12 +582,12 @@
         for (var contentNode of contentFlow.contentNodes)
             this._contentNodesToFlowsMap.delete(contentNode.id);
 
-        this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow});
+        this.dispatchEventToListeners(WI.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow});
     }
 
     _sendNamedFlowUpdateEvents(flowPayload)
     {
-        var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);
+        var flowKey = WI.DOMTreeManager._flowPayloadHashKey(flowPayload);
         console.assert(this._flows.has(flowKey));
         this._updateContentFlowFromPayload(this._flows.get(flowKey), flowPayload);
     }
@@ -599,7 +599,7 @@
 
     registeredNamedFlowContentElement(documentNodeIdentifier, flowName, contentNodeId, nextContentElementNodeId)
     {
-        var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName});
+        var flowKey = WI.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName});
         console.assert(this._flows.has(flowKey));
         console.assert(!this._contentNodesToFlowsMap.has(contentNodeId));
 
@@ -628,7 +628,7 @@
         console.assert(this._contentNodesToFlowsMap.has(contentNodeId));
 
         var flow = this._contentNodesToFlowsMap.get(contentNodeId);
-        console.assert(flow.id === WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName}));
+        console.assert(flow.id === WI.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName}));
 
         this._contentNodesToFlowsMap.delete(contentNodeId);
         flow.removeContentNode(this.nodeForId(contentNodeId));
@@ -660,7 +660,7 @@
                 callback(lastError, nodes);
         }
 
-        WebInspector.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId, function(error, properties) {
+        WI.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId, function(error, properties) {
             if (error) {
                 callback(error);
                 return;
@@ -714,7 +714,7 @@
             // The backend function can never return null.
             console.assert(remoteObject.type === "object");
             console.assert(remoteObject.objectId);
-            WebInspector.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId, remoteObjectPropertiesAvailable.bind(this));
+            WI.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId, remoteObjectPropertiesAvailable.bind(this));
         }
 
         function remoteObjectPropertiesAvailable(error, properties) {
@@ -732,14 +732,14 @@
             var regionFlowNameProperty = properties.get("regionFlowName");
             if (regionFlowNameProperty && regionFlowNameProperty.value && regionFlowNameProperty.value.value) {
                 console.assert(regionFlowNameProperty.value.type === "string");
-                var regionFlowKey = WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: domNode.ownerDocument.id, name: regionFlowNameProperty.value.value});
+                var regionFlowKey = WI.DOMTreeManager._flowPayloadHashKey({documentNodeId: domNode.ownerDocument.id, name: regionFlowNameProperty.value.value});
                 result.regionFlow = this._flows.get(regionFlowKey);
             }
 
             var contentFlowNameProperty = properties.get("contentFlowName");
             if (contentFlowNameProperty && contentFlowNameProperty.value && contentFlowNameProperty.value.value) {
                 console.assert(contentFlowNameProperty.value.type === "string");
-                var contentFlowKey = WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: domNode.ownerDocument.id, name: contentFlowNameProperty.value.value});
+                var contentFlowKey = WI.DOMTreeManager._flowPayloadHashKey({documentNodeId: domNode.ownerDocument.id, name: contentFlowNameProperty.value.value});
                 result.contentFlow = this._flows.get(contentFlowKey);
             }
 
@@ -806,7 +806,7 @@
     }
 };
 
-WebInspector.DOMTreeManager.Event = {
+WI.DOMTreeManager.Event = {
     AttributeModified: "dom-tree-manager-attribute-modified",
     AttributeRemoved: "dom-tree-manager-attribute-removed",
     CharacterDataModified: "dom-tree-manager-character-data-modified",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js
index 332c34f..0cd63da 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DashboardManager = class DashboardManager extends WebInspector.Object
+WI.DashboardManager = class DashboardManager extends WI.Object
 {
     constructor()
     {
         super();
 
         this._dashboards = {};
-        this._dashboards.default = new WebInspector.DefaultDashboard;
-        this._dashboards.debugger = new WebInspector.DebuggerDashboard;
+        this._dashboards.default = new WI.DefaultDashboard;
+        this._dashboards.debugger = new WI.DebuggerDashboard;
     }
 
     get dashboards()
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
index a80c898..55427fa 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
+WI.DebuggerManager = class DebuggerManager extends WI.Object
 {
     constructor()
     {
@@ -31,37 +31,37 @@
 
         DebuggerAgent.enable();
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.DebugUIEnabledDidChange, this._debugUIEnabledDidChange, this);
+        WI.notifications.addEventListener(WI.Notification.DebugUIEnabledDidChange, this._debugUIEnabledDidChange, this);
 
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointDisabledStateDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ConditionDidChange, this._breakpointEditablePropertyDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.IgnoreCountDidChange, this._breakpointEditablePropertyDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointEditablePropertyDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisabledStateDidChange, this._breakpointDisabledStateDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ConditionDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.IgnoreCountDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.AutoContinueDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ActionsDidChange, this._breakpointEditablePropertyDidChange, this);
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
 
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
-        this._breakpointsSetting = new WebInspector.Setting("breakpoints", []);
-        this._breakpointsEnabledSetting = new WebInspector.Setting("breakpoints-enabled", true);
-        this._allExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-exceptions", false);
-        this._allUncaughtExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-uncaught-exceptions", false);
-        this._assertionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-assertions", false);
-        this._asyncStackTraceDepthSetting = new WebInspector.Setting("async-stack-trace-depth", 200);
+        this._breakpointsSetting = new WI.Setting("breakpoints", []);
+        this._breakpointsEnabledSetting = new WI.Setting("breakpoints-enabled", true);
+        this._allExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-all-exceptions", false);
+        this._allUncaughtExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-all-uncaught-exceptions", false);
+        this._assertionsBreakpointEnabledSetting = new WI.Setting("break-on-assertions", false);
+        this._asyncStackTraceDepthSetting = new WI.Setting("async-stack-trace-depth", 200);
 
-        let specialBreakpointLocation = new WebInspector.SourceCodeLocation(null, Infinity, Infinity);
+        let specialBreakpointLocation = new WI.SourceCodeLocation(null, Infinity, Infinity);
 
-        this._allExceptionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._allExceptionsBreakpointEnabledSetting.value);
+        this._allExceptionsBreakpoint = new WI.Breakpoint(specialBreakpointLocation, !this._allExceptionsBreakpointEnabledSetting.value);
         this._allExceptionsBreakpoint.resolved = true;
 
-        this._allUncaughtExceptionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._allUncaughtExceptionsBreakpointEnabledSetting.value);
+        this._allUncaughtExceptionsBreakpoint = new WI.Breakpoint(specialBreakpointLocation, !this._allUncaughtExceptionsBreakpointEnabledSetting.value);
 
-        this._assertionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._assertionsBreakpointEnabledSetting.value);
+        this._assertionsBreakpoint = new WI.Breakpoint(specialBreakpointLocation, !this._assertionsBreakpointEnabledSetting.value);
         this._assertionsBreakpoint.resolved = true;
 
         this._breakpoints = [];
@@ -78,11 +78,11 @@
 
         this._internalWebKitScripts = [];
         this._targetDebuggerDataMap = new Map;
-        this._targetDebuggerDataMap.set(WebInspector.mainTarget, new WebInspector.DebuggerData(WebInspector.mainTarget));
+        this._targetDebuggerDataMap.set(WI.mainTarget, new WI.DebuggerData(WI.mainTarget));
 
         // Restore the correct breakpoints enabled setting if Web Inspector had
         // previously been left in a state where breakpoints were temporarily disabled.
-        this._temporarilyDisabledBreakpointsRestoreSetting = new WebInspector.Setting("temporarily-disabled-breakpoints-restore", null);
+        this._temporarilyDisabledBreakpointsRestoreSetting = new WI.Setting("temporarily-disabled-breakpoints-restore", null);
         if (this._temporarilyDisabledBreakpointsRestoreSetting.value !== null) {
             this._breakpointsEnabledSetting.value = this._temporarilyDisabledBreakpointsRestoreSetting.value;
             this._temporarilyDisabledBreakpointsRestoreSetting.value = null;
@@ -104,7 +104,7 @@
         function restoreBreakpointsSoon() {
             this._restoringBreakpoints = true;
             for (let cookie of this._breakpointsSetting.value)
-                this.addBreakpoint(new WebInspector.Breakpoint(cookie));
+                this.addBreakpoint(new WI.Breakpoint(cookie));
             this._restoringBreakpoints = false;
         }
 
@@ -137,7 +137,7 @@
 
         this._activeCallFrame = callFrame || null;
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ActiveCallFrameDidChange);
     }
 
     dataForTarget(target)
@@ -146,7 +146,7 @@
         if (targetData)
             return targetData;
 
-        targetData = new WebInspector.DebuggerData(target);
+        targetData = new WI.DebuggerData(target);
         this._targetDebuggerDataMap.set(target, targetData);
         return targetData;
     }
@@ -178,9 +178,9 @@
 
     breakpointsForSourceCode(sourceCode)
     {
-        console.assert(sourceCode instanceof WebInspector.Resource || sourceCode instanceof WebInspector.Script);
+        console.assert(sourceCode instanceof WI.Resource || sourceCode instanceof WI.Script);
 
-        if (sourceCode instanceof WebInspector.SourceMapResource) {
+        if (sourceCode instanceof WI.SourceMapResource) {
             let originalSourceCodeBreakpoints = this.breakpointsForSourceCode(sourceCode.sourceMap.originalSourceCode);
             return originalSourceCodeBreakpoints.filter(function(breakpoint) {
                 return breakpoint.sourceCodeLocation.displaySourceCode === sourceCode;
@@ -193,7 +193,7 @@
             return contentIdentifierBreakpoints;
         }
 
-        if (sourceCode instanceof WebInspector.Script) {
+        if (sourceCode instanceof WI.Script) {
             let scriptIdentifierBreakpoints = this._breakpointScriptIdentifierMap.get(sourceCode.id);
             if (scriptIdentifierBreakpoints) {
                 this._associateBreakpointsWithSourceCode(scriptIdentifierBreakpoints, sourceCode);
@@ -206,7 +206,7 @@
 
     breakpointForSourceCodeLocation(sourceCodeLocation)
     {
-        console.assert(sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
+        console.assert(sourceCodeLocation instanceof WI.SourceCodeLocation);
 
         for (let breakpoint of this.breakpointsForSourceCode(sourceCodeLocation.sourceCode)) {
             if (breakpoint.sourceCodeLocation.isEqual(sourceCodeLocation))
@@ -246,12 +246,12 @@
 
         this._updateBreakOnExceptionsState();
 
-        for (let target of WebInspector.targets) {
+        for (let target of WI.targets) {
             target.DebuggerAgent.setBreakpointsActive(enabled);
             target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
         }
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointsEnabledDidChange);
     }
 
     get breakpointsDisabledTemporarily()
@@ -261,14 +261,14 @@
 
     scriptForIdentifier(id, target)
     {
-        console.assert(target instanceof WebInspector.Target);
+        console.assert(target instanceof WI.Target);
         return this.dataForTarget(target).scriptForIdentifier(id);
     }
 
     scriptsForURL(url, target)
     {
         // FIXME: This may not be safe. A Resource's URL may differ from a Script's URL.
-        console.assert(target instanceof WebInspector.Target);
+        console.assert(target instanceof WI.Target);
         return this.dataForTarget(target).scriptsForURL(url);
     }
 
@@ -285,7 +285,7 @@
             for (let script of targetData.scripts) {
                 if (script.resource)
                     continue;
-                if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
+                if (!WI.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
                     continue;
                 knownScripts.push(script);
             }
@@ -306,7 +306,7 @@
 
         this._asyncStackTraceDepthSetting.value = x;
 
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);
     }
 
@@ -315,12 +315,12 @@
         if (this.paused)
             return Promise.resolve();
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.WaitingToPause);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.WaitingToPause);
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Paused, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.Paused, resolve);
         });
 
         let promises = [];
@@ -335,10 +335,10 @@
         if (!this.paused)
             return Promise.resolve();
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Resumed, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.Resumed, resolve);
         });
 
         let promises = [];
@@ -353,10 +353,10 @@
         if (!this.paused)
             return Promise.reject(new Error("Cannot step over because debugger is not paused."));
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
         let protocolResult = this._activeCallFrame.target.DebuggerAgent.stepOver()
@@ -374,10 +374,10 @@
         if (!this.paused)
             return Promise.reject(new Error("Cannot step into because debugger is not paused."));
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
         let protocolResult = this._activeCallFrame.target.DebuggerAgent.stepInto()
@@ -395,10 +395,10 @@
         if (!this.paused)
             return Promise.reject(new Error("Cannot step out because debugger is not paused."));
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
         let protocolResult = this._activeCallFrame.target.DebuggerAgent.stepOut()
@@ -423,7 +423,7 @@
 
     addBreakpoint(breakpoint, shouldSpeculativelyResolve)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
         if (!breakpoint)
             return;
 
@@ -457,12 +457,12 @@
 
         this._saveBreakpoints();
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded, {breakpoint});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointAdded, {breakpoint});
     }
 
     removeBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
         if (!breakpoint)
             return;
 
@@ -499,7 +499,7 @@
 
         this._saveBreakpoints();
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
     }
 
     nextBreakpointActionIdentifier()
@@ -534,11 +534,11 @@
         this._restoringBreakpoints = false;
     }
 
-    // Protected (Called from WebInspector.DebuggerObserver)
+    // Protected (Called from WI.DebuggerObserver)
 
     breakpointResolved(target, breakpointIdentifier, location)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         let breakpoint = this._breakpointIdMap.get(breakpointIdentifier);
         console.assert(breakpoint);
@@ -557,11 +557,11 @@
 
     reset()
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         let wasPaused = this.paused;
 
-        WebInspector.Script.resetUniqueDisplayNameNumbers();
+        WI.Script.resetUniqueDisplayNameNumbers();
 
         this._internalWebKitScripts = [];
         this._targetDebuggerDataMap.clear();
@@ -578,15 +578,15 @@
 
         this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptsCleared);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ScriptsCleared);
 
         if (wasPaused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Resumed);
     }
 
     debuggerDidPause(target, callFramesPayload, reason, data, asyncStackTracePayload)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         if (this._delayedResumeTimeout) {
             clearTimeout(this._delayedResumeTimeout);
@@ -610,11 +610,11 @@
                 continue;
 
             // Exclude the case where the call frame is in the inspector code.
-            if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCodeLocation.sourceCode.sourceURL))
+            if (!WI.isDebugUIEnabled() && isWebKitInternalScript(sourceCodeLocation.sourceCode.sourceURL))
                 continue;
 
             let scopeChain = this._scopeChainFromPayload(target, callFramePayload.scopeChain);
-            let callFrame = WebInspector.CallFrame.fromDebuggerPayload(target, callFramePayload, scopeChain, sourceCodeLocation);
+            let callFrame = WI.CallFrame.fromDebuggerPayload(target, callFramePayload, scopeChain, sourceCodeLocation);
             callFrames.push(callFrame);
         }
 
@@ -633,7 +633,7 @@
             return;
         }
 
-        let asyncStackTrace = WebInspector.StackTrace.fromPayload(target, asyncStackTracePayload);
+        let asyncStackTrace = WI.StackTrace.fromPayload(target, asyncStackTracePayload);
         targetData.updateForPause(callFrames, pauseReason, pauseData, asyncStackTrace);
 
         // Pause other targets because at least one target has paused.
@@ -650,17 +650,17 @@
         }
 
         if (!wasPaused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Paused);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Paused);
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange, {target});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.CallFramesDidChange, {target});
 
         if (activeCallFrameDidChange)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.ActiveCallFrameDidChange);
     }
 
     debuggerDidResume(target)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         // COMPATIBILITY (iOS 10): Debugger.resumed event was ambiguous. When stepping
         // we would receive a Debugger.resumed and we would not know if it really meant
@@ -678,14 +678,14 @@
 
     playBreakpointActionSound(breakpointActionIdentifier)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         InspectorFrontendHost.beep();
     }
 
     scriptDidParse(target, scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         // Don't add the script again if it is already known.
         let targetData = this.dataForTarget(target);
@@ -699,16 +699,16 @@
             return;
         }
 
-        if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceURL))
+        if (!WI.isDebugUIEnabled() && isWebKitInternalScript(sourceURL))
             return;
 
-        let range = new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
-        let sourceType = isModule ? WebInspector.Script.SourceType.Module : WebInspector.Script.SourceType.Program;
-        let script = new WebInspector.Script(target, scriptIdentifier, range, url, sourceType, isContentScript, sourceURL, sourceMapURL);
+        let range = new WI.TextRange(startLine, startColumn, endLine, endColumn);
+        let sourceType = isModule ? WI.Script.SourceType.Module : WI.Script.SourceType.Program;
+        let script = new WI.Script(target, scriptIdentifier, range, url, sourceType, isContentScript, sourceURL, sourceMapURL);
 
         targetData.addScript(script);
 
-        if (target !== WebInspector.mainTarget && !target.mainResource) {
+        if (target !== WI.mainTarget && !target.mainResource) {
             // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
             // We make the main resource of a WorkerTarget the Script instead of the Resource
             // because the frontend may not be informed of the Resource. We should guarantee
@@ -722,7 +722,7 @@
 
         if (isWebKitInternalScript(script.sourceURL)) {
             this._internalWebKitScripts.push(script);
-            if (!WebInspector.isDebugUIEnabled())
+            if (!WI.isDebugUIEnabled())
                 return;
         }
 
@@ -730,9 +730,9 @@
         if (isWebInspectorConsoleEvaluationScript(script.sourceURL))
             return;
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptAdded, {script});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ScriptAdded, {script});
 
-        if (target !== WebInspector.mainTarget && !script.isMainResource() && !script.resource)
+        if (target !== WI.mainTarget && !script.isMainResource() && !script.resource)
             target.addScript(script);
     }
 
@@ -761,40 +761,40 @@
         var type = null;
         switch (payload.type) {
         case DebuggerAgent.ScopeType.Global:
-            type = WebInspector.ScopeChainNode.Type.Global;
+            type = WI.ScopeChainNode.Type.Global;
             break;
         case DebuggerAgent.ScopeType.With:
-            type = WebInspector.ScopeChainNode.Type.With;
+            type = WI.ScopeChainNode.Type.With;
             break;
         case DebuggerAgent.ScopeType.Closure:
-            type = WebInspector.ScopeChainNode.Type.Closure;
+            type = WI.ScopeChainNode.Type.Closure;
             break;
         case DebuggerAgent.ScopeType.Catch:
-            type = WebInspector.ScopeChainNode.Type.Catch;
+            type = WI.ScopeChainNode.Type.Catch;
             break;
         case DebuggerAgent.ScopeType.FunctionName:
-            type = WebInspector.ScopeChainNode.Type.FunctionName;
+            type = WI.ScopeChainNode.Type.FunctionName;
             break;
         case DebuggerAgent.ScopeType.NestedLexical:
-            type = WebInspector.ScopeChainNode.Type.Block;
+            type = WI.ScopeChainNode.Type.Block;
             break;
         case DebuggerAgent.ScopeType.GlobalLexicalEnvironment:
-            type = WebInspector.ScopeChainNode.Type.GlobalLexicalEnvironment;
+            type = WI.ScopeChainNode.Type.GlobalLexicalEnvironment;
             break;
 
         // COMPATIBILITY (iOS 9): Debugger.ScopeType.Local used to be provided by the backend.
         // Newer backends no longer send this enum value, it should be computed by the frontend.
         // Map this to "Closure" type. The frontend can recalculate this when needed.
         case DebuggerAgent.ScopeType.Local:
-            type = WebInspector.ScopeChainNode.Type.Closure;
+            type = WI.ScopeChainNode.Type.Closure;
             break;
 
         default:
             console.error("Unknown type: " + payload.type);
         }
 
-        let object = WebInspector.RemoteObject.fromPayload(payload.object, target);
-        return new WebInspector.ScopeChainNode(type, [object], payload.name, payload.location, payload.empty);
+        let object = WI.RemoteObject.fromPayload(payload.object, target);
+        return new WI.ScopeChainNode(type, [object], payload.name, payload.location, payload.empty);
     }
 
     _pauseReasonFromPayload(payload)
@@ -802,36 +802,36 @@
         // FIXME: Handle other backend pause reasons.
         switch (payload) {
         case DebuggerAgent.PausedReason.Assert:
-            return WebInspector.DebuggerManager.PauseReason.Assertion;
+            return WI.DebuggerManager.PauseReason.Assertion;
         case DebuggerAgent.PausedReason.Breakpoint:
-            return WebInspector.DebuggerManager.PauseReason.Breakpoint;
+            return WI.DebuggerManager.PauseReason.Breakpoint;
         case DebuggerAgent.PausedReason.CSPViolation:
-            return WebInspector.DebuggerManager.PauseReason.CSPViolation;
+            return WI.DebuggerManager.PauseReason.CSPViolation;
         case DebuggerAgent.PausedReason.DOM:
-            return WebInspector.DebuggerManager.PauseReason.DOM;
+            return WI.DebuggerManager.PauseReason.DOM;
         case DebuggerAgent.PausedReason.DebuggerStatement:
-            return WebInspector.DebuggerManager.PauseReason.DebuggerStatement;
+            return WI.DebuggerManager.PauseReason.DebuggerStatement;
         case DebuggerAgent.PausedReason.Exception:
-            return WebInspector.DebuggerManager.PauseReason.Exception;
+            return WI.DebuggerManager.PauseReason.Exception;
         case DebuggerAgent.PausedReason.PauseOnNextStatement:
-            return WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement;
+            return WI.DebuggerManager.PauseReason.PauseOnNextStatement;
         case DebuggerAgent.PausedReason.XHR:
-            return WebInspector.DebuggerManager.PauseReason.XHR;
+            return WI.DebuggerManager.PauseReason.XHR;
         default:
-            return WebInspector.DebuggerManager.PauseReason.Other;
+            return WI.DebuggerManager.PauseReason.Other;
         }
     }
 
     _debuggerBreakpointActionType(type)
     {
         switch (type) {
-        case WebInspector.BreakpointAction.Type.Log:
+        case WI.BreakpointAction.Type.Log:
             return DebuggerAgent.BreakpointActionType.Log;
-        case WebInspector.BreakpointAction.Type.Evaluate:
+        case WI.BreakpointAction.Type.Evaluate:
             return DebuggerAgent.BreakpointActionType.Evaluate;
-        case WebInspector.BreakpointAction.Type.Sound:
+        case WI.BreakpointAction.Type.Sound:
             return DebuggerAgent.BreakpointActionType.Sound;
-        case WebInspector.BreakpointAction.Type.Probe:
+        case WI.BreakpointAction.Type.Probe:
             return DebuggerAgent.BreakpointActionType.Probe;
         default:
             console.assert(false);
@@ -847,13 +847,13 @@
         let invalidActions = [];
 
         for (let action of options.actions) {
-            if (action.type !== WebInspector.BreakpointAction.Type.Log)
+            if (action.type !== WI.BreakpointAction.Type.Log)
                 continue;
 
             if (!templatePlaceholderRegex.test(action.data))
                 continue;
 
-            let lexer = new WebInspector.BreakpointLogMessageLexer;
+            let lexer = new WI.BreakpointLogMessageLexer;
             let tokens = lexer.tokenize(action.data);
             if (!tokens) {
                 invalidActions.push(action);
@@ -861,15 +861,15 @@
             }
 
             let templateLiteral = tokens.reduce((text, token) => {
-                if (token.type === WebInspector.BreakpointLogMessageLexer.TokenType.PlainText)
+                if (token.type === WI.BreakpointLogMessageLexer.TokenType.PlainText)
                     return text + token.data.escapeCharacters("`\\");
-                if (token.type === WebInspector.BreakpointLogMessageLexer.TokenType.Expression)
+                if (token.type === WI.BreakpointLogMessageLexer.TokenType.Expression)
                     return text + "${" + token.data + "}";
                 return text;
             }, "");
 
             action.data = "console.log(`" + templateLiteral + "`)";
-            action.type = WebInspector.BreakpointAction.Type.Evaluate;
+            action.type = WI.BreakpointAction.Type.Evaluate;
         }
 
         const onlyFirst = true;
@@ -933,7 +933,7 @@
         // COMPATIBILITY (iOS 7): iOS 7 and earlier, DebuggerAgent.setBreakpoint* took a "condition" string argument.
         // This has been replaced with an "options" BreakpointOptions object.
         if (breakpoint.contentIdentifier) {
-            let targets = specificTarget ? [specificTarget] : WebInspector.targets;
+            let targets = specificTarget ? [specificTarget] : WI.targets;
             for (let target of targets) {
                 target.DebuggerAgent.setBreakpointByUrl.invoke({
                     lineNumber: breakpoint.sourceCodeLocation.lineNumber,
@@ -976,7 +976,7 @@
         }
 
         if (breakpoint.contentIdentifier) {
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.removeBreakpoint(breakpoint.identifier, didRemoveBreakpoint.bind(this));
         } else if (breakpoint.scriptIdentifier) {
             let target = breakpoint.target;
@@ -1001,7 +1001,7 @@
             // Add the breakpoint at its new lineNumber and get a new id.
             this._setBreakpoint(breakpoint);
 
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointMoved, {breakpoint});
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointMoved, {breakpoint});
         }
     }
 
@@ -1015,7 +1015,7 @@
                 this.breakpointsEnabled = true;
             this._allExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
             this._updateBreakOnExceptionsState();
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
             return;
         }
@@ -1025,7 +1025,7 @@
                 this.breakpointsEnabled = true;
             this._allUncaughtExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
             this._updateBreakOnExceptionsState();
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
             return;
         }
@@ -1034,7 +1034,7 @@
             if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
                 this.breakpointsEnabled = true;
             this._assertionsBreakpointEnabledSetting.value = !breakpoint.disabled;
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);
             return;
         }
@@ -1110,7 +1110,7 @@
         this._targetDebuggerDataMap.delete(event.data.target);
 
         if (!this.paused && wasPaused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Resumed);
     }
 
     _mainResourceDidChange(event)
@@ -1118,7 +1118,7 @@
         if (!event.target.isMainFrame())
             return;
 
-        this._didResumeInternal(WebInspector.mainTarget);
+        this._didResumeInternal(WI.mainTarget);
     }
 
     _didResumeInternal(target)
@@ -1140,12 +1140,12 @@
         this.dataForTarget(target).updateForResume();
 
         if (!this.paused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Resumed);
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange, {target});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.CallFramesDidChange, {target});
 
         if (activeCallFrameDidChange)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.ActiveCallFrameDidChange);
     }
 
     _updateBreakOnExceptionsState()
@@ -1201,13 +1201,13 @@
 
     _debugUIEnabledDidChange()
     {
-        let eventType = WebInspector.isDebugUIEnabled() ? WebInspector.DebuggerManager.Event.ScriptAdded : WebInspector.DebuggerManager.Event.ScriptRemoved;
+        let eventType = WI.isDebugUIEnabled() ? WI.DebuggerManager.Event.ScriptAdded : WI.DebuggerManager.Event.ScriptRemoved;
         for (let script of this._internalWebKitScripts)
             this.dispatchEventToListeners(eventType, {script});
     }
 };
 
-WebInspector.DebuggerManager.Event = {
+WI.DebuggerManager.Event = {
     BreakpointAdded: "debugger-manager-breakpoint-added",
     BreakpointRemoved: "debugger-manager-breakpoint-removed",
     BreakpointMoved: "debugger-manager-breakpoint-moved",
@@ -1222,7 +1222,7 @@
     BreakpointsEnabledDidChange: "debugger-manager-breakpoints-enabled-did-change"
 };
 
-WebInspector.DebuggerManager.PauseReason = {
+WI.DebuggerManager.PauseReason = {
     Assertion: "assertion",
     Breakpoint: "breakpoint",
     CSPViolation: "CSP-violation",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DragToAdjustController.js b/Source/WebInspectorUI/UserInterface/Controllers/DragToAdjustController.js
index 4ad3a2a..825e67d 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/DragToAdjustController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/DragToAdjustController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DragToAdjustController = class DragToAdjustController
+WI.DragToAdjustController = class DragToAdjustController
 {
     constructor(delegate)
     {
@@ -81,10 +81,10 @@
             return;
 
         if (active) {
-            WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._modifiersDidChange, this);
+            WI.notifications.addEventListener(WI.Notification.GlobalModifierKeysDidChange, this._modifiersDidChange, this);
             this._element.addEventListener("mousemove", this);
         } else {
-            WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._modifiersDidChange, this);
+            WI.notifications.removeEventListener(WI.Notification.GlobalModifierKeysDidChange, this._modifiersDidChange, this);
             this._element.removeEventListener("mousemove", this);
             this._setTracksMouseClickAndDrag(false);
         }
@@ -98,7 +98,7 @@
     reset()
     {
         this._setTracksMouseClickAndDrag(false);
-        this._element.classList.remove(WebInspector.DragToAdjustController.StyleClassName);
+        this._element.classList.remove(WI.DragToAdjustController.StyleClassName);
 
         if (this._delegate && typeof this._delegate.dragToAdjustControllerDidReset === "function")
             this._delegate.dragToAdjustControllerDidReset(this);
@@ -148,9 +148,9 @@
 
         console.assert(window.event);
         if (dragging)
-            WebInspector.elementDragStart(this._element, this, this, window.event, "col-resize", window);
+            WI.elementDragStart(this._element, this, this, window.event, "col-resize", window);
         else
-            WebInspector.elementDragEnd(window.event);
+            WI.elementDragEnd(window.event);
 
         this._dragging = dragging;
     }
@@ -161,11 +161,11 @@
             return;
 
         if (tracksMouseClickAndDrag) {
-            this._element.classList.add(WebInspector.DragToAdjustController.StyleClassName);
+            this._element.classList.add(WI.DragToAdjustController.StyleClassName);
             window.addEventListener("mousedown", this, true);
             window.addEventListener("contextmenu", this, true);
         } else {
-            this._element.classList.remove(WebInspector.DragToAdjustController.StyleClassName);
+            this._element.classList.remove(WI.DragToAdjustController.StyleClassName);
             window.removeEventListener("mousedown", this, true);
             window.removeEventListener("contextmenu", this, true);
             this._setDragging(false);
@@ -176,7 +176,7 @@
 
     _modifiersDidChange(event)
     {
-        var canBeAdjusted = WebInspector.modifierKeys.altKey;
+        var canBeAdjusted = WI.modifierKeys.altKey;
         if (canBeAdjusted && this._delegate && typeof this._delegate.dragToAdjustControllerCanBeAdjusted === "function")
             canBeAdjusted = this._delegate.dragToAdjustControllerCanBeAdjusted(this);
 
@@ -187,7 +187,7 @@
     {
         var canBeAdjusted = event.altKey;
         if (canBeAdjusted && this._delegate && typeof this._delegate.dragToAdjustControllerCanAdjustObjectAtPoint === "function")
-            canBeAdjusted = this._delegate.dragToAdjustControllerCanAdjustObjectAtPoint(this, WebInspector.Point.fromEvent(event));
+            canBeAdjusted = this._delegate.dragToAdjustControllerCanAdjustObjectAtPoint(this, WI.Point.fromEvent(event));
 
         this._setTracksMouseClickAndDrag(canBeAdjusted);
     }
@@ -235,4 +235,4 @@
     }
 };
 
-WebInspector.DragToAdjustController.StyleClassName = "drag-to-adjust";
+WI.DragToAdjustController.StyleClassName = "drag-to-adjust";
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/Formatter.js b/Source/WebInspectorUI/UserInterface/Controllers/Formatter.js
index 2a16527..54a6580 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/Formatter.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/Formatter.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Formatter = class Formatter
+WI.Formatter = class Formatter
 {
     constructor(codeMirror, builder)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/FormatterSourceMap.js b/Source/WebInspectorUI/UserInterface/Controllers/FormatterSourceMap.js
index e320ba1..a6ff6a6 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/FormatterSourceMap.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/FormatterSourceMap.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FormatterSourceMap = class FormatterSourceMap extends WebInspector.Object
+WI.FormatterSourceMap = class FormatterSourceMap extends WI.Object
 {
     constructor(originalLineEndings, formattedLineEndings, mapping)
     {
@@ -38,7 +38,7 @@
 
     static fromSourceMapData({originalLineEndings, formattedLineEndings, mapping})
     {
-        return new WebInspector.FormatterSourceMap(originalLineEndings, formattedLineEndings, mapping);
+        return new WI.FormatterSourceMap(originalLineEndings, formattedLineEndings, mapping);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js b/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
index c49ca0b..1751c0f 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspector.Object
+WI.FrameResourceManager = class FrameResourceManager extends WI.Object
 {
     constructor()
     {
@@ -45,7 +45,7 @@
         if (window.NetworkAgent)
             NetworkAgent.enable();
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
+        WI.notifications.addEventListener(WI.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
     }
 
     // Public
@@ -67,7 +67,7 @@
 
     frameDidNavigate(framePayload)
     {
-        // Called from WebInspector.PageObserver.
+        // Called from WI.PageObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -95,7 +95,7 @@
         } else {
             if (frame.mainResource.url !== framePayload.url || frame.loaderIdentifier !== framePayload.loaderId) {
                 // Navigations like back/forward do not have provisional loads, so create a new main resource here.
-                var mainResource = new WebInspector.Resource(framePayload.url, framePayload.mimeType, null, framePayload.loaderId);
+                var mainResource = new WI.Resource(framePayload.url, framePayload.mimeType, null, framePayload.loaderId);
             } else {
                 // The main resource is already correct, so reuse it.
                 var mainResource = frame.mainResource;
@@ -130,7 +130,7 @@
 
     frameDidDetach(frameId)
     {
-        // Called from WebInspector.PageObserver.
+        // Called from WI.PageObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -152,7 +152,7 @@
 
         frame.clearExecutionContexts();
 
-        this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.FrameWasRemoved, {frame});
+        this.dispatchEventToListeners(WI.FrameResourceManager.Event.FrameWasRemoved, {frame});
 
         if (this._mainFrame !== oldMainFrame)
             this._mainFrameDidChange(oldMainFrame);
@@ -160,7 +160,7 @@
 
     resourceRequestWillBeSent(requestIdentifier, frameIdentifier, loaderIdentifier, request, type, redirectResponse, timestamp, initiator, targetId)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -173,7 +173,7 @@
         // resource in case it becomes a main resource.
         var originalRequestWillBeSentTimestamp = timestamp;
 
-        var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        var elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         let resource = this._resourceRequestIdentifierMap.get(requestIdentifier);
         if (resource) {
             // This is an existing request which is being redirected, update the resource.
@@ -211,16 +211,16 @@
         }
 
         // FIXME: <webkit.org/b/168475> Web Inspector: Correctly display iframe's and worker's WebSockets
-        let frameIdentifier = WebInspector.frameResourceManager.mainFrame.id;
-        let loaderIdentifier = WebInspector.frameResourceManager.mainFrame.id;
+        let frameIdentifier = WI.frameResourceManager.mainFrame.id;
+        let loaderIdentifier = WI.frameResourceManager.mainFrame.id;
         let targetId;
 
         let frame = this.frameForIdentifier(frameIdentifier);
         let requestData = null;
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         let initiatorSourceCodeLocation = null;
 
-        let resource = new WebInspector.WebSocketResource(url, loaderIdentifier, targetId, requestId, request.headers, requestData, timestamp, walltime, elapsedTime, initiatorSourceCodeLocation);
+        let resource = new WI.WebSocketResource(url, loaderIdentifier, targetId, requestId, request.headers, requestData, timestamp, walltime, elapsedTime, initiatorSourceCodeLocation);
 
         frame.addResource(resource);
 
@@ -234,9 +234,9 @@
         if (!resource)
             return;
 
-        resource.readyState = WebInspector.WebSocketResource.ReadyState.Open;
+        resource.readyState = WI.WebSocketResource.ReadyState.Open;
 
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
 
         // FIXME: <webkit.org/b/169166> Web Inspector: WebSockets: Implement timing information
         let responseTiming = response.timing || null;
@@ -263,9 +263,9 @@
         if (!resource)
             return;
 
-        resource.readyState = WebInspector.WebSocketResource.ReadyState.Closed;
+        resource.readyState = WI.WebSocketResource.ReadyState.Closed;
 
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         resource.markAsFinished(elapsedTime);
 
         this._webSocketIdentifierToURL.delete(requestId);
@@ -283,14 +283,14 @@
         let isOutgoing = !!response.mask;
 
         let {payloadData, payloadLength, opcode} = response;
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
 
         resource.addFrame(payloadData, payloadLength, isOutgoing, opcode, timestamp, elapsedTime);
     }
 
     markResourceRequestAsServedFromMemoryCache(requestIdentifier)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -309,7 +309,7 @@
 
     resourceRequestWasServedFromMemoryCache(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload, timestamp, initiator)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -317,7 +317,7 @@
 
         console.assert(!this._resourceRequestIdentifierMap.has(requestIdentifier));
 
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         let initiatorSourceCodeLocation = this._initiatorSourceCodeLocationFromPayload(initiator);
         let response = cachedResourcePayload.response;
         const responseSource = NetworkAgent.ResponseSource.MemoryCache;
@@ -332,7 +332,7 @@
         console.assert(resource.cached, "This resource should be classified as cached since it was served from the MemoryCache", resource);
 
         if (cachedResourcePayload.sourceMapURL)
-            WebInspector.sourceMapManager.downloadSourceMap(cachedResourcePayload.sourceMapURL, resource.url, resource);
+            WI.sourceMapManager.downloadSourceMap(cachedResourcePayload.sourceMapURL, resource.url, resource);
 
         // No need to associate the resource with the requestIdentifier, since this is the only event
         // sent for memory cache resource loads.
@@ -340,13 +340,13 @@
 
     resourceRequestDidReceiveResponse(requestIdentifier, frameIdentifier, loaderIdentifier, type, response, timestamp)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
             return;
 
-        var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        var elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         let resource = this._resourceRequestIdentifierMap.get(requestIdentifier);
 
         // We might not have a resource if the inspector was opened during the page load (after resourceRequestWillBeSent is called).
@@ -384,14 +384,14 @@
 
     resourceRequestDidReceiveData(requestIdentifier, dataLength, encodedDataLength, timestamp)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
             return;
 
         let resource = this._resourceRequestIdentifierMap.get(requestIdentifier);
-        var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        var elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
 
         // We might not have a resource if the inspector was opened during the page load (after resourceRequestWillBeSent is called).
         // We don't want to assert in this case since we do likely have the resource, via PageAgent.getResourceTree. The Resource
@@ -407,7 +407,7 @@
 
     resourceRequestDidFinishLoading(requestIdentifier, timestamp, sourceMapURL, metrics)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -423,18 +423,18 @@
         if (metrics)
             resource.updateWithMetrics(metrics);
 
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         resource.markAsFinished(elapsedTime);
 
         if (sourceMapURL)
-            WebInspector.sourceMapManager.downloadSourceMap(sourceMapURL, resource.url, resource);
+            WI.sourceMapManager.downloadSourceMap(sourceMapURL, resource.url, resource);
 
         this._resourceRequestIdentifierMap.delete(requestIdentifier);
     }
 
     resourceRequestDidFailLoading(requestIdentifier, canceled, timestamp, errorText)
     {
-        // Called from WebInspector.NetworkObserver.
+        // Called from WI.NetworkObserver.
 
         // Ignore this while waiting for the whole frame/resource tree.
         if (this._waitingForMainFrameResourceTreePayload)
@@ -447,7 +447,7 @@
         if (!resource)
             return;
 
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(timestamp);
         resource.markAsFailed(canceled, elapsedTime, errorText);
 
         if (resource === resource.parentFrame.provisionalMainResource)
@@ -458,7 +458,7 @@
 
     executionContextCreated(contextPayload)
     {
-        // Called from WebInspector.RuntimeObserver.
+        // Called from WI.RuntimeObserver.
 
         var frame = this.frameForIdentifier(contextPayload.frameId);
         console.assert(frame);
@@ -466,7 +466,7 @@
             return;
 
         var displayName = contextPayload.name || frame.mainResource.displayName;
-        var executionContext = new WebInspector.ExecutionContext(WebInspector.mainTarget, contextPayload.id, displayName, contextPayload.isPageContext, frame);
+        var executionContext = new WI.ExecutionContext(WI.mainTarget, contextPayload.id, displayName, contextPayload.isPageContext, frame);
         frame.addExecutionContext(executionContext);
     }
 
@@ -507,8 +507,8 @@
             else if (frame.provisionalMainResource && frame.provisionalMainResource.url === url && frame.provisionalLoaderIdentifier === loaderIdentifier)
                 resource = frame.provisionalMainResource;
             else {
-                resource = new WebInspector.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
-                if (resource.target === WebInspector.mainTarget)
+                resource = new WI.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
+                if (resource.target === WI.mainTarget)
                     this._addResourceToFrame(frame, resource);
                 else if (resource.target)
                     resource.target.addResource(resource);
@@ -518,8 +518,8 @@
         } else {
             // This is a new request for a new frame, which is always the main resource.
             console.assert(!targetId);
-            resource = new WebInspector.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
-            frame = new WebInspector.Frame(frameIdentifier, frameName, frameSecurityOrigin, loaderIdentifier, resource);
+            resource = new WI.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
+            frame = new WI.Frame(frameIdentifier, frameName, frameSecurityOrigin, loaderIdentifier, resource);
             this._frameIdentifierMap.set(frame.id, frame);
 
             // If we don't have a main frame, assume this is it. This can change later in
@@ -560,7 +560,7 @@
 
     _addResourceToTarget(target, resource)
     {
-        console.assert(target !== WebInspector.mainTarget);
+        console.assert(target !== WI.mainTarget);
         console.assert(resource);
 
         target.addResource(resource);
@@ -601,9 +601,9 @@
         if (!url || isNaN(lineNumber) || lineNumber < 0)
             return null;
 
-        var sourceCode = WebInspector.frameResourceManager.resourceForURL(url);
+        var sourceCode = WI.frameResourceManager.resourceForURL(url);
         if (!sourceCode)
-            sourceCode = WebInspector.debuggerManager.scriptsForURL(url, WebInspector.mainTarget)[0];
+            sourceCode = WI.debuggerManager.scriptsForURL(url, WI.mainTarget)[0];
 
         if (!sourceCode)
             return null;
@@ -639,8 +639,8 @@
     {
         // If payload.url is missing or empty then this page is likely the special empty page. In that case
         // we will just say it is "about:blank" so we have a URL, which is required for resources.
-        var mainResource = new WebInspector.Resource(payload.url || "about:blank", payload.mimeType, null, payload.loaderId);
-        var frame = new WebInspector.Frame(payload.id, payload.name, payload.securityOrigin, payload.loaderId, mainResource);
+        var mainResource = new WI.Resource(payload.url || "about:blank", payload.mimeType, null, payload.loaderId);
+        var frame = new WI.Frame(payload.id, payload.name, payload.securityOrigin, payload.loaderId, mainResource);
 
         this._frameIdentifierMap.set(frame.id, frame);
 
@@ -651,10 +651,10 @@
 
     _createResource(payload, framePayload)
     {
-        var resource = new WebInspector.Resource(payload.url, payload.mimeType, payload.type, framePayload.loaderId, payload.targetId);
+        var resource = new WI.Resource(payload.url, payload.mimeType, payload.type, framePayload.loaderId, payload.targetId);
 
         if (payload.sourceMapURL)
-            WebInspector.sourceMapManager.downloadSourceMap(payload.sourceMapURL, resource.url, resource);
+            WI.sourceMapManager.downloadSourceMap(payload.sourceMapURL, resource.url, resource);
 
         return resource;
     }
@@ -678,7 +678,7 @@
                 continue;
 
             var resource = this._createResource(resourcePayload, payload);
-            if (resource.target === WebInspector.mainTarget)
+            if (resource.target === WI.mainTarget)
                 frame.addResource(resource);
             else if (resource.target)
                 resource.target.addResource(resource);
@@ -709,7 +709,7 @@
 
     _dispatchFrameWasAddedEvent(frame)
     {
-        this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.FrameWasAdded, {frame});
+        this.dispatchEventToListeners(WI.FrameResourceManager.Event.FrameWasAdded, {frame});
     }
 
     _mainFrameDidChange(oldMainFrame)
@@ -719,7 +719,7 @@
         if (this._mainFrame)
             this._mainFrame.markAsMainFrame();
 
-        this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.MainFrameDidChange, {oldMainFrame});
+        this.dispatchEventToListeners(WI.FrameResourceManager.Event.MainFrameDidChange, {oldMainFrame});
     }
 
     _extraDomainsActivated(event)
@@ -729,7 +729,7 @@
     }
 };
 
-WebInspector.FrameResourceManager.Event = {
+WI.FrameResourceManager.Event = {
     FrameWasAdded: "frame-resource-manager-frame-was-added",
     FrameWasRemoved: "frame-resource-manager-frame-was-removed",
     MainFrameDidChange: "frame-resource-manager-main-frame-did-change",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js b/Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js
index cc8449c..888c4b9 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapManager = class HeapManager extends WebInspector.Object
+WI.HeapManager = class HeapManager extends WI.Object
 {
     constructor()
     {
@@ -37,17 +37,17 @@
 
     garbageCollected(target, payload)
     {
-        // Called from WebInspector.HeapObserver.
+        // Called from WI.HeapObserver.
 
         // FIXME: <https://webkit.org/b/167323> Web Inspector: Enable Memory profiling in Workers
-        if (target !== WebInspector.mainTarget)
+        if (target !== WI.mainTarget)
             return;
 
-        let collection = WebInspector.GarbageCollection.fromPayload(payload);
-        this.dispatchEventToListeners(WebInspector.HeapManager.Event.GarbageCollected, {collection});
+        let collection = WI.GarbageCollection.fromPayload(payload);
+        this.dispatchEventToListeners(WI.HeapManager.Event.GarbageCollected, {collection});
     }
 };
 
-WebInspector.HeapManager.Event = {
+WI.HeapManager.Event = {
     GarbageCollected: "heap-manager-garbage-collected"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/IssueManager.js b/Source/WebInspectorUI/UserInterface/Controllers/IssueManager.js
index a589adb..c8b55ad 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/IssueManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/IssueManager.js
@@ -23,25 +23,25 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IssueManager = class IssueManager extends WebInspector.Object
+WI.IssueManager = class IssueManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._logCleared, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.logManager.addEventListener(WI.LogManager.Event.Cleared, this._logCleared, this);
 
         this.initialize();
     }
 
     static issueMatchSourceCode(issue, sourceCode)
     {
-        if (sourceCode instanceof WebInspector.SourceMapResource)
+        if (sourceCode instanceof WI.SourceMapResource)
             return issue.sourceCodeLocation && issue.sourceCodeLocation.displaySourceCode === sourceCode;
-        if (sourceCode instanceof WebInspector.Resource)
+        if (sourceCode instanceof WI.Resource)
             return issue.url === sourceCode.url && (!issue.sourceCodeLocation || issue.sourceCodeLocation.sourceCode === sourceCode);
-        if (sourceCode instanceof WebInspector.Script)
+        if (sourceCode instanceof WI.Script)
             return issue.sourceCodeLocation && issue.sourceCodeLocation.sourceCode === sourceCode;
         return false;
     }
@@ -52,16 +52,16 @@
     {
         this._issues = [];
 
-        this.dispatchEventToListeners(WebInspector.IssueManager.Event.Cleared);
+        this.dispatchEventToListeners(WI.IssueManager.Event.Cleared);
     }
 
     issueWasAdded(consoleMessage)
     {
-        let issue = new WebInspector.IssueMessage(consoleMessage);
+        let issue = new WI.IssueMessage(consoleMessage);
 
         this._issues.push(issue);
 
-        this.dispatchEventToListeners(WebInspector.IssueManager.Event.IssueWasAdded, {issue});
+        this.dispatchEventToListeners(WI.IssueManager.Event.IssueWasAdded, {issue});
     }
 
     issuesForSourceCode(sourceCode)
@@ -70,7 +70,7 @@
 
         for (var i = 0; i < this._issues.length; ++i) {
             var issue = this._issues[i];
-            if (WebInspector.IssueManager.issueMatchSourceCode(issue, sourceCode))
+            if (WI.IssueManager.issueMatchSourceCode(issue, sourceCode))
                 issues.push(issue);
         }
 
@@ -86,7 +86,7 @@
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (!event.target.isMainFrame())
             return;
@@ -95,7 +95,7 @@
     }
 };
 
-WebInspector.IssueManager.Event = {
+WI.IssueManager.Event = {
     IssueWasAdded: "issue-manager-issue-was-added",
     Cleared: "issue-manager-cleared"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
index 7262132..c501fb8 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
@@ -23,19 +23,19 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.JavaScriptLogViewController = class JavaScriptLogViewController extends WebInspector.Object
+WI.JavaScriptLogViewController = class JavaScriptLogViewController extends WI.Object
 {
     constructor(element, scrollElement, textPrompt, delegate, historySettingIdentifier)
     {
         super();
 
-        console.assert(textPrompt instanceof WebInspector.ConsolePrompt);
+        console.assert(textPrompt instanceof WI.ConsolePrompt);
         console.assert(historySettingIdentifier);
 
         this._element = element;
         this._scrollElement = scrollElement;
 
-        this._promptHistorySetting = new WebInspector.Setting(historySettingIdentifier, null);
+        this._promptHistorySetting = new WI.Setting(historySettingIdentifier, null);
 
         this._prompt = textPrompt;
         this._prompt.delegate = this;
@@ -50,14 +50,14 @@
 
         this._sessions = [];
 
-        this.messagesAlternateClearKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "L", this.requestClearMessages.bind(this), this._element);
+        this.messagesAlternateClearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, "L", this.requestClearMessages.bind(this), this._element);
 
-        this._messagesFindNextKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "G", this._handleFindNextShortcut.bind(this), this._element);
-        this._messagesFindPreviousKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "G", this._handleFindPreviousShortcut.bind(this), this._element);
+        this._messagesFindNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._handleFindNextShortcut.bind(this), this._element);
+        this._messagesFindPreviousKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "G", this._handleFindPreviousShortcut.bind(this), this._element);
 
-        this._promptAlternateClearKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "L", this.requestClearMessages.bind(this), this._prompt.element);
-        this._promptFindNextKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "G", this._handleFindNextShortcut.bind(this), this._prompt.element);
-        this._promptFindPreviousKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "G", this._handleFindPreviousShortcut.bind(this), this._prompt.element);
+        this._promptAlternateClearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, "L", this.requestClearMessages.bind(this), this._prompt.element);
+        this._promptFindNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._handleFindNextShortcut.bind(this), this._prompt.element);
+        this._promptFindPreviousKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "G", this._handleFindPreviousShortcut.bind(this), this._prompt.element);
 
         this._pendingMessages = [];
         this._scheduledRenderIdentifier = 0;
@@ -82,7 +82,7 @@
         this._cleared = true;
 
         const clearPreviousSessions = true;
-        this.startNewSession(clearPreviousSessions, {newSessionReason: WebInspector.ConsoleSession.NewSessionReason.ConsoleCleared});
+        this.startNewSession(clearPreviousSessions, {newSessionReason: WI.ConsoleSession.NewSessionReason.ConsoleCleared});
     }
 
     startNewSession(clearPreviousSessions = false, data = {})
@@ -107,7 +107,7 @@
             lastSession.element.remove();
         }
 
-        let consoleSession = new WebInspector.ConsoleSession(data);
+        let consoleSession = new WI.ConsoleSession(data);
 
         this._previousMessageView = null;
         this._lastCommitted = "";
@@ -124,24 +124,24 @@
 
     appendImmediateExecutionWithResult(text, result, addSpecialUserLogClass, shouldRevealConsole)
     {
-        console.assert(result instanceof WebInspector.RemoteObject);
+        console.assert(result instanceof WI.RemoteObject);
 
-        var commandMessageView = new WebInspector.ConsoleCommandView(text, addSpecialUserLogClass ? "special-user-log" : null);
+        var commandMessageView = new WI.ConsoleCommandView(text, addSpecialUserLogClass ? "special-user-log" : null);
         this._appendConsoleMessageView(commandMessageView, true);
 
         function saveResultCallback(savedResultIndex)
         {
-            let commandResultMessage = new WebInspector.ConsoleCommandResultMessage(result.target, result, false, savedResultIndex, shouldRevealConsole);
-            let commandResultMessageView = new WebInspector.ConsoleMessageView(commandResultMessage);
+            let commandResultMessage = new WI.ConsoleCommandResultMessage(result.target, result, false, savedResultIndex, shouldRevealConsole);
+            let commandResultMessageView = new WI.ConsoleMessageView(commandResultMessage);
             this._appendConsoleMessageView(commandResultMessageView, true);
         }
 
-        WebInspector.runtimeManager.saveResult(result, saveResultCallback.bind(this));
+        WI.runtimeManager.saveResult(result, saveResultCallback.bind(this));
     }
 
     appendConsoleMessage(consoleMessage)
     {
-        var consoleMessageView = new WebInspector.ConsoleMessageView(consoleMessage);
+        var consoleMessageView = new WI.ConsoleMessageView(consoleMessage);
         this._appendConsoleMessageView(consoleMessageView);
         return consoleMessageView;
     }
@@ -152,7 +152,7 @@
         if (!this._previousMessageView)
             return false;
 
-        var previousIgnoredCount = this._previousMessageView[WebInspector.JavaScriptLogViewController.IgnoredRepeatCount] || 0;
+        var previousIgnoredCount = this._previousMessageView[WI.JavaScriptLogViewController.IgnoredRepeatCount] || 0;
         var previousVisibleCount = this._previousMessageView.repeatCount;
 
         if (!this._repeatCountWasInterrupted) {
@@ -161,8 +161,8 @@
         }
 
         var consoleMessage = this._previousMessageView.message;
-        var duplicatedConsoleMessageView = new WebInspector.ConsoleMessageView(consoleMessage);
-        duplicatedConsoleMessageView[WebInspector.JavaScriptLogViewController.IgnoredRepeatCount] = previousIgnoredCount + previousVisibleCount;
+        var duplicatedConsoleMessageView = new WI.ConsoleMessageView(consoleMessage);
+        duplicatedConsoleMessageView[WI.JavaScriptLogViewController.IgnoredRepeatCount] = previousIgnoredCount + previousVisibleCount;
         duplicatedConsoleMessageView.repeatCount = 1;
         this._appendConsoleMessageView(duplicatedConsoleMessageView);
 
@@ -193,7 +193,7 @@
 
     requestClearMessages()
     {
-        WebInspector.logManager.requestClearMessages();
+        WI.logManager.requestClearMessages();
     }
 
     // Protected
@@ -216,7 +216,7 @@
             handler(result !== RuntimeAgent.SyntaxErrorType.Recoverable);
         }
 
-        WebInspector.runtimeManager.activeExecutionContext.target.RuntimeAgent.parse(text, parseFinished.bind(this));
+        WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.parse(text, parseFinished.bind(this));
     }
 
     consolePromptTextCommitted(prompt, text)
@@ -224,7 +224,7 @@
         console.assert(text);
 
         if (this._lastCommitted !== text) {
-            let commandMessageView = new WebInspector.ConsoleCommandView(text);
+            let commandMessageView = new WI.ConsoleCommandView(text);
             this._appendConsoleMessageView(commandMessageView, true);
             this._lastCommitted = text;
         }
@@ -235,13 +235,13 @@
                 return;
 
             let shouldRevealConsole = true;
-            let commandResultMessage = new WebInspector.ConsoleCommandResultMessage(result.target, result, wasThrown, savedResultIndex, shouldRevealConsole);
-            let commandResultMessageView = new WebInspector.ConsoleMessageView(commandResultMessage);
+            let commandResultMessage = new WI.ConsoleCommandResultMessage(result.target, result, wasThrown, savedResultIndex, shouldRevealConsole);
+            let commandResultMessageView = new WI.ConsoleMessageView(commandResultMessage);
             this._appendConsoleMessageView(commandResultMessageView, true);
         }
 
         let options = {
-            objectGroup: WebInspector.RuntimeManager.ConsoleObjectGroup,
+            objectGroup: WI.RuntimeManager.ConsoleObjectGroup,
             includeCommandLineAPI: true,
             doNotPauseOnExceptionsAndMuteConsole: false,
             returnByValue: false,
@@ -250,7 +250,7 @@
             sourceURLAppender: appendWebInspectorConsoleEvaluationSourceURL,
         };
 
-        WebInspector.runtimeManager.evaluateInInspectedWindow(text, options, printResult.bind(this));
+        WI.runtimeManager.evaluateInInspectedWindow(text, options, printResult.bind(this));
     }
 
     // Private
@@ -275,14 +275,14 @@
         if (!repeatCountWasInterrupted)
             this._previousMessageView = messageView;
 
-        if (messageView.message && messageView.message.source !== WebInspector.ConsoleMessage.MessageSource.JS)
+        if (messageView.message && messageView.message.source !== WI.ConsoleMessage.MessageSource.JS)
             this._lastCommitted = "";
 
-        if (WebInspector.consoleContentView.visible)
+        if (WI.consoleContentView.visible)
             this.renderPendingMessagesSoon();
 
-        if (!WebInspector.isShowingConsoleTab() && messageView.message && messageView.message.shouldRevealConsole)
-            WebInspector.showSplitConsole();
+        if (!WI.isShowingConsoleTab() && messageView.message && messageView.message.shouldRevealConsole)
+            WI.showSplitConsole();
     }
 
     renderPendingMessages()
@@ -299,8 +299,8 @@
         let messages = this._pendingMessages.splice(0, maxMessagesPerFrame);
 
         let lastMessageView = messages.lastValue;
-        let isCommandView = lastMessageView instanceof WebInspector.ConsoleCommandView;
-        let shouldScrollToBottom = isCommandView || lastMessageView.message.type === WebInspector.ConsoleMessage.MessageType.Result || this.isScrolledToBottom();
+        let isCommandView = lastMessageView instanceof WI.ConsoleCommandView;
+        let shouldScrollToBottom = isCommandView || lastMessageView.message.type === WI.ConsoleMessage.MessageType.Result || this.isScrolledToBottom();
 
         for (let messageView of messages) {
             messageView.render();
@@ -310,7 +310,7 @@
         if (shouldScrollToBottom)
             this.scrollToBottom();
 
-        WebInspector.quickConsole.needsLayout();
+        WI.quickConsole.needsLayout();
 
         if (this._pendingMessages.length > 0)
             this.renderPendingMessagesSoon();
@@ -326,14 +326,14 @@
 
     _didRenderConsoleMessageView(messageView)
     {
-        var type = messageView instanceof WebInspector.ConsoleCommandView ? null : messageView.message.type;
-        if (type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
+        var type = messageView instanceof WI.ConsoleCommandView ? null : messageView.message.type;
+        if (type === WI.ConsoleMessage.MessageType.EndGroup) {
             var parentGroup = this._currentConsoleGroup.parentGroup;
             if (parentGroup)
                 this._currentConsoleGroup = parentGroup;
         } else {
-            if (type === WebInspector.ConsoleMessage.MessageType.StartGroup || type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
-                var group = new WebInspector.ConsoleGroup(this._currentConsoleGroup);
+            if (type === WI.ConsoleMessage.MessageType.StartGroup || type === WI.ConsoleMessage.MessageType.StartGroupCollapsed) {
+                var group = new WI.ConsoleGroup(this._currentConsoleGroup);
                 var groupElement = group.render(messageView);
                 this._currentConsoleGroup.append(groupElement);
                 this._currentConsoleGroup = group;
@@ -346,5 +346,5 @@
     }
 };
 
-WebInspector.JavaScriptLogViewController.CachedPropertiesDuration = 30000;
-WebInspector.JavaScriptLogViewController.IgnoredRepeatCount = Symbol("ignored-repeat-count");
+WI.JavaScriptLogViewController.CachedPropertiesDuration = 30000;
+WI.JavaScriptLogViewController.IgnoredRepeatCount = Symbol("ignored-repeat-count");
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
index 3fad543..c935edb 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
@@ -23,25 +23,25 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-Object.defineProperty(WebInspector, "javaScriptRuntimeCompletionProvider",
+Object.defineProperty(WI, "javaScriptRuntimeCompletionProvider",
 {
     get: function()
     {
-        if (!WebInspector.JavaScriptRuntimeCompletionProvider._instance)
-            WebInspector.JavaScriptRuntimeCompletionProvider._instance = new WebInspector.JavaScriptRuntimeCompletionProvider;
-        return WebInspector.JavaScriptRuntimeCompletionProvider._instance;
+        if (!WI.JavaScriptRuntimeCompletionProvider._instance)
+            WI.JavaScriptRuntimeCompletionProvider._instance = new WI.JavaScriptRuntimeCompletionProvider;
+        return WI.JavaScriptRuntimeCompletionProvider._instance;
     }
 });
 
-WebInspector.JavaScriptRuntimeCompletionProvider = class JavaScriptRuntimeCompletionProvider extends WebInspector.Object
+WI.JavaScriptRuntimeCompletionProvider = class JavaScriptRuntimeCompletionProvider extends WI.Object
 {
     constructor()
     {
         super();
 
-        console.assert(!WebInspector.JavaScriptRuntimeCompletionProvider._instance);
+        console.assert(!WI.JavaScriptRuntimeCompletionProvider._instance);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._clearLastProperties, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._clearLastProperties, this);
     }
 
     // Protected
@@ -99,19 +99,19 @@
         this._lastBase = base;
         this._lastPropertyNames = null;
 
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
         if (!base && activeCallFrame && !this._alwaysEvaluateInWindowContext)
             activeCallFrame.collectScopeChainVariableNames(receivedPropertyNames.bind(this));
         else {
             let options = {objectGroup: "completion", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: false, saveResult: false};
-            WebInspector.runtimeManager.evaluateInInspectedWindow(base, options, evaluated.bind(this));
+            WI.runtimeManager.evaluateInInspectedWindow(base, options, evaluated.bind(this));
         }
 
         function updateLastPropertyNames(propertyNames)
         {
             if (this._clearLastPropertiesTimeout)
                 clearTimeout(this._clearLastPropertiesTimeout);
-            this._clearLastPropertiesTimeout = setTimeout(this._clearLastProperties.bind(this), WebInspector.JavaScriptLogViewController.CachedPropertiesDuration);
+            this._clearLastPropertiesTimeout = setTimeout(this._clearLastProperties.bind(this), WI.JavaScriptLogViewController.CachedPropertiesDuration);
 
             this._lastPropertyNames = propertyNames || {};
         }
@@ -119,7 +119,7 @@
         function evaluated(result, wasThrown)
         {
             if (wasThrown || !result || result.type === "undefined" || (result.type === "object" && result.subtype === "null")) {
-                WebInspector.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
+                WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
 
                 updateLastPropertyNames.call(this, {});
                 completionController.updateCompletions(defaultCompletions);
@@ -189,7 +189,7 @@
                 result.callFunctionJSON(inspectedPage_evalResult_getCompletions, undefined, receivedPropertyNames.bind(this));
             else if (result.type === "string" || result.type === "number" || result.type === "boolean" || result.type === "symbol") {
                 let options = {objectGroup: "completion", includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: false, saveResult: false};
-                WebInspector.runtimeManager.evaluateInInspectedWindow("(" + inspectedPage_evalResult_getCompletions + ")(\"" + result.type + "\")", options, receivedPropertyNamesFromEvaluate.bind(this));
+                WI.runtimeManager.evaluateInInspectedWindow("(" + inspectedPage_evalResult_getCompletions + ")(\"" + result.type + "\")", options, receivedPropertyNamesFromEvaluate.bind(this));
             } else
                 console.error("Unknown result type: " + result.type);
         }
@@ -219,20 +219,20 @@
 
             updateLastPropertyNames.call(this, propertyNames);
 
-            WebInspector.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
+            WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
 
             if (!base) {
                 var commandLineAPI = ["$", "$$", "$x", "dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "getEventListeners", "$0", "$_"];
-                if (WebInspector.debuggerManager.paused) {
-                    let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.runtimeManager.activeExecutionContext.target);
-                    if (targetData.pauseReason === WebInspector.DebuggerManager.PauseReason.Exception)
+                if (WI.debuggerManager.paused) {
+                    let targetData = WI.debuggerManager.dataForTarget(WI.runtimeManager.activeExecutionContext.target);
+                    if (targetData.pauseReason === WI.DebuggerManager.PauseReason.Exception)
                         commandLineAPI.push("$exception");
                 }
                 for (var i = 0; i < commandLineAPI.length; ++i)
                     propertyNames[commandLineAPI[i]] = true;
 
                 // FIXME: Due to caching, sometimes old $n values show up as completion results even though they are not available. We should clear that proactively.
-                for (var i = 1; i <= WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex; ++i)
+                for (var i = 1; i <= WI.ConsoleCommandResultMessage.maximumSavedResultIndex; ++i)
                     propertyNames["$" + i] = true;
             }
 
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js b/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js
index 48ec5f1..a8732cf 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayerTreeManager = class LayerTreeManager extends WebInspector.Object
+WI.LayerTreeManager = class LayerTreeManager extends WI.Object
 {
     constructor()
     {
@@ -145,10 +145,10 @@
 
     layerTreeDidChange()
     {
-        this.dispatchEventToListeners(WebInspector.LayerTreeManager.Event.LayerTreeDidChange);
+        this.dispatchEventToListeners(WI.LayerTreeManager.Event.LayerTreeDidChange);
     }
 };
 
-WebInspector.LayerTreeManager.Event = {
+WI.LayerTreeManager.Event = {
     LayerTreeDidChange: "layer-tree-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js b/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js
index 3b917bb..e2238e9 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LogManager = class LogManager extends WebInspector.Object
+WI.LogManager = class LogManager extends WI.Object
 {
     constructor()
     {
@@ -33,42 +33,42 @@
         this._clearMessagesRequested = false;
         this._isNewPageOrReload = false;
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     }
 
     // Public
 
     messageWasAdded(target, source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, requestId)
     {
-        // Called from WebInspector.ConsoleObserver.
+        // Called from WI.ConsoleObserver.
 
         // FIXME: Get a request from request ID.
 
         if (parameters)
-            parameters = parameters.map((x) => WebInspector.RemoteObject.fromPayload(x, target));
+            parameters = parameters.map((x) => WI.RemoteObject.fromPayload(x, target));
 
-        let message = new WebInspector.ConsoleMessage(target, source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, null);
+        let message = new WI.ConsoleMessage(target, source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, null);
 
-        this.dispatchEventToListeners(WebInspector.LogManager.Event.MessageAdded, {message});
+        this.dispatchEventToListeners(WI.LogManager.Event.MessageAdded, {message});
 
         if (message.level === "warning" || message.level === "error")
-            WebInspector.issueManager.issueWasAdded(message);
+            WI.issueManager.issueWasAdded(message);
     }
 
     messagesCleared()
     {
-        // Called from WebInspector.ConsoleObserver.
+        // Called from WI.ConsoleObserver.
 
-        WebInspector.ConsoleCommandResultMessage.clearMaximumSavedResultIndex();
+        WI.ConsoleCommandResultMessage.clearMaximumSavedResultIndex();
 
         if (this._clearMessagesRequested) {
             // Frontend requested "clear console" and Backend successfully completed the request.
             this._clearMessagesRequested = false;
-            this.dispatchEventToListeners(WebInspector.LogManager.Event.Cleared);
+            this.dispatchEventToListeners(WI.LogManager.Event.Cleared);
         } else {
             // Received an unrequested clear console event.
             // This could be for a navigation or other reasons (like console.clear()).
-            // If this was a reload, we may not want to dispatch WebInspector.LogManager.Event.Cleared.
+            // If this was a reload, we may not want to dispatch WI.LogManager.Event.Cleared.
             // To detect if this is a reload we wait a turn and check if there was a main resource change reload.
             setTimeout(this._delayedMessagesCleared.bind(this), 0);
         }
@@ -79,26 +79,26 @@
         if (this._isNewPageOrReload) {
             this._isNewPageOrReload = false;
 
-            if (!WebInspector.settings.clearLogOnNavigate.value)
+            if (!WI.settings.clearLogOnNavigate.value)
                 return;
         }
 
         // A console.clear() or command line clear() happened.
-        this.dispatchEventToListeners(WebInspector.LogManager.Event.Cleared);
+        this.dispatchEventToListeners(WI.LogManager.Event.Cleared);
     }
 
     messageRepeatCountUpdated(count)
     {
-        // Called from WebInspector.ConsoleObserver.
+        // Called from WI.ConsoleObserver.
 
-        this.dispatchEventToListeners(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, {count});
+        this.dispatchEventToListeners(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, {count});
     }
 
     requestClearMessages()
     {
         this._clearMessagesRequested = true;
 
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.ConsoleAgent.clearMessages();
     }
 
@@ -106,7 +106,7 @@
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (!event.target.isMainFrame())
             return;
@@ -115,13 +115,13 @@
 
         let timestamp = Date.now();
         let wasReloaded = event.data.oldMainResource && event.data.oldMainResource.url === event.target.mainResource.url;
-        this.dispatchEventToListeners(WebInspector.LogManager.Event.SessionStarted, {timestamp, wasReloaded});
+        this.dispatchEventToListeners(WI.LogManager.Event.SessionStarted, {timestamp, wasReloaded});
 
-        WebInspector.ConsoleCommandResultMessage.clearMaximumSavedResultIndex();
+        WI.ConsoleCommandResultMessage.clearMaximumSavedResultIndex();
     }
 };
 
-WebInspector.LogManager.Event = {
+WI.LogManager.Event = {
     SessionStarted: "log-manager-session-was-started",
     Cleared: "log-manager-cleared",
     MessageAdded: "log-manager-message-added",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js b/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js
index ecb07ea..ec71950 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryManager = class MemoryManager extends WebInspector.Object
+WI.MemoryManager = class MemoryManager extends WI.Object
 {
     constructor()
     {
@@ -37,13 +37,13 @@
 
     memoryPressure(timestamp, protocolSeverity)
     {
-        // Called from WebInspector.MemoryObserver.
+        // Called from WI.MemoryObserver.
 
-        let memoryPressureEvent = WebInspector.MemoryPressureEvent.fromPayload(timestamp, protocolSeverity);
-        this.dispatchEventToListeners(WebInspector.MemoryManager.Event.MemoryPressure, {memoryPressureEvent});
+        let memoryPressureEvent = WI.MemoryPressureEvent.fromPayload(timestamp, protocolSeverity);
+        this.dispatchEventToListeners(WI.MemoryManager.Event.MemoryPressure, {memoryPressureEvent});
     }
 };
 
-WebInspector.MemoryManager.Event = {
+WI.MemoryManager.Event = {
     MemoryPressure: "memory-manager-memory-pressure",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/ProbeManager.js b/Source/WebInspectorUI/UserInterface/Controllers/ProbeManager.js
index b7f100f..83cda38 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/ProbeManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/ProbeManager.js
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeManager = class ProbeManager extends WebInspector.Object
+WI.ProbeManager = class ProbeManager extends WI.Object
 {
     constructor()
     {
@@ -37,13 +37,13 @@
         this._probesByIdentifier = new Map;
         this._probeSetsByBreakpoint = new Map;
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange, this._breakpointActionsChanged, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ActionsDidChange, this._breakpointActionsChanged, this);
 
         // Saved breakpoints should not be restored on the first event loop turn, because it
         // makes manager initialization order very fragile. No breakpoints should be available.
-        console.assert(!WebInspector.debuggerManager.breakpoints.length, "No breakpoints should exist before all the managers are constructed.");
+        console.assert(!WI.debuggerManager.breakpoints.length, "No breakpoints should exist before all the managers are constructed.");
     }
 
     // Public
@@ -58,15 +58,15 @@
         return this._probesByIdentifier.get(identifier);
     }
 
-    // Protected (called by WebInspector.DebuggerObserver)
+    // Protected (called by WI.DebuggerObserver)
 
     didSampleProbe(target, sample)
     {
         console.assert(this._probesByIdentifier.has(sample.probeId), "Unknown probe identifier specified for sample: ", sample);
         let probe = this._probesByIdentifier.get(sample.probeId);
-        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(sample.timestamp);
-        let object = WebInspector.RemoteObject.fromPayload(sample.payload, target);
-        probe.addSample(new WebInspector.ProbeSample(sample.sampleId, sample.batchId, elapsedTime, object));
+        let elapsedTime = WI.timelineManager.computeElapsedTime(sample.timestamp);
+        let object = WI.RemoteObject.fromPayload(sample.payload, target);
+        probe.addSample(new WI.ProbeSample(sample.sampleId, sample.batchId, elapsedTime, object));
     }
 
     // Private
@@ -74,12 +74,12 @@
     _breakpointAdded(breakpointOrEvent)
     {
         var breakpoint;
-        if (breakpointOrEvent instanceof WebInspector.Breakpoint)
+        if (breakpointOrEvent instanceof WI.Breakpoint)
             breakpoint = breakpointOrEvent;
         else
             breakpoint = breakpointOrEvent.data.breakpoint;
 
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unknown object passed as breakpoint: ", breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unknown object passed as breakpoint: ", breakpoint);
 
         if (this._knownProbeIdentifiersForBreakpoint.has(breakpoint))
             return;
@@ -101,12 +101,12 @@
     _breakpointActionsChanged(breakpointOrEvent)
     {
         var breakpoint;
-        if (breakpointOrEvent instanceof WebInspector.Breakpoint)
+        if (breakpointOrEvent instanceof WI.Breakpoint)
             breakpoint = breakpointOrEvent;
         else
             breakpoint = breakpointOrEvent.target;
 
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unknown object passed as breakpoint: ", breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unknown object passed as breakpoint: ", breakpoint);
 
         // Sometimes actions change before the added breakpoint is fully dispatched.
         if (!this._knownProbeIdentifiersForBreakpoint.has(breakpoint)) {
@@ -126,7 +126,7 @@
                 // New probe; find or create relevant probe set.
                 knownProbeIdentifiers.add(probeIdentifier);
                 var probeSet = this._probeSetForBreakpoint(breakpoint);
-                var newProbe = new WebInspector.Probe(probeIdentifier, breakpoint, probeAction.data);
+                var newProbe = new WI.Probe(probeIdentifier, breakpoint, probeAction.data);
                 this._probesByIdentifier.set(probeIdentifier, newProbe);
                 probeSet.addProbe(newProbe);
                 return;
@@ -154,7 +154,7 @@
             if (!probeSet.probes.length) {
                 this._probeSetsByBreakpoint.delete(probeSet.breakpoint);
                 probeSet.willRemove();
-                this.dispatchEventToListeners(WebInspector.ProbeManager.Event.ProbeSetRemoved, {probeSet});
+                this.dispatchEventToListeners(WI.ProbeManager.Event.ProbeSetRemoved, {probeSet});
             }
         }, this);
     }
@@ -164,14 +164,14 @@
         if (this._probeSetsByBreakpoint.has(breakpoint))
             return this._probeSetsByBreakpoint.get(breakpoint);
 
-        var newProbeSet = new WebInspector.ProbeSet(breakpoint);
+        var newProbeSet = new WI.ProbeSet(breakpoint);
         this._probeSetsByBreakpoint.set(breakpoint, newProbeSet);
-        this.dispatchEventToListeners(WebInspector.ProbeManager.Event.ProbeSetAdded, {probeSet: newProbeSet});
+        this.dispatchEventToListeners(WI.ProbeManager.Event.ProbeSetAdded, {probeSet: newProbeSet});
         return newProbeSet;
     }
 };
 
-WebInspector.ProbeManager.Event = {
+WI.ProbeManager.Event = {
     ProbeSetAdded: "probe-manager-probe-set-added",
     ProbeSetRemoved: "probe-manager-probe-set-removed",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js b/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js
index a818dd3..ce75808 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceQueryController = class ResourceQueryController extends WebInspector.Object
+WI.ResourceQueryController = class ResourceQueryController extends WI.Object
 {
     constructor()
     {
@@ -75,7 +75,7 @@
 
             let matches = this._findQueryMatches(query, cachedData.searchString, cachedData.specialCharacterIndices);
             if (matches.length)
-                results.push(new WebInspector.ResourceQueryResult(resource, matches, cookie));
+                results.push(new WI.ResourceQueryResult(resource, matches, cookie));
         }
 
         // Resources are sorted in descending order by rank. Resources of equal
@@ -96,11 +96,11 @@
         let searchIndex = 0;
         let specialIndex = 0;
         let deadBranches = new Array(query.length).fill(Infinity);
-        let type = WebInspector.ResourceQueryMatch.Type.Special;
+        let type = WI.ResourceQueryMatch.Type.Special;
 
         function pushMatch(index)
         {
-            matches.push(new WebInspector.ResourceQueryMatch(type, index, queryIndex));
+            matches.push(new WI.ResourceQueryMatch(type, index, queryIndex));
             searchIndex = index + 1;
             queryIndex++;
         }
@@ -135,7 +135,7 @@
                 queryIndex--;
 
                 let lastMatch = matches.pop();
-                if (lastMatch.type !== WebInspector.ResourceQueryMatch.Type.Special)
+                if (lastMatch.type !== WI.ResourceQueryMatch.Type.Special)
                     continue;
 
                 deadBranches[lastMatch.queryIndex] = lastMatch.index;
@@ -147,14 +147,14 @@
         }
 
         while (queryIndex < query.length && searchIndex < searchString.length) {
-            if (type === WebInspector.ResourceQueryMatch.Type.Special && !matchNextSpecialCharacter())
-                type = WebInspector.ResourceQueryMatch.Type.Normal;
+            if (type === WI.ResourceQueryMatch.Type.Special && !matchNextSpecialCharacter())
+                type = WI.ResourceQueryMatch.Type.Normal;
 
-            if (type === WebInspector.ResourceQueryMatch.Type.Normal) {
+            if (type === WI.ResourceQueryMatch.Type.Normal) {
                 let index = searchString.indexOf(query[queryIndex], searchIndex);
                 if (index >= 0 && index < deadBranches[queryIndex]) {
                     pushMatch(index);
-                    type = WebInspector.ResourceQueryMatch.Type.Special;
+                    type = WI.ResourceQueryMatch.Type.Special;
                 } else if (!backtrack())
                     return [];
             }
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js b/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js
index a105414..0f9bbae 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RuntimeManager = class RuntimeManager extends WebInspector.Object
+WI.RuntimeManager = class RuntimeManager extends WI.Object
 {
     constructor()
     {
@@ -32,9 +32,9 @@
         // Enable the RuntimeAgent to receive notification of execution contexts.
         RuntimeAgent.enable();
 
-        this._activeExecutionContext = WebInspector.mainTarget.executionContext;
+        this._activeExecutionContext = WI.mainTarget.executionContext;
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
     }
 
     // Public
@@ -51,7 +51,7 @@
 
         this._activeExecutionContext = executionContext;
 
-        this.dispatchEventToListeners(WebInspector.RuntimeManager.Event.ActiveExecutionContextChanged);
+        this.dispatchEventToListeners(WI.RuntimeManager.Event.ActiveExecutionContextChanged);
     }
 
     evaluateInInspectedWindow(expression, options, callback)
@@ -84,14 +84,14 @@
         let target = this._activeExecutionContext.target;
         let executionContextId = this._activeExecutionContext.id;
 
-        if (WebInspector.debuggerManager.activeCallFrame) {
-            target = WebInspector.debuggerManager.activeCallFrame.target;
+        if (WI.debuggerManager.activeCallFrame) {
+            target = WI.debuggerManager.activeCallFrame.target;
             executionContextId = target.executionContext.id;
         }
 
         function evalCallback(error, result, wasThrown, savedResultIndex)
         {
-            this.dispatchEventToListeners(WebInspector.RuntimeManager.Event.DidEvaluate, {objectGroup});
+            this.dispatchEventToListeners(WI.RuntimeManager.Event.DidEvaluate, {objectGroup});
 
             if (error) {
                 console.error(error);
@@ -102,12 +102,12 @@
             if (returnByValue)
                 callback(null, wasThrown, wasThrown ? null : result, savedResultIndex);
             else
-                callback(WebInspector.RemoteObject.fromPayload(result, target), wasThrown, savedResultIndex);
+                callback(WI.RemoteObject.fromPayload(result, target), wasThrown, savedResultIndex);
         }
 
-        if (WebInspector.debuggerManager.activeCallFrame) {
+        if (WI.debuggerManager.activeCallFrame) {
             // COMPATIBILITY (iOS 8): "saveResult" did not exist.
-            target.DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId: WebInspector.debuggerManager.activeCallFrame.id, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult}, evalCallback.bind(this), target.DebuggerAgent);
+            target.DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId: WI.debuggerManager.activeCallFrame.id, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult}, evalCallback.bind(this), target.DebuggerAgent);
             return;
         }
 
@@ -117,7 +117,7 @@
 
     saveResult(remoteObject, callback)
     {
-        console.assert(remoteObject instanceof WebInspector.RemoteObject);
+        console.assert(remoteObject instanceof WI.RemoteObject);
 
         // COMPATIBILITY (iOS 8): Runtime.saveResult did not exist.
         if (!RuntimeAgent.saveResult) {
@@ -163,7 +163,7 @@
 
         let currentContextWasDestroyed = contexts.some((context) => context.id === this._activeExecutionContext.id);
         if (currentContextWasDestroyed)
-            this.activeExecutionContext = WebInspector.mainTarget.executionContext;
+            this.activeExecutionContext = WI.mainTarget.executionContext;
     }
 
     _tryApplyAwaitConvenience(originalExpression)
@@ -252,10 +252,10 @@
     }
 };
 
-WebInspector.RuntimeManager.ConsoleObjectGroup = "console";
-WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier = undefined;
+WI.RuntimeManager.ConsoleObjectGroup = "console";
+WI.RuntimeManager.TopLevelExecutionContextIdentifier = undefined;
 
-WebInspector.RuntimeManager.Event = {
+WI.RuntimeManager.Event = {
     DidEvaluate: Symbol("runtime-manager-did-evaluate"),
     DefaultExecutionContextChanged: Symbol("runtime-manager-default-execution-context-changed"),
     ActiveExecutionContextChanged: Symbol("runtime-manager-active-execution-context-changed"),
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js b/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js
index 6bb8cef..ceb6af6 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceMapManager = class SourceMapManager extends WebInspector.Object
+WI.SourceMapManager = class SourceMapManager extends WI.Object
 {
     constructor()
     {
@@ -32,7 +32,7 @@
         this._sourceMapURLMap = {};
         this._downloadingSourceMaps = {};
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     }
 
     // Public
@@ -46,8 +46,8 @@
     {
         // The baseURL could have come from a "//# sourceURL". Attempt to get a
         // reasonable absolute URL for the base by using the main resource's URL.
-        if (WebInspector.frameResourceManager.mainFrame)
-            baseURL = absoluteURL(baseURL, WebInspector.frameResourceManager.mainFrame.url);
+        if (WI.frameResourceManager.mainFrame)
+            baseURL = absoluteURL(baseURL, WI.frameResourceManager.mainFrame.url);
 
         if (sourceMapURL.startsWith("data:")) {
             this._loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode);
@@ -75,7 +75,7 @@
             this._loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode);
         }
 
-        if (!WebInspector.frameResourceManager.mainFrame) {
+        if (!WI.frameResourceManager.mainFrame) {
             // If we don't have a main frame, then we are likely in the middle of building the resource tree.
             // Delaying until the next runloop is enough in this case to then start loading the source map.
             setTimeout(loadAndParseSourceMap.bind(this), 0);
@@ -111,7 +111,7 @@
             try {
                 var payload = JSON.parse(content);
                 var baseURL = sourceMapURL.startsWith("data:") ? originalSourceCode.url : sourceMapURL;
-                var sourceMap = new WebInspector.SourceMap(baseURL, payload, originalSourceCode);
+                var sourceMap = new WI.SourceMap(baseURL, payload, originalSourceCode);
                 this._loadAndParseSucceeded(sourceMapURL, sourceMap);
             } catch (e) {
                 this._loadAndParseFailed(sourceMapURL);
@@ -133,11 +133,11 @@
         }
 
         var frameIdentifier = null;
-        if (originalSourceCode instanceof WebInspector.Resource && originalSourceCode.parentFrame)
+        if (originalSourceCode instanceof WI.Resource && originalSourceCode.parentFrame)
             frameIdentifier = originalSourceCode.parentFrame.id;
 
         if (!frameIdentifier)
-            frameIdentifier = WebInspector.frameResourceManager.mainFrame.id;
+            frameIdentifier = WI.frameResourceManager.mainFrame.id;
 
         NetworkAgent.loadResource(frameIdentifier, sourceMapURL, sourceMapLoaded.bind(this));
     }
@@ -158,7 +158,7 @@
 
         var sources = sourceMap.sources();
         for (var i = 0; i < sources.length; ++i) {
-            var sourceMapResource = new WebInspector.SourceMapResource(sources[i], sourceMap);
+            var sourceMapResource = new WI.SourceMapResource(sources[i], sourceMap);
             sourceMap.addResource(sourceMapResource);
         }
 
@@ -167,8 +167,8 @@
 
         // If the originalSourceCode was not a Resource, be sure to also associate with the Resource if one exists.
         // FIXME: We should try to use the right frame instead of a global lookup by URL.
-        if (!(sourceMap.originalSourceCode instanceof WebInspector.Resource)) {
-            console.assert(sourceMap.originalSourceCode instanceof WebInspector.Script);
+        if (!(sourceMap.originalSourceCode instanceof WI.Resource)) {
+            console.assert(sourceMap.originalSourceCode instanceof WI.Script);
             var resource = sourceMap.originalSourceCode.resource;
             if (resource)
                 resource.addSourceMap(sourceMap);
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js b/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js
index a267dcb..d3e68cb 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StorageManager = class StorageManager extends WebInspector.Object
+WI.StorageManager = class StorageManager extends WI.Object
 {
     constructor()
     {
@@ -37,8 +37,8 @@
         if (window.IndexedDBAgent)
             IndexedDBAgent.enable();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.SecurityOriginDidChange, this._securityOriginDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.SecurityOriginDidChange, this._securityOriginDidChange, this);
 
         this.initialize();
     }
@@ -78,18 +78,18 @@
 
     domStorageWasAdded(id, host, isLocalStorage)
     {
-        var domStorage = new WebInspector.DOMStorageObject(id, host, isLocalStorage);
+        var domStorage = new WI.DOMStorageObject(id, host, isLocalStorage);
 
         this._domStorageObjects.push(domStorage);
-        this.dispatchEventToListeners(WebInspector.StorageManager.Event.DOMStorageObjectWasAdded, {domStorage});
+        this.dispatchEventToListeners(WI.StorageManager.Event.DOMStorageObjectWasAdded, {domStorage});
     }
 
     databaseWasAdded(id, host, name, version)
     {
-        var database = new WebInspector.DatabaseObject(id, host, name, version);
+        var database = new WI.DatabaseObject(id, host, name, version);
 
         this._databaseObjects.push(database);
-        this.dispatchEventToListeners(WebInspector.StorageManager.Event.DatabaseWasAdded, {database});
+        this.dispatchEventToListeners(WI.StorageManager.Event.DatabaseWasAdded, {database});
     }
 
     itemsCleared(storageId)
@@ -126,7 +126,7 @@
         console.assert(database);
         if (!database)
             return;
-        this.dispatchEventToListeners(WebInspector.StorageManager.Event.DatabaseWasInspected, {database});
+        this.dispatchEventToListeners(WI.StorageManager.Event.DatabaseWasInspected, {database});
     }
 
     inspectDOMStorage(id)
@@ -135,7 +135,7 @@
         console.assert(domStorage);
         if (!domStorage)
             return;
-        this.dispatchEventToListeners(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected, {domStorage});
+        this.dispatchEventToListeners(WI.StorageManager.Event.DOMStorageObjectWasInspected, {domStorage});
     }
 
     requestIndexedDatabaseData(objectStore, objectStoreIndex, startEntryIndex, maximumEntryCount, callback)
@@ -155,9 +155,9 @@
 
             for (var entryPayload of entryPayloads) {
                 var entry = {};
-                entry.primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
-                entry.key = WebInspector.RemoteObject.fromPayload(entryPayload.key);
-                entry.value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                entry.primaryKey = WI.RemoteObject.fromPayload(entryPayload.primaryKey);
+                entry.key = WI.RemoteObject.fromPayload(entryPayload.key);
+                entry.value = WI.RemoteObject.fromPayload(entryPayload.value);
                 entries.push(entry);
             }
 
@@ -200,12 +200,12 @@
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (event.target.isMainFrame()) {
             // If we are dealing with the main frame, we want to clear our list of objects, because we are navigating to a new page.
             this.initialize();
-            this.dispatchEventToListeners(WebInspector.StorageManager.Event.Cleared);
+            this.dispatchEventToListeners(WI.StorageManager.Event.Cleared);
 
             this._addDOMStorageIfNeeded(event.target);
             this._addIndexedDBDatabasesIfNeeded(event.target);
@@ -219,8 +219,8 @@
         if (this._cookieStorageObjects[host])
             return;
 
-        this._cookieStorageObjects[host] = new WebInspector.CookieStorageObject(host);
-        this.dispatchEventToListeners(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded, {cookieStorage: this._cookieStorageObjects[host]});
+        this._cookieStorageObjects[host] = new WI.CookieStorageObject(host);
+        this.dispatchEventToListeners(WI.StorageManager.Event.CookieStorageObjectWasAdded, {cookieStorage: this._cookieStorageObjects[host]});
     }
 
     _addDOMStorageIfNeeded(frame)
@@ -269,10 +269,10 @@
                 return;
 
             var objectStores = databasePayload.objectStores.map(processObjectStore);
-            var indexedDatabase = new WebInspector.IndexedDatabase(databasePayload.name, securityOrigin, databasePayload.version, objectStores);
+            var indexedDatabase = new WI.IndexedDatabase(databasePayload.name, securityOrigin, databasePayload.version, objectStores);
 
             this._indexedDatabases.push(indexedDatabase);
-            this.dispatchEventToListeners(WebInspector.StorageManager.Event.IndexedDatabaseWasAdded, {indexedDatabase});
+            this.dispatchEventToListeners(WI.StorageManager.Event.IndexedDatabaseWasAdded, {indexedDatabase});
         }
 
         function processKeyPath(keyPathPayload)
@@ -294,13 +294,13 @@
         {
             var keyPath = processKeyPath(objectStorePayload.keyPath);
             var indexes = objectStorePayload.indexes.map(processObjectStoreIndex);
-            return new WebInspector.IndexedDatabaseObjectStore(objectStorePayload.name, keyPath, objectStorePayload.autoIncrement, indexes);
+            return new WI.IndexedDatabaseObjectStore(objectStorePayload.name, keyPath, objectStorePayload.autoIncrement, indexes);
         }
 
         function processObjectStoreIndex(objectStoreIndexPayload)
         {
             var keyPath = processKeyPath(objectStoreIndexPayload.keyPath);
-            return new WebInspector.IndexedDatabaseObjectStoreIndex(objectStoreIndexPayload.name, keyPath, objectStoreIndexPayload.unique, objectStoreIndexPayload.multiEntry);
+            return new WI.IndexedDatabaseObjectStoreIndex(objectStoreIndexPayload.name, keyPath, objectStoreIndexPayload.unique, objectStoreIndexPayload.multiEntry);
         }
 
         IndexedDBAgent.requestDatabaseNames(securityOrigin, processDatabaseNames.bind(this));
@@ -308,7 +308,7 @@
 
     _securityOriginDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         this._addDOMStorageIfNeeded(event.target);
         this._addIndexedDBDatabasesIfNeeded(event.target);
@@ -325,7 +325,7 @@
     }
 };
 
-WebInspector.StorageManager.Event = {
+WI.StorageManager.Event = {
     CookieStorageObjectWasAdded: "storage-manager-cookie-storage-object-was-added",
     DOMStorageObjectWasAdded: "storage-manager-dom-storage-object-was-added",
     DOMStorageObjectWasInspected: "storage-dom-object-was-inspected",
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js b/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js
index 7e987d4..5793f10 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TargetManager = class TargetManager extends WebInspector.Object
+WI.TargetManager = class TargetManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        console.assert(WebInspector.mainTarget);
+        console.assert(WI.mainTarget);
 
-        this._targets = new Set([WebInspector.mainTarget]);
+        this._targets = new Set([WI.mainTarget]);
     }
 
     // Public
@@ -58,18 +58,18 @@
     {
         this._targets.add(target);
 
-        this.dispatchEventToListeners(WebInspector.TargetManager.Event.TargetAdded, {target});
+        this.dispatchEventToListeners(WI.TargetManager.Event.TargetAdded, {target});
     }
 
     removeTarget(target)
     {
         this._targets.delete(target);
 
-        this.dispatchEventToListeners(WebInspector.TargetManager.Event.TargetRemoved, {target});
+        this.dispatchEventToListeners(WI.TargetManager.Event.TargetRemoved, {target});
     }
 };
 
-WebInspector.TargetManager.Event = {
+WI.TargetManager.Event = {
     TargetAdded: Symbol("target-manager-target-added"),
     TargetRemoved: Symbol("target-manager-target-removed"),
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js b/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
index e03ba9b..9e19331 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
@@ -23,24 +23,24 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineManager = class TimelineManager extends WebInspector.Object
+WI.TimelineManager = class TimelineManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
-        WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded, this._resourceWasAdded, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+        WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
 
-        WebInspector.heapManager.addEventListener(WebInspector.HeapManager.Event.GarbageCollected, this._garbageCollected, this);
-        WebInspector.memoryManager.addEventListener(WebInspector.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
+        WI.heapManager.addEventListener(WI.HeapManager.Event.GarbageCollected, this._garbageCollected, this);
+        WI.memoryManager.addEventListener(WI.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
 
-        this._enabledTimelineTypesSetting = new WebInspector.Setting("enabled-instrument-types", WebInspector.TimelineManager.defaultTimelineTypes());
+        this._enabledTimelineTypesSetting = new WI.Setting("enabled-instrument-types", WI.TimelineManager.defaultTimelineTypes());
         this._updateAutoCaptureInstruments();
 
-        this._persistentNetworkTimeline = new WebInspector.NetworkTimeline;
+        this._persistentNetworkTimeline = new WI.NetworkTimeline;
 
         this._isCapturing = false;
         this._initiatedByBackendStart = false;
@@ -66,36 +66,36 @@
 
     static defaultTimelineTypes()
     {
-        if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript) {
-            let defaultTypes = [WebInspector.TimelineRecord.Type.Script];
-            if (WebInspector.HeapAllocationsInstrument.supported())
-                defaultTypes.push(WebInspector.TimelineRecord.Type.HeapAllocations);
+        if (WI.debuggableType === WI.DebuggableType.JavaScript) {
+            let defaultTypes = [WI.TimelineRecord.Type.Script];
+            if (WI.HeapAllocationsInstrument.supported())
+                defaultTypes.push(WI.TimelineRecord.Type.HeapAllocations);
             return defaultTypes;
         }
 
         let defaultTypes = [
-            WebInspector.TimelineRecord.Type.Network,
-            WebInspector.TimelineRecord.Type.Layout,
-            WebInspector.TimelineRecord.Type.Script,
+            WI.TimelineRecord.Type.Network,
+            WI.TimelineRecord.Type.Layout,
+            WI.TimelineRecord.Type.Script,
         ];
 
-        if (WebInspector.FPSInstrument.supported())
-            defaultTypes.push(WebInspector.TimelineRecord.Type.RenderingFrame);
+        if (WI.FPSInstrument.supported())
+            defaultTypes.push(WI.TimelineRecord.Type.RenderingFrame);
 
         return defaultTypes;
     }
 
     static availableTimelineTypes()
     {
-        let types = WebInspector.TimelineManager.defaultTimelineTypes();
-        if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript)
+        let types = WI.TimelineManager.defaultTimelineTypes();
+        if (WI.debuggableType === WI.DebuggableType.JavaScript)
             return types;
 
-        if (WebInspector.MemoryInstrument.supported())
-            types.push(WebInspector.TimelineRecord.Type.Memory);
+        if (WI.MemoryInstrument.supported())
+            types.push(WI.TimelineRecord.Type.Memory);
 
-        if (WebInspector.HeapAllocationsInstrument.supported())
-            types.push(WebInspector.TimelineRecord.Type.HeapAllocations);
+        if (WI.HeapAllocationsInstrument.supported())
+            types.push(WI.TimelineRecord.Type.HeapAllocations);
 
         return types;
     }
@@ -151,7 +151,7 @@
 
     get enabledTimelineTypes()
     {
-        let availableTimelineTypes = WebInspector.TimelineManager.availableTimelineTypes();
+        let availableTimelineTypes = WI.TimelineManager.availableTimelineTypes();
         return this._enabledTimelineTypesSetting.value.filter((type) => availableTimelineTypes.includes(type));
     }
 
@@ -181,7 +181,7 @@
 
         this._waitingForCapturingStartedEvent = true;
 
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingWillStart);
+        this.dispatchEventToListeners(WI.TimelineManager.Event.CapturingWillStart);
 
         this._activeRecording.start(this._initiatedByBackendStart);
     }
@@ -227,7 +227,7 @@
 
     capturingStarted(startTime)
     {
-        // Called from WebInspector.TimelineObserver.
+        // Called from WI.TimelineObserver.
 
         if (this._isCapturing)
             return;
@@ -242,12 +242,12 @@
 
         this._webTimelineScriptRecordsExpectingScriptProfilerEvents = [];
 
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted, {startTime});
+        this.dispatchEventToListeners(WI.TimelineManager.Event.CapturingStarted, {startTime});
     }
 
     capturingStopped(endTime)
     {
-        // Called from WebInspector.TimelineObserver.
+        // Called from WI.TimelineObserver.
 
         if (!this._isCapturing)
             return;
@@ -269,12 +269,12 @@
         this._initiatedByBackendStart = false;
         this._initiatedByBackendStop = false;
 
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStopped, {endTime});
+        this.dispatchEventToListeners(WI.TimelineManager.Event.CapturingStopped, {endTime});
     }
 
     autoCaptureStarted()
     {
-        // Called from WebInspector.TimelineObserver.
+        // Called from WI.TimelineObserver.
 
         if (this._isCapturing)
             this.stopCapturing();
@@ -294,7 +294,7 @@
 
     programmaticCaptureStarted()
     {
-        // Called from WebInspector.TimelineObserver.
+        // Called from WI.TimelineObserver.
 
         this._initiatedByBackendStart = true;
 
@@ -306,7 +306,7 @@
 
     programmaticCaptureStopped()
     {
-        // Called from WebInspector.TimelineObserver.
+        // Called from WI.TimelineObserver.
 
         this._initiatedByBackendStop = true;
 
@@ -320,7 +320,7 @@
 
     eventRecorded(recordPayload)
     {
-        // Called from WebInspector.TimelineObserver.
+        // Called from WI.TimelineObserver.
 
         if (!this._isCapturing)
             return;
@@ -352,7 +352,7 @@
         }
 
         for (var record of records) {
-            if (record.type === WebInspector.TimelineRecord.Type.RenderingFrame) {
+            if (record.type === WI.TimelineRecord.Type.RenderingFrame) {
                 if (!record.children.length)
                     continue;
                 record.setupFrameIndex();
@@ -366,31 +366,31 @@
 
     pageDOMContentLoadedEventFired(timestamp)
     {
-        // Called from WebInspector.PageObserver.
+        // Called from WI.PageObserver.
 
         console.assert(this._activeRecording);
-        console.assert(isNaN(WebInspector.frameResourceManager.mainFrame.domContentReadyEventTimestamp));
+        console.assert(isNaN(WI.frameResourceManager.mainFrame.domContentReadyEventTimestamp));
 
         let computedTimestamp = this.activeRecording.computeElapsedTime(timestamp);
 
-        WebInspector.frameResourceManager.mainFrame.markDOMContentReadyEvent(computedTimestamp);
+        WI.frameResourceManager.mainFrame.markDOMContentReadyEvent(computedTimestamp);
 
-        let eventMarker = new WebInspector.TimelineMarker(computedTimestamp, WebInspector.TimelineMarker.Type.DOMContentEvent);
+        let eventMarker = new WI.TimelineMarker(computedTimestamp, WI.TimelineMarker.Type.DOMContentEvent);
         this._activeRecording.addEventMarker(eventMarker);
     }
 
     pageLoadEventFired(timestamp)
     {
-        // Called from WebInspector.PageObserver.
+        // Called from WI.PageObserver.
 
         console.assert(this._activeRecording);
-        console.assert(isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp));
+        console.assert(isNaN(WI.frameResourceManager.mainFrame.loadEventTimestamp));
 
         let computedTimestamp = this.activeRecording.computeElapsedTime(timestamp);
 
-        WebInspector.frameResourceManager.mainFrame.markLoadEvent(computedTimestamp);
+        WI.frameResourceManager.mainFrame.markLoadEvent(computedTimestamp);
 
-        let eventMarker = new WebInspector.TimelineMarker(computedTimestamp, WebInspector.TimelineMarker.Type.LoadEvent);
+        let eventMarker = new WI.TimelineMarker(computedTimestamp, WI.TimelineMarker.Type.LoadEvent);
         this._activeRecording.addEventMarker(eventMarker);
 
         this._stopAutoRecordingSoon();
@@ -398,47 +398,47 @@
 
     memoryTrackingStart(timestamp)
     {
-        // Called from WebInspector.MemoryObserver.
+        // Called from WI.MemoryObserver.
 
         this.capturingStarted(timestamp);
     }
 
     memoryTrackingUpdate(event)
     {
-        // Called from WebInspector.MemoryObserver.
+        // Called from WI.MemoryObserver.
 
         if (!this._isCapturing)
             return;
 
-        this._addRecord(new WebInspector.MemoryTimelineRecord(event.timestamp, event.categories));
+        this._addRecord(new WI.MemoryTimelineRecord(event.timestamp, event.categories));
     }
 
     memoryTrackingComplete()
     {
-        // Called from WebInspector.MemoryObserver.
+        // Called from WI.MemoryObserver.
     }
 
     heapTrackingStarted(timestamp, snapshot)
     {
-        // Called from WebInspector.HeapObserver.
+        // Called from WI.HeapObserver.
 
-        this._addRecord(new WebInspector.HeapAllocationsTimelineRecord(timestamp, snapshot));
+        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
 
         this.capturingStarted(timestamp);
     }
 
     heapTrackingCompleted(timestamp, snapshot)
     {
-        // Called from WebInspector.HeapObserver.
+        // Called from WI.HeapObserver.
 
-        this._addRecord(new WebInspector.HeapAllocationsTimelineRecord(timestamp, snapshot));
+        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
     }
 
     heapSnapshotAdded(timestamp, snapshot)
     {
-        // Called from WebInspector.HeapAllocationsInstrument.
+        // Called from WI.HeapAllocationsInstrument.
 
-        this._addRecord(new WebInspector.HeapAllocationsTimelineRecord(timestamp, snapshot));
+        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
     }
 
     // Private
@@ -466,38 +466,38 @@
             console.assert(isNaN(endTime));
 
             // Pass the startTime as the endTime since this record type has no duration.
-            return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles, startTime, startTime, callFrames, sourceCodeLocation);
+            return new WI.LayoutTimelineRecord(WI.LayoutTimelineRecord.EventType.InvalidateStyles, startTime, startTime, callFrames, sourceCodeLocation);
 
         case TimelineAgent.EventType.RecalculateStyles:
-            return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles, startTime, endTime, callFrames, sourceCodeLocation);
+            return new WI.LayoutTimelineRecord(WI.LayoutTimelineRecord.EventType.RecalculateStyles, startTime, endTime, callFrames, sourceCodeLocation);
 
         case TimelineAgent.EventType.InvalidateLayout:
             console.assert(isNaN(endTime));
 
             // Pass the startTime as the endTime since this record type has no duration.
-            return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout, startTime, startTime, callFrames, sourceCodeLocation);
+            return new WI.LayoutTimelineRecord(WI.LayoutTimelineRecord.EventType.InvalidateLayout, startTime, startTime, callFrames, sourceCodeLocation);
 
         case TimelineAgent.EventType.Layout:
-            var layoutRecordType = sourceCodeLocation ? WebInspector.LayoutTimelineRecord.EventType.ForcedLayout : WebInspector.LayoutTimelineRecord.EventType.Layout;
-            var quad = new WebInspector.Quad(recordPayload.data.root);
-            return new WebInspector.LayoutTimelineRecord(layoutRecordType, startTime, endTime, callFrames, sourceCodeLocation, quad);
+            var layoutRecordType = sourceCodeLocation ? WI.LayoutTimelineRecord.EventType.ForcedLayout : WI.LayoutTimelineRecord.EventType.Layout;
+            var quad = new WI.Quad(recordPayload.data.root);
+            return new WI.LayoutTimelineRecord(layoutRecordType, startTime, endTime, callFrames, sourceCodeLocation, quad);
 
         case TimelineAgent.EventType.Paint:
-            var quad = new WebInspector.Quad(recordPayload.data.clip);
-            return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, quad);
+            var quad = new WI.Quad(recordPayload.data.clip);
+            return new WI.LayoutTimelineRecord(WI.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, quad);
 
         case TimelineAgent.EventType.Composite:
-            return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Composite, startTime, endTime, callFrames, sourceCodeLocation);
+            return new WI.LayoutTimelineRecord(WI.LayoutTimelineRecord.EventType.Composite, startTime, endTime, callFrames, sourceCodeLocation);
 
         case TimelineAgent.EventType.RenderingFrame:
             if (!recordPayload.children || !recordPayload.children.length)
                 return null;
 
-            return new WebInspector.RenderingFrameTimelineRecord(startTime, endTime);
+            return new WI.RenderingFrameTimelineRecord(startTime, endTime);
 
         case TimelineAgent.EventType.EvaluateScript:
             if (!sourceCodeLocation) {
-                var mainFrame = WebInspector.frameResourceManager.mainFrame;
+                var mainFrame = WI.frameResourceManager.mainFrame;
                 var scriptResource = mainFrame.url === recordPayload.data.url ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.url, true);
                 if (scriptResource) {
                     // The lineNumber is 1-based, but we expect 0-based.
@@ -513,10 +513,10 @@
             var record;
             switch (parentRecordPayload && parentRecordPayload.type) {
             case TimelineAgent.EventType.TimerFire:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId, profileData);
                 break;
             default:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, null, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, null, profileData);
                 break;
             }
 
@@ -527,7 +527,7 @@
             var profileData = recordPayload.data.profile;
             // COMPATIBILITY (iOS 9): With the Sampling Profiler, profiles no longer include legacy profile data.
             console.assert(profileData || TimelineAgent.setInstruments);
-            return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.title, profileData);
+            return new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ConsoleProfileRecorded, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.title, profileData);
 
         case TimelineAgent.EventType.TimerFire:
         case TimelineAgent.EventType.EventDispatch:
@@ -544,7 +544,7 @@
             }
 
             if (!sourceCodeLocation) {
-                var mainFrame = WebInspector.frameResourceManager.mainFrame;
+                var mainFrame = WI.frameResourceManager.mainFrame;
                 var scriptResource = mainFrame.url === recordPayload.data.scriptName ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.scriptName, true);
                 if (scriptResource) {
                     // The lineNumber is 1-based, but we expect 0-based.
@@ -560,19 +560,19 @@
             var record;
             switch (parentRecordPayload.type) {
             case TimelineAgent.EventType.TimerFire:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId, profileData);
                 break;
             case TimelineAgent.EventType.EventDispatch:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type, profileData);
                 break;
             case TimelineAgent.EventType.FireAnimationFrame:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.AnimationFrameFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
                 break;
             case TimelineAgent.EventType.FunctionCall:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
                 break;
             case TimelineAgent.EventType.RenderingFrame:
-                record = new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
+                record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
                 break;
 
             default:
@@ -588,33 +588,33 @@
 
         case TimelineAgent.EventType.ProbeSample:
             // Pass the startTime as the endTime since this record type has no duration.
-            sourceCodeLocation = WebInspector.probeManager.probeForIdentifier(recordPayload.data.probeId).breakpoint.sourceCodeLocation;
-            return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.probeId);
+            sourceCodeLocation = WI.probeManager.probeForIdentifier(recordPayload.data.probeId).breakpoint.sourceCodeLocation;
+            return new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ProbeSampleRecorded, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.probeId);
 
         case TimelineAgent.EventType.TimerInstall:
             console.assert(isNaN(endTime));
 
             // Pass the startTime as the endTime since this record type has no duration.
             var timerDetails = {timerId: recordPayload.data.timerId, timeout: recordPayload.data.timeout, repeating: !recordPayload.data.singleShot};
-            return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerInstalled, startTime, startTime, callFrames, sourceCodeLocation, timerDetails);
+            return new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.TimerInstalled, startTime, startTime, callFrames, sourceCodeLocation, timerDetails);
 
         case TimelineAgent.EventType.TimerRemove:
             console.assert(isNaN(endTime));
 
             // Pass the startTime as the endTime since this record type has no duration.
-            return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerRemoved, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId);
+            return new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.TimerRemoved, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId);
 
         case TimelineAgent.EventType.RequestAnimationFrame:
             console.assert(isNaN(endTime));
 
             // Pass the startTime as the endTime since this record type has no duration.
-            return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.id);
+            return new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.AnimationFrameRequested, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.id);
 
         case TimelineAgent.EventType.CancelAnimationFrame:
             console.assert(isNaN(endTime));
 
             // Pass the startTime as the endTime since this record type has no duration.
-            return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.id);
+            return new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.AnimationFrameCanceled, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.id);
 
         default:
             console.error("Missing handling of Timeline Event Type: " + recordPayload.type);
@@ -628,7 +628,7 @@
         switch (recordPayload.type) {
         case TimelineAgent.EventType.TimeStamp:
             var timestamp = this.activeRecording.computeElapsedTime(recordPayload.startTime);
-            var eventMarker = new WebInspector.TimelineMarker(timestamp, WebInspector.TimelineMarker.Type.TimeStamp, recordPayload.data.message);
+            var eventMarker = new WI.TimelineMarker(timestamp, WI.TimelineMarker.Type.TimeStamp, recordPayload.data.message);
             this._activeRecording.addEventMarker(eventMarker);
             break;
 
@@ -650,12 +650,12 @@
         if (this._activeRecording && this._activeRecording.isEmpty())
             return;
 
-        let instruments = this.enabledTimelineTypes.map((type) => WebInspector.Instrument.createForTimelineType(type));
+        let instruments = this.enabledTimelineTypes.map((type) => WI.Instrument.createForTimelineType(type));
         let identifier = this._nextRecordingIdentifier++;
-        let newRecording = new WebInspector.TimelineRecording(identifier, WebInspector.UIString("Timeline Recording %d").format(identifier), instruments);
+        let newRecording = new WI.TimelineRecording(identifier, WI.UIString("Timeline Recording %d").format(identifier), instruments);
 
         this._recordings.push(newRecording);
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingCreated, {recording: newRecording});
+        this.dispatchEventToListeners(WI.TimelineManager.Event.RecordingCreated, {recording: newRecording});
 
         if (this._isCapturing)
             this.stopCapturing();
@@ -671,13 +671,13 @@
         // Now that we have navigated, we should reset the legacy base timestamp and the
         // will send request timestamp for the new main resource. This way, all new timeline
         // records will be computed relative to the new navigation.
-        if (this._mainResourceForAutoCapturing && WebInspector.TimelineRecording.isLegacy) {
+        if (this._mainResourceForAutoCapturing && WI.TimelineRecording.isLegacy) {
             console.assert(this._mainResourceForAutoCapturing.originalRequestWillBeSentTimestamp);
             this._activeRecording.setLegacyBaseTimestamp(this._mainResourceForAutoCapturing.originalRequestWillBeSentTimestamp);
             this._mainResourceForAutoCapturing._requestSentTimestamp = 0;
         }
 
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingLoaded, {oldRecording});
+        this.dispatchEventToListeners(WI.TimelineManager.Event.RecordingLoaded, {oldRecording});
     }
 
     _callFramesFromPayload(payload)
@@ -685,7 +685,7 @@
         if (!payload)
             return null;
 
-        return payload.map((x) => WebInspector.CallFrame.fromPayload(WebInspector.assumingMainTarget(), x));
+        return payload.map((x) => WI.CallFrame.fromPayload(WI.assumingMainTarget(), x));
     }
 
     _addRecord(record)
@@ -693,7 +693,7 @@
         this._activeRecording.addRecord(record);
 
         // Only worry about dead time after the load event.
-        if (WebInspector.frameResourceManager.mainFrame && isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp))
+        if (WI.frameResourceManager.mainFrame && isNaN(WI.frameResourceManager.mainFrame.loadEventTimestamp))
             this._resetAutoRecordingDeadTimeTimeout();
     }
 
@@ -724,7 +724,7 @@
 
         this._mainResourceForAutoCapturing = mainResource;
 
-        this._addRecord(new WebInspector.ResourceTimelineRecord(mainResource));
+        this._addRecord(new WI.ResourceTimelineRecord(mainResource));
 
         this._resetAutoRecordingMaxTimeTimeout();
 
@@ -754,7 +754,7 @@
 
         this.startCapturing();
 
-        this._addRecord(new WebInspector.ResourceTimelineRecord(mainResource));
+        this._addRecord(new WI.ResourceTimelineRecord(mainResource));
 
         this._resetAutoRecordingMaxTimeTimeout();
 
@@ -769,14 +769,14 @@
 
         if (this._stopCapturingTimeout)
             clearTimeout(this._stopCapturingTimeout);
-        this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent);
+        this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WI.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent);
     }
 
     _resetAutoRecordingMaxTimeTimeout()
     {
         if (this._stopCapturingTimeout)
             clearTimeout(this._stopCapturingTimeout);
-        this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.MaximumAutoRecordDuration);
+        this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WI.TimelineManager.MaximumAutoRecordDuration);
     }
 
     _resetAutoRecordingDeadTimeTimeout()
@@ -793,7 +793,7 @@
 
         if (this._deadTimeTimeout)
             clearTimeout(this._deadTimeTimeout);
-        this._deadTimeTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly);
+        this._deadTimeTimeout = setTimeout(this._boundStopCapturing, WI.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly);
     }
 
     _provisionalLoadStarted(event)
@@ -804,17 +804,17 @@
     _mainResourceDidChange(event)
     {
         let frame = event.target;
-        if (frame.isMainFrame() && WebInspector.settings.clearNetworkOnNavigate.value)
+        if (frame.isMainFrame() && WI.settings.clearNetworkOnNavigate.value)
             this._persistentNetworkTimeline.reset();
 
         let mainResource = frame.mainResource;
-        let record = new WebInspector.ResourceTimelineRecord(mainResource);
+        let record = new WI.ResourceTimelineRecord(mainResource);
         if (!isNaN(record.startTime))
             this._persistentNetworkTimeline.addRecord(record);
 
         // Ignore resource events when there isn't a main frame yet. Those events are triggered by
         // loading the cached resources when the inspector opens, and they do not have timing information.
-        if (!WebInspector.frameResourceManager.mainFrame)
+        if (!WI.frameResourceManager.mainFrame)
             return;
 
         if (this._attemptAutoCapturingForFrame(frame))
@@ -831,13 +831,13 @@
 
     _resourceWasAdded(event)
     {
-        var record = new WebInspector.ResourceTimelineRecord(event.data.resource);
+        var record = new WI.ResourceTimelineRecord(event.data.resource);
         if (!isNaN(record.startTime))
             this._persistentNetworkTimeline.addRecord(record);
 
         // Ignore resource events when there isn't a main frame yet. Those events are triggered by
         // loading the cached resources when the inspector opens, and they do not have timing information.
-        if (!WebInspector.frameResourceManager.mainFrame)
+        if (!WI.frameResourceManager.mainFrame)
             return;
 
         if (!this._isCapturing)
@@ -852,7 +852,7 @@
             return;
 
         let collection = event.data.collection;
-        this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.GarbageCollected, collection.startTime, collection.endTime, null, null, collection));
+        this._addRecord(new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.GarbageCollected, collection.startTime, collection.endTime, null, null, collection));
     }
 
     _memoryPressure(event)
@@ -867,18 +867,18 @@
     {
         switch (type) {
         case ScriptProfilerAgent.EventType.API:
-            return WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated;
+            return WI.ScriptTimelineRecord.EventType.APIScriptEvaluated;
         case ScriptProfilerAgent.EventType.Microtask:
-            return WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched;
+            return WI.ScriptTimelineRecord.EventType.MicrotaskDispatched;
         case ScriptProfilerAgent.EventType.Other:
-            return WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated;
+            return WI.ScriptTimelineRecord.EventType.ScriptEvaluated;
         }
     }
 
     scriptProfilerProgrammaticCaptureStarted()
     {
         // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
-        console.assert(WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript);
+        console.assert(WI.debuggableType === WI.DebuggableType.JavaScript);
         console.assert(!this._isCapturing);
 
         this.programmaticCaptureStarted();
@@ -887,7 +887,7 @@
     scriptProfilerProgrammaticCaptureStopped()
     {
         // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
-        console.assert(WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript);
+        console.assert(WI.debuggableType === WI.DebuggableType.JavaScript);
         console.assert(this._isCapturing);
 
         this.programmaticCaptureStopped();
@@ -904,7 +904,7 @@
     {
         let {startTime, endTime, type} = event;
         let scriptRecordType = this._scriptProfilerTypeToScriptTimelineRecordType(type);
-        let record = new WebInspector.ScriptTimelineRecord(scriptRecordType, startTime, endTime, null, null, null, null);
+        let record = new WI.ScriptTimelineRecord(scriptRecordType, startTime, endTime, null, null, null, null);
         record.__scriptProfilerType = type;
         this._scriptProfilerRecords.push(record);
 
@@ -977,14 +977,14 @@
 
         // Associate the ScriptProfiler created records with Web Timeline records.
         // Filter out the already added ScriptProfiler events which should not have been wrapped.
-        if (WebInspector.debuggableType !== WebInspector.DebuggableType.JavaScript) {
+        if (WI.debuggableType !== WI.DebuggableType.JavaScript) {
             this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
             this._mergeScriptProfileRecords();
         }
 
         this._scriptProfilerRecords = null;
 
-        let timeline = this.activeRecording.timelineForRecordType(WebInspector.TimelineRecord.Type.Script);
+        let timeline = this.activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
         timeline.refresh();
     }
 
@@ -1002,7 +1002,7 @@
 
         while (webRecord && profilerRecord) {
             // Skip web records with parent web records. For example an EvaluateScript with an EvaluateScript parent.
-            if (webRecord.parent instanceof WebInspector.ScriptTimelineRecord) {
+            if (webRecord.parent instanceof WI.ScriptTimelineRecord) {
                 console.assert(recordEnclosesRecord(webRecord.parent, webRecord), "Timeline Record incorrectly wrapping another Timeline Record");
                 webRecord = nextWebTimelineRecord();
                 continue;
@@ -1057,18 +1057,18 @@
 
         for (let timelineType of enabledTimelineTypes) {
             switch (timelineType) {
-            case WebInspector.TimelineRecord.Type.Script:
+            case WI.TimelineRecord.Type.Script:
                 instrumentSet.add(TimelineAgent.Instrument.ScriptProfiler);
                 break;
-            case WebInspector.TimelineRecord.Type.HeapAllocations:
+            case WI.TimelineRecord.Type.HeapAllocations:
                 instrumentSet.add(TimelineAgent.Instrument.Heap);
                 break;
-            case WebInspector.TimelineRecord.Type.Network:
-            case WebInspector.TimelineRecord.Type.RenderingFrame:
-            case WebInspector.TimelineRecord.Type.Layout:
+            case WI.TimelineRecord.Type.Network:
+            case WI.TimelineRecord.Type.RenderingFrame:
+            case WI.TimelineRecord.Type.Layout:
                 instrumentSet.add(TimelineAgent.Instrument.Timeline);
                 break;
-            case WebInspector.TimelineRecord.Type.Memory:
+            case WI.TimelineRecord.Type.Memory:
                 instrumentSet.add(TimelineAgent.Instrument.Memory);
                 break;
             }
@@ -1078,7 +1078,7 @@
     }
 };
 
-WebInspector.TimelineManager.Event = {
+WI.TimelineManager.Event = {
     RecordingCreated: "timeline-manager-recording-created",
     RecordingLoaded: "timeline-manager-recording-loaded",
     CapturingWillStart: "timeline-manager-capturing-will-start",
@@ -1086,6 +1086,6 @@
     CapturingStopped: "timeline-manager-capturing-stopped"
 };
 
-WebInspector.TimelineManager.MaximumAutoRecordDuration = 90000; // 90 seconds
-WebInspector.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent = 10000; // 10 seconds
-WebInspector.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly = 2000; // 2 seconds
+WI.TimelineManager.MaximumAutoRecordDuration = 90000; // 90 seconds
+WI.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent = 10000; // 10 seconds
+WI.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly = 2000; // 2 seconds
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js b/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js
index 7b820bb..bf1cc01 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TypeTokenAnnotator = class TypeTokenAnnotator extends WebInspector.Annotator
+WI.TypeTokenAnnotator = class TypeTokenAnnotator extends WI.Annotator
 {
     constructor(sourceCodeTextEditor, script)
     {
@@ -84,9 +84,9 @@
 
     _insertTypeToken(node)
     {
-        if (node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier) {
+        if (node.type === WI.ScriptSyntaxTree.NodeType.Identifier) {
             if (!node.attachments.__typeToken && node.attachments.types && node.attachments.types.valid)
-                this._insertToken(node.range[0], node, false, WebInspector.TypeTokenView.TitleType.Variable, node.name);
+                this._insertToken(node.range[0], node, false, WI.TypeTokenView.TitleType.Variable, node.name);
 
             if (node.attachments.__typeToken)
                 node.attachments.__typeToken.update(node.attachments.types);
@@ -94,7 +94,7 @@
             return;
         }
 
-        console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression || node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+        console.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression || node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
 
         var functionReturnType = node.attachments.returnTypes;
         if (!functionReturnType || !functionReturnType.valid)
@@ -103,9 +103,9 @@
         // If a function does not have an explicit return statement with an argument (i.e, "return x;" instead of "return;")
         // then don't show a return type unless we think it's a constructor.
         var scriptSyntaxTree = this._script._scriptSyntaxTree;
-        if (!node.attachments.__typeToken && (scriptSyntaxTree.containsNonEmptyReturnStatement(node.body) || !functionReturnType.typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Undefined))) {
+        if (!node.attachments.__typeToken && (scriptSyntaxTree.containsNonEmptyReturnStatement(node.body) || !functionReturnType.typeSet.isContainedIn(WI.TypeSet.TypeBit.Undefined))) {
             var functionName = node.id ? node.id.name : null;
-            this._insertToken(node.typeProfilingReturnDivot, node, true, WebInspector.TypeTokenView.TitleType.ReturnStatement, functionName);
+            this._insertToken(node.typeProfilingReturnDivot, node, true, WI.TypeTokenView.TitleType.ReturnStatement, functionName);
         }
 
         if (node.attachments.__typeToken)
@@ -130,7 +130,7 @@
         var isSpaceRegexp = /\s/;
         var shouldHaveLeftMargin = currentOffset !== 0 && !isSpaceRegexp.test(sourceString[currentOffset - 1]);
         var shouldHaveRightMargin = !isSpaceRegexp.test(sourceString[currentOffset]);
-        var typeToken = new WebInspector.TypeTokenView(this, shouldHaveRightMargin, shouldHaveLeftMargin, typeTokenTitleType, functionOrVariableName);
+        var typeToken = new WI.TypeTokenView(this, shouldHaveRightMargin, shouldHaveLeftMargin, typeTokenTitleType, functionOrVariableName);
         var bookmark = this.sourceCodeTextEditor.setInlineWidget(tokenPosition, typeToken.element);
         node.attachments.__typeToken = typeToken;
         this._typeTokenNodes.push(node);
@@ -146,7 +146,7 @@
         var isMultiLineComment = false;
         var isSingleLineComment = false;
         var shouldIgnore = false;
-        const isArrowFunction = node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;
+        const isArrowFunction = node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;
 
         function isLineTerminator(char)
         {
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/VisualStyleCompletionsController.js b/Source/WebInspectorUI/UserInterface/Controllers/VisualStyleCompletionsController.js
index d2a40b9..33e96b7 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/VisualStyleCompletionsController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/VisualStyleCompletionsController.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleCompletionsController = class VisualStyleCompletionsController extends WebInspector.Object
+WI.VisualStyleCompletionsController = class VisualStyleCompletionsController extends WI.Object
 {
     constructor(delegate)
     {
         super();
 
         this._delegate = delegate || null;
-        this._suggestionsView = new WebInspector.CompletionSuggestionsView(this);
+        this._suggestionsView = new WI.CompletionSuggestionsView(this);
         this._completions = null;
         this._currentCompletions = [];
         this._selectedCompletionIndex = 0;
@@ -70,7 +70,7 @@
     completionSuggestionsClickedCompletion(suggestionsView, text)
     {
         suggestionsView.hide();
-        this.dispatchEventToListeners(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected, {text});
+        this.dispatchEventToListeners(WI.VisualStyleCompletionsController.Event.CompletionSelected, {text});
     }
 
     previous()
@@ -127,6 +127,6 @@
     }
 };
 
-WebInspector.VisualStyleCompletionsController.Event = {
+WI.VisualStyleCompletionsController.Event = {
     CompletionSelected: "visual-style-completions-controller-completion-selected"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js
index 99cd3f6..029eb54 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WorkerManager = class WorkerManager extends WebInspector.Object
+WI.WorkerManager = class WorkerManager extends WI.Object
 {
     constructor()
     {
@@ -40,8 +40,8 @@
     workerCreated(workerId, url)
     {
         let connection = new InspectorBackend.WorkerConnection(workerId);
-        let workerTarget = new WebInspector.WorkerTarget(workerId, url, connection);
-        WebInspector.targetManager.addTarget(workerTarget);
+        let workerTarget = new WI.WorkerTarget(workerId, url, connection);
+        WI.targetManager.addTarget(workerTarget);
 
         this._connections.set(workerId, connection);
 
@@ -53,7 +53,7 @@
     {
         let connection = this._connections.take(workerId);
 
-        WebInspector.targetManager.removeTarget(connection.target);
+        WI.targetManager.removeTarget(connection.target);
     }
 
     dispatchMessageFromWorker(workerId, message)
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/XHRBreakpointTreeController.js b/Source/WebInspectorUI/UserInterface/Controllers/XHRBreakpointTreeController.js
index f8c8951..6578563 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/XHRBreakpointTreeController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/XHRBreakpointTreeController.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.XHRBreakpointTreeController = class XHRBreakpointsTreeController extends WebInspector.Object
+WI.XHRBreakpointTreeController = class XHRBreakpointsTreeController extends WI.Object
 {
     constructor(treeOutline)
     {
@@ -31,14 +31,14 @@
 
         this._treeOutline = treeOutline;
 
-        WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.XHRBreakpointAdded, this._xhrBreakpointAdded, this);
-        WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.XHRBreakpointRemoved, this._xhrBreakpointRemoved, this);
+        WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.XHRBreakpointAdded, this._xhrBreakpointAdded, this);
+        WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.XHRBreakpointRemoved, this._xhrBreakpointRemoved, this);
 
-        this._allReqestsBreakpointTreeElement = new WebInspector.XHRBreakpointTreeElement(WebInspector.domDebuggerManager.allRequestsBreakpoint, WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName, WebInspector.UIString("All Requests"));
+        this._allReqestsBreakpointTreeElement = new WI.XHRBreakpointTreeElement(WI.domDebuggerManager.allRequestsBreakpoint, WI.DebuggerSidebarPanel.AssertionIconStyleClassName, WI.UIString("All Requests"));
 
         this._treeOutline.appendChild(this._allReqestsBreakpointTreeElement);
 
-        for (let breakpoint of WebInspector.domDebuggerManager.xhrBreakpoints)
+        for (let breakpoint of WI.domDebuggerManager.xhrBreakpoints)
             this._addTreeElement(breakpoint);
     }
 
@@ -55,8 +55,8 @@
 
     disconnect()
     {
-        WebInspector.Frame.removeEventListener(null, null, this);
-        WebInspector.domDebuggerManager.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
+        WI.domDebuggerManager.removeEventListener(null, null, this);
     }
 
     // Private
@@ -83,6 +83,6 @@
         if (treeElement)
             return;
 
-        this._treeOutline.appendChild(new WebInspector.XHRBreakpointTreeElement(breakpoint));
+        this._treeOutline.appendChild(new WI.XHRBreakpointTreeElement(breakpoint));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js b/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js
index 9b15873..8de3617 100644
--- a/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js
+++ b/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js
@@ -24,40 +24,40 @@
  */
 
 // This function is invoked after the inspector has loaded.
-WebInspector.runBootstrapOperations = function() {
-    WebInspector.showDebugUISetting = new WebInspector.Setting("show-debug-ui", false);
+WI.runBootstrapOperations = function() {
+    WI.showDebugUISetting = new WI.Setting("show-debug-ui", false);
 
     // Toggle Debug UI setting.
-    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "D", () => {
-        WebInspector.showDebugUISetting.value = !WebInspector.showDebugUISetting.value;
+    new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "D", () => {
+        WI.showDebugUISetting.value = !WI.showDebugUISetting.value;
     });
 
     // Reload the Web Inspector.
-    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "R", () => {
+    new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "R", () => {
         window.location.reload();
     });
 
-    const toolTip = WebInspector.unlocalizedString("Enable dump inspector messages to console");
-    const activatedToolTip = WebInspector.unlocalizedString("Disable dump inspector messages to console");
-    let debugInspectorToolbarButton = new WebInspector.ActivateButtonToolbarItem("debug-inspector", toolTip, activatedToolTip, null, "Images/Console.svg");
+    const toolTip = WI.unlocalizedString("Enable dump inspector messages to console");
+    const activatedToolTip = WI.unlocalizedString("Disable dump inspector messages to console");
+    let debugInspectorToolbarButton = new WI.ActivateButtonToolbarItem("debug-inspector", toolTip, activatedToolTip, null, "Images/Console.svg");
     debugInspectorToolbarButton.activated = InspectorBackend.dumpInspectorProtocolMessages;
-    WebInspector.toolbar.addToolbarItem(debugInspectorToolbarButton, WebInspector.Toolbar.Section.CenterRight);
-    debugInspectorToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, () => {
+    WI.toolbar.addToolbarItem(debugInspectorToolbarButton, WI.Toolbar.Section.CenterRight);
+    debugInspectorToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, () => {
         InspectorBackend.dumpInspectorProtocolMessages = !InspectorBackend.dumpInspectorProtocolMessages;
         debugInspectorToolbarButton.activated = InspectorBackend.dumpInspectorProtocolMessages;
     });
-    WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed, () => {
+    WI.settings.autoLogProtocolMessages.addEventListener(WI.Setting.Event.Changed, () => {
         debugInspectorToolbarButton.activated = InspectorBackend.dumpInspectorProtocolMessages;
     });
 
     function updateDebugUI()
     {
-        debugInspectorToolbarButton.hidden = !WebInspector.showDebugUISetting.value;
+        debugInspectorToolbarButton.hidden = !WI.showDebugUISetting.value;
     }
 
-    WebInspector.showDebugUISetting.addEventListener(WebInspector.Setting.Event.Changed, () => {
+    WI.showDebugUISetting.addEventListener(WI.Setting.Event.Changed, () => {
         updateDebugUI();
-        WebInspector.notifications.dispatchEventToListeners(WebInspector.Notification.DebugUIEnabledDidChange);
+        WI.notifications.dispatchEventToListeners(WI.Notification.DebugUIEnabledDidChange);
     });
 
     updateDebugUI();
diff --git a/Source/WebInspectorUI/UserInterface/Debug/CapturingProtocolTracer.js b/Source/WebInspectorUI/UserInterface/Debug/CapturingProtocolTracer.js
index f44754a..d747186f 100644
--- a/Source/WebInspectorUI/UserInterface/Debug/CapturingProtocolTracer.js
+++ b/Source/WebInspectorUI/UserInterface/Debug/CapturingProtocolTracer.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CapturingProtocolTracer = class CapturingProtocolTracer extends WebInspector.ProtocolTracer
+WI.CapturingProtocolTracer = class CapturingProtocolTracer extends WI.ProtocolTracer
 {
     constructor()
     {
         super();
 
-        this._trace = new WebInspector.ProtocolTrace;
+        this._trace = new WI.ProtocolTrace;
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js b/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js
index 4390ec1..628be12 100644
--- a/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js
+++ b/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProtocolTrace = class ProtocolTrace
+WI.ProtocolTrace = class ProtocolTrace
 {
     constructor()
     {
@@ -50,7 +50,7 @@
         // This follows the file name of screen shots on OS X (en-US):
         // "Protocol Trace 2015-12-31 at 12.43.04.json".
         // When the Intl API is implemented, we can do a better job.
-        let filename = WebInspector.unlocalizedString(`Protocol Trace at ${YYYY}-${MM}-${DD} ${hh}.${mm}.${ss}.json`);
+        let filename = WI.unlocalizedString(`Protocol Trace at ${YYYY}-${MM}-${DD} ${hh}.${mm}.${ss}.json`);
         return {url: "web-inspector:///" + encodeURIComponent(filename), content: JSON.stringify(this._entries)};
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js b/Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js
index 3766a36..e8365a0 100644
--- a/Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js
+++ b/Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js
@@ -72,7 +72,7 @@
 }
 
 function handleUncaughtExceptionRecord(exceptionRecord) {
-    if (!WebInspector.settings.enableUncaughtExceptionReporter.value)
+    if (!WI.settings.enableUncaughtExceptionReporter.value)
         return;
 
     if (!window.__uncaughtExceptions)
@@ -87,7 +87,7 @@
     if (!loadCompleted || isFirstException)
         window.__uncaughtExceptions.push(exceptionRecord);
 
-    // If WebInspector.contentLoaded throws an uncaught exception, then these
+    // If WI.contentLoaded throws an uncaught exception, then these
     // listeners will not work correctly because the UI is not fully loaded.
     // Prevent any event handlers from running in an inconsistent state.
     if (isFirstException)
@@ -115,7 +115,7 @@
     window.__uncaughtExceptions = [];
 
     // Do this last in case WebInspector's internal state is corrupted.
-    WebInspector.updateWindowTitle();
+    WI.updateWindowTitle();
 
     // FIXME (151959): tell the frontend host to hide a draggable title bar.
 }
@@ -181,7 +181,7 @@
 
     let inspectedPageURL = null;
     try {
-        inspectedPageURL = WebInspector.frameResourceManager.mainFrame.url;
+        inspectedPageURL = WI.frameResourceManager.mainFrame.url;
     } catch (e) { }
 
     let topLevelItems = [
diff --git a/Source/WebInspectorUI/UserInterface/Main.html b/Source/WebInspectorUI/UserInterface/Main.html
index b8ede32..980ca25 100644
--- a/Source/WebInspectorUI/UserInterface/Main.html
+++ b/Source/WebInspectorUI/UserInterface/Main.html
@@ -798,7 +798,7 @@
     <script src="Debug/ProtocolTrace.js"></script>
 
     <script>
-        WebInspector.loaded();
+        WI.loaded();
     </script>
 </head>
 <body>
diff --git a/Source/WebInspectorUI/UserInterface/Models/AnalyzerMessage.js b/Source/WebInspectorUI/UserInterface/Models/AnalyzerMessage.js
index 4a74338..912560a 100644
--- a/Source/WebInspectorUI/UserInterface/Models/AnalyzerMessage.js
+++ b/Source/WebInspectorUI/UserInterface/Models/AnalyzerMessage.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.AnalyzerMessage = class AnalyzerMessage
+WI.AnalyzerMessage = class AnalyzerMessage
 {
     constructor(sourceCodeLocation, text, ruleIdentifier)
     {
-        console.assert(sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
+        console.assert(sourceCodeLocation instanceof WI.SourceCodeLocation);
         console.assert(typeof text === "string");
 
         this._sourceCodeLocation = sourceCodeLocation;
diff --git a/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js b/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js
index f16a5b1..90d3965 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheFrame = class ApplicationCacheFrame
+WI.ApplicationCacheFrame = class ApplicationCacheFrame
 {
     constructor(frame, manifest, status)
     {
-        console.assert(frame instanceof WebInspector.Frame);
-        console.assert(manifest instanceof WebInspector.ApplicationCacheManifest);
+        console.assert(frame instanceof WI.Frame);
+        console.assert(manifest instanceof WI.ApplicationCacheManifest);
 
         this._frame = frame;
         this._manifest = manifest;
@@ -44,11 +44,11 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.ApplicationCacheFrame.FrameURLCookieKey] = this.frame.url;
-        cookie[WebInspector.ApplicationCacheFrame.ManifestURLCookieKey] = this.manifest.manifestURL;
+        cookie[WI.ApplicationCacheFrame.FrameURLCookieKey] = this.frame.url;
+        cookie[WI.ApplicationCacheFrame.ManifestURLCookieKey] = this.manifest.manifestURL;
     }
 };
 
-WebInspector.ApplicationCacheFrame.TypeIdentifier = "application-cache-frame";
-WebInspector.ApplicationCacheFrame.FrameURLCookieKey = "application-cache-frame-url";
-WebInspector.ApplicationCacheFrame.ManifestURLCookieKey = "application-cache-frame-manifest-url";
+WI.ApplicationCacheFrame.TypeIdentifier = "application-cache-frame";
+WI.ApplicationCacheFrame.FrameURLCookieKey = "application-cache-frame-url";
+WI.ApplicationCacheFrame.ManifestURLCookieKey = "application-cache-frame-manifest-url";
diff --git a/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheManifest.js b/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheManifest.js
index 5d021de..d8b69ca 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheManifest.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ApplicationCacheManifest.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheManifest = class ApplicationCacheManifest
+WI.ApplicationCacheManifest = class ApplicationCacheManifest
 {
     constructor(manifestURL)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/BackForwardEntry.js b/Source/WebInspectorUI/UserInterface/Models/BackForwardEntry.js
index 9621fb3..34ac1e6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/BackForwardEntry.js
+++ b/Source/WebInspectorUI/UserInterface/Models/BackForwardEntry.js
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BackForwardEntry = class BackForwardEntry
+WI.BackForwardEntry = class BackForwardEntry
 {
     constructor(contentView, cookie)
     {
@@ -46,7 +46,7 @@
 
     makeCopy(newCookie)
     {
-        let copy = new WebInspector.BackForwardEntry(this._contentView, newCookie || this.cookie);
+        let copy = new WI.BackForwardEntry(this._contentView, newCookie || this.cookie);
         copy._tombstone = this._tombstone;
         copy._scrollPositions = this._scrollPositions.slice();
         return copy;
diff --git a/Source/WebInspectorUI/UserInterface/Models/Branch.js b/Source/WebInspectorUI/UserInterface/Models/Branch.js
index 2abfbf7..6a8a41e 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Branch.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Branch.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Branch = class Branch
+WI.Branch = class Branch
 {
     constructor(displayName, revisions, locked)
     {
@@ -64,14 +64,14 @@
     {
         for (var i = 0; i < this._revisions.length; ++i) {
             var revision = this._revisions[i];
-            if (revision instanceof WebInspector.SourceCodeRevision && revision.sourceCode === representedObject)
+            if (revision instanceof WI.SourceCodeRevision && revision.sourceCode === representedObject)
                 return revision;
         }
 
         if (doNotCreateIfNeeded)
             return null;
 
-        if (representedObject instanceof WebInspector.SourceCode) {
+        if (representedObject instanceof WI.SourceCode) {
             var revision = representedObject.originalRevision.copy();
             representedObject.currentRevision = revision;
             this.addRevision(revision);
@@ -83,7 +83,7 @@
 
     addRevision(revision)
     {
-        console.assert(revision instanceof WebInspector.Revision);
+        console.assert(revision instanceof WI.Revision);
 
         if (this._locked)
             return;
@@ -96,7 +96,7 @@
 
     removeRevision(revision)
     {
-        console.assert(revision instanceof WebInspector.Revision);
+        console.assert(revision instanceof WI.Revision);
 
         if (this._locked)
             return;
@@ -115,7 +115,7 @@
     fork(displayName)
     {
         var copiedRevisions = this._revisions.map(function(revision) { return revision.copy(); });
-        return new WebInspector.Branch(displayName, copiedRevisions);
+        return new WI.Branch(displayName, copiedRevisions);
     }
 
     apply()
diff --git a/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js b/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
index 03f85de..90b98cc 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
@@ -23,33 +23,33 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Breakpoint = class Breakpoint extends WebInspector.Object
+WI.Breakpoint = class Breakpoint extends WI.Object
 {
     constructor(sourceCodeLocationOrInfo, disabled, condition)
     {
         super();
 
-        if (sourceCodeLocationOrInfo instanceof WebInspector.SourceCodeLocation) {
+        if (sourceCodeLocationOrInfo instanceof WI.SourceCodeLocation) {
             var sourceCode = sourceCodeLocationOrInfo.sourceCode;
             var contentIdentifier = sourceCode ? sourceCode.contentIdentifier : null;
-            var scriptIdentifier = sourceCode instanceof WebInspector.Script ? sourceCode.id : null;
-            var target = sourceCode instanceof WebInspector.Script ? sourceCode.target : null;
+            var scriptIdentifier = sourceCode instanceof WI.Script ? sourceCode.id : null;
+            var target = sourceCode instanceof WI.Script ? sourceCode.target : null;
             var location = sourceCodeLocationOrInfo;
         } else if (sourceCodeLocationOrInfo && typeof sourceCodeLocationOrInfo === "object") {
             // The 'url' fallback is for transitioning from older frontends and should be removed.
             var contentIdentifier = sourceCodeLocationOrInfo.contentIdentifier || sourceCodeLocationOrInfo.url;
             var lineNumber = sourceCodeLocationOrInfo.lineNumber || 0;
             var columnNumber = sourceCodeLocationOrInfo.columnNumber || 0;
-            var location = new WebInspector.SourceCodeLocation(null, lineNumber, columnNumber);
+            var location = new WI.SourceCodeLocation(null, lineNumber, columnNumber);
             var ignoreCount = sourceCodeLocationOrInfo.ignoreCount || 0;
             var autoContinue = sourceCodeLocationOrInfo.autoContinue || false;
             var actions = sourceCodeLocationOrInfo.actions || [];
             for (var i = 0; i < actions.length; ++i)
-                actions[i] = new WebInspector.BreakpointAction(this, actions[i]);
+                actions[i] = new WI.BreakpointAction(this, actions[i]);
             disabled = sourceCodeLocationOrInfo.disabled;
             condition = sourceCodeLocationOrInfo.condition;
         } else
-            console.error("Unexpected type passed to WebInspector.Breakpoint", sourceCodeLocationOrInfo);
+            console.error("Unexpected type passed to WI.Breakpoint", sourceCodeLocationOrInfo);
 
         this._id = null;
         this._contentIdentifier = contentIdentifier || null;
@@ -63,8 +63,8 @@
         this._resolved = false;
 
         this._sourceCodeLocation = location;
-        this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationLocationChanged, this);
-        this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
+        this._sourceCodeLocation.addEventListener(WI.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationLocationChanged, this);
+        this._sourceCodeLocation.addEventListener(WI.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
     }
 
     // Public
@@ -111,14 +111,14 @@
 
         function isSpecialBreakpoint()
         {
-            return this._sourceCodeLocation.isEqual(new WebInspector.SourceCodeLocation(null, Infinity, Infinity));
+            return this._sourceCodeLocation.isEqual(new WI.SourceCodeLocation(null, Infinity, Infinity));
         }
 
         console.assert(!resolved || this._sourceCodeLocation.sourceCode || isSpecialBreakpoint.call(this), "Breakpoints must have a SourceCode to be resolved.", this);
 
         this._resolved = resolved || false;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ResolvedStateDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ResolvedStateDidChange);
     }
 
     get disabled()
@@ -133,7 +133,7 @@
 
         this._disabled = disabled || false;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.DisabledStateDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.DisabledStateDidChange);
     }
 
     get condition()
@@ -148,7 +148,7 @@
 
         this._condition = condition;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ConditionDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ConditionDidChange);
     }
 
     get ignoreCount()
@@ -167,7 +167,7 @@
 
         this._ignoreCount = ignoreCount;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.IgnoreCountDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.IgnoreCountDidChange);
     }
 
     get autoContinue()
@@ -182,7 +182,7 @@
 
         this._autoContinue = cont;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.AutoContinueDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.AutoContinueDidChange);
     }
 
     get actions()
@@ -218,7 +218,7 @@
     get probeActions()
     {
         return this._actions.filter(function(action) {
-            return action.type === WebInspector.BreakpointAction.Type.Probe;
+            return action.type === WI.BreakpointAction.Type.Probe;
         });
     }
 
@@ -246,7 +246,7 @@
 
     createAction(type, precedingAction, data)
     {
-        var newAction = new WebInspector.BreakpointAction(this, type, data || null);
+        var newAction = new WI.BreakpointAction(this, type, data || null);
 
         if (!precedingAction)
             this._actions.push(newAction);
@@ -259,14 +259,14 @@
                 this._actions.splice(index + 1, 0, newAction);
         }
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ActionsDidChange);
 
         return newAction;
     }
 
     recreateAction(type, actionToReplace)
     {
-        var newAction = new WebInspector.BreakpointAction(this, type, null);
+        var newAction = new WI.BreakpointAction(this, type, null);
 
         var index = this._actions.indexOf(actionToReplace);
         console.assert(index !== -1);
@@ -275,7 +275,7 @@
 
         this._actions[index] = newAction;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ActionsDidChange);
 
         return newAction;
     }
@@ -292,7 +292,7 @@
         if (!this._actions.length)
             this.autoContinue = false;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ActionsDidChange);
     }
 
     clearActions(type)
@@ -302,14 +302,14 @@
         else
             this._actions = this._actions.filter(function(action) { return action.type !== type; });
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ActionsDidChange);
     }
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.Breakpoint.ContentIdentifierCookieKey] = this.contentIdentifier;
-        cookie[WebInspector.Breakpoint.LineNumberCookieKey] = this.sourceCodeLocation.lineNumber;
-        cookie[WebInspector.Breakpoint.ColumnNumberCookieKey] = this.sourceCodeLocation.columnNumber;
+        cookie[WI.Breakpoint.ContentIdentifierCookieKey] = this.contentIdentifier;
+        cookie[WI.Breakpoint.LineNumberCookieKey] = this.sourceCodeLocation.lineNumber;
+        cookie[WI.Breakpoint.ColumnNumberCookieKey] = this.sourceCodeLocation.columnNumber;
     }
 
     // Protected (Called by BreakpointAction)
@@ -321,7 +321,7 @@
         if (index === -1)
             return;
 
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.ActionsDidChange);
     }
 
     // Private
@@ -336,23 +336,23 @@
 
     _sourceCodeLocationLocationChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.LocationDidChange, event.data);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.LocationDidChange, event.data);
     }
 
     _sourceCodeLocationDisplayLocationChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.Breakpoint.Event.DisplayLocationDidChange, event.data);
+        this.dispatchEventToListeners(WI.Breakpoint.Event.DisplayLocationDidChange, event.data);
     }
 };
 
-WebInspector.Breakpoint.DefaultBreakpointActionType = WebInspector.BreakpointAction.Type.Log;
+WI.Breakpoint.DefaultBreakpointActionType = WI.BreakpointAction.Type.Log;
 
-WebInspector.Breakpoint.TypeIdentifier = "breakpoint";
-WebInspector.Breakpoint.ContentIdentifierCookieKey = "breakpoint-content-identifier";
-WebInspector.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";
-WebInspector.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";
+WI.Breakpoint.TypeIdentifier = "breakpoint";
+WI.Breakpoint.ContentIdentifierCookieKey = "breakpoint-content-identifier";
+WI.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";
+WI.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";
 
-WebInspector.Breakpoint.Event = {
+WI.Breakpoint.Event = {
     DisabledStateDidChange: "breakpoint-disabled-state-did-change",
     ResolvedStateDidChange: "breakpoint-resolved-state-did-change",
     ConditionDidChange: "breakpoint-condition-did-change",
diff --git a/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js b/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js
index e7ed77e..b854741 100644
--- a/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js
+++ b/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BreakpointAction = class BreakpointAction
+WI.BreakpointAction = class BreakpointAction
 {
     constructor(breakpoint, typeOrInfo, data)
     {
@@ -39,10 +39,10 @@
             this._type = typeOrInfo.type;
             this._data = typeOrInfo.data || null;
         } else
-            console.error("Unexpected type passed to WebInspector.BreakpointAction");
+            console.error("Unexpected type passed to WI.BreakpointAction");
 
         console.assert(typeof this._type === "string");
-        this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier();
+        this._id = WI.debuggerManager.nextBreakpointActionIdentifier();
     }
 
     // Public
@@ -75,7 +75,7 @@
     }
 };
 
-WebInspector.BreakpointAction.Type = {
+WI.BreakpointAction.Type = {
     Log: "log",
     Evaluate: "evaluate",
     Sound: "sound",
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js b/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
index 8cab966..67ba4e6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
@@ -31,7 +31,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSCompletions = class CSSCompletions
+WI.CSSCompletions = class CSSCompletions
 {
     constructor(properties, acceptEmptyPrefix)
     {
@@ -79,7 +79,7 @@
 
     static requestCSSCompletions()
     {
-        if (WebInspector.CSSCompletions.cssNameCompletions)
+        if (WI.CSSCompletions.cssNameCompletions)
             return;
 
         function propertyNamesCallback(error, names)
@@ -87,9 +87,9 @@
             if (error)
                 return;
 
-            WebInspector.CSSCompletions.cssNameCompletions = new WebInspector.CSSCompletions(names, false);
+            WI.CSSCompletions.cssNameCompletions = new WI.CSSCompletions(names, false);
 
-            WebInspector.CSSKeywordCompletions.addCustomCompletions(names);
+            WI.CSSKeywordCompletions.addCustomCompletions(names);
 
             // CodeMirror is not included by tests so we shouldn't assume it always exists.
             // If it isn't available we skip MIME type associations.
@@ -119,8 +119,8 @@
             for (var property of names)
                 collectPropertyNameForCodeMirror(property.name);
 
-            for (var propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap) {
-                var keywords = WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName];
+            for (var propertyName in WI.CSSKeywordCompletions._propertyKeywordMap) {
+                var keywords = WI.CSSKeywordCompletions._propertyKeywordMap[propertyName];
                 for (var i = 0; i < keywords.length; ++i) {
                     // Skip numbers, like the ones defined for font-weight.
                     if (!isNaN(Number(keywords[i])))
@@ -129,7 +129,7 @@
                 }
             }
 
-            WebInspector.CSSKeywordCompletions._colors.forEach(function(colorName) {
+            WI.CSSKeywordCompletions._colors.forEach(function(colorName) {
                 colorKeywordsForCodeMirror[nameForCodeMirror(colorName)] = true;
             });
 
@@ -157,8 +157,8 @@
             if (error)
                 return;
 
-            WebInspector.CSSKeywordCompletions.addPropertyCompletionValues("font-family", fontFamilyNames);
-            WebInspector.CSSKeywordCompletions.addPropertyCompletionValues("font", fontFamilyNames);
+            WI.CSSKeywordCompletions.addPropertyCompletionValues("font-family", fontFamilyNames);
+            WI.CSSKeywordCompletions.addPropertyCompletionValues("font", fontFamilyNames);
         }
 
         if (window.CSSAgent) {
@@ -295,4 +295,4 @@
     }
 };
 
-WebInspector.CSSCompletions.cssNameCompletions = null;
+WI.CSSCompletions.cssNameCompletions = null;
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js b/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
index 5a3d151..a86ff73 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
@@ -29,52 +29,52 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSKeywordCompletions = {};
+WI.CSSKeywordCompletions = {};
 
-WebInspector.CSSKeywordCompletions.forProperty = function(propertyName)
+WI.CSSKeywordCompletions.forProperty = function(propertyName)
 {
     let acceptedKeywords = ["initial", "unset", "revert", "var()"];
     let isNotPrefixed = propertyName.charAt(0) !== "-";
 
-    if (propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
-        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]);
-    else if (isNotPrefixed && ("-webkit-" + propertyName) in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
-        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap["-webkit-" + propertyName]);
+    if (propertyName in WI.CSSKeywordCompletions._propertyKeywordMap)
+        acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._propertyKeywordMap[propertyName]);
+    else if (isNotPrefixed && ("-webkit-" + propertyName) in WI.CSSKeywordCompletions._propertyKeywordMap)
+        acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._propertyKeywordMap["-webkit-" + propertyName]);
 
-    if (propertyName in WebInspector.CSSKeywordCompletions._colorAwareProperties)
-        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
-    else if (isNotPrefixed && ("-webkit-" + propertyName) in WebInspector.CSSKeywordCompletions._colorAwareProperties)
-        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
+    if (propertyName in WI.CSSKeywordCompletions._colorAwareProperties)
+        acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors);
+    else if (isNotPrefixed && ("-webkit-" + propertyName) in WI.CSSKeywordCompletions._colorAwareProperties)
+        acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors);
     else if (propertyName.endsWith("color"))
-        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
+        acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors);
 
     // Only suggest "inherit" on inheritable properties even though it is valid on all properties.
-    if (propertyName in WebInspector.CSSKeywordCompletions.InheritedProperties)
+    if (propertyName in WI.CSSKeywordCompletions.InheritedProperties)
         acceptedKeywords.push("inherit");
-    else if (isNotPrefixed && ("-webkit-" + propertyName) in WebInspector.CSSKeywordCompletions.InheritedProperties)
+    else if (isNotPrefixed && ("-webkit-" + propertyName) in WI.CSSKeywordCompletions.InheritedProperties)
         acceptedKeywords.push("inherit");
 
-    if (acceptedKeywords.includes(WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder) && WebInspector.CSSCompletions.cssNameCompletions) {
-        acceptedKeywords.remove(WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder);
-        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSCompletions.cssNameCompletions.values);
+    if (acceptedKeywords.includes(WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder) && WI.CSSCompletions.cssNameCompletions) {
+        acceptedKeywords.remove(WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder);
+        acceptedKeywords = acceptedKeywords.concat(WI.CSSCompletions.cssNameCompletions.values);
     }
 
-    return new WebInspector.CSSCompletions(acceptedKeywords, true);
+    return new WI.CSSCompletions(acceptedKeywords, true);
 };
 
-WebInspector.CSSKeywordCompletions.addCustomCompletions = function(properties)
+WI.CSSKeywordCompletions.addCustomCompletions = function(properties)
 {
     for (var property of properties) {
         if (property.values)
-            WebInspector.CSSKeywordCompletions.addPropertyCompletionValues(property.name, property.values);
+            WI.CSSKeywordCompletions.addPropertyCompletionValues(property.name, property.values);
     }
 };
 
-WebInspector.CSSKeywordCompletions.addPropertyCompletionValues = function(propertyName, newValues)
+WI.CSSKeywordCompletions.addPropertyCompletionValues = function(propertyName, newValues)
 {
-    var existingValues = WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName];
+    var existingValues = WI.CSSKeywordCompletions._propertyKeywordMap[propertyName];
     if (!existingValues) {
-        WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName] = newValues;
+        WI.CSSKeywordCompletions._propertyKeywordMap[propertyName] = newValues;
         return;
     }
 
@@ -84,12 +84,12 @@
     for (var value of newValues)
         union.add(value);
 
-    WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName] = [...union.values()];
+    WI.CSSKeywordCompletions._propertyKeywordMap[propertyName] = [...union.values()];
 };
 
-WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder = "__all-properties__";
+WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder = "__all-properties__";
 
-WebInspector.CSSKeywordCompletions.InheritedProperties = [
+WI.CSSKeywordCompletions.InheritedProperties = [
     "azimuth", "border-collapse", "border-spacing", "caption-side", "clip-rule", "color", "color-interpolation",
     "color-interpolation-filters", "color-rendering", "cursor", "direction", "elevation", "empty-cells", "fill",
     "fill-opacity", "fill-rule", "font", "font-family", "font-size", "font-style", "font-variant", "font-variant-numeric", "font-weight", "font-optical-sizing",
@@ -118,7 +118,7 @@
     "-webkit-overflow-scrolling", "-webkit-touch-callout", "-webkit-tap-highlight-color"
 ].keySet();
 
-WebInspector.CSSKeywordCompletions._colors = [
+WI.CSSKeywordCompletions._colors = [
     "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red",
     "silver", "teal", "white", "yellow", "transparent", "currentcolor", "grey", "aliceblue", "antiquewhite",
     "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blueviolet", "brown", "burlywood", "cadetblue",
@@ -139,7 +139,7 @@
     "wheat", "whitesmoke", "yellowgreen", "rgb()", "rgba()", "hsl()", "hsla()"
 ];
 
-WebInspector.CSSKeywordCompletions._colorAwareProperties = [
+WI.CSSKeywordCompletions._colorAwareProperties = [
     "background", "background-color", "background-image", "border", "border-color", "border-top", "border-right", "border-bottom",
     "border-left", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "box-shadow", "color",
     "fill", "outline", "outline-color", "stroke", "text-line-through", "text-line-through-color", "text-overline", "text-overline-color",
@@ -151,7 +151,7 @@
     "-webkit-tap-highlight-color"
 ].keySet();
 
-WebInspector.CSSKeywordCompletions._propertyKeywordMap = {
+WI.CSSKeywordCompletions._propertyKeywordMap = {
     "table-layout": [
         "auto", "fixed"
     ],
@@ -718,13 +718,13 @@
         "normal", "break-word"
     ],
     "transition": [
-        "none", "ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end", "steps()", "cubic-bezier()", "spring()", "all", WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder
+        "none", "ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end", "steps()", "cubic-bezier()", "spring()", "all", WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder
     ],
     "transition-timing-function": [
         "ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end", "steps()", "cubic-bezier()", "spring()"
     ],
     "transition-property": [
-        "all", "none", WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder
+        "all", "none", WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder
     ],
     "-webkit-column-progression": [
         "normal", "reverse"
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js b/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js
index 3b2cc19..3bd6899 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSMedia.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSMedia = class CSSMedia
+WI.CSSMedia = class CSSMedia
 {
     constructor(type, text, sourceCodeLocation)
     {
-        console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
+        console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WI.SourceCodeLocation);
 
         this._type = type || null;
         this._text = text || "";
@@ -41,7 +41,7 @@
     get sourceCodeLocation() { return this._sourceCodeLocation; }
 };
 
-WebInspector.CSSMedia.Type = {
+WI.CSSMedia.Type = {
     MediaRule: "css-media-type-media-rule",
     ImportRule: "css-media-type-import-rule",
     LinkedStyleSheet: "css-media-type-linked-stylesheet",
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js b/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js
index 860f1ef..2f73aec 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSProperty = class CSSProperty extends WebInspector.Object
+WI.CSSProperty = class CSSProperty extends WI.Object
 {
     constructor(index, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange)
     {
@@ -40,7 +40,7 @@
     static isInheritedPropertyName(name)
     {
         console.assert(typeof name === "string");
-        if (name in WebInspector.CSSKeywordCompletions.InheritedProperties)
+        if (name in WI.CSSKeywordCompletions.InheritedProperties)
             return true;
         // Check if the name is a CSS variable.
         return name.startsWith("--");
@@ -101,7 +101,7 @@
         this._enabled = enabled;
         this._implicit = implicit;
         this._anonymous = anonymous;
-        this._inherited = WebInspector.CSSProperty.isInheritedPropertyName(name);
+        this._inherited = WI.CSSProperty.isInheritedPropertyName(name);
         this._valid = valid;
         this._variable = name.startsWith("--");
         this._styleSheetTextRange = styleSheetTextRange || null;
@@ -115,7 +115,7 @@
         delete this._hasOtherVendorNameOrKeyword;
 
         if (changed)
-            this.dispatchEventToListeners(WebInspector.CSSProperty.Event.Changed);
+            this.dispatchEventToListeners(WI.CSSProperty.Event.Changed);
     }
 
     get synthesizedText()
@@ -140,7 +140,7 @@
         if (this._canonicalName)
             return this._canonicalName;
 
-        this._canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(this.name);
+        this._canonicalName = WI.cssStyleManager.canonicalNameForPropertyName(this.name);
 
         return this._canonicalName;
     }
@@ -156,7 +156,7 @@
 
     get enabled()
     {
-        return this._enabled && this._ownerStyle && (!isNaN(this._index) || this._ownerStyle.type === WebInspector.CSSStyleDeclaration.Type.Computed);
+        return this._enabled && this._ownerStyle && (!isNaN(this._index) || this._ownerStyle.type === WI.CSSStyleDeclaration.Type.Computed);
     }
 
     get overridden() { return this._overridden; }
@@ -181,7 +181,7 @@
             if (this._overridden === previousOverridden)
                 return;
 
-            this.dispatchEventToListeners(WebInspector.CSSProperty.Event.OverriddenStatusChanged);
+            this.dispatchEventToListeners(WI.CSSProperty.Event.OverriddenStatusChanged);
         }
 
         this._overriddenStatusChangedTimeout = setTimeout(delayed.bind(this), 0);
@@ -219,7 +219,7 @@
         if (!endLine)
             endColumn -= styleTextRange.startColumn;
 
-        this._styleDeclarationTextRange = new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
+        this._styleDeclarationTextRange = new WI.TextRange(startLine, startColumn, endLine, endColumn);
 
         return this._styleDeclarationTextRange;
     }
@@ -247,13 +247,13 @@
         if ("_hasOtherVendorNameOrKeyword" in this)
             return this._hasOtherVendorNameOrKeyword;
 
-        this._hasOtherVendorNameOrKeyword = WebInspector.cssStyleManager.propertyNameHasOtherVendorPrefix(this.name) || WebInspector.cssStyleManager.propertyValueHasOtherVendorKeyword(this.value);
+        this._hasOtherVendorNameOrKeyword = WI.cssStyleManager.propertyNameHasOtherVendorPrefix(this.name) || WI.cssStyleManager.propertyValueHasOtherVendorKeyword(this.value);
 
         return this._hasOtherVendorNameOrKeyword;
     }
 };
 
-WebInspector.CSSProperty.Event = {
+WI.CSSProperty.Event = {
     Changed: "css-property-changed",
     OverriddenStatusChanged: "css-property-overridden-status-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSRule.js b/Source/WebInspectorUI/UserInterface/Models/CSSRule.js
index b20a965..a327b14 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSRule.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSRule.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSRule = class CSSRule extends WebInspector.Object
+WI.CSSRule = class CSSRule extends WI.Object
 {
     constructor(nodeStyles, ownerStyleSheet, id, type, sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList)
     {
@@ -53,7 +53,7 @@
 
     get editable()
     {
-        return !!this._id && (this._type === WebInspector.CSSStyleSheet.Type.Author || this._type === WebInspector.CSSStyleSheet.Type.Inspector);
+        return !!this._id && (this._type === WI.CSSStyleSheet.Type.Author || this._type === WI.CSSStyleSheet.Type.Inspector);
     }
 
     update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList, dontFireEvents)
@@ -91,7 +91,7 @@
             this._style.ownerRule = this;
 
         if (changed)
-            this.dispatchEventToListeners(WebInspector.CSSRule.Event.Changed);
+            this.dispatchEventToListeners(WI.CSSRule.Event.Changed);
     }
 
     get type()
@@ -242,16 +242,16 @@
 
     _selectorRejected(error)
     {
-        this.dispatchEventToListeners(WebInspector.CSSRule.Event.SelectorChanged, {valid: !error});
+        this.dispatchEventToListeners(WI.CSSRule.Event.SelectorChanged, {valid: !error});
     }
 
     _selectorResolved(rulePayload)
     {
-        this.dispatchEventToListeners(WebInspector.CSSRule.Event.SelectorChanged, {valid: !!rulePayload});
+        this.dispatchEventToListeners(WI.CSSRule.Event.SelectorChanged, {valid: !!rulePayload});
     }
 };
 
-WebInspector.CSSRule.Event = {
+WI.CSSRule.Event = {
     Changed: "css-rule-changed",
     SelectorChanged: "css-rule-invalid-selector"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js b/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js
index f82fdb0..0496a27 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSSelector.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSSelector = class CSSSelector
+WI.CSSSelector = class CSSSelector
 {
     constructor(text, specificity, dynamic)
     {
@@ -57,6 +57,6 @@
 
     isPseudoElementSelector()
     {
-        return WebInspector.CSSStyleManager.PseudoElementNames.some((name) => this._text.includes(`:${name}`));
+        return WI.CSSStyleManager.PseudoElementNames.some((name) => this._text.includes(`:${name}`));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js b/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
index 8a7ba5f..9615119 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleDeclaration = class CSSStyleDeclaration extends WebInspector.Object
+WI.CSSStyleDeclaration = class CSSStyleDeclaration extends WI.Object
 {
     constructor(nodeStyles, ownerStyleSheet, id, type, node, inherited, text, properties, styleSheetTextRange)
     {
@@ -81,10 +81,10 @@
         if (!this._id)
             return false;
 
-        if (this._type === WebInspector.CSSStyleDeclaration.Type.Rule)
+        if (this._type === WI.CSSStyleDeclaration.Type.Rule)
             return this._ownerRule && this._ownerRule.editable;
 
-        if (this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
+        if (this._type === WI.CSSStyleDeclaration.Type.Inline)
             return !this._node.isInUserAgentShadowTree();
 
         return false;
@@ -159,7 +159,7 @@
 
         function delayed()
         {
-            this.dispatchEventToListeners(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged, {addedProperties, removedProperties});
+            this.dispatchEventToListeners(WI.CSSStyleDeclaration.Event.PropertiesChanged, {addedProperties, removedProperties});
         }
 
         // Delay firing the PropertiesChanged event so DOMNodeStyles has a chance to mark overridden and associated properties.
@@ -186,17 +186,17 @@
         if (this._text === text)
             return;
 
-        let trimmedText = WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace + text.trim();
+        let trimmedText = WI.CSSStyleDeclarationTextEditor.PrefixWhitespace + text.trim();
         if (this._text === trimmedText)
             return;
 
-        if (trimmedText === WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
+        if (trimmedText === WI.CSSStyleDeclarationTextEditor.PrefixWhitespace || this._type === WI.CSSStyleDeclaration.Type.Inline)
             text = trimmedText;
 
         let modified = text !== this._initialText;
         if (modified !== this._hasModifiedInitialText) {
             this._hasModifiedInitialText = modified;
-            this.dispatchEventToListeners(WebInspector.CSSStyleDeclaration.Event.InitialTextModified);
+            this.dispatchEventToListeners(WI.CSSStyleDeclaration.Event.InitialTextModified);
         }
 
         this._nodeStyles.changeStyleText(this, text);
@@ -292,7 +292,7 @@
         if (bestMatchProperty)
             return bestMatchProperty;
 
-        var newProperty = new WebInspector.CSSProperty(NaN, null, name);
+        var newProperty = new WI.CSSProperty(NaN, null, name);
         newProperty.ownerStyle = this;
 
         this._pendingProperties.push(newProperty);
@@ -302,7 +302,7 @@
 
     generateCSSRuleString()
     {
-        let indentString = WebInspector.indentString();
+        let indentString = WI.indentString();
         let styleText = "";
         let mediaList = this.mediaList;
         let mediaQueriesCount = mediaList.length;
@@ -333,7 +333,7 @@
 
     isInspectorRule()
     {
-        return this._ownerRule && this._ownerRule.type === WebInspector.CSSStyleSheet.Type.Inspector;
+        return this._ownerRule && this._ownerRule.type === WI.CSSStyleSheet.Type.Inspector;
     }
 
     hasProperties()
@@ -349,12 +349,12 @@
     }
 };
 
-WebInspector.CSSStyleDeclaration.Event = {
+WI.CSSStyleDeclaration.Event = {
     PropertiesChanged: "css-style-declaration-properties-changed",
     InitialTextModified: "css-style-declaration-initial-text-modified"
 };
 
-WebInspector.CSSStyleDeclaration.Type = {
+WI.CSSStyleDeclaration.Type = {
     Rule: "css-style-declaration-type-rule",
     Inline: "css-style-declaration-type-inline",
     Attribute: "css-style-declaration-type-attribute",
diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js b/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js
index 4a64fe4..17b010c 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleSheet = class CSSStyleSheet extends WebInspector.SourceCode
+WI.CSSStyleSheet = class CSSStyleSheet extends WI.SourceCode
 {
     constructor(id)
     {
@@ -48,7 +48,7 @@
 
     static resetUniqueDisplayNameNumbers()
     {
-        WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
+        WI.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
     }
 
     // Public
@@ -88,13 +88,13 @@
     get displayName()
     {
         if (this._url)
-            return WebInspector.displayNameForURL(this._url, this.urlComponents);
+            return WI.displayNameForURL(this._url, this.urlComponents);
 
         // Assign a unique number to the StyleSheet object so it will stay the same.
         if (!this._uniqueDisplayNameNumber)
             this._uniqueDisplayNameNumber = this.constructor._nextUniqueDisplayNameNumber++;
 
-        return WebInspector.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);
+        return WI.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);
     }
 
     get startLineNumber()
@@ -114,7 +114,7 @@
 
     isInspectorStyleSheet()
     {
-        return this._origin === WebInspector.CSSStyleSheet.Type.Inspector;
+        return this._origin === WI.CSSStyleSheet.Type.Inspector;
     }
 
     isInlineStyleTag()
@@ -180,7 +180,7 @@
 
             DOMAgent.markUndoableState();
 
-            this.dispatchEventToListeners(WebInspector.CSSStyleSheet.Event.ContentDidChange);
+            this.dispatchEventToListeners(WI.CSSStyleSheet.Event.ContentDidChange);
         }
 
         this._ignoreNextContentDidChangeNotification = true;
@@ -207,18 +207,18 @@
         }
 
         this.markContentAsStale();
-        this.dispatchEventToListeners(WebInspector.CSSStyleSheet.Event.ContentDidChange);
+        this.dispatchEventToListeners(WI.CSSStyleSheet.Event.ContentDidChange);
         return true;
     }
 };
 
-WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
+WI.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
 
-WebInspector.CSSStyleSheet.Event = {
+WI.CSSStyleSheet.Event = {
     ContentDidChange: "stylesheet-content-did-change"
 };
 
-WebInspector.CSSStyleSheet.Type = {
+WI.CSSStyleSheet.Type = {
     Author: "css-stylesheet-type-author",
     User: "css-stylesheet-type-user",
     UserAgent: "css-stylesheet-type-user-agent",
diff --git a/Source/WebInspectorUI/UserInterface/Models/CallFrame.js b/Source/WebInspectorUI/UserInterface/Models/CallFrame.js
index 3644966..962b02c 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CallFrame.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CallFrame.js
@@ -23,18 +23,18 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CallFrame = class CallFrame
+WI.CallFrame = class CallFrame
 {
     constructor(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted)
     {
-        console.assert(target instanceof WebInspector.Target);
-        console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
-        console.assert(!thisObject || thisObject instanceof WebInspector.RemoteObject);
+        console.assert(target instanceof WI.Target);
+        console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WI.SourceCodeLocation);
+        console.assert(!thisObject || thisObject instanceof WI.RemoteObject);
         console.assert(!scopeChain || scopeChain instanceof Array);
 
         this._isConsoleEvaluation = sourceCodeLocation && isWebInspectorConsoleEvaluationScript(sourceCodeLocation.sourceCode.sourceURL);
         if (this._isConsoleEvaluation) {
-            functionName = WebInspector.UIString("Console Evaluation");
+            functionName = WI.UIString("Console Evaluation");
             programCode = true;
         }
 
@@ -108,7 +108,7 @@
         function markAsBaseIfNeeded(scope) {
             if (!scope.hash)
                 return false;
-            if (scope.type !== WebInspector.ScopeChainNode.Type.Closure)
+            if (scope.type !== WI.ScopeChainNode.Type.Closure)
                 return false;
             if (scope.hash === lastMarkedHash)
                 return false;
@@ -126,9 +126,9 @@
                 return false;
 
             // Only merge closure scopes.
-            if (youngScope.type !== WebInspector.ScopeChainNode.Type.Closure)
+            if (youngScope.type !== WI.ScopeChainNode.Type.Closure)
                 return false;
-            if (oldScope.type !== WebInspector.ScopeChainNode.Type.Closure)
+            if (oldScope.type !== WI.ScopeChainNode.Type.Closure)
                 return false;
 
             // Don't merge if they are not the same.
@@ -149,9 +149,9 @@
             markAsBaseIfNeeded(scope);
             if (shouldMergeClosureScopes(scope, lastScope, lastMerge)) {
                 console.assert(lastScope.__baseClosureScope);
-                let type = WebInspector.ScopeChainNode.Type.Closure;
+                let type = WI.ScopeChainNode.Type.Closure;
                 let objects = lastScope.objects.concat(scope.objects);
-                let merged = new WebInspector.ScopeChainNode(type, objects, scope.name, scope.location);
+                let merged = new WI.ScopeChainNode(type, objects, scope.name, scope.location);
                 merged.__baseClosureScope = true;
                 console.assert(objects.length === 2);
 
@@ -172,7 +172,7 @@
 
         // Mark the first Closure as Local if the name matches this call frame.
         for (let scope of mergedScopes) {
-            if (scope.type === WebInspector.ScopeChainNode.Type.Closure) {
+            if (scope.type === WI.ScopeChainNode.Type.Closure) {
                 if (scope.name === this._functionName)
                     scope.convertToLocalScope();
                 break;
@@ -188,11 +188,11 @@
     {
         let functionName = payload.functionName;
         if (functionName === "global code")
-            return WebInspector.UIString("Global Code");
+            return WI.UIString("Global Code");
         if (functionName === "eval code")
-            return WebInspector.UIString("Eval Code");
+            return WI.UIString("Eval Code");
         if (functionName === "module code")
-            return WebInspector.UIString("Module Code");
+            return WI.UIString("Module Code");
         return functionName;
     }
 
@@ -204,12 +204,12 @@
     static fromDebuggerPayload(target, payload, scopeChain, sourceCodeLocation)
     {
         let id = payload.callFrameId;
-        let thisObject = WebInspector.RemoteObject.fromPayload(payload.this, target);
-        let functionName = WebInspector.CallFrame.functionNameFromPayload(payload);
+        let thisObject = WI.RemoteObject.fromPayload(payload.this, target);
+        let functionName = WI.CallFrame.functionNameFromPayload(payload);
         let nativeCode = false;
-        let programCode = WebInspector.CallFrame.programCodeFromPayload(payload);
+        let programCode = WI.CallFrame.programCodeFromPayload(payload);
         let isTailDeleted = payload.isTailDeleted;
-        return new WebInspector.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted);
+        return new WI.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted);
     }
 
     static fromPayload(target, payload)
@@ -219,8 +219,8 @@
         let {url, scriptId} = payload;
         let nativeCode = false;
         let sourceCodeLocation = null;
-        let functionName = WebInspector.CallFrame.functionNameFromPayload(payload);
-        let programCode = WebInspector.CallFrame.programCodeFromPayload(payload);
+        let functionName = WI.CallFrame.functionNameFromPayload(payload);
+        let programCode = WI.CallFrame.programCodeFromPayload(payload);
 
         if (url === "[native code]") {
             nativeCode = true;
@@ -228,14 +228,14 @@
         } else if (url || scriptId) {
             let sourceCode = null;
             if (scriptId) {
-                sourceCode = WebInspector.debuggerManager.scriptForIdentifier(scriptId, target);
+                sourceCode = WI.debuggerManager.scriptForIdentifier(scriptId, target);
                 if (sourceCode && sourceCode.resource)
                     sourceCode = sourceCode.resource;
             }
             if (!sourceCode)
-                sourceCode = WebInspector.frameResourceManager.resourceForURL(url);
+                sourceCode = WI.frameResourceManager.resourceForURL(url);
             if (!sourceCode)
-                sourceCode = WebInspector.debuggerManager.scriptsForURL(url, target)[0];
+                sourceCode = WI.debuggerManager.scriptsForURL(url, target)[0];
 
             if (sourceCode) {
                 // The lineNumber is 1-based, but we expect 0-based.
@@ -253,6 +253,6 @@
         const thisObject = null;
         const scopeChain = null;
         const isTailDeleted = false;
-        return new WebInspector.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted);
+        return new WI.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/CallingContextTree.js b/Source/WebInspectorUI/UserInterface/Models/CallingContextTree.js
index 4ad8d32..32d3855 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CallingContextTree.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CallingContextTree.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CallingContextTree = class CallingContextTree
+WI.CallingContextTree = class CallingContextTree
 {
     constructor(type)
     {
-        this._type = type || WebInspector.CallingContextTree.Type.TopDown;
+        this._type = type || WI.CallingContextTree.Type.TopDown;
 
         this.reset();
     }
@@ -39,7 +39,7 @@
 
     reset()
     {
-        this._root = new WebInspector.CallingContextTreeNode(-1, -1, -1, "<root>", null);
+        this._root = new WI.CallingContextTreeNode(-1, -1, -1, "<root>", null);
         this._totalNumberOfSamples = 0;
     }
 
@@ -56,21 +56,21 @@
         node.addTimestampAndExpressionLocation(timestamp, duration, null);
 
         switch (this._type) {
-        case WebInspector.CallingContextTree.Type.TopDown:
+        case WI.CallingContextTree.Type.TopDown:
             for (let i = stackFrames.length; i--; ) {
                 let stackFrame = stackFrames[i];
                 node = node.findOrMakeChild(stackFrame);
                 node.addTimestampAndExpressionLocation(timestamp, duration, stackFrame.expressionLocation || null, i === 0);
             }
             break;
-        case WebInspector.CallingContextTree.Type.BottomUp:
+        case WI.CallingContextTree.Type.BottomUp:
             for (let i = 0; i < stackFrames.length; ++i) {
                 let stackFrame = stackFrames[i];
                 node = node.findOrMakeChild(stackFrame);
                 node.addTimestampAndExpressionLocation(timestamp, duration, stackFrame.expressionLocation || null, i === 0);
             }
             break;
-        case WebInspector.CallingContextTree.Type.TopFunctionsTopDown:
+        case WI.CallingContextTree.Type.TopFunctionsTopDown:
             for (let i = stackFrames.length; i--; ) {
                 node = this._root;
                 for (let j = i + 1; j--; ) {
@@ -80,7 +80,7 @@
                 }
             }
             break;
-        case WebInspector.CallingContextTree.Type.TopFunctionsBottomUp:
+        case WI.CallingContextTree.Type.TopFunctionsBottomUp:
             for (let i = 0; i < stackFrames.length; i++) {
                 node = this._root;
                 for (let j = i; j < stackFrames.length; j++) {
@@ -125,7 +125,7 @@
 
     static __test_makeTreeFromProtocolMessageObject(messageObject)
     {
-        let tree = new WebInspector.CallingContextTree;
+        let tree = new WI.CallingContextTree;
         let stackTraces = messageObject.params.samples.stackTraces;
         for (let i = 0; i < stackTraces.length; i++)
             tree.updateTreeWithStackTrace(stackTraces[i]);
@@ -166,7 +166,7 @@
     }
 };
 
-WebInspector.CallingContextTree.Type = {
+WI.CallingContextTree.Type = {
     TopDown: Symbol("TopDown"),
     BottomUp: Symbol("BottomUp"),
     TopFunctionsTopDown: Symbol("TopFunctionsTopDown"),
diff --git a/Source/WebInspectorUI/UserInterface/Models/CallingContextTreeNode.js b/Source/WebInspectorUI/UserInterface/Models/CallingContextTreeNode.js
index e897ede..9280480 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CallingContextTreeNode.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CallingContextTreeNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CallingContextTreeNode = class CallingContextTreeNode
+WI.CallingContextTreeNode = class CallingContextTreeNode
 {
     constructor(sourceID, line, column, name, url, hash)
     {
@@ -33,7 +33,7 @@
         this._column = column;
         this._name = name;
         this._url = url;
-        this._uid = WebInspector.CallingContextTreeNode.__uid++;
+        this._uid = WI.CallingContextTreeNode.__uid++;
 
         this._timestamps = [];
         this._durations = [];
@@ -41,7 +41,7 @@
         this._leafDurations = [];
         this._expressionLocations = {}; // Keys are "line:column" strings. Values are arrays of timestamps in sorted order.
 
-        this._hash = hash || WebInspector.CallingContextTreeNode._hash(this);
+        this._hash = hash || WI.CallingContextTreeNode._hash(this);
     }
 
     // Static and Private
@@ -128,11 +128,11 @@
 
     findOrMakeChild(stackFrame)
     {
-        let hash = WebInspector.CallingContextTreeNode._hash(stackFrame);
+        let hash = WI.CallingContextTreeNode._hash(stackFrame);
         let node = this._children[hash];
         if (node)
             return node;
-        node = new WebInspector.CallingContextTreeNode(stackFrame.sourceID, stackFrame.line, stackFrame.column, stackFrame.name, stackFrame.url, hash);
+        node = new WI.CallingContextTreeNode(stackFrame.sourceID, stackFrame.line, stackFrame.column, stackFrame.name, stackFrame.url, hash);
         this._children[hash] = node;
         return node;
     }
@@ -239,4 +239,4 @@
     }
 };
 
-WebInspector.CallingContextTreeNode.__uid = 0;
+WI.CallingContextTreeNode.__uid = 0;
diff --git a/Source/WebInspectorUI/UserInterface/Models/Canvas.js b/Source/WebInspectorUI/UserInterface/Models/Canvas.js
index 42d6f84..d547a2f 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Canvas.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Canvas.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Canvas = class Canvas extends WebInspector.Object
+WI.Canvas = class Canvas extends WI.Object
 {
     constructor(identifier, contextType, frame, {domNode, cssCanvasName, contextAttributes, memoryCost} = {})
     {
@@ -31,7 +31,7 @@
 
         console.assert(identifier);
         console.assert(contextType);
-        console.assert(frame instanceof WebInspector.Frame);
+        console.assert(frame instanceof WI.Frame);
 
         this._identifier = identifier;
         this._contextType = contextType;
@@ -51,24 +51,24 @@
         let contextType = null;
         switch (payload.contextType) {
         case CanvasAgent.ContextType.Canvas2D:
-            contextType = WebInspector.Canvas.ContextType.Canvas2D;
+            contextType = WI.Canvas.ContextType.Canvas2D;
             break;
         case CanvasAgent.ContextType.WebGL:
-            contextType = WebInspector.Canvas.ContextType.WebGL;
+            contextType = WI.Canvas.ContextType.WebGL;
             break;
         case CanvasAgent.ContextType.WebGL2:
-            contextType = WebInspector.Canvas.ContextType.WebGL2;
+            contextType = WI.Canvas.ContextType.WebGL2;
             break;
         case CanvasAgent.ContextType.WebGPU:
-            contextType = WebInspector.Canvas.ContextType.WebGPU;
+            contextType = WI.Canvas.ContextType.WebGPU;
             break;
         default:
             console.error("Invalid canvas context type", payload.contextType);
         }
 
-        let frame = WebInspector.frameResourceManager.frameForIdentifier(payload.frameId);
-        return new WebInspector.Canvas(payload.canvasId, contextType, frame, {
-            domNode: payload.nodeId ? WebInspector.domTreeManager.nodeForId(payload.nodeId) : null,
+        let frame = WI.frameResourceManager.frameForIdentifier(payload.frameId);
+        return new WI.Canvas(payload.canvasId, contextType, frame, {
+            domNode: payload.nodeId ? WI.domTreeManager.nodeForId(payload.nodeId) : null,
             cssCanvasName: payload.cssCanvasName,
             contextAttributes: payload.contextAttributes,
             memoryCost: payload.memoryCost,
@@ -78,14 +78,14 @@
     static displayNameForContextType(contextType)
     {
         switch (contextType) {
-        case WebInspector.Canvas.ContextType.Canvas2D:
-            return WebInspector.UIString("2D");
-        case WebInspector.Canvas.ContextType.WebGL:
-            return WebInspector.unlocalizedString("WebGL");
-        case WebInspector.Canvas.ContextType.WebGL2:
-            return WebInspector.unlocalizedString("WebGL2");
-        case WebInspector.Canvas.ContextType.WebGPU:
-            return WebInspector.unlocalizedString("WebGPU");
+        case WI.Canvas.ContextType.Canvas2D:
+            return WI.UIString("2D");
+        case WI.Canvas.ContextType.WebGL:
+            return WI.unlocalizedString("WebGL");
+        case WI.Canvas.ContextType.WebGL2:
+            return WI.unlocalizedString("WebGL2");
+        case WI.Canvas.ContextType.WebGPU:
+            return WI.unlocalizedString("WebGPU");
         default:
             console.error("Invalid canvas context type", contextType);
         }
@@ -93,7 +93,7 @@
 
     static resetUniqueDisplayNameNumbers()
     {
-        WebInspector.Canvas._nextUniqueDisplayNameNumber = 1;
+        WI.Canvas._nextUniqueDisplayNameNumber = 1;
     }
 
     // Public
@@ -116,23 +116,23 @@
 
         this._memoryCost = memoryCost;
 
-        this.dispatchEventToListeners(WebInspector.Canvas.Event.MemoryChanged);
+        this.dispatchEventToListeners(WI.Canvas.Event.MemoryChanged);
     }
 
     get displayName()
     {
         if (this._cssCanvasName)
-            return WebInspector.UIString("CSS canvas “%s”").format(this._cssCanvasName);
+            return WI.UIString("CSS canvas “%s”").format(this._cssCanvasName);
 
         if (this._domNode) {
             let idSelector = this._domNode.escapedIdSelector;
             if (idSelector)
-                return WebInspector.UIString("Canvas %s").format(idSelector);
+                return WI.UIString("Canvas %s").format(idSelector);
         }
 
         if (!this._uniqueDisplayNameNumber)
             this._uniqueDisplayNameNumber = this.constructor._nextUniqueDisplayNameNumber++;
-        return WebInspector.UIString("Canvas %d").format(this._uniqueDisplayNameNumber);
+        return WI.UIString("Canvas %d").format(this._uniqueDisplayNameNumber);
     }
 
     requestNode(callback)
@@ -142,7 +142,7 @@
             return;
         }
 
-        WebInspector.domTreeManager.ensureDocument();
+        WI.domTreeManager.ensureDocument();
 
         CanvasAgent.requestNode(this._identifier, (error, nodeId) => {
             if (error) {
@@ -150,7 +150,7 @@
                 return;
             }
 
-            this._domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            this._domNode = WI.domTreeManager.nodeForId(nodeId);
             callback(this._domNode);
         });
     }
@@ -179,7 +179,7 @@
             return;
         }
 
-        WebInspector.domTreeManager.ensureDocument();
+        WI.domTreeManager.ensureDocument();
 
         CanvasAgent.requestCSSCanvasClientNodes(this._identifier, (error, clientNodeIds) => {
             if (error) {
@@ -188,7 +188,7 @@
             }
 
             clientNodeIds = Array.isArray(clientNodeIds) ? clientNodeIds : [];
-            this._cssCanvasClientNodes = clientNodeIds.map((clientNodeId) => WebInspector.domTreeManager.nodeForId(clientNodeId));
+            this._cssCanvasClientNodes = clientNodeIds.map((clientNodeId) => WI.domTreeManager.nodeForId(clientNodeId));
 
             callback(this._cssCanvasClientNodes);
         });
@@ -204,43 +204,43 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.Canvas.FrameURLCookieKey] = this._frame.url.hash;
+        cookie[WI.Canvas.FrameURLCookieKey] = this._frame.url.hash;
 
         if (this._cssCanvasName)
-            cookie[WebInspector.Canvas.CSSCanvasNameCookieKey] = this._cssCanvasName;
+            cookie[WI.Canvas.CSSCanvasNameCookieKey] = this._cssCanvasName;
         else if (this._domNode)
-            cookie[WebInspector.Canvas.NodePathCookieKey] = this._domNode.path;
+            cookie[WI.Canvas.NodePathCookieKey] = this._domNode.path;
 
     }
 
     cssCanvasClientNodesChanged()
     {
-        // Called from WebInspector.CanvasManager.
+        // Called from WI.CanvasManager.
 
         if (!this._cssCanvasName)
             return;
 
         this._cssCanvasClientNodes = null;
 
-        this.dispatchEventToListeners(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged);
+        this.dispatchEventToListeners(WI.Canvas.Event.CSSCanvasClientNodesChanged);
     }
 };
 
-WebInspector.Canvas._nextUniqueDisplayNameNumber = 1;
+WI.Canvas._nextUniqueDisplayNameNumber = 1;
 
-WebInspector.Canvas.FrameURLCookieKey = "canvas-frame-url";
-WebInspector.Canvas.CSSCanvasNameCookieKey = "canvas-css-canvas-name";
+WI.Canvas.FrameURLCookieKey = "canvas-frame-url";
+WI.Canvas.CSSCanvasNameCookieKey = "canvas-css-canvas-name";
 
-WebInspector.Canvas.ContextType = {
+WI.Canvas.ContextType = {
     Canvas2D: "canvas-2d",
     WebGL: "webgl",
     WebGL2: "webgl2",
     WebGPU: "webgpu",
 };
 
-WebInspector.Canvas.ResourceSidebarType = "resource-type-canvas";
+WI.Canvas.ResourceSidebarType = "resource-type-canvas";
 
-WebInspector.Canvas.Event = {
+WI.Canvas.Event = {
     MemoryChanged: "canvas-memory-changed",
     CSSCanvasClientNodesChanged: "canvas-css-canvas-client-nodes-changed",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/Collection.js b/Source/WebInspectorUI/UserInterface/Models/Collection.js
index 26f0c73..824c2b8 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Collection.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Collection.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Collection = class Collection extends WebInspector.Object
+WI.Collection = class Collection extends WI.Object
 {
     constructor(typeVerifier)
     {
@@ -32,7 +32,7 @@
         this._items = new Set;
 
         console.assert(!typeVerifier || typeof typeVerifier === "function");
-        this._typeVerifier = typeVerifier || WebInspector.Collection.TypeVerifier.Any;
+        this._typeVerifier = typeVerifier || WI.Collection.TypeVerifier.Any;
     }
 
      // Public
@@ -52,7 +52,7 @@
 
         this.itemAdded(item);
 
-        this.dispatchEventToListeners(WebInspector.Collection.Event.ItemAdded, {item});
+        this.dispatchEventToListeners(WI.Collection.Event.ItemAdded, {item});
     }
 
     remove(item)
@@ -62,7 +62,7 @@
 
         this.itemRemoved(item);
 
-        this.dispatchEventToListeners(WebInspector.Collection.Event.ItemRemoved, {item});
+        this.dispatchEventToListeners(WI.Collection.Event.ItemRemoved, {item});
     }
 
     clear()
@@ -74,7 +74,7 @@
         this.itemsCleared(items);
 
         for (let item of items)
-            this.dispatchEventToListeners(WebInspector.Collection.Event.ItemRemoved, {item});
+            this.dispatchEventToListeners(WI.Collection.Event.ItemRemoved, {item});
     }
 
     toArray()
@@ -105,17 +105,17 @@
     }
 };
 
- WebInspector.Collection.Event = {
+ WI.Collection.Event = {
     ItemAdded: "collection-item-added",
     ItemRemoved: "collection-item-removed",
 };
 
- WebInspector.Collection.TypeVerifier = {
+ WI.Collection.TypeVerifier = {
     Any: (object) => true,
-    ContentFlow: (object) => object instanceof WebInspector.ContentFlow,
-    Frame: (object) => object instanceof WebInspector.Frame,
-    Resource: (object) => object instanceof WebInspector.Resource,
-    Script: (object) => object instanceof WebInspector.Script,
-    CSSStyleSheet: (object) => object instanceof WebInspector.CSSStyleSheet,
-    Canvas: (object) => object instanceof WebInspector.Canvas,
+    ContentFlow: (object) => object instanceof WI.ContentFlow,
+    Frame: (object) => object instanceof WI.Frame,
+    Resource: (object) => object instanceof WI.Resource,
+    Script: (object) => object instanceof WI.Script,
+    CSSStyleSheet: (object) => object instanceof WI.CSSStyleSheet,
+    Canvas: (object) => object instanceof WI.Canvas,
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/CollectionEntry.js b/Source/WebInspectorUI/UserInterface/Models/CollectionEntry.js
index 84073d7..63d5665 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CollectionEntry.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CollectionEntry.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CollectionEntry = class CollectionEntry
+WI.CollectionEntry = class CollectionEntry
 {
     constructor(key, value)
     {
-        console.assert(value instanceof WebInspector.RemoteObject);
-        console.assert(!key || key instanceof WebInspector.RemoteObject);
+        console.assert(value instanceof WI.RemoteObject);
+        console.assert(!key || key instanceof WI.RemoteObject);
 
         this._key = key;
         this._value = value;
@@ -40,11 +40,11 @@
     static fromPayload(payload, target)
     {
         if (payload.key)
-            payload.key = WebInspector.RemoteObject.fromPayload(payload.key, target);
+            payload.key = WI.RemoteObject.fromPayload(payload.key, target);
         if (payload.value)
-            payload.value = WebInspector.RemoteObject.fromPayload(payload.value, target);
+            payload.value = WI.RemoteObject.fromPayload(payload.value, target);
 
-        return new WebInspector.CollectionEntry(payload.key, payload.value);
+        return new WI.CollectionEntry(payload.key, payload.value);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/CollectionEntryPreview.js b/Source/WebInspectorUI/UserInterface/Models/CollectionEntryPreview.js
index 66b0e61..253d397 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CollectionEntryPreview.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CollectionEntryPreview.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CollectionEntryPreview = class CollectionEntryPreview
+WI.CollectionEntryPreview = class CollectionEntryPreview
 {
     constructor(keyPreview, valuePreview)
     {
-        console.assert(valuePreview instanceof WebInspector.ObjectPreview);
-        console.assert(!keyPreview || keyPreview instanceof WebInspector.ObjectPreview);
+        console.assert(valuePreview instanceof WI.ObjectPreview);
+        console.assert(!keyPreview || keyPreview instanceof WI.ObjectPreview);
 
         this._key = keyPreview;
         this._value = valuePreview;
@@ -40,11 +40,11 @@
     static fromPayload(payload)
     {
         if (payload.key)
-            payload.key = WebInspector.ObjectPreview.fromPayload(payload.key);
+            payload.key = WI.ObjectPreview.fromPayload(payload.key);
         if (payload.value)
-            payload.value = WebInspector.ObjectPreview.fromPayload(payload.value);
+            payload.value = WI.ObjectPreview.fromPayload(payload.value);
 
-        return new WebInspector.CollectionEntryPreview(payload.key, payload.value);
+        return new WI.CollectionEntryPreview(payload.key, payload.value);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/Color.js b/Source/WebInspectorUI/UserInterface/Models/Color.js
index 491bf28..919eaf4 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Color.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Color.js
@@ -27,13 +27,13 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Color = class Color
+WI.Color = class Color
 {
     constructor(format, components)
     {
         this.format = format;
 
-        if (format === WebInspector.Color.Format.HSL || format === WebInspector.Color.Format.HSLA)
+        if (format === WI.Color.Format.HSL || format === WI.Color.Format.HSLA)
             this._hsla = components;
         else
             this._rgba = components;
@@ -48,7 +48,7 @@
         let value = colorString.toLowerCase().replace(/%|\s+/g, "");
         let transparentKeywords = ["transparent", "rgba(0,0,0,0)", "hsla(0,0,0,0)"];
         if (transparentKeywords.includes(value)) {
-            let color = new WebInspector.Color(WebInspector.Color.Format.Keyword, [0, 0, 0, 0]);
+            let color = new WI.Color(WI.Color.Format.Keyword, [0, 0, 0, 0]);
             color.keyword = "transparent";
             color.original = colorString;
             return color;
@@ -62,28 +62,28 @@
                 let hex = match[1].toUpperCase();
                 let len = hex.length;
                 if (len === 3) {
-                    return new WebInspector.Color(WebInspector.Color.Format.ShortHEX, [
+                    return new WI.Color(WI.Color.Format.ShortHEX, [
                         parseInt(hex.charAt(0) + hex.charAt(0), 16),
                         parseInt(hex.charAt(1) + hex.charAt(1), 16),
                         parseInt(hex.charAt(2) + hex.charAt(2), 16),
                         1
                     ]);
                 } else if (len === 6) {
-                    return new WebInspector.Color(WebInspector.Color.Format.HEX, [
+                    return new WI.Color(WI.Color.Format.HEX, [
                         parseInt(hex.substring(0, 2), 16),
                         parseInt(hex.substring(2, 4), 16),
                         parseInt(hex.substring(4, 6), 16),
                         1
                     ]);
                 } else if (len === 4) {
-                    return new WebInspector.Color(WebInspector.Color.Format.ShortHEXAlpha, [
+                    return new WI.Color(WI.Color.Format.ShortHEXAlpha, [
                         parseInt(hex.charAt(0) + hex.charAt(0), 16),
                         parseInt(hex.charAt(1) + hex.charAt(1), 16),
                         parseInt(hex.charAt(2) + hex.charAt(2), 16),
                         parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255
                     ]);
                 } else if (len === 8) {
-                    return new WebInspector.Color(WebInspector.Color.Format.HEXAlpha, [
+                    return new WI.Color(WI.Color.Format.HEXAlpha, [
                         parseInt(hex.substring(0, 2), 16),
                         parseInt(hex.substring(2, 4), 16),
                         parseInt(hex.substring(4, 6), 16),
@@ -95,7 +95,7 @@
                 let rgb = match[2].split(/\s*,\s*/);
                 if (rgb.length !== 3)
                     return null;
-                return new WebInspector.Color(WebInspector.Color.Format.RGB, [
+                return new WI.Color(WI.Color.Format.RGB, [
                     parseInt(rgb[0]),
                     parseInt(rgb[1]),
                     parseInt(rgb[2]),
@@ -103,9 +103,9 @@
                 ]);
             } else if (match[3]) { // keyword
                 let keyword = match[3].toLowerCase();
-                if (!WebInspector.Color.Keywords.hasOwnProperty(keyword))
+                if (!WI.Color.Keywords.hasOwnProperty(keyword))
                     return null;
-                let color = new WebInspector.Color(WebInspector.Color.Format.Keyword, WebInspector.Color.Keywords[keyword].concat(1));
+                let color = new WI.Color(WI.Color.Format.Keyword, WI.Color.Keywords[keyword].concat(1));
                 color.keyword = keyword;
                 color.original = colorString;
                 return color;
@@ -113,7 +113,7 @@
                 let hsl = match[4].replace(/%/g, "").split(/\s*,\s*/);
                 if (hsl.length !== 3)
                     return null;
-                return new WebInspector.Color(WebInspector.Color.Format.HSL, [
+                return new WI.Color(WI.Color.Format.HSL, [
                     parseInt(hsl[0]),
                     parseInt(hsl[1]),
                     parseInt(hsl[2]),
@@ -130,7 +130,7 @@
                 let rgba = match[1].split(/\s*,\s*/);
                 if (rgba.length !== 4)
                     return null;
-                return new WebInspector.Color(WebInspector.Color.Format.RGBA, [
+                return new WI.Color(WI.Color.Format.RGBA, [
                     parseInt(rgba[0]),
                     parseInt(rgba[1]),
                     parseInt(rgba[2]),
@@ -140,7 +140,7 @@
                 let hsla = match[2].replace(/%/g, "").split(/\s*,\s*/);
                 if (hsla.length !== 4)
                     return null;
-                return new WebInspector.Color(WebInspector.Color.Format.HSLA, [
+                return new WI.Color(WI.Color.Format.HSLA, [
                     parseInt(hsla[0]),
                     parseInt(hsla[1]),
                     parseInt(hsla[2]),
@@ -233,33 +233,33 @@
         format = format || this.format;
 
         switch (format) {
-        case WebInspector.Color.Format.Original:
-        case WebInspector.Color.Format.HEX:
-        case WebInspector.Color.Format.HEXAlpha:
-            return this.simple ? WebInspector.Color.Format.RGB : WebInspector.Color.Format.RGBA;
+        case WI.Color.Format.Original:
+        case WI.Color.Format.HEX:
+        case WI.Color.Format.HEXAlpha:
+            return this.simple ? WI.Color.Format.RGB : WI.Color.Format.RGBA;
 
-        case WebInspector.Color.Format.RGB:
-        case WebInspector.Color.Format.RGBA:
-            return this.simple ? WebInspector.Color.Format.HSL : WebInspector.Color.Format.HSLA;
+        case WI.Color.Format.RGB:
+        case WI.Color.Format.RGBA:
+            return this.simple ? WI.Color.Format.HSL : WI.Color.Format.HSLA;
 
-        case WebInspector.Color.Format.HSL:
-        case WebInspector.Color.Format.HSLA:
+        case WI.Color.Format.HSL:
+        case WI.Color.Format.HSLA:
             if (this.isKeyword())
-                return WebInspector.Color.Format.Keyword;
+                return WI.Color.Format.Keyword;
             if (this.simple)
-                return this.canBeSerializedAsShortHEX() ? WebInspector.Color.Format.ShortHEX : WebInspector.Color.Format.HEX;
-            return this.canBeSerializedAsShortHEX() ? WebInspector.Color.Format.ShortHEXAlpha : WebInspector.Color.Format.HEXAlpha;
+                return this.canBeSerializedAsShortHEX() ? WI.Color.Format.ShortHEX : WI.Color.Format.HEX;
+            return this.canBeSerializedAsShortHEX() ? WI.Color.Format.ShortHEXAlpha : WI.Color.Format.HEXAlpha;
 
-        case WebInspector.Color.Format.ShortHEX:
-            return WebInspector.Color.Format.HEX;
+        case WI.Color.Format.ShortHEX:
+            return WI.Color.Format.HEX;
 
-        case WebInspector.Color.Format.ShortHEXAlpha:
-            return WebInspector.Color.Format.HEXAlpha;
+        case WI.Color.Format.ShortHEXAlpha:
+            return WI.Color.Format.HEXAlpha;
 
-        case WebInspector.Color.Format.Keyword:
+        case WI.Color.Format.Keyword:
             if (this.simple)
-                return this.canBeSerializedAsShortHEX() ? WebInspector.Color.Format.ShortHEX : WebInspector.Color.Format.HEX;
-            return this.canBeSerializedAsShortHEX() ? WebInspector.Color.Format.ShortHEXAlpha : WebInspector.Color.Format.HEXAlpha;
+                return this.canBeSerializedAsShortHEX() ? WI.Color.Format.ShortHEX : WI.Color.Format.HEX;
+            return this.canBeSerializedAsShortHEX() ? WI.Color.Format.ShortHEXAlpha : WI.Color.Format.HEXAlpha;
 
         default:
             console.error("Unknown color format.");
@@ -308,17 +308,17 @@
     copy()
     {
         switch (this.format) {
-        case WebInspector.Color.Format.RGB:
-        case WebInspector.Color.Format.HEX:
-        case WebInspector.Color.Format.ShortHEX:
-        case WebInspector.Color.Format.HEXAlpha:
-        case WebInspector.Color.Format.ShortHEXAlpha:
-        case WebInspector.Color.Format.Keyword:
-        case WebInspector.Color.Format.RGBA:
-            return new WebInspector.Color(this.format, this.rgba);
-        case WebInspector.Color.Format.HSL:
-        case WebInspector.Color.Format.HSLA:
-            return new WebInspector.Color(this.format, this.hsla);
+        case WI.Color.Format.RGB:
+        case WI.Color.Format.HEX:
+        case WI.Color.Format.ShortHEX:
+        case WI.Color.Format.HEXAlpha:
+        case WI.Color.Format.ShortHEXAlpha:
+        case WI.Color.Format.Keyword:
+        case WI.Color.Format.RGBA:
+            return new WI.Color(this.format, this.rgba);
+        case WI.Color.Format.HSL:
+        case WI.Color.Format.HSLA:
+            return new WI.Color(this.format, this.hsla);
         }
     }
 
@@ -328,25 +328,25 @@
             format = this.format;
 
         switch (format) {
-        case WebInspector.Color.Format.Original:
+        case WI.Color.Format.Original:
             return this._toOriginalString();
-        case WebInspector.Color.Format.RGB:
+        case WI.Color.Format.RGB:
             return this._toRGBString();
-        case WebInspector.Color.Format.RGBA:
+        case WI.Color.Format.RGBA:
             return this._toRGBAString();
-        case WebInspector.Color.Format.HSL:
+        case WI.Color.Format.HSL:
             return this._toHSLString();
-        case WebInspector.Color.Format.HSLA:
+        case WI.Color.Format.HSLA:
             return this._toHSLAString();
-        case WebInspector.Color.Format.HEX:
+        case WI.Color.Format.HEX:
             return this._toHEXString();
-        case WebInspector.Color.Format.ShortHEX:
+        case WI.Color.Format.ShortHEX:
             return this._toShortHEXString();
-        case WebInspector.Color.Format.HEXAlpha:
+        case WI.Color.Format.HEXAlpha:
             return this._toHEXAlphaString();
-        case WebInspector.Color.Format.ShortHEXAlpha:
+        case WI.Color.Format.ShortHEXAlpha:
             return this._toShortHEXAlphaString();
-        case WebInspector.Color.Format.Keyword:
+        case WI.Color.Format.Keyword:
             return this._toKeywordString();
         }
 
@@ -362,7 +362,7 @@
             return Array.shallowEqual(this._rgba, [0, 0, 0, 0]) || Array.shallowEqual(this._hsla, [0, 0, 0, 0]);
 
         let rgb = (this._rgba && this._rgba.slice(0, 3)) || this._hslToRGB(this._hsla);
-        return Object.keys(WebInspector.Color.Keywords).some(key => Array.shallowEqual(WebInspector.Color.Keywords[key], rgb));
+        return Object.keys(WI.Color.Keywords).some(key => Array.shallowEqual(WI.Color.Keywords[key], rgb));
     }
 
     canBeSerializedAsShortHEX()
@@ -409,7 +409,7 @@
             return this._toRGBAString();
         }
 
-        let keywords = WebInspector.Color.Keywords;
+        let keywords = WI.Color.Keywords;
         for (let keyword in keywords) {
             if (!keywords.hasOwnProperty(keyword))
                 continue;
@@ -599,7 +599,7 @@
     }
 };
 
-WebInspector.Color.Format = {
+WI.Color.Format = {
     Original: "color-format-original",
     Keyword: "color-format-keyword",
     HEX: "color-format-hex",
@@ -612,7 +612,7 @@
     HSLA: "color-format-hsla"
 };
 
-WebInspector.Color.Keywords = {
+WI.Color.Keywords = {
     "aliceblue": [240, 248, 255],
     "antiquewhite": [250, 235, 215],
     "aquamarine": [127, 255, 212],
diff --git a/Source/WebInspectorUI/UserInterface/Models/ConsoleCommandResultMessage.js b/Source/WebInspectorUI/UserInterface/Models/ConsoleCommandResultMessage.js
index f76c8a8..fd58416 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ConsoleCommandResultMessage.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ConsoleCommandResultMessage.js
@@ -27,28 +27,28 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleCommandResultMessage = class ConsoleCommandResult extends WebInspector.ConsoleMessage
+WI.ConsoleCommandResultMessage = class ConsoleCommandResult extends WI.ConsoleMessage
 {
     constructor(target, result, wasThrown, savedResultIndex, shouldRevealConsole = true)
     {
-        let source = WebInspector.ConsoleMessage.MessageSource.JS;
-        let level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log;
-        let type = WebInspector.ConsoleMessage.MessageType.Result;
+        let source = WI.ConsoleMessage.MessageSource.JS;
+        let level = wasThrown ? WI.ConsoleMessage.MessageLevel.Error : WI.ConsoleMessage.MessageLevel.Log;
+        let type = WI.ConsoleMessage.MessageType.Result;
 
         super(target, source, level, "", type, undefined, undefined, undefined, 0, [result], undefined, undefined);
 
         this._savedResultIndex = savedResultIndex;
         this._shouldRevealConsole = shouldRevealConsole;
 
-        if (this._savedResultIndex && this._savedResultIndex > WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex)
-            WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex = this._savedResultIndex;
+        if (this._savedResultIndex && this._savedResultIndex > WI.ConsoleCommandResultMessage.maximumSavedResultIndex)
+            WI.ConsoleCommandResultMessage.maximumSavedResultIndex = this._savedResultIndex;
     }
 
     // Static
 
     static clearMaximumSavedResultIndex()
     {
-        WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex = 0;
+        WI.ConsoleCommandResultMessage.maximumSavedResultIndex = 0;
     }
 
     // Public
@@ -64,4 +64,4 @@
     }
 };
 
-WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex = 0;
+WI.ConsoleCommandResultMessage.maximumSavedResultIndex = 0;
diff --git a/Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js b/Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js
index df7ab35..1243d0c 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleMessage = class ConsoleMessage
+WI.ConsoleMessage = class ConsoleMessage
 {
     constructor(target, source, level, message, type, url, line, column, repeatCount, parameters, callFrames, request)
     {
         console.assert(typeof source === "string");
         console.assert(typeof level === "string");
         console.assert(typeof message === "string");
-        console.assert(target instanceof WebInspector.Target);
-        console.assert(!parameters || parameters.every((x) => x instanceof WebInspector.RemoteObject));
+        console.assert(target instanceof WI.Target);
+        console.assert(!parameters || parameters.every((x) => x instanceof WI.RemoteObject));
 
         this._target = target;
         this._source = source;
         this._level = level;
         this._messageText = message;
-        this._type = type || WebInspector.ConsoleMessage.MessageType.Log;
+        this._type = type || WI.ConsoleMessage.MessageType.Log;
 
         this._url = url || null;
         this._line = line || 0;
@@ -48,7 +48,7 @@
         this._parameters = parameters;
 
         callFrames = callFrames || [];
-        this._stackTrace = WebInspector.StackTrace.fromPayload(this._target, {callFrames});
+        this._stackTrace = WI.StackTrace.fromPayload(this._target, {callFrames});
 
         this._request = request;
     }
@@ -83,11 +83,11 @@
         // If that doesn't exist try to get a location from the url/line/column in the ConsoleMessage.
         // FIXME <http://webkit.org/b/76404>: Remove the string equality checks for undefined once we don't get that value anymore.
         if (this._url && this._url !== "undefined") {
-            let sourceCode = WebInspector.frameResourceManager.resourceForURL(this._url);
+            let sourceCode = WI.frameResourceManager.resourceForURL(this._url);
             if (sourceCode) {
                 let lineNumber = this._line > 0 ? this._line - 1 : 0;
                 let columnNumber = this._column > 0 ? this._column - 1 : 0;
-                this._sourceCodeLocation = new WebInspector.SourceCodeLocation(sourceCode, lineNumber, columnNumber);
+                this._sourceCodeLocation = new WI.SourceCodeLocation(sourceCode, lineNumber, columnNumber);
                 return this._sourceCodeLocation;
             }
         }
@@ -97,7 +97,7 @@
     }
 };
 
-WebInspector.ConsoleMessage.MessageSource = {
+WI.ConsoleMessage.MessageSource = {
     HTML: "html",
     XML: "xml",
     JS: "javascript",
@@ -111,7 +111,7 @@
     Other: "other",
 };
 
-WebInspector.ConsoleMessage.MessageType = {
+WI.ConsoleMessage.MessageType = {
     Log: "log",
     Dir: "dir",
     DirXML: "dirxml",
@@ -127,7 +127,7 @@
     Result: "result", // Frontend Only.
 };
 
-WebInspector.ConsoleMessage.MessageLevel = {
+WI.ConsoleMessage.MessageLevel = {
     Log: "log",
     Info: "info",
     Warning: "warning",
diff --git a/Source/WebInspectorUI/UserInterface/Models/ContentFlow.js b/Source/WebInspectorUI/UserInterface/Models/ContentFlow.js
index cc063d3..32bef02 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ContentFlow.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ContentFlow.js
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 
-WebInspector.ContentFlow = class ContentFlow extends WebInspector.Object
+WI.ContentFlow = class ContentFlow extends WI.Object
 {
     constructor(documentNodeIdentifier, name, overset, contentNodes)
     {
@@ -67,7 +67,7 @@
         if (this._overset === overset)
             return;
         this._overset = overset;
-        this.dispatchEventToListeners(WebInspector.ContentFlow.Event.FlowOversetWasChanged);
+        this.dispatchEventToListeners(WI.ContentFlow.Event.FlowOversetWasChanged);
     }
 
     get contentNodes()
@@ -80,13 +80,13 @@
         var index = this._contentNodes.indexOf(referenceNode);
         console.assert(index !== -1);
         this._contentNodes.splice(index, 0, contentNode);
-        this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded, {node: contentNode, before: referenceNode});
+        this.dispatchEventToListeners(WI.ContentFlow.Event.ContentNodeWasAdded, {node: contentNode, before: referenceNode});
     }
 
     appendContentNode(contentNode)
     {
         this._contentNodes.push(contentNode);
-        this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded, {node: contentNode});
+        this.dispatchEventToListeners(WI.ContentFlow.Event.ContentNodeWasAdded, {node: contentNode});
     }
 
     removeContentNode(contentNode)
@@ -94,11 +94,11 @@
         var index = this._contentNodes.indexOf(contentNode);
         console.assert(index !== -1);
         this._contentNodes.splice(index, 1);
-        this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, {node: contentNode});
+        this.dispatchEventToListeners(WI.ContentFlow.Event.ContentNodeWasRemoved, {node: contentNode});
     }
 };
 
-WebInspector.ContentFlow.Event = {
+WI.ContentFlow.Event = {
     OversetWasChanged: "content-flow-overset-was-changed",
     ContentNodeWasAdded: "content-flow-content-node-was-added",
     ContentNodeWasRemoved: "content-flow-content-node-was-removed"
diff --git a/Source/WebInspectorUI/UserInterface/Models/CookieStorageObject.js b/Source/WebInspectorUI/UserInterface/Models/CookieStorageObject.js
index fe41077..abcf3cf 100644
--- a/Source/WebInspectorUI/UserInterface/Models/CookieStorageObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/CookieStorageObject.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CookieStorageObject = class CookieStorageObject
+WI.CookieStorageObject = class CookieStorageObject
 {
     constructor(host)
     {
@@ -35,7 +35,7 @@
     static cookieMatchesResourceURL(cookie, resourceURL)
     {
         var parsedURL = parseURL(resourceURL);
-        if (!parsedURL || !WebInspector.CookieStorageObject.cookieDomainMatchesResourceDomain(cookie.domain, parsedURL.host))
+        if (!parsedURL || !WI.CookieStorageObject.cookieDomainMatchesResourceDomain(cookie.domain, parsedURL.host))
             return false;
 
         return parsedURL.path.startsWith(cookie.path)
@@ -60,9 +60,9 @@
     saveIdentityToCookie(cookie)
     {
         // FIXME <https://webkit.org/b/151413>: This class should actually store cookie data for this host.
-        cookie[WebInspector.CookieStorageObject.CookieHostCookieKey] = this.host;
+        cookie[WI.CookieStorageObject.CookieHostCookieKey] = this.host;
     }
 };
 
-WebInspector.CookieStorageObject.TypeIdentifier = "cookie-storage";
-WebInspector.CookieStorageObject.CookieHostCookieKey = "cookie-storage-host";
+WI.CookieStorageObject.TypeIdentifier = "cookie-storage";
+WI.CookieStorageObject.CookieHostCookieKey = "cookie-storage-host";
diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMBreakpoint.js b/Source/WebInspectorUI/UserInterface/Models/DOMBreakpoint.js
index d763fa6..23fce05 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DOMBreakpoint.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DOMBreakpoint.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMBreakpoint = class DOMBreakpoint extends WebInspector.Object
+WI.DOMBreakpoint = class DOMBreakpoint extends WI.Object
 {
     constructor(domNodeOrInfo, type, disabled)
     {
@@ -31,11 +31,11 @@
 
         super();
 
-        if (domNodeOrInfo instanceof WebInspector.DOMNode) {
+        if (domNodeOrInfo instanceof WI.DOMNode) {
             this._domNodeIdentifier = domNodeOrInfo.id;
             this._path = domNodeOrInfo.path();
-            console.assert(WebInspector.frameResourceManager.mainFrame);
-            this._url = WebInspector.frameResourceManager.mainFrame.url;
+            console.assert(WI.frameResourceManager.mainFrame);
+            this._url = WI.frameResourceManager.mainFrame.url;
         } else if (domNodeOrInfo && typeof domNodeOrInfo === "object") {
             this._domNodeIdentifier = null;
             this._path = domNodeOrInfo.path;
@@ -64,7 +64,7 @@
 
         this._disabled = disabled;
 
-        this.dispatchEventToListeners(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange);
+        this.dispatchEventToListeners(WI.DOMBreakpoint.Event.DisabledStateDidChange);
     }
 
     get domNodeIdentifier()
@@ -83,7 +83,7 @@
 
         this._domNodeIdentifier = nodeIdentifier;
 
-        this.dispatchEventToListeners(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange, data);
+        this.dispatchEventToListeners(WI.DOMBreakpoint.Event.ResolvedStateDidChange, data);
     }
 
     get serializableInfo()
@@ -97,23 +97,23 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.DOMBreakpoint.DocumentURLCookieKey] = this.url;
-        cookie[WebInspector.DOMBreakpoint.NodePathCookieKey] = this.path;
-        cookie[WebInspector.DOMBreakpoint.TypeCookieKey] = this.type;
+        cookie[WI.DOMBreakpoint.DocumentURLCookieKey] = this.url;
+        cookie[WI.DOMBreakpoint.NodePathCookieKey] = this.path;
+        cookie[WI.DOMBreakpoint.TypeCookieKey] = this.type;
     }
 };
 
-WebInspector.DOMBreakpoint.DocumentURLCookieKey = "dom-breakpoint-document-url";
-WebInspector.DOMBreakpoint.NodePathCookieKey = "dom-breakpoint-node-path";
-WebInspector.DOMBreakpoint.TypeCookieKey = "dom-breakpoint-type";
+WI.DOMBreakpoint.DocumentURLCookieKey = "dom-breakpoint-document-url";
+WI.DOMBreakpoint.NodePathCookieKey = "dom-breakpoint-node-path";
+WI.DOMBreakpoint.TypeCookieKey = "dom-breakpoint-type";
 
-WebInspector.DOMBreakpoint.Type = {
+WI.DOMBreakpoint.Type = {
     SubtreeModified: "subtree-modified",
     AttributeModified: "attribute-modified",
     NodeRemoved: "node-removed",
 };
 
-WebInspector.DOMBreakpoint.Event = {
+WI.DOMBreakpoint.Event = {
     DisabledStateDidChange: "dom-breakpoint-disabled-state-did-change",
     ResolvedStateDidChange: "dom-breakpoint-resolved-state-did-change",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMNode.js b/Source/WebInspectorUI/UserInterface/Models/DOMNode.js
index ce44a61..b1aa9d8 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DOMNode.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DOMNode.js
@@ -30,7 +30,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMNode = class DOMNode extends WebInspector.Object
+WI.DOMNode = class DOMNode extends WI.Object
 {
     constructor(domTreeManager, doc, isInShadowTree, payload)
     {
@@ -80,7 +80,7 @@
         if (payload.shadowRoots) {
             for (var i = 0; i < payload.shadowRoots.length; ++i) {
                 var root = payload.shadowRoots[i];
-                var node = new WebInspector.DOMNode(this._domTreeManager, this.ownerDocument, true, root);
+                var node = new WI.DOMNode(this._domTreeManager, this.ownerDocument, true, root);
                 node.parentNode = this;
                 this._shadowRoots.push(node);
             }
@@ -92,26 +92,26 @@
             this._children = this._shadowRoots.slice();
 
         if (this._nodeType === Node.ELEMENT_NODE)
-            this._customElementState = payload.customElementState || WebInspector.DOMNode.CustomElementState.Builtin;
+            this._customElementState = payload.customElementState || WI.DOMNode.CustomElementState.Builtin;
         else
             this._customElementState = null;
 
         if (payload.templateContent) {
-            this._templateContent = new WebInspector.DOMNode(this._domTreeManager, this.ownerDocument, false, payload.templateContent);
+            this._templateContent = new WI.DOMNode(this._domTreeManager, this.ownerDocument, false, payload.templateContent);
             this._templateContent.parentNode = this;
         }
 
         this._pseudoElements = new Map;
         if (payload.pseudoElements) {
             for (var i = 0; i < payload.pseudoElements.length; ++i) {
-                var node = new WebInspector.DOMNode(this._domTreeManager, this.ownerDocument, this._isInShadowTree, payload.pseudoElements[i]);
+                var node = new WI.DOMNode(this._domTreeManager, this.ownerDocument, this._isInShadowTree, payload.pseudoElements[i]);
                 node.parentNode = this;
                 this._pseudoElements.set(node.pseudoType(), node);
             }
         }
 
         if (payload.contentDocument) {
-            this._contentDocument = new WebInspector.DOMNode(this._domTreeManager, null, false, payload.contentDocument);
+            this._contentDocument = new WI.DOMNode(this._domTreeManager, null, false, payload.contentDocument);
             this._children = [this._contentDocument];
             this._renumber();
         }
@@ -149,7 +149,7 @@
     get frame()
     {
         if (!this._frame)
-            this._frame = WebInspector.frameResourceManager.frameForIdentifier(this.frameIdentifier);
+            this._frame = WI.frameResourceManager.frameForIdentifier(this.frameIdentifier);
         return this._frame;
     }
 
@@ -158,7 +158,7 @@
         if (!this._children)
             return null;
 
-        if (WebInspector.showShadowDOMSetting.value)
+        if (WI.showShadowDOMSetting.value)
             return this._children;
 
         if (this._filteredChildrenNeedsUpdating) {
@@ -193,7 +193,7 @@
 
     get nextSibling()
     {
-        if (WebInspector.showShadowDOMSetting.value)
+        if (WI.showShadowDOMSetting.value)
             return this._nextSibling;
 
         var node = this._nextSibling;
@@ -207,7 +207,7 @@
 
     get previousSibling()
     {
-        if (WebInspector.showShadowDOMSetting.value)
+        if (WI.showShadowDOMSetting.value)
             return this._previousSibling;
 
         var node = this._previousSibling;
@@ -225,7 +225,7 @@
         if (children)
             return children.length;
 
-        if (WebInspector.showShadowDOMSetting.value)
+        if (WI.showShadowDOMSetting.value)
             return this._childNodeCount + this._shadowRoots.length;
 
         return this._childNodeCount;
@@ -273,7 +273,7 @@
 
     isCustomElement()
     {
-        return this._customElementState === WebInspector.DOMNode.CustomElementState.Custom;
+        return this._customElementState === WI.DOMNode.CustomElementState.Custom;
     }
 
     customElementState()
@@ -288,7 +288,7 @@
 
     isUserAgentShadowRoot()
     {
-        return this._shadowRootType === WebInspector.DOMNode.ShadowRootType.UserAgent;
+        return this._shadowRootType === WI.DOMNode.ShadowRootType.UserAgent;
     }
 
     ancestorShadowRoot()
@@ -360,12 +360,12 @@
 
     beforePseudoElement()
     {
-        return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementType.Before) || null;
+        return this._pseudoElements.get(WI.DOMNode.PseudoElementType.Before) || null;
     }
 
     afterPseudoElement()
     {
-        return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementType.After) || null;
+        return this._pseudoElements.get(WI.DOMNode.PseudoElementType.After) || null;
     }
 
     shadowRoots()
@@ -455,7 +455,7 @@
             object.release();
         }
 
-        WebInspector.RemoteObject.resolveNode(this, "", resolvedNode);
+        WI.RemoteObject.resolveNode(this, "", resolvedNode);
     }
 
     scrollIntoView()
@@ -474,7 +474,7 @@
             object.release();
         }
 
-        WebInspector.RemoteObject.resolveNode(this, "", resolvedNode);
+        WI.RemoteObject.resolveNode(this, "", resolvedNode);
     }
 
     getChildNodes(callback)
@@ -698,7 +698,7 @@
 
     _insertChild(prev, payload)
     {
-        var node = new WebInspector.DOMNode(this._domTreeManager, this.ownerDocument, this._isInShadowTree, payload);
+        var node = new WI.DOMNode(this._domTreeManager, this.ownerDocument, this._isInShadowTree, payload);
         if (!prev) {
             if (!this._children) {
                 // First node
@@ -732,7 +732,7 @@
 
         this._children = this._shadowRoots.slice();
         for (var i = 0; i < payloads.length; ++i) {
-            var node = new WebInspector.DOMNode(this._domTreeManager, this.ownerDocument, this._isInShadowTree, payloads[i]);
+            var node = new WI.DOMNode(this._domTreeManager, this.ownerDocument, this._isInShadowTree, payloads[i]);
             this._children.push(node);
         }
         this._renumber();
@@ -811,7 +811,7 @@
         function changed(error)
         {
             if (!error)
-                this.dispatchEventToListeners(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged);
+                this.dispatchEventToListeners(WI.DOMNode.Event.EnabledPseudoClassesChanged);
         }
 
         CSSAgent.forcePseudoState(this.id, pseudoClasses, changed.bind(this));
@@ -830,24 +830,24 @@
     }
 };
 
-WebInspector.DOMNode.Event = {
+WI.DOMNode.Event = {
     EnabledPseudoClassesChanged: "dom-node-enabled-pseudo-classes-did-change",
     AttributeModified: "dom-node-attribute-modified",
     AttributeRemoved: "dom-node-attribute-removed"
 };
 
-WebInspector.DOMNode.PseudoElementType = {
+WI.DOMNode.PseudoElementType = {
     Before: "before",
     After: "after",
 };
 
-WebInspector.DOMNode.ShadowRootType = {
+WI.DOMNode.ShadowRootType = {
     UserAgent: "user-agent",
     Closed: "closed",
     Open: "open",
 };
 
-WebInspector.DOMNode.CustomElementState = {
+WI.DOMNode.CustomElementState = {
     Builtin: "builtin",
     Custom: "custom",
     Waiting: "waiting",
diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js b/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
index abc949a..71ace2e 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMNodeStyles = class DOMNodeStyles extends WebInspector.Object
+WI.DOMNodeStyles = class DOMNodeStyles extends WI.Object
 {
     constructor(node)
     {
@@ -75,9 +75,9 @@
 
         this._needsRefresh = false;
 
-        let fetchedMatchedStylesPromise = new WebInspector.WrappedPromise;
-        let fetchedInlineStylesPromise = new WebInspector.WrappedPromise;
-        let fetchedComputedStylesPromise = new WebInspector.WrappedPromise;
+        let fetchedMatchedStylesPromise = new WI.WrappedPromise;
+        let fetchedInlineStylesPromise = new WI.WrappedPromise;
+        let fetchedComputedStylesPromise = new WI.WrappedPromise;
 
         // Ensure we resolve these promises even in the case of an error.
         function wrap(func, promise) {
@@ -137,7 +137,7 @@
                 var inheritedRulePayload = inheritedRulesPayload[i];
 
                 var inheritedRuleInfo = {node: currentNode};
-                inheritedRuleInfo.inlineStyle = inheritedRulePayload.inlineStyle ? this._parseStyleDeclarationPayload(inheritedRulePayload.inlineStyle, currentNode, true, WebInspector.CSSStyleDeclaration.Type.Inline) : null;
+                inheritedRuleInfo.inlineStyle = inheritedRulePayload.inlineStyle ? this._parseStyleDeclarationPayload(inheritedRulePayload.inlineStyle, currentNode, true, WI.CSSStyleDeclaration.Type.Inline) : null;
                 inheritedRuleInfo.matchedRules = inheritedRulePayload.matchedCSSRules ? parseRuleMatchArrayPayload.call(this, inheritedRulePayload.matchedCSSRules, currentNode, true) : [];
 
                 if (inheritedRuleInfo.inlineStyle || inheritedRuleInfo.matchedRules.length)
@@ -152,8 +152,8 @@
 
         function fetchedInlineStyles(error, inlineStylePayload, attributesStylePayload)
         {
-            this._inlineStyle = inlineStylePayload ? this._parseStyleDeclarationPayload(inlineStylePayload, this._node, false, WebInspector.CSSStyleDeclaration.Type.Inline) : null;
-            this._attributesStyle = attributesStylePayload ? this._parseStyleDeclarationPayload(attributesStylePayload, this._node, false, WebInspector.CSSStyleDeclaration.Type.Attribute) : null;
+            this._inlineStyle = inlineStylePayload ? this._parseStyleDeclarationPayload(inlineStylePayload, this._node, false, WI.CSSStyleDeclaration.Type.Inline) : null;
+            this._attributesStyle = attributesStylePayload ? this._parseStyleDeclarationPayload(attributesStylePayload, this._node, false, WI.CSSStyleDeclaration.Type.Attribute) : null;
 
             this._updateStyleCascade();
 
@@ -166,7 +166,7 @@
             for (var i = 0; computedPropertiesPayload && i < computedPropertiesPayload.length; ++i) {
                 var propertyPayload = computedPropertiesPayload[i];
 
-                var canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(propertyPayload.name);
+                var canonicalName = WI.cssStyleManager.canonicalNameForPropertyName(propertyPayload.name);
                 propertyPayload.implicit = !this._propertyNameToEffectivePropertyMap[canonicalName];
 
                 var property = this._parseStylePropertyPayload(propertyPayload, NaN, this._computedStyle);
@@ -178,7 +178,7 @@
             if (this._computedStyle)
                 this._computedStyle.update(null, properties);
             else
-                this._computedStyle = new WebInspector.CSSStyleDeclaration(this, null, null, WebInspector.CSSStyleDeclaration.Type.Computed, this._node, false, null, properties);
+                this._computedStyle = new WI.CSSStyleDeclaration(this, null, null, WI.CSSStyleDeclaration.Type.Computed, this._node, false, null, properties);
 
             let significantChange = false;
             for (let key in this._styleDeclarationsMap) {
@@ -205,7 +205,7 @@
                 if (!this._includeUserAgentRulesOnNextRefresh) {
                     // We can assume all the styles with the same key are from the same stylesheet and rule, so we only check the first.
                     let firstStyle = this._styleDeclarationsMap[key][0];
-                    if (firstStyle && firstStyle.ownerRule && firstStyle.ownerRule.type === WebInspector.CSSStyleSheet.Type.UserAgent) {
+                    if (firstStyle && firstStyle.ownerRule && firstStyle.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent) {
                         // User Agent styles get different identifiers after some edits. This would cause us to fire a significant refreshed
                         // event more than it is helpful. And since the user agent stylesheet is static it shouldn't match differently
                         // between refreshes for the same node. This issue is tracked by: https://webkit.org/b/110055
@@ -227,7 +227,7 @@
                     if (!this._includeUserAgentRulesOnNextRefresh) {
                         // See above for why we skip user agent style rules.
                         var firstStyle = this._previousStyleDeclarationsMap[key][0];
-                        if (firstStyle && firstStyle.ownerRule && firstStyle.ownerRule.type === WebInspector.CSSStyleSheet.Type.UserAgent)
+                        if (firstStyle && firstStyle.ownerRule && firstStyle.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent)
                             continue;
                     }
 
@@ -243,13 +243,13 @@
             delete this._previousRulesMap;
             delete this._previousStyleDeclarationsMap;
 
-            this.dispatchEventToListeners(WebInspector.DOMNodeStyles.Event.Refreshed, {significantChange});
+            this.dispatchEventToListeners(WI.DOMNodeStyles.Event.Refreshed, {significantChange});
 
             fetchedComputedStylesPromise.resolve();
         }
 
         // FIXME: Convert to pushing StyleSheet information to the frontend. <rdar://problem/13213680>
-        WebInspector.cssStyleManager.fetchStyleSheetsIfNeeded();
+        WI.cssStyleManager.fetchStyleSheetsIfNeeded();
 
         CSSAgent.getMatchedStylesForNode.invoke({nodeId: this._node.id, includePseudo: true, includeInherited: true}, wrap.call(this, fetchedMatchedStyles, fetchedMatchedStylesPromise));
         CSSAgent.getInlineStylesForNode.invoke({nodeId: this._node.id}, wrap.call(this, fetchedInlineStyles, fetchedInlineStylesPromise));
@@ -309,9 +309,9 @@
         }
 
         if (styleSheetId)
-            inspectorStyleSheetAvailable.call(this, WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId));
+            inspectorStyleSheetAvailable.call(this, WI.cssStyleManager.styleSheetForIdentifier(styleSheetId));
         else
-            WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._node.frame, inspectorStyleSheetAvailable.bind(this));
+            WI.cssStyleManager.preferredInspectorStyleSheetForFrame(this._node.frame, inspectorStyleSheetAvailable.bind(this));
     }
 
     rulesForSelector(selector)
@@ -371,7 +371,7 @@
         if (property)
             return property;
 
-        let canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(name);
+        let canonicalName = WI.cssStyleManager.canonicalNameForPropertyName(name);
         return this._propertyNameToEffectivePropertyMap[canonicalName] || null;
     }
 
@@ -441,7 +441,7 @@
     changeRuleSelector(rule, selector)
     {
         selector = selector || "";
-        let result = new WebInspector.WrappedPromise;
+        let result = new WI.WrappedPromise;
 
         function ruleSelectorChanged(error, rulePayload)
         {
@@ -494,7 +494,7 @@
 
         // Try to use the node to find the frame which has the correct resource first.
         if (this._node.ownerDocument) {
-            var mainResource = WebInspector.frameResourceManager.resourceForURL(this._node.ownerDocument.documentURL);
+            var mainResource = WI.frameResourceManager.resourceForURL(this._node.ownerDocument.documentURL);
             if (mainResource) {
                 var parentFrame = mainResource.parentFrame;
                 sourceCode = parentFrame.resourceForURL(sourceURL);
@@ -503,7 +503,7 @@
 
         // If that didn't find the resource, then search all frames.
         if (!sourceCode)
-            sourceCode = WebInspector.frameResourceManager.resourceForURL(sourceURL);
+            sourceCode = WI.frameResourceManager.resourceForURL(sourceURL);
 
         if (!sourceCode)
             return null;
@@ -516,7 +516,7 @@
         if (!payload)
             return null;
 
-        return new WebInspector.TextRange(payload.startLine, payload.startColumn, payload.endLine, payload.endColumn);
+        return new WI.TextRange(payload.startLine, payload.startColumn, payload.endLine, payload.endColumn);
     }
 
     _parseStylePropertyPayload(payload, index, styleDeclaration, styleText)
@@ -578,7 +578,7 @@
             }
         }
 
-        return new WebInspector.CSSProperty(index, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange);
+        return new WI.CSSProperty(index, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange);
     }
 
     _parseStyleDeclarationPayload(payload, node, inherited, type, rule, updateAllStyles)
@@ -592,7 +592,7 @@
         var id = payload.styleId;
         var mapKey = id ? id.styleSheetId + ":" + id.ordinal : null;
 
-        if (type === WebInspector.CSSStyleDeclaration.Type.Attribute)
+        if (type === WI.CSSStyleDeclaration.Type.Attribute)
             mapKey = node.id + ":attribute";
 
         var styleDeclaration = rule ? rule.style : null;
@@ -660,7 +660,7 @@
         for (var i = 0; payload.cssProperties && i < payload.cssProperties.length; ++i) {
             var propertyPayload = payload.cssProperties[i];
 
-            if (inherited && WebInspector.CSSProperty.isInheritedPropertyName(propertyPayload.name))
+            if (inherited && WI.CSSProperty.isInheritedPropertyName(propertyPayload.name))
                 ++inheritedPropertyCount;
 
             var property = this._parseStylePropertyPayload(propertyPayload, i, styleDeclaration, text);
@@ -674,17 +674,17 @@
             return styleDeclaration;
         }
 
-        var styleSheet = id ? WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
+        var styleSheet = id ? WI.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
         if (styleSheet) {
-            if (type === WebInspector.CSSStyleDeclaration.Type.Inline)
+            if (type === WI.CSSStyleDeclaration.Type.Inline)
                 styleSheet.markAsInlineStyleAttributeStyleSheet();
-            styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
+            styleSheet.addEventListener(WI.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
         }
 
         if (inherited && !inheritedPropertyCount)
             return null;
 
-        styleDeclaration = new WebInspector.CSSStyleDeclaration(this, styleSheet, id, type, node, inherited, text, properties, styleSheetTextRange);
+        styleDeclaration = new WI.CSSStyleDeclaration(this, styleSheet, id, type, node, inherited, text, properties, styleSheetTextRange);
 
         if (mapKey) {
             styleDeclarations.push(styleDeclaration);
@@ -704,12 +704,12 @@
         // Now they are CSSSelector objects with multiple properties.
         if (typeof selectors[0] === "string") {
             return selectors.map(function(selectorText) {
-                return new WebInspector.CSSSelector(selectorText);
+                return new WI.CSSSelector(selectorText);
             });
         }
 
         return selectors.map(function(selectorPayload) {
-            return new WebInspector.CSSSelector(selectorPayload.text, selectorPayload.specificity, selectorPayload.dynamic);
+            return new WI.CSSSelector(selectorPayload.text, selectorPayload.specificity, selectorPayload.dynamic);
         });
     }
 
@@ -752,15 +752,15 @@
             }
         }
 
-        var style = this._parseStyleDeclarationPayload(payload.style, node, inherited, WebInspector.CSSStyleDeclaration.Type.Rule, rule);
+        var style = this._parseStyleDeclarationPayload(payload.style, node, inherited, WI.CSSStyleDeclaration.Type.Rule, rule);
         if (!style)
             return null;
 
-        var styleSheet = id ? WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
+        var styleSheet = id ? WI.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
 
         var selectorText = payload.selectorList.text;
         var selectors = this._parseSelectorListPayload(payload.selectorList);
-        var type = WebInspector.CSSStyleManager.protocolStyleSheetOriginToEnum(payload.origin);
+        var type = WI.CSSStyleManager.protocolStyleSheetOriginToEnum(payload.origin);
 
         var sourceCodeLocation = null;
         var sourceRange = payload.selectorList.range;
@@ -781,13 +781,13 @@
         var mediaList = [];
         for (var i = 0; payload.media && i < payload.media.length; ++i) {
             var mediaItem = payload.media[i];
-            var mediaType = WebInspector.CSSStyleManager.protocolMediaSourceToEnum(mediaItem.source);
+            var mediaType = WI.CSSStyleManager.protocolMediaSourceToEnum(mediaItem.source);
             var mediaText = mediaItem.text;
             var mediaSourceCodeLocation = this._createSourceCodeLocation(mediaItem.sourceURL, mediaItem.sourceLine);
             if (styleSheet)
                 mediaSourceCodeLocation = styleSheet.offsetSourceCodeLocation(mediaSourceCodeLocation);
 
-            mediaList.push(new WebInspector.CSSMedia(mediaType, mediaText, mediaSourceCodeLocation));
+            mediaList.push(new WI.CSSMedia(mediaType, mediaText, mediaSourceCodeLocation));
         }
 
         if (rule) {
@@ -796,9 +796,9 @@
         }
 
         if (styleSheet)
-            styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
+            styleSheet.addEventListener(WI.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
 
-        rule = new WebInspector.CSSRule(this, styleSheet, id, type, sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList);
+        rule = new WI.CSSRule(this, styleSheet, id, type, sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList);
 
         if (mapKey)
             this._rulesMap[mapKey] = rule;
@@ -809,7 +809,7 @@
     _markAsNeedsRefresh()
     {
         this._needsRefresh = true;
-        this.dispatchEventToListeners(WebInspector.DOMNodeStyles.Event.NeedsRefresh);
+        this.dispatchEventToListeners(WI.DOMNodeStyles.Event.NeedsRefresh);
     }
 
     _styleSheetContentDidChange(event)
@@ -869,13 +869,13 @@
             // Only append to the result array here for author and inspector rules since attribute
             // styles come between author rules and user/user agent rules.
             switch (rule.type) {
-            case WebInspector.CSSStyleSheet.Type.Inspector:
-            case WebInspector.CSSStyleSheet.Type.Author:
+            case WI.CSSStyleSheet.Type.Inspector:
+            case WI.CSSStyleSheet.Type.Author:
                 result.push(rule.style);
                 break;
 
-            case WebInspector.CSSStyleSheet.Type.User:
-            case WebInspector.CSSStyleSheet.Type.UserAgent:
+            case WI.CSSStyleSheet.Type.User:
+            case WI.CSSStyleSheet.Type.UserAgent:
                 userAndUserAgentStyles.push(rule.style);
                 break;
             }
@@ -949,7 +949,7 @@
                 if (!property.valid)
                     continue;
 
-                if (!WebInspector.CSSCompletions.cssNameCompletions.isShorthandPropertyName(property.name))
+                if (!WI.CSSCompletions.cssNameCompletions.isShorthandPropertyName(property.name))
                     continue;
 
                 if (knownShorthands[property.canonicalName] && !knownShorthands[property.canonicalName].overridden) {
@@ -969,7 +969,7 @@
                 var shorthandProperty = null;
 
                 if (!isEmptyObject(knownShorthands)) {
-                    var possibleShorthands = WebInspector.CSSCompletions.cssNameCompletions.shorthandsForLonghand(property.canonicalName);
+                    var possibleShorthands = WI.CSSCompletions.cssNameCompletions.shorthandsForLonghand(property.canonicalName);
                     for (var k = 0; k < possibleShorthands.length; ++k) {
                         if (possibleShorthands[k] in knownShorthands) {
                             shorthandProperty = knownShorthands[possibleShorthands[k]];
@@ -1001,7 +1001,7 @@
     }
 };
 
-WebInspector.DOMNodeStyles.Event = {
+WI.DOMNodeStyles.Event = {
     NeedsRefresh: "dom-node-styles-needs-refresh",
     Refreshed: "dom-node-styles-refreshed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js b/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js
index 0914ab1..7df4ef7 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMSearchMatchObject = class DOMSearchMatchObject
+WI.DOMSearchMatchObject = class DOMSearchMatchObject
 {
     constructor(resource, domNode, title, searchTerm, textRange)
     {
-        console.assert(resource instanceof WebInspector.Resource);
-        console.assert(domNode instanceof WebInspector.DOMNode);
+        console.assert(resource instanceof WI.Resource);
+        console.assert(domNode instanceof WI.DOMNode);
 
         this._resource = resource;
         this._domNode = domNode;
@@ -120,10 +120,10 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.DOMSearchMatchObject.URLCookieKey] = this._resource.url.hash;
-        cookie[WebInspector.DOMSearchMatchObject.TitleKey] = this._title;
+        cookie[WI.DOMSearchMatchObject.URLCookieKey] = this._resource.url.hash;
+        cookie[WI.DOMSearchMatchObject.TitleKey] = this._title;
         var textRange = this._sourceCodeTextRange.textRange;
-        cookie[WebInspector.DOMSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
+        cookie[WI.DOMSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
     }
 
     // Private
@@ -132,39 +132,39 @@
     {
         switch (this._domNode.nodeType()) {
         case Node.ELEMENT_NODE:
-            return WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchElementIconStyleClassName;
 
         case Node.TEXT_NODE:
-            return WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName;
 
         case Node.COMMENT_NODE:
-            return WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName;
 
         case Node.DOCUMENT_TYPE_NODE:
-            return WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;
 
         case Node.CDATA_SECTION_NODE:
-            return WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName;
 
         case Node.PROCESSING_INSTRUCTION_NODE:
             // <rdar://problem/12800950> Need icon for DOCUMENT_FRAGMENT_NODE and PROCESSING_INSTRUCTION_NODE
-            return WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;
 
         default:
             console.error("Unknown DOM node type: ", this._domNode.nodeType());
-            return WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName;
+            return WI.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName;
         }
     }
 };
 
-WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName = "dom-match-element-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName = "dom-match-text-node-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName = "dom-match-comment-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName = "dom-match-document-type-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName = "dom-match-character-data-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName = "dom-match-node-icon";
+WI.DOMSearchMatchObject.DOMMatchElementIconStyleClassName = "dom-match-element-icon";
+WI.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName = "dom-match-text-node-icon";
+WI.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName = "dom-match-comment-icon";
+WI.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName = "dom-match-document-type-icon";
+WI.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName = "dom-match-character-data-icon";
+WI.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName = "dom-match-node-icon";
 
-WebInspector.DOMSearchMatchObject.TypeIdentifier = "dom-search-match-object";
-WebInspector.DOMSearchMatchObject.URLCookieKey = "resource-url";
-WebInspector.DOMSearchMatchObject.TitleKey = "title";
-WebInspector.DOMSearchMatchObject.TextRangeKey = "text-range";
+WI.DOMSearchMatchObject.TypeIdentifier = "dom-search-match-object";
+WI.DOMSearchMatchObject.URLCookieKey = "resource-url";
+WI.DOMSearchMatchObject.TitleKey = "title";
+WI.DOMSearchMatchObject.TextRangeKey = "text-range";
diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js b/Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js
index ac03b8d..0144328 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMStorageObject = class DOMStorageObject extends WebInspector.Object
+WI.DOMStorageObject = class DOMStorageObject extends WI.Object
 {
     constructor(id, host, isLocalStorage)
     {
@@ -43,8 +43,8 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.DOMStorageObject.HostCookieKey] = this.host;
-        cookie[WebInspector.DOMStorageObject.LocalStorageCookieKey] = this.isLocalStorage();
+        cookie[WI.DOMStorageObject.HostCookieKey] = this.host;
+        cookie[WI.DOMStorageObject.LocalStorageCookieKey] = this.isLocalStorage();
     }
 
     isLocalStorage()
@@ -85,33 +85,33 @@
     itemsCleared()
     {
         this._entries.clear();
-        this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemsCleared);
+        this.dispatchEventToListeners(WI.DOMStorageObject.Event.ItemsCleared);
     }
 
     itemRemoved(key)
     {
         this._entries.delete(key);
-        this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemRemoved, {key});
+        this.dispatchEventToListeners(WI.DOMStorageObject.Event.ItemRemoved, {key});
     }
 
     itemAdded(key, value)
     {
         this._entries.set(key, value);
-        this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemAdded, {key, value});
+        this.dispatchEventToListeners(WI.DOMStorageObject.Event.ItemAdded, {key, value});
     }
 
     itemUpdated(key, oldValue, value)
     {
         this._entries.set(key, value);
-        this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemUpdated, {key, oldValue, value});
+        this.dispatchEventToListeners(WI.DOMStorageObject.Event.ItemUpdated, {key, oldValue, value});
     }
 };
 
-WebInspector.DOMStorageObject.TypeIdentifier = "dom-storage";
-WebInspector.DOMStorageObject.HostCookieKey = "dom-storage-object-host";
-WebInspector.DOMStorageObject.LocalStorageCookieKey = "dom-storage-object-local-storage";
+WI.DOMStorageObject.TypeIdentifier = "dom-storage";
+WI.DOMStorageObject.HostCookieKey = "dom-storage-object-host";
+WI.DOMStorageObject.LocalStorageCookieKey = "dom-storage-object-local-storage";
 
-WebInspector.DOMStorageObject.Event = {
+WI.DOMStorageObject.Event = {
     ItemsCleared: "dom-storage-object-items-cleared",
     ItemAdded: "dom-storage-object-item-added",
     ItemRemoved: "dom-storage-object-item-removed",
diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMTree.js b/Source/WebInspectorUI/UserInterface/Models/DOMTree.js
index dfabd48..3f79372 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DOMTree.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DOMTree.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTree = class DOMTree extends WebInspector.Object
+WI.DOMTree = class DOMTree extends WI.Object
 {
     constructor(frame)
     {
@@ -33,21 +33,21 @@
 
         this._rootDOMNode = null;
         this._requestIdentifier = 0;
-        this._contentFlowCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.ContentFlow);
+        this._contentFlowCollection = new WI.Collection(WI.Collection.TypeVerifier.ContentFlow);
 
-        this._frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextChanged, this);
+        this._frame.addEventListener(WI.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextChanged, this);
 
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated, this._documentUpdated, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.DocumentUpdated, this._documentUpdated, this);
 
         // Only add extra event listeners when not the main frame. Since DocumentUpdated is enough for the main frame.
         if (!this._frame.isMainFrame()) {
-            WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
-            this._frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._frameMainResourceDidChange, this);
+            WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
+            this._frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._frameMainResourceDidChange, this);
         }
 
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated, this._contentFlowListWasUpdated, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded, this._contentFlowWasAdded, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, this._contentFlowWasRemoved, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.ContentFlowListWasUpdated, this._contentFlowListWasUpdated, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.ContentFlowWasAdded, this._contentFlowWasAdded, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.ContentFlowWasRemoved, this._contentFlowWasRemoved, this);
     }
 
     // Public
@@ -57,7 +57,7 @@
 
     disconnect()
     {
-        WebInspector.domTreeManager.removeEventListener(null, null, this);
+        WI.domTreeManager.removeEventListener(null, null, this);
         this._frame.removeEventListener(null, null, this);
     }
 
@@ -77,7 +77,7 @@
         {
             this._invalidateTimeoutIdentifier = undefined;
 
-            this.dispatchEventToListeners(WebInspector.DOMTree.Event.RootDOMNodeInvalidated);
+            this.dispatchEventToListeners(WI.DOMTree.Event.RootDOMNodeInvalidated);
         }
 
         // Delay the invalidation on a timeout to coalesce multiple calls to invalidate.
@@ -116,7 +116,7 @@
     {
         this.requestRootDOMNode(function(rootNode) {
             // Let the backend know we are interested about the named flow events for this document.
-            WebInspector.domTreeManager.getNamedFlowCollection(rootNode.id);
+            WI.domTreeManager.getNamedFlowCollection(rootNode.id);
         });
     }
 
@@ -145,7 +145,7 @@
             }
 
             // Convert the RemoteObject to a DOMNode by asking the backend to push it to us.
-            var remoteObject = WebInspector.RemoteObject.fromPayload(result);
+            var remoteObject = WI.RemoteObject.fromPayload(result);
             remoteObject.pushNodeToFrontend(rootDOMNodeAvailable.bind(this, remoteObject));
         }
 
@@ -163,7 +163,7 @@
                 return;
             }
 
-            this._rootDOMNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            this._rootDOMNode = WI.domTreeManager.nodeForId(nodeId);
 
             console.assert(this._rootDOMNode);
             if (!this._rootDOMNode) {
@@ -199,7 +199,7 @@
         // a specific way to request a document given a frame identifier. The child frame approach
         // involves evaluating the JavaScript "document" and resolving that into a DOMNode.
         if (this._frame.isMainFrame())
-            WebInspector.domTreeManager.requestDocument(mainDocumentAvailable.bind(this));
+            WI.domTreeManager.requestDocument(mainDocumentAvailable.bind(this));
         else {
             var contextId = this._frame.pageExecutionContext.id;
             RuntimeAgent.evaluate.invoke({expression: appendWebInspectorSourceURL("document"), objectGroup: "", includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, contextId, returnByValue: false, generatePreview: false}, rootObjectAvailable.bind(this));
@@ -273,10 +273,10 @@
         // Send update events to listeners.
 
         for (let flow of deletedFlows)
-            this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasRemoved, {flow});
+            this.dispatchEventToListeners(WI.DOMTree.Event.ContentFlowWasRemoved, {flow});
 
         for (let flow of newFlows)
-            this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasAdded, {flow});
+            this.dispatchEventToListeners(WI.DOMTree.Event.ContentFlowWasAdded, {flow});
     }
 
     _contentFlowWasAdded(event)
@@ -287,7 +287,7 @@
 
         this._contentFlowCollection.add(flow);
 
-        this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasAdded, {flow});
+        this.dispatchEventToListeners(WI.DOMTree.Event.ContentFlowWasAdded, {flow});
     }
 
     _contentFlowWasRemoved(event)
@@ -298,11 +298,11 @@
 
         this._contentFlowCollection.remove(flow);
 
-        this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasRemoved, {flow});
+        this.dispatchEventToListeners(WI.DOMTree.Event.ContentFlowWasRemoved, {flow});
     }
 };
 
-WebInspector.DOMTree.Event = {
+WI.DOMTree.Event = {
     RootDOMNodeInvalidated: "dom-tree-root-dom-node-invalidated",
     ContentFlowWasAdded: "dom-tree-content-flow-was-added",
     ContentFlowWasRemoved: "dom-tree-content-flow-was-removed"
diff --git a/Source/WebInspectorUI/UserInterface/Models/DatabaseObject.js b/Source/WebInspectorUI/UserInterface/Models/DatabaseObject.js
index db4bfd5..e31a13d 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DatabaseObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DatabaseObject.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseObject = class DatabaseObject
+WI.DatabaseObject = class DatabaseObject
 {
     constructor(id, host, name, version)
     {
         this._id = id;
-        this._host = host ? host : WebInspector.UIString("Local File");
+        this._host = host ? host : WI.UIString("Local File");
         this._name = name;
         this._version = version;
     }
@@ -42,8 +42,8 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.DatabaseObject.HostCookieKey] = this.host;
-        cookie[WebInspector.DatabaseObject.NameCookieKey] = this.name;
+        cookie[WI.DatabaseObject.HostCookieKey] = this.host;
+        cookie[WI.DatabaseObject.NameCookieKey] = this.name;
     }
 
     getTableNames(callback)
@@ -62,20 +62,20 @@
         function queryCallback(error, columnNames, values, sqlError)
         {
             if (error) {
-                errorCallback(WebInspector.UIString("An unexpected error occurred."));
+                errorCallback(WI.UIString("An unexpected error occurred."));
                 return;
             }
 
             if (sqlError) {
                 switch (sqlError.code) {
                 case SQLError.VERSION_ERR:
-                    errorCallback(WebInspector.UIString("Database no longer has expected version."));
+                    errorCallback(WI.UIString("Database no longer has expected version."));
                     break;
                 case SQLError.TOO_LARGE_ERR:
-                    errorCallback(WebInspector.UIString("Data returned from the database is too large."));
+                    errorCallback(WI.UIString("Data returned from the database is too large."));
                     break;
                 default:
-                    errorCallback(WebInspector.UIString("An unexpected error occurred."));
+                    errorCallback(WI.UIString("An unexpected error occurred."));
                     break;
                 }
                 return;
@@ -88,6 +88,6 @@
     }
 };
 
-WebInspector.DatabaseObject.TypeIdentifier = "database";
-WebInspector.DatabaseObject.HostCookieKey = "database-object-host";
-WebInspector.DatabaseObject.NameCookieKey = "database-object-name";
+WI.DatabaseObject.TypeIdentifier = "database";
+WI.DatabaseObject.HostCookieKey = "database-object-host";
+WI.DatabaseObject.NameCookieKey = "database-object-name";
diff --git a/Source/WebInspectorUI/UserInterface/Models/DatabaseTableObject.js b/Source/WebInspectorUI/UserInterface/Models/DatabaseTableObject.js
index c65294e..9264a6d 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DatabaseTableObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DatabaseTableObject.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseTableObject = class DatabaseTableObject
+WI.DatabaseTableObject = class DatabaseTableObject
 {
     constructor(name, database)
     {
-        console.assert(database instanceof WebInspector.DatabaseObject);
+        console.assert(database instanceof WI.DatabaseObject);
 
         this._name = name;
         this._database = database;
@@ -40,9 +40,9 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.DatabaseTableObject.NameCookieKey] = this.name;
+        cookie[WI.DatabaseTableObject.NameCookieKey] = this.name;
     }
 };
 
-WebInspector.DatabaseTableObject.TypeIdentifier = "database-table";
-WebInspector.DatabaseTableObject.NameCookieKey = "database-table-object-name";
+WI.DatabaseTableObject.TypeIdentifier = "database-table";
+WI.DatabaseTableObject.NameCookieKey = "database-table-object-name";
diff --git a/Source/WebInspectorUI/UserInterface/Models/DebuggerDashboard.js b/Source/WebInspectorUI/UserInterface/Models/DebuggerDashboard.js
index 291b601..4411b10 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DebuggerDashboard.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DebuggerDashboard.js
@@ -23,6 +23,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerDashboard = class DebuggerDashboard
+WI.DebuggerDashboard = class DebuggerDashboard
 {
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/DebuggerData.js b/Source/WebInspectorUI/UserInterface/Models/DebuggerData.js
index f35c3d9..e390d13 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DebuggerData.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DebuggerData.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerData = class DebuggerData
+WI.DebuggerData = class DebuggerData
 {
     constructor(target)
     {
-        console.assert(target instanceof WebInspector.Target);
+        console.assert(target instanceof WI.Target);
 
         this._target = target;
 
diff --git a/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js b/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js
index 33b8d6d..e0c0f32 100644
--- a/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js
+++ b/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Object
+WI.DefaultDashboard = class DefaultDashboard extends WI.Object
 {
     constructor()
     {
@@ -32,19 +32,19 @@
         this._waitingForFirstMainResourceToStartTrackingSize = true;
 
         // Necessary event required to track page load time and resource sizes.
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
 
         // Necessary events required to track load of resources.
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
-        WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded, this._resourceWasAdded, this);
-        WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+        WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
+        WI.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
 
         // Necessary events required to track console messages.
-        var logManager = WebInspector.logManager;
-        logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._consoleWasCleared, this);
-        logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, this._consoleMessageAdded, this);
-        logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, this._consoleMessageWasRepeated, this);
+        var logManager = WI.logManager;
+        logManager.addEventListener(WI.LogManager.Event.Cleared, this._consoleWasCleared, this);
+        logManager.addEventListener(WI.LogManager.Event.MessageAdded, this._consoleMessageAdded, this);
+        logManager.addEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, this._consoleMessageWasRepeated, this);
 
         this._resourcesCount = 0;
         this._resourcesSize = 0;
@@ -126,24 +126,24 @@
 
     _dataDidChange()
     {
-        this.dispatchEventToListeners(WebInspector.DefaultDashboard.Event.DataDidChange);
+        this.dispatchEventToListeners(WI.DefaultDashboard.Event.DataDidChange);
     }
 
     _mainResourceDidChange(event)
     {
-        console.assert(event.target instanceof WebInspector.Frame);
+        console.assert(event.target instanceof WI.Frame);
 
         if (!event.target.isMainFrame())
             return;
 
         this._time = 0;
         this._resourcesCount = 1;
-        this._resourcesSize = WebInspector.frameResourceManager.mainFrame.mainResource.size || 0;
+        this._resourcesSize = WI.frameResourceManager.mainFrame.mainResource.size || 0;
 
         // We should only track resource sizes on fresh loads.
         if (this._waitingForFirstMainResourceToStartTrackingSize) {
             this._waitingForFirstMainResourceToStartTrackingSize = false;
-            WebInspector.Resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._resourceSizeDidChange, this);
+            WI.Resource.addEventListener(WI.Resource.Event.SizeDidChange, this._resourceSizeDidChange, this);
         }
 
         this._dataDidChange();
@@ -212,7 +212,7 @@
             this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay);
         }
 
-        var mainFrame = WebInspector.frameResourceManager.mainFrame;
+        var mainFrame = WI.frameResourceManager.mainFrame;
         var mainFrameStartTime = mainFrame.mainResource.firstTimestamp;
         var mainFrameLoadEventTime = mainFrame.loadEventTimestamp;
 
@@ -241,15 +241,15 @@
     _incrementConsoleMessageType(type, increment)
     {
         switch (type) {
-        case WebInspector.ConsoleMessage.MessageLevel.Log:
-        case WebInspector.ConsoleMessage.MessageLevel.Info:
-        case WebInspector.ConsoleMessage.MessageLevel.Debug:
+        case WI.ConsoleMessage.MessageLevel.Log:
+        case WI.ConsoleMessage.MessageLevel.Info:
+        case WI.ConsoleMessage.MessageLevel.Debug:
             this.logs += increment;
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Warning:
+        case WI.ConsoleMessage.MessageLevel.Warning:
             this.issues += increment;
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Error:
+        case WI.ConsoleMessage.MessageLevel.Error:
             this.errors += increment;
             break;
         }
@@ -264,6 +264,6 @@
     }
 };
 
-WebInspector.DefaultDashboard.Event = {
+WI.DefaultDashboard.Event = {
     DataDidChange: "default-dashboard-data-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js b/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js
index 2fe40aa..3bbb2c5 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ExecutionContext = class ExecutionContext
+WI.ExecutionContext = class ExecutionContext
 {
     constructor(target, id, name, isPageContext, frame)
     {
-        console.assert(target instanceof WebInspector.Target);
-        console.assert(typeof id === "number" || id === WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier);
+        console.assert(target instanceof WI.Target);
+        console.assert(typeof id === "number" || id === WI.RuntimeManager.TopLevelExecutionContextIdentifier);
         console.assert(typeof name === "string");
 
         this._target = target;
diff --git a/Source/WebInspectorUI/UserInterface/Models/ExecutionContextList.js b/Source/WebInspectorUI/UserInterface/Models/ExecutionContextList.js
index a3dfdeb..b2b9aa0 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ExecutionContextList.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ExecutionContextList.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ExecutionContextList = class ExecutionContextList
+WI.ExecutionContextList = class ExecutionContextList
 {
     constructor()
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/FPSInstrument.js b/Source/WebInspectorUI/UserInterface/Models/FPSInstrument.js
index a5e4452..e462b84 100644
--- a/Source/WebInspectorUI/UserInterface/Models/FPSInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/FPSInstrument.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FPSInstrument = class FPSInstrument extends WebInspector.Instrument
+WI.FPSInstrument = class FPSInstrument extends WI.Instrument
 {
     constructor()
     {
         super();
 
-        console.assert(WebInspector.FPSInstrument.supported());
+        console.assert(WI.FPSInstrument.supported());
     }
 
     // Static
@@ -44,6 +44,6 @@
 
     get timelineRecordType()
     {
-        return WebInspector.TimelineRecord.Type.RenderingFrame;
+        return WI.TimelineRecord.Type.RenderingFrame;
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/Frame.js b/Source/WebInspectorUI/UserInterface/Models/Frame.js
index d5c6087..aa4c88d 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Frame.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Frame.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Frame = class Frame extends WebInspector.Object
+WI.Frame = class Frame extends WI.Object
 {
     constructor(id, name, securityOrigin, loaderIdentifier, mainResource)
     {
@@ -36,12 +36,12 @@
         this._name = null;
         this._securityOrigin = null;
 
-        this._resourceCollection = new WebInspector.ResourceCollection;
-        this._provisionalResourceCollection = new WebInspector.ResourceCollection;
-        this._extraScriptCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);
-        this._canvasCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Canvas);
+        this._resourceCollection = new WI.ResourceCollection;
+        this._provisionalResourceCollection = new WI.ResourceCollection;
+        this._extraScriptCollection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+        this._canvasCollection = new WI.Collection(WI.Collection.TypeVerifier.Canvas);
 
-        this._childFrameCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Frame);
+        this._childFrameCollection = new WI.Collection(WI.Collection.TypeVerifier.Frame);
         this._childFrameIdentifierMap = new Map;
 
         this._parentFrame = null;
@@ -50,7 +50,7 @@
         this._domContentReadyEventTimestamp = NaN;
         this._loadEventTimestamp = NaN;
 
-        this._executionContextList = new WebInspector.ExecutionContextList;
+        this._executionContextList = new WI.ExecutionContextList;
 
         this.initialize(name, securityOrigin, loaderIdentifier, mainResource);
     }
@@ -90,10 +90,10 @@
             this._dispatchMainResourceDidChangeEvent(oldMainResource);
 
         if (this._securityOrigin !== oldSecurityOrigin)
-            this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange, {oldSecurityOrigin});
+            this.dispatchEventToListeners(WI.Frame.Event.SecurityOriginDidChange, {oldSecurityOrigin});
 
         if (this._name !== oldName)
-            this.dispatchEventToListeners(WebInspector.Frame.Event.NameDidChange, {oldName});
+            this.dispatchEventToListeners(WI.Frame.Event.NameDidChange, {oldName});
     }
 
     startProvisionalLoad(provisionalMainResource)
@@ -107,7 +107,7 @@
 
         this._provisionalResourceCollection.clear();
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadStarted);
+        this.dispatchEventToListeners(WI.Frame.Event.ProvisionalLoadStarted);
     }
 
     commitProvisionalLoad(securityOrigin)
@@ -133,7 +133,7 @@
         this.removeAllResources();
 
         this._resourceCollection = this._provisionalResourceCollection;
-        this._provisionalResourceCollection = new WebInspector.ResourceCollection;
+        this._provisionalResourceCollection = new WI.ResourceCollection;
         this._extraScriptCollection.clear();
         this._canvasCollection.clear();
 
@@ -141,13 +141,13 @@
         this.clearProvisionalLoad(true);
         this.removeAllChildFrames();
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCommitted);
+        this.dispatchEventToListeners(WI.Frame.Event.ProvisionalLoadCommitted);
 
         if (this._mainResource !== oldMainResource)
             this._dispatchMainResourceDidChangeEvent(oldMainResource);
 
         if (this._securityOrigin !== oldSecurityOrigin)
-            this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange, {oldSecurityOrigin});
+            this.dispatchEventToListeners(WI.Frame.Event.SecurityOriginDidChange, {oldSecurityOrigin});
     }
 
     clearProvisionalLoad(skipProvisionalLoadClearedEvent)
@@ -160,7 +160,7 @@
         this._provisionalResourceCollection.clear();
 
         if (!skipProvisionalLoadClearedEvent)
-            this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCleared);
+            this.dispatchEventToListeners(WI.Frame.Event.ProvisionalLoadCleared);
     }
 
     get id()
@@ -196,7 +196,7 @@
     get domTree()
     {
         if (!this._domTree)
-            this._domTree = new WebInspector.DOMTree(this);
+            this._domTree = new WI.DOMTree(this);
         return this._domTree;
     }
 
@@ -215,7 +215,7 @@
         if (this._executionContextList.contexts.length) {
             let contexts = this._executionContextList.contexts.slice();
             this._executionContextList.clear();
-            this.dispatchEventToListeners(WebInspector.Frame.Event.ExecutionContextsCleared, {committingProvisionalLoad: !!committingProvisionalLoad, contexts});
+            this.dispatchEventToListeners(WI.Frame.Event.ExecutionContextsCleared, {committingProvisionalLoad: !!committingProvisionalLoad, contexts});
         }
     }
 
@@ -224,7 +224,7 @@
         var changedPageContext = this._executionContextList.add(context);
 
         if (changedPageContext)
-            this.dispatchEventToListeners(WebInspector.Frame.Event.PageExecutionContextChanged);
+            this.dispatchEventToListeners(WI.Frame.Event.PageExecutionContextChanged);
     }
 
     get mainResource()
@@ -296,8 +296,8 @@
 
     addChildFrame(frame)
     {
-        console.assert(frame instanceof WebInspector.Frame);
-        if (!(frame instanceof WebInspector.Frame))
+        console.assert(frame instanceof WI.Frame);
+        if (!(frame instanceof WI.Frame))
             return;
 
         if (frame._parentFrame === this)
@@ -311,7 +311,7 @@
 
         frame._parentFrame = this;
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasAdded, {childFrame: frame});
+        this.dispatchEventToListeners(WI.Frame.Event.ChildFrameWasAdded, {childFrame: frame});
     }
 
     removeChildFrame(frameOrFrameId)
@@ -319,15 +319,15 @@
         console.assert(frameOrFrameId);
 
         let childFrameId = frameOrFrameId;
-        if (childFrameId instanceof WebInspector.Frame)
+        if (childFrameId instanceof WI.Frame)
             childFrameId = frameOrFrameId._id;
 
-        // Fetch the frame by id even if we were passed a WebInspector.Frame.
-        // We do this incase the WebInspector.Frame is a new object that isn't
+        // Fetch the frame by id even if we were passed a WI.Frame.
+        // We do this incase the WI.Frame is a new object that isn't
         // in _childFrameCollection, but the id is a valid child frame.
         let childFrame = this.childFrameForIdentifier(childFrameId);
-        console.assert(childFrame instanceof WebInspector.Frame);
-        if (!(childFrame instanceof WebInspector.Frame))
+        console.assert(childFrame instanceof WI.Frame);
+        if (!(childFrame instanceof WI.Frame))
             return;
 
         console.assert(childFrame.parentFrame === this);
@@ -337,7 +337,7 @@
 
         childFrame._detachFromParentFrame();
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasRemoved, {childFrame});
+        this.dispatchEventToListeners(WI.Frame.Event.ChildFrameWasRemoved, {childFrame});
     }
 
     removeAllChildFrames()
@@ -350,7 +350,7 @@
         this._childFrameCollection.clear();
         this._childFrameIdentifierMap.clear();
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.AllChildFramesRemoved);
+        this.dispatchEventToListeners(WI.Frame.Event.AllChildFramesRemoved);
     }
 
     resourceForURL(url, recursivelySearchChildFrames)
@@ -386,8 +386,8 @@
 
     addResource(resource)
     {
-        console.assert(resource instanceof WebInspector.Resource);
-        if (!(resource instanceof WebInspector.Resource))
+        console.assert(resource instanceof WI.Resource);
+        if (!(resource instanceof WI.Resource))
             return;
 
         if (resource.parentFrame === this)
@@ -400,10 +400,10 @@
 
         if (this._isProvisionalResource(resource)) {
             this._provisionalResourceCollection.add(resource);
-            this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalResourceWasAdded, {resource});
+            this.dispatchEventToListeners(WI.Frame.Event.ProvisionalResourceWasAdded, {resource});
         } else {
             this._resourceCollection.add(resource);
-            this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasAdded, {resource});
+            this.dispatchEventToListeners(WI.Frame.Event.ResourceWasAdded, {resource});
         }
     }
 
@@ -415,7 +415,7 @@
 
         this._disassociateWithResource(resource);
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasRemoved, {resource});
+        this.dispatchEventToListeners(WI.Frame.Event.ResourceWasRemoved, {resource});
     }
 
     removeAllResources()
@@ -431,20 +431,20 @@
 
         this._resourceCollection.clear();
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.AllResourcesRemoved);
+        this.dispatchEventToListeners(WI.Frame.Event.AllResourcesRemoved);
     }
 
     addExtraScript(script)
     {
         this._extraScriptCollection.add(script);
 
-        this.dispatchEventToListeners(WebInspector.Frame.Event.ExtraScriptAdded, {script});
+        this.dispatchEventToListeners(WI.Frame.Event.ExtraScriptAdded, {script});
     }
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.Frame.MainResourceURLCookieKey] = this.mainResource.url.hash;
-        cookie[WebInspector.Frame.IsMainFrameCookieKey] = this._isMainFrame;
+        cookie[WI.Frame.MainResourceURLCookieKey] = this.mainResource.url.hash;
+        cookie[WI.Frame.IsMainFrameCookieKey] = this._isMainFrame;
     }
 
     // Private
@@ -484,11 +484,11 @@
 
     _dispatchMainResourceDidChangeEvent(oldMainResource)
     {
-        this.dispatchEventToListeners(WebInspector.Frame.Event.MainResourceDidChange, {oldMainResource});
+        this.dispatchEventToListeners(WI.Frame.Event.MainResourceDidChange, {oldMainResource});
     }
 };
 
-WebInspector.Frame.Event = {
+WI.Frame.Event = {
     NameDidChange: "frame-name-did-change",
     SecurityOriginDidChange: "frame-security-origin-did-change",
     MainResourceDidChange: "frame-main-resource-did-change",
@@ -507,6 +507,6 @@
     ExecutionContextsCleared: "frame-execution-contexts-cleared"
 };
 
-WebInspector.Frame.TypeIdentifier = "Frame";
-WebInspector.Frame.MainResourceURLCookieKey = "frame-main-resource-url";
-WebInspector.Frame.IsMainFrameCookieKey = "frame-is-main-frame";
+WI.Frame.TypeIdentifier = "Frame";
+WI.Frame.MainResourceURLCookieKey = "frame-main-resource-url";
+WI.Frame.IsMainFrameCookieKey = "frame-is-main-frame";
diff --git a/Source/WebInspectorUI/UserInterface/Models/GarbageCollection.js b/Source/WebInspectorUI/UserInterface/Models/GarbageCollection.js
index 6a37f9e..91e6723 100644
--- a/Source/WebInspectorUI/UserInterface/Models/GarbageCollection.js
+++ b/Source/WebInspectorUI/UserInterface/Models/GarbageCollection.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GarbageCollection = class GarbageCollection
+WI.GarbageCollection = class GarbageCollection
 {
     constructor(type, startTime, endTime)
     {
@@ -38,11 +38,11 @@
 
     static fromPayload(payload)
     {
-        let type = WebInspector.GarbageCollection.Type.Full;
+        let type = WI.GarbageCollection.Type.Full;
         if (payload.type === HeapAgent.GarbageCollectionType.Partial)
-            type = WebInspector.GarbageCollection.Type.Partial;
+            type = WI.GarbageCollection.Type.Partial;
 
-        return new WebInspector.GarbageCollection(type, payload.startTime, payload.endTime);
+        return new WI.GarbageCollection(type, payload.startTime, payload.endTime);
     }
 
     // Public
@@ -57,7 +57,7 @@
     }
 };
 
-WebInspector.GarbageCollection.Type = {
+WI.GarbageCollection.Type = {
     Partial: Symbol("Partial"),
     Full: Symbol("Full")
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/Geometry.js b/Source/WebInspectorUI/UserInterface/Models/Geometry.js
index 2fde0a5..ce54532 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Geometry.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Geometry.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Point = class Point
+WI.Point = class Point
 {
     constructor(x, y)
     {
@@ -35,25 +35,25 @@
 
     static fromEvent(event)
     {
-        return new WebInspector.Point(event.pageX, event.pageY);
+        return new WI.Point(event.pageX, event.pageY);
     }
 
     static fromEventInElement(event, element)
     {
         var wkPoint = window.webkitConvertPointFromPageToNode(element, new WebKitPoint(event.pageX, event.pageY));
-        return new WebInspector.Point(wkPoint.x, wkPoint.y);
+        return new WI.Point(wkPoint.x, wkPoint.y);
     }
 
     // Public
 
     toString()
     {
-        return "WebInspector.Point[" + this.x + "," + this.y + "]";
+        return "WI.Point[" + this.x + "," + this.y + "]";
     }
 
     copy()
     {
-        return new WebInspector.Point(this.x, this.y);
+        return new WI.Point(this.x, this.y);
     }
 
     equals(anotherPoint)
@@ -69,7 +69,7 @@
     }
 };
 
-WebInspector.Size = class Size
+WI.Size = class Size
 {
     constructor(width, height)
     {
@@ -81,12 +81,12 @@
 
     toString()
     {
-        return "WebInspector.Size[" + this.width + "," + this.height + "]";
+        return "WI.Size[" + this.width + "," + this.height + "]";
     }
 
     copy()
     {
-        return new WebInspector.Size(this.width, this.height);
+        return new WI.Size(this.width, this.height);
     }
 
     equals(anotherSize)
@@ -95,22 +95,22 @@
     }
 };
 
-WebInspector.Size.ZERO_SIZE = new WebInspector.Size(0, 0);
+WI.Size.ZERO_SIZE = new WI.Size(0, 0);
 
 
-WebInspector.Rect = class Rect
+WI.Rect = class Rect
 {
     constructor(x, y, width, height)
     {
-        this.origin = new WebInspector.Point(x || 0, y || 0);
-        this.size = new WebInspector.Size(width || 0, height || 0);
+        this.origin = new WI.Point(x || 0, y || 0);
+        this.size = new WI.Size(width || 0, height || 0);
     }
 
     // Static
 
     static rectFromClientRect(clientRect)
     {
-        return new WebInspector.Rect(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
+        return new WI.Rect(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
     }
 
     static unionOfRects(rects)
@@ -125,12 +125,12 @@
 
     toString()
     {
-        return "WebInspector.Rect[" + [this.origin.x, this.origin.y, this.size.width, this.size.height].join(", ") + "]";
+        return "WI.Rect[" + [this.origin.x, this.origin.y, this.size.width, this.size.height].join(", ") + "]";
     }
 
     copy()
     {
-        return new WebInspector.Rect(this.origin.x, this.origin.y, this.size.width, this.size.height);
+        return new WI.Rect(this.origin.x, this.origin.y, this.size.width, this.size.height);
     }
 
     equals(anotherRect)
@@ -140,7 +140,7 @@
 
     inset(insets)
     {
-        return new WebInspector.Rect(
+        return new WI.Rect(
             this.origin.x + insets.left,
             this.origin.y + insets.top,
             this.size.width - insets.left - insets.right,
@@ -150,7 +150,7 @@
 
     pad(padding)
     {
-        return new WebInspector.Rect(
+        return new WI.Rect(
             this.origin.x - padding,
             this.origin.y - padding,
             this.size.width + padding * 2,
@@ -193,14 +193,14 @@
         var x1 = Math.max(this.minX(), rect.minX());
         var x2 = Math.min(this.maxX(), rect.maxX());
         if (x1 > x2)
-            return WebInspector.Rect.ZERO_RECT;
-        var intersection = new WebInspector.Rect;
+            return WI.Rect.ZERO_RECT;
+        var intersection = new WI.Rect;
         intersection.origin.x = x1;
         intersection.size.width = x2 - x1;
         var y1 = Math.max(this.minY(), rect.minY());
         var y2 = Math.min(this.maxY(), rect.maxY());
         if (y1 > y2)
-            return WebInspector.Rect.ZERO_RECT;
+            return WI.Rect.ZERO_RECT;
         intersection.origin.y = y1;
         intersection.size.height = y2 - y1;
         return intersection;
@@ -212,12 +212,12 @@
         var y = Math.min(this.minY(), rect.minY());
         var width = Math.max(this.maxX(), rect.maxX()) - x;
         var height = Math.max(this.maxY(), rect.maxY()) - y;
-        return new WebInspector.Rect(x, y, width, height);
+        return new WI.Rect(x, y, width, height);
     }
 
     round()
     {
-        return new WebInspector.Rect(
+        return new WI.Rect(
             Math.floor(this.origin.x),
             Math.floor(this.origin.y),
             Math.ceil(this.size.width),
@@ -226,10 +226,10 @@
     }
 };
 
-WebInspector.Rect.ZERO_RECT = new WebInspector.Rect(0, 0, 0, 0);
+WI.Rect.ZERO_RECT = new WI.Rect(0, 0, 0, 0);
 
 
-WebInspector.EdgeInsets = class EdgeInsets
+WI.EdgeInsets = class EdgeInsets
 {
     constructor(top, right, bottom, left)
     {
@@ -258,26 +258,26 @@
 
     copy()
     {
-        return new WebInspector.EdgeInsets(this.top, this.right, this.bottom, this.left);
+        return new WI.EdgeInsets(this.top, this.right, this.bottom, this.left);
     }
 };
 
-WebInspector.RectEdge = {
+WI.RectEdge = {
     MIN_X: 0,
     MIN_Y: 1,
     MAX_X: 2,
     MAX_Y: 3
 };
 
-WebInspector.Quad = class Quad
+WI.Quad = class Quad
 {
     constructor(quad)
     {
         this.points = [
-            new WebInspector.Point(quad[0], quad[1]), // top left
-            new WebInspector.Point(quad[2], quad[3]), // top right
-            new WebInspector.Point(quad[4], quad[5]), // bottom right
-            new WebInspector.Point(quad[6], quad[7])  // bottom left
+            new WI.Point(quad[0], quad[1]), // top left
+            new WI.Point(quad[2], quad[3]), // top right
+            new WI.Point(quad[4], quad[5]), // bottom right
+            new WI.Point(quad[6], quad[7])  // bottom left
         ];
 
         this.width = Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1] - quad[3], 2)));
@@ -297,7 +297,7 @@
     }
 };
 
-WebInspector.Polygon = class Polygon
+WI.Polygon = class Polygon
 {
     constructor(points)
     {
@@ -318,16 +318,16 @@
             minY = Math.min(minY, point.y);
             maxY = Math.max(maxY, point.y);
         }
-        return new WebInspector.Rect(minX, minY, maxX - minX, maxY - minY);
+        return new WI.Rect(minX, minY, maxX - minX, maxY - minY);
     }
 };
 
-WebInspector.CubicBezier = class CubicBezier
+WI.CubicBezier = class CubicBezier
 {
     constructor(x1, y1, x2, y2)
     {
-        this._inPoint = new WebInspector.Point(x1, y1);
-        this._outPoint = new WebInspector.Point(x2, y2);
+        this._inPoint = new WI.Point(x1, y1);
+        this._outPoint = new WI.Point(x2, y2);
 
         // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).
         this._curveInfo = {
@@ -353,7 +353,7 @@
         if (coordinates.includes(NaN))
             return null;
 
-        return new WebInspector.CubicBezier(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
+        return new WI.CubicBezier(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
     }
 
     static fromString(text)
@@ -365,15 +365,15 @@
         if (!trimmedText.length)
             return null;
 
-        if (Object.keys(WebInspector.CubicBezier.keywordValues).includes(trimmedText))
-            return WebInspector.CubicBezier.fromCoordinates(WebInspector.CubicBezier.keywordValues[trimmedText]);
+        if (Object.keys(WI.CubicBezier.keywordValues).includes(trimmedText))
+            return WI.CubicBezier.fromCoordinates(WI.CubicBezier.keywordValues[trimmedText]);
 
         var matches = trimmedText.match(/^cubic-bezier\(([-\d.]+),([-\d.]+),([-\d.]+),([-\d.]+)\)$/);
         if (!matches)
             return null;
 
         matches.splice(0, 1);
-        return WebInspector.CubicBezier.fromCoordinates(matches);
+        return WI.CubicBezier.fromCoordinates(matches);
     }
 
     // Public
@@ -390,14 +390,14 @@
 
     copy()
     {
-        return new WebInspector.CubicBezier(this._inPoint.x, this._inPoint.y, this._outPoint.x, this._outPoint.y);
+        return new WI.CubicBezier(this._inPoint.x, this._inPoint.y, this._outPoint.x, this._outPoint.y);
     }
 
     toString()
     {
         var values = [this._inPoint.x, this._inPoint.y, this._outPoint.x, this._outPoint.y];
-        for (var key in WebInspector.CubicBezier.keywordValues) {
-            if (Array.shallowEqual(WebInspector.CubicBezier.keywordValues[key], values))
+        for (var key in WI.CubicBezier.keywordValues) {
+            if (Array.shallowEqual(WI.CubicBezier.keywordValues[key], values))
                 return key;
         }
 
@@ -469,7 +469,7 @@
     }
 };
 
-WebInspector.CubicBezier.keywordValues = {
+WI.CubicBezier.keywordValues = {
     "ease":         [0.25, 0.1, 0.25, 1],
     "ease-in":      [0.42, 0, 1, 1],
     "ease-out":     [0, 0, 0.58, 1],
@@ -477,7 +477,7 @@
     "linear":       [0, 0, 1, 1]
 };
 
-WebInspector.Spring = class Spring
+WI.Spring = class Spring
 {
     constructor(mass, stiffness, damping, initialVelocity)
     {
@@ -498,7 +498,7 @@
         if (values.includes(NaN))
             return null;
 
-        return new WebInspector.Spring(...values);
+        return new WI.Spring(...values);
     }
 
     static fromString(text)
@@ -514,14 +514,14 @@
         if (!matches)
             return null;
 
-        return WebInspector.Spring.fromValues(matches.slice(1));
+        return WI.Spring.fromValues(matches.slice(1));
     }
 
     // Public
 
     copy()
     {
-        return new WebInspector.Spring(this.mass, this.stiffness, this.damping, this.initialVelocity);
+        return new WI.Spring(this.mass, this.stiffness, this.damping, this.initialVelocity);
     }
 
     toString()
diff --git a/Source/WebInspectorUI/UserInterface/Models/Gradient.js b/Source/WebInspectorUI/UserInterface/Models/Gradient.js
index f9b1c23..df89c16 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Gradient.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Gradient.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Gradient = class Gradient
+WI.Gradient = class Gradient
 {
     constructor(type, stops)
     {
@@ -38,10 +38,10 @@
         var type;
         var openingParenthesisIndex = cssString.indexOf("(");
         var typeString = cssString.substring(0, openingParenthesisIndex);
-        if (typeString.indexOf(WebInspector.Gradient.Types.Linear) !== -1)
-            type = WebInspector.Gradient.Types.Linear;
-        else if (typeString.indexOf(WebInspector.Gradient.Types.Radial) !== -1)
-            type = WebInspector.Gradient.Types.Radial;
+        if (typeString.indexOf(WI.Gradient.Types.Linear) !== -1)
+            type = WI.Gradient.Types.Linear;
+        else if (typeString.indexOf(WI.Gradient.Types.Radial) !== -1)
+            type = WI.Gradient.Types.Radial;
         else
             return null;
 
@@ -89,10 +89,10 @@
             return null;
 
         var gradient;
-        if (type === WebInspector.Gradient.Types.Linear)
-            gradient = WebInspector.LinearGradient.fromComponents(components);
+        if (type === WI.Gradient.Types.Linear)
+            gradient = WI.LinearGradient.fromComponents(components);
         else
-            gradient = WebInspector.RadialGradient.fromComponents(components);
+            gradient = WI.RadialGradient.fromComponents(components);
 
         if (gradient)
             gradient.repeats = typeString.startsWith("repeating");
@@ -105,7 +105,7 @@
         // FIXME: handle lengths.
         var stops = components.map(function(component) {
             while (component.length) {
-                var color = WebInspector.Color.fromString(component.shift());
+                var color = WI.Color.fromString(component.shift());
                 if (!color)
                     continue;
 
@@ -160,16 +160,16 @@
     }
 };
 
-WebInspector.Gradient.Types = {
+WI.Gradient.Types = {
     Linear: "linear-gradient",
     Radial: "radial-gradient"
 };
 
-WebInspector.LinearGradient = class LinearGradient extends WebInspector.Gradient
+WI.LinearGradient = class LinearGradient extends WI.Gradient
 {
     constructor(angle, stops)
     {
-        super(WebInspector.Gradient.Types.Linear, stops);
+        super(WI.Gradient.Types.Linear, stops);
         this._angle = angle;
     }
 
@@ -177,11 +177,11 @@
 
     static fromComponents(components)
     {
-        let angle = {value: 180, units: WebInspector.LinearGradient.AngleUnits.DEG};
+        let angle = {value: 180, units: WI.LinearGradient.AngleUnits.DEG};
 
-        if (components[0].length === 1 && !WebInspector.Color.fromString(components[0][0])) {
+        if (components[0].length === 1 && !WI.Color.fromString(components[0][0])) {
             let match = components[0][0].match(/([-\d\.]+)(\w+)/);
-            if (!match || !Object.values(WebInspector.LinearGradient.AngleUnits).includes(match[2]))
+            if (!match || !Object.values(WI.LinearGradient.AngleUnits).includes(match[2]))
                 return null;
 
             angle.value = parseFloat(match[1]);
@@ -220,17 +220,17 @@
             }
 
             components.shift();
-        } else if (components[0].length !== 1 && !WebInspector.Color.fromString(components[0][0])) {
+        } else if (components[0].length !== 1 && !WI.Color.fromString(components[0][0])) {
             // If the first component is not a color, then we're dealing with a
             // legacy linear gradient format that we don't support.
             return null;
         }
 
-        var stops = WebInspector.Gradient.stopsWithComponents(components);
+        var stops = WI.Gradient.stopsWithComponents(components);
         if (!stops)
             return null;
 
-        return new WebInspector.LinearGradient(angle, stops);
+        return new WI.LinearGradient(angle, stops);
     }
 
     // Public
@@ -255,14 +255,14 @@
 
     copy()
     {
-        return new WebInspector.LinearGradient(this._angle, this.stops.concat());
+        return new WI.LinearGradient(this._angle, this.stops.concat());
     }
 
     toString()
     {
         let str = "";
 
-        let deg = this._angleValueForUnits(WebInspector.LinearGradient.AngleUnits.DEG);
+        let deg = this._angleValueForUnits(WI.LinearGradient.AngleUnits.DEG);
         if (deg === 0)
             str += "to top";
         else if (deg === 45)
@@ -298,43 +298,43 @@
         let deg = 0;
 
         switch (this._angle.units) {
-        case WebInspector.LinearGradient.AngleUnits.DEG:
+        case WI.LinearGradient.AngleUnits.DEG:
             deg = this._angle.value;
             break;
 
-        case WebInspector.LinearGradient.AngleUnits.RAD:
+        case WI.LinearGradient.AngleUnits.RAD:
             deg = this._angle.value * 180 / Math.PI;
             break;
 
-        case WebInspector.LinearGradient.AngleUnits.GRAD:
+        case WI.LinearGradient.AngleUnits.GRAD:
             deg = this._angle.value / 400 * 360;
             break;
 
-        case WebInspector.LinearGradient.AngleUnits.TURN:
+        case WI.LinearGradient.AngleUnits.TURN:
             deg = this._angle.value * 360;
             break;
 
         default:
-            WebInspector.reportInternalError(`Unknown angle units "${this._angle.units}"`);
+            WI.reportInternalError(`Unknown angle units "${this._angle.units}"`);
             return 0;
         }
 
         let value = 0;
 
         switch (units) {
-        case WebInspector.LinearGradient.AngleUnits.DEG:
+        case WI.LinearGradient.AngleUnits.DEG:
             value = deg;
             break;
 
-        case WebInspector.LinearGradient.AngleUnits.RAD:
+        case WI.LinearGradient.AngleUnits.RAD:
             value = deg * Math.PI / 180;
             break;
 
-        case WebInspector.LinearGradient.AngleUnits.GRAD:
+        case WI.LinearGradient.AngleUnits.GRAD:
             value = deg / 360 * 400;
             break;
 
-        case WebInspector.LinearGradient.AngleUnits.TURN:
+        case WI.LinearGradient.AngleUnits.TURN:
             value = deg / 360;
             break;
         }
@@ -343,18 +343,18 @@
     }
 };
 
-WebInspector.LinearGradient.AngleUnits = {
+WI.LinearGradient.AngleUnits = {
     DEG: "deg",
     RAD: "rad",
     GRAD: "grad",
     TURN: "turn",
 };
 
-WebInspector.RadialGradient = class RadialGradient extends WebInspector.Gradient
+WI.RadialGradient = class RadialGradient extends WI.Gradient
 {
     constructor(sizing, stops)
     {
-        super(WebInspector.Gradient.Types.Radial, stops);
+        super(WI.Gradient.Types.Radial, stops);
         this.sizing = sizing;
     }
 
@@ -362,20 +362,20 @@
 
     static fromComponents(components)
     {
-        var sizing = !WebInspector.Color.fromString(components[0].join(" ")) ? components.shift().join(" ") : "";
+        var sizing = !WI.Color.fromString(components[0].join(" ")) ? components.shift().join(" ") : "";
 
-        var stops = WebInspector.Gradient.stopsWithComponents(components);
+        var stops = WI.Gradient.stopsWithComponents(components);
         if (!stops)
             return null;
 
-        return new WebInspector.RadialGradient(sizing, stops);
+        return new WI.RadialGradient(sizing, stops);
     }
 
     // Public
 
     copy()
     {
-        return new WebInspector.RadialGradient(this.sizing, this.stops.concat());
+        return new WI.RadialGradient(this.sizing, this.stops.concat());
     }
 
     toString()
diff --git a/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js b/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
index f35c184..03c33b9 100644
--- a/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapAllocationsInstrument = class HeapAllocationsInstrument extends WebInspector.Instrument
+WI.HeapAllocationsInstrument = class HeapAllocationsInstrument extends WI.Instrument
 {
     constructor()
     {
         super();
 
-        console.assert(WebInspector.HeapAllocationsInstrument.supported());
+        console.assert(WI.HeapAllocationsInstrument.supported());
 
         this._snapshotIntervalIdentifier = undefined;
     }
@@ -46,7 +46,7 @@
 
     get timelineRecordType()
     {
-        return WebInspector.TimelineRecord.Type.HeapAllocations;
+        return WI.TimelineRecord.Type.HeapAllocations;
     }
 
     startInstrumentation(initiatedByBackend)
@@ -76,10 +76,10 @@
     _takeHeapSnapshot()
     {
         HeapAgent.snapshot(function(error, timestamp, snapshotStringData) {
-            let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+            let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
             workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
-                WebInspector.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+                let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                WI.timelineManager.heapSnapshotAdded(timestamp, snapshot);
             });
         });
     }
diff --git a/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsTimelineRecord.js
index 853fe3e..d10c0b9 100644
--- a/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsTimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsTimelineRecord.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapAllocationsTimelineRecord = class HeapAllocationsTimelineRecord extends WebInspector.TimelineRecord
+WI.HeapAllocationsTimelineRecord = class HeapAllocationsTimelineRecord extends WI.TimelineRecord
 {
     constructor(timestamp, heapSnapshot)
     {
-        super(WebInspector.TimelineRecord.Type.HeapAllocations, timestamp, timestamp);
+        super(WI.TimelineRecord.Type.HeapAllocations, timestamp, timestamp);
 
         console.assert(typeof timestamp === "number");
-        console.assert(heapSnapshot instanceof WebInspector.HeapSnapshotProxy);
+        console.assert(heapSnapshot instanceof WI.HeapSnapshotProxy);
 
         this._timestamp = timestamp;
         this._heapSnapshot = heapSnapshot;
diff --git a/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js b/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js
index b7090e7..0737a36 100644
--- a/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js
+++ b/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapSnapshotRootPath = class HeapSnapshotRootPath
+WI.HeapSnapshotRootPath = class HeapSnapshotRootPath
 {
     constructor(node, pathComponent, parent, isGlobalScope)
     {
-        console.assert(!node || node instanceof WebInspector.HeapSnapshotNodeProxy);
+        console.assert(!node || node instanceof WI.HeapSnapshotNodeProxy);
         console.assert(!pathComponent || typeof pathComponent === "string");
-        console.assert(!parent || parent instanceof WebInspector.HeapSnapshotRootPath);
+        console.assert(!parent || parent instanceof WI.HeapSnapshotRootPath);
 
         this._node = node || null;
         this._parent = parent || null;
@@ -45,19 +45,19 @@
 
     static emptyPath()
     {
-        return new WebInspector.HeapSnapshotRootPath(null);
+        return new WI.HeapSnapshotRootPath(null);
     }
 
     static pathComponentForIndividualEdge(edge)
     {
         switch (edge.type) {
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Internal:
             return null;
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Index:
             return "[" + edge.data + "]";
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:
-            if (WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(edge.data))
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Property:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Variable:
+            if (WI.HeapSnapshotRootPath.canPropertyNameBeDotAccess(edge.data))
                 return edge.data;
             return "[" + doubleQuotedString(edge.data) + "]";
         }
@@ -124,19 +124,19 @@
 
     appendInternal(node)
     {
-        return new WebInspector.HeapSnapshotRootPath(node, WebInspector.HeapSnapshotRootPath.SpecialPathComponent.InternalPropertyName, this);
+        return new WI.HeapSnapshotRootPath(node, WI.HeapSnapshotRootPath.SpecialPathComponent.InternalPropertyName, this);
     }
 
     appendArrayIndex(node, index)
     {
         let component = "[" + index + "]";
-        return new WebInspector.HeapSnapshotRootPath(node, component, this);
+        return new WI.HeapSnapshotRootPath(node, component, this);
     }
 
     appendPropertyName(node, propertyName)
     {
-        let component = WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(propertyName) ? "." + propertyName : "[" + doubleQuotedString(propertyName) + "]";
-        return new WebInspector.HeapSnapshotRootPath(node, component, this);
+        let component = WI.HeapSnapshotRootPath.canPropertyNameBeDotAccess(propertyName) ? "." + propertyName : "[" + doubleQuotedString(propertyName) + "]";
+        return new WI.HeapSnapshotRootPath(node, component, this);
     }
 
     appendVariableName(node, variableName)
@@ -144,26 +144,26 @@
         // Treat as a property of the global object, e.g. "window.foo".
         if (this._isGlobalScope)
             return this.appendPropertyName(node, variableName);
-        return new WebInspector.HeapSnapshotRootPath(node, variableName, this);
+        return new WI.HeapSnapshotRootPath(node, variableName, this);
     }
 
     appendGlobalScopeName(node, globalScopeName)
     {
-        return new WebInspector.HeapSnapshotRootPath(node, globalScopeName, this, true);
+        return new WI.HeapSnapshotRootPath(node, globalScopeName, this, true);
     }
 
     appendEdge(edge)
     {
-        console.assert(edge instanceof WebInspector.HeapSnapshotEdgeProxy);
+        console.assert(edge instanceof WI.HeapSnapshotEdgeProxy);
 
         switch (edge.type) {
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Internal:
             return this.appendInternal(edge.to);
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Index:
             return this.appendArrayIndex(edge.to, edge.data);
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Property:
             return this.appendPropertyName(edge.to, edge.data);
-        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:
+        case WI.HeapSnapshotEdgeProxy.EdgeType.Variable:
             return this.appendVariableName(edge.to, edge.data);
         }
 
@@ -171,6 +171,6 @@
     }
 };
 
-WebInspector.HeapSnapshotRootPath.SpecialPathComponent = {
+WI.HeapSnapshotRootPath.SpecialPathComponent = {
     InternalPropertyName: "@internal",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/IndexedDatabase.js b/Source/WebInspectorUI/UserInterface/Models/IndexedDatabase.js
index 2bad617..cef3b95 100644
--- a/Source/WebInspectorUI/UserInterface/Models/IndexedDatabase.js
+++ b/Source/WebInspectorUI/UserInterface/Models/IndexedDatabase.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabase = class IndexedDatabase
+WI.IndexedDatabase = class IndexedDatabase
 {
     constructor(name, securityOrigin, version, objectStores)
     {
@@ -47,11 +47,11 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.IndexedDatabase.NameCookieKey] = this._name;
-        cookie[WebInspector.IndexedDatabase.HostCookieKey] = this._host;
+        cookie[WI.IndexedDatabase.NameCookieKey] = this._name;
+        cookie[WI.IndexedDatabase.HostCookieKey] = this._host;
     }
 };
 
-WebInspector.IndexedDatabase.TypeIdentifier = "indexed-database";
-WebInspector.IndexedDatabase.NameCookieKey = "indexed-database-name";
-WebInspector.IndexedDatabase.HostCookieKey = "indexed-database-host";
+WI.IndexedDatabase.TypeIdentifier = "indexed-database";
+WI.IndexedDatabase.NameCookieKey = "indexed-database-name";
+WI.IndexedDatabase.HostCookieKey = "indexed-database-host";
diff --git a/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStore.js b/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStore.js
index 23c56fe..2c6cbbb 100644
--- a/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStore.js
+++ b/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStore.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStore = class IndexedDatabaseObjectStore
+WI.IndexedDatabaseObjectStore = class IndexedDatabaseObjectStore
 {
     constructor(name, keyPath, autoIncrement, indexes)
     {
@@ -47,8 +47,8 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.IndexedDatabaseObjectStore.NameCookieKey] = this._name;
-        cookie[WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey] = this._keyPath;
+        cookie[WI.IndexedDatabaseObjectStore.NameCookieKey] = this._name;
+        cookie[WI.IndexedDatabaseObjectStore.KeyPathCookieKey] = this._keyPath;
     }
 
     // Protected
@@ -59,6 +59,6 @@
     }
 };
 
-WebInspector.IndexedDatabaseObjectStore.TypeIdentifier = "indexed-database-object-store";
-WebInspector.IndexedDatabaseObjectStore.NameCookieKey = "indexed-database-object-store-name";
-WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey = "indexed-database-object-store-key-path";
+WI.IndexedDatabaseObjectStore.TypeIdentifier = "indexed-database-object-store";
+WI.IndexedDatabaseObjectStore.NameCookieKey = "indexed-database-object-store-name";
+WI.IndexedDatabaseObjectStore.KeyPathCookieKey = "indexed-database-object-store-key-path";
diff --git a/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStoreIndex.js b/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStoreIndex.js
index c1fa7ce..94eba95 100644
--- a/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStoreIndex.js
+++ b/Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStoreIndex.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStoreIndex = class IndexedDatabaseObjectStoreIndex
+WI.IndexedDatabaseObjectStoreIndex = class IndexedDatabaseObjectStoreIndex
 {
     constructor(name, keyPath, unique, multiEntry)
     {
@@ -44,8 +44,8 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey] = this._name;
-        cookie[WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey] = this._keyPath;
+        cookie[WI.IndexedDatabaseObjectStoreIndex.NameCookieKey] = this._name;
+        cookie[WI.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey] = this._keyPath;
     }
 
     // Protected
@@ -56,6 +56,6 @@
     }
 };
 
-WebInspector.IndexedDatabaseObjectStoreIndex.TypeIdentifier = "indexed-database-object-store-index";
-WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey = "indexed-database-object-store-index-name";
-WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey = "indexed-database-object-store-index-key-path";
+WI.IndexedDatabaseObjectStoreIndex.TypeIdentifier = "indexed-database-object-store-index";
+WI.IndexedDatabaseObjectStoreIndex.NameCookieKey = "indexed-database-object-store-index-name";
+WI.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey = "indexed-database-object-store-index-key-path";
diff --git a/Source/WebInspectorUI/UserInterface/Models/Instrument.js b/Source/WebInspectorUI/UserInterface/Models/Instrument.js
index f08e523..6f6b607 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Instrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Instrument.js
@@ -23,25 +23,25 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Instrument = class Instrument
+WI.Instrument = class Instrument
 {
     // Static
 
     static createForTimelineType(type)
     {
         switch (type) {
-        case WebInspector.TimelineRecord.Type.Network:
-            return new WebInspector.NetworkInstrument;
-        case WebInspector.TimelineRecord.Type.Layout:
-            return new WebInspector.LayoutInstrument;
-        case WebInspector.TimelineRecord.Type.Script:
-            return new WebInspector.ScriptInstrument;
-        case WebInspector.TimelineRecord.Type.RenderingFrame:
-            return new WebInspector.FPSInstrument;
-        case WebInspector.TimelineRecord.Type.Memory:
-            return new WebInspector.MemoryInstrument;
-        case WebInspector.TimelineRecord.Type.HeapAllocations:
-            return new WebInspector.HeapAllocationsInstrument;
+        case WI.TimelineRecord.Type.Network:
+            return new WI.NetworkInstrument;
+        case WI.TimelineRecord.Type.Layout:
+            return new WI.LayoutInstrument;
+        case WI.TimelineRecord.Type.Script:
+            return new WI.ScriptInstrument;
+        case WI.TimelineRecord.Type.RenderingFrame:
+            return new WI.FPSInstrument;
+        case WI.TimelineRecord.Type.Memory:
+            return new WI.MemoryInstrument;
+        case WI.TimelineRecord.Type.HeapAllocations:
+            return new WI.HeapAllocationsInstrument;
         default:
             console.error("Unknown TimelineRecord.Type: " + type);
             return null;
@@ -52,10 +52,10 @@
     {
         console.assert(window.TimelineAgent, "Attempted to start legacy timeline agent without TimelineAgent.");
 
-        if (WebInspector.Instrument._legacyTimelineAgentStarted)
+        if (WI.Instrument._legacyTimelineAgentStarted)
             return;
 
-        WebInspector.Instrument._legacyTimelineAgentStarted = true;
+        WI.Instrument._legacyTimelineAgentStarted = true;
 
         if (initiatedByBackend)
             return;
@@ -65,17 +65,17 @@
         // COMPATIBILITY (iOS 7): recordingStarted event did not exist yet. Start explicitly.
         if (!TimelineAgent.hasEvent("recordingStarted")) {
             result.then(function() {
-                WebInspector.timelineManager.capturingStarted();
+                WI.timelineManager.capturingStarted();
             });
         }
     }
 
     static stopLegacyTimelineAgent(initiatedByBackend)
     {
-        if (!WebInspector.Instrument._legacyTimelineAgentStarted)
+        if (!WI.Instrument._legacyTimelineAgentStarted)
             return;
 
-        WebInspector.Instrument._legacyTimelineAgentStarted = false;
+        WI.Instrument._legacyTimelineAgentStarted = false;
 
         if (initiatedByBackend)
             return;
@@ -92,13 +92,13 @@
 
     startInstrumentation(initiatedByBackend)
     {
-        WebInspector.Instrument.startLegacyTimelineAgent(initiatedByBackend);
+        WI.Instrument.startLegacyTimelineAgent(initiatedByBackend);
     }
 
     stopInstrumentation(initiatedByBackend)
     {
-        WebInspector.Instrument.stopLegacyTimelineAgent(initiatedByBackend);
+        WI.Instrument.stopLegacyTimelineAgent(initiatedByBackend);
     }
 };
 
-WebInspector.Instrument._legacyTimelineAgentStarted = false;
+WI.Instrument._legacyTimelineAgentStarted = false;
diff --git a/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js b/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js
index 9900b1d..2f71cec 100644
--- a/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js
+++ b/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IssueMessage = class IssueMessage extends WebInspector.Object
+WI.IssueMessage = class IssueMessage extends WI.Object
 {
     constructor(consoleMessage)
     {
         super();
 
-        console.assert(consoleMessage instanceof WebInspector.ConsoleMessage);
+        console.assert(consoleMessage instanceof WI.ConsoleMessage);
 
         this._consoleMessage = consoleMessage;
 
@@ -41,24 +41,24 @@
             // as part of the data passed from WebCore, instead of having to determine it ourselves.
             var prefixRegex = /^([^:]+): (?:DOM Exception \d+: )?/;
             var match = prefixRegex.exec(this._text);
-            if (match && match[1] in WebInspector.IssueMessage.Type._prefixTypeMap) {
-                this._type = WebInspector.IssueMessage.Type._prefixTypeMap[match[1]];
+            if (match && match[1] in WI.IssueMessage.Type._prefixTypeMap) {
+                this._type = WI.IssueMessage.Type._prefixTypeMap[match[1]];
                 this._text = this._text.substring(match[0].length);
             } else
-                this._type = WebInspector.IssueMessage.Type.OtherIssue;
+                this._type = WI.IssueMessage.Type.OtherIssue;
             break;
 
         case "css":
         case "xml":
-            this._type = WebInspector.IssueMessage.Type.PageIssue;
+            this._type = WI.IssueMessage.Type.PageIssue;
             break;
 
         case "network":
-            this._type = WebInspector.IssueMessage.Type.NetworkIssue;
+            this._type = WI.IssueMessage.Type.NetworkIssue;
             break;
 
         case "security":
-            this._type = WebInspector.IssueMessage.Type.SecurityIssue;
+            this._type = WI.IssueMessage.Type.SecurityIssue;
             break;
 
         case "console-api":
@@ -66,17 +66,17 @@
         case "appcache":
         case "rendering":
         case "other":
-            this._type = WebInspector.IssueMessage.Type.OtherIssue;
+            this._type = WI.IssueMessage.Type.OtherIssue;
             break;
 
         default:
             console.error("Unknown issue source:", this._consoleMessage.source);
-            this._type = WebInspector.IssueMessage.Type.OtherIssue;
+            this._type = WI.IssueMessage.Type.OtherIssue;
         }
 
         this._sourceCodeLocation = consoleMessage.sourceCodeLocation;
         if (this._sourceCodeLocation)
-            this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
+            this._sourceCodeLocation.addEventListener(WI.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
     }
 
     // Static
@@ -84,25 +84,25 @@
     static displayName(type)
     {
         switch (type) {
-        case WebInspector.IssueMessage.Type.SemanticIssue:
-            return WebInspector.UIString("Semantic Issue");
-        case WebInspector.IssueMessage.Type.RangeIssue:
-            return WebInspector.UIString("Range Issue");
-        case WebInspector.IssueMessage.Type.ReferenceIssue:
-            return WebInspector.UIString("Reference Issue");
-        case WebInspector.IssueMessage.Type.TypeIssue:
-            return WebInspector.UIString("Type Issue");
-        case WebInspector.IssueMessage.Type.PageIssue:
-            return WebInspector.UIString("Page Issue");
-        case WebInspector.IssueMessage.Type.NetworkIssue:
-            return WebInspector.UIString("Network Issue");
-        case WebInspector.IssueMessage.Type.SecurityIssue:
-            return WebInspector.UIString("Security Issue");
-        case WebInspector.IssueMessage.Type.OtherIssue:
-            return WebInspector.UIString("Other Issue");
+        case WI.IssueMessage.Type.SemanticIssue:
+            return WI.UIString("Semantic Issue");
+        case WI.IssueMessage.Type.RangeIssue:
+            return WI.UIString("Range Issue");
+        case WI.IssueMessage.Type.ReferenceIssue:
+            return WI.UIString("Reference Issue");
+        case WI.IssueMessage.Type.TypeIssue:
+            return WI.UIString("Type Issue");
+        case WI.IssueMessage.Type.PageIssue:
+            return WI.UIString("Page Issue");
+        case WI.IssueMessage.Type.NetworkIssue:
+            return WI.UIString("Network Issue");
+        case WI.IssueMessage.Type.SecurityIssue:
+            return WI.UIString("Security Issue");
+        case WI.IssueMessage.Type.OtherIssue:
+            return WI.UIString("Other Issue");
         default:
             console.error("Unknown issue message type:", type);
-            return WebInspector.UIString("Other Issue");
+            return WI.UIString("Other Issue");
         }
     }
 
@@ -119,9 +119,9 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.IssueMessage.URLCookieKey] = this.url;
-        cookie[WebInspector.IssueMessage.LineNumberCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : 0;
-        cookie[WebInspector.IssueMessage.ColumnNumberCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : 0;
+        cookie[WI.IssueMessage.URLCookieKey] = this.url;
+        cookie[WI.IssueMessage.LineNumberCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : 0;
+        cookie[WI.IssueMessage.ColumnNumberCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : 0;
     }
 
     // Private
@@ -164,16 +164,16 @@
 
     _sourceCodeLocationDisplayLocationChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.IssueMessage.Event.DisplayLocationDidChange, event.data);
+        this.dispatchEventToListeners(WI.IssueMessage.Event.DisplayLocationDidChange, event.data);
     }
 };
 
-WebInspector.IssueMessage.Level = {
+WI.IssueMessage.Level = {
     Error: "error",
     Warning: "warning"
 };
 
-WebInspector.IssueMessage.Type = {
+WI.IssueMessage.Type = {
     SemanticIssue: "issue-message-type-semantic-issue",
     RangeIssue: "issue-message-type-range-issue",
     ReferenceIssue: "issue-message-type-reference-issue",
@@ -184,52 +184,52 @@
     OtherIssue: "issue-message-type-other-issue"
 };
 
-WebInspector.IssueMessage.TypeIdentifier = "issue-message";
-WebInspector.IssueMessage.URLCookieKey = "issue-message-url";
-WebInspector.IssueMessage.LineNumberCookieKey = "issue-message-line-number";
-WebInspector.IssueMessage.ColumnNumberCookieKey = "issue-message-column-number";
+WI.IssueMessage.TypeIdentifier = "issue-message";
+WI.IssueMessage.URLCookieKey = "issue-message-url";
+WI.IssueMessage.LineNumberCookieKey = "issue-message-line-number";
+WI.IssueMessage.ColumnNumberCookieKey = "issue-message-column-number";
 
-WebInspector.IssueMessage.Event = {
+WI.IssueMessage.Event = {
     LocationDidChange: "issue-message-location-did-change",
     DisplayLocationDidChange: "issue-message-display-location-did-change"
 };
 
-WebInspector.IssueMessage.Type._prefixTypeMap = {
-    "SyntaxError": WebInspector.IssueMessage.Type.SemanticIssue,
-    "URIError": WebInspector.IssueMessage.Type.SemanticIssue,
-    "EvalError": WebInspector.IssueMessage.Type.SemanticIssue,
-    "INVALID_CHARACTER_ERR": WebInspector.IssueMessage.Type.SemanticIssue,
-    "SYNTAX_ERR": WebInspector.IssueMessage.Type.SemanticIssue,
+WI.IssueMessage.Type._prefixTypeMap = {
+    "SyntaxError": WI.IssueMessage.Type.SemanticIssue,
+    "URIError": WI.IssueMessage.Type.SemanticIssue,
+    "EvalError": WI.IssueMessage.Type.SemanticIssue,
+    "INVALID_CHARACTER_ERR": WI.IssueMessage.Type.SemanticIssue,
+    "SYNTAX_ERR": WI.IssueMessage.Type.SemanticIssue,
 
-    "RangeError": WebInspector.IssueMessage.Type.RangeIssue,
-    "INDEX_SIZE_ERR": WebInspector.IssueMessage.Type.RangeIssue,
-    "DOMSTRING_SIZE_ERR": WebInspector.IssueMessage.Type.RangeIssue,
+    "RangeError": WI.IssueMessage.Type.RangeIssue,
+    "INDEX_SIZE_ERR": WI.IssueMessage.Type.RangeIssue,
+    "DOMSTRING_SIZE_ERR": WI.IssueMessage.Type.RangeIssue,
 
-    "ReferenceError": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "HIERARCHY_REQUEST_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "INVALID_STATE_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "NOT_FOUND_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "WRONG_DOCUMENT_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
+    "ReferenceError": WI.IssueMessage.Type.ReferenceIssue,
+    "HIERARCHY_REQUEST_ERR": WI.IssueMessage.Type.ReferenceIssue,
+    "INVALID_STATE_ERR": WI.IssueMessage.Type.ReferenceIssue,
+    "NOT_FOUND_ERR": WI.IssueMessage.Type.ReferenceIssue,
+    "WRONG_DOCUMENT_ERR": WI.IssueMessage.Type.ReferenceIssue,
 
-    "TypeError": WebInspector.IssueMessage.Type.TypeIssue,
-    "INVALID_NODE_TYPE_ERR": WebInspector.IssueMessage.Type.TypeIssue,
-    "TYPE_MISMATCH_ERR": WebInspector.IssueMessage.Type.TypeIssue,
+    "TypeError": WI.IssueMessage.Type.TypeIssue,
+    "INVALID_NODE_TYPE_ERR": WI.IssueMessage.Type.TypeIssue,
+    "TYPE_MISMATCH_ERR": WI.IssueMessage.Type.TypeIssue,
 
-    "SECURITY_ERR": WebInspector.IssueMessage.Type.SecurityIssue,
+    "SECURITY_ERR": WI.IssueMessage.Type.SecurityIssue,
 
-    "NETWORK_ERR": WebInspector.IssueMessage.Type.NetworkIssue,
+    "NETWORK_ERR": WI.IssueMessage.Type.NetworkIssue,
 
-    "ABORT_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "DATA_CLONE_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "INUSE_ATTRIBUTE_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "INVALID_ACCESS_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "INVALID_MODIFICATION_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NAMESPACE_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NOT_SUPPORTED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NO_DATA_ALLOWED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NO_MODIFICATION_ALLOWED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "QUOTA_EXCEEDED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "TIMEOUT_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "URL_MISMATCH_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "VALIDATION_ERR": WebInspector.IssueMessage.Type.OtherIssue
+    "ABORT_ERR": WI.IssueMessage.Type.OtherIssue,
+    "DATA_CLONE_ERR": WI.IssueMessage.Type.OtherIssue,
+    "INUSE_ATTRIBUTE_ERR": WI.IssueMessage.Type.OtherIssue,
+    "INVALID_ACCESS_ERR": WI.IssueMessage.Type.OtherIssue,
+    "INVALID_MODIFICATION_ERR": WI.IssueMessage.Type.OtherIssue,
+    "NAMESPACE_ERR": WI.IssueMessage.Type.OtherIssue,
+    "NOT_SUPPORTED_ERR": WI.IssueMessage.Type.OtherIssue,
+    "NO_DATA_ALLOWED_ERR": WI.IssueMessage.Type.OtherIssue,
+    "NO_MODIFICATION_ALLOWED_ERR": WI.IssueMessage.Type.OtherIssue,
+    "QUOTA_EXCEEDED_ERR": WI.IssueMessage.Type.OtherIssue,
+    "TIMEOUT_ERR": WI.IssueMessage.Type.OtherIssue,
+    "URL_MISMATCH_ERR": WI.IssueMessage.Type.OtherIssue,
+    "VALIDATION_ERR": WI.IssueMessage.Type.OtherIssue
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/KeyboardShortcut.js b/Source/WebInspectorUI/UserInterface/Models/KeyboardShortcut.js
index 737e9aa..3d7fda8 100644
--- a/Source/WebInspectorUI/UserInterface/Models/KeyboardShortcut.js
+++ b/Source/WebInspectorUI/UserInterface/Models/KeyboardShortcut.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.KeyboardShortcut = class KeyboardShortcut
+WI.KeyboardShortcut = class KeyboardShortcut
 {
     constructor(modifiers, key, callback, targetElement)
     {
@@ -33,13 +33,13 @@
 
         if (typeof key === "string") {
             key = key[0].toUpperCase();
-            key = new WebInspector.Key(key.charCodeAt(0), key);
+            key = new WI.Key(key.charCodeAt(0), key);
         }
 
         if (callback && !targetElement)
             targetElement = document;
 
-        this._modifiers = modifiers || WebInspector.KeyboardShortcut.Modifier.None;
+        this._modifiers = modifiers || WI.KeyboardShortcut.Modifier.None;
         this._key = key;
         this._targetElement = targetElement;
         this._callback = callback;
@@ -53,9 +53,9 @@
 
             targetKeyboardShortcuts.push(this);
 
-            if (!WebInspector.KeyboardShortcut._registeredKeyDownListener) {
-                WebInspector.KeyboardShortcut._registeredKeyDownListener = true;
-                window.addEventListener("keydown", WebInspector.KeyboardShortcut._handleKeyDown);
+            if (!WI.KeyboardShortcut._registeredKeyDownListener) {
+                WI.KeyboardShortcut._registeredKeyDownListener = true;
+                window.addEventListener("keydown", WI.KeyboardShortcut._handleKeyDown);
             }
         }
     }
@@ -105,13 +105,13 @@
     {
         var result = "";
 
-        if (this._modifiers & WebInspector.KeyboardShortcut.Modifier.Control)
+        if (this._modifiers & WI.KeyboardShortcut.Modifier.Control)
             result += "\u2303";
-        if (this._modifiers & WebInspector.KeyboardShortcut.Modifier.Option)
-            result += WebInspector.Platform.name === "mac" ? "\u2325" : "\u2387";
-        if (this._modifiers & WebInspector.KeyboardShortcut.Modifier.Shift)
+        if (this._modifiers & WI.KeyboardShortcut.Modifier.Option)
+            result += WI.Platform.name === "mac" ? "\u2325" : "\u2387";
+        if (this._modifiers & WI.KeyboardShortcut.Modifier.Shift)
             result += "\u21e7";
-        if (this._modifiers & WebInspector.KeyboardShortcut.Modifier.Command)
+        if (this._modifiers & WI.KeyboardShortcut.Modifier.Command)
             result += "\u2318";
 
         result += this._key.toString();
@@ -173,20 +173,20 @@
         if (this._key.keyCode !== event.keyCode)
             return false;
 
-        var eventModifiers = WebInspector.KeyboardShortcut.Modifier.None;
+        var eventModifiers = WI.KeyboardShortcut.Modifier.None;
         if (event.shiftKey)
-            eventModifiers |= WebInspector.KeyboardShortcut.Modifier.Shift;
+            eventModifiers |= WI.KeyboardShortcut.Modifier.Shift;
         if (event.ctrlKey)
-            eventModifiers |= WebInspector.KeyboardShortcut.Modifier.Control;
+            eventModifiers |= WI.KeyboardShortcut.Modifier.Control;
         if (event.altKey)
-            eventModifiers |= WebInspector.KeyboardShortcut.Modifier.Option;
+            eventModifiers |= WI.KeyboardShortcut.Modifier.Option;
         if (event.metaKey)
-            eventModifiers |= WebInspector.KeyboardShortcut.Modifier.Command;
+            eventModifiers |= WI.KeyboardShortcut.Modifier.Command;
         return this._modifiers === eventModifiers;
     }
 };
 
-WebInspector.Key = class Key
+WI.Key = class Key
 {
     constructor(keyCode, displayName)
     {
@@ -212,7 +212,7 @@
     }
 };
 
-WebInspector.KeyboardShortcut.Modifier = {
+WI.KeyboardShortcut.Modifier = {
     None: 0,
     Shift: 1,
     Control: 2,
@@ -221,47 +221,47 @@
 
     get CommandOrControl()
     {
-        return WebInspector.Platform.name === "mac" ? this.Command : this.Control;
+        return WI.Platform.name === "mac" ? this.Command : this.Control;
     }
 };
 
-WebInspector.KeyboardShortcut.Key = {
-    Backspace: new WebInspector.Key(8, "\u232b"),
-    Tab: new WebInspector.Key(9, "\u21e5"),
-    Enter: new WebInspector.Key(13, "\u21a9"),
-    Escape: new WebInspector.Key(27, "\u238b"),
-    Space: new WebInspector.Key(32, "Space"), // UIString populated in WebInspector.loaded.
-    PageUp: new WebInspector.Key(33, "\u21de"),
-    PageDown: new WebInspector.Key(34, "\u21df"),
-    End: new WebInspector.Key(35, "\u2198"),
-    Home: new WebInspector.Key(36, "\u2196"),
-    Left: new WebInspector.Key(37, "\u2190"),
-    Up: new WebInspector.Key(38, "\u2191"),
-    Right: new WebInspector.Key(39, "\u2192"),
-    Down: new WebInspector.Key(40, "\u2193"),
-    Delete: new WebInspector.Key(46, "\u2326"),
-    Zero: new WebInspector.Key(48, "0"),
-    F1: new WebInspector.Key(112, "F1"),
-    F2: new WebInspector.Key(113, "F2"),
-    F3: new WebInspector.Key(114, "F3"),
-    F4: new WebInspector.Key(115, "F4"),
-    F5: new WebInspector.Key(116, "F5"),
-    F6: new WebInspector.Key(117, "F6"),
-    F7: new WebInspector.Key(118, "F7"),
-    F8: new WebInspector.Key(119, "F8"),
-    F9: new WebInspector.Key(120, "F9"),
-    F10: new WebInspector.Key(121, "F10"),
-    F11: new WebInspector.Key(122, "F11"),
-    F12: new WebInspector.Key(123, "F12"),
-    Semicolon: new WebInspector.Key(186, ";"),
-    Plus: new WebInspector.Key(187, "+"),
-    Comma: new WebInspector.Key(188, ","),
-    Minus: new WebInspector.Key(189, "-"),
-    Period: new WebInspector.Key(190, "."),
-    Slash: new WebInspector.Key(191, "/"),
-    Apostrophe: new WebInspector.Key(192, "`"),
-    LeftCurlyBrace: new WebInspector.Key(219, "{"),
-    Backslash: new WebInspector.Key(220, "\\"),
-    RightCurlyBrace: new WebInspector.Key(221, "}"),
-    SingleQuote: new WebInspector.Key(222, "\'")
+WI.KeyboardShortcut.Key = {
+    Backspace: new WI.Key(8, "\u232b"),
+    Tab: new WI.Key(9, "\u21e5"),
+    Enter: new WI.Key(13, "\u21a9"),
+    Escape: new WI.Key(27, "\u238b"),
+    Space: new WI.Key(32, "Space"), // UIString populated in WI.loaded.
+    PageUp: new WI.Key(33, "\u21de"),
+    PageDown: new WI.Key(34, "\u21df"),
+    End: new WI.Key(35, "\u2198"),
+    Home: new WI.Key(36, "\u2196"),
+    Left: new WI.Key(37, "\u2190"),
+    Up: new WI.Key(38, "\u2191"),
+    Right: new WI.Key(39, "\u2192"),
+    Down: new WI.Key(40, "\u2193"),
+    Delete: new WI.Key(46, "\u2326"),
+    Zero: new WI.Key(48, "0"),
+    F1: new WI.Key(112, "F1"),
+    F2: new WI.Key(113, "F2"),
+    F3: new WI.Key(114, "F3"),
+    F4: new WI.Key(115, "F4"),
+    F5: new WI.Key(116, "F5"),
+    F6: new WI.Key(117, "F6"),
+    F7: new WI.Key(118, "F7"),
+    F8: new WI.Key(119, "F8"),
+    F9: new WI.Key(120, "F9"),
+    F10: new WI.Key(121, "F10"),
+    F11: new WI.Key(122, "F11"),
+    F12: new WI.Key(123, "F12"),
+    Semicolon: new WI.Key(186, ";"),
+    Plus: new WI.Key(187, "+"),
+    Comma: new WI.Key(188, ","),
+    Minus: new WI.Key(189, "-"),
+    Period: new WI.Key(190, "."),
+    Slash: new WI.Key(191, "/"),
+    Apostrophe: new WI.Key(192, "`"),
+    LeftCurlyBrace: new WI.Key(219, "{"),
+    Backslash: new WI.Key(220, "\\"),
+    RightCurlyBrace: new WI.Key(221, "}"),
+    SingleQuote: new WI.Key(222, "\'")
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/LayoutInstrument.js b/Source/WebInspectorUI/UserInterface/Models/LayoutInstrument.js
index 2d33ac3..d4a41d9 100644
--- a/Source/WebInspectorUI/UserInterface/Models/LayoutInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/LayoutInstrument.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutInstrument = class LayoutInstrument extends WebInspector.Instrument
+WI.LayoutInstrument = class LayoutInstrument extends WI.Instrument
 {
     // Protected
 
     get timelineRecordType()
     {
-        return WebInspector.TimelineRecord.Type.Layout;
+        return WI.TimelineRecord.Type.Layout;
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js
index 79376c5..95f8af5 100644
--- a/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutTimelineRecord = class LayoutTimelineRecord extends WebInspector.TimelineRecord
+WI.LayoutTimelineRecord = class LayoutTimelineRecord extends WI.TimelineRecord
 {
     constructor(eventType, startTime, endTime, callFrames, sourceCodeLocation, quad)
     {
-        super(WebInspector.TimelineRecord.Type.Layout, startTime, endTime, callFrames, sourceCodeLocation);
+        super(WI.TimelineRecord.Type.Layout, startTime, endTime, callFrames, sourceCodeLocation);
 
         console.assert(eventType);
-        console.assert(!quad || quad instanceof WebInspector.Quad);
+        console.assert(!quad || quad instanceof WI.Quad);
 
-        if (eventType in WebInspector.LayoutTimelineRecord.EventType)
-            eventType = WebInspector.LayoutTimelineRecord.EventType[eventType];
+        if (eventType in WI.LayoutTimelineRecord.EventType)
+            eventType = WI.LayoutTimelineRecord.EventType[eventType];
 
         this._eventType = eventType;
         this._quad = quad || null;
@@ -44,20 +44,20 @@
     static displayNameForEventType(eventType)
     {
         switch (eventType) {
-        case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:
-            return WebInspector.UIString("Styles Invalidated");
-        case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:
-            return WebInspector.UIString("Styles Recalculated");
-        case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:
-            return WebInspector.UIString("Layout Invalidated");
-        case WebInspector.LayoutTimelineRecord.EventType.ForcedLayout:
-            return WebInspector.UIString("Forced Layout");
-        case WebInspector.LayoutTimelineRecord.EventType.Layout:
-            return WebInspector.UIString("Layout");
-        case WebInspector.LayoutTimelineRecord.EventType.Paint:
-            return WebInspector.UIString("Paint");
-        case WebInspector.LayoutTimelineRecord.EventType.Composite:
-            return WebInspector.UIString("Composite");
+        case WI.LayoutTimelineRecord.EventType.InvalidateStyles:
+            return WI.UIString("Styles Invalidated");
+        case WI.LayoutTimelineRecord.EventType.RecalculateStyles:
+            return WI.UIString("Styles Recalculated");
+        case WI.LayoutTimelineRecord.EventType.InvalidateLayout:
+            return WI.UIString("Layout Invalidated");
+        case WI.LayoutTimelineRecord.EventType.ForcedLayout:
+            return WI.UIString("Forced Layout");
+        case WI.LayoutTimelineRecord.EventType.Layout:
+            return WI.UIString("Layout");
+        case WI.LayoutTimelineRecord.EventType.Paint:
+            return WI.UIString("Paint");
+        case WI.LayoutTimelineRecord.EventType.Composite:
+            return WI.UIString("Composite");
         }
     }
 
@@ -92,11 +92,11 @@
     {
         super.saveIdentityToCookie(cookie);
 
-        cookie[WebInspector.LayoutTimelineRecord.EventTypeCookieKey] = this._eventType;
+        cookie[WI.LayoutTimelineRecord.EventTypeCookieKey] = this._eventType;
     }
 };
 
-WebInspector.LayoutTimelineRecord.EventType = {
+WI.LayoutTimelineRecord.EventType = {
     InvalidateStyles: "layout-timeline-record-invalidate-styles",
     RecalculateStyles: "layout-timeline-record-recalculate-styles",
     InvalidateLayout: "layout-timeline-record-invalidate-layout",
@@ -106,5 +106,5 @@
     Composite: "layout-timeline-record-composite"
 };
 
-WebInspector.LayoutTimelineRecord.TypeIdentifier = "layout-timeline-record";
-WebInspector.LayoutTimelineRecord.EventTypeCookieKey = "layout-timeline-record-event-type";
+WI.LayoutTimelineRecord.TypeIdentifier = "layout-timeline-record";
+WI.LayoutTimelineRecord.EventTypeCookieKey = "layout-timeline-record-event-type";
diff --git a/Source/WebInspectorUI/UserInterface/Models/LazySourceCodeLocation.js b/Source/WebInspectorUI/UserInterface/Models/LazySourceCodeLocation.js
index 6f1a90a..e37e543 100644
--- a/Source/WebInspectorUI/UserInterface/Models/LazySourceCodeLocation.js
+++ b/Source/WebInspectorUI/UserInterface/Models/LazySourceCodeLocation.js
@@ -30,7 +30,7 @@
 //  - formatted information does require initialization, done by overriding public APIs.
 //  - display information does require initialization, done by overriding private funnel API resolveMappedLocation.
 
-WebInspector.LazySourceCodeLocation = class LazySourceCodeLocation extends WebInspector.SourceCodeLocation
+WI.LazySourceCodeLocation = class LazySourceCodeLocation extends WI.SourceCodeLocation
 {
     constructor(sourceCode, lineNumber, columnNumber)
     {
@@ -77,7 +77,7 @@
     formattedPosition()
     {
         this._lazyInitialization();
-        return new WebInspector.SourceCodePosition(this._formattedLineNumber, this._formattedColumnNumber);
+        return new WI.SourceCodePosition(this._formattedLineNumber, this._formattedColumnNumber);
     }
 
     hasFormattedLocation()
diff --git a/Source/WebInspectorUI/UserInterface/Models/LineWidget.js b/Source/WebInspectorUI/UserInterface/Models/LineWidget.js
index eec22a5..48acfdb 100644
--- a/Source/WebInspectorUI/UserInterface/Models/LineWidget.js
+++ b/Source/WebInspectorUI/UserInterface/Models/LineWidget.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LineWidget = class LineWidget
+WI.LineWidget = class LineWidget
 {
     constructor(codeMirrorLineWidget, widgetElement)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/LogObject.js b/Source/WebInspectorUI/UserInterface/Models/LogObject.js
index a1c7759cd..a99b608 100644
--- a/Source/WebInspectorUI/UserInterface/Models/LogObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/LogObject.js
@@ -23,6 +23,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LogObject = class LogObject
+WI.LogObject = class LogObject
 {
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/MemoryCategory.js b/Source/WebInspectorUI/UserInterface/Models/MemoryCategory.js
index c2da954..76bb8bf 100644
--- a/Source/WebInspectorUI/UserInterface/Models/MemoryCategory.js
+++ b/Source/WebInspectorUI/UserInterface/Models/MemoryCategory.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryCategory = class MemoryCategory
+WI.MemoryCategory = class MemoryCategory
 {
     constructor(type, size)
     {
@@ -36,7 +36,7 @@
     }
 };
 
-WebInspector.MemoryCategory.Type = {
+WI.MemoryCategory.Type = {
     JavaScript: "javascript",
     Images: "images",
     Layers: "layers",
diff --git a/Source/WebInspectorUI/UserInterface/Models/MemoryInstrument.js b/Source/WebInspectorUI/UserInterface/Models/MemoryInstrument.js
index cbe2543..37c2866 100644
--- a/Source/WebInspectorUI/UserInterface/Models/MemoryInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/MemoryInstrument.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryInstrument = class MemoryInstrument extends WebInspector.Instrument
+WI.MemoryInstrument = class MemoryInstrument extends WI.Instrument
 {
     constructor()
     {
         super();
 
-        console.assert(WebInspector.MemoryInstrument.supported());
+        console.assert(WI.MemoryInstrument.supported());
     }
 
     // Static
@@ -44,7 +44,7 @@
 
     get timelineRecordType()
     {
-        return WebInspector.TimelineRecord.Type.Memory;
+        return WI.TimelineRecord.Type.Memory;
     }
 
     startInstrumentation(initiatedByBackend)
diff --git a/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js b/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js
index 1677d9f..0cfeca7 100644
--- a/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js
+++ b/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryPressureEvent = class MemoryPressureEvent
+WI.MemoryPressureEvent = class MemoryPressureEvent
 {
     constructor(timestamp, severity)
     {
@@ -38,18 +38,18 @@
         let severity;
         switch (protocolSeverity) {
         case MemoryAgent.MemoryPressureSeverity.Critical:
-            severity = WebInspector.MemoryPressureEvent.Severity.Critical;
+            severity = WI.MemoryPressureEvent.Severity.Critical;
             break;
         case MemoryAgent.MemoryPressureSeverity.NonCritical:
-            severity = WebInspector.MemoryPressureEvent.Severity.NonCritical;
+            severity = WI.MemoryPressureEvent.Severity.NonCritical;
             break;
         default:
             console.error("Unexpected memory pressure severity", protocolSeverity);
-            severity = WebInspector.MemoryPressureEvent.Severity.NonCritical;
+            severity = WI.MemoryPressureEvent.Severity.NonCritical;
             break;
         }
 
-        return new WebInspector.MemoryPressureEvent(timestamp, severity);
+        return new WI.MemoryPressureEvent(timestamp, severity);
     }
 
     // Public
@@ -58,7 +58,7 @@
     get severity() { return this._severity; }
 };
 
-WebInspector.MemoryPressureEvent.Severity = {
+WI.MemoryPressureEvent.Severity = {
     Critical: Symbol("Critical"),
     NonCritical: Symbol("NonCritical"),
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js b/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js
index 8a791ba..a2f109b 100644
--- a/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js
+++ b/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryTimeline = class MemoryTimeline extends WebInspector.Timeline
+WI.MemoryTimeline = class MemoryTimeline extends WI.Timeline
 {
     // Public
 
@@ -31,11 +31,11 @@
 
     addMemoryPressureEvent(memoryPressureEvent)
     {
-        console.assert(memoryPressureEvent instanceof WebInspector.MemoryPressureEvent);
+        console.assert(memoryPressureEvent instanceof WI.MemoryPressureEvent);
 
         this._pressureEvents.push(memoryPressureEvent);
 
-        this.dispatchEventToListeners(WebInspector.MemoryTimeline.Event.MemoryPressureEventAdded, {memoryPressureEvent});
+        this.dispatchEventToListeners(WI.MemoryTimeline.Event.MemoryPressureEventAdded, {memoryPressureEvent});
     }
 
     // Protected
@@ -48,6 +48,6 @@
     }
 };
 
-WebInspector.MemoryTimeline.Event = {
+WI.MemoryTimeline.Event = {
     MemoryPressureEventAdded: "memory-timeline-memory-pressure-event-added",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/MemoryTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/MemoryTimelineRecord.js
index 5b482d8..0a3d4b4 100644
--- a/Source/WebInspectorUI/UserInterface/Models/MemoryTimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/MemoryTimelineRecord.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryTimelineRecord = class MemoryTimelineRecord extends WebInspector.TimelineRecord
+WI.MemoryTimelineRecord = class MemoryTimelineRecord extends WI.TimelineRecord
 {
     constructor(timestamp, categories)
     {
-        super(WebInspector.TimelineRecord.Type.Memory, timestamp, timestamp);
+        super(WI.TimelineRecord.Type.Memory, timestamp, timestamp);
 
         console.assert(typeof timestamp === "number");
         console.assert(categories instanceof Array);
 
         this._timestamp = timestamp;
-        this._categories = WebInspector.MemoryTimelineRecord.memoryCategoriesFromProtocol(categories);
+        this._categories = WI.MemoryTimelineRecord.memoryCategoriesFromProtocol(categories);
 
         this._totalSize = 0;
         for (let {size} of categories)
@@ -72,10 +72,10 @@
         }
 
         return [
-            {type: WebInspector.MemoryCategory.Type.JavaScript, size: javascriptSize},
-            {type: WebInspector.MemoryCategory.Type.Images, size: imagesSize},
-            {type: WebInspector.MemoryCategory.Type.Layers, size: layersSize},
-            {type: WebInspector.MemoryCategory.Type.Page, size: pageSize},
+            {type: WI.MemoryCategory.Type.JavaScript, size: javascriptSize},
+            {type: WI.MemoryCategory.Type.Images, size: imagesSize},
+            {type: WI.MemoryCategory.Type.Layers, size: layersSize},
+            {type: WI.MemoryCategory.Type.Page, size: pageSize},
         ];
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js b/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js
index 729ef95..51705c6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js
+++ b/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js
@@ -26,7 +26,7 @@
 // FIXME: Provide Parameter lists for the constructors themselves? (new RegExp(...)).
 // FIXME: Provide Parameter lists for global functions (eval, decodeURI, ...).
 
-WebInspector.NativeConstructorFunctionParameters = {
+WI.NativeConstructorFunctionParameters = {
     Object: {
         assign: "target, ...sources",
         create: "prototype, [propertiesObject]",
@@ -220,7 +220,7 @@
     },
 };
 
-WebInspector.NativePrototypeFunctionParameters = {
+WI.NativePrototypeFunctionParameters = {
 
     // Built-in JavaScript objects.
     // FIXME: TypedArrays (Int8Array, etc),
@@ -2178,7 +2178,7 @@
 (function() {
     // COMPATIBILITY (iOS 9): EventTarget properties were on instances, now there
     // is an actual EventTarget prototype in the chain.
-    var EventTarget = WebInspector.NativePrototypeFunctionParameters.EventTarget;
+    var EventTarget = WI.NativePrototypeFunctionParameters.EventTarget;
     var eventTargetTypes = [
         "Node", "Window",
         "AudioNode", "AudioTrackList", "DOMApplicationCache", "FileReader",
@@ -2188,7 +2188,7 @@
         "WorkerGlobalScope", "XMLHttpRequest", "webkitMediaStream", "webkitRTCPeerConnection"
     ];
     for (var type of eventTargetTypes)
-        Object.assign(WebInspector.NativePrototypeFunctionParameters[type], EventTarget);
+        Object.assign(WI.NativePrototypeFunctionParameters[type], EventTarget);
 
     var ElementQueries = {
         getElementsByClassName: "classNames",
@@ -2197,27 +2197,27 @@
         querySelector: "selectors",
         querySelectorAll: "selectors",
     };
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.Element, ElementQueries);
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.Document, ElementQueries);
+    Object.assign(WI.NativePrototypeFunctionParameters.Element, ElementQueries);
+    Object.assign(WI.NativePrototypeFunctionParameters.Document, ElementQueries);
 
     var ChildNode = {
         after: "[node|string]...",
         before: "[node|string]...",
         replaceWith: "[node|string]...",
     };
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.Element, ChildNode);
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.CharacterData, ChildNode);
+    Object.assign(WI.NativePrototypeFunctionParameters.Element, ChildNode);
+    Object.assign(WI.NativePrototypeFunctionParameters.CharacterData, ChildNode);
 
     var ParentNode = {
         append: "[node|string]...",
         prepend: "[node|string]...",
     };
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.Element, ParentNode);
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.Document, ParentNode);
-    Object.assign(WebInspector.NativePrototypeFunctionParameters.DocumentFragment, ParentNode);
+    Object.assign(WI.NativePrototypeFunctionParameters.Element, ParentNode);
+    Object.assign(WI.NativePrototypeFunctionParameters.Document, ParentNode);
+    Object.assign(WI.NativePrototypeFunctionParameters.DocumentFragment, ParentNode);
 
     // COMPATIBILITY (iOS 9): window.console used to be a Console object instance,
     // now it is just a namespace object on the global object.
-    WebInspector.NativePrototypeFunctionParameters.Console = WebInspector.NativeConstructorFunctionParameters.Console;
+    WI.NativePrototypeFunctionParameters.Console = WI.NativeConstructorFunctionParameters.Console;
 
 })();
diff --git a/Source/WebInspectorUI/UserInterface/Models/NetworkInstrument.js b/Source/WebInspectorUI/UserInterface/Models/NetworkInstrument.js
index ad8f990..8583a47 100644
--- a/Source/WebInspectorUI/UserInterface/Models/NetworkInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/NetworkInstrument.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkInstrument = class NetworkInstrument extends WebInspector.Instrument
+WI.NetworkInstrument = class NetworkInstrument extends WI.Instrument
 {
     // Protected
 
     get timelineRecordType()
     {
-        return WebInspector.TimelineRecord.Type.Network;
+        return WI.TimelineRecord.Type.Network;
     }
 
     startInstrumentation(initiatedByBackend)
diff --git a/Source/WebInspectorUI/UserInterface/Models/NetworkTimeline.js b/Source/WebInspectorUI/UserInterface/Models/NetworkTimeline.js
index 450ff2c..c772ae0 100644
--- a/Source/WebInspectorUI/UserInterface/Models/NetworkTimeline.js
+++ b/Source/WebInspectorUI/UserInterface/Models/NetworkTimeline.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkTimeline = class NetworkTimeline extends WebInspector.Timeline
+WI.NetworkTimeline = class NetworkTimeline extends WI.Timeline
 {
     // Public
 
     recordForResource(resource)
     {
-        console.assert(resource instanceof WebInspector.Resource);
+        console.assert(resource instanceof WI.Resource);
 
         return this._resourceRecordMap.get(resource) || null;
     }
@@ -43,7 +43,7 @@
 
     addRecord(record)
     {
-        console.assert(record instanceof WebInspector.ResourceTimelineRecord);
+        console.assert(record instanceof WI.ResourceTimelineRecord);
 
         // Don't allow duplicate records for a resource.
         if (this._resourceRecordMap.has(record.resource))
diff --git a/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js b/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js
index 38f1289..58217d9 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectPreview = class ObjectPreview
+WI.ObjectPreview = class ObjectPreview
 {
     constructor(type, subtype, description, lossless, overflow, properties, entries, size)
     {
         console.assert(type);
         console.assert(typeof lossless === "boolean");
-        console.assert(!properties || !properties.length || properties[0] instanceof WebInspector.PropertyPreview);
-        console.assert(!entries || !entries.length || entries[0] instanceof WebInspector.CollectionEntryPreview);
+        console.assert(!properties || !properties.length || properties[0] instanceof WI.PropertyPreview);
+        console.assert(!entries || !entries.length || entries[0] instanceof WI.CollectionEntryPreview);
 
         this._type = type;
         this._subtype = subtype;
@@ -49,9 +49,9 @@
     static fromPayload(payload)
     {
         if (payload.properties)
-            payload.properties = payload.properties.map(WebInspector.PropertyPreview.fromPayload);
+            payload.properties = payload.properties.map(WI.PropertyPreview.fromPayload);
         if (payload.entries)
-            payload.entries = payload.entries.map(WebInspector.CollectionEntryPreview.fromPayload);
+            payload.entries = payload.entries.map(WI.CollectionEntryPreview.fromPayload);
 
         if (payload.subtype === "array") {
             // COMPATIBILITY (iOS 8): Runtime.ObjectPreview did not have size property,
@@ -63,7 +63,7 @@
             }
         }
 
-        return new WebInspector.ObjectPreview(payload.type, payload.subtype, payload.description, payload.lossless, payload.overflow, payload.properties, payload.entries, payload.size);
+        return new WI.ObjectPreview(payload.type, payload.subtype, payload.description, payload.lossless, payload.overflow, payload.properties, payload.entries, payload.size);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/Probe.js b/Source/WebInspectorUI/UserInterface/Models/Probe.js
index 6c1ca21..80c9c65 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Probe.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Probe.js
@@ -24,11 +24,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSample = class ProbeSample
+WI.ProbeSample = class ProbeSample
 {
     constructor(sampleId, batchId, elapsedTime, object)
     {
-        console.assert(object instanceof WebInspector.RemoteObject);
+        console.assert(object instanceof WI.RemoteObject);
 
         this.sampleId = sampleId;
         this.batchId = batchId;
@@ -37,14 +37,14 @@
     }
 };
 
-WebInspector.Probe = class Probe extends WebInspector.Object
+WI.Probe = class Probe extends WI.Object
 {
     constructor(id, breakpoint, expression)
     {
         super();
 
         console.assert(id);
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
 
         this._id = id;
         this._breakpoint = breakpoint;
@@ -77,7 +77,7 @@
         var data = {oldValue: this._expression, newValue: value};
         this._expression = value;
         this.clearSamples();
-        this.dispatchEventToListeners(WebInspector.Probe.Event.ExpressionChanged, data);
+        this.dispatchEventToListeners(WI.Probe.Event.ExpressionChanged, data);
     }
 
     get samples()
@@ -88,18 +88,18 @@
     clearSamples()
     {
         this._samples = [];
-        this.dispatchEventToListeners(WebInspector.Probe.Event.SamplesCleared);
+        this.dispatchEventToListeners(WI.Probe.Event.SamplesCleared);
     }
 
     addSample(sample)
     {
-        console.assert(sample instanceof WebInspector.ProbeSample, "Wrong object type passed as probe sample: ", sample);
+        console.assert(sample instanceof WI.ProbeSample, "Wrong object type passed as probe sample: ", sample);
         this._samples.push(sample);
-        this.dispatchEventToListeners(WebInspector.Probe.Event.SampleAdded, sample);
+        this.dispatchEventToListeners(WI.Probe.Event.SampleAdded, sample);
     }
 };
 
-WebInspector.Probe.Event = {
+WI.Probe.Event = {
     ExpressionChanged: "probe-object-expression-changed",
     SampleAdded: "probe-object-sample-added",
     SamplesCleared: "probe-object-samples-cleared"
diff --git a/Source/WebInspectorUI/UserInterface/Models/ProbeSet.js b/Source/WebInspectorUI/UserInterface/Models/ProbeSet.js
index bf7f4be..a513ce3 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ProbeSet.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ProbeSet.js
@@ -26,13 +26,13 @@
 
 // A ProbeSet clusters Probes from the same Breakpoint and their samples.
 
-WebInspector.ProbeSet = class ProbeSet extends WebInspector.Object
+WI.ProbeSet = class ProbeSet extends WI.Object
 {
     constructor(breakpoint)
     {
         super();
 
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Unknown breakpoint argument: ", breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint, "Unknown breakpoint argument: ", breakpoint);
 
         this._breakpoint = breakpoint;
         this._probes = [];
@@ -40,9 +40,9 @@
 
         this._createDataTable();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
-        WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SampleAdded, this._sampleCollected, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointResolvedStateDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
+        WI.Probe.addEventListener(WI.Probe.Event.SampleAdded, this._sampleCollected, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ResolvedStateDidChange, this._breakpointResolvedStateDidChange, this);
     }
 
     // Public
@@ -53,7 +53,7 @@
 
     clear()
     {
-        this._breakpoint.clearActions(WebInspector.BreakpointAction.Type.Probe);
+        this._breakpoint.clearActions(WI.BreakpointAction.Type.Probe);
     }
 
     clearSamples()
@@ -63,45 +63,45 @@
 
         var oldTable = this._dataTable;
         this._createDataTable();
-        this.dispatchEventToListeners(WebInspector.ProbeSet.Event.SamplesCleared, {oldTable});
+        this.dispatchEventToListeners(WI.ProbeSet.Event.SamplesCleared, {oldTable});
     }
 
     createProbe(expression)
     {
-        this.breakpoint.createAction(WebInspector.BreakpointAction.Type.Probe, null, expression);
+        this.breakpoint.createAction(WI.BreakpointAction.Type.Probe, null, expression);
     }
 
     addProbe(probe)
     {
-        console.assert(probe instanceof WebInspector.Probe, "Tried to add non-probe ", probe, " to probe group", this);
+        console.assert(probe instanceof WI.Probe, "Tried to add non-probe ", probe, " to probe group", this);
         console.assert(probe.breakpoint === this.breakpoint, "Probe and ProbeSet must have same breakpoint.", probe, this);
 
         this._probes.push(probe);
         this._probesByIdentifier.set(probe.id, probe);
 
         this.dataTable.addProbe(probe);
-        this.dispatchEventToListeners(WebInspector.ProbeSet.Event.ProbeAdded, probe);
+        this.dispatchEventToListeners(WI.ProbeSet.Event.ProbeAdded, probe);
     }
 
     removeProbe(probe)
     {
-        console.assert(probe instanceof WebInspector.Probe, "Tried to remove non-probe ", probe, " to probe group", this);
+        console.assert(probe instanceof WI.Probe, "Tried to remove non-probe ", probe, " to probe group", this);
         console.assert(this._probes.indexOf(probe) !== -1, "Tried to remove probe", probe, " not in group ", this);
         console.assert(this._probesByIdentifier.has(probe.id), "Tried to remove probe", probe, " not in group ", this);
 
         this._probes.splice(this._probes.indexOf(probe), 1);
         this._probesByIdentifier.delete(probe.id);
         this.dataTable.removeProbe(probe);
-        this.dispatchEventToListeners(WebInspector.ProbeSet.Event.ProbeRemoved, probe);
+        this.dispatchEventToListeners(WI.ProbeSet.Event.ProbeRemoved, probe);
     }
 
     willRemove()
     {
         console.assert(!this._probes.length, "ProbeSet.willRemove called, but probes still associated with group: ", this._probes);
 
-        WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
-        WebInspector.Probe.removeEventListener(WebInspector.Probe.Event.SampleAdded, this._sampleCollected, this);
-        WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointResolvedStateDidChange, this);
+        WI.Frame.removeEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
+        WI.Probe.removeEventListener(WI.Probe.Event.SampleAdded, this._sampleCollected, this);
+        WI.Breakpoint.removeEventListener(WI.Breakpoint.Event.ResolvedStateDidChange, this._breakpointResolvedStateDidChange, this);
     }
 
     // Private
@@ -116,13 +116,13 @@
         if (this.dataTable)
             this.dataTable.willRemove();
 
-        this._dataTable = new WebInspector.ProbeSetDataTable(this);
+        this._dataTable = new WI.ProbeSetDataTable(this);
     }
 
     _sampleCollected(event)
     {
         var sample = event.data;
-        console.assert(sample instanceof WebInspector.ProbeSample, "Tried to add non-sample to probe group: ", sample);
+        console.assert(sample instanceof WI.ProbeSample, "Tried to add non-sample to probe group: ", sample);
 
         var probe = event.target;
         if (!this._probesByIdentifier.has(probe.id))
@@ -130,16 +130,16 @@
 
         console.assert(this.dataTable);
         this.dataTable.addSampleForProbe(probe, sample);
-        this.dispatchEventToListeners(WebInspector.ProbeSet.Event.SampleAdded, {probe, sample});
+        this.dispatchEventToListeners(WI.ProbeSet.Event.SampleAdded, {probe, sample});
     }
 
     _breakpointResolvedStateDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ProbeSet.Event.ResolvedStateDidChange);
+        this.dispatchEventToListeners(WI.ProbeSet.Event.ResolvedStateDidChange);
     }
 };
 
-WebInspector.ProbeSet.Event = {
+WI.ProbeSet.Event = {
     ProbeAdded: "probe-set-probe-added",
     ProbeRemoved: "probe-set-probe-removed",
     ResolvedStateDidChange: "probe-set-resolved-state-did-change",
diff --git a/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataFrame.js b/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataFrame.js
index 634a7a9..4721f28 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataFrame.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataFrame.js
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSetDataFrame = class ProbeSetDataFrame
+WI.ProbeSetDataFrame = class ProbeSetDataFrame
 {
     constructor(index)
     {
@@ -37,8 +37,8 @@
 
     static compare(a, b)
     {
-        console.assert(a instanceof WebInspector.ProbeSetDataFrame, a);
-        console.assert(b instanceof WebInspector.ProbeSetDataFrame, b);
+        console.assert(a instanceof WI.ProbeSetDataFrame, a);
+        console.assert(b instanceof WI.ProbeSetDataFrame, b);
 
         return a.index - b.index;
     }
@@ -92,8 +92,8 @@
     fillMissingValues(probeSet)
     {
         for (var key of this.missingKeys(probeSet))
-            this[key] = WebInspector.ProbeSetDataFrame.MissingValue;
+            this[key] = WI.ProbeSetDataFrame.MissingValue;
     }
 };
 
-WebInspector.ProbeSetDataFrame.MissingValue = "?";
+WI.ProbeSetDataFrame.MissingValue = "?";
diff --git a/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataTable.js b/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataTable.js
index 4dcee25..4fa3013 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataTable.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ProbeSetDataTable.js
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSetDataTable = class ProbeSetDataTable extends WebInspector.Object
+WI.ProbeSetDataTable = class ProbeSetDataTable extends WI.Object
 {
     constructor(probeSet)
     {
@@ -32,7 +32,7 @@
 
         this._probeSet = probeSet;
         this._frames = [];
-        this._previousBatchIdentifier = WebInspector.ProbeSetDataTable.SentinelValue;
+        this._previousBatchIdentifier = WI.ProbeSetDataTable.SentinelValue;
     }
 
     // Public
@@ -49,7 +49,7 @@
 
     willRemove()
     {
-        this.dispatchEventToListeners(WebInspector.ProbeSetDataTable.Event.WillRemove);
+        this.dispatchEventToListeners(WI.ProbeSetDataTable.Event.WillRemove);
         this._frames = [];
         delete this._probeSet;
     }
@@ -84,7 +84,7 @@
     {
         for (var frame of this.frames)
             if (!frame[probe.id])
-                frame[probe.id] = WebInspector.ProbeSetDataTable.UnknownValue;
+                frame[probe.id] = WI.ProbeSetDataTable.UnknownValue;
     }
 
     removeProbe(probe)
@@ -97,13 +97,13 @@
 
     createFrame()
     {
-        return new WebInspector.ProbeSetDataFrame(this._frames.length);
+        return new WI.ProbeSetDataFrame(this._frames.length);
     }
 
     addFrame(frame)
     {
         this._frames.push(frame);
-        this.dispatchEventToListeners(WebInspector.ProbeSetDataTable.Event.FrameInserted, frame);
+        this.dispatchEventToListeners(WI.ProbeSetDataTable.Event.FrameInserted, frame);
     }
 
     addSeparator()
@@ -118,15 +118,15 @@
             return;
 
         previousFrame.isSeparator = true;
-        this.dispatchEventToListeners(WebInspector.ProbeSetDataTable.Event.SeparatorInserted, previousFrame);
+        this.dispatchEventToListeners(WI.ProbeSetDataTable.Event.SeparatorInserted, previousFrame);
     }
 };
 
-WebInspector.ProbeSetDataTable.Event = {
+WI.ProbeSetDataTable.Event = {
     FrameInserted: "probe-set-data-table-frame-inserted",
     SeparatorInserted: "probe-set-data-table-separator-inserted",
     WillRemove: "probe-set-data-table-will-remove"
 };
 
-WebInspector.ProbeSetDataTable.SentinelValue = -1;
-WebInspector.ProbeSetDataTable.UnknownValue = "?";
+WI.ProbeSetDataTable.SentinelValue = -1;
+WI.ProbeSetDataTable.UnknownValue = "?";
diff --git a/Source/WebInspectorUI/UserInterface/Models/Profile.js b/Source/WebInspectorUI/UserInterface/Models/Profile.js
index b0789b7..7e067c6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Profile.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Profile.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Profile = class Profile
+WI.Profile = class Profile
 {
     constructor(topDownRootNodes)
     {
         topDownRootNodes = topDownRootNodes || [];
 
         console.assert(topDownRootNodes instanceof Array);
-        console.assert(topDownRootNodes.reduce(function(previousValue, node) { return previousValue && node instanceof WebInspector.ProfileNode; }, true));
+        console.assert(topDownRootNodes.reduce(function(previousValue, node) { return previousValue && node instanceof WI.ProfileNode; }, true));
 
         this._topDownRootNodes = topDownRootNodes;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js b/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js
index 5030140..b4f42ed 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProfileNode = class ProfileNode
+WI.ProfileNode = class ProfileNode
 {
     constructor(id, type, functionName, sourceCodeLocation, callInfo, calls, childNodes)
     {
@@ -32,12 +32,12 @@
         console.assert(id);
         console.assert(!calls || calls instanceof Array);
         console.assert(!calls || calls.length >= 1);
-        console.assert(!calls || calls.every((call) => call instanceof WebInspector.ProfileNodeCall));
+        console.assert(!calls || calls.every((call) => call instanceof WI.ProfileNodeCall));
         console.assert(childNodes instanceof Array);
-        console.assert(childNodes.every((node) => node instanceof WebInspector.ProfileNode));
+        console.assert(childNodes.every((node) => node instanceof WI.ProfileNode));
 
         this._id = id;
-        this._type = type || WebInspector.ProfileNode.Type.Function;
+        this._type = type || WI.ProfileNode.Type.Function;
         this._functionName = functionName || null;
         this._sourceCodeLocation = sourceCodeLocation || null;
         this._calls = calls || null;
@@ -230,11 +230,11 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.ProfileNode.TypeCookieKey] = this._type || null;
-        cookie[WebInspector.ProfileNode.FunctionNameCookieKey] = this._functionName || null;
-        cookie[WebInspector.ProfileNode.SourceCodeURLCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.sourceCode.url ? this._sourceCodeLocation.sourceCode.url.hash : null : null;
-        cookie[WebInspector.ProfileNode.SourceCodeLocationLineCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : null;
-        cookie[WebInspector.ProfileNode.SourceCodeLocationColumnCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : null;
+        cookie[WI.ProfileNode.TypeCookieKey] = this._type || null;
+        cookie[WI.ProfileNode.FunctionNameCookieKey] = this._functionName || null;
+        cookie[WI.ProfileNode.SourceCodeURLCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.sourceCode.url ? this._sourceCodeLocation.sourceCode.url.hash : null : null;
+        cookie[WI.ProfileNode.SourceCodeLocationLineCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : null;
+        cookie[WI.ProfileNode.SourceCodeLocationColumnCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : null;
     }
 
     // Protected
@@ -263,14 +263,14 @@
     }
 };
 
-WebInspector.ProfileNode.Type = {
+WI.ProfileNode.Type = {
     Function: "profile-node-type-function",
     Program: "profile-node-type-program"
 };
 
-WebInspector.ProfileNode.TypeIdentifier = "profile-node";
-WebInspector.ProfileNode.TypeCookieKey = "profile-node-type";
-WebInspector.ProfileNode.FunctionNameCookieKey = "profile-node-function-name";
-WebInspector.ProfileNode.SourceCodeURLCookieKey = "profile-node-source-code-url";
-WebInspector.ProfileNode.SourceCodeLocationLineCookieKey = "profile-node-source-code-location-line";
-WebInspector.ProfileNode.SourceCodeLocationColumnCookieKey = "profile-node-source-code-location-column";
+WI.ProfileNode.TypeIdentifier = "profile-node";
+WI.ProfileNode.TypeCookieKey = "profile-node-type";
+WI.ProfileNode.FunctionNameCookieKey = "profile-node-function-name";
+WI.ProfileNode.SourceCodeURLCookieKey = "profile-node-source-code-url";
+WI.ProfileNode.SourceCodeLocationLineCookieKey = "profile-node-source-code-location-line";
+WI.ProfileNode.SourceCodeLocationColumnCookieKey = "profile-node-source-code-location-column";
diff --git a/Source/WebInspectorUI/UserInterface/Models/ProfileNodeCall.js b/Source/WebInspectorUI/UserInterface/Models/ProfileNodeCall.js
index 9d8ce80..542cec0 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ProfileNodeCall.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ProfileNodeCall.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProfileNodeCall = class ProfileNodeCall
+WI.ProfileNodeCall = class ProfileNodeCall
 {
     constructor(startTime, totalTime)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js b/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js
index 3210114..3439ce6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js
+++ b/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PropertyDescriptor = class PropertyDescriptor
+WI.PropertyDescriptor = class PropertyDescriptor
 {
     constructor(descriptor, symbol, isOwnProperty, wasThrown, nativeGetter, isInternalProperty)
     {
         console.assert(descriptor);
         console.assert(descriptor.name);
-        console.assert(!descriptor.value || descriptor.value instanceof WebInspector.RemoteObject);
-        console.assert(!descriptor.get || descriptor.get instanceof WebInspector.RemoteObject);
-        console.assert(!descriptor.set || descriptor.set instanceof WebInspector.RemoteObject);
-        console.assert(!symbol || symbol instanceof WebInspector.RemoteObject);
+        console.assert(!descriptor.value || descriptor.value instanceof WI.RemoteObject);
+        console.assert(!descriptor.get || descriptor.get instanceof WI.RemoteObject);
+        console.assert(!descriptor.set || descriptor.set instanceof WI.RemoteObject);
+        console.assert(!symbol || symbol instanceof WI.RemoteObject);
 
         this._name = descriptor.name;
         this._value = descriptor.value;
@@ -57,14 +57,14 @@
     static fromPayload(payload, internal, target)
     {
         if (payload.value)
-            payload.value = WebInspector.RemoteObject.fromPayload(payload.value, target);
+            payload.value = WI.RemoteObject.fromPayload(payload.value, target);
         if (payload.get)
-            payload.get = WebInspector.RemoteObject.fromPayload(payload.get, target);
+            payload.get = WI.RemoteObject.fromPayload(payload.get, target);
         if (payload.set)
-            payload.set = WebInspector.RemoteObject.fromPayload(payload.set, target);
+            payload.set = WI.RemoteObject.fromPayload(payload.set, target);
 
         if (payload.symbol)
-            payload.symbol = WebInspector.RemoteObject.fromPayload(payload.symbol, target);
+            payload.symbol = WI.RemoteObject.fromPayload(payload.symbol, target);
 
         if (internal) {
             console.assert(payload.value);
@@ -72,7 +72,7 @@
             payload.isOwn = true;
         }
 
-        return new WebInspector.PropertyDescriptor(payload, payload.symbol, payload.isOwn, payload.wasThrown, payload.nativeGetter, internal);
+        return new WI.PropertyDescriptor(payload, payload.symbol, payload.isOwn, payload.wasThrown, payload.nativeGetter, internal);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js b/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js
index f7ab5fc..05bb034 100644
--- a/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js
+++ b/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PropertyPath = class PropertyPath
+WI.PropertyPath = class PropertyPath
 {
     constructor(object, pathComponent, parent, isPrototype)
     {
-        console.assert(object instanceof WebInspector.RemoteObject || object === null);
+        console.assert(object instanceof WI.RemoteObject || object === null);
         console.assert(!pathComponent || typeof pathComponent === "string");
-        console.assert(!parent || parent instanceof WebInspector.PropertyPath);
+        console.assert(!parent || parent instanceof WI.PropertyPath);
         console.assert(!parent || pathComponent.length);
 
         // We allow property pathes with null objects as end-caps only.
@@ -47,7 +47,7 @@
 
     static emptyPropertyPathForScope(object)
     {
-        return new WebInspector.PropertyPath(object, WebInspector.PropertyPath.SpecialPathComponent.EmptyPathComponentForScope);
+        return new WI.PropertyPath(object, WI.PropertyPath.SpecialPathComponent.EmptyPathComponentForScope);
     }
 
     // Public
@@ -114,7 +114,7 @@
 
     displayPath(type)
     {
-        return type === WebInspector.PropertyPath.Type.Value ? this.reducedPath : this.fullPath;
+        return type === WI.PropertyPath.Type.Value ? this.reducedPath : this.fullPath;
     }
 
     isRoot()
@@ -124,7 +124,7 @@
 
     isScope()
     {
-        return this._pathComponent === WebInspector.PropertyPath.SpecialPathComponent.EmptyPathComponentForScope;
+        return this._pathComponent === WI.PropertyPath.SpecialPathComponent.EmptyPathComponentForScope;
     }
 
     isPathComponentImpossible()
@@ -148,93 +148,93 @@
         var isPrototype = propertyName === "__proto__";
 
         if (this.isScope())
-            return new WebInspector.PropertyPath(object, propertyName, this, isPrototype);
+            return new WI.PropertyPath(object, propertyName, this, isPrototype);
 
         var component = this._canPropertyNameBeDotAccess(propertyName) ? "." + propertyName : "[" + doubleQuotedString(propertyName) + "]";
-        return new WebInspector.PropertyPath(object, component, this, isPrototype);
+        return new WI.PropertyPath(object, component, this, isPrototype);
     }
 
     appendPropertySymbol(object, symbolName)
     {
-        var component = WebInspector.PropertyPath.SpecialPathComponent.SymbolPropertyName + (symbolName.length ? "(" + symbolName + ")" : "");
-        return new WebInspector.PropertyPath(object, component, this);
+        var component = WI.PropertyPath.SpecialPathComponent.SymbolPropertyName + (symbolName.length ? "(" + symbolName + ")" : "");
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendInternalPropertyName(object, propertyName)
     {
-        var component = WebInspector.PropertyPath.SpecialPathComponent.InternalPropertyName + "[" + propertyName + "]";
-        return new WebInspector.PropertyPath(object, component, this);
+        var component = WI.PropertyPath.SpecialPathComponent.InternalPropertyName + "[" + propertyName + "]";
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendGetterPropertyName(object, propertyName)
     {
         var component = ".__lookupGetter__(" + doubleQuotedString(propertyName) + ")";
-        return new WebInspector.PropertyPath(object, component, this);
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendSetterPropertyName(object, propertyName)
     {
         var component = ".__lookupSetter__(" + doubleQuotedString(propertyName) + ")";
-        return new WebInspector.PropertyPath(object, component, this);
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendArrayIndex(object, indexString)
     {
         var component = "[" + indexString + "]";
-        return new WebInspector.PropertyPath(object, component, this);
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendMapKey(object)
     {
-        var component = WebInspector.PropertyPath.SpecialPathComponent.MapKey;
-        return new WebInspector.PropertyPath(object, component, this);
+        var component = WI.PropertyPath.SpecialPathComponent.MapKey;
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendMapValue(object, keyObject)
     {
-        console.assert(!keyObject || keyObject instanceof WebInspector.RemoteObject);
+        console.assert(!keyObject || keyObject instanceof WI.RemoteObject);
 
         if (keyObject && keyObject.hasValue()) {
             if (keyObject.type === "string") {
                 var component = ".get(" + doubleQuotedString(keyObject.description) + ")";
-                return new WebInspector.PropertyPath(object, component, this);
+                return new WI.PropertyPath(object, component, this);
             }
 
             var component = ".get(" + keyObject.description + ")";
-            return new WebInspector.PropertyPath(object, component, this);
+            return new WI.PropertyPath(object, component, this);
         }
 
-        var component = WebInspector.PropertyPath.SpecialPathComponent.MapValue;
-        return new WebInspector.PropertyPath(object, component, this);
+        var component = WI.PropertyPath.SpecialPathComponent.MapValue;
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendSetIndex(object)
     {
-        var component = WebInspector.PropertyPath.SpecialPathComponent.SetIndex;
-        return new WebInspector.PropertyPath(object, component, this);
+        var component = WI.PropertyPath.SpecialPathComponent.SetIndex;
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendSymbolProperty(object)
     {
-        var component = WebInspector.PropertyPath.SpecialPathComponent.SymbolPropertyName;
-        return new WebInspector.PropertyPath(object, component, this);
+        var component = WI.PropertyPath.SpecialPathComponent.SymbolPropertyName;
+        return new WI.PropertyPath(object, component, this);
     }
 
     appendPropertyDescriptor(object, descriptor, type)
     {
-        console.assert(descriptor instanceof WebInspector.PropertyDescriptor);
+        console.assert(descriptor instanceof WI.PropertyDescriptor);
 
         if (descriptor.isInternalProperty)
             return this.appendInternalPropertyName(object, descriptor.name);
         if (descriptor.symbol)
             return this.appendSymbolProperty(object);
 
-        if (type === WebInspector.PropertyPath.Type.Getter)
+        if (type === WI.PropertyPath.Type.Getter)
             return this.appendGetterPropertyName(object, descriptor.name);
-        if (type === WebInspector.PropertyPath.Type.Setter)
+        if (type === WI.PropertyPath.Type.Setter)
             return this.appendSetterPropertyName(object, descriptor.name);
 
-        console.assert(type === WebInspector.PropertyPath.Type.Value);
+        console.assert(type === WI.PropertyPath.Type.Value);
 
         if (this._object.subtype === "array" && !isNaN(parseInt(descriptor.name)))
             return this.appendArrayIndex(object, descriptor.name);
@@ -250,7 +250,7 @@
     }
 };
 
-WebInspector.PropertyPath.SpecialPathComponent = {
+WI.PropertyPath.SpecialPathComponent = {
     InternalPropertyName: "@internal",
     SymbolPropertyName: "@symbol",
     MapKey: "@mapkey",
@@ -259,7 +259,7 @@
     EmptyPathComponentForScope: "",
 };
 
-WebInspector.PropertyPath.Type = {
+WI.PropertyPath.Type = {
     Value: "value",
     Getter: "getter",
     Setter: "setter",
diff --git a/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js b/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js
index 0230486..c98a4a5 100644
--- a/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js
+++ b/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PropertyPreview = class PropertyPreview
+WI.PropertyPreview = class PropertyPreview
 {
     constructor(name, type, subtype, value, valuePreview, isInternalProperty)
     {
         console.assert(typeof name === "string");
         console.assert(type);
         console.assert(!value || typeof value === "string");
-        console.assert(!valuePreview || valuePreview instanceof WebInspector.ObjectPreview);
+        console.assert(!valuePreview || valuePreview instanceof WI.ObjectPreview);
 
         this._name = name;
         this._type = type;
@@ -46,9 +46,9 @@
     static fromPayload(payload)
     {
         if (payload.valuePreview)
-            payload.valuePreview = WebInspector.ObjectPreview.fromPayload(payload.valuePreview);
+            payload.valuePreview = WI.ObjectPreview.fromPayload(payload.valuePreview);
 
-        return new WebInspector.PropertyPreview(payload.name, payload.type, payload.subtype, payload.value, payload.valuePreview, payload.internal);
+        return new WI.PropertyPreview(payload.name, payload.type, payload.subtype, payload.value, payload.valuePreview, payload.internal);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/Recording.js b/Source/WebInspectorUI/UserInterface/Models/Recording.js
index 17c758b..81a4cf9 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Recording.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Recording.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Recording = class Recording
+WI.Recording = class Recording
 {
     constructor(version, type, initialState, frames, data)
     {
@@ -33,7 +33,7 @@
         this._frames = frames;
         this._data = data;
 
-        this._actions = [new WebInspector.RecordingInitialStateAction].concat(...this._frames.map((frame) => frame.actions));
+        this._actions = [new WI.RecordingInitialStateAction].concat(...this._frames.map((frame) => frame.actions));
         this._swizzle = [];
         this._source = null;
 
@@ -42,7 +42,7 @@
                 action.swizzle(this);
 
                 let prototype = null;
-                if (this._type === WebInspector.Recording.Type.Canvas2D)
+                if (this._type === WI.Recording.Type.Canvas2D)
                     prototype = CanvasRenderingContext2D.prototype;
 
                 if (prototype) {
@@ -51,7 +51,7 @@
                     if (!validName || !validFunction) {
                         action.valid = false;
 
-                        WebInspector.Recording.synthesizeError(WebInspector.UIString("“%s” is invalid.").format(action.name));
+                        WI.Recording.synthesizeError(WI.UIString("“%s” is invalid.").format(action.name));
                     }
                 }
             }
@@ -71,7 +71,7 @@
         let type = null;
         switch (payload.type) {
         case RecordingAgent.Type.Canvas2D:
-            type = WebInspector.Recording.Type.Canvas2D;
+            type = WI.Recording.Type.Canvas2D;
             break;
         default:
             type = String(payload.type);
@@ -93,19 +93,19 @@
         if (!Array.isArray(payload.data))
             payload.data = [];
 
-        let frames = payload.frames.map(WebInspector.RecordingFrame.fromPayload);
-        return new WebInspector.Recording(payload.version, type, payload.initialState, frames, payload.data);
+        let frames = payload.frames.map(WI.RecordingFrame.fromPayload);
+        return new WI.Recording(payload.version, type, payload.initialState, frames, payload.data);
     }
 
     static synthesizeError(message)
     {
-        const target = WebInspector.mainTarget;
-        const source = WebInspector.ConsoleMessage.MessageSource.Other;
-        const level = WebInspector.ConsoleMessage.MessageLevel.Error;
-        let consoleMessage = new WebInspector.ConsoleMessage(target, source, level, WebInspector.UIString("Recording error: %s").format(message));
+        const target = WI.mainTarget;
+        const source = WI.ConsoleMessage.MessageSource.Other;
+        const level = WI.ConsoleMessage.MessageLevel.Error;
+        let consoleMessage = new WI.ConsoleMessage(target, source, level, WI.UIString("Recording error: %s").format(message));
         consoleMessage.shouldRevealConsole = true;
 
-        WebInspector.consoleLogViewController.appendConsoleMessage(consoleMessage);
+        WI.consoleLogViewController.appendConsoleMessage(consoleMessage);
     }
 
     // Public
@@ -129,49 +129,49 @@
             try {
                 let data = this._data[index];
                 switch (type) {
-                case WebInspector.Recording.Swizzle.CanvasStyle:
+                case WI.Recording.Swizzle.CanvasStyle:
                     if (Array.isArray(data)) {
                         let context = document.createElement("canvas").getContext("2d");
 
-                        let canvasStyle = this.swizzle(data[0], WebInspector.Recording.Swizzle.String);
+                        let canvasStyle = this.swizzle(data[0], WI.Recording.Swizzle.String);
                         if (canvasStyle === "linear-gradient" || canvasStyle === "radial-gradient") {
                             this._swizzle[index][type] = canvasStyle === "radial-gradient" ? context.createRadialGradient(...data[1]) : context.createLinearGradient(...data[1]);
                             for (let stop of data[2]) {
-                                let color = this.swizzle(stop[1], WebInspector.Recording.Swizzle.String);
+                                let color = this.swizzle(stop[1], WI.Recording.Swizzle.String);
                                 this._swizzle[index][type].addColorStop(stop[0], color);
                             }
                         } else if (canvasStyle === "pattern") {
-                            let image = this.swizzle(data[1], WebInspector.Recording.Swizzle.Image);
-                            let repeat = this.swizzle(data[2], WebInspector.Recording.Swizzle.String);
+                            let image = this.swizzle(data[1], WI.Recording.Swizzle.Image);
+                            let repeat = this.swizzle(data[2], WI.Recording.Swizzle.String);
                             this._swizzle[index][type] = context.createPattern(image, repeat);
                         }
                     } else if (typeof data === "string")
                         this._swizzle[index][type] = data;
                     break;
-                case WebInspector.Recording.Swizzle.Element:
-                    this._swizzle[index][type] = WebInspector.Recording.Swizzle.Invalid;
+                case WI.Recording.Swizzle.Element:
+                    this._swizzle[index][type] = WI.Recording.Swizzle.Invalid;
                     break;
-                case WebInspector.Recording.Swizzle.Image:
+                case WI.Recording.Swizzle.Image:
                     this._swizzle[index][type] = new Image;
                     this._swizzle[index][type].src = data;
                     break;
-                case WebInspector.Recording.Swizzle.ImageData:
+                case WI.Recording.Swizzle.ImageData:
                     this._swizzle[index][type] = new ImageData(new Uint8ClampedArray(data[0]), parseInt(data[1]), parseInt(data[2]));
                     break;
-                case WebInspector.Recording.Swizzle.Path2D:
+                case WI.Recording.Swizzle.Path2D:
                     this._swizzle[index][type] = new Path2D(data);
                     break;
-                case WebInspector.Recording.Swizzle.String:
+                case WI.Recording.Swizzle.String:
                     if (typeof data === "string")
                         this._swizzle[index][type] = data;
                     break;
                 }
             } catch (e) {
-                this._swizzle[index][type] = WebInspector.Recording.Swizzle.Invalid;
+                this._swizzle[index][type] = WI.Recording.Swizzle.Invalid;
             }
 
             if (!(type in this._swizzle[index]))
-                this._swizzle[index][type] = WebInspector.Recording.Swizzle.Invalid;
+                this._swizzle[index][type] = WI.Recording.Swizzle.Invalid;
         }
 
         return this._swizzle[index][type];
@@ -197,11 +197,11 @@
     }
 };
 
-WebInspector.Recording.Type = {
+WI.Recording.Type = {
     Canvas2D: "canvas-2d",
 };
 
-WebInspector.Recording.Swizzle = {
+WI.Recording.Swizzle = {
     CanvasStyle: "CanvasStyle",
     Element: "Element",
     Image: "Image",
diff --git a/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js b/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js
index dd3dce7..d744ddc 100644
--- a/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js
+++ b/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingAction = class RecordingAction
+WI.RecordingAction = class RecordingAction
 {
     constructor(name, parameters)
     {
@@ -55,12 +55,12 @@
         if (!Array.isArray(payload[1]))
             payload[1] = [];
 
-        return new WebInspector.RecordingAction(...payload);
+        return new WI.RecordingAction(...payload);
     }
 
     static isFunctionForType(type, name)
     {
-        let functionNames = WebInspector.RecordingAction._functionNames[type];
+        let functionNames = WI.RecordingAction._functionNames[type];
         if (!functionNames)
             return false;
 
@@ -82,7 +82,7 @@
 
     swizzle(recording)
     {
-        this._name = recording.swizzle(this._payloadName, WebInspector.Recording.Swizzle.String);
+        this._name = recording.swizzle(this._payloadName, WI.Recording.Swizzle.String);
 
         this._parameters = this._payloadParameters.map((item, i) => {
             let type = this.parameterSwizzleTypeForTypeAtIndex(recording.type, i);
@@ -90,20 +90,20 @@
                 return item;
 
             let swizzled = recording.swizzle(item, type);
-            if (swizzled === WebInspector.Recording.Swizzle.Invalid)
+            if (swizzled === WI.Recording.Swizzle.Invalid)
                 this._valid = false;
 
             return swizzled;
         });
 
-        this._isFunction = WebInspector.RecordingAction.isFunctionForType(recording.type, this._name);
+        this._isFunction = WI.RecordingAction.isFunctionForType(recording.type, this._name);
         this._isGetter = !this._isFunction && !this._parameters.length;
 
-        let visualNames = WebInspector.RecordingAction._visualNames[recording.type];
+        let visualNames = WI.RecordingAction._visualNames[recording.type];
         this._isVisual = visualNames ? visualNames.includes(this._name) : false;
 
         this._stateModifiers = [this._name];
-        let stateModifiers = WebInspector.RecordingAction._stateModifiers[recording.type];
+        let stateModifiers = WI.RecordingAction._stateModifiers[recording.type];
         if (stateModifiers) {
             let modifiedByAction = stateModifiers[this._name];
             if (modifiedByAction)
@@ -113,7 +113,7 @@
 
     parameterSwizzleTypeForTypeAtIndex(type, index)
     {
-        let functionNames = WebInspector.RecordingAction._parameterSwizzleTypeForTypeAtIndex[type];
+        let functionNames = WI.RecordingAction._parameterSwizzleTypeForTypeAtIndex[type];
         if (!functionNames)
             return null;
 
@@ -160,10 +160,10 @@
 //     }
 
 {
-    let {CanvasStyle, Element, Image, ImageData, Path2D, String} = WebInspector.Recording.Swizzle;
+    let {CanvasStyle, Element, Image, ImageData, Path2D, String} = WI.Recording.Swizzle;
 
-    WebInspector.RecordingAction._parameterSwizzleTypeForTypeAtIndex = {
-        [WebInspector.Recording.Type.Canvas2D]: {
+    WI.RecordingAction._parameterSwizzleTypeForTypeAtIndex = {
+        [WI.Recording.Type.Canvas2D]: {
             "clip": {
                 1: {0: String},
                 2: {0: Path2D, 1: String},
@@ -276,8 +276,8 @@
     };
 }
 
-WebInspector.RecordingAction._functionNames = {
-    [WebInspector.Recording.Type.Canvas2D]: [
+WI.RecordingAction._functionNames = {
+    [WI.Recording.Type.Canvas2D]: [
         "arc",
         "arcTo",
         "beginPath",
@@ -339,8 +339,8 @@
     ],
 };
 
-WebInspector.RecordingAction._visualNames = {
-    [WebInspector.Recording.Type.Canvas2D]: [
+WI.RecordingAction._visualNames = {
+    [WI.Recording.Type.Canvas2D]: [
         "clearRect",
         "drawFocusIfNeeded",
         "drawImage",
@@ -356,8 +356,8 @@
     ],
 };
 
-WebInspector.RecordingAction._stateModifiers = {
-    [WebInspector.Recording.Type.Canvas2D]: {
+WI.RecordingAction._stateModifiers = {
+    [WI.Recording.Type.Canvas2D]: {
         clearShadow: ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"],
         resetTransform: ["transform"],
         rotate: ["transform"],
diff --git a/Source/WebInspectorUI/UserInterface/Models/RecordingFrame.js b/Source/WebInspectorUI/UserInterface/Models/RecordingFrame.js
index 28e93a7..b534113 100644
--- a/Source/WebInspectorUI/UserInterface/Models/RecordingFrame.js
+++ b/Source/WebInspectorUI/UserInterface/Models/RecordingFrame.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingFrame = class RecordingFrame
+WI.RecordingFrame = class RecordingFrame
 {
     constructor(actions, {incomplete} = {})
     {
@@ -41,8 +41,8 @@
         if (!Array.isArray(payload.actions))
             payload.actions = [];
 
-        let actions = payload.actions.map(WebInspector.RecordingAction.fromPayload);
-        return new WebInspector.RecordingFrame(actions, {
+        let actions = payload.actions.map(WI.RecordingAction.fromPayload);
+        return new WI.RecordingFrame(actions, {
             incomplete: !!payload.incomplete,
         });
     }
diff --git a/Source/WebInspectorUI/UserInterface/Models/RecordingInitialStateAction.js b/Source/WebInspectorUI/UserInterface/Models/RecordingInitialStateAction.js
index ac07a48..d549854 100644
--- a/Source/WebInspectorUI/UserInterface/Models/RecordingInitialStateAction.js
+++ b/Source/WebInspectorUI/UserInterface/Models/RecordingInitialStateAction.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingInitialStateAction = class RecordingInitialStateAction extends WebInspector.RecordingAction
+WI.RecordingInitialStateAction = class RecordingInitialStateAction extends WI.RecordingAction
 {
     constructor()
     {
         super();
 
-        this._name = WebInspector.UIString("Initial State");
+        this._name = WI.UIString("Initial State");
 
         this._valid = false;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js
index d6b502f..10dca42 100644
--- a/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RenderingFrameTimelineRecord = class RenderingFrameTimelineRecord extends WebInspector.TimelineRecord
+WI.RenderingFrameTimelineRecord = class RenderingFrameTimelineRecord extends WI.TimelineRecord
 {
     constructor(startTime, endTime)
     {
-        super(WebInspector.TimelineRecord.Type.RenderingFrame, startTime, endTime);
+        super(WI.TimelineRecord.Type.RenderingFrame, startTime, endTime);
 
         this._durationByTaskType = new Map;
         this._frameIndex = -1;
@@ -37,32 +37,32 @@
 
     static resetFrameIndex()
     {
-        WebInspector.RenderingFrameTimelineRecord._nextFrameIndex = 0;
+        WI.RenderingFrameTimelineRecord._nextFrameIndex = 0;
     }
 
     static displayNameForTaskType(taskType)
     {
         switch (taskType) {
-        case WebInspector.RenderingFrameTimelineRecord.TaskType.Script:
-            return WebInspector.UIString("Script");
-        case WebInspector.RenderingFrameTimelineRecord.TaskType.Layout:
-            return WebInspector.UIString("Layout");
-        case WebInspector.RenderingFrameTimelineRecord.TaskType.Paint:
-            return WebInspector.UIString("Paint");
-        case WebInspector.RenderingFrameTimelineRecord.TaskType.Other:
-            return WebInspector.UIString("Other");
+        case WI.RenderingFrameTimelineRecord.TaskType.Script:
+            return WI.UIString("Script");
+        case WI.RenderingFrameTimelineRecord.TaskType.Layout:
+            return WI.UIString("Layout");
+        case WI.RenderingFrameTimelineRecord.TaskType.Paint:
+            return WI.UIString("Paint");
+        case WI.RenderingFrameTimelineRecord.TaskType.Other:
+            return WI.UIString("Other");
         }
     }
 
     static taskTypeForTimelineRecord(record)
     {
         switch (record.type) {
-        case WebInspector.TimelineRecord.Type.Script:
-            return WebInspector.RenderingFrameTimelineRecord.TaskType.Script;
-        case WebInspector.TimelineRecord.Type.Layout:
-            if (record.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint || record.eventType === WebInspector.LayoutTimelineRecord.EventType.Composite)
-                return WebInspector.RenderingFrameTimelineRecord.TaskType.Paint;
-            return WebInspector.RenderingFrameTimelineRecord.TaskType.Layout;
+        case WI.TimelineRecord.Type.Script:
+            return WI.RenderingFrameTimelineRecord.TaskType.Script;
+        case WI.TimelineRecord.Type.Layout:
+            if (record.eventType === WI.LayoutTimelineRecord.EventType.Paint || record.eventType === WI.LayoutTimelineRecord.EventType.Composite)
+                return WI.RenderingFrameTimelineRecord.TaskType.Paint;
+            return WI.RenderingFrameTimelineRecord.TaskType.Layout;
         default:
             console.error("Unsupported timeline record type: " + record.type);
             return null;
@@ -86,7 +86,7 @@
         console.assert(this._frameIndex === -1, "Frame index should only be set once.");
         if (this._frameIndex >= 0)
             return;
-        this._frameIndex = WebInspector.RenderingFrameTimelineRecord._nextFrameIndex++;
+        this._frameIndex = WI.RenderingFrameTimelineRecord._nextFrameIndex++;
     }
 
     durationForTask(taskType)
@@ -95,11 +95,11 @@
             return this._durationByTaskType.get(taskType);
 
         var duration;
-        if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
+        if (taskType === WI.RenderingFrameTimelineRecord.TaskType.Other)
             duration = this._calculateDurationRemainder();
         else {
             duration = this.children.reduce(function(previousValue, currentValue) {
-                if (taskType !== WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord(currentValue))
+                if (taskType !== WI.RenderingFrameTimelineRecord.taskTypeForTimelineRecord(currentValue))
                     return previousValue;
 
                 var currentDuration = currentValue.duration;
@@ -108,11 +108,11 @@
                 return previousValue + currentDuration;
             }, 0);
 
-            if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Script) {
+            if (taskType === WI.RenderingFrameTimelineRecord.TaskType.Script) {
                 // Layout events synchronously triggered from JavaScript must be subtracted from the total
                 // script time, to prevent the time from being counted twice.
                 duration -= this.children.reduce(function(previousValue, currentValue) {
-                    if (currentValue.type === WebInspector.TimelineRecord.Type.Layout && (currentValue.sourceCodeLocation || currentValue.callFrames))
+                    if (currentValue.type === WI.TimelineRecord.Type.Layout && (currentValue.sourceCodeLocation || currentValue.callFrames))
                         return previousValue + currentValue.duration;
                     return previousValue;
                 }, 0);
@@ -127,22 +127,22 @@
 
     _calculateDurationRemainder()
     {
-        return Object.keys(WebInspector.RenderingFrameTimelineRecord.TaskType).reduce((previousValue, key) => {
-            let taskType = WebInspector.RenderingFrameTimelineRecord.TaskType[key];
-            if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
+        return Object.keys(WI.RenderingFrameTimelineRecord.TaskType).reduce((previousValue, key) => {
+            let taskType = WI.RenderingFrameTimelineRecord.TaskType[key];
+            if (taskType === WI.RenderingFrameTimelineRecord.TaskType.Other)
                 return previousValue;
             return previousValue - this.durationForTask(taskType);
         }, this.duration);
     }
 };
 
-WebInspector.RenderingFrameTimelineRecord.TaskType = {
+WI.RenderingFrameTimelineRecord.TaskType = {
     Script: "rendering-frame-timeline-record-script",
     Layout: "rendering-frame-timeline-record-layout",
     Paint: "rendering-frame-timeline-record-paint",
     Other: "rendering-frame-timeline-record-other"
 };
 
-WebInspector.RenderingFrameTimelineRecord.TypeIdentifier = "rendering-frame-timeline-record";
+WI.RenderingFrameTimelineRecord.TypeIdentifier = "rendering-frame-timeline-record";
 
-WebInspector.RenderingFrameTimelineRecord._nextFrameIndex = 0;
+WI.RenderingFrameTimelineRecord._nextFrameIndex = 0;
diff --git a/Source/WebInspectorUI/UserInterface/Models/Resource.js b/Source/WebInspectorUI/UserInterface/Models/Resource.js
index 0bc643c..4553234 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Resource.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Resource.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Resource = class Resource extends WebInspector.SourceCode
+WI.Resource = class Resource extends WI.SourceCode
 {
     constructor(url, mimeType, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp)
     {
@@ -32,14 +32,14 @@
 
         console.assert(url);
 
-        if (type in WebInspector.Resource.Type)
-            type = WebInspector.Resource.Type[type];
+        if (type in WI.Resource.Type)
+            type = WI.Resource.Type[type];
 
         this._url = url;
         this._urlComponents = null;
         this._mimeType = mimeType;
         this._mimeTypeComponents = null;
-        this._type = type || WebInspector.Resource.typeFromMIMEType(mimeType);
+        this._type = type || WI.Resource.typeFromMIMEType(mimeType);
         this._loaderIdentifier = loaderIdentifier || null;
         this._requestIdentifier = requestIdentifier || null;
         this._requestMethod = requestMethod || null;
@@ -63,13 +63,13 @@
         this._failed = false;
         this._failureReasonText = null;
         this._receivedNetworkLoadMetrics = false;
-        this._responseSource = WebInspector.Resource.ResponseSource.Unknown;
-        this._timingData = new WebInspector.ResourceTimingData(this);
+        this._responseSource = WI.Resource.ResponseSource.Unknown;
+        this._timingData = new WI.ResourceTimingData(this);
         this._protocol = null;
-        this._priority = WebInspector.Resource.NetworkPriority.Unknown;
+        this._priority = WI.Resource.NetworkPriority.Unknown;
         this._remoteAddress = null;
         this._connectionIdentifier = null;
-        this._target = targetId ? WebInspector.targetManager.targetForIdentifier(targetId) : WebInspector.mainTarget;
+        this._target = targetId ? WI.targetManager.targetForIdentifier(targetId) : WI.mainTarget;
 
         // Exact sizes if loaded over the network or cache.
         this._requestHeadersTransferSize = NaN;
@@ -84,7 +84,7 @@
         this._estimatedTransferSize = NaN;
         this._estimatedResponseHeadersSize = NaN;
 
-        if (this._initiatorSourceCodeLocation && this._initiatorSourceCodeLocation.sourceCode instanceof WebInspector.Resource)
+        if (this._initiatorSourceCodeLocation && this._initiatorSourceCodeLocation.sourceCode instanceof WI.Resource)
             this._initiatorSourceCodeLocation.sourceCode.addInitiatedResource(this);
     }
 
@@ -93,59 +93,59 @@
     static typeFromMIMEType(mimeType)
     {
         if (!mimeType)
-            return WebInspector.Resource.Type.Other;
+            return WI.Resource.Type.Other;
 
         mimeType = parseMIMEType(mimeType).type;
 
-        if (mimeType in WebInspector.Resource._mimeTypeMap)
-            return WebInspector.Resource._mimeTypeMap[mimeType];
+        if (mimeType in WI.Resource._mimeTypeMap)
+            return WI.Resource._mimeTypeMap[mimeType];
 
         if (mimeType.startsWith("image/"))
-            return WebInspector.Resource.Type.Image;
+            return WI.Resource.Type.Image;
 
         if (mimeType.startsWith("font/"))
-            return WebInspector.Resource.Type.Font;
+            return WI.Resource.Type.Font;
 
-        return WebInspector.Resource.Type.Other;
+        return WI.Resource.Type.Other;
     }
 
     static displayNameForType(type, plural)
     {
         switch (type) {
-        case WebInspector.Resource.Type.Document:
+        case WI.Resource.Type.Document:
             if (plural)
-                return WebInspector.UIString("Documents");
-            return WebInspector.UIString("Document");
-        case WebInspector.Resource.Type.Stylesheet:
+                return WI.UIString("Documents");
+            return WI.UIString("Document");
+        case WI.Resource.Type.Stylesheet:
             if (plural)
-                return WebInspector.UIString("Stylesheets");
-            return WebInspector.UIString("Stylesheet");
-        case WebInspector.Resource.Type.Image:
+                return WI.UIString("Stylesheets");
+            return WI.UIString("Stylesheet");
+        case WI.Resource.Type.Image:
             if (plural)
-                return WebInspector.UIString("Images");
-            return WebInspector.UIString("Image");
-        case WebInspector.Resource.Type.Font:
+                return WI.UIString("Images");
+            return WI.UIString("Image");
+        case WI.Resource.Type.Font:
             if (plural)
-                return WebInspector.UIString("Fonts");
-            return WebInspector.UIString("Font");
-        case WebInspector.Resource.Type.Script:
+                return WI.UIString("Fonts");
+            return WI.UIString("Font");
+        case WI.Resource.Type.Script:
             if (plural)
-                return WebInspector.UIString("Scripts");
-            return WebInspector.UIString("Script");
-        case WebInspector.Resource.Type.XHR:
+                return WI.UIString("Scripts");
+            return WI.UIString("Script");
+        case WI.Resource.Type.XHR:
             if (plural)
-                return WebInspector.UIString("XHRs");
-            return WebInspector.UIString("XHR");
-        case WebInspector.Resource.Type.Fetch:
+                return WI.UIString("XHRs");
+            return WI.UIString("XHR");
+        case WI.Resource.Type.Fetch:
             if (plural)
-                return WebInspector.UIString("Fetches");
-            return WebInspector.UIString("Fetch");
-        case WebInspector.Resource.Type.WebSocket:
+                return WI.UIString("Fetches");
+            return WI.UIString("Fetch");
+        case WI.Resource.Type.WebSocket:
             if (plural)
-                return WebInspector.UIString("Sockets");
-            return WebInspector.UIString("Socket");
-        case WebInspector.Resource.Type.Other:
-            return WebInspector.UIString("Other");
+                return WI.UIString("Sockets");
+            return WI.UIString("Socket");
+        case WI.Resource.Type.Other:
+            return WI.UIString("Other");
         default:
             console.error("Unknown resource type", type);
             return null;
@@ -178,10 +178,10 @@
         console.assert(typeof b === "symbol");
 
         const map = {
-            [WebInspector.Resource.NetworkPriority.Unknown]: 0,
-            [WebInspector.Resource.NetworkPriority.Low]: 1,
-            [WebInspector.Resource.NetworkPriority.Medium]: 2,
-            [WebInspector.Resource.NetworkPriority.High]: 3,
+            [WI.Resource.NetworkPriority.Unknown]: 0,
+            [WI.Resource.NetworkPriority.Low]: 1,
+            [WI.Resource.NetworkPriority.Medium]: 2,
+            [WI.Resource.NetworkPriority.High]: 3,
         };
 
         let aNum = map[a] || 0;
@@ -192,12 +192,12 @@
     static displayNameForPriority(priority)
     {
         switch (priority) {
-        case WebInspector.Resource.NetworkPriority.Low:
-            return WebInspector.UIString("Low");
-        case WebInspector.Resource.NetworkPriority.Medium:
-            return WebInspector.UIString("Medium");
-        case WebInspector.Resource.NetworkPriority.High:
-            return WebInspector.UIString("High");
+        case WI.Resource.NetworkPriority.Low:
+            return WI.UIString("Low");
+        case WI.Resource.NetworkPriority.Medium:
+            return WI.UIString("Medium");
+        case WI.Resource.NetworkPriority.High:
+            return WI.UIString("High");
         default:
             return null;
         }
@@ -206,20 +206,20 @@
     static responseSourceFromPayload(source)
     {
         if (!source)
-            return WebInspector.Resource.ResponseSource.Unknown;
+            return WI.Resource.ResponseSource.Unknown;
 
         switch (source) {
         case NetworkAgent.ResponseSource.Unknown:
-            return WebInspector.Resource.ResponseSource.Unknown;
+            return WI.Resource.ResponseSource.Unknown;
         case NetworkAgent.ResponseSource.Network:
-            return WebInspector.Resource.ResponseSource.Network;
+            return WI.Resource.ResponseSource.Network;
         case NetworkAgent.ResponseSource.MemoryCache:
-            return WebInspector.Resource.ResponseSource.MemoryCache;
+            return WI.Resource.ResponseSource.MemoryCache;
         case NetworkAgent.ResponseSource.DiskCache:
-            return WebInspector.Resource.ResponseSource.DiskCache;
+            return WI.Resource.ResponseSource.DiskCache;
         default:
             console.error("Unknown response source type", source);
-            return WebInspector.Resource.ResponseSource.Unknown;
+            return WI.Resource.ResponseSource.Unknown;
         }
     }
 
@@ -227,31 +227,31 @@
     {
         switch (priority) {
         case NetworkAgent.MetricsPriority.Low:
-            return WebInspector.Resource.NetworkPriority.Low;
+            return WI.Resource.NetworkPriority.Low;
         case NetworkAgent.MetricsPriority.Medium:
-            return WebInspector.Resource.NetworkPriority.Medium;
+            return WI.Resource.NetworkPriority.Medium;
         case NetworkAgent.MetricsPriority.High:
-            return WebInspector.Resource.NetworkPriority.High;
+            return WI.Resource.NetworkPriority.High;
         default:
             console.error("Unknown metrics priority", priority);
-            return WebInspector.Resource.NetworkPriority.Unknown;
+            return WI.Resource.NetworkPriority.Unknown;
         }
     }
 
     static connectionIdentifierFromPayload(connectionIdentifier)
     {
         // Map backend connection identifiers to an easier to read number.
-        if (!WebInspector.Resource.connectionIdentifierMap) {
-            WebInspector.Resource.connectionIdentifierMap = new Map;
-            WebInspector.Resource.nextConnectionIdentifier = 1;
+        if (!WI.Resource.connectionIdentifierMap) {
+            WI.Resource.connectionIdentifierMap = new Map;
+            WI.Resource.nextConnectionIdentifier = 1;
         }
 
-        let id = WebInspector.Resource.connectionIdentifierMap.get(connectionIdentifier);
+        let id = WI.Resource.connectionIdentifierMap.get(connectionIdentifier);
         if (id)
             return id;
 
-        id = WebInspector.Resource.nextConnectionIdentifier++;
-        WebInspector.Resource.connectionIdentifierMap.set(connectionIdentifier, id);
+        id = WI.Resource.nextConnectionIdentifier++;
+        WI.Resource.connectionIdentifierMap.set(connectionIdentifier, id);
         return id;
     }
 
@@ -286,14 +286,14 @@
 
     get displayName()
     {
-        return WebInspector.displayNameForURL(this._url, this.urlComponents);
+        return WI.displayNameForURL(this._url, this.urlComponents);
     }
 
     get displayURL()
     {
         const isMultiLine = true;
         const dataURIMaxSize = 64;
-        return WebInspector.truncateURL(this._url, isMultiLine, dataURIMaxSize);
+        return WI.truncateURL(this._url, isMultiLine, dataURIMaxSize);
     }
 
     get initiatorSourceCodeLocation()
@@ -326,19 +326,19 @@
     get syntheticMIMEType()
     {
         // Resources are often transferred with a MIME-type that doesn't match the purpose the
-        // resource was loaded for, which is what WebInspector.Resource.Type represents.
+        // resource was loaded for, which is what WI.Resource.Type represents.
         // This getter generates a MIME-type, if needed, that matches the resource type.
 
         // If the type matches the Resource.Type of the MIME-type, then return the actual MIME-type.
-        if (this._type === WebInspector.Resource.typeFromMIMEType(this._mimeType))
+        if (this._type === WI.Resource.typeFromMIMEType(this._mimeType))
             return this._mimeType;
 
         // Return the default MIME-types for the Resource.Type, since the current MIME-type
         // does not match what is expected for the Resource.Type.
         switch (this._type) {
-        case WebInspector.Resource.Type.Stylesheet:
+        case WI.Resource.Type.Stylesheet:
             return "text/css";
-        case WebInspector.Resource.Type.Script:
+        case WI.Resource.Type.Script:
             return "text/javascript";
         }
 
@@ -367,12 +367,12 @@
 
     addInitiatedResource(resource)
     {
-        if (!(resource instanceof WebInspector.Resource))
+        if (!(resource instanceof WI.Resource))
             return;
 
         this._initiatedResources.push(resource);
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.InitiatedResourcesDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.InitiatedResourcesDidChange);
     }
 
     get parentFrame()
@@ -515,7 +515,7 @@
         // macOS provides the decoded transfer size instead of the encoded size
         // for estimatedTransferSize. So prefer the "Content-Length" property
         // on mac if it is available.
-        if (WebInspector.Platform.name === "mac") {
+        if (WI.Platform.name === "mac") {
             let contentLength = Number(this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"));
             if (!isNaN(contentLength))
                 return contentLength;
@@ -566,7 +566,7 @@
 
     scriptForLocation(sourceCodeLocation)
     {
-        console.assert(!(this instanceof WebInspector.SourceMapResource));
+        console.assert(!(this instanceof WI.SourceMapResource));
         console.assert(sourceCodeLocation.sourceCode === this, "SourceCodeLocation must be in this Resource");
         if (sourceCodeLocation.sourceCode !== this)
             return null;
@@ -603,11 +603,11 @@
             // Delete the URL components so the URL is re-parsed the next time it is requested.
             this._urlComponents = null;
 
-            this.dispatchEventToListeners(WebInspector.Resource.Event.URLDidChange, {oldURL});
+            this.dispatchEventToListeners(WI.Resource.Event.URLDidChange, {oldURL});
         }
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.RequestHeadersDidChange);
-        this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.RequestHeadersDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.TimestampsDidChange);
     }
 
     hasResponse()
@@ -625,20 +625,20 @@
         let oldMIMEType = this._mimeType;
         let oldType = this._type;
 
-        if (type in WebInspector.Resource.Type)
-            type = WebInspector.Resource.Type[type];
+        if (type in WI.Resource.Type)
+            type = WI.Resource.Type[type];
 
         this._url = url;
         this._mimeType = mimeType;
-        this._type = type || WebInspector.Resource.typeFromMIMEType(mimeType);
+        this._type = type || WI.Resource.typeFromMIMEType(mimeType);
         this._statusCode = statusCode;
         this._statusText = statusText;
         this._responseHeaders = responseHeaders || {};
         this._responseReceivedTimestamp = elapsedTime || NaN;
-        this._timingData = WebInspector.ResourceTimingData.fromPayload(timingData, this);
+        this._timingData = WI.ResourceTimingData.fromPayload(timingData, this);
 
         if (source)
-            this._responseSource = WebInspector.Resource.responseSourceFromPayload(source);
+            this._responseSource = WI.Resource.responseSourceFromPayload(source);
 
         const headerBaseSize = 12; // Length of "HTTP/1.1 ", " ", and "\r\n".
         const headerPad = 4; // Length of ": " and "\r\n".
@@ -647,7 +647,7 @@
             this._estimatedResponseHeadersSize += name.length + this._responseHeaders[name].length + headerPad;
 
         if (!this._cached) {
-            if (statusCode === 304 || (this._responseSource === WebInspector.Resource.ResponseSource.MemoryCache || this._responseSource === WebInspector.Resource.ResponseSource.DiskCache))
+            if (statusCode === 304 || (this._responseSource === WI.Resource.ResponseSource.MemoryCache || this._responseSource === WI.Resource.ResponseSource.DiskCache))
                 this.markAsCached();
         }
 
@@ -655,18 +655,18 @@
             // Delete the URL components so the URL is re-parsed the next time it is requested.
             this._urlComponents = null;
 
-            this.dispatchEventToListeners(WebInspector.Resource.Event.URLDidChange, {oldURL});
+            this.dispatchEventToListeners(WI.Resource.Event.URLDidChange, {oldURL});
         }
 
         if (oldMIMEType !== mimeType) {
             // Delete the MIME-type components so the MIME-type is re-parsed the next time it is requested.
             this._mimeTypeComponents = null;
 
-            this.dispatchEventToListeners(WebInspector.Resource.Event.MIMETypeDidChange, {oldMIMEType});
+            this.dispatchEventToListeners(WI.Resource.Event.MIMETypeDidChange, {oldMIMEType});
         }
 
         if (oldType !== type)
-            this.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange, {oldType});
+            this.dispatchEventToListeners(WI.Resource.Event.TypeDidChange, {oldType});
 
         console.assert(isNaN(this._estimatedSize));
         console.assert(isNaN(this._estimatedTransferSize));
@@ -674,10 +674,10 @@
         // The transferSize becomes 0 when status is 304 or Content-Length is available, so
         // notify listeners of that change.
         if (statusCode === 304 || this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"))
-            this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);
+            this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.ResponseReceived);
-        this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.ResponseReceived);
+        this.dispatchEventToListeners(WI.Resource.Event.TimestampsDidChange);
     }
 
     updateWithMetrics(metrics)
@@ -687,14 +687,14 @@
         if (metrics.protocol)
             this._protocol = metrics.protocol;
         if (metrics.priority)
-            this._priority = WebInspector.Resource.networkPriorityFromPayload(metrics.priority);
+            this._priority = WI.Resource.networkPriorityFromPayload(metrics.priority);
         if (metrics.remoteAddress)
             this._remoteAddress = metrics.remoteAddress;
         if (metrics.connectionIdentifier)
-            this._connectionIdentifier = WebInspector.Resource.connectionIdentifierFromPayload(metrics.connectionIdentifier);
+            this._connectionIdentifier = WI.Resource.connectionIdentifierFromPayload(metrics.connectionIdentifier);
         if (metrics.requestHeaders) {
             this._requestHeaders = metrics.requestHeaders;
-            this.dispatchEventToListeners(WebInspector.Resource.Event.RequestHeadersDidChange);
+            this.dispatchEventToListeners(WI.Resource.Event.RequestHeadersDidChange);
         }
 
         if ("requestHeaderBytesSent" in metrics) {
@@ -710,8 +710,8 @@
             console.assert(this._responseBodyTransferSize >= 0);
             console.assert(this._responseBodySize >= 0);
 
-            this.dispatchEventToListeners(WebInspector.Resource.Event.SizeDidChange, {previousSize: this._estimatedSize});
-            this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);
+            this.dispatchEventToListeners(WI.Resource.Event.SizeDidChange, {previousSize: this._estimatedSize});
+            this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
         }
     }
 
@@ -752,11 +752,11 @@
 
         this._lastDataReceivedTimestamp = elapsedTime || NaN;
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.SizeDidChange, {previousSize});
+        this.dispatchEventToListeners(WI.Resource.Event.SizeDidChange, {previousSize});
 
         // The estimatedTransferSize is based off of size when status is not 304 or Content-Length is missing.
         if (isNaN(this._estimatedTransferSize) && this._statusCode !== 304 && !this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"))
-            this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);
+            this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
     }
 
     increaseTransferSize(encodedDataLength)
@@ -768,18 +768,18 @@
             this._estimatedTransferSize = 0;
         this._estimatedTransferSize += encodedDataLength;
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
     }
 
     markAsCached()
     {
         this._cached = true;
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.CacheStatusDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.CacheStatusDidChange);
 
         // The transferSize starts returning 0 when cached is true, unless status is 304.
         if (this._statusCode !== 304)
-            this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);
+            this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
     }
 
     markAsFinished(elapsedTime)
@@ -794,8 +794,8 @@
         if (this._finishThenRequestContentPromise)
             this._finishThenRequestContentPromise = null;
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.LoadingDidFinish);
-        this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.LoadingDidFinish);
+        this.dispatchEventToListeners(WI.Resource.Event.TimestampsDidChange);
     }
 
     markAsFailed(canceled, elapsedTime, errorText)
@@ -809,8 +809,8 @@
         if (!this._failureReasonText)
             this._failureReasonText = errorText || null;
 
-        this.dispatchEventToListeners(WebInspector.Resource.Event.LoadingDidFail);
-        this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);
+        this.dispatchEventToListeners(WI.Resource.Event.LoadingDidFail);
+        this.dispatchEventToListeners(WI.Resource.Event.TimestampsDidChange);
     }
 
     revertMarkAsFinished()
@@ -826,9 +826,9 @@
     legacyMarkServedFromMemoryCache()
     {
         // COMPATIBILITY (iOS 10.3): This is a legacy code path where we know the resource came from the MemoryCache.
-        console.assert(this._responseSource === WebInspector.Resource.ResponseSource.Unknown);
+        console.assert(this._responseSource === WI.Resource.ResponseSource.Unknown);
 
-        this._responseSource = WebInspector.Resource.ResponseSource.MemoryCache;
+        this._responseSource = WI.Resource.ResponseSource.MemoryCache;
 
         this.markAsCached();
     }
@@ -836,9 +836,9 @@
     legacyMarkServedFromDiskCache()
     {
         // COMPATIBILITY (iOS 10.3): This is a legacy code path where we know the resource came from the DiskCache.
-        console.assert(this._responseSource === WebInspector.Resource.ResponseSource.Unknown);
+        console.assert(this._responseSource === WI.Resource.ResponseSource.Unknown);
 
-        this._responseSource = WebInspector.Resource.ResponseSource.DiskCache;
+        this._responseSource = WI.Resource.ResponseSource.DiskCache;
 
         this.markAsCached();
     }
@@ -851,7 +851,7 @@
     getImageSize(callback)
     {
         // Throw an error in the case this resource is not an image.
-        if (this.type !== WebInspector.Resource.Type.Image)
+        if (this.type !== WI.Resource.Type.Image)
             throw "Resource is not an image.";
 
         // See if we've already computed and cached the image size,
@@ -900,13 +900,13 @@
             return super.requestContent();
 
         if (this._failed)
-            return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")});
+            return Promise.resolve({error: WI.UIString("An error occurred trying to load the resource.")});
 
         if (!this._finishThenRequestContentPromise) {
             this._finishThenRequestContentPromise = new Promise((resolve, reject) => {
-                this.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, resolve);
-                this.addEventListener(WebInspector.Resource.Event.LoadingDidFail, reject);
-            }).then(WebInspector.SourceCode.prototype.requestContent.bind(this));
+                this.addEventListener(WI.Resource.Event.LoadingDidFinish, resolve);
+                this.addEventListener(WI.Resource.Event.LoadingDidFail, reject);
+            }).then(WI.SourceCode.prototype.requestContent.bind(this));
         }
 
         return this._finishThenRequestContentPromise;
@@ -919,17 +919,17 @@
 
         this._scripts.push(script);
 
-        if (this._type === WebInspector.Resource.Type.Other || this._type === WebInspector.Resource.Type.XHR) {
+        if (this._type === WI.Resource.Type.Other || this._type === WI.Resource.Type.XHR) {
             let oldType = this._type;
-            this._type = WebInspector.Resource.Type.Script;
-            this.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange, {oldType});
+            this._type = WI.Resource.Type.Script;
+            this.dispatchEventToListeners(WI.Resource.Event.TypeDidChange, {oldType});
         }
     }
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.Resource.URLCookieKey] = this.url.hash;
-        cookie[WebInspector.Resource.MainResourceCookieKey] = this.isMainResource();
+        cookie[WI.Resource.URLCookieKey] = this.url.hash;
+        cookie[WI.Resource.MainResourceCookieKey] = this.isMainResource();
     }
 
     generateCURLCommand()
@@ -975,11 +975,11 @@
     }
 };
 
-WebInspector.Resource.TypeIdentifier = "resource";
-WebInspector.Resource.URLCookieKey = "resource-url";
-WebInspector.Resource.MainResourceCookieKey = "resource-is-main-resource";
+WI.Resource.TypeIdentifier = "resource";
+WI.Resource.URLCookieKey = "resource-url";
+WI.Resource.MainResourceCookieKey = "resource-is-main-resource";
 
-WebInspector.Resource.Event = {
+WI.Resource.Event = {
     URLDidChange: "resource-url-did-change",
     MIMETypeDidChange: "resource-mime-type-did-change",
     TypeDidChange: "resource-type-did-change",
@@ -995,7 +995,7 @@
 };
 
 // Keep these in sync with the "ResourceType" enum defined by the "Page" domain.
-WebInspector.Resource.Type = {
+WI.Resource.Type = {
     Document: "resource-type-document",
     Stylesheet: "resource-type-stylesheet",
     Image: "resource-type-image",
@@ -1007,57 +1007,57 @@
     Other: "resource-type-other"
 };
 
-WebInspector.Resource.ResponseSource = {
+WI.Resource.ResponseSource = {
     Unknown: Symbol("unknown"),
     Network: Symbol("network"),
     MemoryCache: Symbol("memory-cache"),
     DiskCache: Symbol("disk-cache"),
 };
 
-WebInspector.Resource.NetworkPriority = {
+WI.Resource.NetworkPriority = {
     Unknown: Symbol("unknown"),
     Low: Symbol("low"),
     Medium: Symbol("medium"),
     High: Symbol("high"),
 };
 
-// This MIME Type map is private, use WebInspector.Resource.typeFromMIMEType().
-WebInspector.Resource._mimeTypeMap = {
-    "text/html": WebInspector.Resource.Type.Document,
-    "text/xml": WebInspector.Resource.Type.Document,
-    "text/plain": WebInspector.Resource.Type.Document,
-    "application/xhtml+xml": WebInspector.Resource.Type.Document,
-    "image/svg+xml": WebInspector.Resource.Type.Document,
+// This MIME Type map is private, use WI.Resource.typeFromMIMEType().
+WI.Resource._mimeTypeMap = {
+    "text/html": WI.Resource.Type.Document,
+    "text/xml": WI.Resource.Type.Document,
+    "text/plain": WI.Resource.Type.Document,
+    "application/xhtml+xml": WI.Resource.Type.Document,
+    "image/svg+xml": WI.Resource.Type.Document,
 
-    "text/css": WebInspector.Resource.Type.Stylesheet,
-    "text/xsl": WebInspector.Resource.Type.Stylesheet,
-    "text/x-less": WebInspector.Resource.Type.Stylesheet,
-    "text/x-sass": WebInspector.Resource.Type.Stylesheet,
-    "text/x-scss": WebInspector.Resource.Type.Stylesheet,
+    "text/css": WI.Resource.Type.Stylesheet,
+    "text/xsl": WI.Resource.Type.Stylesheet,
+    "text/x-less": WI.Resource.Type.Stylesheet,
+    "text/x-sass": WI.Resource.Type.Stylesheet,
+    "text/x-scss": WI.Resource.Type.Stylesheet,
 
-    "application/pdf": WebInspector.Resource.Type.Image,
+    "application/pdf": WI.Resource.Type.Image,
 
-    "application/x-font-type1": WebInspector.Resource.Type.Font,
-    "application/x-font-ttf": WebInspector.Resource.Type.Font,
-    "application/x-font-woff": WebInspector.Resource.Type.Font,
-    "application/x-truetype-font": WebInspector.Resource.Type.Font,
+    "application/x-font-type1": WI.Resource.Type.Font,
+    "application/x-font-ttf": WI.Resource.Type.Font,
+    "application/x-font-woff": WI.Resource.Type.Font,
+    "application/x-truetype-font": WI.Resource.Type.Font,
 
-    "text/javascript": WebInspector.Resource.Type.Script,
-    "text/ecmascript": WebInspector.Resource.Type.Script,
-    "application/javascript": WebInspector.Resource.Type.Script,
-    "application/ecmascript": WebInspector.Resource.Type.Script,
-    "application/x-javascript": WebInspector.Resource.Type.Script,
-    "application/json": WebInspector.Resource.Type.Script,
-    "application/x-json": WebInspector.Resource.Type.Script,
-    "text/x-javascript": WebInspector.Resource.Type.Script,
-    "text/x-json": WebInspector.Resource.Type.Script,
-    "text/javascript1.1": WebInspector.Resource.Type.Script,
-    "text/javascript1.2": WebInspector.Resource.Type.Script,
-    "text/javascript1.3": WebInspector.Resource.Type.Script,
-    "text/jscript": WebInspector.Resource.Type.Script,
-    "text/livescript": WebInspector.Resource.Type.Script,
-    "text/x-livescript": WebInspector.Resource.Type.Script,
-    "text/typescript": WebInspector.Resource.Type.Script,
-    "text/x-clojure": WebInspector.Resource.Type.Script,
-    "text/x-coffeescript": WebInspector.Resource.Type.Script
+    "text/javascript": WI.Resource.Type.Script,
+    "text/ecmascript": WI.Resource.Type.Script,
+    "application/javascript": WI.Resource.Type.Script,
+    "application/ecmascript": WI.Resource.Type.Script,
+    "application/x-javascript": WI.Resource.Type.Script,
+    "application/json": WI.Resource.Type.Script,
+    "application/x-json": WI.Resource.Type.Script,
+    "text/x-javascript": WI.Resource.Type.Script,
+    "text/x-json": WI.Resource.Type.Script,
+    "text/javascript1.1": WI.Resource.Type.Script,
+    "text/javascript1.2": WI.Resource.Type.Script,
+    "text/javascript1.3": WI.Resource.Type.Script,
+    "text/jscript": WI.Resource.Type.Script,
+    "text/livescript": WI.Resource.Type.Script,
+    "text/x-livescript": WI.Resource.Type.Script,
+    "text/typescript": WI.Resource.Type.Script,
+    "text/x-clojure": WI.Resource.Type.Script,
+    "text/x-coffeescript": WI.Resource.Type.Script
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js b/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js
index ec5ad7c..4c5b4ca 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js
@@ -24,11 +24,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceCollection = class ResourceCollection extends WebInspector.Collection
+WI.ResourceCollection = class ResourceCollection extends WI.Collection
 {
     constructor(resourceType)
     {
-        super(WebInspector.ResourceCollection.verifierForType(resourceType));
+        super(WI.ResourceCollection.verifierForType(resourceType));
 
         this._resourceType = resourceType || null;
         this._resourceURLMap = new Map;
@@ -39,26 +39,26 @@
 
     static verifierForType(type) {
         switch (type) {
-        case WebInspector.Resource.Type.Document:
-            return WebInspector.ResourceCollection.TypeVerifier.Document;
-        case WebInspector.Resource.Type.Stylesheet:
-            return WebInspector.ResourceCollection.TypeVerifier.Stylesheet;
-        case WebInspector.Resource.Type.Image:
-            return WebInspector.ResourceCollection.TypeVerifier.Image;
-        case WebInspector.Resource.Type.Font:
-            return WebInspector.ResourceCollection.TypeVerifier.Font;
-        case WebInspector.Resource.Type.Script:
-            return WebInspector.ResourceCollection.TypeVerifier.Script;
-        case WebInspector.Resource.Type.XHR:
-            return WebInspector.ResourceCollection.TypeVerifier.XHR;
-        case WebInspector.Resource.Type.Fetch:
-            return WebInspector.ResourceCollection.TypeVerifier.Fetch;
-        case WebInspector.Resource.Type.WebSocket:
-            return WebInspector.ResourceCollection.TypeVerifier.WebSocket;
-        case WebInspector.Resource.Type.Other:
-            return WebInspector.ResourceCollection.TypeVerifier.Other;
+        case WI.Resource.Type.Document:
+            return WI.ResourceCollection.TypeVerifier.Document;
+        case WI.Resource.Type.Stylesheet:
+            return WI.ResourceCollection.TypeVerifier.Stylesheet;
+        case WI.Resource.Type.Image:
+            return WI.ResourceCollection.TypeVerifier.Image;
+        case WI.Resource.Type.Font:
+            return WI.ResourceCollection.TypeVerifier.Font;
+        case WI.Resource.Type.Script:
+            return WI.ResourceCollection.TypeVerifier.Script;
+        case WI.Resource.Type.XHR:
+            return WI.ResourceCollection.TypeVerifier.XHR;
+        case WI.Resource.Type.Fetch:
+            return WI.ResourceCollection.TypeVerifier.Fetch;
+        case WI.Resource.Type.WebSocket:
+            return WI.ResourceCollection.TypeVerifier.WebSocket;
+        case WI.Resource.Type.Other:
+            return WI.ResourceCollection.TypeVerifier.Other;
         default:
-            return WebInspector.Collection.TypeVerifier.Resource;
+            return WI.Collection.TypeVerifier.Resource;
         }
     }
 
@@ -78,7 +78,7 @@
 
         let resourcesCollectionForType = this._resourcesTypeMap.get(type);
         if (!resourcesCollectionForType) {
-            resourcesCollectionForType = new WebInspector.ResourceCollection(type);
+            resourcesCollectionForType = new WI.ResourceCollection(type);
             this._resourcesTypeMap.set(type, resourcesCollectionForType);
         }
 
@@ -126,14 +126,14 @@
             resourcesCollectionForType.add(resource);
         }
 
-        resource.addEventListener(WebInspector.Resource.Event.URLDidChange, this._resourceURLDidChange, this);
-        resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
+        resource.addEventListener(WI.Resource.Event.URLDidChange, this._resourceURLDidChange, this);
+        resource.addEventListener(WI.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
     }
 
     _disassociateWithResource(resource, skipRemoval)
     {
-        resource.removeEventListener(WebInspector.Resource.Event.URLDidChange, this._resourceURLDidChange, this);
-        resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
+        resource.removeEventListener(WI.Resource.Event.URLDidChange, this._resourceURLDidChange, this);
+        resource.removeEventListener(WI.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
 
         if (skipRemoval)
             return;
@@ -149,8 +149,8 @@
     _resourceURLDidChange(event)
     {
         let resource = event.target;
-        console.assert(resource instanceof WebInspector.Resource);
-        if (!(resource instanceof WebInspector.Resource))
+        console.assert(resource instanceof WI.Resource);
+        if (!(resource instanceof WI.Resource))
             return;
 
         let oldURL = event.data.oldURL;
@@ -165,8 +165,8 @@
     _resourceTypeDidChange(event)
     {
         let resource = event.target;
-        console.assert(resource instanceof WebInspector.Resource);
-        if (!(resource instanceof WebInspector.Resource))
+        console.assert(resource instanceof WI.Resource);
+        if (!(resource instanceof WI.Resource))
             return;
 
         if (this._resourceType) {
@@ -186,18 +186,18 @@
     }
 };
 
-WebInspector.ResourceCollection.TypeVerifier = {
-    Document: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Document,
+WI.ResourceCollection.TypeVerifier = {
+    Document: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Document,
     Stylesheet: (object) => {
-        if (WebInspector.Collection.TypeVerifier.CSSStyleSheet(object))
+        if (WI.Collection.TypeVerifier.CSSStyleSheet(object))
             return true;
-        return WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Stylesheet
+        return WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Stylesheet
     },
-    Image: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Image,
-    Font: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Font,
-    Script: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Script,
-    XHR: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.XHR,
-    Fetch: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Fetch,
-    WebSocket: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.WebSocket,
-    Other: (object) => WebInspector.Collection.TypeVerifier.Resource(object) && object.type === WebInspector.Resource.Type.Other,
+    Image: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Image,
+    Font: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Font,
+    Script: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Script,
+    XHR: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.XHR,
+    Fetch: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Fetch,
+    WebSocket: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.WebSocket,
+    Other: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Other,
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/ResourceQueryMatch.js b/Source/WebInspectorUI/UserInterface/Models/ResourceQueryMatch.js
index 7eb9ec8..90c1df0 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ResourceQueryMatch.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ResourceQueryMatch.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceQueryMatch = class QueryMatch
+WI.ResourceQueryMatch = class QueryMatch
 {
     constructor(type, index, queryIndex)
     {
@@ -40,7 +40,7 @@
     get queryIndex() { return this._queryIndex; }
 };
 
-WebInspector.ResourceQueryMatch.Type = {
+WI.ResourceQueryMatch.Type = {
     Normal: Symbol("normal"),
     Special: Symbol("special")
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/ResourceQueryResult.js b/Source/WebInspectorUI/UserInterface/Models/ResourceQueryResult.js
index 301d1b2..0229b78 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ResourceQueryResult.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ResourceQueryResult.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceQueryResult = class ResourceQueryResult
+WI.ResourceQueryResult = class ResourceQueryResult
 {
     constructor(resource, matches, cookie)
     {
@@ -64,7 +64,7 @@
         const specialMultiplier = 5;
 
         function getMultiplier(match) {
-            if (match.type === WebInspector.ResourceQueryMatch.Type.Special)
+            if (match.type === WI.ResourceQueryMatch.Type.Special)
                 return specialMultiplier;
 
             return 1;
@@ -118,12 +118,12 @@
             }
 
             // Begin a new range when a gap between this match and the previous match is found.
-            ranges.push(new WebInspector.TextRange(0, startIndex, 0, endIndex + 1));
+            ranges.push(new WI.TextRange(0, startIndex, 0, endIndex + 1));
             startIndex = match.index;
             endIndex = startIndex;
         }
 
-        ranges.push(new WebInspector.TextRange(0, startIndex, 0, endIndex + 1));
+        ranges.push(new WI.TextRange(0, startIndex, 0, endIndex + 1));
         return ranges;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js
index 03a0909..1b54a70 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceTimelineRecord = class ResourceTimelineRecord extends WebInspector.TimelineRecord
+WI.ResourceTimelineRecord = class ResourceTimelineRecord extends WI.TimelineRecord
 {
     constructor(resource)
     {
-        super(WebInspector.TimelineRecord.Type.Network);
+        super(WI.TimelineRecord.Type.Network);
 
         this._resource = resource;
-        this._resource.addEventListener(WebInspector.Resource.Event.TimestampsDidChange, this._dispatchUpdatedEvent, this);
+        this._resource.addEventListener(WI.Resource.Event.TimestampsDidChange, this._dispatchUpdatedEvent, this);
     }
 
     // Public
@@ -69,6 +69,6 @@
 
     _dispatchUpdatedEvent()
     {
-        this.dispatchEventToListeners(WebInspector.TimelineRecord.Event.Updated);
+        this.dispatchEventToListeners(WI.TimelineRecord.Event.Updated);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js b/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js
index 22a27ac..ab1de27 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceTimingData = class ResourceTimingData
+WI.ResourceTimingData = class ResourceTimingData
 {
     constructor(resource, data)
     {
@@ -82,7 +82,7 @@
         if (isNaN(data.connectStart) && !isNaN(data.secureConnectionStart))
             data.connectStart = data.secureConnectionStart;
 
-        return new WebInspector.ResourceTimingData(resource, data);
+        return new WI.ResourceTimingData(resource, data);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/Revision.js b/Source/WebInspectorUI/UserInterface/Models/Revision.js
index 445804e..d514702 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Revision.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Revision.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Revision = class Revision
+WI.Revision = class Revision
 {
     // Public
 
diff --git a/Source/WebInspectorUI/UserInterface/Models/ScopeChainNode.js b/Source/WebInspectorUI/UserInterface/Models/ScopeChainNode.js
index b0cd9b9..7ca93c6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ScopeChainNode.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ScopeChainNode.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScopeChainNode = class ScopeChainNode
+WI.ScopeChainNode = class ScopeChainNode
 {
     constructor(type, objects, name, location, empty)
     {
         console.assert(typeof type === "string");
-        console.assert(objects.every((x) => x instanceof WebInspector.RemoteObject));
+        console.assert(objects.every((x) => x instanceof WI.RemoteObject));
 
-        if (type in WebInspector.ScopeChainNode.Type)
-            type = WebInspector.ScopeChainNode.Type[type];
+        if (type in WI.ScopeChainNode.Type)
+            type = WI.ScopeChainNode.Type[type];
 
         this._type = type || null;
         this._objects = objects || [];
@@ -61,11 +61,11 @@
 
     convertToLocalScope()
     {
-        this._type = WebInspector.ScopeChainNode.Type.Local;
+        this._type = WI.ScopeChainNode.Type.Local;
     }
 };
 
-WebInspector.ScopeChainNode.Type = {
+WI.ScopeChainNode.Type = {
     Local: "scope-chain-type-local",
     Global: "scope-chain-type-global",
     GlobalLexicalEnvironment: "scope-chain-type-global-lexical-environment",
diff --git a/Source/WebInspectorUI/UserInterface/Models/Script.js b/Source/WebInspectorUI/UserInterface/Models/Script.js
index 22626ce..b5dec4a 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Script.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Script.js
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Script = class Script extends WebInspector.SourceCode
+WI.Script = class Script extends WI.SourceCode
 {
     constructor(target, id, range, url, sourceType, injected, sourceURL, sourceMapURL)
     {
         super();
 
         console.assert(id);
-        console.assert(target instanceof WebInspector.Target);
-        console.assert(range instanceof WebInspector.TextRange);
+        console.assert(target instanceof WI.Target);
+        console.assert(range instanceof WI.TextRange);
 
         this._target = target;
         this._id = id || null;
         this._range = range || null;
         this._url = url || null;
-        this._sourceType = sourceType || WebInspector.Script.SourceType.Program;
+        this._sourceType = sourceType || WI.Script.SourceType.Program;
         this._sourceURL = sourceURL || null;
         this._sourceMappingURL = sourceMapURL || null;
         this._injected = injected || false;
@@ -49,7 +49,7 @@
         // If this Script was a dynamically added <script> to a Document,
         // do not associate with the Document resource, instead associate
         // with the frame as a dynamic script.
-        if (this._resource && this._resource.type === WebInspector.Resource.Type.Document && !this._range.startLine && !this._range.startColumn) {
+        if (this._resource && this._resource.type === WI.Resource.Type.Document && !this._range.startLine && !this._range.startColumn) {
             console.assert(this._resource.isMainResource());
             let documentResource = this._resource;
             this._resource = null;
@@ -65,15 +65,15 @@
         }
 
         if (this._sourceMappingURL)
-            WebInspector.sourceMapManager.downloadSourceMap(this._sourceMappingURL, this._url, this);
+            WI.sourceMapManager.downloadSourceMap(this._sourceMappingURL, this._url, this);
     }
 
     // Static
 
     static resetUniqueDisplayNameNumbers()
     {
-        WebInspector.Script._nextUniqueDisplayNameNumber = 1;
-        WebInspector.Script._nextUniqueConsoleDisplayNameNumber = 1;
+        WI.Script._nextUniqueDisplayNameNumber = 1;
+        WI.Script._nextUniqueConsoleDisplayNameNumber = 1;
     }
 
     // Public
@@ -124,27 +124,27 @@
     get displayName()
     {
         if (this._url && !this._dynamicallyAddedScriptElement)
-            return WebInspector.displayNameForURL(this._url, this.urlComponents);
+            return WI.displayNameForURL(this._url, this.urlComponents);
 
         if (isWebInspectorConsoleEvaluationScript(this._sourceURL)) {
             console.assert(this._uniqueDisplayNameNumber);
-            return WebInspector.UIString("Console Evaluation %d").format(this._uniqueDisplayNameNumber);
+            return WI.UIString("Console Evaluation %d").format(this._uniqueDisplayNameNumber);
         }
 
         if (this._sourceURL) {
             if (!this._sourceURLComponents)
                 this._sourceURLComponents = parseURL(this._sourceURL);
-            return WebInspector.displayNameForURL(this._sourceURL, this._sourceURLComponents);
+            return WI.displayNameForURL(this._sourceURL, this._sourceURLComponents);
         }
 
         if (this._dynamicallyAddedScriptElement)
-            return WebInspector.UIString("Script Element %d").format(this._dynamicallyAddedScriptElementNumber);
+            return WI.UIString("Script Element %d").format(this._dynamicallyAddedScriptElementNumber);
 
         // Assign a unique number to the script object so it will stay the same.
         if (!this._uniqueDisplayNameNumber)
             this._uniqueDisplayNameNumber = this.constructor._nextUniqueDisplayNameNumber++;
 
-        return WebInspector.UIString("Anonymous Script %d").format(this._uniqueDisplayNameNumber);
+        return WI.UIString("Anonymous Script %d").format(this._uniqueDisplayNameNumber);
     }
 
     get displayURL()
@@ -153,9 +153,9 @@
         const dataURIMaxSize = 64;
 
         if (this._url)
-            return WebInspector.truncateURL(this._url, isMultiLine, dataURIMaxSize);
+            return WI.truncateURL(this._url, isMultiLine, dataURIMaxSize);
         if (this._sourceURL)
-            return WebInspector.truncateURL(this._sourceURL, isMultiLine, dataURIMaxSize);
+            return WI.truncateURL(this._sourceURL, isMultiLine, dataURIMaxSize);
         return null;
     }
 
@@ -197,8 +197,8 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.Script.URLCookieKey] = this.url;
-        cookie[WebInspector.Script.DisplayNameCookieKey] = this.displayName;
+        cookie[WI.Script.URLCookieKey] = this.url;
+        cookie[WI.Script.DisplayNameCookieKey] = this.displayName;
     }
 
     requestScriptSyntaxTree(callback)
@@ -214,7 +214,7 @@
         };
 
         var content = this.content;
-        if (!content && this._resource && this._resource.type === WebInspector.Resource.Type.Script && this._resource.finished)
+        if (!content && this._resource && this._resource.type === WI.Resource.Type.Script && this._resource.finished)
             content = this._resource.content;
         if (content) {
             setTimeout(makeSyntaxTreeAndCallCallback, 0, content);
@@ -241,8 +241,8 @@
         if (!this._url)
             return null;
 
-        let resolver = WebInspector.frameResourceManager;
-        if (this._target !== WebInspector.mainTarget)
+        let resolver = WI.frameResourceManager;
+        if (this._target !== WI.mainTarget)
             resolver = this._target.resourceCollection;
 
         try {
@@ -286,18 +286,18 @@
         if (this._scriptSyntaxTree || !sourceText)
             return;
 
-        this._scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(sourceText, this);
+        this._scriptSyntaxTree = new WI.ScriptSyntaxTree(sourceText, this);
     }
 };
 
-WebInspector.Script.SourceType = {
+WI.Script.SourceType = {
     Program: "script-source-type-program",
     Module: "script-source-type-module",
 };
 
-WebInspector.Script.TypeIdentifier = "script";
-WebInspector.Script.URLCookieKey = "script-url";
-WebInspector.Script.DisplayNameCookieKey = "script-display-name";
+WI.Script.TypeIdentifier = "script";
+WI.Script.URLCookieKey = "script-url";
+WI.Script.DisplayNameCookieKey = "script-display-name";
 
-WebInspector.Script._nextUniqueDisplayNameNumber = 1;
-WebInspector.Script._nextUniqueConsoleDisplayNameNumber = 1;
+WI.Script._nextUniqueDisplayNameNumber = 1;
+WI.Script._nextUniqueConsoleDisplayNameNumber = 1;
diff --git a/Source/WebInspectorUI/UserInterface/Models/ScriptInstrument.js b/Source/WebInspectorUI/UserInterface/Models/ScriptInstrument.js
index cea34da..1a3c272 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ScriptInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ScriptInstrument.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptInstrument = class ScriptInstrument extends WebInspector.Instrument
+WI.ScriptInstrument = class ScriptInstrument extends WI.Instrument
 {
     // Protected
 
     get timelineRecordType()
     {
-        return WebInspector.TimelineRecord.Type.Script;
+        return WI.TimelineRecord.Type.Script;
     }
 
     startInstrumentation(initiatedByBackend)
diff --git a/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js b/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js
index a5fa5af..50e76b1 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptSyntaxTree = class ScriptSyntaxTree
+WI.ScriptSyntaxTree = class ScriptSyntaxTree
 {
     constructor(sourceText, script)
     {
-        console.assert(script && script instanceof WebInspector.Script, script);
+        console.assert(script && script instanceof WI.Script, script);
 
         this._script = script;
 
         try {
-            let sourceType = this._script.sourceType === WebInspector.Script.SourceType.Module ? "module" : "script";
+            let sourceType = this._script.sourceType === WI.Script.SourceType.Module ? "module" : "script";
             let esprimaSyntaxTree = esprima.parse(sourceText, {range: true, sourceType});
             this._syntaxTree = this._createInternalSyntaxTree(esprimaSyntaxTree);
             this._parsedSuccessfully = true;
@@ -148,14 +148,14 @@
 
         function removeFunctionsFilter(node)
         {
-            return node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression
-                && node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration
-                && node.type !== WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;
+            return node.type !== WI.ScriptSyntaxTree.NodeType.FunctionExpression
+                && node.type !== WI.ScriptSyntaxTree.NodeType.FunctionDeclaration
+                && node.type !== WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;
         }
 
         var nodes = this.filter(removeFunctionsFilter, startNode);
         var hasNonEmptyReturnStatement = false;
-        var returnStatementType = WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement;
+        var returnStatementType = WI.ScriptSyntaxTree.NodeType.ReturnStatement;
         for (var node of nodes) {
             if (node.type === returnStatementType && node.argument) {
                 hasNonEmptyReturnStatement = true;
@@ -170,7 +170,7 @@
 
     static functionReturnDivot(node)
     {
-        console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression || node.type === WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition || node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+        console.assert(node.type === WI.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WI.ScriptSyntaxTree.NodeType.FunctionExpression || node.type === WI.ScriptSyntaxTree.NodeType.MethodDefinition || node.type === WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
 
         // COMPATIBILITY (iOS 9): Legacy Backends view the return type as being the opening "{" of the function body.
         // After iOS 9, this is to move to the start of the function statement/expression. See below:
@@ -197,13 +197,13 @@
 
         for (var node of nodesToUpdate) {
             switch (node.type) {
-            case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:
-            case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:
-            case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:
+            case WI.ScriptSyntaxTree.NodeType.FunctionDeclaration:
+            case WI.ScriptSyntaxTree.NodeType.FunctionExpression:
+            case WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:
                 for (var param of node.params) {
                     for (var identifier of this._gatherIdentifiersInDeclaration(param)) {
                         allRequests.push({
-                            typeInformationDescriptor: WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,
+                            typeInformationDescriptor: WI.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,
                             sourceID,
                             divot: identifier.range[0]
                         });
@@ -212,16 +212,16 @@
                 }
 
                 allRequests.push({
-                    typeInformationDescriptor: WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn,
+                    typeInformationDescriptor: WI.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn,
                     sourceID,
-                    divot: WebInspector.ScriptSyntaxTree.functionReturnDivot(node)
+                    divot: WI.ScriptSyntaxTree.functionReturnDivot(node)
                 });
                 allRequestNodes.push(node);
                 break;
-            case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator:
+            case WI.ScriptSyntaxTree.NodeType.VariableDeclarator:
                 for (var identifier of this._gatherIdentifiersInDeclaration(node.id)) {
                     allRequests.push({
-                        typeInformationDescriptor: WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,
+                        typeInformationDescriptor: WI.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,
                         sourceID,
                         divot: identifier.range[0]
                     });
@@ -242,8 +242,8 @@
 
             for (var i = 0; i < typeInformationArray.length; i++) {
                 var node = allRequestNodes[i];
-                var typeInformation = WebInspector.TypeDescription.fromPayload(typeInformationArray[i]);
-                if (allRequests[i].typeInformationDescriptor === WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn)
+                var typeInformation = WI.TypeDescription.fromPayload(typeInformationArray[i]);
+                if (allRequests[i].typeInformationDescriptor === WI.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn)
                     node.attachments.returnTypes = typeInformation;
                 else
                     node.attachments.types = typeInformation;
@@ -262,28 +262,28 @@
         function gatherIdentifiers(node)
         {
             switch (node.type) {
-                case WebInspector.ScriptSyntaxTree.NodeType.Identifier:
+                case WI.ScriptSyntaxTree.NodeType.Identifier:
                     return [node];
-                case WebInspector.ScriptSyntaxTree.NodeType.Property:
+                case WI.ScriptSyntaxTree.NodeType.Property:
                     return gatherIdentifiers(node.value);
-                case WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern:
+                case WI.ScriptSyntaxTree.NodeType.ObjectPattern:
                     var identifiers = [];
                     for (var property of node.properties) {
                         for (var identifier of gatherIdentifiers(property))
                             identifiers.push(identifier);
                     }
                     return identifiers;
-                case WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern:
+                case WI.ScriptSyntaxTree.NodeType.ArrayPattern:
                     var identifiers = [];
                     for (var element of node.elements) {
                         for (var identifier of gatherIdentifiers(element))
                             identifiers.push(identifier);
                     }
                     return identifiers;
-                case WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern:
+                case WI.ScriptSyntaxTree.NodeType.AssignmentPattern:
                     return gatherIdentifiers(node.left);
-                case WebInspector.ScriptSyntaxTree.NodeType.RestElement:
-                case WebInspector.ScriptSyntaxTree.NodeType.RestProperty:
+                case WI.ScriptSyntaxTree.NodeType.RestElement:
+                case WI.ScriptSyntaxTree.NodeType.RestProperty:
                     return gatherIdentifiers(node.argument);
                 default:
                     console.assert(false, "Unexpected node type in variable declarator: " + node.type);
@@ -291,7 +291,7 @@
             }
         }
 
-        console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier || node.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern || node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern || node.type === WebInspector.ScriptSyntaxTree.NodeType.RestElement || node.type === WebInspector.ScriptSyntaxTree.NodeType.RestProperty);
+        console.assert(node.type === WI.ScriptSyntaxTree.NodeType.Identifier || node.type === WI.ScriptSyntaxTree.NodeType.ObjectPattern || node.type === WI.ScriptSyntaxTree.NodeType.ArrayPattern || node.type === WI.ScriptSyntaxTree.NodeType.RestElement || node.type === WI.ScriptSyntaxTree.NodeType.RestProperty);
 
         return gatherIdentifiers(node);
     }
@@ -315,227 +315,227 @@
         callback(node, state);
 
         switch (node.type) {
-        case WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression:
+        case WI.ScriptSyntaxTree.NodeType.AssignmentExpression:
             this._recurse(node.left, callback, state);
             this._recurse(node.right, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression:
-        case WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern:
+        case WI.ScriptSyntaxTree.NodeType.ArrayExpression:
+        case WI.ScriptSyntaxTree.NodeType.ArrayPattern:
             this._recurseArray(node.elements, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern:
+        case WI.ScriptSyntaxTree.NodeType.AssignmentPattern:
             this._recurse(node.left, callback, state);
             this._recurse(node.right, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.AwaitExpression:
+        case WI.ScriptSyntaxTree.NodeType.AwaitExpression:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.BlockStatement:
+        case WI.ScriptSyntaxTree.NodeType.BlockStatement:
             this._recurseArray(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression:
+        case WI.ScriptSyntaxTree.NodeType.BinaryExpression:
             this._recurse(node.left, callback, state);
             this._recurse(node.right, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.BreakStatement:
+        case WI.ScriptSyntaxTree.NodeType.BreakStatement:
             this._recurse(node.label, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.CatchClause:
+        case WI.ScriptSyntaxTree.NodeType.CatchClause:
             this._recurse(node.param, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.CallExpression:
+        case WI.ScriptSyntaxTree.NodeType.CallExpression:
             this._recurse(node.callee, callback, state);
             this._recurseArray(node.arguments, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ClassBody:
+        case WI.ScriptSyntaxTree.NodeType.ClassBody:
             this._recurseArray(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration:
-        case WebInspector.ScriptSyntaxTree.NodeType.ClassExpression:
+        case WI.ScriptSyntaxTree.NodeType.ClassDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.ClassExpression:
             this._recurse(node.id, callback, state);
             this._recurse(node.superClass, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement:
+        case WI.ScriptSyntaxTree.NodeType.ContinueStatement:
             this._recurse(node.label, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.DoWhileStatement:
+        case WI.ScriptSyntaxTree.NodeType.DoWhileStatement:
             this._recurse(node.body, callback, state);
             this._recurse(node.test, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement:
+        case WI.ScriptSyntaxTree.NodeType.ExpressionStatement:
             this._recurse(node.expression, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ForStatement:
+        case WI.ScriptSyntaxTree.NodeType.ForStatement:
             this._recurse(node.init, callback, state);
             this._recurse(node.test, callback, state);
             this._recurse(node.update, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ForInStatement:
-        case WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement:
+        case WI.ScriptSyntaxTree.NodeType.ForInStatement:
+        case WI.ScriptSyntaxTree.NodeType.ForOfStatement:
             this._recurse(node.left, callback, state);
             this._recurse(node.right, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:
-        case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:
-        case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:
+        case WI.ScriptSyntaxTree.NodeType.FunctionDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.FunctionExpression:
+        case WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:
             this._recurse(node.id, callback, state);
             this._recurseArray(node.params, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.IfStatement:
+        case WI.ScriptSyntaxTree.NodeType.IfStatement:
             this._recurse(node.test, callback, state);
             this._recurse(node.consequent, callback, state);
             this._recurse(node.alternate, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.LabeledStatement:
+        case WI.ScriptSyntaxTree.NodeType.LabeledStatement:
             this._recurse(node.label, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.LogicalExpression:
+        case WI.ScriptSyntaxTree.NodeType.LogicalExpression:
             this._recurse(node.left, callback, state);
             this._recurse(node.right, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.MemberExpression:
+        case WI.ScriptSyntaxTree.NodeType.MemberExpression:
             this._recurse(node.object, callback, state);
             this._recurse(node.property, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition:
+        case WI.ScriptSyntaxTree.NodeType.MethodDefinition:
             this._recurse(node.key, callback, state);
             this._recurse(node.value, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.NewExpression:
+        case WI.ScriptSyntaxTree.NodeType.NewExpression:
             this._recurse(node.callee, callback, state);
             this._recurseArray(node.arguments, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression:
-        case WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern:
+        case WI.ScriptSyntaxTree.NodeType.ObjectExpression:
+        case WI.ScriptSyntaxTree.NodeType.ObjectPattern:
             this._recurseArray(node.properties, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.Program:
+        case WI.ScriptSyntaxTree.NodeType.Program:
             this._recurseArray(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.Property:
+        case WI.ScriptSyntaxTree.NodeType.Property:
             this._recurse(node.key, callback, state);
             this._recurse(node.value, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.RestElement:
+        case WI.ScriptSyntaxTree.NodeType.RestElement:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.RestProperty:
+        case WI.ScriptSyntaxTree.NodeType.RestProperty:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement:
+        case WI.ScriptSyntaxTree.NodeType.ReturnStatement:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.SequenceExpression:
+        case WI.ScriptSyntaxTree.NodeType.SequenceExpression:
             this._recurseArray(node.expressions, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.SpreadElement:
+        case WI.ScriptSyntaxTree.NodeType.SpreadElement:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.SpreadProperty:
+        case WI.ScriptSyntaxTree.NodeType.SpreadProperty:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement:
+        case WI.ScriptSyntaxTree.NodeType.SwitchStatement:
             this._recurse(node.discriminant, callback, state);
             this._recurseArray(node.cases, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.SwitchCase:
+        case WI.ScriptSyntaxTree.NodeType.SwitchCase:
             this._recurse(node.test, callback, state);
             this._recurseArray(node.consequent, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression:
+        case WI.ScriptSyntaxTree.NodeType.ConditionalExpression:
             this._recurse(node.test, callback, state);
             this._recurse(node.consequent, callback, state);
             this._recurse(node.alternate, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.TaggedTemplateExpression:
+        case WI.ScriptSyntaxTree.NodeType.TaggedTemplateExpression:
             this._recurse(node.tag, callback, state);
             this._recurse(node.quasi, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.TemplateLiteral:
+        case WI.ScriptSyntaxTree.NodeType.TemplateLiteral:
             this._recurseArray(node.quasis, callback, state);
             this._recurseArray(node.expressions, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement:
+        case WI.ScriptSyntaxTree.NodeType.ThrowStatement:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.TryStatement:
+        case WI.ScriptSyntaxTree.NodeType.TryStatement:
             this._recurse(node.block, callback, state);
             this._recurse(node.handler, callback, state);
             this._recurse(node.finalizer, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.UnaryExpression:
+        case WI.ScriptSyntaxTree.NodeType.UnaryExpression:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression:
+        case WI.ScriptSyntaxTree.NodeType.UpdateExpression:
             this._recurse(node.argument, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.VariableDeclaration:
             this._recurseArray(node.declarations, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator:
+        case WI.ScriptSyntaxTree.NodeType.VariableDeclarator:
             this._recurse(node.id, callback, state);
             this._recurse(node.init, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.WhileStatement:
+        case WI.ScriptSyntaxTree.NodeType.WhileStatement:
             this._recurse(node.test, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.WithStatement:
+        case WI.ScriptSyntaxTree.NodeType.WithStatement:
             this._recurse(node.object, callback, state);
             this._recurse(node.body, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.YieldExpression:
+        case WI.ScriptSyntaxTree.NodeType.YieldExpression:
             this._recurse(node.argument, callback, state);
             break;
 
         // Modules.
 
-        case WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.ExportAllDeclaration:
             this._recurse(node.source, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.ExportNamedDeclaration:
             this._recurse(node.declaration, callback, state);
             this._recurseArray(node.specifiers, callback, state);
             this._recurse(node.source, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration:
             this._recurse(node.declaration, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier:
+        case WI.ScriptSyntaxTree.NodeType.ExportSpecifier:
             this._recurse(node.local, callback, state);
             this._recurse(node.exported, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration:
+        case WI.ScriptSyntaxTree.NodeType.ImportDeclaration:
             this._recurseArray(node.specifiers, callback, state);
             this._recurse(node.source, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier:
+        case WI.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier:
             this._recurse(node.local, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier:
+        case WI.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier:
             this._recurse(node.local, callback, state);
             break;
-        case WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier:
+        case WI.ScriptSyntaxTree.NodeType.ImportSpecifier:
             this._recurse(node.imported, callback, state);
             this._recurse(node.local, callback, state);
             break;
 
         // All the leaf nodes go here.
-        case WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement:
-        case WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement:
-        case WebInspector.ScriptSyntaxTree.NodeType.Identifier:
-        case WebInspector.ScriptSyntaxTree.NodeType.Import:
-        case WebInspector.ScriptSyntaxTree.NodeType.Literal:
-        case WebInspector.ScriptSyntaxTree.NodeType.MetaProperty:
-        case WebInspector.ScriptSyntaxTree.NodeType.Super:
-        case WebInspector.ScriptSyntaxTree.NodeType.ThisExpression:
-        case WebInspector.ScriptSyntaxTree.NodeType.TemplateElement:
+        case WI.ScriptSyntaxTree.NodeType.DebuggerStatement:
+        case WI.ScriptSyntaxTree.NodeType.EmptyStatement:
+        case WI.ScriptSyntaxTree.NodeType.Identifier:
+        case WI.ScriptSyntaxTree.NodeType.Import:
+        case WI.ScriptSyntaxTree.NodeType.Literal:
+        case WI.ScriptSyntaxTree.NodeType.MetaProperty:
+        case WI.ScriptSyntaxTree.NodeType.Super:
+        case WI.ScriptSyntaxTree.NodeType.ThisExpression:
+        case WI.ScriptSyntaxTree.NodeType.TemplateElement:
             break;
         }
 
@@ -561,19 +561,19 @@
         switch (node.type) {
         case "ArrayExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression,
+                type: WI.ScriptSyntaxTree.NodeType.ArrayExpression,
                 elements: node.elements.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "ArrayPattern":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern,
+                type: WI.ScriptSyntaxTree.NodeType.ArrayPattern,
                 elements: node.elements.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "ArrowFunctionExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression,
+                type: WI.ScriptSyntaxTree.NodeType.ArrowFunctionExpression,
                 id: this._createInternalSyntaxTree(node.id),
                 params: node.params.map(this._createInternalSyntaxTree, this),
                 body: this._createInternalSyntaxTree(node.body),
@@ -585,7 +585,7 @@
             break;
         case "AssignmentExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression,
+                type: WI.ScriptSyntaxTree.NodeType.AssignmentExpression,
                 operator: node.operator,
                 left: this._createInternalSyntaxTree(node.left),
                 right: this._createInternalSyntaxTree(node.right)
@@ -593,26 +593,26 @@
             break;
         case "AssignmentPattern":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern,
+                type: WI.ScriptSyntaxTree.NodeType.AssignmentPattern,
                 left: this._createInternalSyntaxTree(node.left),
                 right: this._createInternalSyntaxTree(node.right),
             };
             break;
         case "AwaitExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.AwaitExpression,
+                type: WI.ScriptSyntaxTree.NodeType.AwaitExpression,
                 argument: this._createInternalSyntaxTree(node.argument),
             };
             break;
         case "BlockStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.BlockStatement,
+                type: WI.ScriptSyntaxTree.NodeType.BlockStatement,
                 body: node.body.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "BinaryExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression,
+                type: WI.ScriptSyntaxTree.NodeType.BinaryExpression,
                 operator: node.operator,
                 left: this._createInternalSyntaxTree(node.left),
                 right: this._createInternalSyntaxTree(node.right)
@@ -620,33 +620,33 @@
             break;
         case "BreakStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.BreakStatement,
+                type: WI.ScriptSyntaxTree.NodeType.BreakStatement,
                 label: this._createInternalSyntaxTree(node.label)
             };
             break;
         case "CallExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.CallExpression,
+                type: WI.ScriptSyntaxTree.NodeType.CallExpression,
                 callee: this._createInternalSyntaxTree(node.callee),
                 arguments: node.arguments.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "CatchClause":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.CatchClause,
+                type: WI.ScriptSyntaxTree.NodeType.CatchClause,
                 param: this._createInternalSyntaxTree(node.param),
                 body: this._createInternalSyntaxTree(node.body)
             };
             break;
         case "ClassBody":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ClassBody,
+                type: WI.ScriptSyntaxTree.NodeType.ClassBody,
                 body: node.body.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "ClassDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.ClassDeclaration,
                 id: this._createInternalSyntaxTree(node.id),
                 superClass: this._createInternalSyntaxTree(node.superClass),
                 body: this._createInternalSyntaxTree(node.body),
@@ -654,7 +654,7 @@
             break;
         case "ClassExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ClassExpression,
+                type: WI.ScriptSyntaxTree.NodeType.ClassExpression,
                 id: this._createInternalSyntaxTree(node.id),
                 superClass: this._createInternalSyntaxTree(node.superClass),
                 body: this._createInternalSyntaxTree(node.body),
@@ -662,7 +662,7 @@
             break;
         case "ConditionalExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression,
+                type: WI.ScriptSyntaxTree.NodeType.ConditionalExpression,
                 test: this._createInternalSyntaxTree(node.test),
                 consequent: this._createInternalSyntaxTree(node.consequent),
                 alternate: this._createInternalSyntaxTree(node.alternate)
@@ -670,36 +670,36 @@
             break;
         case "ContinueStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ContinueStatement,
                 label: this._createInternalSyntaxTree(node.label)
             };
             break;
         case "DoWhileStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.DoWhileStatement,
+                type: WI.ScriptSyntaxTree.NodeType.DoWhileStatement,
                 body: this._createInternalSyntaxTree(node.body),
                 test: this._createInternalSyntaxTree(node.test)
             };
             break;
         case "DebuggerStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement
+                type: WI.ScriptSyntaxTree.NodeType.DebuggerStatement
             };
             break;
         case "EmptyStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement
+                type: WI.ScriptSyntaxTree.NodeType.EmptyStatement
             };
             break;
         case "ExpressionStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ExpressionStatement,
                 expression: this._createInternalSyntaxTree(node.expression)
             };
             break;
         case "ForStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ForStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ForStatement,
                 init: this._createInternalSyntaxTree(node.init),
                 test: this._createInternalSyntaxTree(node.test),
                 update: this._createInternalSyntaxTree(node.update),
@@ -708,7 +708,7 @@
             break;
         case "ForInStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ForInStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ForInStatement,
                 left: this._createInternalSyntaxTree(node.left),
                 right: this._createInternalSyntaxTree(node.right),
                 body: this._createInternalSyntaxTree(node.body)
@@ -716,7 +716,7 @@
             break;
         case "ForOfStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ForOfStatement,
                 left: this._createInternalSyntaxTree(node.left),
                 right: this._createInternalSyntaxTree(node.right),
                 body: this._createInternalSyntaxTree(node.body)
@@ -724,7 +724,7 @@
             break;
         case "FunctionDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.FunctionDeclaration,
                 id: this._createInternalSyntaxTree(node.id),
                 params: node.params.map(this._createInternalSyntaxTree, this),
                 body: this._createInternalSyntaxTree(node.body),
@@ -735,7 +735,7 @@
             break;
         case "FunctionExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression,
+                type: WI.ScriptSyntaxTree.NodeType.FunctionExpression,
                 id: this._createInternalSyntaxTree(node.id),
                 params: node.params.map(this._createInternalSyntaxTree, this),
                 body: this._createInternalSyntaxTree(node.body),
@@ -746,13 +746,13 @@
             break;
         case "Identifier":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.Identifier,
+                type: WI.ScriptSyntaxTree.NodeType.Identifier,
                 name: node.name
             };
             break;
         case "IfStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.IfStatement,
+                type: WI.ScriptSyntaxTree.NodeType.IfStatement,
                 test: this._createInternalSyntaxTree(node.test),
                 consequent: this._createInternalSyntaxTree(node.consequent),
                 alternate: this._createInternalSyntaxTree(node.alternate)
@@ -760,21 +760,21 @@
             break;
         case "Literal":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.Literal,
+                type: WI.ScriptSyntaxTree.NodeType.Literal,
                 value: node.value,
                 raw: node.raw
             };
             break;
         case "LabeledStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.LabeledStatement,
+                type: WI.ScriptSyntaxTree.NodeType.LabeledStatement,
                 label: this._createInternalSyntaxTree(node.label),
                 body: this._createInternalSyntaxTree(node.body)
             };
             break;
         case "LogicalExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.LogicalExpression,
+                type: WI.ScriptSyntaxTree.NodeType.LogicalExpression,
                 left: this._createInternalSyntaxTree(node.left),
                 right: this._createInternalSyntaxTree(node.right),
                 operator: node.operator
@@ -782,7 +782,7 @@
             break;
         case "MemberExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.MemberExpression,
+                type: WI.ScriptSyntaxTree.NodeType.MemberExpression,
                 object: this._createInternalSyntaxTree(node.object),
                 property: this._createInternalSyntaxTree(node.property),
                 computed: node.computed
@@ -791,14 +791,14 @@
         case "MetaProperty":
             // i.e: new.target produces {meta: "new", property: "target"}
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.MetaProperty,
+                type: WI.ScriptSyntaxTree.NodeType.MetaProperty,
                 meta: this._createInternalSyntaxTree(node.meta),
                 property: this._createInternalSyntaxTree(node.property),
             };
             break;
         case "MethodDefinition":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition,
+                type: WI.ScriptSyntaxTree.NodeType.MethodDefinition,
                 key: this._createInternalSyntaxTree(node.key),
                 value: this._createInternalSyntaxTree(node.value),
                 computed: node.computed,
@@ -809,33 +809,33 @@
             break;
         case "NewExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.NewExpression,
+                type: WI.ScriptSyntaxTree.NodeType.NewExpression,
                 callee: this._createInternalSyntaxTree(node.callee),
                 arguments: node.arguments.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "ObjectExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression,
+                type: WI.ScriptSyntaxTree.NodeType.ObjectExpression,
                 properties: node.properties.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "ObjectPattern":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern,
+                type: WI.ScriptSyntaxTree.NodeType.ObjectPattern,
                 properties: node.properties.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "Program":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.Program,
+                type: WI.ScriptSyntaxTree.NodeType.Program,
                 sourceType: node.sourceType,
                 body: node.body.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "Property":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.Property,
+                type: WI.ScriptSyntaxTree.NodeType.Property,
                 key: this._createInternalSyntaxTree(node.key),
                 value: this._createInternalSyntaxTree(node.value),
                 kind: node.kind,
@@ -847,94 +847,94 @@
             break;
         case "RestElement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.RestElement,
+                type: WI.ScriptSyntaxTree.NodeType.RestElement,
                 argument: this._createInternalSyntaxTree(node.argument)
             };
             break;
         case "RestProperty":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.RestProperty,
+                type: WI.ScriptSyntaxTree.NodeType.RestProperty,
                 argument: this._createInternalSyntaxTree(node.argument),
             };
             break;
         case "ReturnStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ReturnStatement,
                 argument: this._createInternalSyntaxTree(node.argument)
             };
             break;
         case "SequenceExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.SequenceExpression,
+                type: WI.ScriptSyntaxTree.NodeType.SequenceExpression,
                 expressions: node.expressions.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "SpreadElement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.SpreadElement,
+                type: WI.ScriptSyntaxTree.NodeType.SpreadElement,
                 argument: this._createInternalSyntaxTree(node.argument),
             };
             break;
         case "SpreadProperty":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.SpreadProperty,
+                type: WI.ScriptSyntaxTree.NodeType.SpreadProperty,
                 argument: this._createInternalSyntaxTree(node.argument),
             };
             break;
         case "Super":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.Super
+                type: WI.ScriptSyntaxTree.NodeType.Super
             };
             break;
         case "SwitchStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement,
+                type: WI.ScriptSyntaxTree.NodeType.SwitchStatement,
                 discriminant: this._createInternalSyntaxTree(node.discriminant),
                 cases: node.cases.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "SwitchCase":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.SwitchCase,
+                type: WI.ScriptSyntaxTree.NodeType.SwitchCase,
                 test: this._createInternalSyntaxTree(node.test),
                 consequent: node.consequent.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "TaggedTemplateExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.TaggedTemplateExpression,
+                type: WI.ScriptSyntaxTree.NodeType.TaggedTemplateExpression,
                 tag: this._createInternalSyntaxTree(node.tag),
                 quasi: this._createInternalSyntaxTree(node.quasi)
             };
             break;
         case "TemplateElement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.TemplateElement,
+                type: WI.ScriptSyntaxTree.NodeType.TemplateElement,
                 value: node.value,
                 tail: node.tail
             };
             break;
         case "TemplateLiteral":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.TemplateLiteral,
+                type: WI.ScriptSyntaxTree.NodeType.TemplateLiteral,
                 quasis: node.quasis.map(this._createInternalSyntaxTree, this),
                 expressions: node.expressions.map(this._createInternalSyntaxTree, this)
             };
             break;
         case "ThisExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ThisExpression
+                type: WI.ScriptSyntaxTree.NodeType.ThisExpression
             };
             break;
         case "ThrowStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement,
+                type: WI.ScriptSyntaxTree.NodeType.ThrowStatement,
                 argument: this._createInternalSyntaxTree(node.argument)
             };
             break;
         case "TryStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.TryStatement,
+                type: WI.ScriptSyntaxTree.NodeType.TryStatement,
                 block: this._createInternalSyntaxTree(node.block),
                 handler: this._createInternalSyntaxTree(node.handler),
                 finalizer: this._createInternalSyntaxTree(node.finalizer)
@@ -942,14 +942,14 @@
             break;
         case "UnaryExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.UnaryExpression,
+                type: WI.ScriptSyntaxTree.NodeType.UnaryExpression,
                 operator: node.operator,
                 argument: this._createInternalSyntaxTree(node.argument)
             };
             break;
         case "UpdateExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression,
+                type: WI.ScriptSyntaxTree.NodeType.UpdateExpression,
                 operator: node.operator,
                 prefix: node.prefix,
                 argument: this._createInternalSyntaxTree(node.argument)
@@ -957,35 +957,35 @@
             break;
         case "VariableDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.VariableDeclaration,
                 declarations: node.declarations.map(this._createInternalSyntaxTree, this),
                 kind: node.kind
             };
             break;
         case "VariableDeclarator":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator,
+                type: WI.ScriptSyntaxTree.NodeType.VariableDeclarator,
                 id: this._createInternalSyntaxTree(node.id),
                 init: this._createInternalSyntaxTree(node.init)
             };
             break;
         case "WhileStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.WhileStatement,
+                type: WI.ScriptSyntaxTree.NodeType.WhileStatement,
                 test: this._createInternalSyntaxTree(node.test),
                 body: this._createInternalSyntaxTree(node.body)
             };
             break;
         case "WithStatement":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.WithStatement,
+                type: WI.ScriptSyntaxTree.NodeType.WithStatement,
                 object: this._createInternalSyntaxTree(node.object),
                 body: this._createInternalSyntaxTree(node.body)
             };
             break;
         case "YieldExpression":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.YieldExpression,
+                type: WI.ScriptSyntaxTree.NodeType.YieldExpression,
                 argument: this._createInternalSyntaxTree(node.argument),
                 delegate: node.delegate
             };
@@ -995,13 +995,13 @@
 
         case "ExportAllDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.ExportAllDeclaration,
                 source: this._createInternalSyntaxTree(node.source),
             };
             break;
         case "ExportNamedDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.ExportNamedDeclaration,
                 declaration: this._createInternalSyntaxTree(node.declaration),
                 specifiers: node.specifiers.map(this._createInternalSyntaxTree, this),
                 source: this._createInternalSyntaxTree(node.source),
@@ -1009,44 +1009,44 @@
             break;
         case "ExportDefaultDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration,
                 declaration: this._createInternalSyntaxTree(node.declaration),
             };
             break;
         case "ExportSpecifier":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier,
+                type: WI.ScriptSyntaxTree.NodeType.ExportSpecifier,
                 local: this._createInternalSyntaxTree(node.local),
                 exported: this._createInternalSyntaxTree(node.exported),
             };
             break;
         case "Import":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.Import,
+                type: WI.ScriptSyntaxTree.NodeType.Import,
             };
             break;
         case "ImportDeclaration":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration,
+                type: WI.ScriptSyntaxTree.NodeType.ImportDeclaration,
                 specifiers: node.specifiers.map(this._createInternalSyntaxTree, this),
                 source: this._createInternalSyntaxTree(node.source),
             };
             break;
         case "ImportDefaultSpecifier":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier,
+                type: WI.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier,
                 local: this._createInternalSyntaxTree(node.local),
             };
             break;
         case "ImportNamespaceSpecifier":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier,
+                type: WI.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier,
                 local: this._createInternalSyntaxTree(node.local),
             };
             break;
         case "ImportSpecifier":
             result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier,
+                type: WI.ScriptSyntaxTree.NodeType.ImportSpecifier,
                 imported: this._createInternalSyntaxTree(node.imported),
                 local: this._createInternalSyntaxTree(node.local),
             };
@@ -1066,12 +1066,12 @@
 };
 
 // This should be kept in sync with an enum in JavaSciptCore/runtime/TypeProfiler.h
-WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor = {
+WI.ScriptSyntaxTree.TypeProfilerSearchDescriptor = {
     NormalExpression: 1,
     FunctionReturn: 2
 };
 
-WebInspector.ScriptSyntaxTree.NodeType = {
+WI.ScriptSyntaxTree.NodeType = {
     ArrayExpression: Symbol("array-expression"),
     ArrayPattern: Symbol("array-pattern"),
     ArrowFunctionExpression: Symbol("arrow-function-expression"),
diff --git a/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
index d6ef9b4..33c153b 100644
--- a/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptTimelineRecord = class ScriptTimelineRecord extends WebInspector.TimelineRecord
+WI.ScriptTimelineRecord = class ScriptTimelineRecord extends WI.TimelineRecord
 {
     constructor(eventType, startTime, endTime, callFrames, sourceCodeLocation, details, profilePayload)
     {
-        super(WebInspector.TimelineRecord.Type.Script, startTime, endTime, callFrames, sourceCodeLocation);
+        super(WI.TimelineRecord.Type.Script, startTime, endTime, callFrames, sourceCodeLocation);
 
         console.assert(eventType);
 
-        if (eventType in WebInspector.ScriptTimelineRecord.EventType)
-            eventType = WebInspector.ScriptTimelineRecord.EventType[eventType];
+        if (eventType in WI.ScriptTimelineRecord.EventType)
+            eventType = WI.ScriptTimelineRecord.EventType[eventType];
 
         this._eventType = eventType;
         this._details = details || "";
@@ -73,15 +73,15 @@
 
     isGarbageCollection()
     {
-        return this._eventType === WebInspector.ScriptTimelineRecord.EventType.GarbageCollected;
+        return this._eventType === WI.ScriptTimelineRecord.EventType.GarbageCollected;
     }
 
     saveIdentityToCookie(cookie)
     {
         super.saveIdentityToCookie(cookie);
 
-        cookie[WebInspector.ScriptTimelineRecord.EventTypeCookieKey] = this._eventType;
-        cookie[WebInspector.ScriptTimelineRecord.DetailsCookieKey] = this._details;
+        cookie[WI.ScriptTimelineRecord.EventTypeCookieKey] = this._eventType;
+        cookie[WI.ScriptTimelineRecord.DetailsCookieKey] = this._details;
     }
 
     get profilePayload()
@@ -111,9 +111,9 @@
             console.assert("id" in nodePayload);
 
             if (nodePayload.url) {
-                var sourceCode = WebInspector.frameResourceManager.resourceForURL(nodePayload.url);
+                var sourceCode = WI.frameResourceManager.resourceForURL(nodePayload.url);
                 if (!sourceCode)
-                    sourceCode = WebInspector.debuggerManager.scriptsForURL(nodePayload.url, WebInspector.assumingMainTarget())[0];
+                    sourceCode = WI.debuggerManager.scriptsForURL(nodePayload.url, WI.assumingMainTarget())[0];
 
                 // The lineNumber is 1-based, but we expect 0-based.
                 var lineNumber = nodePayload.lineNumber - 1;
@@ -124,7 +124,7 @@
             var isProgramCode = nodePayload.functionName === "(program)";
             var isAnonymousFunction = nodePayload.functionName === "(anonymous function)";
 
-            var type = isProgramCode ? WebInspector.ProfileNode.Type.Program : WebInspector.ProfileNode.Type.Function;
+            var type = isProgramCode ? WI.ProfileNode.Type.Program : WI.ProfileNode.Type.Function;
             var functionName = !isProgramCode && !isAnonymousFunction && nodePayload.functionName !== "(unknown)" ? nodePayload.functionName : null;
 
             // COMPATIBILITY (iOS 8): Timeline.CPUProfileNodes used to include an array of complete
@@ -135,7 +135,7 @@
                 calls = nodePayload.calls.map(profileNodeCallFromPayload);
             }
 
-            return new WebInspector.ProfileNode(nodePayload.id, type, functionName, sourceCodeLocation, nodePayload.callInfo, calls, nodePayload.children);
+            return new WI.ProfileNode(nodePayload.id, type, functionName, sourceCodeLocation, nodePayload.callInfo, calls, nodePayload.children);
         }
 
         function profileNodeCallFromPayload(nodeCallPayload)
@@ -143,9 +143,9 @@
             console.assert("startTime" in nodeCallPayload);
             console.assert("totalTime" in nodeCallPayload);
 
-            var startTime = WebInspector.timelineManager.computeElapsedTime(nodeCallPayload.startTime);
+            var startTime = WI.timelineManager.computeElapsedTime(nodeCallPayload.startTime);
 
-            return new WebInspector.ProfileNodeCall(startTime, nodeCallPayload.totalTime);
+            return new WI.ProfileNodeCall(startTime, nodeCallPayload.totalTime);
         }
 
         var rootNodes = payload.rootNodes;
@@ -178,11 +178,11 @@
                 this._callCountOrSamples += rootNodes[i].callInfo.callCount;
         }
 
-        this._profile = new WebInspector.Profile(rootNodes);
+        this._profile = new WI.Profile(rootNodes);
     }
 };
 
-WebInspector.ScriptTimelineRecord.EventType = {
+WI.ScriptTimelineRecord.EventType = {
     ScriptEvaluated: "script-timeline-record-script-evaluated",
     APIScriptEvaluated: "script-timeline-record-api-script-evaluated",
     MicrotaskDispatched: "script-timeline-record-microtask-dispatched",
@@ -198,9 +198,9 @@
     GarbageCollected: "script-timeline-record-garbage-collected",
 };
 
-WebInspector.ScriptTimelineRecord.EventType.displayName = function(eventType, details, includeDetailsInMainTitle)
+WI.ScriptTimelineRecord.EventType.displayName = function(eventType, details, includeDetailsInMainTitle)
 {
-    if (details && !WebInspector.ScriptTimelineRecord._eventDisplayNames) {
+    if (details && !WI.ScriptTimelineRecord._eventDisplayNames) {
         // These display names are not localized because they closely represent
         // the real API name, just with word spaces and Title Case.
 
@@ -354,65 +354,65 @@
         nameMap.set("writeend", "Write End");
         nameMap.set("writestart", "Write Start");
 
-        WebInspector.ScriptTimelineRecord._eventDisplayNames = nameMap;
+        WI.ScriptTimelineRecord._eventDisplayNames = nameMap;
     }
 
     switch (eventType) {
-    case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:
-    case WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated:
-        return WebInspector.UIString("Script Evaluated");
-    case WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched:
-        return WebInspector.UIString("Microtask Dispatched");
-    case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:
+    case WI.ScriptTimelineRecord.EventType.ScriptEvaluated:
+    case WI.ScriptTimelineRecord.EventType.APIScriptEvaluated:
+        return WI.UIString("Script Evaluated");
+    case WI.ScriptTimelineRecord.EventType.MicrotaskDispatched:
+        return WI.UIString("Microtask Dispatched");
+    case WI.ScriptTimelineRecord.EventType.EventDispatched:
         if (details && (details instanceof String || typeof details === "string")) {
-            var eventDisplayName = WebInspector.ScriptTimelineRecord._eventDisplayNames.get(details) || details.capitalize();
-            return WebInspector.UIString("%s Event Dispatched").format(eventDisplayName);
+            var eventDisplayName = WI.ScriptTimelineRecord._eventDisplayNames.get(details) || details.capitalize();
+            return WI.UIString("%s Event Dispatched").format(eventDisplayName);
         }
-        return WebInspector.UIString("Event Dispatched");
-    case WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded:
-        return WebInspector.UIString("Probe Sample Recorded");
-    case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:
+        return WI.UIString("Event Dispatched");
+    case WI.ScriptTimelineRecord.EventType.ProbeSampleRecorded:
+        return WI.UIString("Probe Sample Recorded");
+    case WI.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:
         if (details && (details instanceof String || typeof details === "string"))
-            return WebInspector.UIString("“%s” Profile Recorded").format(details);
-        return WebInspector.UIString("Console Profile Recorded");
-    case WebInspector.ScriptTimelineRecord.EventType.GarbageCollected:
+            return WI.UIString("“%s” Profile Recorded").format(details);
+        return WI.UIString("Console Profile Recorded");
+    case WI.ScriptTimelineRecord.EventType.GarbageCollected:
         console.assert(details);
-        if (details && (details instanceof WebInspector.GarbageCollection) && includeDetailsInMainTitle) {
+        if (details && (details instanceof WI.GarbageCollection) && includeDetailsInMainTitle) {
             switch (details.type) {
-            case WebInspector.GarbageCollection.Type.Partial:
-                return WebInspector.UIString("Partial Garbage Collection");
-            case WebInspector.GarbageCollection.Type.Full:
-                return WebInspector.UIString("Full Garbage Collection");
+            case WI.GarbageCollection.Type.Partial:
+                return WI.UIString("Partial Garbage Collection");
+            case WI.GarbageCollection.Type.Full:
+                return WI.UIString("Full Garbage Collection");
             }
         }
-        return WebInspector.UIString("Garbage Collection");
-    case WebInspector.ScriptTimelineRecord.EventType.TimerFired:
+        return WI.UIString("Garbage Collection");
+    case WI.ScriptTimelineRecord.EventType.TimerFired:
         if (details && includeDetailsInMainTitle)
-            return WebInspector.UIString("Timer %d Fired").format(details);
-        return WebInspector.UIString("Timer Fired");
-    case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:
+            return WI.UIString("Timer %d Fired").format(details);
+        return WI.UIString("Timer Fired");
+    case WI.ScriptTimelineRecord.EventType.TimerInstalled:
         if (details && includeDetailsInMainTitle)
-            return WebInspector.UIString("Timer %d Installed").format(details.timerId);
-        return WebInspector.UIString("Timer Installed");
-    case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:
+            return WI.UIString("Timer %d Installed").format(details.timerId);
+        return WI.UIString("Timer Installed");
+    case WI.ScriptTimelineRecord.EventType.TimerRemoved:
         if (details && includeDetailsInMainTitle)
-            return WebInspector.UIString("Timer %d Removed").format(details);
-        return WebInspector.UIString("Timer Removed");
-    case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:
+            return WI.UIString("Timer %d Removed").format(details);
+        return WI.UIString("Timer Removed");
+    case WI.ScriptTimelineRecord.EventType.AnimationFrameFired:
         if (details && includeDetailsInMainTitle)
-            return WebInspector.UIString("Animation Frame %d Fired").format(details);
-        return WebInspector.UIString("Animation Frame Fired");
-    case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:
+            return WI.UIString("Animation Frame %d Fired").format(details);
+        return WI.UIString("Animation Frame Fired");
+    case WI.ScriptTimelineRecord.EventType.AnimationFrameRequested:
         if (details && includeDetailsInMainTitle)
-            return WebInspector.UIString("Animation Frame %d Requested").format(details);
-        return WebInspector.UIString("Animation Frame Requested");
-    case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
+            return WI.UIString("Animation Frame %d Requested").format(details);
+        return WI.UIString("Animation Frame Requested");
+    case WI.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
         if (details && includeDetailsInMainTitle)
-            return WebInspector.UIString("Animation Frame %d Canceled").format(details);
-        return WebInspector.UIString("Animation Frame Canceled");
+            return WI.UIString("Animation Frame %d Canceled").format(details);
+        return WI.UIString("Animation Frame Canceled");
     }
 };
 
-WebInspector.ScriptTimelineRecord.TypeIdentifier = "script-timeline-record";
-WebInspector.ScriptTimelineRecord.EventTypeCookieKey = "script-timeline-record-event-type";
-WebInspector.ScriptTimelineRecord.DetailsCookieKey = "script-timeline-record-details";
+WI.ScriptTimelineRecord.TypeIdentifier = "script-timeline-record";
+WI.ScriptTimelineRecord.EventTypeCookieKey = "script-timeline-record-event-type";
+WI.ScriptTimelineRecord.DetailsCookieKey = "script-timeline-record-details";
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCode.js b/Source/WebInspectorUI/UserInterface/Models/SourceCode.js
index 29e8f32..0b1d1d7 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCode.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCode.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCode = class SourceCode extends WebInspector.Object
+WI.SourceCode = class SourceCode extends WI.Object
 {
     constructor()
     {
         super();
 
-        this._originalRevision = new WebInspector.SourceCodeRevision(this, null, false);
+        this._originalRevision = new WI.SourceCodeRevision(this, null, false);
         this._currentRevision = this._originalRevision;
 
         this._sourceMaps = null;
@@ -58,8 +58,8 @@
 
     set currentRevision(revision)
     {
-        console.assert(revision instanceof WebInspector.SourceCodeRevision);
-        if (!(revision instanceof WebInspector.SourceCodeRevision))
+        console.assert(revision instanceof WI.SourceCodeRevision);
+        if (!(revision instanceof WI.SourceCodeRevision))
             return;
 
         console.assert(revision.sourceCode === this);
@@ -68,7 +68,7 @@
 
         this._currentRevision = revision;
 
-        this.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);
+        this.dispatchEventToListeners(WI.SourceCode.Event.ContentDidChange);
     }
 
     get content()
@@ -97,14 +97,14 @@
 
     addSourceMap(sourceMap)
     {
-        console.assert(sourceMap instanceof WebInspector.SourceMap);
+        console.assert(sourceMap instanceof WI.SourceMap);
 
         if (!this._sourceMaps)
             this._sourceMaps = [];
 
         this._sourceMaps.push(sourceMap);
 
-        this.dispatchEventToListeners(WebInspector.SourceCode.Event.SourceMapAdded);
+        this.dispatchEventToListeners(WI.SourceCode.Event.SourceMapAdded);
     }
 
     get formatterSourceMap()
@@ -115,11 +115,11 @@
     set formatterSourceMap(formatterSourceMap)
     {
         console.assert(this._formatterSourceMap === null || formatterSourceMap === null);
-        console.assert(formatterSourceMap === null || formatterSourceMap instanceof WebInspector.FormatterSourceMap);
+        console.assert(formatterSourceMap === null || formatterSourceMap instanceof WI.FormatterSourceMap);
 
         this._formatterSourceMap = formatterSourceMap;
 
-        this.dispatchEventToListeners(WebInspector.SourceCode.Event.FormatterDidChange);
+        this.dispatchEventToListeners(WI.SourceCode.Event.FormatterDidChange);
     }
 
     requestContent()
@@ -131,17 +131,17 @@
 
     createSourceCodeLocation(lineNumber, columnNumber)
     {
-        return new WebInspector.SourceCodeLocation(this, lineNumber, columnNumber);
+        return new WI.SourceCodeLocation(this, lineNumber, columnNumber);
     }
 
     createLazySourceCodeLocation(lineNumber, columnNumber)
     {
-        return new WebInspector.LazySourceCodeLocation(this, lineNumber, columnNumber);
+        return new WI.LazySourceCodeLocation(this, lineNumber, columnNumber);
     }
 
     createSourceCodeTextRange(textRange)
     {
-        return new WebInspector.SourceCodeTextRange(this, textRange);
+        return new WI.SourceCodeTextRange(this, textRange);
     }
 
     // Protected
@@ -156,7 +156,7 @@
 
         this.handleCurrentRevisionContentChange();
 
-        this.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);
+        this.dispatchEventToListeners(WI.SourceCode.Event.ContentDidChange);
     }
 
     handleCurrentRevisionContentChange()
@@ -217,7 +217,7 @@
     }
 };
 
-WebInspector.SourceCode.Event = {
+WI.SourceCode.Event = {
     ContentDidChange: "source-code-content-did-change",
     SourceMapAdded: "source-code-source-map-added",
     FormatterDidChange: "source-code-formatter-did-change",
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js b/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js
index 7969170..298cf3b 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeLocation = class SourceCodeLocation extends WebInspector.Object
+WI.SourceCodeLocation = class SourceCodeLocation extends WI.Object
 {
     constructor(sourceCode, lineNumber, columnNumber)
     {
         super();
 
-        console.assert(sourceCode === null || sourceCode instanceof WebInspector.SourceCode);
-        console.assert(!(sourceCode instanceof WebInspector.SourceMapResource));
+        console.assert(sourceCode === null || sourceCode instanceof WI.SourceCode);
+        console.assert(!(sourceCode instanceof WI.SourceMapResource));
         console.assert(typeof lineNumber === "number" && !isNaN(lineNumber) && lineNumber >= 0);
         console.assert(typeof columnNumber === "number" && !isNaN(columnNumber) && columnNumber >= 0);
 
@@ -40,8 +40,8 @@
         this._resolveFormattedLocation();
 
         if (this._sourceCode) {
-            this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
-            this._sourceCode.addEventListener(WebInspector.SourceCode.Event.FormatterDidChange, this._sourceCodeFormatterDidChange, this);
+            this._sourceCode.addEventListener(WI.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+            this._sourceCode.addEventListener(WI.SourceCode.Event.FormatterDidChange, this._sourceCodeFormatterDidChange, this);
         }
 
         this._resetMappedLocation();
@@ -80,7 +80,7 @@
 
     position()
     {
-        return new WebInspector.SourceCodePosition(this.lineNumber, this.columnNumber);
+        return new WI.SourceCodePosition(this.lineNumber, this.columnNumber);
     }
 
     // Formatted line and column if the original source code is pretty printed.
@@ -98,7 +98,7 @@
 
     formattedPosition()
     {
-        return new WebInspector.SourceCodePosition(this.formattedLineNumber, this.formattedColumnNumber);
+        return new WI.SourceCodePosition(this.formattedLineNumber, this.formattedColumnNumber);
     }
 
     // Display line and column:
@@ -125,7 +125,7 @@
 
     displayPosition()
     {
-        return new WebInspector.SourceCodePosition(this.displayLineNumber, this.displayColumnNumber);
+        return new WI.SourceCodePosition(this.displayLineNumber, this.displayColumnNumber);
     }
 
     // User presentable location strings: "file:lineNumber:columnNumber".
@@ -148,10 +148,10 @@
     tooltipString()
     {
         if (!this.hasDifferentDisplayLocation())
-            return this.originalLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown, WebInspector.SourceCodeLocation.NameStyle.Full);
+            return this.originalLocationString(WI.SourceCodeLocation.ColumnStyle.Shown, WI.SourceCodeLocation.NameStyle.Full);
 
-        var tooltip = WebInspector.UIString("Located at %s").format(this.displayLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown, WebInspector.SourceCodeLocation.NameStyle.Full));
-        tooltip += "\n" + WebInspector.UIString("Originally %s").format(this.originalLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown, WebInspector.SourceCodeLocation.NameStyle.Full));
+        var tooltip = WI.UIString("Located at %s").format(this.displayLocationString(WI.SourceCodeLocation.ColumnStyle.Shown, WI.SourceCodeLocation.NameStyle.Full));
+        tooltip += "\n" + WI.UIString("Originally %s").format(this.originalLocationString(WI.SourceCodeLocation.ColumnStyle.Shown, WI.SourceCodeLocation.NameStyle.Full));
         return tooltip;
     }
 
@@ -203,7 +203,7 @@
 
         element.title = prefix + this.tooltipString();
 
-        this.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, function(event) {
+        this.addEventListener(WI.SourceCodeLocation.Event.DisplayLocationChanged, function(event) {
             if (this.sourceCode)
                 element.title = prefix + this.tooltipString();
         }, this);
@@ -222,10 +222,10 @@
 
             if (!showAlternativeLocation) {
                 element[propertyName] = this.displayLocationString(columnStyle, nameStyle, prefix);
-                element.classList.toggle(WebInspector.SourceCodeLocation.DisplayLocationClassName, this.hasDifferentDisplayLocation());
+                element.classList.toggle(WI.SourceCodeLocation.DisplayLocationClassName, this.hasDifferentDisplayLocation());
             } else if (this.hasDifferentDisplayLocation()) {
                 element[propertyName] = this.originalLocationString(columnStyle, nameStyle, prefix);
-                element.classList.remove(WebInspector.SourceCodeLocation.DisplayLocationClassName);
+                element.classList.remove(WI.SourceCodeLocation.DisplayLocationClassName);
             }
         }
 
@@ -236,7 +236,7 @@
 
         updateDisplayString.call(this, false);
 
-        this.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, function(event) {
+        this.addEventListener(WI.SourceCodeLocation.Event.DisplayLocationChanged, function(event) {
             if (this.sourceCode)
                 updateDisplayString.call(this, currentDisplay, true);
         }, this);
@@ -251,22 +251,22 @@
 
     setSourceCode(sourceCode)
     {
-        console.assert((this._sourceCode === null && sourceCode instanceof WebInspector.SourceCode) || (this._sourceCode instanceof WebInspector.SourceCode && sourceCode === null));
+        console.assert((this._sourceCode === null && sourceCode instanceof WI.SourceCode) || (this._sourceCode instanceof WI.SourceCode && sourceCode === null));
 
         if (sourceCode === this._sourceCode)
             return;
 
         this._makeChangeAndDispatchChangeEventIfNeeded(function() {
             if (this._sourceCode) {
-                this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
-                this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.FormatterDidChange, this._sourceCodeFormatterDidChange, this);
+                this._sourceCode.removeEventListener(WI.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+                this._sourceCode.removeEventListener(WI.SourceCode.Event.FormatterDidChange, this._sourceCodeFormatterDidChange, this);
             }
 
             this._sourceCode = sourceCode;
 
             if (this._sourceCode) {
-                this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
-                this._sourceCode.addEventListener(WebInspector.SourceCode.Event.FormatterDidChange, this._sourceCodeFormatterDidChange, this);
+                this._sourceCode.addEventListener(WI.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+                this._sourceCode.addEventListener(WI.SourceCode.Event.FormatterDidChange, this._sourceCodeFormatterDidChange, this);
             }
         });
     }
@@ -314,29 +314,29 @@
         if (!sourceCode)
             return "";
 
-        columnStyle = columnStyle || WebInspector.SourceCodeLocation.ColumnStyle.OnlyIfLarge;
-        nameStyle = nameStyle || WebInspector.SourceCodeLocation.NameStyle.Short;
+        columnStyle = columnStyle || WI.SourceCodeLocation.ColumnStyle.OnlyIfLarge;
+        nameStyle = nameStyle || WI.SourceCodeLocation.NameStyle.Short;
         prefix = prefix || "";
 
         let lineString = lineNumber + 1; // The user visible line number is 1-based.
-        if (columnStyle === WebInspector.SourceCodeLocation.ColumnStyle.Shown && columnNumber > 0)
+        if (columnStyle === WI.SourceCodeLocation.ColumnStyle.Shown && columnNumber > 0)
             lineString += ":" + (columnNumber + 1); // The user visible column number is 1-based.
-        else if (columnStyle === WebInspector.SourceCodeLocation.ColumnStyle.OnlyIfLarge && columnNumber > WebInspector.SourceCodeLocation.LargeColumnNumber)
+        else if (columnStyle === WI.SourceCodeLocation.ColumnStyle.OnlyIfLarge && columnNumber > WI.SourceCodeLocation.LargeColumnNumber)
             lineString += ":" + (columnNumber + 1); // The user visible column number is 1-based.
-        else if (columnStyle === WebInspector.SourceCodeLocation.ColumnStyle.Hidden)
+        else if (columnStyle === WI.SourceCodeLocation.ColumnStyle.Hidden)
             lineString = "";
 
         switch (nameStyle) {
-        case WebInspector.SourceCodeLocation.NameStyle.None:
+        case WI.SourceCodeLocation.NameStyle.None:
             return prefix + lineString;
 
-        case WebInspector.SourceCodeLocation.NameStyle.Short:
-        case WebInspector.SourceCodeLocation.NameStyle.Full:
+        case WI.SourceCodeLocation.NameStyle.Short:
+        case WI.SourceCodeLocation.NameStyle.Full:
             var displayURL = sourceCode.displayURL;
-            var name = nameStyle === WebInspector.SourceCodeLocation.NameStyle.Full && displayURL ? displayURL : sourceCode.displayName;
-            if (columnStyle === WebInspector.SourceCodeLocation.ColumnStyle.Hidden)
+            var name = nameStyle === WI.SourceCodeLocation.NameStyle.Full && displayURL ? displayURL : sourceCode.displayName;
+            if (columnStyle === WI.SourceCodeLocation.ColumnStyle.Hidden)
                 return prefix + name;
-            var lineSuffix = displayURL ? ":" + lineString : WebInspector.UIString(" (line %s)").format(lineString);
+            var lineSuffix = displayURL ? ":" + lineString : WI.UIString(" (line %s)").format(lineString);
             return prefix + name + lineSuffix;
 
         default:
@@ -425,9 +425,9 @@
                 oldDisplayColumnNumber
             };
             if (displayLocationChanged)
-                this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, oldData);
+                this.dispatchEventToListeners(WI.SourceCodeLocation.Event.DisplayLocationChanged, oldData);
             if (anyLocationChanged)
-                this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.LocationChanged, oldData);
+                this.dispatchEventToListeners(WI.SourceCodeLocation.Event.LocationChanged, oldData);
         }
     }
 
@@ -442,23 +442,23 @@
     }
 };
 
-WebInspector.SourceCodeLocation.DisplayLocationClassName = "display-location";
+WI.SourceCodeLocation.DisplayLocationClassName = "display-location";
 
-WebInspector.SourceCodeLocation.LargeColumnNumber = 80;
+WI.SourceCodeLocation.LargeColumnNumber = 80;
 
-WebInspector.SourceCodeLocation.NameStyle = {
+WI.SourceCodeLocation.NameStyle = {
     None: "none", // File name not included.
     Short: "short", // Only the file name.
     Full: "full" // Full URL is used.
 };
 
-WebInspector.SourceCodeLocation.ColumnStyle = {
+WI.SourceCodeLocation.ColumnStyle = {
     Hidden: "hidden",             // line and column numbers are not included.
     OnlyIfLarge: "only-if-large", // column numbers greater than 80 are shown.
     Shown: "shown"                // non-zero column numbers are shown.
 };
 
-WebInspector.SourceCodeLocation.Event = {
+WI.SourceCodeLocation.Event = {
     LocationChanged: "source-code-location-location-changed",
     DisplayLocationChanged: "source-code-location-display-location-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCodePosition.js b/Source/WebInspectorUI/UserInterface/Models/SourceCodePosition.js
index 40d98d3..628fd11 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCodePosition.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCodePosition.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodePosition = class SourceCodePosition
+WI.SourceCodePosition = class SourceCodePosition
 {
     constructor(lineNumber, columNumber)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js b/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js
index b955493..bda3e0f 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeRevision = class SourceCodeRevision extends WebInspector.Revision
+WI.SourceCodeRevision = class SourceCodeRevision extends WI.Revision
 {
     constructor(sourceCode, content)
     {
         super();
 
-        console.assert(sourceCode instanceof WebInspector.SourceCode);
+        console.assert(sourceCode instanceof WI.SourceCode);
 
         this._sourceCode = sourceCode;
         this._content = content || "";
@@ -71,6 +71,6 @@
 
     copy()
     {
-        return new WebInspector.SourceCodeRevision(this._sourceCode, this._content);
+        return new WI.SourceCodeRevision(this._sourceCode, this._content);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js b/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js
index 239f326..29de1fe 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeSearchMatchObject = class SourceCodeSearchMatchObject
+WI.SourceCodeSearchMatchObject = class SourceCodeSearchMatchObject
 {
     constructor(sourceCode, lineText, searchTerm, textRange)
     {
-        console.assert(sourceCode instanceof WebInspector.SourceCode);
+        console.assert(sourceCode instanceof WI.SourceCode);
 
         this._sourceCode = sourceCode;
         this._lineText = lineText;
@@ -50,13 +50,13 @@
     saveIdentityToCookie(cookie)
     {
         if (this._sourceCode.url)
-            cookie[WebInspector.SourceCodeSearchMatchObject.URLCookieKey] = this._sourceCode.url.hash;
+            cookie[WI.SourceCodeSearchMatchObject.URLCookieKey] = this._sourceCode.url.hash;
 
         var textRange = this._sourceCodeTextRange.textRange;
-        cookie[WebInspector.SourceCodeSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
+        cookie[WI.SourceCodeSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
     }
 };
 
-WebInspector.SourceCodeSearchMatchObject.TypeIdentifier = "source-code-search-match-object";
-WebInspector.SourceCodeSearchMatchObject.URLCookieKey = "source-code-url";
-WebInspector.SourceCodeSearchMatchObject.TextRangeKey = "text-range";
+WI.SourceCodeSearchMatchObject.TypeIdentifier = "source-code-search-match-object";
+WI.SourceCodeSearchMatchObject.URLCookieKey = "source-code-url";
+WI.SourceCodeSearchMatchObject.TextRangeKey = "text-range";
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js b/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js
index 08143c9..247a52e 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js
@@ -23,31 +23,31 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTextRange = class SourceCodeTextRange extends WebInspector.Object
+WI.SourceCodeTextRange = class SourceCodeTextRange extends WI.Object
 {
     constructor(sourceCode) /* textRange || startLocation, endLocation */
     {
         super();
 
-        console.assert(sourceCode instanceof WebInspector.SourceCode);
+        console.assert(sourceCode instanceof WI.SourceCode);
         console.assert(arguments.length === 2 || arguments.length === 3);
 
         this._sourceCode = sourceCode;
 
         if (arguments.length === 2) {
             var textRange = arguments[1];
-            console.assert(textRange instanceof WebInspector.TextRange);
+            console.assert(textRange instanceof WI.TextRange);
             this._startLocation = sourceCode.createSourceCodeLocation(textRange.startLine, textRange.startColumn);
             this._endLocation = sourceCode.createSourceCodeLocation(textRange.endLine, textRange.endColumn);
         } else {
-            console.assert(arguments[1] instanceof WebInspector.SourceCodeLocation);
-            console.assert(arguments[2] instanceof WebInspector.SourceCodeLocation);
+            console.assert(arguments[1] instanceof WI.SourceCodeLocation);
+            console.assert(arguments[2] instanceof WI.SourceCodeLocation);
             this._startLocation = arguments[1];
             this._endLocation = arguments[2];
         }
 
-        this._startLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationChanged, this);
-        this._endLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationChanged, this);
+        this._startLocation.addEventListener(WI.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationChanged, this);
+        this._endLocation.addEventListener(WI.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationChanged, this);
     }
 
     // Public
@@ -65,7 +65,7 @@
         var startColumn = this._startLocation.columnNumber;
         var endLine = this._endLocation.lineNumber;
         var endColumn = this._endLocation.columnNumber;
-        return new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
+        return new WI.TextRange(startLine, startColumn, endLine, endColumn);
     }
 
     // Formatted text range in the original source code if it is pretty printed.
@@ -77,7 +77,7 @@
         var startColumn = this._startLocation.formattedColumnNumber;
         var endLine = this._endLocation.formattedLineNumber;
         var endColumn = this._endLocation.formattedColumnNumber;
-        return new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
+        return new WI.TextRange(startLine, startColumn, endLine, endColumn);
     }
 
     // Display values:
@@ -102,7 +102,7 @@
         var startColumn = this._startLocation.displayColumnNumber;
         var endLine = this._endLocation.displayLineNumber;
         var endColumn = this._endLocation.displayColumnNumber;
-        return new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
+        return new WI.TextRange(startLine, startColumn, endLine, endColumn);
     }
 
     get synthesizedTextValue()
@@ -120,10 +120,10 @@
 
     _sourceCodeLocationChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.RangeChanged);
+        this.dispatchEventToListeners(WI.SourceCodeLocation.Event.RangeChanged);
     }
 };
 
-WebInspector.SourceCodeTextRange.Event = {
+WI.SourceCodeTextRange.Event = {
     RangeChanged: "source-code-text-range-range-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceCodeTimeline.js b/Source/WebInspectorUI/UserInterface/Models/SourceCodeTimeline.js
index f1699c4..a90df0e 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceCodeTimeline.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceCodeTimeline.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTimeline = class SourceCodeTimeline extends WebInspector.Timeline
+WI.SourceCodeTimeline = class SourceCodeTimeline extends WI.Timeline
 {
     constructor(sourceCode, sourceCodeLocation, recordType, recordEventType)
     {
@@ -48,18 +48,18 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.SourceCodeTimeline.SourceCodeURLCookieKey] = this._sourceCode.url ? this._sourceCode.url.hash : null;
-        cookie[WebInspector.SourceCodeTimeline.SourceCodeLocationLineCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : null;
-        cookie[WebInspector.SourceCodeTimeline.SourceCodeLocationColumnCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : null;
-        cookie[WebInspector.SourceCodeTimeline.RecordTypeCookieKey] = this._recordType || null;
-        cookie[WebInspector.SourceCodeTimeline.RecordEventTypeCookieKey] = this._recordEventType || null;
+        cookie[WI.SourceCodeTimeline.SourceCodeURLCookieKey] = this._sourceCode.url ? this._sourceCode.url.hash : null;
+        cookie[WI.SourceCodeTimeline.SourceCodeLocationLineCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : null;
+        cookie[WI.SourceCodeTimeline.SourceCodeLocationColumnCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : null;
+        cookie[WI.SourceCodeTimeline.RecordTypeCookieKey] = this._recordType || null;
+        cookie[WI.SourceCodeTimeline.RecordEventTypeCookieKey] = this._recordEventType || null;
     }
 };
 
-WebInspector.SourceCodeTimeline.TypeIdentifier = "source-code-timeline";
-WebInspector.SourceCodeTimeline.SourceCodeURLCookieKey = "source-code-timeline-source-code-url";
-WebInspector.SourceCodeTimeline.SourceCodeLocationLineCookieKey = "source-code-timeline-source-code-location-line";
-WebInspector.SourceCodeTimeline.SourceCodeLocationColumnCookieKey = "source-code-timeline-source-code-location-column";
-WebInspector.SourceCodeTimeline.SourceCodeURLCookieKey = "source-code-timeline-source-code-url";
-WebInspector.SourceCodeTimeline.RecordTypeCookieKey = "source-code-timeline-record-type";
-WebInspector.SourceCodeTimeline.RecordEventTypeCookieKey = "source-code-timeline-record-event-type";
+WI.SourceCodeTimeline.TypeIdentifier = "source-code-timeline";
+WI.SourceCodeTimeline.SourceCodeURLCookieKey = "source-code-timeline-source-code-url";
+WI.SourceCodeTimeline.SourceCodeLocationLineCookieKey = "source-code-timeline-source-code-location-line";
+WI.SourceCodeTimeline.SourceCodeLocationColumnCookieKey = "source-code-timeline-source-code-location-column";
+WI.SourceCodeTimeline.SourceCodeURLCookieKey = "source-code-timeline-source-code-url";
+WI.SourceCodeTimeline.RecordTypeCookieKey = "source-code-timeline-record-type";
+WI.SourceCodeTimeline.RecordEventTypeCookieKey = "source-code-timeline-record-event-type";
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceMap.js b/Source/WebInspectorUI/UserInterface/Models/SourceMap.js
index e39472b..63aa239 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceMap.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceMap.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceMap = class SourceMap
+WI.SourceMap = class SourceMap
 {
     constructor(sourceMappingURL, payload, originalSourceCode)
     {
-        if (!WebInspector.SourceMap._base64Map) {
+        if (!WI.SourceMap._base64Map) {
             var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-            WebInspector.SourceMap._base64Map = {};
+            WI.SourceMap._base64Map = {};
             for (var i = 0; i < base64Digits.length; ++i)
-                WebInspector.SourceMap._base64Map[base64Digits.charAt(i)] = i;
+                WI.SourceMap._base64Map[base64Digits.charAt(i)] = i;
         }
 
         this._originalSourceCode = originalSourceCode || null;
@@ -183,7 +183,7 @@
 
         this._sourceRoot = map.sourceRoot || null;
 
-        var stringCharIterator = new WebInspector.SourceMap.StringCharIterator(map.mappings);
+        var stringCharIterator = new WI.SourceMap.StringCharIterator(map.mappings);
         var sourceURL = sources[sourceIndex];
 
         while (true) {
@@ -243,10 +243,10 @@
         var result = 0;
         var shift = 0;
         do {
-            var digit = WebInspector.SourceMap._base64Map[stringCharIterator.next()];
-            result += (digit & WebInspector.SourceMap.VLQ_BASE_MASK) << shift;
-            shift += WebInspector.SourceMap.VLQ_BASE_SHIFT;
-        } while (digit & WebInspector.SourceMap.VLQ_CONTINUATION_MASK);
+            var digit = WI.SourceMap._base64Map[stringCharIterator.next()];
+            result += (digit & WI.SourceMap.VLQ_BASE_MASK) << shift;
+            shift += WI.SourceMap.VLQ_BASE_SHIFT;
+        } while (digit & WI.SourceMap.VLQ_CONTINUATION_MASK);
 
         // Fix the sign.
         var negative = result & 1;
@@ -255,11 +255,11 @@
     }
 };
 
-WebInspector.SourceMap.VLQ_BASE_SHIFT = 5;
-WebInspector.SourceMap.VLQ_BASE_MASK = (1 << 5) - 1;
-WebInspector.SourceMap.VLQ_CONTINUATION_MASK = 1 << 5;
+WI.SourceMap.VLQ_BASE_SHIFT = 5;
+WI.SourceMap.VLQ_BASE_MASK = (1 << 5) - 1;
+WI.SourceMap.VLQ_CONTINUATION_MASK = 1 << 5;
 
-WebInspector.SourceMap.StringCharIterator = class StringCharIterator
+WI.SourceMap.StringCharIterator = class StringCharIterator
 {
     constructor(string)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js b/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
index e7a17cb..b9e6b54 100644
--- a/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
+++ b/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceMapResource = class SourceMapResource extends WebInspector.Resource
+WI.SourceMapResource = class SourceMapResource extends WI.Resource
 {
     constructor(url, sourceMap)
     {
@@ -34,15 +34,15 @@
 
         this._sourceMap = sourceMap;
 
-        var inheritedMIMEType = this._sourceMap.originalSourceCode instanceof WebInspector.Resource ? this._sourceMap.originalSourceCode.syntheticMIMEType : null;
+        var inheritedMIMEType = this._sourceMap.originalSourceCode instanceof WI.Resource ? this._sourceMap.originalSourceCode.syntheticMIMEType : null;
 
-        var fileExtension = WebInspector.fileExtensionForURL(url);
-        var fileExtensionMIMEType = WebInspector.mimeTypeForFileExtension(fileExtension, true);
+        var fileExtension = WI.fileExtensionForURL(url);
+        var fileExtensionMIMEType = WI.mimeTypeForFileExtension(fileExtension, true);
 
         // FIXME: This is a layering violation. It should use a helper function on the
         // Resource base-class to set _mimeType and _type.
         this._mimeType = fileExtensionMIMEType || inheritedMIMEType || "text/javascript";
-        this._type = WebInspector.Resource.typeFromMIMEType(this._mimeType);
+        this._type = WI.Resource.typeFromMIMEType(this._mimeType);
 
         // Mark the resource as loaded so it does not show a spinner in the sidebar.
         // We will really load the resource the first time content is requested.
@@ -94,7 +94,7 @@
         {
             this.markAsFailed();
             return Promise.resolve({
-                error: WebInspector.UIString("An error occurred trying to load the resource."),
+                error: WI.UIString("An error occurred trying to load the resource."),
                 content,
                 mimeType,
                 statusCode
@@ -106,7 +106,7 @@
             // There was an error calling NetworkAgent.loadResource.
             console.error(error || "There was an unknown error calling NetworkAgent.loadResource.");
             this.markAsFailed();
-            return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")});
+            return Promise.resolve({error: WI.UIString("An error occurred trying to load the resource.")});
         }
 
         function sourceMapResourceLoaded(parameters)
@@ -137,11 +137,11 @@
             return sourceMapResourceLoadError.call(this);
 
         var frameIdentifier = null;
-        if (this._sourceMap.originalSourceCode instanceof WebInspector.Resource && this._sourceMap.originalSourceCode.parentFrame)
+        if (this._sourceMap.originalSourceCode instanceof WI.Resource && this._sourceMap.originalSourceCode.parentFrame)
             frameIdentifier = this._sourceMap.originalSourceCode.parentFrame.id;
 
         if (!frameIdentifier)
-            frameIdentifier = WebInspector.frameResourceManager.mainFrame.id;
+            frameIdentifier = WI.frameResourceManager.mainFrame.id;
 
         return NetworkAgent.loadResource(frameIdentifier, this.url).then(sourceMapResourceLoaded.bind(this)).catch(sourceMapResourceLoadError.bind(this));
     }
@@ -155,7 +155,7 @@
 
         // If the raw location is an inline script we need to include that offset.
         var originalSourceCode = this._sourceMap.originalSourceCode;
-        if (originalSourceCode instanceof WebInspector.Script) {
+        if (originalSourceCode instanceof WI.Script) {
             if (rawLineNumber === 0)
                 rawColumnNumber += originalSourceCode.range.startColumn;
             rawLineNumber += originalSourceCode.range.startLine;
@@ -173,6 +173,6 @@
         // However, we can provide the most accurate mapped locations in construction.
         var startSourceCodeLocation = this.createSourceCodeLocation(textRange.startLine, textRange.startColumn);
         var endSourceCodeLocation = this.createSourceCodeLocation(textRange.endLine, textRange.endColumn);
-        return new WebInspector.SourceCodeTextRange(this._sourceMap.originalSourceCode, startSourceCodeLocation, endSourceCodeLocation);
+        return new WI.SourceCodeTextRange(this._sourceMap.originalSourceCode, startSourceCodeLocation, endSourceCodeLocation);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Models/StackTrace.js b/Source/WebInspectorUI/UserInterface/Models/StackTrace.js
index 0f95b7f..ca72995 100644
--- a/Source/WebInspectorUI/UserInterface/Models/StackTrace.js
+++ b/Source/WebInspectorUI/UserInterface/Models/StackTrace.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StackTrace = class StackTrace
+WI.StackTrace = class StackTrace
 {
     constructor(callFrames, topCallFrameIsBoundary, truncated, parentStackTrace)
     {
-        console.assert(callFrames && callFrames.every((callFrame) => callFrame instanceof WebInspector.CallFrame));
+        console.assert(callFrames && callFrames.every((callFrame) => callFrame instanceof WI.CallFrame));
 
         this._callFrames = callFrames;
         this._topCallFrameIsBoundary = topCallFrameIsBoundary || false;
@@ -43,8 +43,8 @@
         let previousStackTrace = null;
 
         while (payload) {
-            let callFrames = payload.callFrames.map((x) => WebInspector.CallFrame.fromPayload(target, x));
-            let stackTrace = new WebInspector.StackTrace(callFrames, payload.topCallFrameIsBoundary, payload.truncated);
+            let callFrames = payload.callFrames.map((x) => WI.CallFrame.fromPayload(target, x));
+            let stackTrace = new WI.StackTrace(callFrames, payload.topCallFrameIsBoundary, payload.truncated);
             if (!result)
                 result = stackTrace;
             if (previousStackTrace)
@@ -59,8 +59,8 @@
 
     static fromString(target, stack)
     {
-        let callFrames = WebInspector.StackTrace._parseStackTrace(stack);
-        return WebInspector.StackTrace.fromPayload(target, {callFrames});
+        let callFrames = WI.StackTrace._parseStackTrace(stack);
+        return WI.StackTrace.fromPayload(target, {callFrames});
     }
 
     // May produce false negatives; must not produce any false positives.
@@ -102,9 +102,9 @@
 
             if (atIndex !== -1) {
                 functionName = line.slice(0, atIndex);
-                ({url, lineNumber, columnNumber} = WebInspector.StackTrace._parseLocation(line.slice(atIndex + 1)));
+                ({url, lineNumber, columnNumber} = WI.StackTrace._parseLocation(line.slice(atIndex + 1)));
             } else if (line.includes("/"))
-                ({url, lineNumber, columnNumber} = WebInspector.StackTrace._parseLocation(line));
+                ({url, lineNumber, columnNumber} = WI.StackTrace._parseLocation(line));
             else
                 functionName = line;
 
@@ -158,7 +158,7 @@
                 continue;
             if (frame.sourceCodeLocation) {
                 let sourceCode = frame.sourceCodeLocation.sourceCode;
-                if (sourceCode instanceof WebInspector.Script && sourceCode.anonymous)
+                if (sourceCode instanceof WI.Script && sourceCode.anonymous)
                     continue;
             }
             return frame;
diff --git a/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js b/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js
index 40acacb..a226254 100644
--- a/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js
+++ b/Source/WebInspectorUI/UserInterface/Models/StructureDescription.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StructureDescription = class StructureDescription
+WI.StructureDescription = class StructureDescription
 {
     constructor(fields, optionalFields, constructorName, prototypeStructure, imprecise)
     {
         console.assert(!fields || fields.every((x) => typeof x === "string"));
         console.assert(!optionalFields || optionalFields.every((x) => typeof x === "string"));
         console.assert(!constructorName || typeof constructorName === "string");
-        console.assert(!prototypeStructure || prototypeStructure instanceof WebInspector.StructureDescription);
+        console.assert(!prototypeStructure || prototypeStructure instanceof WI.StructureDescription);
 
         this._fields = fields || null;
         this._optionalFields = optionalFields || null;
@@ -45,9 +45,9 @@
     static fromPayload(payload)
     {
         if (payload.prototypeStructure)
-            payload.prototypeStructure = WebInspector.StructureDescription.fromPayload(payload.prototypeStructure);
+            payload.prototypeStructure = WI.StructureDescription.fromPayload(payload.prototypeStructure);
 
-        return new WebInspector.StructureDescription(payload.fields, payload.optionalFields, payload.constructorName, payload.prototypeStructure, payload.imprecise);
+        return new WI.StructureDescription(payload.fields, payload.optionalFields, payload.constructorName, payload.prototypeStructure, payload.imprecise);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/TextMarker.js b/Source/WebInspectorUI/UserInterface/Models/TextMarker.js
index e274a58..3cf8909 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TextMarker.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TextMarker.js
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextMarker = class TextMarker
+WI.TextMarker = class TextMarker
 {
     constructor(codeMirrorTextMarker, type)
     {
         this._codeMirrorTextMarker = codeMirrorTextMarker;
         codeMirrorTextMarker.__webInspectorTextMarker = this;
 
-        this._type = type || WebInspector.TextMarker.Type.Plain;
+        this._type = type || WI.TextMarker.Type.Plain;
     }
 
     // Static
 
     static textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker)
     {
-        return codeMirrorTextMarker.__webInspectorTextMarker || new WebInspector.TextMarker(codeMirrorTextMarker);
+        return codeMirrorTextMarker.__webInspectorTextMarker || new WI.TextMarker(codeMirrorTextMarker);
     }
 
     // Public
@@ -57,14 +57,14 @@
         var range = this._codeMirrorTextMarker.find();
         if (!range)
             return null;
-        return new WebInspector.TextRange(range.from.line, range.from.ch, range.to.line, range.to.ch);
+        return new WI.TextRange(range.from.line, range.from.ch, range.to.line, range.to.ch);
     }
 
     get rects()
     {
         var range = this._codeMirrorTextMarker.find();
         if (!range)
-            return WebInspector.Rect.ZERO_RECT;
+            return WI.Rect.ZERO_RECT;
         return this._codeMirrorTextMarker.doc.cm.rectsForRange({
             start: range.from,
             end: range.to
@@ -77,7 +77,7 @@
     }
 };
 
-WebInspector.TextMarker.Type = {
+WI.TextMarker.Type = {
     Color: "text-marker-type-color",
     Gradient: "text-marker-type-gradient",
     Plain: "text-marker-type-plain",
diff --git a/Source/WebInspectorUI/UserInterface/Models/TextRange.js b/Source/WebInspectorUI/UserInterface/Models/TextRange.js
index 1ecab2d..e093199 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TextRange.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TextRange.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextRange = class TextRange
+WI.TextRange = class TextRange
 {
     constructor(startLineOrStartOffset, startColumnOrEndOffset, endLine, endColumn)
     {
@@ -62,12 +62,12 @@
 
     startPosition()
     {
-        return new WebInspector.SourceCodePosition(this._startLine, this._startColumn);
+        return new WI.SourceCodePosition(this._startLine, this._startColumn);
     }
 
     endPosition()
     {
-        return new WebInspector.SourceCodePosition(this._endLine, this._endColumn);
+        return new WI.SourceCodePosition(this._endLine, this._endColumn);
     }
 
     resolveOffsets(text)
diff --git a/Source/WebInspectorUI/UserInterface/Models/Timeline.js b/Source/WebInspectorUI/UserInterface/Models/Timeline.js
index b72440a..3de983d 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Timeline.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Timeline.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Timeline = class Timeline extends WebInspector.Object
+WI.Timeline = class Timeline extends WI.Object
 {
     constructor(type)
     {
@@ -38,13 +38,13 @@
 
     static create(type)
     {
-        if (type === WebInspector.TimelineRecord.Type.Network)
-            return new WebInspector.NetworkTimeline(type);
+        if (type === WI.TimelineRecord.Type.Network)
+            return new WI.NetworkTimeline(type);
 
-        if (type === WebInspector.TimelineRecord.Type.Memory)
-            return new WebInspector.MemoryTimeline(type);
+        if (type === WI.TimelineRecord.Type.Memory)
+            return new WI.MemoryTimeline(type);
 
-        return new WebInspector.Timeline(type);
+        return new WI.Timeline(type);
     }
 
     // Public
@@ -61,15 +61,15 @@
         this._endTime = NaN;
 
         if (!suppressEvents) {
-            this.dispatchEventToListeners(WebInspector.Timeline.Event.TimesUpdated);
-            this.dispatchEventToListeners(WebInspector.Timeline.Event.Reset);
+            this.dispatchEventToListeners(WI.Timeline.Event.TimesUpdated);
+            this.dispatchEventToListeners(WI.Timeline.Event.Reset);
         }
     }
 
     addRecord(record)
     {
         if (record.updatesDynamically)
-            record.addEventListener(WebInspector.TimelineRecord.Event.Updated, this._recordUpdated, this);
+            record.addEventListener(WI.TimelineRecord.Event.Updated, this._recordUpdated, this);
 
         // Because records can be nested, it is possible that outer records with an early start time
         // may be completed and added to the Timeline after inner records with a later start time
@@ -80,17 +80,17 @@
 
         this._updateTimesIfNeeded(record);
 
-        this.dispatchEventToListeners(WebInspector.Timeline.Event.RecordAdded, {record});
+        this.dispatchEventToListeners(WI.Timeline.Event.RecordAdded, {record});
     }
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.Timeline.TimelineTypeCookieKey] = this._type;
+        cookie[WI.Timeline.TimelineTypeCookieKey] = this._type;
     }
 
     refresh()
     {
-        this.dispatchEventToListeners(WebInspector.Timeline.Event.Refreshed);
+        this.dispatchEventToListeners(WI.Timeline.Event.Refreshed);
     }
 
     recordsInTimeRange(startTime, endTime, includeRecordBeforeStart)
@@ -122,7 +122,7 @@
         }
 
         if (changed)
-            this.dispatchEventToListeners(WebInspector.Timeline.Event.TimesUpdated);
+            this.dispatchEventToListeners(WI.Timeline.Event.TimesUpdated);
     }
 
     _recordUpdated(event)
@@ -154,11 +154,11 @@
     }
 };
 
-WebInspector.Timeline.Event = {
+WI.Timeline.Event = {
     Reset: "timeline-reset",
     RecordAdded: "timeline-record-added",
     TimesUpdated: "timeline-times-updated",
     Refreshed: "timeline-refreshed",
 };
 
-WebInspector.Timeline.TimelineTypeCookieKey = "timeline-type";
+WI.Timeline.TimelineTypeCookieKey = "timeline-type";
diff --git a/Source/WebInspectorUI/UserInterface/Models/TimelineMarker.js b/Source/WebInspectorUI/UserInterface/Models/TimelineMarker.js
index dee038c..c797223 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TimelineMarker.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TimelineMarker.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineMarker = class TimelineMarker extends WebInspector.Object
+WI.TimelineMarker = class TimelineMarker extends WI.Object
 {
     constructor(time, type, details)
     {
@@ -54,7 +54,7 @@
 
         this._time = x;
 
-        this.dispatchEventToListeners(WebInspector.TimelineMarker.Event.TimeChanged);
+        this.dispatchEventToListeners(WI.TimelineMarker.Event.TimeChanged);
     }
 
     get type()
@@ -68,11 +68,11 @@
     }
 };
 
-WebInspector.TimelineMarker.Event = {
+WI.TimelineMarker.Event = {
     TimeChanged: "timeline-marker-time-changed"
 };
 
-WebInspector.TimelineMarker.Type = {
+WI.TimelineMarker.Type = {
     CurrentTime: "current-time",
     LoadEvent: "load-event",
     DOMContentEvent: "dom-content-event",
diff --git a/Source/WebInspectorUI/UserInterface/Models/TimelineRange.js b/Source/WebInspectorUI/UserInterface/Models/TimelineRange.js
index a7e43a1..d1d7ded 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TimelineRange.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TimelineRange.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRange = class TimelineRange
+WI.TimelineRange = class TimelineRange
 {
     constructor(startValue, endValue)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js b/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js
index 99f4431..fd7d5ff 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecord = class TimelineRecord extends WebInspector.Object
+WI.TimelineRecord = class TimelineRecord extends WI.Object
 {
     constructor(type, startTime, endTime, callFrames, sourceCodeLocation)
     {
@@ -31,8 +31,8 @@
 
         console.assert(type);
 
-        if (type in WebInspector.TimelineRecord.Type)
-            type = WebInspector.TimelineRecord.Type[type];
+        if (type in WI.TimelineRecord.Type)
+            type = WI.TimelineRecord.Type[type];
 
         this._type = type;
         this._startTime = startTime || NaN;
@@ -142,18 +142,18 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.TimelineRecord.SourceCodeURLCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.sourceCode.url ? this._sourceCodeLocation.sourceCode.url.hash : null : null;
-        cookie[WebInspector.TimelineRecord.SourceCodeLocationLineCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : null;
-        cookie[WebInspector.TimelineRecord.SourceCodeLocationColumnCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : null;
-        cookie[WebInspector.TimelineRecord.TypeCookieKey] = this._type || null;
+        cookie[WI.TimelineRecord.SourceCodeURLCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.sourceCode.url ? this._sourceCodeLocation.sourceCode.url.hash : null : null;
+        cookie[WI.TimelineRecord.SourceCodeLocationLineCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.lineNumber : null;
+        cookie[WI.TimelineRecord.SourceCodeLocationColumnCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.columnNumber : null;
+        cookie[WI.TimelineRecord.TypeCookieKey] = this._type || null;
     }
 };
 
-WebInspector.TimelineRecord.Event = {
+WI.TimelineRecord.Event = {
     Updated: "timeline-record-updated"
 };
 
-WebInspector.TimelineRecord.Type = {
+WI.TimelineRecord.Type = {
     Network: "timeline-record-type-network",
     Layout: "timeline-record-type-layout",
     Script: "timeline-record-type-script",
@@ -162,8 +162,8 @@
     HeapAllocations: "timeline-record-type-heap-allocations",
 };
 
-WebInspector.TimelineRecord.TypeIdentifier = "timeline-record";
-WebInspector.TimelineRecord.SourceCodeURLCookieKey = "timeline-record-source-code-url";
-WebInspector.TimelineRecord.SourceCodeLocationLineCookieKey = "timeline-record-source-code-location-line";
-WebInspector.TimelineRecord.SourceCodeLocationColumnCookieKey = "timeline-record-source-code-location-column";
-WebInspector.TimelineRecord.TypeCookieKey = "timeline-record-type";
+WI.TimelineRecord.TypeIdentifier = "timeline-record";
+WI.TimelineRecord.SourceCodeURLCookieKey = "timeline-record-source-code-url";
+WI.TimelineRecord.SourceCodeLocationLineCookieKey = "timeline-record-source-code-location-line";
+WI.TimelineRecord.SourceCodeLocationColumnCookieKey = "timeline-record-source-code-location-column";
+WI.TimelineRecord.TypeCookieKey = "timeline-record-type";
diff --git a/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js b/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
index f4cc102..af34121 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecording = class TimelineRecording extends WebInspector.Object
+WI.TimelineRecording = class TimelineRecording extends WI.Object
 {
     constructor(identifier, displayName, instruments)
     {
@@ -35,15 +35,15 @@
         this._capturing = false;
         this._readonly = false;
         this._instruments = instruments || [];
-        this._topDownCallingContextTree = new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopDown);
-        this._bottomUpCallingContextTree = new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.BottomUp);
-        this._topFunctionsTopDownCallingContextTree = new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopFunctionsTopDown);
-        this._topFunctionsBottomUpCallingContextTree = new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopFunctionsBottomUp);
+        this._topDownCallingContextTree = new WI.CallingContextTree(WI.CallingContextTree.Type.TopDown);
+        this._bottomUpCallingContextTree = new WI.CallingContextTree(WI.CallingContextTree.Type.BottomUp);
+        this._topFunctionsTopDownCallingContextTree = new WI.CallingContextTree(WI.CallingContextTree.Type.TopFunctionsTopDown);
+        this._topFunctionsBottomUpCallingContextTree = new WI.CallingContextTree(WI.CallingContextTree.Type.TopFunctionsBottomUp);
 
-        for (let type of WebInspector.TimelineManager.availableTimelineTypes()) {
-            let timeline = WebInspector.Timeline.create(type);
+        for (let type of WI.TimelineManager.availableTimelineTypes()) {
+            let timeline = WI.Timeline.create(type);
             this._timelines.set(type, timeline);
-            timeline.addEventListener(WebInspector.Timeline.Event.TimesUpdated, this._timelineTimesUpdated, this);
+            timeline.addEventListener(WI.Timeline.Event.TimesUpdated, this._timelineTimesUpdated, this);
         }
 
         // For legacy backends, we compute the elapsed time of records relative to this timestamp.
@@ -56,7 +56,7 @@
 
     static sourceCodeTimelinesSupported()
     {
-        return WebInspector.debuggableType === WebInspector.DebuggableType.Web;
+        return WI.debuggableType === WI.DebuggableType.Web;
     }
 
     // Public
@@ -118,7 +118,7 @@
 
         this._readonly = true;
 
-        this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Unloaded);
+        this.dispatchEventToListeners(WI.TimelineRecording.Event.Unloaded);
     }
 
     reset(suppressEvents)
@@ -139,11 +139,11 @@
         for (var timeline of this._timelines.values())
             timeline.reset(suppressEvents);
 
-        WebInspector.RenderingFrameTimelineRecord.resetFrameIndex();
+        WI.RenderingFrameTimelineRecord.resetFrameIndex();
 
         if (!suppressEvents) {
-            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Reset);
-            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);
+            this.dispatchEventToListeners(WI.TimelineRecording.Event.Reset);
+            this.dispatchEventToListeners(WI.TimelineRecording.Event.TimesUpdated);
         }
     }
 
@@ -172,22 +172,22 @@
 
     addInstrument(instrument)
     {
-        console.assert(instrument instanceof WebInspector.Instrument, instrument);
+        console.assert(instrument instanceof WI.Instrument, instrument);
         console.assert(!this._instruments.includes(instrument), this._instruments, instrument);
 
         this._instruments.push(instrument);
 
-        this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.InstrumentAdded, {instrument});
+        this.dispatchEventToListeners(WI.TimelineRecording.Event.InstrumentAdded, {instrument});
     }
 
     removeInstrument(instrument)
     {
-        console.assert(instrument instanceof WebInspector.Instrument, instrument);
+        console.assert(instrument instanceof WI.Instrument, instrument);
         console.assert(this._instruments.includes(instrument), this._instruments, instrument);
 
         this._instruments.remove(instrument);
 
-        this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.InstrumentRemoved, {instrument});
+        this.dispatchEventToListeners(WI.TimelineRecording.Event.InstrumentRemoved, {instrument});
     }
 
     addEventMarker(marker)
@@ -197,7 +197,7 @@
 
         this._eventMarkers.push(marker);
 
-        this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.MarkerAdded, {marker});
+        this.dispatchEventToListeners(WI.TimelineRecording.Event.MarkerAdded, {marker});
     }
 
     addRecord(record)
@@ -211,17 +211,17 @@
         timeline.addRecord(record);
 
         // Some records don't have source code timelines.
-        if (record.type === WebInspector.TimelineRecord.Type.Network
-            || record.type === WebInspector.TimelineRecord.Type.RenderingFrame
-            || record.type === WebInspector.TimelineRecord.Type.Memory
-            || record.type === WebInspector.TimelineRecord.Type.HeapAllocations)
+        if (record.type === WI.TimelineRecord.Type.Network
+            || record.type === WI.TimelineRecord.Type.RenderingFrame
+            || record.type === WI.TimelineRecord.Type.Memory
+            || record.type === WI.TimelineRecord.Type.HeapAllocations)
             return;
 
-        if (!WebInspector.TimelineRecording.sourceCodeTimelinesSupported())
+        if (!WI.TimelineRecording.sourceCodeTimelinesSupported())
             return;
 
         // Add the record to the source code timelines.
-        var activeMainResource = WebInspector.frameResourceManager.mainFrame.provisionalMainResource || WebInspector.frameResourceManager.mainFrame.mainResource;
+        var activeMainResource = WI.frameResourceManager.mainFrame.provisionalMainResource || WI.frameResourceManager.mainFrame.mainResource;
         var sourceCode = record.sourceCodeLocation ? record.sourceCodeLocation.sourceCode : activeMainResource;
 
         var sourceCodeTimelines = this._sourceCodeTimelinesMap.get(sourceCode);
@@ -234,7 +234,7 @@
         var key = this._keyForRecord(record);
         var sourceCodeTimeline = sourceCodeTimelines.get(key);
         if (!sourceCodeTimeline) {
-            sourceCodeTimeline = new WebInspector.SourceCodeTimeline(sourceCode, record.sourceCodeLocation, record.type, record.eventType);
+            sourceCodeTimeline = new WI.SourceCodeTimeline(sourceCode, record.sourceCodeLocation, record.type, record.eventType);
             sourceCodeTimelines.set(key, sourceCodeTimeline);
             newTimeline = true;
         }
@@ -242,12 +242,12 @@
         sourceCodeTimeline.addRecord(record);
 
         if (newTimeline)
-            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded, {sourceCodeTimeline});
+            this.dispatchEventToListeners(WI.TimelineRecording.Event.SourceCodeTimelineAdded, {sourceCodeTimeline});
     }
 
     addMemoryPressureEvent(memoryPressureEvent)
     {
-        let memoryTimeline = this._timelines.get(WebInspector.TimelineRecord.Type.Memory);
+        let memoryTimeline = this._timelines.get(WI.TimelineRecord.Type.Memory);
         console.assert(memoryTimeline, this._timelines);
         if (!memoryTimeline)
             return;
@@ -268,14 +268,14 @@
     addScriptInstrumentForProgrammaticCapture()
     {
         for (let instrument of this._instruments) {
-            if (instrument instanceof WebInspector.ScriptInstrument)
+            if (instrument instanceof WI.ScriptInstrument)
                 return;
         }
 
-        this.addInstrument(new WebInspector.ScriptInstrument);
+        this.addInstrument(new WI.ScriptInstrument);
 
         let instrumentTypes = this._instruments.map((instrument) => instrument.timelineRecordType);
-        WebInspector.timelineManager.enabledTimelineTypes = instrumentTypes;
+        WI.timelineManager.enabledTimelineTypes = instrumentTypes;
     }
 
     computeElapsedTime(timestamp)
@@ -286,15 +286,15 @@
         // COMPATIBILITY (iOS 8): old backends send timestamps (seconds or milliseconds since the epoch),
         // rather than seconds elapsed since timeline capturing started. We approximate the latter by
         // subtracting the start timestamp, as old versions did not use monotonic times.
-        if (WebInspector.TimelineRecording.isLegacy === undefined)
-            WebInspector.TimelineRecording.isLegacy = timestamp > WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion;
+        if (WI.TimelineRecording.isLegacy === undefined)
+            WI.TimelineRecording.isLegacy = timestamp > WI.TimelineRecording.TimestampThresholdForLegacyRecordConversion;
 
-        if (!WebInspector.TimelineRecording.isLegacy)
+        if (!WI.TimelineRecording.isLegacy)
             return timestamp;
 
         // If the record's start time is large, but not really large, then it is seconds since epoch
         // not millseconds since epoch, so convert it to milliseconds.
-        if (timestamp < WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
+        if (timestamp < WI.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
             timestamp *= 1000;
 
         if (isNaN(this._legacyFirstRecordedTimestamp))
@@ -308,7 +308,7 @@
     {
         console.assert(isNaN(this._legacyFirstRecordedTimestamp));
 
-        if (timestamp < WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
+        if (timestamp < WI.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
             timestamp *= 1000;
 
         this._legacyFirstRecordedTimestamp = timestamp;
@@ -322,7 +322,7 @@
             this._startTime = timestamp;
             this._endTime = timestamp;
 
-            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);
+            this.dispatchEventToListeners(WI.TimelineRecording.Event.TimesUpdated);
         }
     }
 
@@ -331,9 +331,9 @@
     _keyForRecord(record)
     {
         var key = record.type;
-        if (record instanceof WebInspector.ScriptTimelineRecord || record instanceof WebInspector.LayoutTimelineRecord)
+        if (record instanceof WI.ScriptTimelineRecord || record instanceof WI.LayoutTimelineRecord)
             key += ":" + record.eventType;
-        if (record instanceof WebInspector.ScriptTimelineRecord && record.eventType === WebInspector.ScriptTimelineRecord.EventType.EventDispatched)
+        if (record instanceof WI.ScriptTimelineRecord && record.eventType === WI.ScriptTimelineRecord.EventType.EventDispatched)
             key += ":" + record.details;
         if (record.sourceCodeLocation)
             key += ":" + record.sourceCodeLocation.lineNumber + ":" + record.sourceCodeLocation.columnNumber;
@@ -356,11 +356,11 @@
         }
 
         if (changed)
-            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);
+            this.dispatchEventToListeners(WI.TimelineRecording.Event.TimesUpdated);
     }
 };
 
-WebInspector.TimelineRecording.Event = {
+WI.TimelineRecording.Event = {
     Reset: "timeline-recording-reset",
     Unloaded: "timeline-recording-unloaded",
     SourceCodeTimelineAdded: "timeline-recording-source-code-timeline-added",
@@ -370,6 +370,6 @@
     MarkerAdded: "timeline-recording-marker-added",
 };
 
-WebInspector.TimelineRecording.isLegacy = undefined;
-WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion = 10000000; // Some value not near zero.
-WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds = 1420099200000; // Date.parse("Jan 1, 2015"). Milliseconds since epoch.
+WI.TimelineRecording.isLegacy = undefined;
+WI.TimelineRecording.TimestampThresholdForLegacyRecordConversion = 10000000; // Some value not near zero.
+WI.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds = 1420099200000; // Date.parse("Jan 1, 2015"). Milliseconds since epoch.
diff --git a/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js b/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js
index 07b5837..4d6b420 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TypeDescription.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TypeDescription = class TypeDescription
+WI.TypeDescription = class TypeDescription
 {
     constructor(leastCommonAncestor, typeSet, structures, valid, truncated)
     {
         console.assert(!leastCommonAncestor || typeof leastCommonAncestor === "string");
-        console.assert(!typeSet || typeSet instanceof WebInspector.TypeSet);
-        console.assert(!structures || structures.every((x) => x instanceof WebInspector.StructureDescription));
+        console.assert(!typeSet || typeSet instanceof WI.TypeSet);
+        console.assert(!structures || structures.every((x) => x instanceof WI.StructureDescription));
 
         this._leastCommonAncestor = leastCommonAncestor || null;
         this._typeSet = typeSet || null;
@@ -45,13 +45,13 @@
     {
         var typeSet = undefined;
         if (payload.typeSet)
-            typeSet = WebInspector.TypeSet.fromPayload(payload.typeSet);
+            typeSet = WI.TypeSet.fromPayload(payload.typeSet);
 
         var structures = undefined;
         if (payload.structures)
-            structures = payload.structures.map(WebInspector.StructureDescription.fromPayload);
+            structures = payload.structures.map(WI.StructureDescription.fromPayload);
 
-        return new WebInspector.TypeDescription(payload.leastCommonAncestor, typeSet, structures, payload.isValid, payload.isTruncated);
+        return new WI.TypeDescription(payload.leastCommonAncestor, typeSet, structures, payload.isValid, payload.isTruncated);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Models/TypeSet.js b/Source/WebInspectorUI/UserInterface/Models/TypeSet.js
index 627fbc4..4429f42 100644
--- a/Source/WebInspectorUI/UserInterface/Models/TypeSet.js
+++ b/Source/WebInspectorUI/UserInterface/Models/TypeSet.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TypeSet = class TypeSet
+WI.TypeSet = class TypeSet
 {
     constructor(typeSet)
     {
@@ -32,23 +32,23 @@
 
         var bitString = 0x0;
         if (typeSet.isFunction)
-            bitString |= WebInspector.TypeSet.TypeBit.Function;
+            bitString |= WI.TypeSet.TypeBit.Function;
         if (typeSet.isUndefined)
-            bitString |= WebInspector.TypeSet.TypeBit.Undefined;
+            bitString |= WI.TypeSet.TypeBit.Undefined;
         if (typeSet.isNull)
-            bitString |= WebInspector.TypeSet.TypeBit.Null;
+            bitString |= WI.TypeSet.TypeBit.Null;
         if (typeSet.isBoolean)
-            bitString |= WebInspector.TypeSet.TypeBit.Boolean;
+            bitString |= WI.TypeSet.TypeBit.Boolean;
         if (typeSet.isInteger)
-            bitString |= WebInspector.TypeSet.TypeBit.Integer;
+            bitString |= WI.TypeSet.TypeBit.Integer;
         if (typeSet.isNumber)
-            bitString |= WebInspector.TypeSet.TypeBit.Number;
+            bitString |= WI.TypeSet.TypeBit.Number;
         if (typeSet.isString)
-            bitString |= WebInspector.TypeSet.TypeBit.String;
+            bitString |= WI.TypeSet.TypeBit.String;
         if (typeSet.isObject)
-            bitString |= WebInspector.TypeSet.TypeBit.Object;
+            bitString |= WI.TypeSet.TypeBit.Object;
         if (typeSet.isSymbol)
-            bitString |= WebInspector.TypeSet.TypeBit.Symbol;
+            bitString |= WI.TypeSet.TypeBit.Symbol;
         console.assert(bitString);
 
         this._typeSet = typeSet;
@@ -60,7 +60,7 @@
 
     static fromPayload(payload)
     {
-        return new WebInspector.TypeSet(payload);
+        return new WI.TypeSet(payload);
     }
 
     // Public
@@ -115,7 +115,7 @@
     }
 };
 
-WebInspector.TypeSet.TypeBit = {
+WI.TypeSet.TypeBit = {
     "Function"    :  0x1,
     "Undefined"   :  0x2,
     "Null"        :  0x4,
@@ -127,4 +127,4 @@
     "Symbol"      :  0x100
 };
 
-WebInspector.TypeSet.NullOrUndefinedTypeBits = WebInspector.TypeSet.TypeBit.Null | WebInspector.TypeSet.TypeBit.Undefined;
+WI.TypeSet.NullOrUndefinedTypeBits = WI.TypeSet.TypeBit.Null | WI.TypeSet.TypeBit.Undefined;
diff --git a/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js b/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js
index 56b5e94..c498dcd 100644
--- a/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js
+++ b/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js
@@ -23,18 +23,18 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WebSocketResource = class WebSocketResource extends WebInspector.Resource
+WI.WebSocketResource = class WebSocketResource extends WI.Resource
 {
     constructor(url, loaderIdentifier, targetId, requestIdentifier, requestHeaders, requestData, timestamp, walltime, requestSentTimestamp, initiatorSourceCodeLocation)
     {
-        const type = WebInspector.Resource.Type.WebSocket;
+        const type = WI.Resource.Type.WebSocket;
         const mimeType = null;
         const requestMethod = "GET";
         super(url, mimeType, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, initiatorSourceCodeLocation);
 
         this._timestamp = timestamp;
         this._walltime = walltime;
-        this._readyState = WebInspector.WebSocketResource.ReadyState.Connecting;
+        this._readyState = WI.WebSocketResource.ReadyState.Connecting;
         this._frames = [];
     }
 
@@ -56,7 +56,7 @@
         let previousState = this._readyState;
         this._readyState = state;
 
-        this.dispatchEventToListeners(WebInspector.WebSocketResource.Event.ReadyStateChanged, {previousState, state});
+        this.dispatchEventToListeners(WI.WebSocketResource.Event.ReadyStateChanged, {previousState, state});
     }
 
     addFrame(data, payloadLength, isOutgoing, opcode, timestamp, elapsedTime)
@@ -64,7 +64,7 @@
         let frameData;
 
         // Binary data is never shown in the UI, don't clog memory with it.
-        if (opcode === WebInspector.WebSocketResource.OpCodes.BinaryFrame)
+        if (opcode === WI.WebSocketResource.OpCodes.BinaryFrame)
             frameData = null;
         else
             frameData = data;
@@ -78,7 +78,7 @@
 
         this.increaseSize(payloadLength, elapsedTime);
 
-        this.dispatchEventToListeners(WebInspector.WebSocketResource.Event.FrameAdded, frame);
+        this.dispatchEventToListeners(WI.WebSocketResource.Event.FrameAdded, frame);
     }
 
     // Private
@@ -89,18 +89,18 @@
     }
 };
 
-WebInspector.WebSocketResource.Event = {
+WI.WebSocketResource.Event = {
     FrameAdded: Symbol("web-socket-frame-added"),
     ReadyStateChanged: Symbol("web-socket-resource-ready-state-changed"),
 };
 
-WebInspector.WebSocketResource.ReadyState = {
+WI.WebSocketResource.ReadyState = {
     Closed: Symbol("closed"),
     Connecting: Symbol("connecting"),
     Open: Symbol("open"),
 };
 
-WebInspector.WebSocketResource.OpCodes = {
+WI.WebSocketResource.OpCodes = {
     ContinuationFrame: 0,
     TextFrame: 1,
     BinaryFrame: 2,
diff --git a/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js b/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js
index a42253d..cd02b2e 100644
--- a/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js
+++ b/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WrappedPromise = class WrappedPromise
+WI.WrappedPromise = class WrappedPromise
 {
     constructor(work)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js b/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js
index 85554d0..eb7ac4f 100644
--- a/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js
+++ b/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.XHRBreakpoint = class XHRBreakpoint extends WebInspector.Object
+WI.XHRBreakpoint = class XHRBreakpoint extends WI.Object
 {
     constructor(type, url, disabled)
     {
         super();
 
-        this._type = type || WebInspector.XHRBreakpoint.Type.Text;
+        this._type = type || WI.XHRBreakpoint.Type.Text;
         this._url = url || "";
         this._disabled = disabled || false;
     }
@@ -51,7 +51,7 @@
 
         this._disabled = disabled;
 
-        this.dispatchEventToListeners(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange);
+        this.dispatchEventToListeners(WI.XHRBreakpoint.Event.DisabledStateDidChange);
     }
 
     get serializableInfo()
@@ -65,18 +65,18 @@
 
     saveIdentityToCookie(cookie)
     {
-        cookie[WebInspector.XHRBreakpoint.URLCookieKey] = this._url;
+        cookie[WI.XHRBreakpoint.URLCookieKey] = this._url;
     }
 };
 
-WebInspector.XHRBreakpoint.URLCookieKey = "xhr-breakpoint-url";
+WI.XHRBreakpoint.URLCookieKey = "xhr-breakpoint-url";
 
-WebInspector.XHRBreakpoint.Event = {
+WI.XHRBreakpoint.Event = {
     DisabledStateDidChange: "xhr-breakpoint-disabled-state-did-change",
     ResolvedStateDidChange: "xhr-breakpoint-resolved-state-did-change",
 };
 
-WebInspector.XHRBreakpoint.Type = {
+WI.XHRBreakpoint.Type = {
     Text: "text",
     RegularExpression: "regex",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/ApplicationCacheObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/ApplicationCacheObserver.js
index d803853..1dfe65d 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/ApplicationCacheObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/ApplicationCacheObserver.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheObserver = class ApplicationCacheObserver
+WI.ApplicationCacheObserver = class ApplicationCacheObserver
 {
     // Events defined by the "ApplicationCache" domain.
 
     applicationCacheStatusUpdated(frameId, manifestURL, status)
     {
-        WebInspector.applicationCacheManager.applicationCacheStatusUpdated(frameId, manifestURL, status);
+        WI.applicationCacheManager.applicationCacheStatusUpdated(frameId, manifestURL, status);
     }
 
     networkStateUpdated(isNowOnline)
     {
-        WebInspector.applicationCacheManager.networkStateUpdated(isNowOnline);
+        WI.applicationCacheManager.networkStateUpdated(isNowOnline);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
index f8e0570..ed9e636 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
@@ -23,38 +23,38 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSObserver = class CSSObserver
+WI.CSSObserver = class CSSObserver
 {
     // Events defined by the "CSS" domain.
 
     mediaQueryResultChanged()
     {
-        WebInspector.cssStyleManager.mediaQueryResultChanged();
+        WI.cssStyleManager.mediaQueryResultChanged();
     }
 
     styleSheetChanged(styleSheetId)
     {
-        WebInspector.cssStyleManager.styleSheetChanged(styleSheetId);
+        WI.cssStyleManager.styleSheetChanged(styleSheetId);
     }
 
     styleSheetAdded(styleSheetInfo)
     {
-        WebInspector.cssStyleManager.styleSheetAdded(styleSheetInfo);
+        WI.cssStyleManager.styleSheetAdded(styleSheetInfo);
     }
 
     styleSheetRemoved(id)
     {
-        WebInspector.cssStyleManager.styleSheetRemoved(id);
+        WI.cssStyleManager.styleSheetRemoved(id);
     }
 
     namedFlowCreated(namedFlow)
     {
-        WebInspector.domTreeManager.namedFlowCreated(namedFlow);
+        WI.domTreeManager.namedFlowCreated(namedFlow);
     }
 
     namedFlowRemoved(documentNodeId, flowName)
     {
-        WebInspector.domTreeManager.namedFlowRemoved(documentNodeId, flowName);
+        WI.domTreeManager.namedFlowRemoved(documentNodeId, flowName);
     }
 
     // COMPATIBILITY (iOS 7): regionLayoutUpdated was removed and replaced by regionOversetChanged.
@@ -65,16 +65,16 @@
 
     regionOversetChanged(namedFlow)
     {
-        WebInspector.domTreeManager.regionOversetChanged(namedFlow);
+        WI.domTreeManager.regionOversetChanged(namedFlow);
     }
 
     registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId)
     {
-        WebInspector.domTreeManager.registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId);
+        WI.domTreeManager.registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId);
     }
 
     unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId)
     {
-        WebInspector.domTreeManager.unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId);
+        WI.domTreeManager.unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
index f7e1d55..b7c5f2f 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
@@ -23,32 +23,32 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CanvasObserver = class CanvasObserver
+WI.CanvasObserver = class CanvasObserver
 {
     // Events defined by the "Canvas" domain.
 
     canvasAdded(canvas)
     {
-        WebInspector.canvasManager.canvasAdded(canvas);
+        WI.canvasManager.canvasAdded(canvas);
     }
 
     canvasRemoved(canvasId)
     {
-        WebInspector.canvasManager.canvasRemoved(canvasId);
+        WI.canvasManager.canvasRemoved(canvasId);
     }
 
     canvasMemoryChanged(canvasId, memoryCost)
     {
-        WebInspector.canvasManager.canvasMemoryChanged(canvasId, memoryCost);
+        WI.canvasManager.canvasMemoryChanged(canvasId, memoryCost);
     }
 
     cssCanvasClientNodesChanged(canvasId)
     {
-        WebInspector.canvasManager.cssCanvasClientNodesChanged(canvasId);
+        WI.canvasManager.cssCanvasClientNodesChanged(canvasId);
     }
 
     recordingFinished(canvasId, recording)
     {
-        WebInspector.canvasManager.recordingFinished(canvasId, recording);
+        WI.canvasManager.recordingFinished(canvasId, recording);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/Connection.js b/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
index eb4919d..48f69e3 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
@@ -145,7 +145,7 @@
         try {
             callback.apply(null, callbackArguments);
         } catch (e) {
-            WebInspector.reportInternalError(e, {"cause": `An uncaught exception was thrown while dispatching response callback for command ${command.qualifiedName}.`});
+            WI.reportInternalError(e, {"cause": `An uncaught exception was thrown while dispatching response callback for command ${command.qualifiedName}.`});
         }
     }
 
@@ -195,7 +195,7 @@
             for (let tracer of InspectorBackend.activeTracers)
                 tracer.logFrontendException(messageObject, e);
 
-            WebInspector.reportInternalError(e, {"cause": `An uncaught exception was thrown while handling event: ${qualifiedName}`});
+            WI.reportInternalError(e, {"cause": `An uncaught exception was thrown while handling event: ${qualifiedName}`});
         }
 
         InspectorBackend.currentDispatchState.event = null;
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
index 1dff619..7a8d7d4 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleObserver = class ConsoleObserver
+WI.ConsoleObserver = class ConsoleObserver
 {
     // Events defined by the "Console" domain.
 
@@ -33,27 +33,27 @@
             return;
 
         if (message.type === "assert" && !message.text)
-            message.text = WebInspector.UIString("Assertion");
+            message.text = WI.UIString("Assertion");
 
-        WebInspector.logManager.messageWasAdded(this.target, message.source, message.level, message.text, message.type, message.url, message.line, message.column || 0, message.repeatCount, message.parameters, message.stackTrace, message.networkRequestId);
+        WI.logManager.messageWasAdded(this.target, message.source, message.level, message.text, message.type, message.url, message.line, message.column || 0, message.repeatCount, message.parameters, message.stackTrace, message.networkRequestId);
     }
 
     messageRepeatCountUpdated(count)
     {
-        WebInspector.logManager.messageRepeatCountUpdated(count);
+        WI.logManager.messageRepeatCountUpdated(count);
     }
 
     messagesCleared()
     {
-        WebInspector.logManager.messagesCleared();
+        WI.logManager.messagesCleared();
     }
 
     heapSnapshot(timestamp, snapshotStringData, title)
     {
-        let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+        let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
         workerProxy.createSnapshot(snapshotStringData, title || null, ({objectId, snapshot: serializedSnapshot}) => {
-            let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
-            WebInspector.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+            let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+            WI.timelineManager.heapSnapshotAdded(timestamp, snapshot);
         });
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js
index 40a9977..4595640 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js
@@ -23,77 +23,77 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMObserver = class DOMObserver
+WI.DOMObserver = class DOMObserver
 {
     // Events defined by the "DOM" domain.
 
     documentUpdated()
     {
-        WebInspector.domTreeManager._documentUpdated();
+        WI.domTreeManager._documentUpdated();
     }
 
     setChildNodes(parentId, payloads)
     {
-        WebInspector.domTreeManager._setChildNodes(parentId, payloads);
+        WI.domTreeManager._setChildNodes(parentId, payloads);
     }
 
     attributeModified(nodeId, name, value)
     {
-        WebInspector.domTreeManager._attributeModified(nodeId, name, value);
+        WI.domTreeManager._attributeModified(nodeId, name, value);
     }
 
     attributeRemoved(nodeId, name)
     {
-        WebInspector.domTreeManager._attributeRemoved(nodeId, name);
+        WI.domTreeManager._attributeRemoved(nodeId, name);
     }
 
     inlineStyleInvalidated(nodeIds)
     {
-        WebInspector.domTreeManager._inlineStyleInvalidated(nodeIds);
+        WI.domTreeManager._inlineStyleInvalidated(nodeIds);
     }
 
     characterDataModified(nodeId, characterData)
     {
-        WebInspector.domTreeManager._characterDataModified(nodeId, characterData);
+        WI.domTreeManager._characterDataModified(nodeId, characterData);
     }
 
     childNodeCountUpdated(nodeId, childNodeCount)
     {
-        WebInspector.domTreeManager._childNodeCountUpdated(nodeId, childNodeCount);
+        WI.domTreeManager._childNodeCountUpdated(nodeId, childNodeCount);
     }
 
     childNodeInserted(parentNodeId, previousNodeId, payload)
     {
-        WebInspector.domTreeManager._childNodeInserted(parentNodeId, previousNodeId, payload);
+        WI.domTreeManager._childNodeInserted(parentNodeId, previousNodeId, payload);
     }
 
     childNodeRemoved(parentNodeId, nodeId)
     {
-        WebInspector.domTreeManager._childNodeRemoved(parentNodeId, nodeId);
+        WI.domTreeManager._childNodeRemoved(parentNodeId, nodeId);
     }
 
     shadowRootPushed(parentNodeId, nodeId)
     {
-        WebInspector.domTreeManager._childNodeInserted(parentNodeId, 0, nodeId);
+        WI.domTreeManager._childNodeInserted(parentNodeId, 0, nodeId);
     }
 
     shadowRootPopped(parentNodeId, nodeId)
     {
-        WebInspector.domTreeManager._childNodeRemoved(parentNodeId, nodeId);
+        WI.domTreeManager._childNodeRemoved(parentNodeId, nodeId);
     }
 
     customElementStateChanged(nodeId, customElementState)
     {
-        WebInspector.domTreeManager._customElementStateChanged(nodeId, customElementState);
+        WI.domTreeManager._customElementStateChanged(nodeId, customElementState);
     }
 
     pseudoElementAdded(parentNodeId, pseudoElement)
     {
-        WebInspector.domTreeManager._pseudoElementAdded(parentNodeId, pseudoElement);
+        WI.domTreeManager._pseudoElementAdded(parentNodeId, pseudoElement);
     }
 
     pseudoElementRemoved(parentNodeId, pseudoElementId)
     {
-        WebInspector.domTreeManager._pseudoElementRemoved(parentNodeId, pseudoElementId);
+        WI.domTreeManager._pseudoElementRemoved(parentNodeId, pseudoElementId);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/DOMStorageObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/DOMStorageObserver.js
index 57da70f..870c3ac 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/DOMStorageObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/DOMStorageObserver.js
@@ -24,27 +24,27 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMStorageObserver = class DOMStorageObserver
+WI.DOMStorageObserver = class DOMStorageObserver
 {
     // Events defined by the "DOMStorage" domain.
 
     domStorageItemsCleared(storageId)
     {
-        WebInspector.storageManager.itemsCleared(storageId);
+        WI.storageManager.itemsCleared(storageId);
     }
 
     domStorageItemRemoved(storageId, key)
     {
-        WebInspector.storageManager.itemRemoved(storageId, key);
+        WI.storageManager.itemRemoved(storageId, key);
     }
 
     domStorageItemAdded(storageId, key, value)
     {
-        WebInspector.storageManager.itemAdded(storageId, key, value);
+        WI.storageManager.itemAdded(storageId, key, value);
     }
 
     domStorageItemUpdated(storageId, key, oldValue, value)
     {
-        WebInspector.storageManager.itemUpdated(storageId, key, oldValue, value);
+        WI.storageManager.itemUpdated(storageId, key, oldValue, value);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/DatabaseObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/DatabaseObserver.js
index 2efd6e9..11ce6ff 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/DatabaseObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/DatabaseObserver.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseObserver = class DatabaseObserver
+WI.DatabaseObserver = class DatabaseObserver
 {
     // Events defined by the "Database" domain.
 
     addDatabase(database)
     {
-        WebInspector.storageManager.databaseWasAdded(database.id, database.domain, database.name, database.version);
+        WI.storageManager.databaseWasAdded(database.id, database.domain, database.name, database.version);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js
index 8dbd536..214fe2b 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerObserver = class DebuggerObserver
+WI.DebuggerObserver = class DebuggerObserver
 {
     constructor()
     {
@@ -34,7 +34,7 @@
 
     globalObjectCleared()
     {
-        WebInspector.debuggerManager.reset();
+        WI.debuggerManager.reset();
     }
 
     scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL, isModule)
@@ -46,11 +46,11 @@
             let legacySourceMapURL = arguments[7];
             let hasSourceURL = arguments[8];
             let legacySourceURL = hasSourceURL ? url : undefined;
-            WebInspector.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, legacySourceURL, legacySourceMapURL);
+            WI.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, legacySourceURL, legacySourceMapURL);
             return;
         }
 
-        WebInspector.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL);
+        WI.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL);
     }
 
     scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage)
@@ -60,26 +60,26 @@
 
     breakpointResolved(breakpointId, location)
     {
-        WebInspector.debuggerManager.breakpointResolved(this.target, breakpointId, location);
+        WI.debuggerManager.breakpointResolved(this.target, breakpointId, location);
     }
 
     paused(callFrames, reason, data, asyncStackTrace)
     {
-        WebInspector.debuggerManager.debuggerDidPause(this.target, callFrames, reason, data, asyncStackTrace);
+        WI.debuggerManager.debuggerDidPause(this.target, callFrames, reason, data, asyncStackTrace);
     }
 
     resumed()
     {
-        WebInspector.debuggerManager.debuggerDidResume(this.target);
+        WI.debuggerManager.debuggerDidResume(this.target);
     }
 
     playBreakpointActionSound(breakpointActionIdentifier)
     {
-        WebInspector.debuggerManager.playBreakpointActionSound(breakpointActionIdentifier);
+        WI.debuggerManager.playBreakpointActionSound(breakpointActionIdentifier);
     }
 
     didSampleProbe(sample)
     {
-        WebInspector.probeManager.didSampleProbe(this.target, sample);
+        WI.probeManager.didSampleProbe(this.target, sample);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js
index dab3076..828bf53 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js
@@ -23,30 +23,30 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapObserver = class HeapObserver
+WI.HeapObserver = class HeapObserver
 {
     // Events defined by the "Heap" domain.
 
     garbageCollected(collection)
     {
-        WebInspector.heapManager.garbageCollected(this.target, collection);
+        WI.heapManager.garbageCollected(this.target, collection);
     }
 
     trackingStart(timestamp, snapshotStringData)
     {
-        let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+        let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
         workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-            let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
-            WebInspector.timelineManager.heapTrackingStarted(timestamp, snapshot);
+            let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+            WI.timelineManager.heapTrackingStarted(timestamp, snapshot);
         });
     }
 
     trackingComplete(timestamp, snapshotStringData)
     {
-        let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+        let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
         workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-            let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
-            WebInspector.timelineManager.heapTrackingCompleted(timestamp, snapshot);
+            let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+            WI.timelineManager.heapTrackingCompleted(timestamp, snapshot);
         });
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js b/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
index 2bda4ae..eb76651 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
@@ -37,13 +37,13 @@
         this._agents = {};
 
         this._customTracer = null;
-        this._defaultTracer = new WebInspector.LoggingProtocolTracer;
+        this._defaultTracer = new WI.LoggingProtocolTracer;
         this._activeTracers = [this._defaultTracer];
 
         this._workerSupportedDomains = [];
 
-        WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed, this._startOrStopAutomaticTracing, this);
-        WebInspector.settings.autoLogTimeStats.addEventListener(WebInspector.Setting.Event.Changed, this._startOrStopAutomaticTracing, this);
+        WI.settings.autoLogProtocolMessages.addEventListener(WI.Setting.Event.Changed, this._startOrStopAutomaticTracing, this);
+        WI.settings.autoLogTimeStats.addEventListener(WI.Setting.Event.Changed, this._startOrStopAutomaticTracing, this);
         this._startOrStopAutomaticTracing();
 
         this.currentDispatchState = {
@@ -59,23 +59,23 @@
 
     // It's still possible to set this flag on InspectorBackend to just
     // dump protocol traffic as it happens. For more complex uses of
-    // protocol data, install a subclass of WebInspector.ProtocolTracer.
+    // protocol data, install a subclass of WI.ProtocolTracer.
     set dumpInspectorProtocolMessages(value)
     {
         // Implicitly cause automatic logging to start if it's allowed.
-        WebInspector.settings.autoLogProtocolMessages.value = value;
+        WI.settings.autoLogProtocolMessages.value = value;
 
         this._defaultTracer.dumpMessagesToConsole = value;
     }
 
     get dumpInspectorProtocolMessages()
     {
-        return WebInspector.settings.autoLogProtocolMessages.value;
+        return WI.settings.autoLogProtocolMessages.value;
     }
 
     set dumpInspectorTimeStats(value)
     {
-        WebInspector.settings.autoLogTimeStats.value = value;
+        WI.settings.autoLogTimeStats.value = value;
 
         if (!this.dumpInspectorProtocolMessages)
             this.dumpInspectorProtocolMessages = true;
@@ -85,12 +85,12 @@
 
     get dumpInspectorTimeStats()
     {
-        return WebInspector.settings.autoLogTimeStats.value;
+        return WI.settings.autoLogTimeStats.value;
     }
 
     set customTracer(tracer)
     {
-        console.assert(!tracer || tracer instanceof WebInspector.ProtocolTracer, tracer);
+        console.assert(!tracer || tracer instanceof WI.ProtocolTracer, tracer);
         console.assert(!tracer || tracer !== this._defaultTracer, tracer);
 
         // Bail early if no state change is to be made.
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js b/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
index 1bdcf17..2fa9816 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
@@ -39,45 +39,45 @@
 
     isTimelineProfilingEnabled: function()
     {
-        return WebInspector.timelineManager.isCapturing();
+        return WI.timelineManager.isCapturing();
     },
 
     setTimelineProfilingEnabled: function(enabled)
     {
-        if (WebInspector.timelineManager.isCapturing() === enabled)
+        if (WI.timelineManager.isCapturing() === enabled)
             return;
 
         if (enabled)
-            WebInspector.timelineManager.startCapturing();
+            WI.timelineManager.startCapturing();
         else
-            WebInspector.timelineManager.stopCapturing();
+            WI.timelineManager.stopCapturing();
     },
 
     setElementSelectionEnabled: function(enabled)
     {
-        WebInspector.domTreeManager.inspectModeEnabled = enabled;
+        WI.domTreeManager.inspectModeEnabled = enabled;
     },
 
     setDockingUnavailable: function(unavailable)
     {
-        WebInspector.updateDockingAvailability(!unavailable);
+        WI.updateDockingAvailability(!unavailable);
     },
 
     setDockSide: function(side)
     {
-        WebInspector.updateDockedState(side);
+        WI.updateDockedState(side);
     },
 
     setIsVisible: function(visible)
     {
-        WebInspector.updateVisibilityState(visible);
+        WI.updateVisibilityState(visible);
     },
 
     showConsole: function()
     {
-        WebInspector.showConsoleTab();
+        WI.showConsoleTab();
 
-        WebInspector.quickConsole.prompt.focus();
+        WI.quickConsole.prompt.focus();
 
         // If the page is still loading, focus the quick console again after tabindex autofocus.
         if (document.readyState !== "complete")
@@ -91,7 +91,7 @@
         console.assert(event.type === "readystatechange" || event.type === "visibilitychange");
 
         if (document.readyState === "complete" && document.visibilityState === "visible") {
-            WebInspector.quickConsole.prompt.focus();
+            WI.quickConsole.prompt.focus();
             document.removeEventListener("readystatechange", this);
             document.removeEventListener("visibilitychange", this);
         }
@@ -99,12 +99,12 @@
 
     showResources: function()
     {
-        WebInspector.showResourcesTab();
+        WI.showResourcesTab();
     },
 
     showTimelines: function()
     {
-        WebInspector.showTimelineTab();
+        WI.showTimelineTab();
     },
 
     showMainResourceForFrame: function(frameIdentifier)
@@ -113,13 +113,13 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        WebInspector.showSourceCodeForFrame(frameIdentifier, options);
+        WI.showSourceCodeForFrame(frameIdentifier, options);
     },
 
     contextMenuItemSelected: function(id)
     {
         try {
-            WebInspector.ContextMenu.contextMenuItemSelected(id);
+            WI.ContextMenu.contextMenuItemSelected(id);
         } catch (e) {
             console.error("Uncaught exception in inspector page under contextMenuItemSelected", e);
         }
@@ -127,12 +127,12 @@
 
     contextMenuCleared: function()
     {
-        WebInspector.ContextMenu.contextMenuCleared();
+        WI.ContextMenu.contextMenuCleared();
     },
 
     dispatchMessageAsync: function(messageObject)
     {
-        WebInspector.dispatchMessageFromBackend(messageObject);
+        WI.dispatchMessageFromBackend(messageObject);
     },
 
     dispatchMessage: function(messageObject)
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js
index cb8ec50..6acc88b 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.InspectorObserver = class InspectorObserver
+WI.InspectorObserver = class InspectorObserver
 {
     // Events defined by the "Inspector" domain.
 
@@ -39,16 +39,16 @@
 
     inspect(payload, hints)
     {
-        let remoteObject = WebInspector.RemoteObject.fromPayload(payload, WebInspector.mainTarget);
+        let remoteObject = WI.RemoteObject.fromPayload(payload, WI.mainTarget);
         if (remoteObject.subtype === "node") {
-            WebInspector.domTreeManager.inspectNodeObject(remoteObject);
+            WI.domTreeManager.inspectNodeObject(remoteObject);
             return;
         }
 
         if (remoteObject.type === "function") {
             remoteObject.findFunctionSourceCodeLocation().then((sourceCodeLocation) => {
-                if (sourceCodeLocation instanceof WebInspector.SourceCodeLocation) {
-                    WebInspector.showSourceCodeLocation(sourceCodeLocation, {
+                if (sourceCodeLocation instanceof WI.SourceCodeLocation) {
+                    WI.showSourceCodeLocation(sourceCodeLocation, {
                         ignoreNetworkTab: true,
                         ignoreSearchTab: true,
                     });
@@ -59,15 +59,15 @@
         }
 
         if (hints.databaseId)
-            WebInspector.storageManager.inspectDatabase(hints.databaseId);
+            WI.storageManager.inspectDatabase(hints.databaseId);
         else if (hints.domStorageId)
-            WebInspector.storageManager.inspectDOMStorage(hints.domStorageId);
+            WI.storageManager.inspectDOMStorage(hints.domStorageId);
 
         remoteObject.release();
     }
 
     activateExtraDomains(domains)
     {
-        WebInspector.activateExtraDomains(domains);
+        WI.activateExtraDomains(domains);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js
index 0ac671b..cde62c1 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayerTreeObserver = class LayerTreeObserver
+WI.LayerTreeObserver = class LayerTreeObserver
 {
     // Events defined by the "LayerTree" domain.
 
     layerTreeDidChange()
     {
-        if (WebInspector.layerTreeManager.supported)
-            WebInspector.layerTreeManager.layerTreeDidChange();
+        if (WI.layerTreeManager.supported)
+            WI.layerTreeManager.layerTreeDidChange();
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/LoggingProtocolTracer.js b/Source/WebInspectorUI/UserInterface/Protocol/LoggingProtocolTracer.js
index c2c0fa6..471fb36 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/LoggingProtocolTracer.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/LoggingProtocolTracer.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LoggingProtocolTracer = class LoggingProtocolTracer extends WebInspector.ProtocolTracer
+WI.LoggingProtocolTracer = class LoggingProtocolTracer extends WI.ProtocolTracer
 {
     constructor()
     {
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js b/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js
index 9dc969f..95a8691 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js
@@ -23,34 +23,34 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MainTarget = class MainTarget extends WebInspector.Target
+WI.MainTarget = class MainTarget extends WI.Target
 {
     constructor(connection)
     {
-        super("main", "", WebInspector.Target.Type.Main, InspectorBackend.mainConnection);
+        super("main", "", WI.Target.Type.Main, InspectorBackend.mainConnection);
 
-        let displayName = WebInspector.debuggableType === WebInspector.DebuggableType.Web ? WebInspector.UIString("Main Frame") : this.displayName;
-        this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, displayName, true, null);
+        let displayName = WI.debuggableType === WI.DebuggableType.Web ? WI.UIString("Main Frame") : this.displayName;
+        this._executionContext = new WI.ExecutionContext(this, WI.RuntimeManager.TopLevelContextExecutionIdentifier, displayName, true, null);
     }
 
     // Protected (Target)
 
     get displayName()
     {
-        switch (WebInspector.debuggableType) {
-        case WebInspector.DebuggableType.Web:
-            return WebInspector.UIString("Page");
-        case WebInspector.DebuggableType.JavaScript:
-            return WebInspector.UIString("JavaScript Context");
+        switch (WI.debuggableType) {
+        case WI.DebuggableType.Web:
+            return WI.UIString("Page");
+        case WI.DebuggableType.JavaScript:
+            return WI.UIString("JavaScript Context");
         default:
-            console.error("Unexpected debuggable type: ", WebInspector.debuggableType);
-            return WebInspector.UIString("Main");
+            console.error("Unexpected debuggable type: ", WI.debuggableType);
+            return WI.UIString("Main");
         }
     }
 
     get mainResource()
     {
-        let mainFrame = WebInspector.frameResourceManager.mainFrame;
+        let mainFrame = WI.frameResourceManager.mainFrame;
         return mainFrame ? mainFrame.mainResource : null;
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js
index 1b0b475..7e1d326 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js
@@ -23,27 +23,27 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryObserver = class MemoryObserver
+WI.MemoryObserver = class MemoryObserver
 {
     // Events defined by the "Memory" domain.
 
     memoryPressure(timestamp, severity)
     {
-        WebInspector.memoryManager.memoryPressure(timestamp, severity);
+        WI.memoryManager.memoryPressure(timestamp, severity);
     }
 
     trackingStart(timestamp)
     {
-        WebInspector.timelineManager.memoryTrackingStart(timestamp);
+        WI.timelineManager.memoryTrackingStart(timestamp);
     }
 
     trackingUpdate(event)
     {
-        WebInspector.timelineManager.memoryTrackingUpdate(event);
+        WI.timelineManager.memoryTrackingUpdate(event);
     }
 
     trackingComplete()
     {
-        WebInspector.timelineManager.memoryTrackingComplete();
+        WI.timelineManager.memoryTrackingComplete();
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js b/Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js
index 65ebb49..dead6c9 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js
@@ -24,41 +24,41 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector._messagesToDispatch = [];
+WI._messagesToDispatch = [];
 
-WebInspector.dispatchNextQueuedMessageFromBackend = function()
+WI.dispatchNextQueuedMessageFromBackend = function()
 {
-    const startCount = WebInspector._messagesToDispatch.length;
+    const startCount = WI._messagesToDispatch.length;
     const startTimestamp = performance.now();
     const timeLimitPerRunLoop = 10; // milliseconds
 
     let i = 0;
-    for (; i < WebInspector._messagesToDispatch.length; ++i) {
+    for (; i < WI._messagesToDispatch.length; ++i) {
         // Defer remaining messages if we have taken too long. In practice, single
         // messages like Page.getResourceContent blow through the time budget.
         if (performance.now() - startTimestamp > timeLimitPerRunLoop)
             break;
 
-        InspectorBackend.dispatch(WebInspector._messagesToDispatch[i]);
+        InspectorBackend.dispatch(WI._messagesToDispatch[i]);
     }
 
-    if (i === WebInspector._messagesToDispatch.length) {
-        WebInspector._messagesToDispatch = [];
-        WebInspector._dispatchTimeout = null;
+    if (i === WI._messagesToDispatch.length) {
+        WI._messagesToDispatch = [];
+        WI._dispatchTimeout = null;
     } else {
-        WebInspector._messagesToDispatch = WebInspector._messagesToDispatch.slice(i);
-        WebInspector._dispatchTimeout = setTimeout(WebInspector.dispatchNextQueuedMessageFromBackend, 0);
+        WI._messagesToDispatch = WI._messagesToDispatch.slice(i);
+        WI._dispatchTimeout = setTimeout(WI.dispatchNextQueuedMessageFromBackend, 0);
     }
 
     if (InspectorBackend.dumpInspectorTimeStats) {
         let messageDuration = (performance.now() - startTimestamp).toFixed(3);
-        let dispatchedCount = startCount - WebInspector._messagesToDispatch.length;
-        let remainingCount = WebInspector._messagesToDispatch.length;
+        let dispatchedCount = startCount - WI._messagesToDispatch.length;
+        let remainingCount = WI._messagesToDispatch.length;
         console.log(`time-stats: --- RunLoop duration: ${messageDuration}ms; dispatched: ${dispatchedCount}; remaining: ${remainingCount}`);
     }
 };
 
-WebInspector.dispatchMessageFromBackend = function(message)
+WI.dispatchMessageFromBackend = function(message)
 {
     // Enforce asynchronous interaction between the backend and the frontend by queueing messages.
     // The messages are dequeued on a zero delay timeout.
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
index 1089fc6..ab05456 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
@@ -23,74 +23,74 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkObserver = class NetworkObserver
+WI.NetworkObserver = class NetworkObserver
 {
     // Events defined by the "Network" domain.
 
     requestWillBeSent(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type, targetId)
     {
-        WebInspector.frameResourceManager.resourceRequestWillBeSent(requestId, frameId, loaderId, request, type, redirectResponse, timestamp, initiator, targetId);
+        WI.frameResourceManager.resourceRequestWillBeSent(requestId, frameId, loaderId, request, type, redirectResponse, timestamp, initiator, targetId);
     }
 
     requestServedFromCache(requestId)
     {
         // COMPATIBILITY (iOS 10.3): The backend no longer sends this.
-        WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);
+        WI.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);
     }
 
     responseReceived(requestId, frameId, loaderId, timestamp, type, response)
     {
-        WebInspector.frameResourceManager.resourceRequestDidReceiveResponse(requestId, frameId, loaderId, type, response, timestamp);
+        WI.frameResourceManager.resourceRequestDidReceiveResponse(requestId, frameId, loaderId, type, response, timestamp);
     }
 
     dataReceived(requestId, timestamp, dataLength, encodedDataLength)
     {
-        WebInspector.frameResourceManager.resourceRequestDidReceiveData(requestId, dataLength, encodedDataLength, timestamp);
+        WI.frameResourceManager.resourceRequestDidReceiveData(requestId, dataLength, encodedDataLength, timestamp);
     }
 
     loadingFinished(requestId, timestamp, sourceMapURL, metrics)
     {
-        WebInspector.frameResourceManager.resourceRequestDidFinishLoading(requestId, timestamp, sourceMapURL, metrics);
+        WI.frameResourceManager.resourceRequestDidFinishLoading(requestId, timestamp, sourceMapURL, metrics);
     }
 
     loadingFailed(requestId, timestamp, errorText, canceled)
     {
-        WebInspector.frameResourceManager.resourceRequestDidFailLoading(requestId, canceled, timestamp, errorText);
+        WI.frameResourceManager.resourceRequestDidFailLoading(requestId, canceled, timestamp, errorText);
     }
 
     requestServedFromMemoryCache(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource)
     {
-        WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId, frameId, loaderId, resource, timestamp, initiator);
+        WI.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId, frameId, loaderId, resource, timestamp, initiator);
     }
 
     webSocketCreated(requestId, url)
     {
-        WebInspector.frameResourceManager.webSocketCreated(requestId, url);
+        WI.frameResourceManager.webSocketCreated(requestId, url);
     }
 
     webSocketWillSendHandshakeRequest(requestId, timestamp, walltime, request)
     {
-        WebInspector.frameResourceManager.webSocketWillSendHandshakeRequest(requestId, timestamp, walltime, request);
+        WI.frameResourceManager.webSocketWillSendHandshakeRequest(requestId, timestamp, walltime, request);
     }
 
     webSocketHandshakeResponseReceived(requestId, timestamp, response)
     {
-        WebInspector.frameResourceManager.webSocketHandshakeResponseReceived(requestId, timestamp, response);
+        WI.frameResourceManager.webSocketHandshakeResponseReceived(requestId, timestamp, response);
     }
 
     webSocketClosed(requestId, timestamp)
     {
-        WebInspector.frameResourceManager.webSocketClosed(requestId, timestamp);
+        WI.frameResourceManager.webSocketClosed(requestId, timestamp);
     }
 
     webSocketFrameReceived(requestId, timestamp, response)
     {
-        WebInspector.frameResourceManager.webSocketFrameReceived(requestId, timestamp, response);
+        WI.frameResourceManager.webSocketFrameReceived(requestId, timestamp, response);
     }
 
     webSocketFrameSent(requestId, timestamp, response)
     {
-        WebInspector.frameResourceManager.webSocketFrameSent(requestId, timestamp, response);
+        WI.frameResourceManager.webSocketFrameSent(requestId, timestamp, response);
     }
 
     webSocketFrameError(requestId, timestamp, errorMessage)
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
index c136e53..0572cb4 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
@@ -23,28 +23,28 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PageObserver = class PageObserver
+WI.PageObserver = class PageObserver
 {
     // Events defined by the "Page" domain.
 
     domContentEventFired(timestamp)
     {
-        WebInspector.timelineManager.pageDOMContentLoadedEventFired(timestamp);
+        WI.timelineManager.pageDOMContentLoadedEventFired(timestamp);
     }
 
     loadEventFired(timestamp)
     {
-        WebInspector.timelineManager.pageLoadEventFired(timestamp);
+        WI.timelineManager.pageLoadEventFired(timestamp);
     }
 
     frameNavigated(frame, loaderId)
     {
-        WebInspector.frameResourceManager.frameDidNavigate(frame, loaderId);
+        WI.frameResourceManager.frameDidNavigate(frame, loaderId);
     }
 
     frameDetached(frameId)
     {
-        WebInspector.frameResourceManager.frameDidDetach(frameId);
+        WI.frameResourceManager.frameDidDetach(frameId);
     }
 
     frameStartedLoading(frameId)
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/ProtocolTracer.js b/Source/WebInspectorUI/UserInterface/Protocol/ProtocolTracer.js
index 5d542c5..d8f8600 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/ProtocolTracer.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/ProtocolTracer.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProtocolTracer = class ProtocolTracer
+WI.ProtocolTracer = class ProtocolTracer
 {
     // Public
 
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js b/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
index 02e326b..8c17c87 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
@@ -29,15 +29,15 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RemoteObject = class RemoteObject
+WI.RemoteObject = class RemoteObject
 {
     constructor(target, objectId, type, subtype, value, description, size, classPrototype, className, preview)
     {
         console.assert(type);
-        console.assert(!preview || preview instanceof WebInspector.ObjectPreview);
-        console.assert(!target || target instanceof WebInspector.Target);
+        console.assert(!preview || preview instanceof WI.ObjectPreview);
+        console.assert(!target || target instanceof WI.Target);
 
-        this._target = target || WebInspector.mainTarget;
+        this._target = target || WI.mainTarget;
         this._type = type;
         this._subtype = subtype;
 
@@ -73,12 +73,12 @@
 
     static createFakeRemoteObject()
     {
-        return new WebInspector.RemoteObject(undefined, WebInspector.RemoteObject.FakeRemoteObjectId, "object");
+        return new WI.RemoteObject(undefined, WI.RemoteObject.FakeRemoteObjectId, "object");
     }
 
     static fromPrimitiveValue(value)
     {
-        return new WebInspector.RemoteObject(undefined, undefined, typeof value, undefined, value, undefined, undefined, undefined, undefined);
+        return new WI.RemoteObject(undefined, undefined, typeof value, undefined, value, undefined, undefined, undefined, undefined);
     }
 
     static fromPayload(payload, target)
@@ -96,7 +96,7 @@
         }
 
         if (payload.classPrototype)
-            payload.classPrototype = WebInspector.RemoteObject.fromPayload(payload.classPrototype, target);
+            payload.classPrototype = WI.RemoteObject.fromPayload(payload.classPrototype, target);
 
         if (payload.preview) {
             // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on
@@ -108,15 +108,15 @@
                 payload.preview.size = payload.size;
             }
 
-            payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview);
+            payload.preview = WI.ObjectPreview.fromPayload(payload.preview);
         }
 
-        return new WebInspector.RemoteObject(target, payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.classPrototype, payload.className, payload.preview);
+        return new WI.RemoteObject(target, payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.classPrototype, payload.className, payload.preview);
     }
 
     static createCallArgument(valueOrObject)
     {
-        if (valueOrObject instanceof WebInspector.RemoteObject) {
+        if (valueOrObject instanceof WI.RemoteObject) {
             if (valueOrObject.objectId)
                 return {objectId: valueOrObject.objectId};
             return {value: valueOrObject.value};
@@ -134,7 +134,7 @@
             if (error || !object)
                 callback(null);
             else
-                callback(WebInspector.RemoteObject.fromPayload(object, WebInspector.mainTarget));
+                callback(WI.RemoteObject.fromPayload(object, WI.mainTarget));
         });
     }
 
@@ -146,7 +146,7 @@
             if (error || !object)
                 callback(null);
             else
-                callback(WebInspector.RemoteObject.fromPayload(object, webSocketResource.target));
+                callback(WI.RemoteObject.fromPayload(object, webSocketResource.target));
         });
     }
 
@@ -158,7 +158,7 @@
             if (error || !object)
                 callback(null);
             else
-                callback(WebInspector.RemoteObject.fromPayload(object, WebInspector.mainTarget));
+                callback(WI.RemoteObject.fromPayload(object, WI.mainTarget));
         });
     }
 
@@ -265,7 +265,7 @@
                 return;
             }
 
-            this._preview = WebInspector.ObjectPreview.fromPayload(payload);
+            this._preview = WI.ObjectPreview.fromPayload(payload);
             callback(this._preview);
         });
     }
@@ -449,7 +449,7 @@
         let objectGroup = this.isWeakCollection() ? this._weakCollectionObjectGroup() : "";
 
         this._target.RuntimeAgent.getCollectionEntries(this._objectId, objectGroup, start, numberToFetch, (error, entries) => {
-            entries = entries.map((x) => WebInspector.CollectionEntry.fromPayload(x, this._target));
+            entries = entries.map((x) => WI.CollectionEntry.fromPayload(x, this._target));
             callback(entries);
         });
     }
@@ -464,7 +464,7 @@
     pushNodeToFrontend(callback)
     {
         if (this._objectId)
-            WebInspector.domTreeManager.pushNodeToFrontend(this._objectId, callback);
+            WI.domTreeManager.pushNodeToFrontend(this._objectId, callback);
         else
             callback(0);
     }
@@ -482,14 +482,14 @@
     {
         function mycallback(error, result, wasThrown)
         {
-            result = result ? WebInspector.RemoteObject.fromPayload(result, this._target) : null;
+            result = result ? WI.RemoteObject.fromPayload(result, this._target) : null;
 
             if (callback && typeof callback === "function")
                 callback(error, result, wasThrown);
         }
 
         if (args)
-            args = args.map(WebInspector.RemoteObject.createCallArgument);
+            args = args.map(WI.RemoteObject.createCallArgument);
 
         this._target.RuntimeAgent.callFunctionOn(this._objectId, appendWebInspectorSourceURL(functionDeclaration.toString()), args, true, undefined, !!generatePreview, mycallback.bind(this));
     }
@@ -506,7 +506,7 @@
 
     invokeGetter(getterRemoteObject, callback)
     {
-        console.assert(getterRemoteObject instanceof WebInspector.RemoteObject);
+        console.assert(getterRemoteObject instanceof WI.RemoteObject);
 
         function backendInvokeGetter(getter)
         {
@@ -525,13 +525,13 @@
 
         function wrappedCallback(error, result, wasThrown)
         {
-            if (error || wasThrown || !(result instanceof WebInspector.RemoteObject)) {
+            if (error || wasThrown || !(result instanceof WI.RemoteObject)) {
                 callback(null);
                 return;
             }
 
             var fakeDescriptor = {name: propertyName, value: result, writable: true, configurable: true, enumerable: false};
-            var fakePropertyDescriptor = new WebInspector.PropertyDescriptor(fakeDescriptor, null, true, false, false, false);
+            var fakePropertyDescriptor = new WI.PropertyDescriptor(fakeDescriptor, null, true, false, false, false);
             callback(fakePropertyDescriptor);
         }
 
@@ -559,15 +559,15 @@
 
     asCallArgument()
     {
-        return WebInspector.RemoteObject.createCallArgument(this);
+        return WI.RemoteObject.createCallArgument(this);
     }
 
     findFunctionSourceCodeLocation()
     {
-        var result = new WebInspector.WrappedPromise;
+        var result = new WI.WrappedPromise;
 
         if (!this._isFunction() || !this._objectId) {
-            result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId);
+            result.resolve(WI.RemoteObject.SourceCodeLocationPromise.MissingObjectId);
             return result.promise;
         }
 
@@ -578,10 +578,10 @@
             }
 
             var location = response.location;
-            var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId, this._target);
+            var sourceCode = WI.debuggerManager.scriptForIdentifier(location.scriptId, this._target);
 
-            if (!sourceCode || (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCode.sourceURL))) {
-                result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound);
+            if (!sourceCode || (!WI.isDebugUIEnabled() && isWebKitInternalScript(sourceCode.sourceURL))) {
+                result.resolve(WI.RemoteObject.SourceCodeLocationPromise.NoSourceFound);
                 return;
             }
 
@@ -596,7 +596,7 @@
 
     _isFakeObject()
     {
-        return this._objectId === WebInspector.RemoteObject.FakeRemoteObjectId;
+        return this._objectId === WI.RemoteObject.FakeRemoteObjectId;
     }
 
     _isSymbol()
@@ -645,12 +645,12 @@
         }
 
         let descriptors = properties.map((payload) => {
-            return WebInspector.PropertyDescriptor.fromPayload(payload, false, this._target);
+            return WI.PropertyDescriptor.fromPayload(payload, false, this._target);
         });
 
         if (internalProperties) {
             descriptors = descriptors.concat(internalProperties.map((payload) => {
-                return WebInspector.PropertyDescriptor.fromPayload(payload, true, this._target);
+                return WI.PropertyDescriptor.fromPayload(payload, true, this._target);
             }));
         }
 
@@ -690,26 +690,26 @@
             var property = properties[i];
             if (property.get || property.set) {
                 if (property.get)
-                    result.push(new WebInspector.DeprecatedRemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get, this._target), property));
+                    result.push(new WI.DeprecatedRemoteObjectProperty("get " + property.name, WI.RemoteObject.fromPayload(property.get, this._target), property));
                 if (property.set)
-                    result.push(new WebInspector.DeprecatedRemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set, this._target), property));
+                    result.push(new WI.DeprecatedRemoteObjectProperty("set " + property.name, WI.RemoteObject.fromPayload(property.set, this._target), property));
             } else
-                result.push(new WebInspector.DeprecatedRemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value, this._target), property));
+                result.push(new WI.DeprecatedRemoteObjectProperty(property.name, WI.RemoteObject.fromPayload(property.value, this._target), property));
         }
 
         callback(result);
     }
 };
 
-WebInspector.RemoteObject.FakeRemoteObjectId = "fake-remote-object";
+WI.RemoteObject.FakeRemoteObjectId = "fake-remote-object";
 
-WebInspector.RemoteObject.SourceCodeLocationPromise = {
+WI.RemoteObject.SourceCodeLocationPromise = {
     NoSourceFound: "remote-object-source-code-location-promise-no-source-found",
     MissingObjectId: "remote-object-source-code-location-promise-missing-object-id"
 };
 
 // FIXME: Phase out this deprecated class.
-WebInspector.DeprecatedRemoteObjectProperty = class DeprecatedRemoteObjectProperty
+WI.DeprecatedRemoteObjectProperty = class DeprecatedRemoteObjectProperty
 {
     constructor(name, value, descriptor)
     {
@@ -725,6 +725,6 @@
 
     fromPrimitiveValue(name, value)
     {
-        return new WebInspector.DeprecatedRemoteObjectProperty(name, WebInspector.RemoteObject.fromPrimitiveValue(value));
+        return new WI.DeprecatedRemoteObjectProperty(name, WI.RemoteObject.fromPrimitiveValue(value));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
index e09baa4..108bdfc 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RuntimeObserver = class RuntimeObserver
+WI.RuntimeObserver = class RuntimeObserver
 {
     // Events defined by the "Runtime" domain.
 
     executionContextCreated(contextPayload)
     {
-        WebInspector.frameResourceManager.executionContextCreated(contextPayload);
+        WI.frameResourceManager.executionContextCreated(contextPayload);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/ScriptProfilerObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/ScriptProfilerObserver.js
index 0d29954..f1b54cc 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/ScriptProfilerObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/ScriptProfilerObserver.js
@@ -23,32 +23,32 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptProfilerObserver = class ScriptProfilerObserver
+WI.ScriptProfilerObserver = class ScriptProfilerObserver
 {
     // Events defined by the "ScriptProfiler" domain.
 
     trackingStart(timestamp)
     {
-        WebInspector.timelineManager.scriptProfilerTrackingStarted(timestamp);
+        WI.timelineManager.scriptProfilerTrackingStarted(timestamp);
     }
 
     trackingUpdate(event)
     {
-        WebInspector.timelineManager.scriptProfilerTrackingUpdated(event);
+        WI.timelineManager.scriptProfilerTrackingUpdated(event);
     }
 
     trackingComplete(samples)
     {
-        WebInspector.timelineManager.scriptProfilerTrackingCompleted(samples);
+        WI.timelineManager.scriptProfilerTrackingCompleted(samples);
     }
 
     programmaticCaptureStarted()
     {
-        WebInspector.timelineManager.scriptProfilerProgrammaticCaptureStarted();
+        WI.timelineManager.scriptProfilerProgrammaticCaptureStarted();
     }
 
     programmaticCaptureStopped()
     {
-        WebInspector.timelineManager.scriptProfilerProgrammaticCaptureStopped();
+        WI.timelineManager.scriptProfilerProgrammaticCaptureStopped();
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/Target.js b/Source/WebInspectorUI/UserInterface/Protocol/Target.js
index ffc77b4..5c544e1 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/Target.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/Target.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Target = class Target extends WebInspector.Object
+WI.Target = class Target extends WI.Object
 {
     constructor(identifier, name, type, connection)
     {
@@ -35,8 +35,8 @@
         this._connection = connection;
         this._executionContext = null;
         this._mainResource = null;
-        this._resourceCollection = new WebInspector.ResourceCollection;
-        this._extraScriptCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);
+        this._resourceCollection = new WI.ResourceCollection;
+        this._extraScriptCollection = new WI.Collection(WI.Collection.TypeVerifier.Script);
 
         this._connection.target = this;
     }
@@ -66,7 +66,7 @@
     {
         this._resourceCollection.add(resource);
 
-        this.dispatchEventToListeners(WebInspector.Target.Event.ResourceAdded, {resource});
+        this.dispatchEventToListeners(WI.Target.Event.ResourceAdded, {resource});
     }
 
     adoptResource(resource)
@@ -80,16 +80,16 @@
     {
         this._extraScriptCollection.add(script);
 
-        this.dispatchEventToListeners(WebInspector.Target.Event.ScriptAdded, {script});
+        this.dispatchEventToListeners(WI.Target.Event.ScriptAdded, {script});
     }
 };
 
-WebInspector.Target.Type = {
+WI.Target.Type = {
     Main: Symbol("main"),
     Worker: Symbol("worker"),
 };
 
-WebInspector.Target.Event = {
+WI.Target.Event = {
     ResourceAdded: "target-resource-added",
     ScriptAdded: "target-script-added",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
index 99dfb97..ba9d019 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
@@ -23,37 +23,37 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineObserver = class TimelineObserver
+WI.TimelineObserver = class TimelineObserver
 {
     // Events defined by the "Timeline" domain.
 
     eventRecorded(record)
     {
-        WebInspector.timelineManager.eventRecorded(record);
+        WI.timelineManager.eventRecorded(record);
     }
 
     recordingStarted(startTime)
     {
-        WebInspector.timelineManager.capturingStarted(startTime);
+        WI.timelineManager.capturingStarted(startTime);
     }
 
     recordingStopped(endTime)
     {
-        WebInspector.timelineManager.capturingStopped(endTime);
+        WI.timelineManager.capturingStopped(endTime);
     }
 
     autoCaptureStarted()
     {
-        WebInspector.timelineManager.autoCaptureStarted();
+        WI.timelineManager.autoCaptureStarted();
     }
 
     programmaticCaptureStarted()
     {
-        WebInspector.timelineManager.programmaticCaptureStarted();
+        WI.timelineManager.programmaticCaptureStarted();
     }
 
     programmaticCaptureStopped()
     {
-        WebInspector.timelineManager.programmaticCaptureStopped();
+        WI.timelineManager.programmaticCaptureStopped();
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js
index 9a1a8db..45b9e61 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js
@@ -23,22 +23,22 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WorkerObserver = class WorkerObserver
+WI.WorkerObserver = class WorkerObserver
 {
     // Events defined by the "Worker" domain.
 
     workerCreated(workerId, url)
     {
-        WebInspector.workerManager.workerCreated(workerId, url);
+        WI.workerManager.workerCreated(workerId, url);
     }
 
     workerTerminated(workerId)
     {
-        WebInspector.workerManager.workerTerminated(workerId);
+        WI.workerManager.workerTerminated(workerId);
     }
 
     dispatchMessageFromWorker(workerId, message)
     {
-        WebInspector.workerManager.dispatchMessageFromWorker(workerId, message);
+        WI.workerManager.dispatchMessageFromWorker(workerId, message);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js b/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js
index fbafb8c..826d3be 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js
@@ -23,25 +23,25 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WorkerTarget = class WorkerTarget extends WebInspector.Target
+WI.WorkerTarget = class WorkerTarget extends WI.Target
 {
     constructor(workerId, name, connection)
     {
-        super(workerId, name, WebInspector.Target.Type.Worker, connection);
+        super(workerId, name, WI.Target.Type.Worker, connection);
 
-        WebInspector.frameResourceManager.adoptOrphanedResourcesForTarget(this);
+        WI.frameResourceManager.adoptOrphanedResourcesForTarget(this);
 
         if (this.RuntimeAgent) {
-            this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, this.displayName, false, null);
+            this._executionContext = new WI.ExecutionContext(this, WI.RuntimeManager.TopLevelContextExecutionIdentifier, this.displayName, false, null);
             this.RuntimeAgent.enable();
-            if (WebInspector.showJavaScriptTypeInformationSetting && WebInspector.showJavaScriptTypeInformationSetting.value)
+            if (WI.showJavaScriptTypeInformationSetting && WI.showJavaScriptTypeInformationSetting.value)
                 this.RuntimeAgent.enableTypeProfiler();
-            if (WebInspector.enableControlFlowProfilerSetting && WebInspector.enableControlFlowProfilerSetting.value)
+            if (WI.enableControlFlowProfilerSetting && WI.enableControlFlowProfilerSetting.value)
                 this.RuntimeAgent.enableControlFlowProfiler();
         }
 
         if (this.DebuggerAgent)
-            WebInspector.debuggerManager.initializeTarget(this);
+            WI.debuggerManager.initializeTarget(this);
 
         if (this.ConsoleAgent)
             this.ConsoleAgent.enable();
@@ -54,6 +54,6 @@
 
     get displayName()
     {
-        return WebInspector.displayNameForURL(this._name);
+        return WI.displayNameForURL(this._name);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js b/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js
index 7129cc1..fca1005 100644
--- a/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js
+++ b/Source/WebInspectorUI/UserInterface/Proxies/FormatterWorkerProxy.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FormatterWorkerProxy = class FormatterWorkerProxy
+WI.FormatterWorkerProxy = class FormatterWorkerProxy
 {
     constructor()
     {
diff --git a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js
index 0d7590f..7d07ef9 100644
--- a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js
+++ b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapSnapshotDiffProxy = class HeapSnapshotDiffProxy
+WI.HeapSnapshotDiffProxy = class HeapSnapshotDiffProxy
 {
     constructor(snapshotDiffObjectId, snapshot1, snapshot2, totalSize, totalObjectCount, categories)
     {
         this._proxyObjectId = snapshotDiffObjectId;
 
-        console.assert(snapshot1 instanceof WebInspector.HeapSnapshotProxy);
-        console.assert(snapshot2 instanceof WebInspector.HeapSnapshotProxy);
+        console.assert(snapshot1 instanceof WI.HeapSnapshotProxy);
+        console.assert(snapshot2 instanceof WI.HeapSnapshotProxy);
 
         this._snapshot1 = snapshot1;
         this._snapshot2 = snapshot2;
@@ -47,9 +47,9 @@
         // FIXME: The objectId for these snapshots is the snapshotDiff's objectId. Currently these
         // snapshots are only used for static data so the proxing doesn't matter. However,
         // should we serialize the objectId with the snapshot so we have the right objectId?
-        let snapshot1 = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot1);
-        let snapshot2 = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot2);
-        return new WebInspector.HeapSnapshotDiffProxy(objectId, snapshot1, snapshot2, totalSize, totalObjectCount, categories);
+        let snapshot1 = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot1);
+        let snapshot2 = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot2);
+        return new WI.HeapSnapshotDiffProxy(objectId, snapshot1, snapshot2, totalSize, totalObjectCount, categories);
     }
 
     // Public
@@ -68,28 +68,28 @@
             return;
 
         this.update(() => {
-            this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.CollectedNodes, event.data);
+            this.dispatchEventToListeners(WI.HeapSnapshotProxy.Event.CollectedNodes, event.data);
         });
     }
 
     allocationBucketCounts(bucketSizes, callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "allocationBucketCounts", bucketSizes, callback);
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "allocationBucketCounts", bucketSizes, callback);
     }
 
     instancesWithClassName(className, callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "instancesWithClassName", className, (serializedNodes) => {
-            callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "instancesWithClassName", className, (serializedNodes) => {
+            callback(serializedNodes.map(WI.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
         });
     }
 
     update(callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "update", ({liveSize, categories}) => {
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "update", ({liveSize, categories}) => {
             this._categories = Map.fromObject(categories);
             callback();
         });
@@ -98,8 +98,8 @@
     nodeWithIdentifier(nodeIdentifier, callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "nodeWithIdentifier", nodeIdentifier, (serializedNode) => {
-            callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, serializedNode));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "nodeWithIdentifier", nodeIdentifier, (serializedNode) => {
+            callback(WI.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, serializedNode));
         });
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotEdgeProxy.js b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotEdgeProxy.js
index e4d44b1..8d62c84 100644
--- a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotEdgeProxy.js
+++ b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotEdgeProxy.js
@@ -25,13 +25,13 @@
 
 // Directed edge between two HeapSnapshotNodes 'from' and 'to'.
 
-WebInspector.HeapSnapshotEdgeProxy = class HeapSnapshotEdgeProxy
+WI.HeapSnapshotEdgeProxy = class HeapSnapshotEdgeProxy
 {
     constructor(objectId, fromIdentifier, toIdentifier, type, data)
     {
         this._proxyObjectId = objectId;
 
-        console.assert(type in WebInspector.HeapSnapshotEdgeProxy.EdgeType);
+        console.assert(type in WI.HeapSnapshotEdgeProxy.EdgeType);
 
         this.fromIdentifier = fromIdentifier;
         this.toIdentifier = toIdentifier;
@@ -44,7 +44,7 @@
 
     isPrivateSymbol()
     {
-        if (WebInspector.isDebugUIEnabled())
+        if (WI.isDebugUIEnabled())
             return false;
 
         return typeof this.data === "string" && this.data.startsWith("PrivateSymbol");
@@ -55,11 +55,11 @@
     static deserialize(objectId, serializedEdge)
     {
         let {from, to, type, data} = serializedEdge;
-        return new WebInspector.HeapSnapshotEdgeProxy(objectId, from, to, type, data);
+        return new WI.HeapSnapshotEdgeProxy(objectId, from, to, type, data);
     }
 };
 
-WebInspector.HeapSnapshotEdgeProxy.EdgeType = {
+WI.HeapSnapshotEdgeProxy.EdgeType = {
     Internal: "Internal",       // No data.
     Property: "Property",       // data is string property name.
     Index: "Index",             // data is numeric index.
diff --git a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js
index 908400d..6e50452 100644
--- a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js
+++ b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapSnapshotNodeProxy = class HeapSnapshotNodeProxy
+WI.HeapSnapshotNodeProxy = class HeapSnapshotNodeProxy
 {
     constructor(snapshotObjectId, identifier, className, size, retainedSize, internal, gcRoot, dead, dominatorNodeIdentifier, hasChildren)
     {
@@ -45,24 +45,24 @@
     static deserialize(objectId, serializedNode)
     {
         let {id, className, size, retainedSize, internal, gcRoot, dead, dominatorNodeIdentifier, hasChildren} = serializedNode;
-        return new WebInspector.HeapSnapshotNodeProxy(objectId, id, className, size, retainedSize, internal, gcRoot, dead, dominatorNodeIdentifier, hasChildren);
+        return new WI.HeapSnapshotNodeProxy(objectId, id, className, size, retainedSize, internal, gcRoot, dead, dominatorNodeIdentifier, hasChildren);
     }
 
     // Proxied
 
     shortestGCRootPath(callback)
     {
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "shortestGCRootPath", this.id, (serializedPath) => {
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "shortestGCRootPath", this.id, (serializedPath) => {
             let isNode = false;
             let path = serializedPath.map((component) => {
                 isNode = !isNode;
                 if (isNode)
-                    return WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, component);
-                return WebInspector.HeapSnapshotEdgeProxy.deserialize(this._proxyObjectId, component);
+                    return WI.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, component);
+                return WI.HeapSnapshotEdgeProxy.deserialize(this._proxyObjectId, component);
             });
 
             for (let i = 1; i < path.length; i += 2) {
-                console.assert(path[i] instanceof WebInspector.HeapSnapshotEdgeProxy);
+                console.assert(path[i] instanceof WI.HeapSnapshotEdgeProxy);
                 let edge = path[i];
                 edge.from = path[i - 1];
                 edge.to = path[i + 1];
@@ -74,25 +74,25 @@
 
     dominatedNodes(callback)
     {
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "dominatedNodes", this.id, (serializedNodes) => {
-            callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "dominatedNodes", this.id, (serializedNodes) => {
+            callback(serializedNodes.map(WI.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
         });
     }
 
     retainedNodes(callback)
     {
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainedNodes", this.id, ({retainedNodes: serializedNodes, edges: serializedEdges}) => {
-            let deserializedNodes = serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId));
-            let deserializedEdges = serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null, this._proxyObjectId));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainedNodes", this.id, ({retainedNodes: serializedNodes, edges: serializedEdges}) => {
+            let deserializedNodes = serializedNodes.map(WI.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId));
+            let deserializedEdges = serializedEdges.map(WI.HeapSnapshotEdgeProxy.deserialize.bind(null, this._proxyObjectId));
             callback(deserializedNodes, deserializedEdges);
         });
     }
 
     retainers(callback)
     {
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainers", this.id, ({retainers: serializedNodes, edges: serializedEdges}) => {
-            let deserializedNodes = serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId));
-            let deserializedEdges = serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null, this._proxyObjectId));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainers", this.id, ({retainers: serializedNodes, edges: serializedEdges}) => {
+            let deserializedNodes = serializedNodes.map(WI.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId));
+            let deserializedEdges = serializedEdges.map(WI.HeapSnapshotEdgeProxy.deserialize.bind(null, this._proxyObjectId));
             callback(deserializedNodes, deserializedEdges);
         });
     }
diff --git a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js
index 1c8ed63..dce225e 100644
--- a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js
+++ b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapSnapshotProxy = class HeapSnapshotProxy extends WebInspector.Object
+WI.HeapSnapshotProxy = class HeapSnapshotProxy extends WI.Object
 {
     constructor(snapshotObjectId, identifier, title, totalSize, totalObjectCount, liveSize, categories)
     {
@@ -40,9 +40,9 @@
 
         console.assert(!this.invalid);
 
-        if (!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
-            WebInspector.HeapSnapshotProxy.ValidSnapshotProxies = [];
-        WebInspector.HeapSnapshotProxy.ValidSnapshotProxies.push(this);
+        if (!WI.HeapSnapshotProxy.ValidSnapshotProxies)
+            WI.HeapSnapshotProxy.ValidSnapshotProxies = [];
+        WI.HeapSnapshotProxy.ValidSnapshotProxies.push(this);
     }
 
     // Static
@@ -50,18 +50,18 @@
     static deserialize(objectId, serializedSnapshot)
     {
         let {identifier, title, totalSize, totalObjectCount, liveSize, categories} = serializedSnapshot;
-        return new WebInspector.HeapSnapshotProxy(objectId, identifier, title, totalSize, totalObjectCount, liveSize, categories);
+        return new WI.HeapSnapshotProxy(objectId, identifier, title, totalSize, totalObjectCount, liveSize, categories);
     }
 
     static invalidateSnapshotProxies()
     {
-        if (!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
+        if (!WI.HeapSnapshotProxy.ValidSnapshotProxies)
             return;
 
-        for (let snapshotProxy of WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
+        for (let snapshotProxy of WI.HeapSnapshotProxy.ValidSnapshotProxies)
             snapshotProxy._invalidate();
 
-        WebInspector.HeapSnapshotProxy.ValidSnapshotProxies = null;
+        WI.HeapSnapshotProxy.ValidSnapshotProxies = null;
     }
 
     // Public
@@ -82,28 +82,28 @@
             return;
 
         this.update(() => {
-            this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.CollectedNodes, event.data);
+            this.dispatchEventToListeners(WI.HeapSnapshotProxy.Event.CollectedNodes, event.data);
         });
     }
 
     allocationBucketCounts(bucketSizes, callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "allocationBucketCounts", bucketSizes, callback);
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "allocationBucketCounts", bucketSizes, callback);
     }
 
     instancesWithClassName(className, callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "instancesWithClassName", className, (serializedNodes) => {
-            callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "instancesWithClassName", className, (serializedNodes) => {
+            callback(serializedNodes.map(WI.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
         });
     }
 
     update(callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "update", ({liveSize, categories}) => {
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "update", ({liveSize, categories}) => {
             this._liveSize = liveSize;
             this._categories = Map.fromObject(categories);
             callback();
@@ -113,8 +113,8 @@
     nodeWithIdentifier(nodeIdentifier, callback)
     {
         console.assert(!this.invalid);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "nodeWithIdentifier", nodeIdentifier, (serializedNode) => {
-            callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, serializedNode));
+        WI.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "nodeWithIdentifier", nodeIdentifier, (serializedNode) => {
+            callback(WI.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, serializedNode));
         });
     }
 
@@ -125,11 +125,11 @@
         this._proxyObjectId = 0;
         this._liveSize = 0;
 
-        this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.Invalidated);
+        this.dispatchEventToListeners(WI.HeapSnapshotProxy.Event.Invalidated);
     }
 };
 
-WebInspector.HeapSnapshotProxy.Event = {
+WI.HeapSnapshotProxy.Event = {
     CollectedNodes: "heap-snapshot-proxy-collected-nodes",
     Invalidated: "heap-snapshot-proxy-invalidated",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js
index 4ff4525..4c51b4a 100644
--- a/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js
+++ b/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js
@@ -25,7 +25,7 @@
 
 // Events dispatched on this class: "HeapSnapshot.CollectionEvent"
 
-WebInspector.HeapSnapshotWorkerProxy = class HeapSnapshotWorkerProxy extends WebInspector.Object
+WI.HeapSnapshotWorkerProxy = class HeapSnapshotWorkerProxy extends WI.Object
 {
     constructor()
     {
@@ -37,7 +37,7 @@
         this._nextCallId = 1;
         this._callbacks = new Map;
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     }
 
     // Static
@@ -103,7 +103,7 @@
             return;
 
         this.clearSnapshots(() => {
-            WebInspector.HeapSnapshotProxy.invalidateSnapshotProxies();
+            WI.HeapSnapshotProxy.invalidateSnapshotProxies();
         });
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Test.html b/Source/WebInspectorUI/UserInterface/Test.html
index 813e55d..6a31845 100644
--- a/Source/WebInspectorUI/UserInterface/Test.html
+++ b/Source/WebInspectorUI/UserInterface/Test.html
@@ -211,7 +211,7 @@
     <script src="Views/CodeMirrorFormatters.js"></script>
 
     <script type="text/javascript">
-        WebInspector.loaded();
+        WI.loaded();
 
         // Debug logging is synchronous on the test page.
         InspectorTest.forceDebugLogging = false;
diff --git a/Source/WebInspectorUI/UserInterface/Test/Test.js b/Source/WebInspectorUI/UserInterface/Test/Test.js
index aaaff66..6f31b5d 100644
--- a/Source/WebInspectorUI/UserInterface/Test/Test.js
+++ b/Source/WebInspectorUI/UserInterface/Test/Test.js
@@ -23,51 +23,51 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggableType = {
+WI.DebuggableType = {
     Web: "web",
     JavaScript: "javascript"
 };
 
-WebInspector.loaded = function()
+WI.loaded = function()
 {
-    this.debuggableType = WebInspector.DebuggableType.Web;
+    this.debuggableType = WI.DebuggableType.Web;
     this.hasExtraDomains = false;
 
     // Register observers for events from the InspectorBackend.
     // The initialization order should match the same in Main.js.
-    InspectorBackend.registerInspectorDispatcher(new WebInspector.InspectorObserver);
-    InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);
-    InspectorBackend.registerConsoleDispatcher(new WebInspector.ConsoleObserver);
-    InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);
-    InspectorBackend.registerNetworkDispatcher(new WebInspector.NetworkObserver);
-    InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerObserver);
-    InspectorBackend.registerHeapDispatcher(new WebInspector.HeapObserver);
-    InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageObserver);
-    InspectorBackend.registerTimelineDispatcher(new WebInspector.TimelineObserver);
-    InspectorBackend.registerCSSDispatcher(new WebInspector.CSSObserver);
-    InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeObserver);
-    InspectorBackend.registerWorkerDispatcher(new WebInspector.WorkerObserver);
-    InspectorBackend.registerCanvasDispatcher(new WebInspector.CanvasObserver);
+    InspectorBackend.registerInspectorDispatcher(new WI.InspectorObserver);
+    InspectorBackend.registerPageDispatcher(new WI.PageObserver);
+    InspectorBackend.registerConsoleDispatcher(new WI.ConsoleObserver);
+    InspectorBackend.registerDOMDispatcher(new WI.DOMObserver);
+    InspectorBackend.registerNetworkDispatcher(new WI.NetworkObserver);
+    InspectorBackend.registerDebuggerDispatcher(new WI.DebuggerObserver);
+    InspectorBackend.registerHeapDispatcher(new WI.HeapObserver);
+    InspectorBackend.registerDOMStorageDispatcher(new WI.DOMStorageObserver);
+    InspectorBackend.registerTimelineDispatcher(new WI.TimelineObserver);
+    InspectorBackend.registerCSSDispatcher(new WI.CSSObserver);
+    InspectorBackend.registerRuntimeDispatcher(new WI.RuntimeObserver);
+    InspectorBackend.registerWorkerDispatcher(new WI.WorkerObserver);
+    InspectorBackend.registerCanvasDispatcher(new WI.CanvasObserver);
 
-    WebInspector.mainTarget = new WebInspector.MainTarget;
+    WI.mainTarget = new WI.MainTarget;
 
     // Instantiate controllers used by tests.
-    this.targetManager = new WebInspector.TargetManager;
-    this.frameResourceManager = new WebInspector.FrameResourceManager;
-    this.storageManager = new WebInspector.StorageManager;
-    this.domTreeManager = new WebInspector.DOMTreeManager;
-    this.cssStyleManager = new WebInspector.CSSStyleManager;
-    this.logManager = new WebInspector.LogManager;
-    this.issueManager = new WebInspector.IssueManager;
-    this.runtimeManager = new WebInspector.RuntimeManager;
-    this.heapManager = new WebInspector.HeapManager;
-    this.memoryManager = new WebInspector.MemoryManager;
-    this.timelineManager = new WebInspector.TimelineManager;
-    this.debuggerManager = new WebInspector.DebuggerManager;
-    this.probeManager = new WebInspector.ProbeManager;
-    this.workerManager = new WebInspector.WorkerManager;
-    this.domDebuggerManager = new WebInspector.DOMDebuggerManager;
-    this.canvasManager = new WebInspector.CanvasManager;
+    this.targetManager = new WI.TargetManager;
+    this.frameResourceManager = new WI.FrameResourceManager;
+    this.storageManager = new WI.StorageManager;
+    this.domTreeManager = new WI.DOMTreeManager;
+    this.cssStyleManager = new WI.CSSStyleManager;
+    this.logManager = new WI.LogManager;
+    this.issueManager = new WI.IssueManager;
+    this.runtimeManager = new WI.RuntimeManager;
+    this.heapManager = new WI.HeapManager;
+    this.memoryManager = new WI.MemoryManager;
+    this.timelineManager = new WI.TimelineManager;
+    this.debuggerManager = new WI.DebuggerManager;
+    this.probeManager = new WI.ProbeManager;
+    this.workerManager = new WI.WorkerManager;
+    this.domDebuggerManager = new WI.DOMDebuggerManager;
+    this.canvasManager = new WI.CanvasManager;
 
     document.addEventListener("DOMContentLoaded", this.contentLoaded);
 
@@ -76,13 +76,13 @@
     ConsoleAgent.enable();
 
     // Perform one-time tasks.
-    WebInspector.CSSCompletions.requestCSSCompletions();
+    WI.CSSCompletions.requestCSSCompletions();
 
     // Global settings.
-    this.showShadowDOMSetting = new WebInspector.Setting("show-shadow-dom", true);
+    this.showShadowDOMSetting = new WI.Setting("show-shadow-dom", true);
 };
 
-WebInspector.contentLoaded = function()
+WI.contentLoaded = function()
 {
     // Signal that the frontend is now ready to receive messages.
     InspectorFrontendAPI.loadCompleted();
@@ -92,30 +92,30 @@
     InspectorFrontendHost.loaded();
 };
 
-Object.defineProperty(WebInspector, "targets",
+Object.defineProperty(WI, "targets",
 {
     get() { return this.targetManager.targets; }
 });
 
-WebInspector.assumingMainTarget = () => WebInspector.mainTarget;
+WI.assumingMainTarget = () => WI.mainTarget;
 
-WebInspector.isDebugUIEnabled = () => false;
+WI.isDebugUIEnabled = () => false;
 
-WebInspector.unlocalizedString = (string) => string;
-WebInspector.UIString = (string) => string;
+WI.unlocalizedString = (string) => string;
+WI.UIString = (string) => string;
 
-WebInspector.indentString = () => "    ";
+WI.indentString = () => "    ";
 
 // Add stubs that are called by the frontend API.
-WebInspector.updateDockedState = () => {};
-WebInspector.updateDockingAvailability = () => {};
-WebInspector.updateVisibilityState = () => {};
+WI.updateDockedState = () => {};
+WI.updateDockingAvailability = () => {};
+WI.updateVisibilityState = () => {};
 
 window.InspectorTest = new FrontendTestHarness();
 
 InspectorTest.redirectConsoleToTestOutput();
 
-WebInspector.reportInternalError = (e) => { console.error(e); };
+WI.reportInternalError = (e) => { console.error(e); };
 
 window.reportUnhandledRejection = InspectorTest.reportUnhandledRejection.bind(InspectorTest);
 window.onerror = InspectorTest.reportUncaughtExceptionFromEvent.bind(InspectorTest);
diff --git a/Source/WebInspectorUI/UserInterface/Test/TestHarness.js b/Source/WebInspectorUI/UserInterface/Test/TestHarness.js
index 53bee4a..407cca4 100644
--- a/Source/WebInspectorUI/UserInterface/Test/TestHarness.js
+++ b/Source/WebInspectorUI/UserInterface/Test/TestHarness.js
@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-TestHarness = class TestHarness extends WebInspector.Object
+TestHarness = class TestHarness extends WI.Object
 {
     constructor()
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js
index 731c359..81f7dea 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ActivateButtonNavigationItem = class ActivateButtonNavigationItem extends WebInspector.ButtonNavigationItem
+WI.ActivateButtonNavigationItem = class ActivateButtonNavigationItem extends WI.ButtonNavigationItem
 {
     constructor(identifier, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight, role)
     {
@@ -48,12 +48,12 @@
 
     get activated()
     {
-        return this.element.classList.contains(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName);
+        return this.element.classList.contains(WI.ActivateButtonNavigationItem.ActivatedStyleClassName);
     }
 
     set activated(flag)
     {
-        this.element.classList.toggle(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName, flag);
+        this.element.classList.toggle(WI.ActivateButtonNavigationItem.ActivatedStyleClassName, flag);
 
         if (flag) {
             this.toolTip = this._activatedToolTip;
@@ -74,4 +74,4 @@
     }
 };
 
-WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName = "activated";
+WI.ActivateButtonNavigationItem.ActivatedStyleClassName = "activated";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js b/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js
index 2d8a747..7481e59 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ActivateButtonToolbarItem = class ActivateButtonToolbarItem extends WebInspector.ActivateButtonNavigationItem
+WI.ActivateButtonToolbarItem = class ActivateButtonToolbarItem extends WI.ActivateButtonNavigationItem
 {
     constructor(identifier, defaultToolTip, activatedToolTip, label, image, role)
     {
@@ -31,7 +31,7 @@
 
         if (typeof label === "string") {
             this._labelElement = document.createElement("div");
-            this._labelElement.className = WebInspector.ButtonToolbarItem.LabelStyleClassName;
+            this._labelElement.className = WI.ButtonToolbarItem.LabelStyleClassName;
             this._element.appendChild(this._labelElement);
 
             this.label = label;
diff --git a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js
index 17ae359..27de53d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheDetailsSidebarPanel = class ApplicationCacheDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.ApplicationCacheDetailsSidebarPanel = class ApplicationCacheDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("application-cache-details", WebInspector.UIString("Storage"));
+        super("application-cache-details", WI.UIString("Storage"));
 
         this.element.classList.add("application-cache");
 
@@ -44,9 +44,9 @@
 
         var applicationCacheFrameToInspect = null;
 
-        // Iterate over the objects to find a WebInspector.ApplicationCacheFrame to inspect.
+        // Iterate over the objects to find a WI.ApplicationCacheFrame to inspect.
         for (var i = 0; i < objects.length; ++i) {
-            if (objects[i] instanceof WebInspector.ApplicationCacheFrame) {
+            if (objects[i] instanceof WI.ApplicationCacheFrame) {
                 applicationCacheFrameToInspect = objects[i];
                 break;
             }
@@ -78,23 +78,23 @@
     {
         super.initialLayout();
 
-        this._locationManifestURLRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Manifest URL"));
-        this._locationFrameURLRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Frame URL"));
+        this._locationManifestURLRow = new WI.DetailsSectionSimpleRow(WI.UIString("Manifest URL"));
+        this._locationFrameURLRow = new WI.DetailsSectionSimpleRow(WI.UIString("Frame URL"));
 
-        let locationGroup = new WebInspector.DetailsSectionGroup([this._locationManifestURLRow, this._locationFrameURLRow]);
-        let locationSection = new WebInspector.DetailsSection("application-cache-location", WebInspector.UIString("Location"), [locationGroup]);
+        let locationGroup = new WI.DetailsSectionGroup([this._locationManifestURLRow, this._locationFrameURLRow]);
+        let locationSection = new WI.DetailsSection("application-cache-location", WI.UIString("Location"), [locationGroup]);
 
-        this._onlineRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Online"));
-        this._statusRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Status"));
+        this._onlineRow = new WI.DetailsSectionSimpleRow(WI.UIString("Online"));
+        this._statusRow = new WI.DetailsSectionSimpleRow(WI.UIString("Status"));
 
-        let statusGroup = new WebInspector.DetailsSectionGroup([this._onlineRow, this._statusRow]);
-        let statusSection = new WebInspector.DetailsSection("application-cache-status", WebInspector.UIString("Status"), [statusGroup]);
+        let statusGroup = new WI.DetailsSectionGroup([this._onlineRow, this._statusRow]);
+        let statusSection = new WI.DetailsSection("application-cache-status", WI.UIString("Status"), [statusGroup]);
 
         this.contentView.element.appendChild(locationSection.element);
         this.contentView.element.appendChild(statusSection.element);
 
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.NetworkStateUpdated, this._networkStateUpdated, this);
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged, this._frameManifestStatusChanged, this);
+        WI.applicationCacheManager.addEventListener(WI.ApplicationCacheManager.Event.NetworkStateUpdated, this._networkStateUpdated, this);
+        WI.applicationCacheManager.addEventListener(WI.ApplicationCacheManager.Event.FrameManifestStatusChanged, this._frameManifestStatusChanged, this);
     }
 
     layout()
@@ -126,7 +126,7 @@
         if (!this.applicationCacheFrame)
             return;
 
-        console.assert(event.data.frameManifest instanceof WebInspector.ApplicationCacheFrame);
+        console.assert(event.data.frameManifest instanceof WI.ApplicationCacheFrame);
         if (event.data.frameManifest !== this.applicationCacheFrame)
             return;
 
@@ -135,17 +135,17 @@
 
     _refreshOnlineRow()
     {
-        this._onlineRow.value = WebInspector.applicationCacheManager.online ? WebInspector.UIString("Yes") : WebInspector.UIString("No");
+        this._onlineRow.value = WI.applicationCacheManager.online ? WI.UIString("Yes") : WI.UIString("No");
     }
 
     _refreshStatusRow()
     {
-        this._statusRow.value = WebInspector.ApplicationCacheDetailsSidebarPanel.Status[this.applicationCacheFrame.status];
+        this._statusRow.value = WI.ApplicationCacheDetailsSidebarPanel.Status[this.applicationCacheFrame.status];
     }
 };
 
 // This needs to be kept in sync with ApplicationCacheManager.js.
-WebInspector.ApplicationCacheDetailsSidebarPanel.Status = {
+WI.ApplicationCacheDetailsSidebarPanel.Status = {
     0: "Uncached",
     1: "Idle",
     2: "Checking",
diff --git a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
index 09ad392..a662ef6 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheFrameContentView = class ApplicationCacheFrameContentView extends WebInspector.ContentView
+WI.ApplicationCacheFrameContentView = class ApplicationCacheFrameContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.ApplicationCacheFrame);
+        console.assert(representedObject instanceof WI.ApplicationCacheFrame);
 
         super(representedObject);
 
@@ -35,7 +35,7 @@
 
         this._frame = representedObject.frame;
 
-        this._emptyView = WebInspector.createMessageTextView(WebInspector.UIString("No Application Cache information available"), false);
+        this._emptyView = WI.createMessageTextView(WI.UIString("No Application Cache information available"), false);
         this._emptyView.classList.add("hidden");
         this.element.appendChild(this._emptyView);
 
@@ -44,7 +44,7 @@
         var status = representedObject.status;
         this.updateStatus(status);
 
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged, this._updateStatus, this);
+        WI.applicationCacheManager.addEventListener(WI.ApplicationCacheManager.Event.FrameManifestStatusChanged, this._updateStatus, this);
     }
 
     shown()
@@ -56,14 +56,14 @@
 
     closed()
     {
-        WebInspector.applicationCacheManager.removeEventListener(null, null, this);
+        WI.applicationCacheManager.removeEventListener(null, null, this);
 
         super.closed();
     }
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.ApplicationCache;
+        cookie.type = WI.ContentViewCookieType.ApplicationCache;
         cookie.frame = this.representedObject.frame.url;
         cookie.manifest = this.representedObject.manifest.manifestURL;
     }
@@ -95,7 +95,7 @@
         if (frameManifest !== this.representedObject)
             return;
 
-        console.assert(frameManifest instanceof WebInspector.ApplicationCacheFrame);
+        console.assert(frameManifest instanceof WI.ApplicationCacheFrame);
 
         this.updateStatus(frameManifest.status);
     }
@@ -105,7 +105,7 @@
         var oldStatus = this._status;
         this._status = status;
 
-        if (this.visible && this._status === WebInspector.ApplicationCacheManager.Status.Idle && (oldStatus === WebInspector.ApplicationCacheManager.Status.UpdateReady || !this._resources))
+        if (this.visible && this._status === WI.ApplicationCacheManager.Status.Idle && (oldStatus === WI.ApplicationCacheManager.Status.UpdateReady || !this._resources))
             this._markDirty();
 
         this._maybeUpdate();
@@ -113,7 +113,7 @@
 
     _update()
     {
-        WebInspector.applicationCacheManager.requestApplicationCache(this._frame, this._updateCallback.bind(this));
+        WI.applicationCacheManager.requestApplicationCache(this._frame, this._updateCallback.bind(this));
     }
 
     _updateCallback(applicationCache)
@@ -153,21 +153,21 @@
     {
         var columns = {url: {}, type: {}, size: {}};
 
-        columns.url.title = WebInspector.UIString("Resource");
+        columns.url.title = WI.UIString("Resource");
         columns.url.sortable = true;
 
-        columns.type.title = WebInspector.UIString("Type");
+        columns.type.title = WI.UIString("Type");
         columns.type.sortable = true;
 
-        columns.size.title = WebInspector.UIString("Size");
+        columns.size.title = WI.UIString("Size");
         columns.size.aligned = "right";
         columns.size.sortable = true;
 
-        this._dataGrid = new WebInspector.DataGrid(columns);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
+        this._dataGrid = new WI.DataGrid(columns);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
         this._dataGrid.sortColumnIdentifier = "url";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("application-cache-frame-content-view");
 
         this.addSubview(this._dataGrid);
@@ -206,7 +206,7 @@
                 type: resource.type,
                 size: Number.bytesToString(resource.size)
             };
-            var node = new WebInspector.DataGridNode(data);
+            var node = new WI.DataGridNode(data);
             this._dataGrid.appendChild(node);
         }
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameTreeElement.js
index 732ce54..8bc1b6d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheFrameTreeElement = class ApplicationCacheFrameTreeElement extends WebInspector.GeneralTreeElement
+WI.ApplicationCacheFrameTreeElement = class ApplicationCacheFrameTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.ApplicationCacheFrame);
+        console.assert(representedObject instanceof WI.ApplicationCacheFrame);
 
         const title = null;
         const subtitle = null;
@@ -41,16 +41,16 @@
         var url = this.representedObject.frame.url;
         var parsedURL = parseURL(url);
 
-        this.mainTitle = WebInspector.displayNameForURL(url, parsedURL);
+        this.mainTitle = WI.displayNameForURL(url, parsedURL);
 
         // Show the host as the subtitle only if it doesn't match the subtitle of the manifest tree element,
         // and it doesn't match the mainTitle.
-        var subtitle = WebInspector.displayNameForHost(parsedURL.host);
+        var subtitle = WI.displayNameForHost(parsedURL.host);
 
         var manifestTreeElement = null;
         var currentAncestor = this.parent;
         while (currentAncestor && !currentAncestor.root) {
-            if (currentAncestor instanceof WebInspector.ApplicationCacheManifestTreeElement) {
+            if (currentAncestor instanceof WI.ApplicationCacheManifestTreeElement) {
                 manifestTreeElement = currentAncestor;
                 break;
             }
diff --git a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheManifestTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheManifestTreeElement.js
index 27a95c8..575dbbd 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheManifestTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ApplicationCacheManifestTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheManifestTreeElement = class ApplicationCacheManifestTreeElement extends WebInspector.StorageTreeElement
+WI.ApplicationCacheManifestTreeElement = class ApplicationCacheManifestTreeElement extends WI.StorageTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.ApplicationCacheManifest);
+        console.assert(representedObject instanceof WI.ApplicationCacheManifest);
 
         super("application-cache-manifest", "", representedObject);
 
@@ -55,7 +55,7 @@
 
     get categoryName()
     {
-        return WebInspector.UIString("Application Cache");
+        return WI.UIString("Application Cache");
     }
 
     _generateTitles()
@@ -63,10 +63,10 @@
         var parsedURL = parseURL(this.representedObject.manifestURL);
 
         // Prefer the last path component, with a fallback for the host as the main title.
-        this._name = WebInspector.displayNameForURL(this.representedObject.manifestURL, parsedURL);
+        this._name = WI.displayNameForURL(this.representedObject.manifestURL, parsedURL);
 
         // Show the host as the subtitle.
-        var secondaryName = WebInspector.displayNameForHost(parsedURL.host);
+        var secondaryName = WI.displayNameForHost(parsedURL.host);
         this._secondaryName = this._name !== secondaryName ? secondaryName : null;
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js b/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js
index a07c19d..1322859 100644
--- a/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BezierEditor = class BezierEditor extends WebInspector.Object
+WI.BezierEditor = class BezierEditor extends WI.Object
 {
     constructor()
     {
@@ -40,7 +40,7 @@
         this._bezierHeight = editorHeight - (this._controlHandleRadius * 2) - (this._padding * 2);
 
         this._bezierPreviewContainer = this._element.createChild("div", "bezier-preview");
-        this._bezierPreviewContainer.title = WebInspector.UIString("Restart animation");
+        this._bezierPreviewContainer.title = WI.UIString("Restart animation");
         this._bezierPreviewContainer.addEventListener("mousedown", this._resetPreviewAnimation.bind(this));
 
         this._bezierPreview = this._bezierPreviewContainer.createChild("div");
@@ -114,7 +114,7 @@
         this._mouseDownPosition = null;
         this._bezierContainer.addEventListener("mousedown", this);
 
-        WebInspector.addWindowKeydownListener(this);
+        WI.addWindowKeydownListener(this);
     }
 
     // Public
@@ -129,7 +129,7 @@
         if (!bezier)
             return;
 
-        var isCubicBezier = bezier instanceof WebInspector.CubicBezier;
+        var isCubicBezier = bezier instanceof WI.CubicBezier;
         console.assert(isCubicBezier);
         if (!isCubicBezier)
             return;
@@ -145,7 +145,7 @@
 
     removeListeners()
     {
-        WebInspector.removeWindowKeydownListener(this);
+        WI.removeWindowKeydownListener(this);
     }
 
     // Protected
@@ -173,16 +173,16 @@
         let horizontal = 0;
         let vertical = 0;
         switch (event.keyCode) {
-        case WebInspector.KeyboardShortcut.Key.Up.keyCode:
+        case WI.KeyboardShortcut.Key.Up.keyCode:
             vertical = -1;
             break;
-        case WebInspector.KeyboardShortcut.Key.Right.keyCode:
+        case WI.KeyboardShortcut.Key.Right.keyCode:
             horizontal = 1;
             break;
-        case WebInspector.KeyboardShortcut.Key.Down.keyCode:
+        case WI.KeyboardShortcut.Key.Down.keyCode:
             vertical = 1;
             break;
-        case WebInspector.KeyboardShortcut.Key.Left.keyCode:
+        case WI.KeyboardShortcut.Key.Left.keyCode:
             horizontal = -1;
             break;
         default:
@@ -238,7 +238,7 @@
 
     _updateControlPointsForMouseEvent(event, calculateSelectedControlPoint)
     {
-        var point = WebInspector.Point.fromEventInElement(event, this._bezierContainer);
+        var point = WI.Point.fromEventInElement(event, this._bezierContainer);
         point.x = Number.constrain(point.x - this._controlHandleRadius, 0, this._bezierWidth);
         point.y -= this._controlHandleRadius + this._padding;
 
@@ -276,10 +276,10 @@
         var outValueX = round(this._outControl.point.x / this._bezierWidth);
         var outValueY = round(1 - (this._outControl.point.y / this._bezierHeight));
 
-        this._bezier = new WebInspector.CubicBezier(inValueX, inValueY, outValueX, outValueY);
+        this._bezier = new WI.CubicBezier(inValueX, inValueY, outValueX, outValueY);
         this._updateBezier();
 
-        this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged, {bezier: this._bezier});
+        this.dispatchEventToListeners(WI.BezierEditor.Event.BezierChanged, {bezier: this._bezier});
     }
 
     _updateBezier()
@@ -311,8 +311,8 @@
 
     _updateBezierPreview()
     {
-        this._inControl.point = new WebInspector.Point(this._bezier.inPoint.x * this._bezierWidth, (1 - this._bezier.inPoint.y) * this._bezierHeight);
-        this._outControl.point = new WebInspector.Point(this._bezier.outPoint.x * this._bezierWidth, (1 - this._bezier.outPoint.y) * this._bezierHeight);
+        this._inControl.point = new WI.Point(this._bezier.inPoint.x * this._bezierWidth, (1 - this._bezier.inPoint.y) * this._bezierHeight);
+        this._outControl.point = new WI.Point(this._bezier.outPoint.x * this._bezierWidth, (1 - this._bezier.outPoint.y) * this._bezierHeight);
 
         this._updateBezier();
         this._triggerPreviewAnimation();
@@ -381,10 +381,10 @@
 
         this._updateBezierPreview();
 
-        this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged, {bezier: this._bezier});
+        this.dispatchEventToListeners(WI.BezierEditor.Event.BezierChanged, {bezier: this._bezier});
     }
 };
 
-WebInspector.BezierEditor.Event = {
+WI.BezierEditor.Event = {
     BezierChanged: "bezier-editor-bezier-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js b/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js
index eae123d..52d744a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BoxModelDetailsSectionRow = class BoxModelDetailsSectionRow extends WebInspector.DetailsSectionRow
+WI.BoxModelDetailsSectionRow = class BoxModelDetailsSectionRow extends WI.DetailsSectionRow
 {
     constructor()
     {
-        super(WebInspector.UIString("No Box Model Information"));
+        super(WI.UIString("No Box Model Information"));
 
         this.element.classList.add("box-model");
 
@@ -44,11 +44,11 @@
     set nodeStyles(nodeStyles)
     {
         if (this._nodeStyles && this._nodeStyles.computedStyle)
-            this._nodeStyles.computedStyle.removeEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged, this._refresh, this);
+            this._nodeStyles.computedStyle.removeEventListener(WI.CSSStyleDeclaration.Event.PropertiesChanged, this._refresh, this);
 
         this._nodeStyles = nodeStyles;
         if (this._nodeStyles && this._nodeStyles.computedStyle)
-            this._nodeStyles.computedStyle.addEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged, this._refresh, this);
+            this._nodeStyles.computedStyle.addEventListener(WI.CSSStyleDeclaration.Event.PropertiesChanged, this._refresh, this);
 
         this._refresh();
     }
@@ -94,10 +94,10 @@
             if (this._highlightMode === mode)
                 return;
             this._highlightMode = mode;
-            WebInspector.domTreeManager.highlightDOMNode(nodeId, mode);
+            WI.domTreeManager.highlightDOMNode(nodeId, mode);
         } else {
             this._highlightMode = null;
-            WebInspector.domTreeManager.hideDOMNodeHighlight();
+            WI.domTreeManager.hideDOMNodeHighlight();
         }
 
         for (var i = 0; this._boxElements && i < this._boxElements.length; ++i) {
@@ -246,7 +246,7 @@
 
     _startEditing(targetElement, box, styleProperty, computedStyle)
     {
-        if (WebInspector.isBeingEdited(targetElement))
+        if (WI.isBeingEdited(targetElement))
             return;
 
         // If the target element has a title use it as the editing value
@@ -261,8 +261,8 @@
 
         this._isEditingMetrics = true;
 
-        var config = new WebInspector.EditingConfig(this._editingCommitted.bind(this), this._editingCancelled.bind(this), context);
-        WebInspector.startEditing(targetElement, config);
+        var config = new WI.EditingConfig(this._editingCommitted.bind(this), this._editingCancelled.bind(this), context);
+        WI.startEditing(targetElement, config);
 
         window.getSelection().setBaseAndExtent(targetElement, 0, targetElement, 1);
     }
@@ -287,7 +287,7 @@
         // Make the new number and constrain it to a precision of 6, this matches numbers the engine returns.
         // Use the Number constructor to forget the fixed precision, so 1.100000 will print as 1.1.
         var result = Number((number + changeAmount).toFixed(6));
-        if (!String(result).match(WebInspector.EditingSupport.NumberRegex))
+        if (!String(result).match(WI.EditingSupport.NumberRegex))
             return null;
 
         return result;
@@ -309,10 +309,10 @@
             return;
 
         var originalValue = element.textContent;
-        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WebInspector.EditingSupport.StyleValueDelimiters, element);
+        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WI.EditingSupport.StyleValueDelimiters, element);
         var wordString = wordRange.toString();
 
-        var matches = WebInspector.EditingSupport.NumberRegex.exec(wordString);
+        var matches = WI.EditingSupport.NumberRegex.exec(wordString);
         var replacementString;
         if (matches && matches.length) {
             var prefix = matches[1];
@@ -423,7 +423,7 @@
             object.release();
         }
 
-        WebInspector.RemoteObject.resolveNode(this._nodeStyles.node, "", resolvedNode.bind(this));
+        WI.RemoteObject.resolveNode(this._nodeStyles.node, "", resolvedNode.bind(this));
     }
 
     _editingCommitted(element, userInput, previousContent, context)
diff --git a/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js b/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js
index eae574c..93aa08a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BreakpointActionView = class BreakpointActionView extends WebInspector.Object
+WI.BreakpointActionView = class BreakpointActionView extends WI.Object
 {
     constructor(action, delegate, omitFocus)
     {
@@ -45,10 +45,10 @@
         var picker = header.appendChild(document.createElement("select"));
         picker.addEventListener("change", this._pickerChanged.bind(this));
 
-        for (var key in WebInspector.BreakpointAction.Type) {
-            var type = WebInspector.BreakpointAction.Type[key];
+        for (var key in WI.BreakpointAction.Type) {
+            var type = WI.BreakpointAction.Type[key];
             var option = document.createElement("option");
-            option.textContent = WebInspector.BreakpointActionView.displayStringForType(type);
+            option.textContent = WI.BreakpointActionView.displayStringForType(type);
             option.selected = this._action.type === type;
             option.value = type;
             picker.add(option);
@@ -60,12 +60,12 @@
         let appendActionButton = buttonContainerElement.appendChild(document.createElement("button"));
         appendActionButton.className = "breakpoint-action-append-button";
         appendActionButton.addEventListener("click", this._appendActionButtonClicked.bind(this));
-        appendActionButton.title = WebInspector.UIString("Add new breakpoint action after this action");
+        appendActionButton.title = WI.UIString("Add new breakpoint action after this action");
 
         let removeActionButton = buttonContainerElement.appendChild(document.createElement("button"));
         removeActionButton.className = "breakpoint-action-remove-button";
         removeActionButton.addEventListener("click", this._removeAction.bind(this));
-        removeActionButton.title = WebInspector.UIString("Remove this breakpoint action");
+        removeActionButton.title = WI.UIString("Remove this breakpoint action");
 
         this._bodyElement = this._element.appendChild(document.createElement("div"));
         this._bodyElement.className = "breakpoint-action-block-body";
@@ -78,14 +78,14 @@
     static displayStringForType(type)
     {
         switch (type) {
-        case WebInspector.BreakpointAction.Type.Log:
-            return WebInspector.UIString("Log Message");
-        case WebInspector.BreakpointAction.Type.Evaluate:
-            return WebInspector.UIString("Evaluate JavaScript");
-        case WebInspector.BreakpointAction.Type.Sound:
-            return WebInspector.UIString("Play Sound");
-        case WebInspector.BreakpointAction.Type.Probe:
-            return WebInspector.UIString("Probe Expression");
+        case WI.BreakpointAction.Type.Log:
+            return WI.UIString("Log Message");
+        case WI.BreakpointAction.Type.Evaluate:
+            return WI.UIString("Evaluate JavaScript");
+        case WI.BreakpointAction.Type.Sound:
+            return WI.UIString("Play Sound");
+        case WI.BreakpointAction.Type.Probe:
+            return WI.UIString("Probe Expression");
         default:
             console.assert(false);
             return "";
@@ -131,11 +131,11 @@
         this._bodyElement.removeChildren();
 
         switch (this._action.type) {
-        case WebInspector.BreakpointAction.Type.Log:
+        case WI.BreakpointAction.Type.Log:
             this._bodyElement.hidden = false;
 
             var input = this._bodyElement.appendChild(document.createElement("input"));
-            input.placeholder = WebInspector.UIString("Message");
+            input.placeholder = WI.UIString("Message");
             input.addEventListener("change", this._logInputChanged.bind(this));
             input.value = this._action.data || "";
             input.spellcheck = false;
@@ -145,18 +145,18 @@
             var descriptionElement = this._bodyElement.appendChild(document.createElement("div"));
             descriptionElement.classList.add("description");
             descriptionElement.setAttribute("dir", "ltr");
-            descriptionElement.textContent = WebInspector.UIString("${expr} = expression");
+            descriptionElement.textContent = WI.UIString("${expr} = expression");
             break;
 
-        case WebInspector.BreakpointAction.Type.Evaluate:
-        case WebInspector.BreakpointAction.Type.Probe:
+        case WI.BreakpointAction.Type.Evaluate:
+        case WI.BreakpointAction.Type.Probe:
             this._bodyElement.hidden = false;
 
             var editorElement = this._bodyElement.appendChild(document.createElement("div"));
             editorElement.classList.add("breakpoint-action-eval-editor");
-            editorElement.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
+            editorElement.classList.add(WI.SyntaxHighlightedStyleClassName);
 
-            this._codeMirror = WebInspector.CodeMirrorEditor.create(editorElement, {
+            this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
                 lineWrapping: true,
                 mode: "text/javascript",
                 indentWithTabs: true,
@@ -170,8 +170,8 @@
 
             this._codeMirrorViewport = {from: null, to: null};
 
-            var completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror);
-            completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
+            var completionController = new WI.CodeMirrorCompletionController(this._codeMirror);
+            completionController.addExtendedCompletionProvider("javascript", WI.javaScriptRuntimeCompletionProvider);
 
             // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
             setTimeout(() => {
@@ -182,7 +182,7 @@
 
             break;
 
-        case WebInspector.BreakpointAction.Type.Sound:
+        case WI.BreakpointAction.Type.Sound:
             this._bodyElement.hidden = true;
             break;
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js
index c24f402..39948ed 100644
--- a/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BreakpointTreeElement = class BreakpointTreeElement extends WebInspector.GeneralTreeElement
+WI.BreakpointTreeElement = class BreakpointTreeElement extends WI.GeneralTreeElement
 {
     constructor(breakpoint, className, title)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
 
         if (!className)
-            className = WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;
+            className = WI.BreakpointTreeElement.GenericLineIconStyleClassName;
 
         const subtitle = null;
         super(["breakpoint", className], title, subtitle, breakpoint);
@@ -38,19 +38,19 @@
         this._breakpoint = breakpoint;
         this._probeSet = null;
 
-        this._listenerSet = new WebInspector.EventListenerSet(this, "BreakpointTreeElement listeners");
+        this._listenerSet = new WI.EventListenerSet(this, "BreakpointTreeElement listeners");
         if (!title)
-            this._listenerSet.register(breakpoint, WebInspector.Breakpoint.Event.LocationDidChange, this._breakpointLocationDidChange);
-        this._listenerSet.register(breakpoint, WebInspector.Breakpoint.Event.DisabledStateDidChange, this._updateStatus);
-        this._listenerSet.register(breakpoint, WebInspector.Breakpoint.Event.AutoContinueDidChange, this._updateStatus);
-        this._listenerSet.register(breakpoint, WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._updateStatus);
-        this._listenerSet.register(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._updateStatus);
+            this._listenerSet.register(breakpoint, WI.Breakpoint.Event.LocationDidChange, this._breakpointLocationDidChange);
+        this._listenerSet.register(breakpoint, WI.Breakpoint.Event.DisabledStateDidChange, this._updateStatus);
+        this._listenerSet.register(breakpoint, WI.Breakpoint.Event.AutoContinueDidChange, this._updateStatus);
+        this._listenerSet.register(breakpoint, WI.Breakpoint.Event.ResolvedStateDidChange, this._updateStatus);
+        this._listenerSet.register(WI.debuggerManager, WI.DebuggerManager.Event.BreakpointsEnabledDidChange, this._updateStatus);
 
-        this._listenerSet.register(WebInspector.probeManager, WebInspector.ProbeManager.Event.ProbeSetAdded, this._probeSetAdded);
-        this._listenerSet.register(WebInspector.probeManager, WebInspector.ProbeManager.Event.ProbeSetRemoved, this._probeSetRemoved);
+        this._listenerSet.register(WI.probeManager, WI.ProbeManager.Event.ProbeSetAdded, this._probeSetAdded);
+        this._listenerSet.register(WI.probeManager, WI.ProbeManager.Event.ProbeSetRemoved, this._probeSetRemoved);
 
         this._statusImageElement = document.createElement("img");
-        this._statusImageElement.className = WebInspector.BreakpointTreeElement.StatusImageElementStyleClassName;
+        this._statusImageElement.className = WI.BreakpointTreeElement.StatusImageElementStyleClassName;
         this._listenerSet.register(this._statusImageElement, "mousedown", this._statusImageElementMouseDown);
         this._listenerSet.register(this._statusImageElement, "click", this._statusImageElementClicked);
 
@@ -78,7 +78,7 @@
 
     ondelete()
     {
-        if (!WebInspector.debuggerManager.isBreakpointRemovable(this._breakpoint))
+        if (!WI.debuggerManager.isBreakpointRemovable(this._breakpoint))
             return false;
 
         // We set this flag so that TreeOutlines that will remove this
@@ -86,7 +86,7 @@
         // within the TreeOutline or from outside it (e.g. TextEditor).
         this.__deletedViaDeleteKeyboardShortcut = true;
 
-        WebInspector.debuggerManager.removeBreakpoint(this._breakpoint);
+        WI.debuggerManager.removeBreakpoint(this._breakpoint);
         return true;
     }
 
@@ -108,7 +108,7 @@
 
         this._listenerSet.install();
 
-        for (var probeSet of WebInspector.probeManager.probeSets)
+        for (var probeSet of WI.probeManager.probeSets)
             if (probeSet.breakpoint === this._breakpoint)
                 this._addProbeSet(probeSet);
     }
@@ -125,7 +125,7 @@
 
     populateContextMenu(contextMenu, event)
     {
-        WebInspector.breakpointPopoverController.appendContextMenuItems(contextMenu, this._breakpoint, this._statusImageElement);
+        WI.breakpointPopoverController.appendContextMenuItems(contextMenu, this._breakpoint, this._statusImageElement);
 
         super.populateContextMenu(contextMenu, event);
     }
@@ -145,19 +145,19 @@
         var displayLineNumber = sourceCodeLocation.displayLineNumber;
         var displayColumnNumber = sourceCodeLocation.displayColumnNumber;
         if (displayColumnNumber > 0)
-            this.mainTitle = WebInspector.UIString("Line %d:%d").format(displayLineNumber + 1, displayColumnNumber + 1); // The user visible line and column numbers are 1-based.
+            this.mainTitle = WI.UIString("Line %d:%d").format(displayLineNumber + 1, displayColumnNumber + 1); // The user visible line and column numbers are 1-based.
         else
-            this.mainTitle = WebInspector.UIString("Line %d").format(displayLineNumber + 1); // The user visible line number is 1-based.
+            this.mainTitle = WI.UIString("Line %d").format(displayLineNumber + 1); // The user visible line number is 1-based.
 
         if (sourceCodeLocation.hasMappedLocation()) {
             this.subtitle = sourceCodeLocation.formattedLocationString();
 
             if (sourceCodeLocation.hasFormattedLocation())
-                this.subtitleElement.classList.add(WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName);
+                this.subtitleElement.classList.add(WI.BreakpointTreeElement.FormattedLocationStyleClassName);
             else
-                this.subtitleElement.classList.remove(WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName);
+                this.subtitleElement.classList.remove(WI.BreakpointTreeElement.FormattedLocationStyleClassName);
 
-            this.tooltip = this.mainTitle + " \u2014 " + WebInspector.UIString("originally %s").format(sourceCodeLocation.originalLocationString());
+            this.tooltip = this.mainTitle + " \u2014 " + WI.UIString("originally %s").format(sourceCodeLocation.originalLocationString());
         }
     }
 
@@ -167,39 +167,39 @@
             return;
 
         if (this._breakpoint.disabled)
-            this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName);
+            this._statusImageElement.classList.add(WI.BreakpointTreeElement.StatusImageDisabledStyleClassName);
         else
-            this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName);
+            this._statusImageElement.classList.remove(WI.BreakpointTreeElement.StatusImageDisabledStyleClassName);
 
         if (this._breakpoint.autoContinue)
-            this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);
+            this._statusImageElement.classList.add(WI.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);
         else
-            this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);
+            this._statusImageElement.classList.remove(WI.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);
 
-        if (this._breakpoint.resolved && WebInspector.debuggerManager.breakpointsEnabled)
-            this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName);
+        if (this._breakpoint.resolved && WI.debuggerManager.breakpointsEnabled)
+            this._statusImageElement.classList.add(WI.BreakpointTreeElement.StatusImageResolvedStyleClassName);
         else
-            this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName);
+            this._statusImageElement.classList.remove(WI.BreakpointTreeElement.StatusImageResolvedStyleClassName);
     }
 
     _addProbeSet(probeSet)
     {
-        console.assert(probeSet instanceof WebInspector.ProbeSet);
+        console.assert(probeSet instanceof WI.ProbeSet);
         console.assert(probeSet.breakpoint === this._breakpoint);
         console.assert(probeSet !== this._probeSet);
 
         this._probeSet = probeSet;
-        probeSet.addEventListener(WebInspector.ProbeSet.Event.SamplesCleared, this._samplesCleared, this);
-        probeSet.dataTable.addEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
+        probeSet.addEventListener(WI.ProbeSet.Event.SamplesCleared, this._samplesCleared, this);
+        probeSet.dataTable.addEventListener(WI.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
     }
 
     _removeProbeSet(probeSet)
     {
-        console.assert(probeSet instanceof WebInspector.ProbeSet);
+        console.assert(probeSet instanceof WI.ProbeSet);
         console.assert(probeSet === this._probeSet);
 
-        probeSet.removeEventListener(WebInspector.ProbeSet.Event.SamplesCleared, this._samplesCleared, this);
-        probeSet.dataTable.removeEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
+        probeSet.removeEventListener(WI.ProbeSet.Event.SamplesCleared, this._samplesCleared, this);
+        probeSet.dataTable.removeEventListener(WI.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
         this._probeSet = null;
     }
 
@@ -222,25 +222,25 @@
         console.assert(this._probeSet);
 
         var oldTable = event.data.oldTable;
-        oldTable.removeEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
-        this._probeSet.dataTable.addEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
+        oldTable.removeEventListener(WI.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
+        this._probeSet.dataTable.addEventListener(WI.ProbeSetDataTable.Event.FrameInserted, this._dataUpdated, this);
     }
 
     _dataUpdated()
     {
-        if (this.element.classList.contains(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName)) {
+        if (this.element.classList.contains(WI.BreakpointTreeElement.ProbeDataUpdatedStyleClassName)) {
             clearTimeout(this._removeIconAnimationTimeoutIdentifier);
-            this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
+            this.element.classList.remove(WI.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
             // We want to restart the animation, which can only be done by removing the class,
             // performing layout, and re-adding the class. Try adding class back on next run loop.
             window.requestAnimationFrame(this._dataUpdated.bind(this));
             return;
         }
 
-        this.element.classList.add(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
+        this.element.classList.add(WI.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
         this._removeIconAnimationTimeoutIdentifier = setTimeout(() => {
-            this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
-        }, WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);
+            this.element.classList.remove(WI.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
+        }, WI.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);
     }
 
     _breakpointLocationDidChange(event)
@@ -266,12 +266,12 @@
     }
 };
 
-WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName = "breakpoint-generic-line-icon";
-WebInspector.BreakpointTreeElement.StatusImageElementStyleClassName = "status-image";
-WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName = "resolved";
-WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName = "auto-continue";
-WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName = "disabled";
-WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName = "formatted-location";
-WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName = "data-updated";
+WI.BreakpointTreeElement.GenericLineIconStyleClassName = "breakpoint-generic-line-icon";
+WI.BreakpointTreeElement.StatusImageElementStyleClassName = "status-image";
+WI.BreakpointTreeElement.StatusImageResolvedStyleClassName = "resolved";
+WI.BreakpointTreeElement.StatusImageAutoContinueStyleClassName = "auto-continue";
+WI.BreakpointTreeElement.StatusImageDisabledStyleClassName = "disabled";
+WI.BreakpointTreeElement.FormattedLocationStyleClassName = "formatted-location";
+WI.BreakpointTreeElement.ProbeDataUpdatedStyleClassName = "data-updated";
 
-WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration = 400; // milliseconds
+WI.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration = 400; // milliseconds
diff --git a/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js
index 531cdb8..25779bc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ButtonNavigationItem = class ButtonNavigationItem extends WebInspector.NavigationItem
+WI.ButtonNavigationItem = class ButtonNavigationItem extends WI.NavigationItem
 {
     constructor(identifier, toolTipOrLabel, image, imageWidth, imageHeight, role, label)
     {
@@ -73,7 +73,7 @@
 
     set label(newLabel)
     {
-        this._element.classList.add(WebInspector.ButtonNavigationItem.TextOnlyClassName);
+        this._element.classList.add(WI.ButtonNavigationItem.TextOnlyClassName);
         this._element.textContent = newLabel || "";
         if (this.parentNavigationBar)
             this.parentNavigationBar.needsLayout();
@@ -92,7 +92,7 @@
         }
 
         this._element.removeChildren();
-        this._element.classList.remove(WebInspector.ButtonNavigationItem.TextOnlyClassName);
+        this._element.classList.remove(WI.ButtonNavigationItem.TextOnlyClassName);
 
         this._image = newImage;
 
@@ -104,15 +104,15 @@
 
     get enabled()
     {
-        return !this._element.classList.contains(WebInspector.ButtonNavigationItem.DisabledStyleClassName);
+        return !this._element.classList.contains(WI.ButtonNavigationItem.DisabledStyleClassName);
     }
 
     set enabled(flag)
     {
         if (flag)
-            this._element.classList.remove(WebInspector.ButtonNavigationItem.DisabledStyleClassName);
+            this._element.classList.remove(WI.ButtonNavigationItem.DisabledStyleClassName);
         else
-            this._element.classList.add(WebInspector.ButtonNavigationItem.DisabledStyleClassName);
+            this._element.classList.add(WI.ButtonNavigationItem.DisabledStyleClassName);
     }
 
     // Protected
@@ -128,13 +128,13 @@
     {
         if (!this.enabled)
             return;
-        this.dispatchEventToListeners(WebInspector.ButtonNavigationItem.Event.Clicked, {nativeEvent: event});
+        this.dispatchEventToListeners(WI.ButtonNavigationItem.Event.Clicked, {nativeEvent: event});
     }
 };
 
-WebInspector.ButtonNavigationItem.DisabledStyleClassName = "disabled";
-WebInspector.ButtonNavigationItem.TextOnlyClassName = "text-only";
+WI.ButtonNavigationItem.DisabledStyleClassName = "disabled";
+WI.ButtonNavigationItem.TextOnlyClassName = "text-only";
 
-WebInspector.ButtonNavigationItem.Event = {
+WI.ButtonNavigationItem.Event = {
     Clicked: "button-navigation-item-clicked"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js b/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js
index b2c7a2b..dcf4d98 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ButtonToolbarItem = class ButtonToolbarItem extends WebInspector.ButtonNavigationItem
+WI.ButtonToolbarItem = class ButtonToolbarItem extends WI.ButtonNavigationItem
 {
     constructor(identifier, toolTip, label, image, role)
     {
@@ -31,7 +31,7 @@
 
         if (typeof label === "string") {
             this._labelElement = document.createElement("div");
-            this._labelElement.className = WebInspector.ButtonToolbarItem.LabelStyleClassName;
+            this._labelElement.className = WI.ButtonToolbarItem.LabelStyleClassName;
             this._element.appendChild(this._labelElement);
 
             this.label = label;
@@ -55,4 +55,4 @@
     }
 };
 
-WebInspector.ButtonToolbarItem.LabelStyleClassName = "label";
+WI.ButtonToolbarItem.LabelStyleClassName = "label";
diff --git a/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js b/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
index d0c4a84..0d6fdbe 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleDeclarationSection = class CSSStyleDeclarationSection extends WebInspector.Object
+WI.CSSStyleDeclarationSection = class CSSStyleDeclarationSection extends WI.Object
 {
     constructor(delegate, style)
     {
-        console.assert(style instanceof WebInspector.CSSStyleDeclaration, style);
+        console.assert(style instanceof WI.CSSStyleDeclaration, style);
 
         super();
 
@@ -41,8 +41,8 @@
         this._element = document.createElement("div");
         this._element.classList.add("style-declaration-section");
 
-        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this), this._element);
-        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "S", this._save.bind(this), this._element);
+        new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this), this._element);
+        new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "S", this._save.bind(this), this._element);
 
         this._headerElement = document.createElement("div");
         this._headerElement.classList.add("header");
@@ -51,12 +51,12 @@
             let lockedIconElement = this._headerElement.createChild("img", "locked-icon");
 
             let styleLabel;
-            if (style.ownerRule && style.ownerRule.type === WebInspector.CSSStyleSheet.Type.UserAgent)
-                styleLabel = WebInspector.UIString("User Agent Stylesheet");
+            if (style.ownerRule && style.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent)
+                styleLabel = WI.UIString("User Agent Stylesheet");
             else
-                styleLabel = WebInspector.UIString("Style rule");
+                styleLabel = WI.UIString("Style rule");
 
-            lockedIconElement.title = WebInspector.UIString("%s cannot be modified").format(styleLabel);
+            lockedIconElement.title = WI.UIString("%s cannot be modified").format(styleLabel);
         }
 
         this._iconElement = this._headerElement.createChild("img", "icon");
@@ -88,9 +88,9 @@
         this._propertiesElement.classList.add("properties");
 
         this._editorActive = false;
-        this._propertiesTextEditor = new WebInspector.CSSStyleDeclarationTextEditor(this, style);
-        this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged, this._editorContentChanged.bind(this));
-        this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred, this._editorBlurred.bind(this));
+        this._propertiesTextEditor = new WI.CSSStyleDeclarationTextEditor(this, style);
+        this._propertiesTextEditor.addEventListener(WI.CSSStyleDeclarationTextEditor.Event.ContentChanged, this._editorContentChanged.bind(this));
+        this._propertiesTextEditor.addEventListener(WI.CSSStyleDeclarationTextEditor.Event.Blurred, this._editorBlurred.bind(this));
         this._propertiesElement.appendChild(this._propertiesTextEditor.element);
 
         this._element.appendChild(this._headerElement);
@@ -98,33 +98,33 @@
 
         let iconClassName = null;
         switch (style.type) {
-        case WebInspector.CSSStyleDeclaration.Type.Rule:
+        case WI.CSSStyleDeclaration.Type.Rule:
             console.assert(style.ownerRule);
 
             if (style.inherited)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.Author)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.User)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.UserAgent)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.Inspector)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;
+                iconClassName = WI.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.Author)
+                iconClassName = WI.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.User)
+                iconClassName = WI.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent)
+                iconClassName = WI.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.Inspector)
+                iconClassName = WI.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;
             break;
 
-        case WebInspector.CSSStyleDeclaration.Type.Inline:
-        case WebInspector.CSSStyleDeclaration.Type.Attribute:
+        case WI.CSSStyleDeclaration.Type.Inline:
+        case WI.CSSStyleDeclaration.Type.Attribute:
             if (style.inherited)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;
+                iconClassName = WI.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;
             else
-                iconClassName = WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
+                iconClassName = WI.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
             break;
         }
 
         if (style.editable) {
             this._iconElement.classList.add("toggle-able");
-            this._iconElement.title = WebInspector.UIString("Comment All Properties");
+            this._iconElement.title = WI.UIString("Comment All Properties");
             this._iconElement.addEventListener("click", this._handleIconElementClicked.bind(this));
         }
 
@@ -132,11 +132,11 @@
         this._element.classList.add(iconClassName);
 
         if (!style.editable)
-            this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LockedStyleClassName);
+            this._element.classList.add(WI.CSSStyleDeclarationSection.LockedStyleClassName);
         else if (style.ownerRule)
-            this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._updateSelectorIcon.bind(this));
+            this._style.ownerRule.addEventListener(WI.CSSRule.Event.SelectorChanged, this._updateSelectorIcon.bind(this));
         else
-            this._element.classList.add(WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName);
+            this._element.classList.add(WI.CSSStyleDeclarationSection.SelectorLockedStyleClassName);
 
         this.refresh();
 
@@ -157,15 +157,15 @@
 
     get lastInGroup()
     {
-        return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);
+        return this._element.classList.contains(WI.CSSStyleDeclarationSection.LastInGroupStyleClassName);
     }
 
     set lastInGroup(last)
     {
         if (last)
-            this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);
+            this._element.classList.add(WI.CSSStyleDeclarationSection.LastInGroupStyleClassName);
         else
-            this._element.classList.remove(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);
+            this._element.classList.remove(WI.CSSStyleDeclarationSection.LastInGroupStyleClassName);
     }
 
     get focused()
@@ -188,29 +188,29 @@
 
         function appendSelector(selector, matched)
         {
-            console.assert(selector instanceof WebInspector.CSSSelector);
+            console.assert(selector instanceof WI.CSSSelector);
 
             let selectorElement = document.createElement("span");
             selectorElement.textContent = selector.text;
 
             if (matched)
-                selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);
+                selectorElement.classList.add(WI.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);
 
             let specificity = selector.specificity;
             if (specificity) {
-                let tooltip = WebInspector.UIString("Specificity: (%d, %d, %d)").format(specificity[0], specificity[1], specificity[2]);
+                let tooltip = WI.UIString("Specificity: (%d, %d, %d)").format(specificity[0], specificity[1], specificity[2]);
                 if (selector.dynamic) {
                     tooltip += "\n";
                     if (this._style.inherited)
-                        tooltip += WebInspector.UIString("Dynamically calculated for the parent element");
+                        tooltip += WI.UIString("Dynamically calculated for the parent element");
                     else
-                        tooltip += WebInspector.UIString("Dynamically calculated for the selected element");
+                        tooltip += WI.UIString("Dynamically calculated for the selected element");
                 }
                 selectorElement.title = tooltip;
             } else if (selector.dynamic) {
-                let tooltip = WebInspector.UIString("Specificity: No value for selected element");
+                let tooltip = WI.UIString("Specificity: No value for selected element");
                 tooltip += "\n";
-                tooltip += WebInspector.UIString("Dynamically calculated for the selected element and did not match");
+                tooltip += WI.UIString("Dynamically calculated for the selected element and did not match");
                 selectorElement.title = tooltip;
             }
 
@@ -222,12 +222,12 @@
         {
             let selectorElement = document.createElement("span");
             selectorElement.textContent = selectorText;
-            selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);
+            selectorElement.classList.add(WI.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);
             this._selectorElement.appendChild(selectorElement);
         }
 
         switch (this._style.type) {
-        case WebInspector.CSSStyleDeclaration.Type.Rule:
+        case WI.CSSStyleDeclaration.Type.Rule:
             console.assert(this._style.ownerRule);
 
             let selectors = this._style.ownerRule.selectors;
@@ -243,7 +243,7 @@
                     if (matchedSelectorIndices.includes(i) && selectors[i].isPseudoElementSelector())
                         hasMatchingPseudoElementSelector = true;
                 }
-                this._element.classList.toggle(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName, hasMatchingPseudoElementSelector);
+                this._element.classList.toggle(WI.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName, hasMatchingPseudoElementSelector);
             } else
                 appendSelectorTextKnownToMatch.call(this, this._style.ownerRule.selectorText);
 
@@ -254,29 +254,29 @@
                     ignoreSearchTab: true,
                 };
                 if (this._style.ownerStyleSheet.isInspectorStyleSheet()) {
-                    options.nameStyle = WebInspector.SourceCodeLocation.NameStyle.None;
-                    options.prefix = WebInspector.UIString("Inspector Style Sheet") + ":";
+                    options.nameStyle = WI.SourceCodeLocation.NameStyle.None;
+                    options.prefix = WI.UIString("Inspector Style Sheet") + ":";
                 }
 
-                let sourceCodeLink = WebInspector.createSourceCodeLocationLink(this._style.ownerRule.sourceCodeLocation, options);
+                let sourceCodeLink = WI.createSourceCodeLocationLink(this._style.ownerRule.sourceCodeLocation, options);
                 this._originElement.appendChild(sourceCodeLink);
             } else {
                 let originString;
                 switch (this._style.ownerRule.type) {
-                case WebInspector.CSSStyleSheet.Type.Author:
-                    originString = WebInspector.UIString("Author Stylesheet");
+                case WI.CSSStyleSheet.Type.Author:
+                    originString = WI.UIString("Author Stylesheet");
                     break;
 
-                case WebInspector.CSSStyleSheet.Type.User:
-                    originString = WebInspector.UIString("User Stylesheet");
+                case WI.CSSStyleSheet.Type.User:
+                    originString = WI.UIString("User Stylesheet");
                     break;
 
-                case WebInspector.CSSStyleSheet.Type.UserAgent:
-                    originString = WebInspector.UIString("User Agent Stylesheet");
+                case WI.CSSStyleSheet.Type.UserAgent:
+                    originString = WI.UIString("User Agent Stylesheet");
                     break;
 
-                case WebInspector.CSSStyleSheet.Type.Inspector:
-                    originString = WebInspector.UIString("Web Inspector");
+                case WI.CSSStyleSheet.Type.Inspector:
+                    originString = WI.UIString("Web Inspector");
                     break;
                 }
 
@@ -287,14 +287,14 @@
 
             break;
 
-        case WebInspector.CSSStyleDeclaration.Type.Inline:
+        case WI.CSSStyleDeclaration.Type.Inline:
             appendSelectorTextKnownToMatch.call(this, this._style.node.displayName);
-            this._originElement.append(WebInspector.UIString("Style Attribute"));
+            this._originElement.append(WI.UIString("Style Attribute"));
             break;
 
-        case WebInspector.CSSStyleDeclaration.Type.Attribute:
+        case WI.CSSStyleDeclaration.Type.Attribute:
             appendSelectorTextKnownToMatch.call(this, this._style.node.displayName);
-            this._originElement.append(WebInspector.UIString("HTML Attributes"));
+            this._originElement.append(WI.UIString("HTML Attributes"));
             break;
         }
 
@@ -320,15 +320,15 @@
 
     findMatchingPropertiesAndSelectors(needle)
     {
-        this._element.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName, WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);
+        this._element.classList.remove(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName, WI.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);
 
         var hasMatchingSelector = false;
 
         for (var selectorElement of this._selectorElements) {
-            selectorElement.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName);
+            selectorElement.classList.remove(WI.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName);
 
             if (needle && selectorElement.textContent.includes(needle)) {
-                selectorElement.classList.add(WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName);
+                selectorElement.classList.add(WI.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName);
                 hasMatchingSelector = true;
             }
         }
@@ -341,7 +341,7 @@
         var hasMatchingProperty = this._propertiesTextEditor.findMatchingProperties(needle);
 
         if (!hasMatchingProperty && !hasMatchingSelector) {
-            this._element.classList.add(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);
+            this._element.classList.add(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);
             return false;
         }
 
@@ -440,7 +440,7 @@
 
     _handleSelectorPaste(event)
     {
-        if (this._style.type === WebInspector.CSSStyleDeclaration.Type.Inline || !this._style.ownerRule)
+        if (this._style.type === WI.CSSStyleDeclaration.Type.Inline || !this._style.ownerRule)
             return;
 
         if (!event || !event.clipboardData)
@@ -478,16 +478,16 @@
         if (window.getSelection().toString().length)
             return;
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
-        contextMenu.appendItem(WebInspector.UIString("Copy Rule"), () => {
+        contextMenu.appendItem(WI.UIString("Copy Rule"), () => {
             InspectorFrontendHost.copyText(this._style.generateCSSRuleString());
         });
 
         if (this._style.inherited)
             return;
 
-        contextMenu.appendItem(WebInspector.UIString("Duplicate Selector"), () => {
+        contextMenu.appendItem(WI.UIString("Duplicate Selector"), () => {
             if (this._delegate && typeof this._delegate.focusEmptySectionWithStyle === "function") {
                 let existingRules = this._style.nodeStyles.rulesForSelector(this._currentSelectorText);
                 for (let rule of existingRules) {
@@ -500,19 +500,19 @@
         });
 
         // Only used one colon temporarily since single-colon pseudo elements are valid CSS.
-        if (WebInspector.CSSStyleManager.PseudoElementNames.some((className) => this._style.selectorText.includes(":" + className)))
+        if (WI.CSSStyleManager.PseudoElementNames.some((className) => this._style.selectorText.includes(":" + className)))
             return;
 
-        if (WebInspector.CSSStyleManager.ForceablePseudoClasses.every((className) => !this._style.selectorText.includes(":" + className))) {
+        if (WI.CSSStyleManager.ForceablePseudoClasses.every((className) => !this._style.selectorText.includes(":" + className))) {
             contextMenu.appendSeparator();
 
-            for (let pseudoClass of WebInspector.CSSStyleManager.ForceablePseudoClasses) {
+            for (let pseudoClass of WI.CSSStyleManager.ForceablePseudoClasses) {
                 if (pseudoClass === "visited" && this._style.node.nodeName() !== "A")
                     continue;
 
                 let pseudoClassSelector = ":" + pseudoClass;
 
-                contextMenu.appendItem(WebInspector.UIString("Add %s Rule").format(pseudoClassSelector), () => {
+                contextMenu.appendItem(WI.UIString("Add %s Rule").format(pseudoClassSelector), () => {
                     this._style.node.setPseudoClassEnabled(pseudoClass, true);
 
                     let selector;
@@ -528,7 +528,7 @@
 
         contextMenu.appendSeparator();
 
-        for (let pseudoElement of WebInspector.CSSStyleManager.PseudoElementNames) {
+        for (let pseudoElement of WI.CSSStyleManager.PseudoElementNames) {
             let pseudoElementSelector = "::" + pseudoElement;
             const styleText = "content: \"\";";
 
@@ -543,7 +543,7 @@
                 }
             }
 
-            let title = existingSection ? WebInspector.UIString("Focus %s Rule") : WebInspector.UIString("Create %s Rule");
+            let title = existingSection ? WI.UIString("Focus %s Rule") : WI.UIString("Create %s Rule");
             contextMenu.appendItem(title.format(pseudoElementSelector), () => {
                 if (existingSection) {
                     existingSection.focus();
@@ -570,23 +570,23 @@
         }
 
         this._ruleDisabled = this._ruleDisabled ? !this._propertiesTextEditor.uncommentAllProperties() : this._propertiesTextEditor.commentAllProperties();
-        this._iconElement.title = this._ruleDisabled ? WebInspector.UIString("Uncomment All Properties") : WebInspector.UIString("Comment All Properties");
+        this._iconElement.title = this._ruleDisabled ? WI.UIString("Uncomment All Properties") : WI.UIString("Comment All Properties");
         this._element.classList.toggle("rule-disabled", this._ruleDisabled);
     }
 
     _highlightNodesWithSelector()
     {
         if (!this._style.ownerRule) {
-            WebInspector.domTreeManager.highlightDOMNode(this._style.node.id);
+            WI.domTreeManager.highlightDOMNode(this._style.node.id);
             return;
         }
 
-        WebInspector.domTreeManager.highlightSelector(this._currentSelectorText, this._style.node.ownerDocument.frameIdentifier);
+        WI.domTreeManager.highlightSelector(this._currentSelectorText, this._style.node.ownerDocument.frameIdentifier);
     }
 
     _hideDOMNodeHighlight()
     {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
     }
 
     _handleMouseOver(event)
@@ -623,17 +623,17 @@
         event.preventDefault();
         event.stopPropagation();
 
-        if (this._style.type !== WebInspector.CSSStyleDeclaration.Type.Rule) {
+        if (this._style.type !== WI.CSSStyleDeclaration.Type.Rule) {
             // FIXME: Can't save CSS inside <style></style> <https://webkit.org/b/150357>
             InspectorFrontendHost.beep();
             return;
         }
 
-        console.assert(this._style.ownerRule instanceof WebInspector.CSSRule);
-        console.assert(this._style.ownerRule.sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
+        console.assert(this._style.ownerRule instanceof WI.CSSRule);
+        console.assert(this._style.ownerRule.sourceCodeLocation instanceof WI.SourceCodeLocation);
 
         let sourceCode = this._style.ownerRule.sourceCodeLocation.sourceCode;
-        if (sourceCode.type !== WebInspector.Resource.Type.Stylesheet) {
+        if (sourceCode.type !== WI.Resource.Type.Stylesheet) {
             // FIXME: Can't save CSS inside style="" <https://webkit.org/b/150357>
             InspectorFrontendHost.beep();
             return;
@@ -641,25 +641,25 @@
 
         var url;
         if (sourceCode.urlComponents.scheme === "data") {
-            let mainResource = WebInspector.frameResourceManager.mainFrame.mainResource;
+            let mainResource = WI.frameResourceManager.mainFrame.mainResource;
             let pathDirectory = mainResource.url.slice(0, -mainResource.urlComponents.lastPathComponent.length);
             url = pathDirectory + "base64.css";
         } else
             url = sourceCode.url;
 
         const saveAs = event.shiftKey;
-        WebInspector.saveDataToFile({url: url, content: sourceCode.content}, saveAs);
+        WI.saveDataToFile({url: url, content: sourceCode.content}, saveAs);
     }
 
     _handleKeyDown(event)
     {
-        if (event.keyCode === WebInspector.KeyboardShortcut.Key.Enter.keyCode) {
+        if (event.keyCode === WI.KeyboardShortcut.Key.Enter.keyCode) {
             event.preventDefault();
             this.focus();
             return;
         }
 
-        if (event.keyCode !== WebInspector.KeyboardShortcut.Key.Tab.keyCode) {
+        if (event.keyCode !== WI.KeyboardShortcut.Key.Tab.keyCode) {
             this._highlightNodesWithSelector();
             return;
         }
@@ -723,12 +723,12 @@
         this._hasInvalidSelector = event && event.data && !event.data.valid;
         this._element.classList.toggle("invalid-selector", !!this._hasInvalidSelector);
         if (this._hasInvalidSelector) {
-            this._iconElement.title = WebInspector.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this._selectorElement.textContent.trim());
-            this._selectorInput.title = WebInspector.UIString("Using previous selector “%s”").format(this._style.ownerRule.selectorText);
+            this._iconElement.title = WI.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this._selectorElement.textContent.trim());
+            this._selectorInput.title = WI.UIString("Using previous selector “%s”").format(this._style.ownerRule.selectorText);
             return;
         }
 
-        this._iconElement.title = this._ruleDisabled ? WebInspector.UIString("Uncomment All Properties") : WebInspector.UIString("Comment All Properties");
+        this._iconElement.title = this._ruleDisabled ? WI.UIString("Uncomment All Properties") : WI.UIString("Comment All Properties");
         this._selectorInput.title = "";
     }
 
@@ -740,23 +740,23 @@
     _editorBlurred(event)
     {
         this._editorActive = false;
-        this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationSection.Event.Blurred);
+        this.dispatchEventToListeners(WI.CSSStyleDeclarationSection.Event.Blurred);
     }
 };
 
-WebInspector.CSSStyleDeclarationSection.Event = {
+WI.CSSStyleDeclarationSection.Event = {
     Blurred: "css-style-declaration-sections-blurred"
 };
 
-WebInspector.CSSStyleDeclarationSection.LockedStyleClassName = "locked";
-WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName = "selector-locked";
-WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName = "last-in-group";
-WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName = "matched";
-WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName = "pseudo-element-selector";
+WI.CSSStyleDeclarationSection.LockedStyleClassName = "locked";
+WI.CSSStyleDeclarationSection.SelectorLockedStyleClassName = "selector-locked";
+WI.CSSStyleDeclarationSection.LastInGroupStyleClassName = "last-in-group";
+WI.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName = "matched";
+WI.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName = "pseudo-element-selector";
 
-WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName = "author-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName = "user-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName = "user-agent-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName = "inspector-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName = "inherited-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName = "inherited-element-style-rule-icon";
+WI.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName = "author-style-rule-icon";
+WI.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName = "user-style-rule-icon";
+WI.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName = "user-agent-style-rule-icon";
+WI.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName = "inspector-style-rule-icon";
+WI.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName = "inherited-style-rule-icon";
+WI.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName = "inherited-element-style-rule-icon";
diff --git a/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js b/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
index 6a6c6b9..7d31542 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
@@ -24,20 +24,20 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor extends WebInspector.View
+WI.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor extends WI.View
 {
     constructor(delegate, style)
     {
         super();
 
-        this.element.classList.add(WebInspector.CSSStyleDeclarationTextEditor.StyleClassName);
-        this.element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add(WI.CSSStyleDeclarationTextEditor.StyleClassName);
+        this.element.classList.add(WI.SyntaxHighlightedStyleClassName);
         this.element.addEventListener("mousedown", this._handleMouseDown.bind(this), true);
         this.element.addEventListener("mouseup", this._handleMouseUp.bind(this));
 
         this._mouseDownCursorPosition = null;
 
-        this._propertyVisibilityMode = WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll;
+        this._propertyVisibilityMode = WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll;
         this._showsImplicitProperties = true;
         this._alwaysShowPropertyNames = {};
         this._filterResultPropertyNames = null;
@@ -48,7 +48,7 @@
 
         this._delegate = delegate || null;
 
-        this._codeMirror = WebInspector.CodeMirrorEditor.create(this.element, {
+        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
             readOnly: true,
             lineWrapping: true,
             mode: "css-rule",
@@ -67,16 +67,16 @@
             "Tab": this._handleTabKey.bind(this)
         });
 
-        this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
-        this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
+        this._completionController = new WI.CodeMirrorCompletionController(this._codeMirror, this);
+        this._tokenTrackingController = new WI.CodeMirrorTokenTrackingController(this._codeMirror, this);
 
         this._completionController.noEndingSemicolon = true;
 
         this._jumpToSymbolTrackingModeEnabled = false;
-        this._tokenTrackingController.classNameForHighlightedRange = WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;
+        this._tokenTrackingController.classNameForHighlightedRange = WI.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;
         this._tokenTrackingController.mouseOverDelayDuration = 0;
         this._tokenTrackingController.mouseOutReleaseDelayDuration = 0;
-        this._tokenTrackingController.mode = WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;
+        this._tokenTrackingController.mode = WI.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;
 
         // Make sure CompletionController adds event listeners first.
         // Otherwise we end up in race conditions during complete or delete-complete phases.
@@ -90,7 +90,7 @@
         this.style = style;
         this._shownProperties = [];
 
-        WebInspector.settings.stylesShowInlineWarnings.addEventListener(WebInspector.Setting.Event.Changed, this.refresh, this);
+        WI.settings.stylesShowInlineWarnings.addEventListener(WI.Setting.Event.Changed, this.refresh, this);
     }
 
     // Public
@@ -108,15 +108,15 @@
             return;
 
         if (this._style) {
-            this._style.removeEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged, this._propertiesChanged, this);
-            WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateJumpToSymbolTrackingMode, this);
+            this._style.removeEventListener(WI.CSSStyleDeclaration.Event.PropertiesChanged, this._propertiesChanged, this);
+            WI.notifications.removeEventListener(WI.Notification.GlobalModifierKeysDidChange, this._updateJumpToSymbolTrackingMode, this);
         }
 
         this._style = style || null;
 
         if (this._style) {
-            this._style.addEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged, this._propertiesChanged, this);
-            WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateJumpToSymbolTrackingMode, this);
+            this._style.addEventListener(WI.CSSStyleDeclaration.Event.PropertiesChanged, this._propertiesChanged, this);
+            WI.notifications.addEventListener(WI.Notification.GlobalModifierKeysDidChange, this._updateJumpToSymbolTrackingMode, this);
         }
 
         this._updateJumpToSymbolTrackingMode();
@@ -252,9 +252,9 @@
             var property = propertiesList[i];
 
             if (matchingProperties[i])
-                property.__filterResultClassName = WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName;
+                property.__filterResultClassName = WI.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName;
             else
-                property.__filterResultClassName = WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName;
+                property.__filterResultClassName = WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName;
 
             this._updateTextMarkerForPropertyIfNeeded(property);
         }
@@ -290,7 +290,7 @@
 
             if (indexesOfNeedle.length) {
                 matchingPropertyNames.push(property.name);
-                property.__filterResultClassName = WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName;
+                property.__filterResultClassName = WI.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName;
                 property.__filterResultNeedlePosition = {start: indexesOfNeedle, length: needle.length};
             }
         }
@@ -421,7 +421,7 @@
         if (this._textAtCursorIsComment(codeMirror, cursor))
             nextHead = text.length;
         else {
-            let range = WebInspector.rangeForNextCSSNameOrValue(text, cursor.ch);
+            let range = WI.rangeForNextCSSNameOrValue(text, cursor.ch);
             nextAnchor = range.from;
             nextHead = range.to;
         }
@@ -469,17 +469,17 @@
             let line = this._codeMirror.getLine(cursor.line);
             if (cursor.ch === line.trimRight().length) {
                 let nextLine = this._codeMirror.getLine(cursor.line + 1);
-                if (WebInspector.settings.stylesInsertNewline.value && cursor.line < this._codeMirror.lineCount() - 1 && (!nextLine || !nextLine.trim().length)) {
+                if (WI.settings.stylesInsertNewline.value && cursor.line < this._codeMirror.lineCount() - 1 && (!nextLine || !nextLine.trim().length)) {
                     this._codeMirror.setCursor({line: cursor.line + 1, ch: 0});
                 } else {
                     let line = this._codeMirror.getLine(cursor.line);
-                    let replacement = WebInspector.settings.stylesInsertNewline.value ? "\n" : "";
+                    let replacement = WI.settings.stylesInsertNewline.value ? "\n" : "";
                     if (!line.trimRight().endsWith(";") && !this._textAtCursorIsComment(this._codeMirror, cursor))
                         replacement = ";" + replacement;
 
                     this._codeMirror.replaceRange(replacement, cursor);
                 }
-            } else if (WebInspector.settings.stylesSelectOnFirstClick.value && this._mouseDownCursorPosition.previousRange) {
+            } else if (WI.settings.stylesSelectOnFirstClick.value && this._mouseDownCursorPosition.previousRange) {
                 let range = this._rangeForNextNameOrValue(this._codeMirror, cursor, line);
 
                 let clickedDifferentLine = this._mouseDownCursorPosition.previousRange.from.line !== cursor.line || this._mouseDownCursorPosition.previousRange.to.line !== cursor.line;
@@ -669,7 +669,7 @@
 
         if (cursor.ch >= line.trimRight().length - hasEndingSemicolon || pastLastSemicolon) {
             this._completionController.completeAtCurrentPositionIfNeeded().then(function(result) {
-                if (result !== WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
+                if (result !== WI.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
                     return;
 
                 let replacement = "";
@@ -714,7 +714,7 @@
         {
             var lineCount = this._codeMirror.lineCount();
             for (var i = 0; i < lineCount; ++i)
-                this._codeMirror.removeLineClass(i, "wrap", WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
+                this._codeMirror.removeLineClass(i, "wrap", WI.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
         }
 
         this._codeMirror.operation(removeEditingLineClasses.bind(this));
@@ -724,13 +724,13 @@
     {
         if (this._removeEditingLineClassesTimeout)
             return;
-        this._removeEditingLineClassesTimeout = setTimeout(this._removeEditingLineClasses.bind(this), WebInspector.CSSStyleDeclarationTextEditor.RemoveEditingLineClassesDelay);
+        this._removeEditingLineClassesTimeout = setTimeout(this._removeEditingLineClasses.bind(this), WI.CSSStyleDeclarationTextEditor.RemoveEditingLineClassesDelay);
     }
 
     _formattedContent()
     {
         // Start with the prefix whitespace we stripped.
-        var content = WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace;
+        var content = WI.CSSStyleDeclarationTextEditor.PrefixWhitespace;
 
         // Get each line and add the line prefix whitespace and newlines.
         var lineCount = this._codeMirror.lineCount();
@@ -742,7 +742,7 @@
         }
 
         // Add the suffix whitespace we stripped.
-        content += WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace;
+        content += WI.CSSStyleDeclarationTextEditor.SuffixWhitespace;
 
         // This regular expression replacement removes extra newlines
         // in between properties while preserving leading whitespace
@@ -768,7 +768,7 @@
         // Reset the content on blur since we stop accepting external changes while the the editor is focused.
         // This causes us to pick up any change that was suppressed while the editor was focused.
         this._resetContent();
-        this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred);
+        this.dispatchEventToListeners(WI.CSSStyleDeclarationTextEditor.Event.Blurred);
     }
 
     _editorFocused(codeMirror)
@@ -787,7 +787,7 @@
         this._markLinesWithCheckboxPlaceholder();
 
         this._clearRemoveEditingLineClassesTimeout();
-        this._codeMirror.addLineClass(change.from.line, "wrap", WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
+        this._codeMirror.addLineClass(change.from.line, "wrap", WI.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
 
         // When the change is a completion change, create color swatches now since the changes
         // will not go through _propertiesChanged until completionControllerCompletionsHidden happens.
@@ -798,14 +798,14 @@
         // Use a short delay for user input to coalesce more changes before committing. Other actions like
         // undo, redo and paste are atomic and work better with a zero delay. CodeMirror identifies changes that
         // get coalesced in the undo stack with a "+" prefix on the origin. Use that to set the delay for our coalescing.
-        var delay = change.origin && change.origin.charAt(0) === "+" ? WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay : 0;
+        var delay = change.origin && change.origin.charAt(0) === "+" ? WI.CSSStyleDeclarationTextEditor.CommitCoalesceDelay : 0;
 
         // Reset the timeout so rapid changes coalesce after a short delay.
         if (this._commitChangesTimeout)
             clearTimeout(this._commitChangesTimeout);
         this._commitChangesTimeout = setTimeout(this._commitChanges.bind(this), delay);
 
-        this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged);
+        this.dispatchEventToListeners(WI.CSSStyleDeclarationTextEditor.Event.ContentChanged);
     }
 
     _updateTextMarkers(nonatomic)
@@ -894,9 +894,9 @@
     {
         function createSwatch(swatch, marker, valueObject, valueString)
         {
-            swatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._inlineSwatchValueChanged, this);
-            swatch.addEventListener(WebInspector.InlineSwatch.Event.Activated, this._inlineSwatchActivated, this);
-            swatch.addEventListener(WebInspector.InlineSwatch.Event.Deactivated, this._inlineSwatchDeactivated, this);
+            swatch.addEventListener(WI.InlineSwatch.Event.ValueChanged, this._inlineSwatchValueChanged, this);
+            swatch.addEventListener(WI.InlineSwatch.Event.Activated, this._inlineSwatchActivated, this);
+            swatch.addEventListener(WI.InlineSwatch.Event.Deactivated, this._inlineSwatchDeactivated, this);
 
             let codeMirrorTextMarker = marker.codeMirrorTextMarker;
             let codeMirrorTextMarkerRange = codeMirrorTextMarker.find();
@@ -908,29 +908,29 @@
 
         function update()
         {
-            let range = typeof lineNumber === "number" ? new WebInspector.TextRange(lineNumber, 0, lineNumber + 1, 0) : null;
+            let range = typeof lineNumber === "number" ? new WI.TextRange(lineNumber, 0, lineNumber + 1, 0) : null;
 
             // Look for color strings and add swatches in front of them.
             createCodeMirrorColorTextMarkers(this._codeMirror, range, (marker, color, colorString) => {
-                let swatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Color, color, this._codeMirror.getOption("readOnly"));
+                let swatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Color, color, this._codeMirror.getOption("readOnly"));
                 createSwatch.call(this, swatch, marker, color, colorString);
             });
 
             // Look for gradient strings and add swatches in front of them.
             createCodeMirrorGradientTextMarkers(this._codeMirror, range, (marker, gradient, gradientString) => {
-                let swatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Gradient, gradient, this._codeMirror.getOption("readOnly"));
+                let swatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Gradient, gradient, this._codeMirror.getOption("readOnly"));
                 createSwatch.call(this, swatch, marker, gradient, gradientString);
             });
 
             // Look for cubic-bezier strings and add swatches in front of them.
             createCodeMirrorCubicBezierTextMarkers(this._codeMirror, range, (marker, bezier, bezierString) => {
-                let swatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Bezier, bezier, this._codeMirror.getOption("readOnly"));
+                let swatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Bezier, bezier, this._codeMirror.getOption("readOnly"));
                 createSwatch.call(this, swatch, marker, bezier, bezierString);
             });
 
             // Look for spring strings and add swatches in front of them.
             createCodeMirrorSpringTextMarkers(this._codeMirror, range, (marker, spring, springString) => {
-                let swatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Spring, spring, this._codeMirror.getOption("readOnly"));
+                let swatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Spring, spring, this._codeMirror.getOption("readOnly"));
                 createSwatch.call(this, swatch, marker, spring, springString);
             });
 
@@ -943,10 +943,10 @@
                     let to = {line: marker.range.endLine, ch: marker.range.endColumn};
                     this._codeMirror.markText(from, to, {className: "invalid"});
 
-                    if (WebInspector.settings.stylesShowInlineWarnings.value) {
+                    if (WI.settings.stylesShowInlineWarnings.value) {
                         let invalidMarker = document.createElement("button");
                         invalidMarker.classList.add("invalid-warning-marker", "clickable");
-                        invalidMarker.title = WebInspector.UIString("The variable “%s” does not exist.\nClick to delete and open autocomplete.").format(variableString);
+                        invalidMarker.title = WI.UIString("The variable “%s” does not exist.\nClick to delete and open autocomplete.").format(variableString);
                         invalidMarker.addEventListener("click", (event) => {
                             this._codeMirror.replaceRange("", from, to);
                             this._codeMirror.setCursor(from);
@@ -958,7 +958,7 @@
                 }
 
                 let trimmedValue = variableProperty.value.trim();
-                let swatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Variable, trimmedValue, this._codeMirror.getOption("readOnly"));
+                let swatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Variable, trimmedValue, this._codeMirror.getOption("readOnly"));
                 createSwatch.call(this, swatch, marker, variableProperty, trimmedValue);
             });
         }
@@ -1002,8 +1002,8 @@
         } else if (this._delegate.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows
                 && !property.implicit && typeof this._delegate.cssStyleDeclarationTextEditorShowProperty === "function") {
 
-            let arrowElement = WebInspector.createGoToArrowButton();
-            arrowElement.title = WebInspector.UIString("Option-click to show source");
+            let arrowElement = WI.createGoToArrowButton();
+            arrowElement.title = WI.UIString("Option-click to show source");
 
             let delegate = this._delegate;
             arrowElement.addEventListener("click", function(event) {
@@ -1028,8 +1028,8 @@
         }
 
         var propertyNameIsValid = false;
-        if (WebInspector.CSSCompletions.cssNameCompletions)
-            propertyNameIsValid = WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.name);
+        if (WI.CSSCompletions.cssNameCompletions)
+            propertyNameIsValid = WI.CSSCompletions.cssNameCompletions.isValidPropertyName(property.name);
 
         var classNames = ["css-style-declaration-property"];
 
@@ -1071,7 +1071,7 @@
         propertyTextMarker.__cssProperty = property;
         property.__propertyTextMarker = propertyTextMarker;
 
-        property.addEventListener(WebInspector.CSSProperty.Event.OverriddenStatusChanged, this._propertyOverriddenStatusChanged, this);
+        property.addEventListener(WI.CSSProperty.Event.OverriddenStatusChanged, this._propertyOverriddenStatusChanged, this);
 
         this._removeCheckboxPlaceholder(from.line);
 
@@ -1084,10 +1084,10 @@
             }
         }
 
-        if (this._codeMirror.getOption("readOnly") || property.hasOtherVendorNameOrKeyword() || property.text.trim().endsWith(":") || !WebInspector.settings.stylesShowInlineWarnings.value)
+        if (this._codeMirror.getOption("readOnly") || property.hasOtherVendorNameOrKeyword() || property.text.trim().endsWith(":") || !WI.settings.stylesShowInlineWarnings.value)
             return;
 
-        var propertyHasUnnecessaryPrefix = property.name.startsWith("-webkit-") && WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.canonicalName);
+        var propertyHasUnnecessaryPrefix = property.name.startsWith("-webkit-") && WI.CSSCompletions.cssNameCompletions.isValidPropertyName(property.canonicalName);
 
         function generateInvalidMarker(options)
         {
@@ -1132,14 +1132,14 @@
             // This property has a prefix and is valid without the prefix and the rule containing this property does not have the unprefixed version of the property.
             generateInvalidMarker.call(this, {
                 position: from,
-                title: WebInspector.UIString("The “webkit” prefix is not necessary.\nClick to insert a duplicate without the prefix."),
+                title: WI.UIString("The “webkit” prefix is not necessary.\nClick to insert a duplicate without the prefix."),
                 correction: property.text + "\n" + property.text.replace("-webkit-", ""),
                 autocomplete: false
             });
         } else if (instances > 1) {
             invalidMarkerInfo = {
                 position: from,
-                title: WebInspector.UIString("Duplicate property “%s”.\nClick to delete this property.").format(property.name),
+                title: WI.UIString("Duplicate property “%s”.\nClick to delete this property.").format(property.name),
                 correction: "",
                 autocomplete: false
             };
@@ -1161,12 +1161,12 @@
             if (/^(?:\d+)$/.test(property.value)) {
                 invalidMarkerInfo = {
                     position: from,
-                    title: WebInspector.UIString("The value “%s” needs units.\nClick to add “px” to the value.").format(property.value),
+                    title: WI.UIString("The value “%s” needs units.\nClick to add “px” to the value.").format(property.value),
                     correction: property.name + ": " + property.value + "px;",
                     autocomplete: false
                 };
             } else {
-                var valueReplacement = property.value.length ? WebInspector.UIString("The value “%s” is not supported for this property.\nClick to delete and open autocomplete.").format(property.value) : WebInspector.UIString("This property needs a value.\nClick to open autocomplete.");
+                var valueReplacement = property.value.length ? WI.UIString("The value “%s” is not supported for this property.\nClick to delete and open autocomplete.").format(property.value) : WI.UIString("This property needs a value.\nClick to open autocomplete.");
 
                 invalidMarkerInfo = {
                     position: from,
@@ -1175,31 +1175,31 @@
                     autocomplete: true
                 };
             }
-        } else if (!instancesOfProperty.call(this, "-webkit-" + property.name) && WebInspector.CSSCompletions.cssNameCompletions.propertyRequiresWebkitPrefix(property.name)) {
+        } else if (!instancesOfProperty.call(this, "-webkit-" + property.name) && WI.CSSCompletions.cssNameCompletions.propertyRequiresWebkitPrefix(property.name)) {
             // The property is valid and exists in the rule while its prefixed version does not.
             invalidMarkerInfo = {
                 position: from,
-                title: WebInspector.UIString("The “webkit” prefix is needed for this property.\nClick to insert a duplicate with the prefix."),
+                title: WI.UIString("The “webkit” prefix is needed for this property.\nClick to insert a duplicate with the prefix."),
                 correction: "-webkit-" + property.text + "\n" + property.text,
                 autocomplete: false
             };
-        } else if (!propertyHasUnnecessaryPrefix && !WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName("-webkit-" + property.name)) {
+        } else if (!propertyHasUnnecessaryPrefix && !WI.CSSCompletions.cssNameCompletions.isValidPropertyName("-webkit-" + property.name)) {
             // The property either has no prefix and is invalid with a prefix or is invalid without a prefix.
-            var closestPropertyName = WebInspector.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.name);
+            var closestPropertyName = WI.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.name);
 
             if (closestPropertyName) {
                 // The property name has less than 3 other properties that have the same Levenshtein distance.
                 invalidMarkerInfo = {
                     position: from,
-                    title: WebInspector.UIString("Did you mean “%s”?\nClick to replace.").format(closestPropertyName),
+                    title: WI.UIString("Did you mean “%s”?\nClick to replace.").format(closestPropertyName),
                     correction: property.text.replace(property.name, closestPropertyName),
                     autocomplete: true
                 };
-            } else if (property.name.startsWith("-webkit-") && (closestPropertyName = WebInspector.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.canonicalName))) {
+            } else if (property.name.startsWith("-webkit-") && (closestPropertyName = WI.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.canonicalName))) {
                 // The unprefixed property name has less than 3 other properties that have the same Levenshtein distance.
                 invalidMarkerInfo = {
                     position: from,
-                    title: WebInspector.UIString("Did you mean “%s”?\nClick to replace.").format("-webkit-" + closestPropertyName),
+                    title: WI.UIString("Did you mean “%s”?\nClick to replace.").format("-webkit-" + closestPropertyName),
                     correction: property.text.replace(property.canonicalName, closestPropertyName),
                     autocomplete: true
                 };
@@ -1207,7 +1207,7 @@
                 // The property name is so vague or nonsensical that there are more than 3 other properties that have the same Levenshtein value.
                 invalidMarkerInfo = {
                     position: from,
-                    title: WebInspector.UIString("Unsupported property “%s”").format(property.name),
+                    title: WI.UIString("Unsupported property “%s”").format(property.name),
                     correction: false,
                     autocomplete: false
                 };
@@ -1260,10 +1260,10 @@
         let filterFunction = (property) => property; // Identity function.
         if (this._filterResultPropertyNames) {
             filterFunction = (property) => {
-                if (!property.variable && this._propertyVisibilityMode === WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables)
+                if (!property.variable && this._propertyVisibilityMode === WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables)
                     return false;
 
-                if (property.variable && this._propertyVisibilityMode === WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables)
+                if (property.variable && this._propertyVisibilityMode === WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables)
                     return false;
 
                 if (property.implicit && !this._showsImplicitProperties)
@@ -1278,18 +1278,18 @@
             // Filter based on options only when all properties are used.
             filterFunction = (property) => {
                 switch (this._propertyVisibilityMode) {
-                case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables:
+                case WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables:
                     if (!property.variable)
                         return false;
 
                     break;
-                case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables:
+                case WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables:
                     if (property.variable)
                         return false;
 
                     break;
 
-                case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll:
+                case WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll:
                     break;
 
                 default:
@@ -1382,7 +1382,7 @@
 
         function update()
         {
-            this._codeMirror.addLineClass(range.from.line, "wrap", WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
+            this._codeMirror.addLineClass(range.from.line, "wrap", WI.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
             this._codeMirror.replaceRange(text, range.from, range.to);
 
             // Update the line for any inline swatches that got removed.
@@ -1506,7 +1506,7 @@
             var position = {line: i, ch: 0};
 
             var placeholderElement = document.createElement("div");
-            placeholderElement.className = WebInspector.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName;
+            placeholderElement.className = WI.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName;
 
             var placeholderMark = this._codeMirror.setUniqueBookmark(position, placeholderElement);
             placeholderMark.__checkboxPlaceholder = true;
@@ -1528,9 +1528,9 @@
 
     _formattedContentFromEditor()
     {
-        let indentString = WebInspector.indentString();
+        let indentString = WI.indentString();
         let builder = new FormatterContentBuilder(indentString);
-        let formatter = new WebInspector.Formatter(this._codeMirror, builder);
+        let formatter = new WI.Formatter(this._codeMirror, builder);
         let start = {line: 0, ch: 0};
         let end = {line: this._codeMirror.lineCount() - 1};
         formatter.format(start, end);
@@ -1552,11 +1552,11 @@
         this._codeMirror.setOption("readOnly", readOnly);
 
         if (readOnly) {
-            this.element.classList.add(WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName);
-            this._codeMirror.setOption("placeholder", WebInspector.UIString("No Properties"));
+            this.element.classList.add(WI.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName);
+            this._codeMirror.setOption("placeholder", WI.UIString("No Properties"));
         } else {
-            this.element.classList.remove(WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName);
-            this._codeMirror.setOption("placeholder", WebInspector.UIString("No Properties \u2014 Click to Edit"));
+            this.element.classList.remove(WI.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName);
+            this._codeMirror.setOption("placeholder", WI.UIString("No Properties \u2014 Click to Edit"));
         }
 
         if (!this._style) {
@@ -1604,7 +1604,7 @@
             let selectionHead = this._codeMirror.getCursor("head");
             let whitespaceRegex = /\s+/g;
 
-            this._linePrefixWhitespace = WebInspector.indentString();
+            this._linePrefixWhitespace = WI.indentString();
 
             let styleTextPrefixWhitespace = styleText.match(/^\s*/);
 
@@ -1692,7 +1692,7 @@
         if (!this._style)
             this._jumpToSymbolTrackingModeEnabled = false;
         else
-            this._jumpToSymbolTrackingModeEnabled = WebInspector.modifierKeys.altKey && !WebInspector.modifierKeys.metaKey && !WebInspector.modifierKeys.shiftKey;
+            this._jumpToSymbolTrackingModeEnabled = WI.modifierKeys.altKey && !WI.modifierKeys.metaKey && !WI.modifierKeys.shiftKey;
 
         if (oldJumpToSymbolTrackingModeEnabled !== this._jumpToSymbolTrackingModeEnabled) {
             if (this._jumpToSymbolTrackingModeEnabled) {
@@ -1729,7 +1729,7 @@
             let baseURL = sourceCodeLocation ? sourceCodeLocation.sourceCode.url : this._style.node.ownerDocument.documentURL;
 
             const frame = null;
-            WebInspector.openURL(absoluteURL(url, baseURL), frame, options);
+            WI.openURL(absoluteURL(url, baseURL), frame, options);
             return;
         }
 
@@ -1746,7 +1746,7 @@
             if (!sourceCode || !range)
                 return false;
 
-            WebInspector.showSourceCodeLocation(sourceCode.createSourceCodeLocation(range.startLine, range.startColumn), options);
+            WI.showSourceCodeLocation(sourceCode.createSourceCodeLocation(range.startLine, range.startColumn), options);
             return true;
         }
 
@@ -1780,22 +1780,22 @@
     }
 };
 
-WebInspector.CSSStyleDeclarationTextEditor.Event = {
+WI.CSSStyleDeclarationTextEditor.Event = {
     ContentChanged: "css-style-declaration-text-editor-content-changed",
     Blurred: "css-style-declaration-text-editor-blurred"
 };
 
-WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode = {
+WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode = {
     ShowAll: Symbol("variable-visibility-show-all"),
     HideVariables: Symbol("variable-visibility-hide-variables"),
     HideNonVariables: Symbol("variable-visibility-hide-non-variables"),
 };
 
-WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace = "\n";
-WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace = "\n";
-WebInspector.CSSStyleDeclarationTextEditor.StyleClassName = "css-style-text-editor";
-WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName = "read-only";
-WebInspector.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName = "checkbox-placeholder";
-WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName = "editing-line";
-WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay = 250;
-WebInspector.CSSStyleDeclarationTextEditor.RemoveEditingLineClassesDelay = 2000;
+WI.CSSStyleDeclarationTextEditor.PrefixWhitespace = "\n";
+WI.CSSStyleDeclarationTextEditor.SuffixWhitespace = "\n";
+WI.CSSStyleDeclarationTextEditor.StyleClassName = "css-style-text-editor";
+WI.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName = "read-only";
+WI.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName = "checkbox-placeholder";
+WI.CSSStyleDeclarationTextEditor.EditingLineStyleClassName = "editing-line";
+WI.CSSStyleDeclarationTextEditor.CommitCoalesceDelay = 250;
+WI.CSSStyleDeclarationTextEditor.RemoveEditingLineClassesDelay = 2000;
diff --git a/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js
index 2266864..9a291e2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js
@@ -23,33 +23,33 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleDetailsSidebarPanel = class CSSStyleDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel
+WI.CSSStyleDetailsSidebarPanel = class CSSStyleDetailsSidebarPanel extends WI.DOMDetailsSidebarPanel
 {
     constructor()
     {
         const dontCreateNavigationItem = true;
-        super("css-style", WebInspector.UIString("Styles"), dontCreateNavigationItem);
+        super("css-style", WI.UIString("Styles"), dontCreateNavigationItem);
 
         this._selectedPanel = null;
-        this._computedStyleDetailsPanel = new WebInspector.ComputedStyleDetailsPanel(this);
-        this._rulesStyleDetailsPanel = new WebInspector.RulesStyleDetailsPanel(this);
-        this._visualStyleDetailsPanel = new WebInspector.VisualStyleDetailsPanel(this);
+        this._computedStyleDetailsPanel = new WI.ComputedStyleDetailsPanel(this);
+        this._rulesStyleDetailsPanel = new WI.RulesStyleDetailsPanel(this);
+        this._visualStyleDetailsPanel = new WI.VisualStyleDetailsPanel(this);
 
-        if (WebInspector.settings.experimentalSpreadsheetStyleEditor.value)
-            this._activeRulesStyleDetailsPanel = new WebInspector.RulesStyleSpreadsheetDetailsPanel(this);
+        if (WI.settings.experimentalSpreadsheetStyleEditor.value)
+            this._activeRulesStyleDetailsPanel = new WI.RulesStyleSpreadsheetDetailsPanel(this);
         else
             this._activeRulesStyleDetailsPanel = this._rulesStyleDetailsPanel;
 
         this._panels = [this._computedStyleDetailsPanel, this._activeRulesStyleDetailsPanel, this._visualStyleDetailsPanel];
         this._panelNavigationInfo = [this._computedStyleDetailsPanel.navigationInfo, this._activeRulesStyleDetailsPanel.navigationInfo, this._visualStyleDetailsPanel.navigationInfo];
 
-        this._lastSelectedPanelSetting = new WebInspector.Setting("last-selected-style-details-panel", this._activeRulesStyleDetailsPanel.navigationInfo.identifier);
-        this._classListContainerToggledSetting = new WebInspector.Setting("class-list-container-toggled", false);
+        this._lastSelectedPanelSetting = new WI.Setting("last-selected-style-details-panel", this._activeRulesStyleDetailsPanel.navigationInfo.identifier);
+        this._classListContainerToggledSetting = new WI.Setting("class-list-container-toggled", false);
 
         this._initiallySelectedPanel = this._panelMatchingIdentifier(this._lastSelectedPanelSetting.value) || this._activeRulesStyleDetailsPanel;
 
-        this._navigationItem = new WebInspector.ScopeRadioButtonNavigationItem(this.identifier, this.displayName, this._panelNavigationInfo, this._initiallySelectedPanel.navigationInfo);
-        this._navigationItem.addEventListener(WebInspector.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged, this._handleSelectedItemChanged, this);
+        this._navigationItem = new WI.ScopeRadioButtonNavigationItem(this.identifier, this.displayName, this._panelNavigationInfo, this._initiallySelectedPanel.navigationInfo);
+        this._navigationItem.addEventListener(WI.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged, this._handleSelectedItemChanged, this);
 
         this._forcedPseudoClassCheckboxes = {};
     }
@@ -114,9 +114,9 @@
         if (!effectiveDOMNode)
             return;
 
-        effectiveDOMNode.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged, this._updatePseudoClassCheckboxes, this);
-        effectiveDOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeModified, this._handleNodeAttributeModified, this);
-        effectiveDOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved, this._handleNodeAttributeRemoved, this);
+        effectiveDOMNode.addEventListener(WI.DOMNode.Event.EnabledPseudoClassesChanged, this._updatePseudoClassCheckboxes, this);
+        effectiveDOMNode.addEventListener(WI.DOMNode.Event.AttributeModified, this._handleNodeAttributeModified, this);
+        effectiveDOMNode.addEventListener(WI.DOMNode.Event.AttributeRemoved, this._handleNodeAttributeRemoved, this);
     }
 
     removeEventListeners()
@@ -130,13 +130,13 @@
 
     initialLayout()
     {
-        if (WebInspector.cssStyleManager.canForcePseudoClasses()) {
+        if (WI.cssStyleManager.canForcePseudoClasses()) {
             this._forcedPseudoClassContainer = document.createElement("div");
             this._forcedPseudoClassContainer.className = "pseudo-classes";
 
             let groupElement = null;
 
-            WebInspector.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass) {
+            WI.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass) {
                 // We don't localize the label since it is a CSS pseudo-class from the CSS standard.
                 let label = pseudoClass.capitalize();
 
@@ -163,8 +163,8 @@
             this.contentView.element.appendChild(this._forcedPseudoClassContainer);
         }
 
-        this._computedStyleDetailsPanel.addEventListener(WebInspector.StyleDetailsPanel.Event.Refreshed, this._filterDidChange, this);
-        this._rulesStyleDetailsPanel.addEventListener(WebInspector.StyleDetailsPanel.Event.Refreshed, this._filterDidChange, this);
+        this._computedStyleDetailsPanel.addEventListener(WI.StyleDetailsPanel.Event.Refreshed, this._filterDidChange, this);
+        this._rulesStyleDetailsPanel.addEventListener(WI.StyleDetailsPanel.Event.Refreshed, this._filterDidChange, this);
 
         console.assert(this._initiallySelectedPanel, "Should have an initially selected panel.");
 
@@ -174,34 +174,34 @@
         let optionsContainer = this.element.createChild("div", "options-container");
 
         let newRuleButton = optionsContainer.createChild("img", "new-rule");
-        newRuleButton.title = WebInspector.UIString("Add new rule");
+        newRuleButton.title = WI.UIString("Add new rule");
         newRuleButton.addEventListener("click", this._newRuleButtonClicked.bind(this));
         newRuleButton.addEventListener("contextmenu", this._newRuleButtonContextMenu.bind(this));
 
-        this._filterBar = new WebInspector.FilterBar;
-        this._filterBar.placeholder = WebInspector.UIString("Filter Styles");
-        this._filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange, this._filterDidChange, this);
+        this._filterBar = new WI.FilterBar;
+        this._filterBar.placeholder = WI.UIString("Filter Styles");
+        this._filterBar.addEventListener(WI.FilterBar.Event.FilterDidChange, this._filterDidChange, this);
         optionsContainer.appendChild(this._filterBar.element);
 
         this._classToggleButton = optionsContainer.createChild("button", "toggle-class-toggle");
-        this._classToggleButton.textContent = WebInspector.UIString("Classes");
-        this._classToggleButton.title = WebInspector.UIString("Toggle Classes");
+        this._classToggleButton.textContent = WI.UIString("Classes");
+        this._classToggleButton.title = WI.UIString("Toggle Classes");
         this._classToggleButton.addEventListener("click", this._classToggleButtonClicked.bind(this));
 
         this._classListContainer = this.element.createChild("div", "class-list-container");
         this._classListContainer.hidden = true;
 
         this._addClassContainer = this._classListContainer.createChild("div", "new-class");
-        this._addClassContainer.title = WebInspector.UIString("Add a Class");
+        this._addClassContainer.title = WI.UIString("Add a Class");
         this._addClassContainer.addEventListener("click", this._addClassContainerClicked.bind(this));
 
         this._addClassInput = this._addClassContainer.createChild("input", "class-name-input");
-        this._addClassInput.setAttribute("placeholder", WebInspector.UIString("Enter Class Name"));
+        this._addClassInput.setAttribute("placeholder", WI.UIString("Enter Class Name"));
         this._addClassInput.addEventListener("keypress", this._addClassInputKeyPressed.bind(this));
         this._addClassInput.addEventListener("blur", this._addClassInputBlur.bind(this));
 
-        WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAddedOrRemoved, this);
-        WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, this._styleSheetAddedOrRemoved, this);
+        WI.cssStyleManager.addEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAddedOrRemoved, this);
+        WI.cssStyleManager.addEventListener(WI.CSSStyleManager.Event.StyleSheetRemoved, this._styleSheetAddedOrRemoved, this);
 
         if (this._classListContainerToggledSetting.value)
             this._classToggleButtonClicked();
@@ -221,15 +221,15 @@
 
     get _initialScrollOffset()
     {
-        if (!WebInspector.cssStyleManager.canForcePseudoClasses())
+        if (!WI.cssStyleManager.canForcePseudoClasses())
             return 0;
-        return this.domNode && this.domNode.enabledPseudoClasses.length ? 0 : WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;
+        return this.domNode && this.domNode.enabledPseudoClasses.length ? 0 : WI.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;
     }
 
     _updateNoForcedPseudoClassesScrollOffset()
     {
         if (this._forcedPseudoClassContainer)
-            WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset = this._forcedPseudoClassContainer.offsetHeight;
+            WI.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset = this._forcedPseudoClassContainer.offsetHeight;
     }
 
     _panelMatchingIdentifier(identifier)
@@ -277,7 +277,7 @@
         let hasFilter = typeof this._selectedPanel.filterDidChange === "function";
         this.contentView.element.classList.toggle("has-filter-bar", hasFilter);
         if (this._filterBar)
-            this.contentView.element.classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName, hasFilter && this._filterBar.hasActiveFilters());
+            this.contentView.element.classList.toggle(WI.CSSStyleDetailsSidebarPanel.FilterInProgressClassName, hasFilter && this._filterBar.hasActiveFilters());
 
         this.contentView.element.classList.toggle("supports-new-rule", typeof this._selectedPanel.newRuleButtonClicked === "function");
         this._selectedPanel.shown();
@@ -354,7 +354,7 @@
 
     _addClassInputKeyPressed(event)
     {
-        if (event.keyCode !== WebInspector.KeyboardShortcut.Key.Enter.keyCode)
+        if (event.keyCode !== WI.KeyboardShortcut.Key.Enter.keyCode)
             return;
 
         this._addClassInput.blur();
@@ -374,9 +374,9 @@
             this._classListContainer.children[1].remove();
 
         let classes = this.domNode.getAttribute("class");
-        let classToggledMap = this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];
+        let classToggledMap = this.domNode[WI.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];
         if (!classToggledMap)
-            classToggledMap = this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol] = new Map;
+            classToggledMap = this.domNode[WI.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol] = new Map;
 
         if (classes && classes.length) {
             for (let className of classes.split(/\s+/))
@@ -398,7 +398,7 @@
         if (!className || !className.length)
             return;
 
-        let classToggledMap = this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];
+        let classToggledMap = this.domNode[WI.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];
         if (!classToggledMap)
             return;
 
@@ -418,7 +418,7 @@
         classNameTitle.textContent = className;
         classNameTitle.draggable = true;
         classNameTitle.addEventListener("dragstart", (event) => {
-            event.dataTransfer.setData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType, className);
+            event.dataTransfer.setData(WI.CSSStyleDetailsSidebarPanel.ToggledClassesDragType, className);
             event.dataTransfer.effectAllowed = "copy";
         });
 
@@ -438,7 +438,7 @@
 
     _filterDidChange()
     {
-        this.contentView.element.classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName, this._filterBar.hasActiveFilters());
+        this.contentView.element.classList.toggle(WI.CSSStyleDetailsSidebarPanel.FilterInProgressClassName, this._filterBar.hasActiveFilters());
 
         this._selectedPanel.filterDidChange(this._filterBar);
     }
@@ -449,12 +449,12 @@
     }
 };
 
-WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset = 30; // Default height of the forced pseudo classes container. Updated in sizeDidChange.
-WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName = "filter-in-progress";
-WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName = "filter-section-has-label";
-WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName = "filter-matching";
-WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName = "filter-section-non-matching";
-WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName = "filter-property-non-matching";
+WI.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset = 30; // Default height of the forced pseudo classes container. Updated in sizeDidChange.
+WI.CSSStyleDetailsSidebarPanel.FilterInProgressClassName = "filter-in-progress";
+WI.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName = "filter-section-has-label";
+WI.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName = "filter-matching";
+WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName = "filter-section-non-matching";
+WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName = "filter-property-non-matching";
 
-WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol = Symbol("css-style-details-sidebar-panel-toggled-classes-symbol");
-WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType = "text/classname";
+WI.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol = Symbol("css-style-details-sidebar-panel-toggled-classes-symbol");
+WI.CSSStyleDetailsSidebarPanel.ToggledClassesDragType = "text/classname";
diff --git a/Source/WebInspectorUI/UserInterface/Views/CSSStyleSheetTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/CSSStyleSheetTreeElement.js
index 78ebae1..288fb46 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CSSStyleSheetTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CSSStyleSheetTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleSheetTreeElement = class CSSStyleSheetTreeElement extends WebInspector.SourceCodeTreeElement
+WI.CSSStyleSheetTreeElement = class CSSStyleSheetTreeElement extends WI.SourceCodeTreeElement
 {
     constructor(styleSheet)
     {
-        console.assert(styleSheet instanceof WebInspector.CSSStyleSheet);
+        console.assert(styleSheet instanceof WI.CSSStyleSheet);
         console.assert(styleSheet.isInspectorStyleSheet());
 
-        super(styleSheet, ["stylesheet", "stylesheet-icon"], WebInspector.UIString("Inspector Style Sheet"));
+        super(styleSheet, ["stylesheet", "stylesheet-icon"], WI.UIString("Inspector Style Sheet"));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js
index e6ab8f8..31ff69c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CallFrameTreeElement = class CallFrameTreeElement extends WebInspector.GeneralTreeElement
+WI.CallFrameTreeElement = class CallFrameTreeElement extends WI.GeneralTreeElement
 {
     constructor(callFrame, isAsyncBoundaryCallFrame)
     {
-        console.assert(callFrame instanceof WebInspector.CallFrame);
+        console.assert(callFrame instanceof WI.CallFrame);
 
-        let className = WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame);
-        let title = callFrame.functionName || WebInspector.UIString("(anonymous function)");
+        let className = WI.CallFrameView.iconClassNameForCallFrame(callFrame);
+        let title = callFrame.functionName || WI.UIString("(anonymous function)");
         const subtitle = null;
         super(["call-frame", className], title, subtitle, callFrame);
 
@@ -81,7 +81,7 @@
         if (this.tooltipHandledSeparately) {
             let tailCallSuffix = "";
             if (this._callFrame.isTailDeleted)
-                tailCallSuffix = " " + WebInspector.UIString("(Tail Call)");
+                tailCallSuffix = " " + WI.UIString("(Tail Call)");
             let tooltipPrefix = this.mainTitle + tailCallSuffix + "\n";
             this._callFrame.sourceCodeLocation.populateLiveDisplayLocationTooltip(this.element, tooltipPrefix);
         }
diff --git a/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js b/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js
index e7ac854..5a17219 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CallFrameView = class CallFrameView extends WebInspector.Object
+WI.CallFrameView = class CallFrameView extends WI.Object
 {
     constructor(callFrame, showFunctionName)
     {
-        console.assert(callFrame instanceof WebInspector.CallFrame);
+        console.assert(callFrame instanceof WI.CallFrame);
 
         var callFrameElement = document.createElement("div");
-        callFrameElement.classList.add("call-frame", WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame));
+        callFrameElement.classList.add("call-frame", WI.CallFrameView.iconClassNameForCallFrame(callFrame));
 
         var subtitleElement = document.createElement("span");
         subtitleElement.classList.add("subtitle");
 
         var sourceCodeLocation = callFrame.sourceCodeLocation;
         if (sourceCodeLocation) {
-            WebInspector.linkifyElement(callFrameElement, sourceCodeLocation);
+            WI.linkifyElement(callFrameElement, sourceCodeLocation);
 
             var linkElement = document.createElement("a");
             linkElement.classList.add("source-link");
@@ -63,7 +63,7 @@
             var imgElement = document.createElement("img");
             imgElement.classList.add("icon");
 
-            titleElement.append(imgElement, callFrame.functionName || WebInspector.UIString("(anonymous function)"));
+            titleElement.append(imgElement, callFrame.functionName || WI.UIString("(anonymous function)"));
         }
 
         callFrameElement.append(titleElement, subtitleElement);
@@ -74,25 +74,25 @@
     static iconClassNameForCallFrame(callFrame)
     {
         if (callFrame.isTailDeleted)
-            return WebInspector.CallFrameView.TailDeletedIcon;
+            return WI.CallFrameView.TailDeletedIcon;
 
         if (callFrame.programCode)
-            return WebInspector.CallFrameView.ProgramIconStyleClassName;
+            return WI.CallFrameView.ProgramIconStyleClassName;
 
         // This is more than likely an event listener function with an "on" prefix and it is
         // as long or longer than the shortest event listener name -- "oncut".
         if (callFrame.functionName && callFrame.functionName.startsWith("on") && callFrame.functionName.length >= 5)
-            return WebInspector.CallFrameView.EventListenerIconStyleClassName;
+            return WI.CallFrameView.EventListenerIconStyleClassName;
 
         if (callFrame.nativeCode)
-            return WebInspector.CallFrameView.NativeIconStyleClassName;
+            return WI.CallFrameView.NativeIconStyleClassName;
 
-        return WebInspector.CallFrameView.FunctionIconStyleClassName;
+        return WI.CallFrameView.FunctionIconStyleClassName;
     }
 };
 
-WebInspector.CallFrameView.ProgramIconStyleClassName = "program-icon";
-WebInspector.CallFrameView.FunctionIconStyleClassName = "function-icon";
-WebInspector.CallFrameView.EventListenerIconStyleClassName = "event-listener-icon";
-WebInspector.CallFrameView.NativeIconStyleClassName = "native-icon";
-WebInspector.CallFrameView.TailDeletedIcon = "tail-deleted";
+WI.CallFrameView.ProgramIconStyleClassName = "program-icon";
+WI.CallFrameView.FunctionIconStyleClassName = "function-icon";
+WI.CallFrameView.EventListenerIconStyleClassName = "event-listener-icon";
+WI.CallFrameView.NativeIconStyleClassName = "native-icon";
+WI.CallFrameView.TailDeletedIcon = "tail-deleted";
diff --git a/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js b/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
index d96b344..e859281 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CanvasContentView = class CanvasContentView extends WebInspector.ContentView
+WI.CanvasContentView = class CanvasContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.Canvas);
+        console.assert(representedObject instanceof WI.Canvas);
 
         super(representedObject);
 
@@ -37,19 +37,19 @@
         this._previewImageElement = null;
         this._errorElement = null;
 
-        if (representedObject.contextType === WebInspector.Canvas.ContextType.Canvas2D) {
-            const toolTip = WebInspector.UIString("Request recording of actions. Shift-click to record a single frame.");
-            const altToolTip = WebInspector.UIString("Cancel recording");
-            this._recordButtonNavigationItem = new WebInspector.ToggleButtonNavigationItem("canvas-record", toolTip, altToolTip, "Images/Record.svg", "Images/Stop.svg", 13, 13);
-            this._recordButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleRecording, this);
+        if (representedObject.contextType === WI.Canvas.ContextType.Canvas2D) {
+            const toolTip = WI.UIString("Request recording of actions. Shift-click to record a single frame.");
+            const altToolTip = WI.UIString("Cancel recording");
+            this._recordButtonNavigationItem = new WI.ToggleButtonNavigationItem("canvas-record", toolTip, altToolTip, "Images/Record.svg", "Images/Stop.svg", 13, 13);
+            this._recordButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleRecording, this);
         }
 
-        this._refreshButtonNavigationItem = new WebInspector.ButtonNavigationItem("canvas-refresh", WebInspector.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
-        this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._showPreview, this);
+        this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("canvas-refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
+        this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._showPreview, this);
 
-        this._showGridButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-grid", WebInspector.UIString("Show Grid"), WebInspector.UIString("Hide Grid"), "Images/NavigationItemCheckers.svg", 13, 13);
-        this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._showGridButtonClicked, this);
-        this._showGridButtonNavigationItem.activated = !!WebInspector.settings.showImageGrid.value;
+        this._showGridButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-grid", WI.UIString("Show Grid"), WI.UIString("Hide Grid"), "Images/NavigationItemCheckers.svg", 13, 13);
+        this._showGridButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._showGridButtonClicked, this);
+        this._showGridButtonNavigationItem.activated = !!WI.settings.showImageGrid.value;
     }
 
     // Protected
@@ -66,7 +66,7 @@
     {
         super.initialLayout();
 
-        WebInspector.canvasManager.addEventListener(WebInspector.CanvasManager.Event.RecordingFinished, this._recordingFinished, this);
+        WI.canvasManager.addEventListener(WI.CanvasManager.Event.RecordingFinished, this._recordingFinished, this);
     }
 
     shown()
@@ -75,19 +75,19 @@
 
         this._showPreview();
 
-        WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed, this._updateImageGrid, this);
+        WI.settings.showImageGrid.addEventListener(WI.Setting.Event.Changed, this._updateImageGrid, this);
     }
 
     hidden()
     {
-        WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed, this._updateImageGrid, this);
+        WI.settings.showImageGrid.removeEventListener(WI.Setting.Event.Changed, this._updateImageGrid, this);
 
         super.hidden();
     }
 
     closed()
     {
-        WebInspector.canvasManager.removeEventListener(null, null, this);
+        WI.canvasManager.removeEventListener(null, null, this);
 
         super.closed();
     }
@@ -113,7 +113,7 @@
         if (this._recordButtonNavigationItem)
             this._recordButtonNavigationItem.toggled = false;
 
-        WebInspector.showRepresentedObject(event.data.recording);
+        WI.showRepresentedObject(event.data.recording);
     }
 
     _showPreview()
@@ -124,7 +124,7 @@
 
             if (!this._errorElement) {
                 const isError = true;
-                this._errorElement = WebInspector.createMessageTextView(WebInspector.UIString("No Preview Available"), isError);
+                this._errorElement = WI.createMessageTextView(WI.UIString("No Preview Available"), isError);
             }
 
             this.element.appendChild(this._errorElement);
@@ -161,14 +161,14 @@
         if (!this._previewImageElement)
             return;
 
-        let activated = WebInspector.settings.showImageGrid.value;
+        let activated = WI.settings.showImageGrid.value;
         this._showGridButtonNavigationItem.activated = activated;
         this._previewImageElement.classList.toggle("show-grid", activated);
     }
 
     _showGridButtonClicked(event)
     {
-        WebInspector.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated;
+        WI.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated;
 
         this._updateImageGrid();
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js
index cadd43a..4bd5ea2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CanvasDetailsSidebarPanel = class CanvasDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.CanvasDetailsSidebarPanel = class CanvasDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("canvas", WebInspector.UIString("Canvas"));
+        super("canvas", WI.UIString("Canvas"));
 
         this.element.classList.add("canvas");
 
@@ -42,9 +42,9 @@
         if (!(objects instanceof Array))
             objects = [objects];
 
-        objects = objects.map((object) => object instanceof WebInspector.Recording ? object.source : object);
+        objects = objects.map((object) => object instanceof WI.Recording ? object.source : object);
 
-        this.canvas = objects.find((object) => object instanceof WebInspector.Canvas);
+        this.canvas = objects.find((object) => object instanceof WI.Canvas);
 
         return !!this._canvas;
     }
@@ -60,22 +60,22 @@
             return;
 
         if (this._node) {
-            this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeModified, this._refreshSourceSection, this);
-            this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeRemoved, this._refreshSourceSection, this);
+            this._node.removeEventListener(WI.DOMNode.Event.AttributeModified, this._refreshSourceSection, this);
+            this._node.removeEventListener(WI.DOMNode.Event.AttributeRemoved, this._refreshSourceSection, this);
 
             this._node = null;
         }
 
         if (this._canvas) {
-            this._canvas.removeEventListener(WebInspector.Canvas.Event.MemoryChanged, this._canvasMemoryChanged, this);
-            this._canvas.removeEventListener(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged, this._refreshCSSCanvasSection, this);
+            this._canvas.removeEventListener(WI.Canvas.Event.MemoryChanged, this._canvasMemoryChanged, this);
+            this._canvas.removeEventListener(WI.Canvas.Event.CSSCanvasClientNodesChanged, this._refreshCSSCanvasSection, this);
         }
 
         this._canvas = canvas || null;
 
         if (this._canvas) {
-            this._canvas.addEventListener(WebInspector.Canvas.Event.MemoryChanged, this._canvasMemoryChanged, this);
-            this._canvas.addEventListener(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged, this._refreshCSSCanvasSection, this);
+            this._canvas.addEventListener(WI.Canvas.Event.MemoryChanged, this._canvasMemoryChanged, this);
+            this._canvas.addEventListener(WI.Canvas.Event.CSSCanvasClientNodesChanged, this._refreshCSSCanvasSection, this);
         }
 
         this.needsLayout();
@@ -87,35 +87,35 @@
     {
         super.initialLayout();
 
-        this._nameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));
-        this._typeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"));
-        this._memoryRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Memory"));
-        this._memoryRow.tooltip = WebInspector.UIString("Memory usage of this canvas");
+        this._nameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Name"));
+        this._typeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Type"));
+        this._memoryRow = new WI.DetailsSectionSimpleRow(WI.UIString("Memory"));
+        this._memoryRow.tooltip = WI.UIString("Memory usage of this canvas");
 
-        let identitySection = new WebInspector.DetailsSection("canvas-details", WebInspector.UIString("Identity"));
-        identitySection.groups = [new WebInspector.DetailsSectionGroup([this._nameRow, this._typeRow, this._memoryRow])];
+        let identitySection = new WI.DetailsSection("canvas-details", WI.UIString("Identity"));
+        identitySection.groups = [new WI.DetailsSectionGroup([this._nameRow, this._typeRow, this._memoryRow])];
         this.contentView.element.appendChild(identitySection.element);
 
-        this._nodeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"));
-        this._cssCanvasRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("CSS Canvas"));
-        this._widthRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width"));
-        this._heightRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height"));
-        this._datachedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Detached"));
+        this._nodeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Node"));
+        this._cssCanvasRow = new WI.DetailsSectionSimpleRow(WI.UIString("CSS Canvas"));
+        this._widthRow = new WI.DetailsSectionSimpleRow(WI.UIString("Width"));
+        this._heightRow = new WI.DetailsSectionSimpleRow(WI.UIString("Height"));
+        this._datachedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Detached"));
 
-        let sourceSection = new WebInspector.DetailsSection("canvas-source", WebInspector.UIString("Source"));
-        sourceSection.groups = [new WebInspector.DetailsSectionGroup([this._nodeRow, this._cssCanvasRow, this._widthRow, this._heightRow, this._datachedRow])];
+        let sourceSection = new WI.DetailsSection("canvas-source", WI.UIString("Source"));
+        sourceSection.groups = [new WI.DetailsSectionGroup([this._nodeRow, this._cssCanvasRow, this._widthRow, this._heightRow, this._datachedRow])];
         this.contentView.element.appendChild(sourceSection.element);
 
-        this._attributesDataGridRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Attributes"));
+        this._attributesDataGridRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Attributes"));
 
-        let attributesSection = new WebInspector.DetailsSection("canvas-attributes", WebInspector.UIString("Attributes"));
-        attributesSection.groups = [new WebInspector.DetailsSectionGroup([this._attributesDataGridRow])];
+        let attributesSection = new WI.DetailsSection("canvas-attributes", WI.UIString("Attributes"));
+        attributesSection.groups = [new WI.DetailsSectionGroup([this._attributesDataGridRow])];
         this.contentView.element.appendChild(attributesSection.element);
 
-        this._cssCanvasClientsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Nodes"));
+        this._cssCanvasClientsRow = new WI.DetailsSectionSimpleRow(WI.UIString("Nodes"));
 
-        this._cssCanvasSection = new WebInspector.DetailsSection("canvas-css", WebInspector.UIString("CSS"));
-        this._cssCanvasSection.groups = [new WebInspector.DetailsSectionGroup([this._cssCanvasClientsRow])];
+        this._cssCanvasSection = new WI.DetailsSection("canvas-css", WI.UIString("CSS"));
+        this._cssCanvasSection.groups = [new WI.DetailsSectionGroup([this._cssCanvasClientsRow])];
         this._cssCanvasSection.element.hidden = true;
         this.contentView.element.appendChild(this._cssCanvasSection.element);
     }
@@ -146,7 +146,7 @@
     _refreshIdentitySection()
     {
         this._nameRow.value = this._canvas.displayName;
-        this._typeRow.value = WebInspector.Canvas.displayNameForContextType(this._canvas.contextType);
+        this._typeRow.value = WI.Canvas.displayNameForContextType(this._canvas.contextType);
         this._formatMemoryRow();
     }
 
@@ -167,20 +167,20 @@
 
             if (node !== this._node) {
                 if (this._node) {
-                    this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeModified, this._refreshSourceSection, this);
-                    this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeRemoved, this._refreshSourceSection, this);
+                    this._node.removeEventListener(WI.DOMNode.Event.AttributeModified, this._refreshSourceSection, this);
+                    this._node.removeEventListener(WI.DOMNode.Event.AttributeRemoved, this._refreshSourceSection, this);
 
                     this._node = null;
                 }
 
                 this._node = node;
 
-                this._node.addEventListener(WebInspector.DOMNode.Event.AttributeModified, this._refreshSourceSection, this);
-                this._node.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved, this._refreshSourceSection, this);
+                this._node.addEventListener(WI.DOMNode.Event.AttributeModified, this._refreshSourceSection, this);
+                this._node.addEventListener(WI.DOMNode.Event.AttributeRemoved, this._refreshSourceSection, this);
             }
 
             if (!this._canvas.cssCanvasName)
-                this._nodeRow.value = WebInspector.linkifyNodeReference(this._node);
+                this._nodeRow.value = WI.linkifyNodeReference(this._node);
 
             let setRowValueIfValidAttributeValue = (row, attribute) => {
                 let value = Number(this._node.getAttribute(attribute));
@@ -198,7 +198,7 @@
                 // attributes, we need to invoke the getter for each to get the actual value.
                 //  - https://html.spec.whatwg.org/multipage/canvas.html#attr-canvas-width
                 //  - https://html.spec.whatwg.org/multipage/canvas.html#attr-canvas-height
-                WebInspector.RemoteObject.resolveNode(node, "", (remoteObject) => {
+                WI.RemoteObject.resolveNode(node, "", (remoteObject) => {
                     if (!remoteObject)
                         return;
 
@@ -217,7 +217,7 @@
             }
 
             if (!this._canvas.cssCanvasName && !this._node.parentNode)
-                this._datachedRow.value = WebInspector.UIString("Yes");
+                this._datachedRow.value = WI.UIString("Yes");
         });
     }
 
@@ -231,9 +231,9 @@
 
         let dataGrid = this._attributesDataGridRow.dataGrid;
         if (!dataGrid) {
-            dataGrid = this._attributesDataGridRow.dataGrid = new WebInspector.DataGrid({
-                name: {title: WebInspector.UIString("Name")},
-                value: {title: WebInspector.UIString("Value"), width: "30%"},
+            dataGrid = this._attributesDataGridRow.dataGrid = new WI.DataGrid({
+                name: {title: WI.UIString("Name")},
+                value: {title: WI.UIString("Value"), width: "30%"},
             });
         }
 
@@ -241,7 +241,7 @@
 
         for (let attribute in this._canvas.contextAttributes) {
             let data = {name: attribute, value: this._canvas.contextAttributes[attribute]};
-            let dataGridNode = new WebInspector.DataGridNode(data);
+            let dataGridNode = new WI.DataGridNode(data);
             dataGrid.appendChild(dataGridNode);
         }
 
@@ -268,7 +268,7 @@
 
             let fragment = document.createDocumentFragment();
             for (let clientNode of cssCanvasClientNodes)
-                fragment.appendChild(WebInspector.linkifyNodeReference(clientNode));
+                fragment.appendChild(WI.linkifyNodeReference(clientNode));
             this._cssCanvasClientsRow.value = fragment;
         });
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/CanvasTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/CanvasTreeElement.js
index 941fed5..bb81cab 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CanvasTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CanvasTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CanvasTreeElement = class CanvasTreeElement extends WebInspector.GeneralTreeElement
+WI.CanvasTreeElement = class CanvasTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.Canvas);
+        console.assert(representedObject instanceof WI.Canvas);
 
         const subtitle = null;
         super(["canvas", representedObject.contextType], representedObject.displayName, subtitle, representedObject);
@@ -47,14 +47,14 @@
     {
         super.populateContextMenu(contextMenu, event);
 
-        contextMenu.appendItem(WebInspector.UIString("Log Canvas Context"), () => {
-            WebInspector.RemoteObject.resolveCanvasContext(this.representedObject, WebInspector.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
+        contextMenu.appendItem(WI.UIString("Log Canvas Context"), () => {
+            WI.RemoteObject.resolveCanvasContext(this.representedObject, WI.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
                 if (!remoteObject)
                     return;
 
-                const text = WebInspector.UIString("Selected Canvas Context");
+                const text = WI.UIString("Selected Canvas Context");
                 const addSpecialUserLogClass = true;
-                WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
+                WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
             });
         });
 
@@ -67,20 +67,20 @@
     {
         if (this.representedObject.cssCanvasName) {
             this.representedObject.requestCSSCanvasClientNodes((cssCanvasClientNodes) => {
-                WebInspector.domTreeManager.highlightDOMNodeList(cssCanvasClientNodes.map((node) => node.id), "all");
+                WI.domTreeManager.highlightDOMNodeList(cssCanvasClientNodes.map((node) => node.id), "all");
             });
         } else {
             this.representedObject.requestNode((node) => {
                 if (!node || !node.ownerDocument)
                     return;
 
-                WebInspector.domTreeManager.highlightDOMNode(node.id, "all");
+                WI.domTreeManager.highlightDOMNode(node.id, "all");
             });
         }
     }
 
     _handleMouseOut(event)
     {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js b/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js
index 1a6bfef..4b75f23 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ChartDetailsSectionRow = class ChartDetailsSectionRow extends WebInspector.DetailsSectionRow
+WI.ChartDetailsSectionRow = class ChartDetailsSectionRow extends WI.DetailsSectionRow
 {
     constructor(delegate, chartSize, innerRadiusRatio)
     {
-        super(WebInspector.UIString("No Chart Available"));
+        super(WI.UIString("No Chart Available"));
 
         innerRadiusRatio = innerRadiusRatio || 0;
         console.assert(chartSize > 0, chartSize);
@@ -154,7 +154,7 @@
     clearItems()
     {
         for (let item of this._items.values()) {
-            let path = item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol];
+            let path = item[WI.ChartDetailsSectionRow.ChartSegmentPathSymbol];
             if (path)
                 path.remove();
         }
@@ -225,8 +225,8 @@
         }
 
         for (let [id, item] of this._items) {
-            if (item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol]) {
-                let valueElement = item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol];
+            if (item[WI.ChartDetailsSectionRow.LegendItemValueElementSymbol]) {
+                let valueElement = item[WI.ChartDetailsSectionRow.LegendItemValueElementSymbol];
                 valueElement.textContent = formatItemValue.call(this, item);
                 continue;
             }
@@ -243,7 +243,7 @@
                 keyElement.type = "checkbox";
                 keyElement.classList.add(className);
                 keyElement.checked = item.checked;
-                keyElement[WebInspector.ChartDetailsSectionRow.DataItemIdSymbol] = id;
+                keyElement[WI.ChartDetailsSectionRow.DataItemIdSymbol] = id;
 
                 keyElement.addEventListener("change", this._legendItemCheckboxValueChanged.bind(this));
 
@@ -260,7 +260,7 @@
             valueElement.classList.add("value");
             valueElement.textContent = formatItemValue.call(this, item);
 
-            item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol] = valueElement;
+            item[WI.ChartDetailsSectionRow.LegendItemValueElementSymbol] = valueElement;
 
             let legendItemElement = document.createElement("div");
             legendItemElement.classList.add("legend-item");
@@ -273,8 +273,8 @@
     _legendItemCheckboxValueChanged(event)
     {
         let checkbox = event.target;
-        let id = checkbox[WebInspector.ChartDetailsSectionRow.DataItemIdSymbol];
-        this.dispatchEventToListeners(WebInspector.ChartDetailsSectionRow.Event.LegendItemChecked, {id, checked: checkbox.checked});
+        let id = checkbox[WI.ChartDetailsSectionRow.DataItemIdSymbol];
+        this.dispatchEventToListeners(WI.ChartDetailsSectionRow.Event.LegendItemChecked, {id, checked: checkbox.checked});
     }
 
     _needsLayout()
@@ -357,14 +357,14 @@
         let startAngle = -Math.PI / 2;
         let endAngle = 0;
         for (let [id, item] of this._items) {
-            let path = item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol];
+            let path = item[WI.ChartDetailsSectionRow.ChartSegmentPathSymbol];
             if (!path) {
                 path = createSVGElement("path");
                 path.classList.add("chart-segment");
                 path.setAttribute("fill", item.color);
                 this._chartElement.appendChild(path);
 
-                item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol] = path;
+                item[WI.ChartDetailsSectionRow.ChartSegmentPathSymbol] = path;
             }
 
             if (!item.value) {
@@ -383,10 +383,10 @@
     }
 };
 
-WebInspector.ChartDetailsSectionRow.DataItemIdSymbol = Symbol("chart-details-section-row-data-item-id");
-WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol = Symbol("chart-details-section-row-chart-segment-path");
-WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol = Symbol("chart-details-section-row-legend-item-value-element");
+WI.ChartDetailsSectionRow.DataItemIdSymbol = Symbol("chart-details-section-row-data-item-id");
+WI.ChartDetailsSectionRow.ChartSegmentPathSymbol = Symbol("chart-details-section-row-chart-segment-path");
+WI.ChartDetailsSectionRow.LegendItemValueElementSymbol = Symbol("chart-details-section-row-legend-item-value-element");
 
-WebInspector.ChartDetailsSectionRow.Event = {
+WI.ChartDetailsSectionRow.Event = {
     LegendItemChecked: "chart-details-section-row-legend-item-checked"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/CircleChart.js b/Source/WebInspectorUI/UserInterface/Views/CircleChart.js
index f053ad2..fce5469 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CircleChart.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CircleChart.js
@@ -46,7 +46,7 @@
 //      <div class="center"></div>
 //  </div>
 
-WebInspector.CircleChart = class CircleChart
+WI.CircleChart = class CircleChart
 {
     constructor({size, innerRadiusRatio})
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js b/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js
index 7177bddf..6af3a42 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ClusterContentView = class ClusterContentView extends WebInspector.ContentView
+WI.ClusterContentView = class ClusterContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -31,13 +31,13 @@
 
         this.element.classList.add("cluster");
 
-        this._contentViewContainer = new WebInspector.ContentViewContainer;
-        this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
+        this._contentViewContainer = new WI.ContentViewContainer;
+        this._contentViewContainer.addEventListener(WI.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
         this.addSubview(this._contentViewContainer);
 
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
     }
 
     // Public
@@ -81,7 +81,7 @@
 
         this._contentViewContainer.closeAllContentViews();
 
-        WebInspector.ContentView.removeEventListener(null, null, this);
+        WI.ContentView.removeEventListener(null, null, this);
     }
 
     canGoBack()
@@ -229,29 +229,29 @@
                 currentContentView.searchCleared();
         }
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     _contentViewSelectionPathComponentDidChange(event)
     {
         if (event.target !== this._contentViewContainer.currentContentView)
             return;
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _contentViewSupplementalRepresentedObjectsDidChange(event)
     {
         if (event.target !== this._contentViewContainer.currentContentView)
             return;
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange);
     }
 
     _contentViewNumberOfSearchResultsDidChange(event)
     {
         if (event.target !== this._contentViewContainer.currentContentView)
             return;
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js b/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js
index 5542b95..3e0b5bd 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js
@@ -579,7 +579,7 @@
                     if (coords.bottom > maxY) {
                         if (ch > startChar) {
                             var maxX = Math.ceil(this.cursorCoords({ch: ch - 1, line}).right);
-                            lineRects.push(new WebInspector.Rect(minX, minY, maxX - minX, maxY - minY));
+                            lineRects.push(new WI.Rect(minX, minY, maxX - minX, maxY - minY));
                         }
                         var minX = Math.floor(coords.left);
                         var minY = Math.floor(coords.top);
@@ -587,19 +587,19 @@
                     }
                 }
                 maxX = Math.ceil(coords.right);
-                lineRects.push(new WebInspector.Rect(minX, minY, maxX - minX, maxY - minY));
+                lineRects.push(new WI.Rect(minX, minY, maxX - minX, maxY - minY));
             } else {
                 var minX = Math.floor(firstCharCoords.left);
                 var minY = Math.floor(firstCharCoords.top);
                 var maxX = Math.ceil(endCharCoords.right);
                 var maxY = Math.ceil(endCharCoords.bottom);
-                lineRects.push(new WebInspector.Rect(minX, minY, maxX - minX, maxY - minY));
+                lineRects.push(new WI.Rect(minX, minY, maxX - minX, maxY - minY));
             }
         }
         return lineRects;
     });
 
-    let mac = WebInspector.Platform.name === "mac";
+    let mac = WI.Platform.name === "mac";
 
     CodeMirror.keyMap["default"] = {
         "Alt-Up": alterNumber.bind(null, 1),
@@ -642,7 +642,7 @@
     });
 })();
 
-WebInspector.compareCodeMirrorPositions = function(a, b)
+WI.compareCodeMirrorPositions = function(a, b)
 {
     var lineCompare = a.line - b.line;
     if (lineCompare !== 0)
@@ -653,7 +653,7 @@
     return aColumn - bColumn;
 };
 
-WebInspector.walkTokens = function(cm, mode, initialPosition, callback)
+WI.walkTokens = function(cm, mode, initialPosition, callback)
 {
     let state = CodeMirror.copyState(mode, cm.getTokenAt(initialPosition).state);
     if (state.localState)
diff --git a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js b/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js
index 97838e2..a0338c2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CodeMirrorEditor = class CodeMirrorEditor
+WI.CodeMirrorEditor = class CodeMirrorEditor
 {
     static create(element, options)
     {
@@ -38,7 +38,7 @@
         let codeMirror = new CodeMirror(element, options);
 
         // Override some Mac specific keybindings.
-        if (WebInspector.Platform.name === "mac") {
+        if (WI.Platform.name === "mac") {
             codeMirror.addKeyMap({
                 "Home": () => { codeMirror.scrollIntoView({line: 0, ch: 0}); },
                 "End": () => { codeMirror.scrollIntoView({line: codeMirror.lineCount() - 1, ch: null}); },
@@ -47,7 +47,7 @@
 
         // Set up default controllers that should be present for
         // all CodeMirror editor instances.
-        new WebInspector.CodeMirrorTextKillController(codeMirror);
+        new WI.CodeMirrorTextKillController(codeMirror);
 
         return codeMirror;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js b/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js
index bd309fa..4fa0592 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js
@@ -26,8 +26,8 @@
 function createCodeMirrorTextMarkers(type, pattern, matchFunction, codeMirror, range, callback)
 {
     var createdMarkers = [];
-    var start = range instanceof WebInspector.TextRange ? range.startLine : 0;
-    var end = range instanceof WebInspector.TextRange ? range.endLine + 1 : codeMirror.lineCount();
+    var start = range instanceof WI.TextRange ? range.startLine : 0;
+    var end = range instanceof WI.TextRange ? range.endLine + 1 : codeMirror.lineCount();
     for (var lineNumber = start; lineNumber < end; ++lineNumber) {
         var lineContent = codeMirror.getLine(lineNumber);
         var match = pattern.exec(lineContent);
@@ -43,7 +43,7 @@
             var foundMarker = false;
             var markers = codeMirror.findMarksAt(to);
             for (var j = 0; j < markers.length; ++j) {
-                if (WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(markers[j]).type === WebInspector.TextMarker.Type[type]) {
+                if (WI.TextMarker.textMarkerForCodeMirrorTextMarker(markers[j]).type === WI.TextMarker.Type[type]) {
                     foundMarker = true;
                     break;
                 }
@@ -62,14 +62,14 @@
             }
 
             let valueString = match[1];
-            let value = WebInspector[type] ? WebInspector[type].fromString(valueString) : null;
-            if (WebInspector[type] && !value) {
+            let value = WI[type] ? WI[type].fromString(valueString) : null;
+            if (WI[type] && !value) {
                 match = pattern.exec(lineContent);
                 continue;
             }
 
             var marker = codeMirror.markText(from, to);
-            marker = new WebInspector.TextMarker(marker, WebInspector.TextMarker.Type[type]);
+            marker = new WI.TextMarker(marker, WI.TextMarker.Type[type]);
             createdMarkers.push(marker);
 
             if (typeof callback === "function")
@@ -125,8 +125,8 @@
 {
     var createdMarkers = [];
 
-    var start = range instanceof WebInspector.TextRange ? range.startLine : 0;
-    var end = range instanceof WebInspector.TextRange ? range.endLine + 1 : codeMirror.lineCount();
+    var start = range instanceof WI.TextRange ? range.startLine : 0;
+    var end = range instanceof WI.TextRange ? range.endLine + 1 : codeMirror.lineCount();
 
     var gradientRegex = /(repeating-)?(linear|radial)-gradient\s*\(\s*/g;
 
@@ -170,13 +170,13 @@
             var to = {line: lineNumber, ch: endChar};
 
             var gradientString = codeMirror.getRange(from, to);
-            var gradient = WebInspector.Gradient.fromString(gradientString);
+            var gradient = WI.Gradient.fromString(gradientString);
             if (!gradient) {
                 match = gradientRegex.exec(lineContent);
                 continue;
             }
 
-            var marker = new WebInspector.TextMarker(codeMirror.markText(from, to), WebInspector.TextMarker.Type.Gradient);
+            var marker = new WI.TextMarker(codeMirror.markText(from, to), WI.TextMarker.Type.Gradient);
 
             createdMarkers.push(marker);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js b/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js
index 2b06b3f..bc1e4c5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CollectionContentView = class CollectionContentView extends WebInspector.ContentView
+WI.CollectionContentView = class CollectionContentView extends WI.ContentView
 {
     constructor(collection)
     {
-        console.assert(collection instanceof WebInspector.Collection);
+        console.assert(collection instanceof WI.Collection);
 
         super(collection);
 
-        this.representedObject.addEventListener(WebInspector.Collection.Event.ItemAdded, this._handleItemAdded, this);
-        this.representedObject.addEventListener(WebInspector.Collection.Event.ItemRemoved, this._handleItemRemoved, this);
+        this.representedObject.addEventListener(WI.Collection.Event.ItemAdded, this._handleItemAdded, this);
+        this.representedObject.addEventListener(WI.Collection.Event.ItemRemoved, this._handleItemRemoved, this);
 
         this._contentViewMap = new WeakMap;
         this._handleClickMap = new WeakMap;
@@ -40,61 +40,61 @@
         this._contentViewConstructor = null;
         let title = "";
         switch (this.representedObject.typeVerifier) {
-        case WebInspector.Collection.TypeVerifier.Frame:
-            title = WebInspector.UIString("Frames");
+        case WI.Collection.TypeVerifier.Frame:
+            title = WI.UIString("Frames");
             break;
 
-        case WebInspector.Collection.TypeVerifier.ContentFlow:
-            title = WebInspector.UIString("Flows");
+        case WI.Collection.TypeVerifier.ContentFlow:
+            title = WI.UIString("Flows");
             break;
 
-        case WebInspector.Collection.TypeVerifier.Script:
-            title = WebInspector.UIString("Extra Scripts");
+        case WI.Collection.TypeVerifier.Script:
+            title = WI.UIString("Extra Scripts");
             break;
 
-        case WebInspector.Collection.TypeVerifier.Resource:
-            title = WebInspector.UIString("Resource");
+        case WI.Collection.TypeVerifier.Resource:
+            title = WI.UIString("Resource");
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Document:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Document, true);
+        case WI.ResourceCollection.TypeVerifier.Document:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Document, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Stylesheet:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Stylesheet, true);
+        case WI.ResourceCollection.TypeVerifier.Stylesheet:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Stylesheet, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Image:
-            this._contentViewConstructor = WebInspector.ImageResourceContentView;
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Image, true);
+        case WI.ResourceCollection.TypeVerifier.Image:
+            this._contentViewConstructor = WI.ImageResourceContentView;
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Image, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Font:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Font, true);
+        case WI.ResourceCollection.TypeVerifier.Font:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Font, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Script:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Script, true);
+        case WI.ResourceCollection.TypeVerifier.Script:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Script, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.XHR:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.XHR, true);
+        case WI.ResourceCollection.TypeVerifier.XHR:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.XHR, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Fetch:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Fetch, true);
+        case WI.ResourceCollection.TypeVerifier.Fetch:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Fetch, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.WebSocket:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.WebSocket, true);
+        case WI.ResourceCollection.TypeVerifier.WebSocket:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.WebSocket, true);
             break;
 
-        case WebInspector.ResourceCollection.TypeVerifier.Other:
-            title = WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Other, true);
+        case WI.ResourceCollection.TypeVerifier.Other:
+            title = WI.Resource.displayNameForType(WI.Resource.Type.Other, true);
             break;
         }
 
-        this._contentPlaceholder = new WebInspector.TitleView(title);
+        this._contentPlaceholder = new WI.TitleView(title);
 
         this.element.classList.add("collection");
     }
@@ -123,18 +123,18 @@
 
         let contentView = new this._contentViewConstructor(item);
 
-        contentView.addEventListener(WebInspector.ResourceContentView.Event.ContentError, this._handleContentError, this);
+        contentView.addEventListener(WI.ResourceContentView.Event.ContentError, this._handleContentError, this);
 
         let handleClick = (event) => {
             if (event.button !== 0 || event.ctrlKey)
                 return;
 
-            WebInspector.showRepresentedObject(item);
+            WI.showRepresentedObject(item);
         };
         this._handleClickMap.set(item, handleClick);
         contentView.element.addEventListener("click", handleClick);
 
-        contentView.element.title = WebInspector.displayNameForURL(item.url, item.urlComponents);
+        contentView.element.title = WI.displayNameForURL(item.url, item.urlComponents);
 
         this.addSubview(contentView);
         this._contentViewMap.set(item, contentView);
diff --git a/Source/WebInspectorUI/UserInterface/Views/ColorPicker.js b/Source/WebInspectorUI/UserInterface/Views/ColorPicker.js
index f4d2d2f..3c188ac 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ColorPicker.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ColorPicker.js
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ColorPicker = class ColorPicker extends WebInspector.Object
+WI.ColorPicker = class ColorPicker extends WI.Object
 {
     constructor()
     {
         super();
 
-        this._colorWheel = new WebInspector.ColorWheel;
+        this._colorWheel = new WI.ColorWheel;
         this._colorWheel.delegate = this;
         this._colorWheel.dimension = 200;
 
-        this._brightnessSlider = new WebInspector.Slider;
+        this._brightnessSlider = new WI.Slider;
         this._brightnessSlider.delegate = this;
         this._brightnessSlider.element.classList.add("brightness");
 
-        this._opacitySlider = new WebInspector.Slider;
+        this._opacitySlider = new WI.Slider;
         this._opacitySlider.delegate = this;
         this._opacitySlider.element.classList.add("opacity");
 
@@ -83,7 +83,7 @@
         this._opacity = 0;
         this._opacityPattern = "url(Images/Checkers.svg)";
 
-        this._color = WebInspector.Color.fromString("white");
+        this._color = WI.Color.fromString("white");
 
         this._dontUpdateColor = false;
 
@@ -129,7 +129,7 @@
 
     set color(color)
     {
-        console.assert(color instanceof WebInspector.Color);
+        console.assert(color instanceof WI.Color);
 
         this._dontUpdateColor = true;
 
@@ -183,23 +183,23 @@
 
         let format = this._color.format;
         let components = null;
-        if (format === WebInspector.Color.Format.HSL || format === WebInspector.Color.Format.HSLA) {
+        if (format === WI.Color.Format.HSL || format === WI.Color.Format.HSLA) {
             components = this._colorWheel.tintedColor.hsl.concat(opacity);
             if (opacity !== 1)
-                format = WebInspector.Color.Format.HSLA;
+                format = WI.Color.Format.HSLA;
         } else {
             components = this._colorWheel.tintedColor.rgb.concat(opacity);
-            if (opacity !== 1 && format === WebInspector.Color.Format.RGB)
-                format = WebInspector.Color.Format.RGBA;
+            if (opacity !== 1 && format === WI.Color.Format.RGB)
+                format = WI.Color.Format.RGBA;
         }
 
         let formatChanged = this._color.format === format;
 
-        this._color = new WebInspector.Color(format, components);
+        this._color = new WI.Color(format, components);
 
         this._showColorComponentInputs();
 
-        this.dispatchEventToListeners(WebInspector.ColorPicker.Event.ColorChanged, {color: this._color});
+        this.dispatchEventToListeners(WI.ColorPicker.Event.ColorChanged, {color: this._color});
 
         if (formatChanged)
             this._handleFormatChange();
@@ -208,8 +208,8 @@
     _updateSliders(rawColor, tintedColor)
     {
         var rgb = this._colorWheel.tintedColor.rgb;
-        var opaque = new WebInspector.Color(WebInspector.Color.Format.RGBA, rgb.concat(1)).toString();
-        var transparent = new WebInspector.Color(WebInspector.Color.Format.RGBA, rgb.concat(0)).toString();
+        var opaque = new WI.Color(WI.Color.Format.RGBA, rgb.concat(1)).toString();
+        var transparent = new WI.Color(WI.Color.Format.RGBA, rgb.concat(0)).toString();
 
         this._opacitySlider.element.style.backgroundImage = "linear-gradient(90deg, " + transparent + ", " + opaque + "), " + this._opacityPattern;
         this._brightnessSlider.element.style.backgroundImage = "linear-gradient(90deg, black, " + rawColor + ")";
@@ -217,17 +217,17 @@
 
     _handleFormatChange()
     {
-        this._element.classList.toggle("hide-inputs", this._color.format !== WebInspector.Color.Format.Keyword
-            && this._color.format !== WebInspector.Color.Format.RGB
-            && this._color.format !== WebInspector.Color.Format.RGBA
-            && this._color.format !== WebInspector.Color.Format.HEX
-            && this._color.format !== WebInspector.Color.Format.ShortHEX
-            && this._color.format !== WebInspector.Color.Format.HEXAlpha
-            && this._color.format !== WebInspector.Color.Format.ShortHEXAlpha
-            && this._color.format !== WebInspector.Color.Format.HSL
-            && this._color.format !== WebInspector.Color.Format.HSLA);
+        this._element.classList.toggle("hide-inputs", this._color.format !== WI.Color.Format.Keyword
+            && this._color.format !== WI.Color.Format.RGB
+            && this._color.format !== WI.Color.Format.RGBA
+            && this._color.format !== WI.Color.Format.HEX
+            && this._color.format !== WI.Color.Format.ShortHEX
+            && this._color.format !== WI.Color.Format.HEXAlpha
+            && this._color.format !== WI.Color.Format.ShortHEXAlpha
+            && this._color.format !== WI.Color.Format.HSL
+            && this._color.format !== WI.Color.Format.HSLA);
 
-        this.dispatchEventToListeners(WebInspector.ColorPicker.Event.FormatChanged);
+        this.dispatchEventToListeners(WI.ColorPicker.Event.FormatChanged);
     }
 
     _showColorComponentInputs()
@@ -245,21 +245,21 @@
         }
 
         switch (this._color.format) {
-        case WebInspector.Color.Format.RGB:
-        case WebInspector.Color.Format.RGBA:
-        case WebInspector.Color.Format.HEX:
-        case WebInspector.Color.Format.ShortHEX:
-        case WebInspector.Color.Format.HEXAlpha:
-        case WebInspector.Color.Format.ShortHEXAlpha:
-        case WebInspector.Color.Format.Keyword:
+        case WI.Color.Format.RGB:
+        case WI.Color.Format.RGBA:
+        case WI.Color.Format.HEX:
+        case WI.Color.Format.ShortHEX:
+        case WI.Color.Format.HEXAlpha:
+        case WI.Color.Format.ShortHEXAlpha:
+        case WI.Color.Format.Keyword:
             var [r, g, b] = this._color.rgb;
             updateColorInput.call(this, "R", r);
             updateColorInput.call(this, "G", g);
             updateColorInput.call(this, "B", b);
             break;
 
-        case WebInspector.Color.Format.HSL:
-        case WebInspector.Color.Format.HSLA:
+        case WI.Color.Format.HSL:
+        case WI.Color.Format.HSLA:
             var [h, s, l] = this._color.hsl;
             updateColorInput.call(this, "H", h);
             updateColorInput.call(this, "S", s);
@@ -270,11 +270,11 @@
             return;
         }
 
-        if ((this._color.format === WebInspector.Color.Format.Keyword && this._color.alpha !== 1)
-            || this._color.format === WebInspector.Color.Format.RGBA
-            || this._color.format === WebInspector.Color.Format.HSLA
-            || this._color.format === WebInspector.Color.Format.HEXAlpha
-            || this._color.format === WebInspector.Color.Format.ShortHEXAlpha) {
+        if ((this._color.format === WI.Color.Format.Keyword && this._color.alpha !== 1)
+            || this._color.format === WI.Color.Format.RGBA
+            || this._color.format === WI.Color.Format.HSLA
+            || this._color.format === WI.Color.Format.HEXAlpha
+            || this._color.format === WI.Color.Format.ShortHEXAlpha) {
             updateColorInput.call(this, "A", this._color.alpha);
         }
     }
@@ -282,7 +282,7 @@
     _handleColorInputInput(event)
     {
         if (!this._enableColorComponentInputs) {
-            WebInspector.reportInternalError("Input event fired for disabled color component input");
+            WI.reportInternalError("Input event fired for disabled color component input");
             return;
         }
 
@@ -298,40 +298,40 @@
         let oldFormat = this._color.format;
 
         switch (oldFormat) {
-        case WebInspector.Color.Format.RGB:
-        case WebInspector.Color.Format.HEX:
-        case WebInspector.Color.Format.ShortHEX:
-        case WebInspector.Color.Format.Keyword:
+        case WI.Color.Format.RGB:
+        case WI.Color.Format.HEX:
+        case WI.Color.Format.ShortHEX:
+        case WI.Color.Format.Keyword:
             colorString = `rgb(${r}, ${g}, ${b})`;
             break;
 
-        case WebInspector.Color.Format.RGBA:
-        case WebInspector.Color.Format.HEXAlpha:
-        case WebInspector.Color.Format.ShortHEXAlpha:
+        case WI.Color.Format.RGBA:
+        case WI.Color.Format.HEXAlpha:
+        case WI.Color.Format.ShortHEXAlpha:
             colorString = `rgba(${r}, ${g}, ${b}, ${a})`;
             break;
 
-        case WebInspector.Color.Format.HSL:
+        case WI.Color.Format.HSL:
             colorString = `hsl(${h}, ${s}%, ${l}%)`;
             break;
 
-        case WebInspector.Color.Format.HSLA:
+        case WI.Color.Format.HSLA:
             colorString = `hsla(${h}, ${s}%, ${l}%, ${a})`;
             break;
 
         default:
-            WebInspector.reportInternalError(`Input event fired for invalid color format "${this._color.format}"`);
+            WI.reportInternalError(`Input event fired for invalid color format "${this._color.format}"`);
             return;
         }
 
-        this.color = WebInspector.Color.fromString(colorString);
+        this.color = WI.Color.fromString(colorString);
         this._color.format = oldFormat;
 
-        this.dispatchEventToListeners(WebInspector.ColorPicker.Event.ColorChanged, {color: this._color});
+        this.dispatchEventToListeners(WI.ColorPicker.Event.ColorChanged, {color: this._color});
     }
 };
 
-WebInspector.ColorPicker.Event = {
+WI.ColorPicker.Event = {
     ColorChanged: "css-color-picker-color-changed",
     FormatChanged: "css-color-picker-format-changed",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ColorWheel.js b/Source/WebInspectorUI/UserInterface/Views/ColorWheel.js
index ed73fd3..71abd48 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ColorWheel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ColorWheel.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ColorWheel = class ColorWheel extends WebInspector.Object
+WI.ColorWheel = class ColorWheel extends WI.Object
 {
     constructor()
     {
@@ -60,7 +60,7 @@
         // We shrink the radius a bit for better anti-aliasing.
         this._radius = dimension / 2 - 2;
 
-        this._setCrosshairPosition(new WebInspector.Point(dimension / 2, dimension / 2));
+        this._setCrosshairPosition(new WI.Point(dimension / 2, dimension / 2));
 
         this._drawRawCanvas();
         this._draw();
@@ -87,7 +87,7 @@
         if (this._crosshairPosition)
             return this._colorAtPointWithBrightness(this._crosshairPosition.x * window.devicePixelRatio, this._crosshairPosition.y * window.devicePixelRatio, this._brightness);
 
-        return new WebInspector.Color(WebInspector.Color.Format.RGBA, [0, 0, 0, 0]);
+        return new WI.Color(WI.Color.Format.RGBA, [0, 0, 0, 0]);
     }
 
     set tintedColor(tintedColor)
@@ -102,7 +102,7 @@
         if (this._crosshairPosition)
             return this._colorAtPointWithBrightness(this._crosshairPosition.x * window.devicePixelRatio, this._crosshairPosition.y * window.devicePixelRatio, 1);
 
-        return new WebInspector.Color(WebInspector.Color.Format.RGBA, [0, 0, 0, 0]);
+        return new WI.Color(WI.Color.Format.RGBA, [0, 0, 0, 0]);
     }
 
     // Protected
@@ -157,12 +157,12 @@
 
         function pointOnCircumference(c, r, a)
         {
-            return new WebInspector.Point(c.x + r * Math.cos(a), c.y + r * Math.sin(a));
+            return new WI.Point(c.x + r * Math.cos(a), c.y + r * Math.sin(a));
         }
 
         var dimension = this._dimension;
         var point = window.webkitConvertPointFromPageToNode(this._finalCanvas, new WebKitPoint(event.pageX, event.pageY));
-        var center = new WebInspector.Point(dimension / 2, dimension / 2);
+        var center = new WI.Point(dimension / 2, dimension / 2);
         if (distance(point, center) > this._radius) {
             var angle = angleFromCenterToPoint(center, point);
             point = pointOnCircumference(center, this._radius, angle);
@@ -189,14 +189,14 @@
     _tintedColorToPointAndBrightness(color)
     {
         var rgb = color.rgb;
-        var hsv = WebInspector.Color.rgb2hsv(rgb[0], rgb[1], rgb[2]);
+        var hsv = WI.Color.rgb2hsv(rgb[0], rgb[1], rgb[2]);
         var cosHue = Math.cos(hsv[0] * Math.PI / 180);
         var sinHue = Math.sin(hsv[0] * Math.PI / 180);
         var center = this._dimension / 2;
         var x = center + (center * cosHue * hsv[1]);
         var y = center - (center * sinHue * hsv[1]);
         return {
-            point: new WebInspector.Point(x, y),
+            point: new WI.Point(x, y),
             brightness: hsv[2]
         };
     }
@@ -233,15 +233,15 @@
         var distance = Math.sqrt(xDis * xDis + yDis * yDis);
 
         if (distance - center > 0.001)
-            return new WebInspector.Color(WebInspector.Color.Format.RGBA, [0, 0, 0, 0]);
+            return new WI.Color(WI.Color.Format.RGBA, [0, 0, 0, 0]);
 
         var h = Math.atan2(y - center, center - x) * 180 / Math.PI;
         h = (h + 180) % 360;
         var v = brightness;
         var s = Math.max(0, distance) / center;
 
-        var rgb = WebInspector.Color.hsv2rgb(h, s, v);
-        return new WebInspector.Color(WebInspector.Color.Format.RGBA, [
+        var rgb = WI.Color.hsv2rgb(h, s, v);
+        return new WI.Color(WI.Color.Format.RGBA, [
             Math.round(rgb[0] * 255),
             Math.round(rgb[1] * 255),
             Math.round(rgb[2] * 255),
diff --git a/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js b/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js
index 7732dba..631025e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CompletionSuggestionsView = class CompletionSuggestionsView extends WebInspector.Object
+WI.CompletionSuggestionsView = class CompletionSuggestionsView extends WI.Object
 {
     constructor(delegate)
     {
@@ -34,7 +34,7 @@
         this._selectedIndex = NaN;
 
         this._element = document.createElement("div");
-        this._element.classList.add("completion-suggestions", WebInspector.Popover.IgnoreAutoDismissClassName);
+        this._element.classList.add("completion-suggestions", WI.Popover.IgnoreAutoDismissClassName);
 
         this._containerElement = document.createElement("div");
         this._containerElement.classList.add("completion-suggestions-container");
@@ -65,7 +65,7 @@
     {
         var selectedItemElement = this._selectedItemElement;
         if (selectedItemElement)
-            selectedItemElement.classList.remove(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);
+            selectedItemElement.classList.remove(WI.CompletionSuggestionsView.SelectedItemStyleClassName);
 
         this._selectedIndex = index;
 
@@ -73,7 +73,7 @@
         if (!selectedItemElement)
             return;
 
-        selectedItemElement.classList.add(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);
+        selectedItemElement.classList.add(WI.CompletionSuggestionsView.SelectedItemStyleClassName);
         selectedItemElement.scrollIntoViewIfNeeded(false);
     }
 
@@ -170,10 +170,10 @@
 
         for (var i = 0; i < completions.length; ++i) {
             var itemElement = document.createElement("div");
-            itemElement.className = WebInspector.CompletionSuggestionsView.ItemElementStyleClassName;
+            itemElement.className = WI.CompletionSuggestionsView.ItemElementStyleClassName;
             itemElement.textContent = completions[i];
             if (i === this._selectedIndex)
-                itemElement.classList.add(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);
+                itemElement.classList.add(WI.CompletionSuggestionsView.SelectedItemStyleClassName);
             this._containerElement.appendChild(itemElement);
 
             if (this._delegate && typeof this._delegate.completionSuggestionsViewCustomizeCompletionElement === "function")
@@ -212,7 +212,7 @@
         if (event.button !== 0)
             return;
 
-        var itemElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.CompletionSuggestionsView.ItemElementStyleClassName);
+        var itemElement = event.target.enclosingNodeOrSelfWithClass(WI.CompletionSuggestionsView.ItemElementStyleClassName);
         console.assert(itemElement);
         if (!itemElement)
             return;
@@ -222,5 +222,5 @@
     }
 };
 
-WebInspector.CompletionSuggestionsView.ItemElementStyleClassName = "item";
-WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName = "selected";
+WI.CompletionSuggestionsView.ItemElementStyleClassName = "item";
+WI.CompletionSuggestionsView.SelectedItemStyleClassName = "selected";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js b/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js
index 3c9bb1a..d2ad0b7 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ComputedStyleDetailsPanel = class ComputedStyleDetailsPanel extends WebInspector.StyleDetailsPanel
+WI.ComputedStyleDetailsPanel = class ComputedStyleDetailsPanel extends WI.StyleDetailsPanel
 {
     constructor(delegate)
     {
-        super(delegate, WebInspector.ComputedStyleDetailsPanel.StyleClassName, "computed", WebInspector.UIString("Styles \u2014 Computed"));
+        super(delegate, WI.ComputedStyleDetailsPanel.StyleClassName, "computed", WI.UIString("Styles \u2014 Computed"));
 
-        this._computedStyleShowAllSetting = new WebInspector.Setting("computed-style-show-all", false);
+        this._computedStyleShowAllSetting = new WI.Setting("computed-style-show-all", false);
 
         this.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows = true;
     }
@@ -66,7 +66,7 @@
 
         this._containerRegionsDataGrid.removeChildren();
         for (var regionNode of regions)
-            this._containerRegionsDataGrid.appendChild(new WebInspector.DOMTreeDataGridNode(regionNode));
+            this._containerRegionsDataGrid.appendChild(new WI.DOMTreeDataGridNode(regionNode));
 
         this._containerRegionsFlowSection.element.classList.remove("hidden");
 
@@ -107,7 +107,7 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        WebInspector.showSourceCodeLocation(sourceCode.createSourceCodeLocation(startLine, startColumn), options);
+        WI.showSourceCodeLocation(sourceCode.createSourceCodeLocation(startLine, startColumn), options);
     }
 
     refresh(significantChange)
@@ -141,7 +141,7 @@
     initialLayout()
     {
         let computedStyleShowAllLabel = document.createElement("label");
-        computedStyleShowAllLabel.textContent = WebInspector.UIString("Show All");
+        computedStyleShowAllLabel.textContent = WI.UIString("Show All");
 
         this._computedStyleShowAllCheckbox = document.createElement("input");
         this._computedStyleShowAllCheckbox.type = "checkbox";
@@ -149,29 +149,29 @@
         this._computedStyleShowAllCheckbox.addEventListener("change", this._computedStyleShowAllCheckboxValueChanged.bind(this));
         computedStyleShowAllLabel.appendChild(this._computedStyleShowAllCheckbox);
 
-        this._propertiesTextEditor = new WebInspector.CSSStyleDeclarationTextEditor(this);
-        this._propertiesTextEditor.propertyVisibilityMode = WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables;
+        this._propertiesTextEditor = new WI.CSSStyleDeclarationTextEditor(this);
+        this._propertiesTextEditor.propertyVisibilityMode = WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables;
         this._propertiesTextEditor.showsImplicitProperties = this._computedStyleShowAllSetting.value;
         this._propertiesTextEditor.alwaysShowPropertyNames = ["display", "width", "height"];
         this._propertiesTextEditor.sortProperties = true;
 
-        let propertiesRow = new WebInspector.DetailsSectionRow;
-        let propertiesGroup = new WebInspector.DetailsSectionGroup([propertiesRow]);
-        let propertiesSection = new WebInspector.DetailsSection("computed-style-properties", WebInspector.UIString("Properties"), [propertiesGroup], computedStyleShowAllLabel);
-        propertiesSection.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged, this._handlePropertiesSectionCollapsedStateChanged, this);
+        let propertiesRow = new WI.DetailsSectionRow;
+        let propertiesGroup = new WI.DetailsSectionGroup([propertiesRow]);
+        let propertiesSection = new WI.DetailsSection("computed-style-properties", WI.UIString("Properties"), [propertiesGroup], computedStyleShowAllLabel);
+        propertiesSection.addEventListener(WI.DetailsSection.Event.CollapsedStateChanged, this._handlePropertiesSectionCollapsedStateChanged, this);
 
         this.addSubview(this._propertiesTextEditor);
 
         propertiesRow.element.appendChild(this._propertiesTextEditor.element);
 
-        this._variablesTextEditor = new WebInspector.CSSStyleDeclarationTextEditor(this);
-        this._variablesTextEditor.propertyVisibilityMode = WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables;
+        this._variablesTextEditor = new WI.CSSStyleDeclarationTextEditor(this);
+        this._variablesTextEditor.propertyVisibilityMode = WI.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables;
         this._variablesTextEditor.sortProperties = true;
 
-        let variablesRow = new WebInspector.DetailsSectionRow;
-        let variablesGroup = new WebInspector.DetailsSectionGroup([variablesRow]);
-        this._variablesSection = new WebInspector.DetailsSection("computed-style-properties", WebInspector.UIString("Variables"), [variablesGroup]);
-        this._variablesSection.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged, this._handleVariablesSectionCollapsedStateChanged, this);
+        let variablesRow = new WI.DetailsSectionRow;
+        let variablesGroup = new WI.DetailsSectionGroup([variablesRow]);
+        this._variablesSection = new WI.DetailsSection("computed-style-properties", WI.UIString("Variables"), [variablesGroup]);
+        this._variablesSection.addEventListener(WI.DetailsSection.Event.CollapsedStateChanged, this._handleVariablesSectionCollapsedStateChanged, this);
 
         this.addSubview(this._variablesTextEditor);
 
@@ -182,10 +182,10 @@
         this._regionFlowFragment.appendChild(document.createElement("img")).className = "icon";
         this._regionFlowNameLabelValue = this._regionFlowFragment.appendChild(document.createElement("span"));
 
-        let goToRegionFlowButton = this._regionFlowFragment.appendChild(WebInspector.createGoToArrowButton());
+        let goToRegionFlowButton = this._regionFlowFragment.appendChild(WI.createGoToArrowButton());
         goToRegionFlowButton.addEventListener("click", this._goToRegionFlowArrowWasClicked.bind(this));
 
-        this._regionFlowNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Region Flow"));
+        this._regionFlowNameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Region Flow"));
         this._regionFlowNameRow.element.classList.add("content-flow-link");
 
         // Content flow name is used to display the "flow-into" property of the Content nodes.
@@ -193,21 +193,21 @@
         this._contentFlowFragment.appendChild(document.createElement("img")).className = "icon";
         this._contentFlowNameLabelValue = this._contentFlowFragment.appendChild(document.createElement("span"));
 
-        let goToContentFlowButton = this._contentFlowFragment.appendChild(WebInspector.createGoToArrowButton());
+        let goToContentFlowButton = this._contentFlowFragment.appendChild(WI.createGoToArrowButton());
         goToContentFlowButton.addEventListener("click", this._goToContentFlowArrowWasClicked.bind(this));
 
-        this._contentFlowNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Content Flow"));
+        this._contentFlowNameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Content Flow"));
         this._contentFlowNameRow.element.classList.add("content-flow-link");
 
-        let flowNamesGroup = new WebInspector.DetailsSectionGroup([this._regionFlowNameRow, this._contentFlowNameRow]);
-        this._flowNamesSection = new WebInspector.DetailsSection("content-flow", WebInspector.UIString("Flows"), [flowNamesGroup]);
+        let flowNamesGroup = new WI.DetailsSectionGroup([this._regionFlowNameRow, this._contentFlowNameRow]);
+        this._flowNamesSection = new WI.DetailsSection("content-flow", WI.UIString("Flows"), [flowNamesGroup]);
 
-        this._containerRegionsDataGrid = new WebInspector.DOMTreeDataGrid;
+        this._containerRegionsDataGrid = new WI.DOMTreeDataGrid;
         this._containerRegionsDataGrid.headerVisible = false;
 
-        this._containerRegionsRow = new WebInspector.DetailsSectionDataGridRow(this._containerRegionsDataGrid);
-        let containerRegionsGroup = new WebInspector.DetailsSectionGroup([this._containerRegionsRow]);
-        this._containerRegionsFlowSection = new WebInspector.DetailsSection("container-regions", WebInspector.UIString("Container Regions"), [containerRegionsGroup]);
+        this._containerRegionsRow = new WI.DetailsSectionDataGridRow(this._containerRegionsDataGrid);
+        let containerRegionsGroup = new WI.DetailsSectionGroup([this._containerRegionsRow]);
+        this._containerRegionsFlowSection = new WI.DetailsSection("container-regions", WI.UIString("Container Regions"), [containerRegionsGroup]);
 
         this.element.appendChild(propertiesSection.element);
         this.element.appendChild(this._variablesSection.element);
@@ -216,10 +216,10 @@
 
         this._resetFlowDetails();
 
-        this._boxModelDiagramRow = new WebInspector.BoxModelDetailsSectionRow;
+        this._boxModelDiagramRow = new WI.BoxModelDetailsSectionRow;
 
-        let boxModelGroup = new WebInspector.DetailsSectionGroup([this._boxModelDiagramRow]);
-        let boxModelSection = new WebInspector.DetailsSection("style-box-model", WebInspector.UIString("Box Model"), [boxModelGroup]);
+        let boxModelGroup = new WI.DetailsSectionGroup([this._boxModelDiagramRow]);
+        let boxModelSection = new WI.DetailsSection("style-box-model", WI.UIString("Box Model"), [boxModelGroup]);
 
         this.element.appendChild(boxModelSection.element);
     }
@@ -285,18 +285,18 @@
             this.containerRegions = flowData.regions;
         }
 
-        WebInspector.domTreeManager.getNodeContentFlowInfo(domNode, contentFlowInfoReady.bind(this));
+        WI.domTreeManager.getNodeContentFlowInfo(domNode, contentFlowInfoReady.bind(this));
     }
 
     _goToRegionFlowArrowWasClicked()
     {
-        WebInspector.showRepresentedObject(this._regionFlow);
+        WI.showRepresentedObject(this._regionFlow);
     }
 
     _goToContentFlowArrowWasClicked()
     {
-        WebInspector.showRepresentedObject(this._contentFlow, {nodeToSelect: this.nodeStyles.node});
+        WI.showRepresentedObject(this._contentFlow, {nodeToSelect: this.nodeStyles.node});
     }
 };
 
-WebInspector.ComputedStyleDetailsPanel.StyleClassName = "computed";
+WI.ComputedStyleDetailsPanel.StyleClassName = "computed";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandView.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandView.js
index 356f10dd..434c6aa 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandView.js
@@ -27,7 +27,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleCommandView = class ConsoleCommandView extends WebInspector.Object
+WI.ConsoleCommandView = class ConsoleCommandView extends WI.Object
 {
     constructor(commandText, className)
     {
@@ -43,7 +43,7 @@
     {
         this._element = document.createElement("div");
         this._element.classList.add("console-user-command");
-        this._element.setAttribute("data-labelprefix", WebInspector.UIString("Input: "));
+        this._element.setAttribute("data-labelprefix", WI.UIString("Input: "));
 
         if (this._className)
             this._element.classList.add(this._className);
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js
index 58f207a..00bb781 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleDrawer = class ConsoleDrawer extends WebInspector.ContentBrowser
+WI.ConsoleDrawer = class ConsoleDrawer extends WI.ContentBrowser
 {
     constructor(element)
     {
@@ -34,17 +34,17 @@
 
         this.element.classList.add("console-drawer");
 
-        this._drawerHeightSetting = new WebInspector.Setting("console-drawer-height", 150);
+        this._drawerHeightSetting = new WI.Setting("console-drawer-height", 150);
 
         this.navigationBar.element.addEventListener("mousedown", this._consoleResizerMouseDown.bind(this));
 
-        this._toggleDrawerButton = new WebInspector.ToggleButtonNavigationItem("toggle-drawer", WebInspector.UIString("Hide Console"), WebInspector.UIString("Show Console"), "Images/HideConsoleDrawer.svg", "Images/ShowConsoleDrawer.svg");
-        this._toggleDrawerButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, () => { WebInspector.toggleSplitConsole(); });
+        this._toggleDrawerButton = new WI.ToggleButtonNavigationItem("toggle-drawer", WI.UIString("Hide Console"), WI.UIString("Show Console"), "Images/HideConsoleDrawer.svg", "Images/ShowConsoleDrawer.svg");
+        this._toggleDrawerButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, () => { WI.toggleSplitConsole(); });
         this.navigationBar.insertNavigationItem(this._toggleDrawerButton, 0);
 
         this.collapsed = true;
 
-        WebInspector.TabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._selectedTabContentViewDidChange, this);
+        WI.TabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._selectedTabContentViewDidChange, this);
     }
 
     // Public
@@ -69,7 +69,7 @@
         else
             this.shown();
 
-        this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged);
+        this.dispatchEventToListeners(WI.ConsoleDrawer.Event.CollapsedStateChanged);
     }
 
     get height()
@@ -91,7 +91,7 @@
         if (this._collapsed)
             return;
 
-        if (this.layoutReason !== WebInspector.View.LayoutReason.Resize)
+        if (this.layoutReason !== WI.View.LayoutReason.Resize)
             return;
 
         super.layout();
@@ -100,7 +100,7 @@
         this._restoreDrawerHeight();
 
         if (height !== this.height)
-            this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);
+            this.dispatchEventToListeners(WI.ConsoleDrawer.Event.Resized);
     }
 
     // Private
@@ -130,10 +130,10 @@
             if (event.button !== 0)
                 return;
 
-            WebInspector.elementDragEnd(event);
+            WI.elementDragEnd(event);
         }
 
-        WebInspector.elementDragStart(resizerElement, dockedResizerDrag.bind(this), dockedResizerDragEnd.bind(this), event, "row-resize");
+        WI.elementDragStart(resizerElement, dockedResizerDrag.bind(this), dockedResizerDragEnd.bind(this), event, "row-resize");
     }
 
     _restoreDrawerHeight()
@@ -152,19 +152,19 @@
 
         this.element.style.height = height + "px";
 
-        this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);
+        this.dispatchEventToListeners(WI.ConsoleDrawer.Event.Resized);
     }
 
     _selectedTabContentViewDidChange()
     {
-        if (WebInspector.doesCurrentTabSupportSplitContentBrowser())
+        if (WI.doesCurrentTabSupportSplitContentBrowser())
             return;
 
         this.element.classList.add("hidden");
     }
 };
 
-WebInspector.ConsoleDrawer.Event = {
+WI.ConsoleDrawer.Event = {
     CollapsedStateChanged: "console-drawer-collapsed-state-changed",
     Resized: "console-drawer-resized",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js
index 8e62100..f4a74da 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js
@@ -27,7 +27,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleGroup = class ConsoleGroup extends WebInspector.Object
+WI.ConsoleGroup = class ConsoleGroup extends WI.Object
 {
     constructor(parentGroup)
     {
@@ -51,11 +51,11 @@
         this.element = groupElement;
 
         var titleElement = messageView.element;
-        titleElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);
+        titleElement.classList.add(WI.LogContentView.ItemWrapperStyleClassName);
         titleElement.addEventListener("click", this._titleClicked.bind(this));
         titleElement.addEventListener("mousedown", this._titleMouseDown.bind(this));
 
-        if (groupElement && messageView.message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
+        if (groupElement && messageView.message.type === WI.ConsoleMessage.MessageType.StartGroupCollapsed)
             groupElement.classList.add("collapsed");
 
         groupElement.appendChild(titleElement);
@@ -71,7 +71,7 @@
     addMessageView(messageView)
     {
         var element = messageView.element;
-        element.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);
+        element.classList.add(WI.LogContentView.ItemWrapperStyleClassName);
         this.append(element);
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
index 4bbe52b..7aecedb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
@@ -28,13 +28,13 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.Object
+WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object
 {
     constructor(message)
     {
         super();
 
-        console.assert(message instanceof WebInspector.ConsoleMessage);
+        console.assert(message instanceof WI.ConsoleMessage);
 
         this._message = message;
         this._expandable = false;
@@ -56,32 +56,32 @@
         this._element.__message = this._message;
         this._element.__messageView = this;
 
-        if (this._message.type === WebInspector.ConsoleMessage.MessageType.Result) {
+        if (this._message.type === WI.ConsoleMessage.MessageType.Result) {
             this._element.classList.add("console-user-command-result");
-            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Output: "));
-        } else if (this._message.type === WebInspector.ConsoleMessage.MessageType.StartGroup || this._message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
+            this._element.setAttribute("data-labelprefix", WI.UIString("Output: "));
+        } else if (this._message.type === WI.ConsoleMessage.MessageType.StartGroup || this._message.type === WI.ConsoleMessage.MessageType.StartGroupCollapsed)
             this._element.classList.add("console-group-title");
 
         switch (this._message.level) {
-        case WebInspector.ConsoleMessage.MessageLevel.Log:
+        case WI.ConsoleMessage.MessageLevel.Log:
             this._element.classList.add("console-log-level");
-            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Log: "));
+            this._element.setAttribute("data-labelprefix", WI.UIString("Log: "));
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Info:
+        case WI.ConsoleMessage.MessageLevel.Info:
             this._element.classList.add("console-info-level");
-            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Info: "));
+            this._element.setAttribute("data-labelprefix", WI.UIString("Info: "));
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Debug:
+        case WI.ConsoleMessage.MessageLevel.Debug:
             this._element.classList.add("console-debug-level");
-            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Debug: "));
+            this._element.setAttribute("data-labelprefix", WI.UIString("Debug: "));
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Warning:
+        case WI.ConsoleMessage.MessageLevel.Warning:
             this._element.classList.add("console-warning-level");
-            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Warning: "));
+            this._element.setAttribute("data-labelprefix", WI.UIString("Warning: "));
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Error:
+        case WI.ConsoleMessage.MessageLevel.Error:
             this._element.classList.add("console-error-level");
-            this._element.setAttribute("data-labelprefix", WebInspector.UIString("Error: "));
+            this._element.setAttribute("data-labelprefix", WI.UIString("Error: "));
             break;
         }
 
@@ -169,7 +169,7 @@
 
         // Auto-expand an inner object tree if there is a single object.
         // For Trace messages we are auto-expanding for the call stack, don't also auto-expand an object as well.
-        if (this._objectTree && this._message.type !== WebInspector.ConsoleMessage.MessageType.Trace) {
+        if (this._objectTree && this._message.type !== WI.ConsoleMessage.MessageType.Trace) {
             if (!this._extraParameters || this._extraParameters.length <= 1)
                 this._objectTree.expand();
         }
@@ -206,7 +206,7 @@
             let repeatString = this.repeatCount > 1 ? "x" + this.repeatCount : "";
             let urlLine = "";
             if (this._message.url) {
-                let components = [WebInspector.displayNameForURL(this._message.url), "line " + this._message.line];
+                let components = [WI.displayNameForURL(this._message.url), "line " + this._message.line];
                 if (repeatString)
                     components.push(repeatString);
                 urlLine = " (" + components.join(", ") + ")";
@@ -225,7 +225,7 @@
 
         if (hasStackTrace) {
             this._message.stackTrace.callFrames.forEach(function(frame) {
-                clipboardString += "\n\t" + (frame.functionName || WebInspector.UIString("(anonymous function)"));
+                clipboardString += "\n\t" + (frame.functionName || WI.UIString("(anonymous function)"));
                 if (frame.sourceCodeLocation)
                     clipboardString += " (" + frame.sourceCodeLocation.originalLocationString() + ")";
             });
@@ -240,13 +240,13 @@
 
     _appendMessageTextAndArguments(element)
     {
-        if (this._message.source === WebInspector.ConsoleMessage.MessageSource.ConsoleAPI) {
+        if (this._message.source === WI.ConsoleMessage.MessageSource.ConsoleAPI) {
             switch (this._message.type) {
-            case WebInspector.ConsoleMessage.MessageType.Trace:
-                var args = [WebInspector.UIString("Trace")];
+            case WI.ConsoleMessage.MessageType.Trace:
+                var args = [WI.UIString("Trace")];
                 if (this._message.parameters) {
                     if (this._message.parameters[0].type === "string") {
-                        var prefixedFormatString = WebInspector.UIString("Trace: %s").format(this._message.parameters[0].description);
+                        var prefixedFormatString = WI.UIString("Trace: %s").format(this._message.parameters[0].description);
                         args = [prefixedFormatString].concat(this._message.parameters.slice(1));
                     } else
                         args = args.concat(this._message.parameters);
@@ -254,11 +254,11 @@
                 this._appendFormattedArguments(element, args);
                 break;
 
-            case WebInspector.ConsoleMessage.MessageType.Assert:
-                var args = [WebInspector.UIString("Assertion Failed")];
+            case WI.ConsoleMessage.MessageType.Assert:
+                var args = [WI.UIString("Assertion Failed")];
                 if (this._message.parameters) {
                     if (this._message.parameters[0].type === "string") {
-                        var prefixedFormatString = WebInspector.UIString("Assertion Failed: %s").format(this._message.parameters[0].description);
+                        var prefixedFormatString = WI.UIString("Assertion Failed: %s").format(this._message.parameters[0].description);
                         args = [prefixedFormatString].concat(this._message.parameters.slice(1));
                     } else
                         args = args.concat(this._message.parameters);
@@ -266,20 +266,20 @@
                 this._appendFormattedArguments(element, args);
                 break;
 
-            case WebInspector.ConsoleMessage.MessageType.Dir:
+            case WI.ConsoleMessage.MessageType.Dir:
                 var obj = this._message.parameters ? this._message.parameters[0] : undefined;
                 this._appendFormattedArguments(element, ["%O", obj]);
                 break;
 
-            case WebInspector.ConsoleMessage.MessageType.Table:
+            case WI.ConsoleMessage.MessageType.Table:
                 var args = this._message.parameters;
                 element.appendChild(this._formatParameterAsTable(args));
                 this._extraParameters = null;
                 break;
 
-            case WebInspector.ConsoleMessage.MessageType.StartGroup:
-            case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
-                var args = this._message.parameters || [this._message.messageText || WebInspector.UIString("Group")];
+            case WI.ConsoleMessage.MessageType.StartGroup:
+            case WI.ConsoleMessage.MessageType.StartGroupCollapsed:
+                var args = this._message.parameters || [this._message.messageText || WI.UIString("Group")];
                 this._formatWithSubstitutionString(args, element);
                 this._extraParameters = null;
                 break;
@@ -292,7 +292,7 @@
             return;
         }
 
-        // FIXME: Better handle WebInspector.ConsoleMessage.MessageSource.Network once it has request info.
+        // FIXME: Better handle WI.ConsoleMessage.MessageSource.Network once it has request info.
 
         var args = this._message.parameters || [this._message.messageText];
         this._appendFormattedArguments(element, args);
@@ -303,8 +303,8 @@
         if (!this._message.savedResultIndex)
             return;
 
-        console.assert(this._message instanceof WebInspector.ConsoleCommandResultMessage);
-        console.assert(this._message.type === WebInspector.ConsoleMessage.MessageType.Result);
+        console.assert(this._message instanceof WI.ConsoleCommandResultMessage);
+        console.assert(this._message.type === WI.ConsoleMessage.MessageType.Result);
 
         var savedVariableElement = document.createElement("span");
         savedVariableElement.classList.add("console-saved-variable");
@@ -318,9 +318,9 @@
 
     _appendLocationLink()
     {
-        if (this._message.source === WebInspector.ConsoleMessage.MessageSource.Network) {
+        if (this._message.source === WI.ConsoleMessage.MessageSource.Network) {
             if (this._message.url) {
-                var anchor = WebInspector.linkifyURLAsNode(this._message.url, this._message.url, "console-message-url");
+                var anchor = WI.linkifyURLAsNode(this._message.url, this._message.url, "console-message-url");
                 anchor.classList.add("console-message-location");
                 this._element.appendChild(anchor);
             }
@@ -335,7 +335,7 @@
             callFrame = firstNonNativeNonAnonymousCallFrame;
         } else if (this._message.url && !this._shouldHideURL(this._message.url)) {
             // CSS warnings have no stack traces.
-            callFrame = WebInspector.CallFrame.fromPayload(this._message.target, {
+            callFrame = WI.CallFrame.fromPayload(this._message.target, {
                 functionName: "",
                 url: this._message.url,
                 lineNumber: this._message.line,
@@ -343,9 +343,9 @@
             });
         }
 
-        if (callFrame && (!callFrame.isConsoleEvaluation || WebInspector.isDebugUIEnabled())) {
+        if (callFrame && (!callFrame.isConsoleEvaluation || WI.isDebugUIEnabled())) {
             const showFunctionName = !!callFrame.functionName;
-            var locationElement = new WebInspector.CallFrameView(callFrame, showFunctionName);
+            var locationElement = new WI.CallFrameView(callFrame, showFunctionName);
             locationElement.classList.add("console-message-location");
             this._element.appendChild(locationElement);
             return;
@@ -355,7 +355,7 @@
             var parameter = this._createRemoteObjectIfNeeded(this._message.parameters[0]);
 
             parameter.findFunctionSourceCodeLocation().then(function(result) {
-                if (result === WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound || result === WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId)
+                if (result === WI.RemoteObject.SourceCodeLocationPromise.NoSourceFound || result === WI.RemoteObject.SourceCodeLocationPromise.MissingObjectId)
                     return;
 
                 var link = this._linkifyLocation(result.sourceCode.url, result.lineNumber, result.columnNumber);
@@ -399,26 +399,26 @@
         this._makeExpandable();
 
         // Auto-expand for console.trace.
-        if (this._message.type === WebInspector.ConsoleMessage.MessageType.Trace)
+        if (this._message.type === WI.ConsoleMessage.MessageType.Trace)
             this.expand();
 
         this._stackTraceElement = this._element.appendChild(document.createElement("div"));
         this._stackTraceElement.classList.add("console-message-text", "console-message-stack-trace-container");
 
-        var callFramesElement = new WebInspector.StackTraceView(this._message.stackTrace).element;
+        var callFramesElement = new WI.StackTraceView(this._message.stackTrace).element;
         this._stackTraceElement.appendChild(callFramesElement);
     }
 
     _createRemoteObjectIfNeeded(parameter)
     {
         // FIXME: Only pass RemoteObjects here so we can avoid this work.
-        if (parameter instanceof WebInspector.RemoteObject)
+        if (parameter instanceof WI.RemoteObject)
             return parameter;
 
         if (typeof parameter === "object")
-            return WebInspector.RemoteObject.fromPayload(parameter, this._message.target);
+            return WI.RemoteObject.fromPayload(parameter, this._message.target);
 
-        return WebInspector.RemoteObject.fromPrimitiveValue(parameter);
+        return WI.RemoteObject.fromPrimitiveValue(parameter);
     }
 
     _appendFormattedArguments(element, parameters)
@@ -430,7 +430,7 @@
             parameters[i] = this._createRemoteObjectIfNeeded(parameters[i]);
 
         let builderElement = element.appendChild(document.createElement("span"));
-        let shouldFormatWithStringSubstitution = parameters[0].type === "string" && this._message.type !== WebInspector.ConsoleMessage.MessageType.Result;
+        let shouldFormatWithStringSubstitution = parameters[0].type === "string" && this._message.type !== WI.ConsoleMessage.MessageType.Result;
 
         // Single object (e.g. console result or logging a non-string object).
         if (parameters.length === 1 && !shouldFormatWithStringSubstitution) {
@@ -439,7 +439,7 @@
             return;
         }
 
-        console.assert(this._message.type !== WebInspector.ConsoleMessage.MessageType.Result);
+        console.assert(this._message.type !== WI.ConsoleMessage.MessageType.Result);
 
         if (shouldFormatWithStringSubstitution && this._isStackTrace(parameters[0]))
             shouldFormatWithStringSubstitution = false;
@@ -484,8 +484,8 @@
                     let previewContainer = builderElement.appendChild(document.createElement("span"));
                     previewContainer.classList.add("inline-lossless");
 
-                    let preview = WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject(parameter, WebInspector.ObjectPreviewView.Mode.Brief);
-                    let isPreviewView = preview instanceof WebInspector.ObjectPreviewView;
+                    let preview = WI.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject(parameter, WI.ObjectPreviewView.Mode.Brief);
+                    let isPreviewView = preview instanceof WI.ObjectPreviewView;
 
                     if (isPreviewView)
                         preview.setOriginatingObjectInfo(parameter, null);
@@ -510,8 +510,8 @@
                 let previewContainer = builderElement.appendChild(document.createElement("span"));
                 previewContainer.classList.add("console-message-preview");
 
-                let preview = WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject(parameter, WebInspector.ObjectPreviewView.Mode.Brief);
-                let isPreviewView = preview instanceof WebInspector.ObjectPreviewView;
+                let preview = WI.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject(parameter, WI.ObjectPreviewView.Mode.Brief);
+                let isPreviewView = preview instanceof WI.ObjectPreviewView;
 
                 if (isPreviewView)
                     preview.setOriginatingObjectInfo(parameter, null);
@@ -540,23 +540,23 @@
 
     _hasSimpleDisplay(parameter)
     {
-        console.assert(parameter instanceof WebInspector.RemoteObject);
+        console.assert(parameter instanceof WI.RemoteObject);
 
-        return WebInspector.FormattedValue.hasSimpleDisplay(parameter) && !this._isStackTrace(parameter);
+        return WI.FormattedValue.hasSimpleDisplay(parameter) && !this._isStackTrace(parameter);
     }
 
     _isStackTrace(parameter)
     {
-        console.assert(parameter instanceof WebInspector.RemoteObject);
+        console.assert(parameter instanceof WI.RemoteObject);
 
-        return parameter.type === "string" && WebInspector.StackTrace.isLikelyStackTrace(parameter.description);
+        return parameter.type === "string" && WI.StackTrace.isLikelyStackTrace(parameter.description);
     }
 
     _shouldConsiderObjectLossless(object)
     {
         if (object.type === "string") {
             const description = object.description;
-            const maxLength = WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH;
+            const maxLength = WI.FormattedValue.MAX_PREVIEW_STRING_LENGTH;
             const longOrMultiLineString = description.length > maxLength || description.slice(0, maxLength).includes("\n");
             return !longOrMultiLineString;
         }
@@ -569,7 +569,7 @@
         var type;
         if (forceObjectFormat)
             type = "object";
-        else if (parameter instanceof WebInspector.RemoteObject)
+        else if (parameter instanceof WI.RemoteObject)
             type = parameter.subtype || parameter.type;
         else {
             console.assert(false, "no longer reachable");
@@ -600,44 +600,44 @@
 
     _formatParameterAsValue(value, fragment)
     {
-        fragment.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(value));
+        fragment.appendChild(WI.FormattedValue.createElementForRemoteObject(value));
     }
 
     _formatParameterAsString(object, fragment)
     {
         if (this._isStackTrace(object)) {
-            let stackTrace = WebInspector.StackTrace.fromString(this._message.target, object.description);
+            let stackTrace = WI.StackTrace.fromString(this._message.target, object.description);
             if (stackTrace.callFrames.length) {
-                let stackView = new WebInspector.StackTraceView(stackTrace);
+                let stackView = new WI.StackTraceView(stackTrace);
                 fragment.appendChild(stackView.element);
                 return;
             }
         }
 
-        fragment.appendChild(WebInspector.FormattedValue.createLinkifiedElementString(object.description));
+        fragment.appendChild(WI.FormattedValue.createLinkifiedElementString(object.description));
     }
 
     _formatParameterAsNode(object, fragment)
     {
-        fragment.appendChild(WebInspector.FormattedValue.createElementForNode(object));
+        fragment.appendChild(WI.FormattedValue.createElementForNode(object));
     }
 
     _formatParameterAsObject(object, fragment, forceExpansion)
     {
         // FIXME: Should have a better ObjectTreeView mode for classes (static methods and methods).
-        this._objectTree = new WebInspector.ObjectTreeView(object, null, this._rootPropertyPathForObject(object), forceExpansion);
+        this._objectTree = new WI.ObjectTreeView(object, null, this._rootPropertyPathForObject(object), forceExpansion);
         fragment.appendChild(this._objectTree.element);
     }
 
     _formatParameterAsError(object, fragment)
     {
-        this._objectTree = new WebInspector.ErrorObjectView(object);
+        this._objectTree = new WI.ErrorObjectView(object);
         fragment.appendChild(this._objectTree.element);
     }
 
     _formatParameterAsArray(array, fragment)
     {
-        this._objectTree = new WebInspector.ObjectTreeView(array, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(array));
+        this._objectTree = new WI.ObjectTreeView(array, WI.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(array));
         fragment.appendChild(this._objectTree.element);
     }
 
@@ -646,7 +646,7 @@
         if (!this._message.savedResultIndex)
             return null;
 
-        return new WebInspector.PropertyPath(object, "$" + this._message.savedResultIndex);
+        return new WI.PropertyPath(object, "$" + this._message.savedResultIndex);
     }
 
     _formatWithSubstitutionString(parameters, formattedResult)
@@ -716,7 +716,7 @@
             if (b instanceof Node)
                 a.appendChild(b);
             else if (b !== undefined) {
-                var toAppend = WebInspector.linkifyStringAsFragment(b.toString());
+                var toAppend = WI.linkifyStringAsFragment(b.toString());
                 if (currentStyle) {
                     var wrapper = document.createElement("span");
                     for (var key in currentStyle)
@@ -739,9 +739,9 @@
         if (!this._message.stackTrace.callFrames.length)
             return false;
 
-        return this._message.source === WebInspector.ConsoleMessage.MessageSource.Network
-            || this._message.level === WebInspector.ConsoleMessage.MessageLevel.Error
-            || this._message.type === WebInspector.ConsoleMessage.MessageType.Trace;
+        return this._message.source === WI.ConsoleMessage.MessageSource.Network
+            || this._message.level === WI.ConsoleMessage.MessageLevel.Error
+            || this._message.type === WI.ConsoleMessage.MessageType.Trace;
     }
 
     _shouldHideURL(url)
@@ -756,7 +756,7 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        return WebInspector.linkifyLocation(url, new WebInspector.SourceCodePosition(lineNumber, columnNumber), options);
+        return WI.linkifyLocation(url, new WI.SourceCodePosition(lineNumber, columnNumber), options);
     }
 
     _userProvidedColumnNames(columnNamesArgument)
@@ -764,7 +764,7 @@
         if (!columnNamesArgument)
             return null;
 
-        console.assert(columnNamesArgument instanceof WebInspector.RemoteObject);
+        console.assert(columnNamesArgument instanceof WI.RemoteObject);
 
         // Single primitive argument.
         if (columnNamesArgument.type === "string" || columnNamesArgument.type === "number")
@@ -824,7 +824,7 @@
                         columnNames.push(cellProperty.name);
                     }
 
-                    rowValue[cellProperty.name] = WebInspector.FormattedValue.createElementForPropertyPreview(cellProperty);
+                    rowValue[cellProperty.name] = WI.FormattedValue.createElementForPropertyPreview(cellProperty);
                 }
                 rows.push([rowProperty.name, rowValue]);
             }
@@ -832,7 +832,7 @@
 
         // If there were valuePreviews, convert to a flat list.
         if (rows.length) {
-            columnNames.unshift(WebInspector.UIString("(Index)"));
+            columnNames.unshift(WI.UIString("(Index)"));
             for (var i = 0; i < rows.length; ++i) {
                 var rowName = rows[i][0];
                 var rowValue = rows[i][1];
@@ -855,12 +855,12 @@
                     continue;
 
                 if (!columnNames.length) {
-                    columnNames.push(WebInspector.UIString("Index"));
-                    columnNames.push(WebInspector.UIString("Value"));
+                    columnNames.push(WI.UIString("Index"));
+                    columnNames.push(WI.UIString("Value"));
                 }
 
                 flatValues.push(rowProperty.name);
-                flatValues.push(WebInspector.FormattedValue.createElementForPropertyPreview(rowProperty));
+                flatValues.push(WI.FormattedValue.createElementForPropertyPreview(rowProperty));
             }
         }
 
@@ -870,7 +870,7 @@
 
         // FIXME: Should we output something extra if the preview is lossless?
 
-        var dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, flatValues);
+        var dataGrid = WI.DataGrid.createSortableDataGrid(columnNames, flatValues);
         dataGrid.inline = true;
         dataGrid.variableHeightRows = true;
 
@@ -884,27 +884,27 @@
     _levelString()
     {
         switch (this._message.level) {
-        case WebInspector.ConsoleMessage.MessageLevel.Log:
+        case WI.ConsoleMessage.MessageLevel.Log:
             return "Log";
-        case WebInspector.ConsoleMessage.MessageLevel.Info:
+        case WI.ConsoleMessage.MessageLevel.Info:
             return "Info";
-        case WebInspector.ConsoleMessage.MessageLevel.Warning:
+        case WI.ConsoleMessage.MessageLevel.Warning:
             return "Warning";
-        case WebInspector.ConsoleMessage.MessageLevel.Debug:
+        case WI.ConsoleMessage.MessageLevel.Debug:
             return "Debug";
-        case WebInspector.ConsoleMessage.MessageLevel.Error:
+        case WI.ConsoleMessage.MessageLevel.Error:
             return "Error";
         }
     }
 
     _enforcesClipboardPrefixString()
     {
-        return this._message.type !== WebInspector.ConsoleMessage.MessageType.Result;
+        return this._message.type !== WI.ConsoleMessage.MessageType.Result;
     }
 
     _clipboardPrefixString()
     {
-        if (this._message.type === WebInspector.ConsoleMessage.MessageType.Result)
+        if (this._message.type === WI.ConsoleMessage.MessageType.Result)
             return "< ";
 
         return "[" + this._levelString() + "] ";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js b/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
index 74b3c10..bfbd74a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsolePrompt = class ConsolePrompt extends WebInspector.View
+WI.ConsolePrompt = class ConsolePrompt extends WI.View
 {
     constructor(delegate, mimeType)
     {
@@ -31,11 +31,11 @@
 
         mimeType = parseMIMEType(mimeType).type;
 
-        this.element.classList.add("console-prompt", WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add("console-prompt", WI.SyntaxHighlightedStyleClassName);
 
         this._delegate = delegate || null;
 
-        this._codeMirror = WebInspector.CodeMirrorEditor.create(this.element, {
+        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
             lineWrapping: true,
             mode: {name: mimeType, globalVars: true},
             indentWithTabs: true,
@@ -56,8 +56,8 @@
 
         this._codeMirror.addKeyMap(keyMap);
 
-        this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
-        this._completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
+        this._completionController = new WI.CodeMirrorCompletionController(this._codeMirror, this);
+        this._completionController.addExtendedCompletionProvider("javascript", WI.javaScriptRuntimeCompletionProvider);
 
         this._history = [{}];
         this._historyIndex = 0;
@@ -100,7 +100,7 @@
 
     set history(history)
     {
-        this._history = history instanceof Array ? history.slice(0, WebInspector.ConsolePrompt.MaximumHistorySize) : [{}];
+        this._history = history instanceof Array ? history.slice(0, WI.ConsolePrompt.MaximumHistorySize) : [{}];
         this._historyIndex = 0;
         this._restoreHistoryEntry(0);
     }
@@ -163,7 +163,7 @@
             return CodeMirror.Pass;
 
         this._completionController.completeAtCurrentPositionIfNeeded().then(function(result) {
-            if (result === WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
+            if (result === WI.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
                 InspectorFrontendHost.beep();
         });
     }
@@ -282,8 +282,8 @@
             this._history.unshift({});
 
             // Trim the history length if needed.
-            if (this._history.length > WebInspector.ConsolePrompt.MaximumHistorySize)
-                this._history = this._history.slice(0, WebInspector.ConsolePrompt.MaximumHistorySize);
+            if (this._history.length > WI.ConsolePrompt.MaximumHistorySize)
+                this._history = this._history.slice(0, WI.ConsolePrompt.MaximumHistorySize);
         }
 
         this._historyIndex = 0;
@@ -322,4 +322,4 @@
     }
 };
 
-WebInspector.ConsolePrompt.MaximumHistorySize = 30;
+WI.ConsolePrompt.MaximumHistorySize = 30;
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleSession.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleSession.js
index 6fd4fcd4..42933df 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleSession.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleSession.js
@@ -26,7 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleSession = class ConsoleSession extends WebInspector.Object
+WI.ConsoleSession = class ConsoleSession extends WI.Object
 {
     constructor(data)
     {
@@ -42,17 +42,17 @@
 
         let headerText = "";
         switch (data.newSessionReason) {
-        case WebInspector.ConsoleSession.NewSessionReason.PageReloaded:
-            headerText = WebInspector.UIString("Page reloaded at %s");
+        case WI.ConsoleSession.NewSessionReason.PageReloaded:
+            headerText = WI.UIString("Page reloaded at %s");
             break;
-        case WebInspector.ConsoleSession.NewSessionReason.PageNavigated:
-            headerText = WebInspector.UIString("Page navigated at %s");
+        case WI.ConsoleSession.NewSessionReason.PageNavigated:
+            headerText = WI.UIString("Page navigated at %s");
             break;
-        case WebInspector.ConsoleSession.NewSessionReason.ConsoleCleared:
-            headerText = WebInspector.UIString("Console cleared at %s");
+        case WI.ConsoleSession.NewSessionReason.ConsoleCleared:
+            headerText = WI.UIString("Console cleared at %s");
             break;
         default:
-            headerText = WebInspector.UIString("Console opened at %s");
+            headerText = WI.UIString("Console opened at %s");
             break;
         }
 
@@ -69,7 +69,7 @@
     addMessageView(messageView)
     {
         var messageElement = messageView.element;
-        messageElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);
+        messageElement.classList.add(WI.LogContentView.ItemWrapperStyleClassName);
         this.append(messageElement);
     }
 
@@ -85,7 +85,7 @@
     }
 };
 
-WebInspector.ConsoleSession.NewSessionReason = {
+WI.ConsoleSession.NewSessionReason = {
     PageReloaded: Symbol("Page reloaded"),
     PageNavigated: Symbol("Page navigated"),
     ConsoleCleared: Symbol("Console cleared"),
diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js
index e0ea30e..83d33b6 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleTabContentView = class ConsoleTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.ConsoleTabContentView = class ConsoleTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.ConsoleTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
+        let {image, title} = WI.ConsoleTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
 
         super(identifier || "console", "console", tabBarItem, null, null, true);
     }
@@ -37,7 +37,7 @@
     {
         return {
             image: "Images/Console.svg",
-            title: WebInspector.UIString("Console"),
+            title: WI.UIString("Console"),
         };
     }
 
@@ -45,39 +45,39 @@
 
     get type()
     {
-        return WebInspector.ConsoleTabContentView.Type;
+        return WI.ConsoleTabContentView.Type;
     }
 
     shown()
     {
         super.shown();
 
-        WebInspector.consoleContentView.prompt.focus();
+        WI.consoleContentView.prompt.focus();
 
-        if (this.contentBrowser.currentContentView === WebInspector.consoleContentView)
+        if (this.contentBrowser.currentContentView === WI.consoleContentView)
             return;
 
         // Be sure to close the view in the split content browser before showing it in the
         // tab content browser. We can only show a content view in one browser at a time.
-        if (WebInspector.consoleContentView.parentContainer)
-            WebInspector.consoleContentView.parentContainer.closeContentView(WebInspector.consoleContentView);
+        if (WI.consoleContentView.parentContainer)
+            WI.consoleContentView.parentContainer.closeContentView(WI.consoleContentView);
 
-        this.contentBrowser.showContentView(WebInspector.consoleContentView);
+        this.contentBrowser.showContentView(WI.consoleContentView);
 
-        console.assert(this.contentBrowser.currentContentView === WebInspector.consoleContentView);
+        console.assert(this.contentBrowser.currentContentView === WI.consoleContentView);
     }
 
     showRepresentedObject(representedObject, cookie)
     {
         // Do nothing. The shown function will handle things. Calling
         // ContentBrowserTabContentView.shown will cause a new LogContentView
-        // to be created instead of reusing WebInspector.consoleContentView.
-        console.assert(representedObject instanceof WebInspector.LogObject);
+        // to be created instead of reusing WI.consoleContentView.
+        console.assert(representedObject instanceof WI.LogObject);
     }
 
     canShowRepresentedObject(representedObject)
     {
-        return representedObject instanceof WebInspector.LogObject;
+        return representedObject instanceof WI.LogObject;
     }
 
     get supportsSplitContentBrowser()
@@ -86,4 +86,4 @@
     }
 };
 
-WebInspector.ConsoleTabContentView.Type = "console";
+WI.ConsoleTabContentView.Type = "console";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js b/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
index 57d638c..fea3f5b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.View
+WI.ContentBrowser = class ContentBrowser extends WI.View
 {
     constructor(element, delegate, disableBackForward, disableFindBanner, flexibleNavigationItem)
     {
@@ -31,61 +31,61 @@
 
         this.element.classList.add("content-browser");
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this.addSubview(this._navigationBar);
 
-        this._contentViewContainer = new WebInspector.ContentViewContainer;
-        this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
+        this._contentViewContainer = new WI.ContentViewContainer;
+        this._contentViewContainer.addEventListener(WI.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
         this.addSubview(this._contentViewContainer);
 
         if (!disableBackForward) {
-            let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+            let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
 
             let goBack = () => { this.goBack(); };
             let goForward = () => { this.goForward(); };
 
-            let backShortcutKey = isRTL ? WebInspector.KeyboardShortcut.Key.Right : WebInspector.KeyboardShortcut.Key.Left;
-            let forwardShortcutKey = isRTL ? WebInspector.KeyboardShortcut.Key.Left : WebInspector.KeyboardShortcut.Key.Right;
-            this._backKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Control, backShortcutKey, goBack, this.element);
-            this._forwardKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Control, forwardShortcutKey, goForward, this.element);
+            let backShortcutKey = isRTL ? WI.KeyboardShortcut.Key.Right : WI.KeyboardShortcut.Key.Left;
+            let forwardShortcutKey = isRTL ? WI.KeyboardShortcut.Key.Left : WI.KeyboardShortcut.Key.Right;
+            this._backKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Control, backShortcutKey, goBack, this.element);
+            this._forwardKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Control, forwardShortcutKey, goForward, this.element);
 
             let leftArrow = "Images/BackForwardArrows.svg#left-arrow-mask";
             let rightArrow = "Images/BackForwardArrows.svg#right-arrow-mask";
             let backButtonImage = isRTL ? rightArrow : leftArrow;
             let forwardButtonImage = isRTL ? leftArrow : rightArrow;
 
-            this._backNavigationItem = new WebInspector.ButtonNavigationItem("back", WebInspector.UIString("Back (%s)").format(this._backKeyboardShortcut.displayName), backButtonImage, 8, 13);
-            this._backNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, goBack);
+            this._backNavigationItem = new WI.ButtonNavigationItem("back", WI.UIString("Back (%s)").format(this._backKeyboardShortcut.displayName), backButtonImage, 8, 13);
+            this._backNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, goBack);
             this._backNavigationItem.enabled = false;
             this._navigationBar.addNavigationItem(this._backNavigationItem);
 
-            this._forwardNavigationItem = new WebInspector.ButtonNavigationItem("forward", WebInspector.UIString("Forward (%s)").format(this._forwardKeyboardShortcut.displayName), forwardButtonImage, 8, 13);
-            this._forwardNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, goForward);
+            this._forwardNavigationItem = new WI.ButtonNavigationItem("forward", WI.UIString("Forward (%s)").format(this._forwardKeyboardShortcut.displayName), forwardButtonImage, 8, 13);
+            this._forwardNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, goForward);
             this._forwardNavigationItem.enabled = false;
             this._navigationBar.addNavigationItem(this._forwardNavigationItem);
 
-            this._navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);
+            this._navigationBar.addNavigationItem(new WI.DividerNavigationItem);
         }
 
         if (!disableFindBanner) {
-            this._findBanner = new WebInspector.FindBanner(this);
-            this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidShow, this._findBannerDidShow, this);
-            this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidHide, this._findBannerDidHide, this);
+            this._findBanner = new WI.FindBanner(this);
+            this._findBanner.addEventListener(WI.FindBanner.Event.DidShow, this._findBannerDidShow, this);
+            this._findBanner.addEventListener(WI.FindBanner.Event.DidHide, this._findBannerDidHide, this);
         }
 
-        this._hierarchicalPathNavigationItem = new WebInspector.HierarchicalPathNavigationItem;
-        this._hierarchicalPathNavigationItem.addEventListener(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected, this._hierarchicalPathComponentWasSelected, this);
+        this._hierarchicalPathNavigationItem = new WI.HierarchicalPathNavigationItem;
+        this._hierarchicalPathNavigationItem.addEventListener(WI.HierarchicalPathNavigationItem.Event.PathComponentWasSelected, this._hierarchicalPathComponentWasSelected, this);
         this._navigationBar.addNavigationItem(this._hierarchicalPathNavigationItem);
 
-        this._contentViewSelectionPathNavigationItem = new WebInspector.HierarchicalPathNavigationItem;
+        this._contentViewSelectionPathNavigationItem = new WI.HierarchicalPathNavigationItem;
 
-        this._flexibleNavigationItem = flexibleNavigationItem || new WebInspector.FlexibleSpaceNavigationItem;
+        this._flexibleNavigationItem = flexibleNavigationItem || new WI.FlexibleSpaceNavigationItem;
         this._navigationBar.addNavigationItem(this._flexibleNavigationItem);
 
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._contentViewNavigationItemsDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.NavigationItemsDidChange, this._contentViewNavigationItemsDidChange, this);
 
         this._delegate = delegate || null;
 
@@ -330,7 +330,7 @@
         var pathComponents = [];
 
         while (treeElement && !treeElement.root) {
-            var pathComponent = new WebInspector.GeneralTreeElementPathComponent(treeElement);
+            var pathComponent = new WI.GeneralTreeElementPathComponent(treeElement);
             pathComponents.unshift(pathComponent);
             treeElement = treeElement.parent;
         }
@@ -382,7 +382,7 @@
             return;
 
         if (!forceUpdate) {
-            let previousItems = this._currentContentViewNavigationItems.filter((item) => !(item instanceof WebInspector.DividerNavigationItem));
+            let previousItems = this._currentContentViewNavigationItems.filter((item) => !(item instanceof WI.DividerNavigationItem));
             let isUnchanged = Array.shallowEqual(previousItems, currentContentView.navigationItems);
 
             if (isUnchanged)
@@ -401,8 +401,8 @@
         // Go through each of the items of the new content view and add a divider before them.
         currentContentView.navigationItems.forEach(function(navigationItem, index) {
             // Add dividers before items unless it's the first item and not a button.
-            if (index !== 0 || navigationItem instanceof WebInspector.ButtonNavigationItem) {
-                let divider = new WebInspector.DividerNavigationItem;
+            if (index !== 0 || navigationItem instanceof WI.ButtonNavigationItem) {
+                let divider = new WI.DividerNavigationItem;
                 navigationBar.insertNavigationItem(divider, insertionIndex++);
                 newNavigationItems.push(divider);
             }
@@ -447,7 +447,7 @@
     {
         this._dispatchCurrentRepresentedObjectsDidChangeEvent.cancelDebounce();
 
-        this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange);
+        this.dispatchEventToListeners(WI.ContentBrowser.Event.CurrentRepresentedObjectsDidChange);
     }
 
     _contentViewSelectionPathComponentDidChange(event)
@@ -486,7 +486,7 @@
 
         this._navigationBar.needsLayout();
 
-        this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange);
+        this.dispatchEventToListeners(WI.ContentBrowser.Event.CurrentContentViewDidChange);
 
         this._dispatchCurrentRepresentedObjectsDidChangeEvent();
     }
@@ -503,13 +503,13 @@
 
     _hierarchicalPathComponentWasSelected(event)
     {
-        console.assert(event.data.pathComponent instanceof WebInspector.GeneralTreeElementPathComponent);
+        console.assert(event.data.pathComponent instanceof WI.GeneralTreeElementPathComponent);
 
         var treeElement = event.data.pathComponent.generalTreeElement;
         var originalTreeElement = treeElement;
 
         // Some tree elements (like folders) are not viewable. Find the first descendant that is viewable.
-        while (treeElement && !WebInspector.ContentView.isViewable(treeElement.representedObject))
+        while (treeElement && !WI.ContentView.isViewable(treeElement.representedObject))
             treeElement = treeElement.traverseNextTreeElement(false, originalTreeElement, false);
 
         if (!treeElement)
@@ -519,7 +519,7 @@
     }
 };
 
-WebInspector.ContentBrowser.Event = {
+WI.ContentBrowser.Event = {
     CurrentRepresentedObjectsDidChange: "content-browser-current-represented-objects-did-change",
     CurrentContentViewDidChange: "content-browser-current-content-view-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js
index bc75f18..662999c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentBrowserTabContentView = class ContentBrowserTabContentView extends WebInspector.TabContentView
+WI.ContentBrowserTabContentView = class ContentBrowserTabContentView extends WI.TabContentView
 {
     constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors, disableBackForward, flexibleNavigationItem)
     {
@@ -32,52 +32,52 @@
 
         styleClassNames.push("content-browser");
 
-        var contentBrowser = new WebInspector.ContentBrowser(null, null, disableBackForward, false, flexibleNavigationItem);
+        var contentBrowser = new WI.ContentBrowser(null, null, disableBackForward, false, flexibleNavigationItem);
 
         super(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors);
 
         this._contentBrowser = contentBrowser;
         this._contentBrowser.delegate = this;
 
-        this._lastSelectedDetailsSidebarPanelSetting = new WebInspector.Setting(identifier + "-last-selected-details-sidebar-panel", null);
+        this._lastSelectedDetailsSidebarPanelSetting = new WI.Setting(identifier + "-last-selected-details-sidebar-panel", null);
 
-        this._contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange, this.showDetailsSidebarPanels, this);
-        this._contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);
+        this._contentBrowser.addEventListener(WI.ContentBrowser.Event.CurrentRepresentedObjectsDidChange, this.showDetailsSidebarPanels, this);
+        this._contentBrowser.addEventListener(WI.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);
 
         // If any content views were shown during sidebar construction, contentBrowserTreeElementForRepresentedObject() would have returned null.
         // Explicitly update the path for the navigation bar to prevent it from showing up as blank.
         this._contentBrowser.updateHierarchicalPathForCurrentContentView();
 
         if (navigationSidebarPanelConstructor) {
-            let showToolTip = WebInspector.UIString("Show the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);
-            let hideToolTip = WebInspector.UIString("Hide the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);
-            let image = WebInspector.resolvedLayoutDirection() == WebInspector.LayoutDirection.RTL ? "Images/ToggleRightSidebar.svg" : "Images/ToggleLeftSidebar.svg";
+            let showToolTip = WI.UIString("Show the navigation sidebar (%s)").format(WI.navigationSidebarKeyboardShortcut.displayName);
+            let hideToolTip = WI.UIString("Hide the navigation sidebar (%s)").format(WI.navigationSidebarKeyboardShortcut.displayName);
+            let image = WI.resolvedLayoutDirection() == WI.LayoutDirection.RTL ? "Images/ToggleRightSidebar.svg" : "Images/ToggleLeftSidebar.svg";
 
-            this._showNavigationSidebarItem = new WebInspector.ActivateButtonNavigationItem("toggle-navigation-sidebar", showToolTip, hideToolTip, image, 16, 16);
-            this._showNavigationSidebarItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.toggleNavigationSidebar, WebInspector);
-            this._showNavigationSidebarItem.activated = !WebInspector.navigationSidebar.collapsed;
+            this._showNavigationSidebarItem = new WI.ActivateButtonNavigationItem("toggle-navigation-sidebar", showToolTip, hideToolTip, image, 16, 16);
+            this._showNavigationSidebarItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.toggleNavigationSidebar, WI);
+            this._showNavigationSidebarItem.activated = !WI.navigationSidebar.collapsed;
 
             this._contentBrowser.navigationBar.insertNavigationItem(this._showNavigationSidebarItem, 0);
-            this._contentBrowser.navigationBar.insertNavigationItem(new WebInspector.DividerNavigationItem, 1);
+            this._contentBrowser.navigationBar.insertNavigationItem(new WI.DividerNavigationItem, 1);
 
-            WebInspector.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange, this._navigationSidebarCollapsedStateDidChange, this);
+            WI.navigationSidebar.addEventListener(WI.Sidebar.Event.CollapsedStateDidChange, this._navigationSidebarCollapsedStateDidChange, this);
         }
 
         if (detailsSidebarPanelConstructors && detailsSidebarPanelConstructors.length) {
-            let showToolTip = WebInspector.UIString("Show the details sidebar (%s)").format(WebInspector.detailsSidebarKeyboardShortcut.displayName);
-            let hideToolTip = WebInspector.UIString("Hide the details sidebar (%s)").format(WebInspector.detailsSidebarKeyboardShortcut.displayName);
-            let image = WebInspector.resolvedLayoutDirection() == WebInspector.LayoutDirection.RTL ? "Images/ToggleLeftSidebar.svg" : "Images/ToggleRightSidebar.svg";
+            let showToolTip = WI.UIString("Show the details sidebar (%s)").format(WI.detailsSidebarKeyboardShortcut.displayName);
+            let hideToolTip = WI.UIString("Hide the details sidebar (%s)").format(WI.detailsSidebarKeyboardShortcut.displayName);
+            let image = WI.resolvedLayoutDirection() == WI.LayoutDirection.RTL ? "Images/ToggleLeftSidebar.svg" : "Images/ToggleRightSidebar.svg";
 
-            this._showDetailsSidebarItem = new WebInspector.ActivateButtonNavigationItem("toggle-details-sidebar", showToolTip, hideToolTip, image, 16, 16);
-            this._showDetailsSidebarItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.toggleDetailsSidebar, WebInspector);
-            this._showDetailsSidebarItem.activated = !WebInspector.detailsSidebar.collapsed;
+            this._showDetailsSidebarItem = new WI.ActivateButtonNavigationItem("toggle-details-sidebar", showToolTip, hideToolTip, image, 16, 16);
+            this._showDetailsSidebarItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.toggleDetailsSidebar, WI);
+            this._showDetailsSidebarItem.activated = !WI.detailsSidebar.collapsed;
             this._showDetailsSidebarItem.enabled = false;
 
-            this._contentBrowser.navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);
+            this._contentBrowser.navigationBar.addNavigationItem(new WI.DividerNavigationItem);
             this._contentBrowser.navigationBar.addNavigationItem(this._showDetailsSidebarItem);
 
-            WebInspector.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange, this._detailsSidebarCollapsedStateDidChange, this);
-            WebInspector.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.SidebarPanelSelected, this._detailsSidebarPanelSelected, this);
+            WI.detailsSidebar.addEventListener(WI.Sidebar.Event.CollapsedStateDidChange, this._detailsSidebarCollapsedStateDidChange, this);
+            WI.detailsSidebar.addEventListener(WI.Sidebar.Event.SidebarPanelSelected, this._detailsSidebarPanelSelected, this);
         }
 
         this.addSubview(this._contentBrowser);
@@ -118,8 +118,8 @@
     {
         super.closed();
 
-        WebInspector.navigationSidebar.removeEventListener(null, null, this);
-        WebInspector.detailsSidebar.removeEventListener(null, null, this);
+        WI.navigationSidebar.removeEventListener(null, null, this);
+        WI.detailsSidebar.removeEventListener(null, null, this);
 
         if (this.navigationSidebarPanel && typeof this.navigationSidebarPanel.closed === "function")
             this.navigationSidebarPanel.closed();
@@ -138,7 +138,7 @@
             return;
 
         var currentRepresentedObjects = this._contentBrowser.currentRepresentedObjects;
-        var currentSidebarPanels = WebInspector.detailsSidebar.sidebarPanels;
+        var currentSidebarPanels = WI.detailsSidebar.sidebarPanels;
         var wasSidebarEmpty = !currentSidebarPanels.length;
 
         // Ignore any changes to the selected sidebar panel during this function so only user initiated
@@ -158,26 +158,26 @@
 
                 // The sidebar panel was not previously showing, so add the panel.
                 let index = i - hiddenSidebarPanels;
-                WebInspector.detailsSidebar.insertSidebarPanel(sidebarPanel, index);
+                WI.detailsSidebar.insertSidebarPanel(sidebarPanel, index);
 
                 if (this._lastSelectedDetailsSidebarPanelSetting.value === sidebarPanel.identifier) {
                     // Restore the sidebar panel selection if this sidebar panel was the last one selected by the user.
-                    WebInspector.detailsSidebar.selectedSidebarPanel = sidebarPanel;
+                    WI.detailsSidebar.selectedSidebarPanel = sidebarPanel;
                 }
             } else {
                 // The sidebar panel can't inspect the current represented objects, so remove the panel and hide the toolbar item.
-                WebInspector.detailsSidebar.removeSidebarPanel(sidebarPanel);
+                WI.detailsSidebar.removeSidebarPanel(sidebarPanel);
                 hiddenSidebarPanels++;
             }
         }
 
-        if (!WebInspector.detailsSidebar.selectedSidebarPanel && currentSidebarPanels.length)
-            WebInspector.detailsSidebar.selectedSidebarPanel = currentSidebarPanels[0];
+        if (!WI.detailsSidebar.selectedSidebarPanel && currentSidebarPanels.length)
+            WI.detailsSidebar.selectedSidebarPanel = currentSidebarPanels[0];
 
-        if (!WebInspector.detailsSidebar.sidebarPanels.length)
-            WebInspector.detailsSidebar.collapsed = true;
+        if (!WI.detailsSidebar.sidebarPanels.length)
+            WI.detailsSidebar.collapsed = true;
         else if (wasSidebarEmpty)
-            WebInspector.detailsSidebar.collapsed = this.detailsSidebarCollapsedSetting.value;
+            WI.detailsSidebar.collapsed = this.detailsSidebarCollapsedSetting.value;
 
         this._ignoreDetailsSidebarPanelCollapsedEvent = false;
         this._ignoreDetailsSidebarPanelSelectedEvent = false;
@@ -185,7 +185,7 @@
         if (!this.detailsSidebarPanels.length)
             return;
 
-        this._showDetailsSidebarItem.enabled = WebInspector.detailsSidebar.sidebarPanels.length;
+        this._showDetailsSidebarItem.enabled = WI.detailsSidebar.sidebarPanels.length;
     }
 
     showRepresentedObject(representedObject, cookie)
@@ -218,7 +218,7 @@
 
     _navigationSidebarCollapsedStateDidChange(event)
     {
-        this._showNavigationSidebarItem.activated = !WebInspector.navigationSidebar.collapsed;
+        this._showNavigationSidebarItem.activated = !WI.navigationSidebar.collapsed;
     }
 
     _detailsSidebarCollapsedStateDidChange(event)
@@ -226,13 +226,13 @@
         if (!this.visible)
             return;
 
-        this._showDetailsSidebarItem.activated = !WebInspector.detailsSidebar.collapsed;
-        this._showDetailsSidebarItem.enabled = WebInspector.detailsSidebar.sidebarPanels.length;
+        this._showDetailsSidebarItem.activated = !WI.detailsSidebar.collapsed;
+        this._showDetailsSidebarItem.enabled = WI.detailsSidebar.sidebarPanels.length;
 
         if (this._ignoreDetailsSidebarPanelCollapsedEvent)
             return;
 
-        this.detailsSidebarCollapsedSetting.value = WebInspector.detailsSidebar.collapsed;
+        this.detailsSidebarCollapsedSetting.value = WI.detailsSidebar.collapsed;
     }
 
     _detailsSidebarPanelSelected(event)
@@ -240,13 +240,13 @@
         if (!this.visible)
             return;
 
-        this._showDetailsSidebarItem.activated = !WebInspector.detailsSidebar.collapsed;
-        this._showDetailsSidebarItem.enabled = WebInspector.detailsSidebar.sidebarPanels.length;
+        this._showDetailsSidebarItem.activated = !WI.detailsSidebar.collapsed;
+        this._showDetailsSidebarItem.enabled = WI.detailsSidebar.sidebarPanels.length;
 
-        if (!WebInspector.detailsSidebar.selectedSidebarPanel || this._ignoreDetailsSidebarPanelSelectedEvent)
+        if (!WI.detailsSidebar.selectedSidebarPanel || this._ignoreDetailsSidebarPanelSelectedEvent)
             return;
 
-        this._lastSelectedDetailsSidebarPanelSetting.value = WebInspector.detailsSidebar.selectedSidebarPanel.identifier;
+        this._lastSelectedDetailsSidebarPanelSetting.value = WI.detailsSidebar.selectedSidebarPanel.identifier;
     }
 
     _contentBrowserCurrentContentViewDidChange(event)
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentFlowDOMTreeContentView.js b/Source/WebInspectorUI/UserInterface/Views/ContentFlowDOMTreeContentView.js
index 01cab4a..b91bdfc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContentFlowDOMTreeContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContentFlowDOMTreeContentView.js
@@ -28,16 +28,16 @@
  * SUCH DAMAGE.
  */
 
-WebInspector.ContentFlowDOMTreeContentView = class ContentFlowDOMTreeContentView extends WebInspector.DOMTreeContentView
+WI.ContentFlowDOMTreeContentView = class ContentFlowDOMTreeContentView extends WI.DOMTreeContentView
 {
     constructor(contentFlow)
     {
-        console.assert(contentFlow instanceof WebInspector.ContentFlow, contentFlow);
+        console.assert(contentFlow instanceof WI.ContentFlow, contentFlow);
 
         super(contentFlow);
 
-        contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
-        contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
+        contentFlow.addEventListener(WI.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
+        contentFlow.addEventListener(WI.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
 
         this._createContentTrees();
     }
@@ -64,7 +64,7 @@
     {
         var contentNodes = this.representedObject.contentNodes;
         for (var contentNode of contentNodes)
-            this.domTreeOutline.appendChild(new WebInspector.DOMTreeElement(contentNode));
+            this.domTreeOutline.appendChild(new WI.DOMTreeElement(contentNode));
 
         var documentURL = contentNodes.length ? contentNodes[0].ownerDocument.documentURL : null;
         this._restoreSelectedNodeAfterUpdate(documentURL, contentNodes[0]);
@@ -72,7 +72,7 @@
 
     _contentNodeWasAdded(event)
     {
-        var treeElement = new WebInspector.DOMTreeElement(event.data.node);
+        var treeElement = new WI.DOMTreeElement(event.data.node);
         if (!event.data.before) {
             this.domTreeOutline.appendChild(treeElement);
             return;
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentFlowTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ContentFlowTreeElement.js
index 2fc8f3d..b16fddb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContentFlowTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContentFlowTreeElement.js
@@ -28,11 +28,11 @@
  * SUCH DAMAGE.
  */
 
-WebInspector.ContentFlowTreeElement = class ContentFlowTreeElement extends WebInspector.GeneralTreeElement
+WI.ContentFlowTreeElement = class ContentFlowTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.ContentFlow);
+        console.assert(representedObject instanceof WI.ContentFlow);
 
         const subtitle = null;
         super("content-flow-icon", representedObject.name, subtitle, representedObject);
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentView.js b/Source/WebInspectorUI/UserInterface/Views/ContentView.js
index f14d63c..9225c10 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContentView.js
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentView = class ContentView extends WebInspector.View
+WI.ContentView = class ContentView extends WI.View
 {
     constructor(representedObject, extraArguments)
     {
         // Concrete object instantiation.
-        console.assert(!representedObject || WebInspector.ContentView.isViewable(representedObject), representedObject);
+        console.assert(!representedObject || WI.ContentView.isViewable(representedObject), representedObject);
 
         super();
 
@@ -45,97 +45,97 @@
     {
         console.assert(representedObject);
 
-        if (representedObject instanceof WebInspector.Frame)
-            return new WebInspector.ResourceClusterContentView(representedObject.mainResource, extraArguments);
+        if (representedObject instanceof WI.Frame)
+            return new WI.ResourceClusterContentView(representedObject.mainResource, extraArguments);
 
-        if (representedObject instanceof WebInspector.Resource)
-            return new WebInspector.ResourceClusterContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.Resource)
+            return new WI.ResourceClusterContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.Script)
-            return new WebInspector.ScriptContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.Script)
+            return new WI.ScriptContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.CSSStyleSheet)
-            return new WebInspector.TextResourceContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.CSSStyleSheet)
+            return new WI.TextResourceContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.Canvas)
-            return new WebInspector.CanvasContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.Canvas)
+            return new WI.CanvasContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.TimelineRecording)
-            return new WebInspector.TimelineRecordingContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.TimelineRecording)
+            return new WI.TimelineRecordingContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.Timeline) {
+        if (representedObject instanceof WI.Timeline) {
             var timelineType = representedObject.type;
-            if (timelineType === WebInspector.TimelineRecord.Type.Network)
-                return new WebInspector.NetworkTimelineView(representedObject, extraArguments);
+            if (timelineType === WI.TimelineRecord.Type.Network)
+                return new WI.NetworkTimelineView(representedObject, extraArguments);
 
-            if (timelineType === WebInspector.TimelineRecord.Type.Layout)
-                return new WebInspector.LayoutTimelineView(representedObject, extraArguments);
+            if (timelineType === WI.TimelineRecord.Type.Layout)
+                return new WI.LayoutTimelineView(representedObject, extraArguments);
 
-            if (timelineType === WebInspector.TimelineRecord.Type.Script)
-                return new WebInspector.ScriptClusterTimelineView(representedObject, extraArguments);
+            if (timelineType === WI.TimelineRecord.Type.Script)
+                return new WI.ScriptClusterTimelineView(representedObject, extraArguments);
 
-            if (timelineType === WebInspector.TimelineRecord.Type.RenderingFrame)
-                return new WebInspector.RenderingFrameTimelineView(representedObject, extraArguments);
+            if (timelineType === WI.TimelineRecord.Type.RenderingFrame)
+                return new WI.RenderingFrameTimelineView(representedObject, extraArguments);
 
-            if (timelineType === WebInspector.TimelineRecord.Type.Memory)
-                return new WebInspector.MemoryTimelineView(representedObject, extraArguments);
+            if (timelineType === WI.TimelineRecord.Type.Memory)
+                return new WI.MemoryTimelineView(representedObject, extraArguments);
 
-            if (timelineType === WebInspector.TimelineRecord.Type.HeapAllocations)
-                return new WebInspector.HeapAllocationsTimelineView(representedObject, extraArguments);
+            if (timelineType === WI.TimelineRecord.Type.HeapAllocations)
+                return new WI.HeapAllocationsTimelineView(representedObject, extraArguments);
         }
 
-        if (representedObject instanceof WebInspector.Breakpoint || representedObject instanceof WebInspector.IssueMessage) {
+        if (representedObject instanceof WI.Breakpoint || representedObject instanceof WI.IssueMessage) {
             if (representedObject.sourceCodeLocation)
-                return WebInspector.ContentView.createFromRepresentedObject(representedObject.sourceCodeLocation.displaySourceCode, extraArguments);
+                return WI.ContentView.createFromRepresentedObject(representedObject.sourceCodeLocation.displaySourceCode, extraArguments);
         }
 
-        if (representedObject instanceof WebInspector.DOMStorageObject)
-            return new WebInspector.DOMStorageContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.DOMStorageObject)
+            return new WI.DOMStorageContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.CookieStorageObject)
-            return new WebInspector.CookieStorageContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.CookieStorageObject)
+            return new WI.CookieStorageContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.DatabaseTableObject)
-            return new WebInspector.DatabaseTableContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.DatabaseTableObject)
+            return new WI.DatabaseTableContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.DatabaseObject)
-            return new WebInspector.DatabaseContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.DatabaseObject)
+            return new WI.DatabaseContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.IndexedDatabase)
-            return new WebInspector.IndexedDatabaseContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.IndexedDatabase)
+            return new WI.IndexedDatabaseContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.IndexedDatabaseObjectStore)
-            return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.IndexedDatabaseObjectStore)
+            return new WI.IndexedDatabaseObjectStoreContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
-            return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.IndexedDatabaseObjectStoreIndex)
+            return new WI.IndexedDatabaseObjectStoreContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.ApplicationCacheFrame)
-            return new WebInspector.ApplicationCacheFrameContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.ApplicationCacheFrame)
+            return new WI.ApplicationCacheFrameContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.DOMTree)
-            return new WebInspector.FrameDOMTreeContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.DOMTree)
+            return new WI.FrameDOMTreeContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.DOMSearchMatchObject) {
-            var resultView = new WebInspector.FrameDOMTreeContentView(WebInspector.frameResourceManager.mainFrame.domTree, extraArguments);
+        if (representedObject instanceof WI.DOMSearchMatchObject) {
+            var resultView = new WI.FrameDOMTreeContentView(WI.frameResourceManager.mainFrame.domTree, extraArguments);
             resultView.restoreFromCookie({nodeToSelect: representedObject.domNode});
             return resultView;
         }
 
-        if (representedObject instanceof WebInspector.DOMNode) {
+        if (representedObject instanceof WI.DOMNode) {
             if (representedObject.frame) {
-                let resultView = WebInspector.ContentView.createFromRepresentedObject(representedObject.frame, extraArguments);
+                let resultView = WI.ContentView.createFromRepresentedObject(representedObject.frame, extraArguments);
                 resultView.restoreFromCookie({nodeToSelect: representedObject});
                 return resultView;
             }
         }
 
-        if (representedObject instanceof WebInspector.SourceCodeSearchMatchObject) {
+        if (representedObject instanceof WI.SourceCodeSearchMatchObject) {
             var resultView;
-            if (representedObject.sourceCode instanceof WebInspector.Resource)
-                resultView = new WebInspector.ResourceClusterContentView(representedObject.sourceCode, extraArguments);
-            else if (representedObject.sourceCode instanceof WebInspector.Script)
-                resultView = new WebInspector.ScriptContentView(representedObject.sourceCode, extraArguments);
+            if (representedObject.sourceCode instanceof WI.Resource)
+                resultView = new WI.ResourceClusterContentView(representedObject.sourceCode, extraArguments);
+            else if (representedObject.sourceCode instanceof WI.Script)
+                resultView = new WI.ScriptContentView(representedObject.sourceCode, extraArguments);
             else
                 console.error("Unknown SourceCode", representedObject.sourceCode);
 
@@ -146,28 +146,28 @@
             return resultView;
         }
 
-        if (representedObject instanceof WebInspector.LogObject)
-            return new WebInspector.LogContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.LogObject)
+            return new WI.LogContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.ContentFlow)
-            return new WebInspector.ContentFlowDOMTreeContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.ContentFlow)
+            return new WI.ContentFlowDOMTreeContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.CallingContextTree)
-            return new WebInspector.ProfileView(representedObject, extraArguments);
+        if (representedObject instanceof WI.CallingContextTree)
+            return new WI.ProfileView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.HeapSnapshotProxy || representedObject instanceof WebInspector.HeapSnapshotDiffProxy)
-            return new WebInspector.HeapSnapshotClusterContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.HeapSnapshotProxy || representedObject instanceof WI.HeapSnapshotDiffProxy)
+            return new WI.HeapSnapshotClusterContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.Recording)
-            return new WebInspector.RecordingContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.Recording)
+            return new WI.RecordingContentView(representedObject, extraArguments);
 
-        if (representedObject instanceof WebInspector.Collection)
-            return new WebInspector.CollectionContentView(representedObject, extraArguments);
+        if (representedObject instanceof WI.Collection)
+            return new WI.CollectionContentView(representedObject, extraArguments);
 
         if (typeof representedObject === "string" || representedObject instanceof String)
-            return new WebInspector.TextContentView(representedObject, extraArguments);
+            return new WI.TextContentView(representedObject, extraArguments);
 
-        console.assert(!WebInspector.ContentView.isViewable(representedObject));
+        console.assert(!WI.ContentView.isViewable(representedObject));
 
         throw new Error("Can't make a ContentView for an unknown representedObject of type: " + representedObject.constructor.name);
     }
@@ -178,58 +178,58 @@
 
         // Some represented objects attempt to resolve a better represented object.
         // This may result in null, for example a Breakpoint which doesn't have a SourceCode.
-        let resolvedRepresentedObject = WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);
+        let resolvedRepresentedObject = WI.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);
         if (!resolvedRepresentedObject)
             return null;
 
-        let existingContentView = resolvedRepresentedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol];
-        console.assert(!existingContentView || existingContentView instanceof WebInspector.ContentView);
+        let existingContentView = resolvedRepresentedObject[WI.ContentView.ContentViewForRepresentedObjectSymbol];
+        console.assert(!existingContentView || existingContentView instanceof WI.ContentView);
         if (existingContentView)
             return existingContentView;
 
         if (onlyExisting)
             return null;
 
-        let newContentView = WebInspector.ContentView.createFromRepresentedObject(representedObject, extraArguments);
-        console.assert(newContentView instanceof WebInspector.ContentView);
+        let newContentView = WI.ContentView.createFromRepresentedObject(representedObject, extraArguments);
+        console.assert(newContentView instanceof WI.ContentView);
         if (!newContentView)
             return null;
 
         console.assert(newContentView.representedObject === resolvedRepresentedObject, "createFromRepresentedObject and resolvedRepresentedObjectForRepresentedObject are out of sync for type", representedObject.constructor.name);
-        newContentView.representedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol] = newContentView;
+        newContentView.representedObject[WI.ContentView.ContentViewForRepresentedObjectSymbol] = newContentView;
         return newContentView;
     }
 
     static closedContentViewForRepresentedObject(representedObject)
     {
-        let resolvedRepresentedObject = WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);
-        resolvedRepresentedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol] = null;
+        let resolvedRepresentedObject = WI.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);
+        resolvedRepresentedObject[WI.ContentView.ContentViewForRepresentedObjectSymbol] = null;
     }
 
     static resolvedRepresentedObjectForRepresentedObject(representedObject)
     {
-        if (representedObject instanceof WebInspector.Frame)
+        if (representedObject instanceof WI.Frame)
             return representedObject.mainResource;
 
-        if (representedObject instanceof WebInspector.Breakpoint || representedObject instanceof WebInspector.IssueMessage) {
+        if (representedObject instanceof WI.Breakpoint || representedObject instanceof WI.IssueMessage) {
             if (representedObject.sourceCodeLocation)
                 return representedObject.sourceCodeLocation.displaySourceCode;
         }
 
-        if (representedObject instanceof WebInspector.DOMBreakpoint) {
+        if (representedObject instanceof WI.DOMBreakpoint) {
             if (representedObject.domNode)
-                return WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.domNode);
+                return WI.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.domNode);
         }
 
-        if (representedObject instanceof WebInspector.DOMNode) {
+        if (representedObject instanceof WI.DOMNode) {
             if (representedObject.frame)
-                return WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.frame);
+                return WI.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.frame);
         }
 
-        if (representedObject instanceof WebInspector.DOMSearchMatchObject)
-            return WebInspector.frameResourceManager.mainFrame.domTree;
+        if (representedObject instanceof WI.DOMSearchMatchObject)
+            return WI.frameResourceManager.mainFrame.domTree;
 
-        if (representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
+        if (representedObject instanceof WI.SourceCodeSearchMatchObject)
             return representedObject.sourceCode;
 
         return representedObject;
@@ -237,55 +237,55 @@
 
     static isViewable(representedObject)
     {
-        if (representedObject instanceof WebInspector.Frame)
+        if (representedObject instanceof WI.Frame)
             return true;
-        if (representedObject instanceof WebInspector.Resource)
+        if (representedObject instanceof WI.Resource)
             return true;
-        if (representedObject instanceof WebInspector.Script)
+        if (representedObject instanceof WI.Script)
             return true;
-        if (representedObject instanceof WebInspector.CSSStyleSheet)
+        if (representedObject instanceof WI.CSSStyleSheet)
             return true;
-        if (representedObject instanceof WebInspector.Canvas)
+        if (representedObject instanceof WI.Canvas)
             return true;
-        if (representedObject instanceof WebInspector.TimelineRecording)
+        if (representedObject instanceof WI.TimelineRecording)
             return true;
-        if (representedObject instanceof WebInspector.Timeline)
+        if (representedObject instanceof WI.Timeline)
             return true;
-        if (representedObject instanceof WebInspector.Breakpoint || representedObject instanceof WebInspector.IssueMessage)
+        if (representedObject instanceof WI.Breakpoint || representedObject instanceof WI.IssueMessage)
             return representedObject.sourceCodeLocation;
-        if (representedObject instanceof WebInspector.DOMStorageObject)
+        if (representedObject instanceof WI.DOMStorageObject)
             return true;
-        if (representedObject instanceof WebInspector.CookieStorageObject)
+        if (representedObject instanceof WI.CookieStorageObject)
             return true;
-        if (representedObject instanceof WebInspector.DatabaseTableObject)
+        if (representedObject instanceof WI.DatabaseTableObject)
             return true;
-        if (representedObject instanceof WebInspector.DatabaseObject)
+        if (representedObject instanceof WI.DatabaseObject)
             return true;
-        if (representedObject instanceof WebInspector.IndexedDatabase)
+        if (representedObject instanceof WI.IndexedDatabase)
             return true;
-        if (representedObject instanceof WebInspector.IndexedDatabaseObjectStore)
+        if (representedObject instanceof WI.IndexedDatabaseObjectStore)
             return true;
-        if (representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
+        if (representedObject instanceof WI.IndexedDatabaseObjectStoreIndex)
             return true;
-        if (representedObject instanceof WebInspector.ApplicationCacheFrame)
+        if (representedObject instanceof WI.ApplicationCacheFrame)
             return true;
-        if (representedObject instanceof WebInspector.DOMTree)
+        if (representedObject instanceof WI.DOMTree)
             return true;
-        if (representedObject instanceof WebInspector.DOMSearchMatchObject)
+        if (representedObject instanceof WI.DOMSearchMatchObject)
             return true;
-        if (representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
+        if (representedObject instanceof WI.SourceCodeSearchMatchObject)
             return true;
-        if (representedObject instanceof WebInspector.LogObject)
+        if (representedObject instanceof WI.LogObject)
             return true;
-        if (representedObject instanceof WebInspector.ContentFlow)
+        if (representedObject instanceof WI.ContentFlow)
             return true;
-        if (representedObject instanceof WebInspector.CallingContextTree)
+        if (representedObject instanceof WI.CallingContextTree)
             return true;
-        if (representedObject instanceof WebInspector.HeapSnapshotProxy || representedObject instanceof WebInspector.HeapSnapshotDiffProxy)
+        if (representedObject instanceof WI.HeapSnapshotProxy || representedObject instanceof WI.HeapSnapshotDiffProxy)
             return true;
-        if (representedObject instanceof WebInspector.Recording)
+        if (representedObject instanceof WI.Recording)
             return true;
-        if (representedObject instanceof WebInspector.Collection)
+        if (representedObject instanceof WI.Collection)
             return true;
         if (typeof representedObject === "string" || representedObject instanceof String)
             return true;
@@ -348,7 +348,7 @@
     get supportsSplitContentBrowser()
     {
         // Implemented by subclasses.
-        return WebInspector.dockedConfigurationSupportsSplitContentBrowser();
+        return WI.dockedConfigurationSupportsSplitContentBrowser();
     }
 
     shown()
@@ -459,11 +459,11 @@
     }
 };
 
-WebInspector.ContentView.Event = {
+WI.ContentView.Event = {
     SelectionPathComponentsDidChange: "content-view-selection-path-components-did-change",
     SupplementalRepresentedObjectsDidChange: "content-view-supplemental-represented-objects-did-change",
     NumberOfSearchResultsDidChange: "content-view-number-of-search-results-did-change",
     NavigationItemsDidChange: "content-view-navigation-items-did-change"
 };
 
-WebInspector.ContentView.ContentViewForRepresentedObjectSymbol = Symbol("content-view-for-represented-object");
+WI.ContentView.ContentViewForRepresentedObjectSymbol = Symbol("content-view-for-represented-object");
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js b/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
index 83e1663..25d566e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentViewContainer = class ContentViewContainer extends WebInspector.View
+WI.ContentViewContainer = class ContentViewContainer extends WI.View
 {
     constructor()
     {
@@ -63,7 +63,7 @@
 
     contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments)
     {
-        return WebInspector.ContentView.contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments);
+        return WI.ContentView.contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments);
     }
 
     showContentViewForRepresentedObject(representedObject, extraArguments)
@@ -79,8 +79,8 @@
 
     showContentView(contentView, cookie)
     {
-        console.assert(contentView instanceof WebInspector.ContentView);
-        if (!(contentView instanceof WebInspector.ContentView))
+        console.assert(contentView instanceof WI.ContentView);
+        if (!(contentView instanceof WI.ContentView))
             return null;
 
         // ContentViews can be shared between containers. If this content view is
@@ -103,7 +103,7 @@
         }
 
         if (!provisionalEntry)
-            provisionalEntry = new WebInspector.BackForwardEntry(contentView, cookie);
+            provisionalEntry = new WI.BackForwardEntry(contentView, cookie);
 
         // Don't do anything if we would have added an identical back/forward list entry.
         if (provisionalEntry.isEqual(currentEntry)) {
@@ -163,17 +163,17 @@
         } else
             this._showEntry(currentEntry, false);
 
-        this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
+        this.dispatchEventToListeners(WI.ContentViewContainer.Event.CurrentContentViewDidChange);
     }
 
     replaceContentView(oldContentView, newContentView)
     {
-        console.assert(oldContentView instanceof WebInspector.ContentView);
-        if (!(oldContentView instanceof WebInspector.ContentView))
+        console.assert(oldContentView instanceof WI.ContentView);
+        if (!(oldContentView instanceof WI.ContentView))
             return;
 
-        console.assert(newContentView instanceof WebInspector.ContentView);
-        if (!(newContentView instanceof WebInspector.ContentView))
+        console.assert(newContentView instanceof WI.ContentView);
+        if (!(newContentView instanceof WI.ContentView))
             return;
 
         console.assert(oldContentView.parentContainer === this);
@@ -199,7 +199,7 @@
             if (this._backForwardList[i].contentView === oldContentView) {
                 console.assert(!this._backForwardList[i].tombstone);
                 let currentCookie = this._backForwardList[i].cookie;
-                this._backForwardList[i] = new WebInspector.BackForwardEntry(newContentView, currentCookie);
+                this._backForwardList[i] = new WI.BackForwardEntry(newContentView, currentCookie);
             }
         }
 
@@ -208,7 +208,7 @@
         // Re-show the current entry, because its content view instance was replaced.
         if (currentlyShowing) {
             this._showEntry(this.currentBackForwardEntry, true);
-            this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
+            this.dispatchEventToListeners(WI.ContentViewContainer.Event.CurrentContentViewDidChange);
         }
     }
 
@@ -266,7 +266,7 @@
 
         if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) {
             this._showEntry(currentEntry, true);
-            this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
+            this.dispatchEventToListeners(WI.ContentViewContainer.Event.CurrentContentViewDidChange);
         }
     }
 
@@ -290,7 +290,7 @@
         this._backForwardList = [];
         this._currentIndex = -1;
 
-        this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
+        this.dispatchEventToListeners(WI.ContentViewContainer.Event.CurrentContentViewDidChange);
     }
 
     canGoBack()
@@ -351,7 +351,7 @@
         this._clearTombstonesForContentView(contentView);
 
         // These contentView navigation items need to move to the new content browser.
-        contentView.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        contentView.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     _placeTombstonesForContentView(contentView)
@@ -427,12 +427,12 @@
         contentView.closed();
 
         if (contentView.representedObject)
-            WebInspector.ContentView.closedContentViewForRepresentedObject(contentView.representedObject);
+            WI.ContentView.closedContentViewForRepresentedObject(contentView.representedObject);
     }
 
     _showEntry(entry, shouldCallShown)
     {
-        console.assert(entry instanceof WebInspector.BackForwardEntry);
+        console.assert(entry instanceof WI.BackForwardEntry);
 
         // We may be showing a tombstone from a BackForward list or when re-showing a container
         // that had previously had the content view transferred away from it.
@@ -450,7 +450,7 @@
 
     _hideEntry(entry)
     {
-        console.assert(entry instanceof WebInspector.BackForwardEntry);
+        console.assert(entry instanceof WI.BackForwardEntry);
 
         // If this was a tombstone, the content view should already have been
         // hidden when we placed the tombstone.
@@ -464,9 +464,9 @@
 
     _tombstoneContentViewContainersForContentView(contentView)
     {
-        let tombstoneContentViewContainers = contentView[WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol];
+        let tombstoneContentViewContainers = contentView[WI.ContentViewContainer.TombstoneContentViewContainersSymbol];
         if (!tombstoneContentViewContainers)
-            tombstoneContentViewContainers = contentView[WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol] = [];
+            tombstoneContentViewContainers = contentView[WI.ContentViewContainer.TombstoneContentViewContainersSymbol] = [];
         return tombstoneContentViewContainers;
     }
 
@@ -494,8 +494,8 @@
     }
 };
 
-WebInspector.ContentViewContainer.Event = {
+WI.ContentViewContainer.Event = {
     CurrentContentViewDidChange: "content-view-container-current-content-view-did-change"
 };
 
-WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol = Symbol("content-view-container-tombstone-content-view-containers");
+WI.ContentViewContainer.TombstoneContentViewContainersSymbol = Symbol("content-view-container-tombstone-content-view-containers");
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContextMenu.js b/Source/WebInspectorUI/UserInterface/Views/ContextMenu.js
index e62e8f9..a08adde 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContextMenu.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContextMenu.js
@@ -29,7 +29,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContextMenuItem = class ContextMenuItem extends WebInspector.Object
+WI.ContextMenuItem = class ContextMenuItem extends WI.Object
 {
     constructor(topLevelMenu, type, label, disabled, checked)
     {
@@ -82,7 +82,7 @@
     }
 };
 
-WebInspector.ContextSubMenuItem = class ContextSubMenuItem extends WebInspector.ContextMenuItem
+WI.ContextSubMenuItem = class ContextSubMenuItem extends WI.ContextMenuItem
 {
     constructor(topLevelMenu, label, disabled)
     {
@@ -95,7 +95,7 @@
 
     appendItem(label, handler, disabled)
     {
-        let item = new WebInspector.ContextMenuItem(this._contextMenu, "item", label, disabled);
+        let item = new WI.ContextMenuItem(this._contextMenu, "item", label, disabled);
         this._pushItem(item);
         this._contextMenu._setHandler(item.id(), handler);
         return item;
@@ -103,14 +103,14 @@
 
     appendSubMenuItem(label, disabled)
     {
-        let item = new WebInspector.ContextSubMenuItem(this._contextMenu, label, disabled);
+        let item = new WI.ContextSubMenuItem(this._contextMenu, label, disabled);
         this._pushItem(item);
         return item;
     }
 
     appendCheckboxItem(label, handler, checked, disabled)
     {
-        let item = new WebInspector.ContextMenuItem(this._contextMenu, "checkbox", label, disabled, checked);
+        let item = new WI.ContextMenuItem(this._contextMenu, "checkbox", label, disabled, checked);
         this._pushItem(item);
         this._contextMenu._setHandler(item.id(), handler);
         return item;
@@ -125,7 +125,7 @@
     _pushItem(item)
     {
         if (this._pendingSeparator) {
-            this._items.push(new WebInspector.ContextMenuItem(this._contextMenu, "separator"));
+            this._items.push(new WI.ContextMenuItem(this._contextMenu, "separator"));
             this._pendingSeparator = null;
         }
         this._items.push(item);
@@ -143,7 +143,7 @@
     }
 };
 
-WebInspector.ContextMenu = class ContextMenu extends WebInspector.ContextSubMenuItem
+WI.ContextMenu = class ContextMenu extends WI.ContextSubMenuItem
 {
     constructor(event)
     {
@@ -158,22 +158,22 @@
 
     static createFromEvent(event, onlyExisting = false)
     {
-        if (!event[WebInspector.ContextMenu.ProposedMenuSymbol] && !onlyExisting)
-            event[WebInspector.ContextMenu.ProposedMenuSymbol] = new WebInspector.ContextMenu(event);
+        if (!event[WI.ContextMenu.ProposedMenuSymbol] && !onlyExisting)
+            event[WI.ContextMenu.ProposedMenuSymbol] = new WI.ContextMenu(event);
 
-        return event[WebInspector.ContextMenu.ProposedMenuSymbol] || null;
+        return event[WI.ContextMenu.ProposedMenuSymbol] || null;
     }
 
     static contextMenuItemSelected(id)
     {
-        if (WebInspector.ContextMenu._lastContextMenu)
-            WebInspector.ContextMenu._lastContextMenu._itemSelected(id);
+        if (WI.ContextMenu._lastContextMenu)
+            WI.ContextMenu._lastContextMenu._itemSelected(id);
     }
 
     static contextMenuCleared()
     {
         // FIXME: Unfortunately, contextMenuCleared is invoked between show and item selected
-        // so we can't delete last menu object from WebInspector. Fix the contract.
+        // so we can't delete last menu object from WI. Fix the contract.
     }
 
     // Public
@@ -189,7 +189,7 @@
 
         let menuObject = this._buildDescriptor();
         if (menuObject.length) {
-            WebInspector.ContextMenu._lastContextMenu = this;
+            WI.ContextMenu._lastContextMenu = this;
 
             if (this._event.type !== "contextmenu" && typeof InspectorFrontendHost.dispatchEventAsContextMenuEvent === "function") {
                 this._menuObject = menuObject;
@@ -234,4 +234,4 @@
     }
 };
 
-WebInspector.ContextMenu.ProposedMenuSymbol = Symbol("context-menu-proposed-menu");
+WI.ContextMenu.ProposedMenuSymbol = Symbol("context-menu-proposed-menu");
diff --git a/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js b/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
index 9937c13..bdfd641 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
@@ -23,58 +23,58 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.appendContextMenuItemsForSourceCode = function(contextMenu, sourceCodeOrLocation)
+WI.appendContextMenuItemsForSourceCode = function(contextMenu, sourceCodeOrLocation)
 {
-    console.assert(contextMenu instanceof WebInspector.ContextMenu);
-    if (!(contextMenu instanceof WebInspector.ContextMenu))
+    console.assert(contextMenu instanceof WI.ContextMenu);
+    if (!(contextMenu instanceof WI.ContextMenu))
         return;
 
     let sourceCode = sourceCodeOrLocation;
     let location = null;
-    if (sourceCodeOrLocation instanceof WebInspector.SourceCodeLocation) {
+    if (sourceCodeOrLocation instanceof WI.SourceCodeLocation) {
         sourceCode = sourceCodeOrLocation.sourceCode;
         location = sourceCodeOrLocation;
     }
 
-    console.assert(sourceCode instanceof WebInspector.SourceCode);
-    if (!(sourceCode instanceof WebInspector.SourceCode))
+    console.assert(sourceCode instanceof WI.SourceCode);
+    if (!(sourceCode instanceof WI.SourceCode))
         return;
 
     contextMenu.appendSeparator();
 
     if (sourceCode.url) {
-        contextMenu.appendItem(WebInspector.UIString("Open in New Tab"), () => {
+        contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
             const frame = null;
-            WebInspector.openURL(sourceCode.url, frame, {alwaysOpenExternally: true});
+            WI.openURL(sourceCode.url, frame, {alwaysOpenExternally: true});
         });
 
-        if (WebInspector.frameResourceManager.resourceForURL(sourceCode.url) && !WebInspector.isShowingResourcesTab()) {
-            contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"), () => {
+        if (WI.frameResourceManager.resourceForURL(sourceCode.url) && !WI.isShowingResourcesTab()) {
+            contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
                 const options = {ignoreNetworkTab: true};
                 if (location)
-                    WebInspector.showSourceCodeLocation(location, options);
+                    WI.showSourceCodeLocation(location, options);
                 else
-                    WebInspector.showSourceCode(sourceCode, options);
+                    WI.showSourceCode(sourceCode, options);
             });
         }
 
-        contextMenu.appendItem(WebInspector.UIString("Copy Link Address"), () => {
+        contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
             InspectorFrontendHost.copyText(sourceCode.url);
         });
     }
 
-    if (sourceCode instanceof WebInspector.Resource) {
+    if (sourceCode instanceof WI.Resource) {
         if (sourceCode.urlComponents.scheme !== "data") {
-            contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), () => {
+            contextMenu.appendItem(WI.UIString("Copy as cURL"), () => {
                 sourceCode.generateCURLCommand();
             });
         }
     }
 
-    contextMenu.appendItem(WebInspector.UIString("Save File"), () => {
+    contextMenu.appendItem(WI.UIString("Save File"), () => {
         sourceCode.requestContent().then(() => {
             const forceSaveAs = true;
-            WebInspector.saveDataToFile({
+            WI.saveDataToFile({
                 url: sourceCode.url || "",
                 content: sourceCode.content
             }, forceSaveAs);
@@ -83,15 +83,15 @@
 
     contextMenu.appendSeparator();
 
-    if (location && (sourceCode instanceof WebInspector.Script || (sourceCode instanceof WebInspector.Resource && sourceCode.type === WebInspector.Resource.Type.Script))) {
-        let existingBreakpoint = WebInspector.debuggerManager.breakpointForSourceCodeLocation(location);
+    if (location && (sourceCode instanceof WI.Script || (sourceCode instanceof WI.Resource && sourceCode.type === WI.Resource.Type.Script))) {
+        let existingBreakpoint = WI.debuggerManager.breakpointForSourceCodeLocation(location);
         if (existingBreakpoint) {
-            contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"), () => {
-                WebInspector.debuggerManager.removeBreakpoint(existingBreakpoint);
+            contextMenu.appendItem(WI.UIString("Delete Breakpoint"), () => {
+                WI.debuggerManager.removeBreakpoint(existingBreakpoint);
             });
         } else {
-            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), () => {
-                WebInspector.debuggerManager.addBreakpoint(new WebInspector.Breakpoint(location));
+            contextMenu.appendItem(WI.UIString("Add Breakpoint"), () => {
+                WI.debuggerManager.addBreakpoint(new WI.Breakpoint(location));
             });
         }
 
@@ -99,19 +99,19 @@
     }
 };
 
-WebInspector.appendContextMenuItemsForDOMNode = function(contextMenu, domNode, options = {})
+WI.appendContextMenuItemsForDOMNode = function(contextMenu, domNode, options = {})
 {
-    console.assert(contextMenu instanceof WebInspector.ContextMenu);
-    if (!(contextMenu instanceof WebInspector.ContextMenu))
+    console.assert(contextMenu instanceof WI.ContextMenu);
+    if (!(contextMenu instanceof WI.ContextMenu))
         return;
 
-    console.assert(domNode instanceof WebInspector.DOMNode);
-    if (!(domNode instanceof WebInspector.DOMNode))
+    console.assert(domNode instanceof WI.DOMNode);
+    if (!(domNode instanceof WI.DOMNode))
         return;
 
     let isElement = domNode.nodeType() === Node.ELEMENT_NODE;
     if (isElement) {
-        contextMenu.appendItem(WebInspector.UIString("Scroll Into View"), () => {
+        contextMenu.appendItem(WI.UIString("Scroll Into View"), () => {
             domNode.scrollIntoView();
         });
     }
@@ -119,33 +119,33 @@
     contextMenu.appendSeparator();
 
     if (domNode.ownerDocument && isElement) {
-        contextMenu.appendItem(WebInspector.UIString("Copy Selector Path"), () => {
-            let cssPath = WebInspector.cssPath(domNode);
+        contextMenu.appendItem(WI.UIString("Copy Selector Path"), () => {
+            let cssPath = WI.cssPath(domNode);
             InspectorFrontendHost.copyText(cssPath);
         });
     }
 
     if (domNode.ownerDocument && !domNode.isPseudoElement()) {
-        contextMenu.appendItem(WebInspector.UIString("Copy XPath"), () => {
-            let xpath = WebInspector.xpath(domNode);
+        contextMenu.appendItem(WI.UIString("Copy XPath"), () => {
+            let xpath = WI.xpath(domNode);
             InspectorFrontendHost.copyText(xpath);
         });
     }
 
     if (domNode.isCustomElement()) {
         contextMenu.appendSeparator();
-        contextMenu.appendItem(WebInspector.UIString("Jump to Definition"), () => {
+        contextMenu.appendItem(WI.UIString("Jump to Definition"), () => {
             function didGetFunctionDetails(error, response) {
                 if (error)
                     return;
 
                 let location = response.location;
-                let sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId, WebInspector.mainTarget);
+                let sourceCode = WI.debuggerManager.scriptForIdentifier(location.scriptId, WI.mainTarget);
                 if (!sourceCode)
                     return;
 
                 let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0);
-                WebInspector.showSourceCodeLocation(sourceCodeLocation, {
+                WI.showSourceCodeLocation(sourceCodeLocation, {
                     ignoreNetworkTab: true,
                     ignoreSearchTab: true,
                 });
@@ -167,50 +167,50 @@
                 remoteObject.release();
             }
 
-            WebInspector.RemoteObject.resolveNode(domNode, "", didResolveNode);
+            WI.RemoteObject.resolveNode(domNode, "", didResolveNode);
         });
     }
 
-    if (WebInspector.domDebuggerManager.supported && isElement && !domNode.isPseudoElement() && domNode.ownerDocument) {
+    if (WI.domDebuggerManager.supported && isElement && !domNode.isPseudoElement() && domNode.ownerDocument) {
         contextMenu.appendSeparator();
 
         const allowEditing = false;
-        WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu, domNode, allowEditing);
+        WI.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu, domNode, allowEditing);
     }
 
     contextMenu.appendSeparator();
 
     if (!options.excludeRevealElement && domNode.ownerDocument) {
-        contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"), () => {
-            WebInspector.domTreeManager.inspectElement(domNode.id);
+        contextMenu.appendItem(WI.UIString("Reveal in DOM Tree"), () => {
+            WI.domTreeManager.inspectElement(domNode.id);
         });
     }
 
     if (!options.excludeLogElement && !domNode.isInUserAgentShadowTree() && !domNode.isPseudoElement()) {
-        let label = isElement ? WebInspector.UIString("Log Element") : WebInspector.UIString("Log Node");
+        let label = isElement ? WI.UIString("Log Element") : WI.UIString("Log Node");
         contextMenu.appendItem(label, () => {
-            WebInspector.RemoteObject.resolveNode(domNode, WebInspector.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
+            WI.RemoteObject.resolveNode(domNode, WI.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
                 if (!remoteObject)
                     return;
 
-                let text = isElement ? WebInspector.UIString("Selected Element") : WebInspector.UIString("Selected Node");
+                let text = isElement ? WI.UIString("Selected Element") : WI.UIString("Selected Node");
                 const addSpecialUserLogClass = true;
-                WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
+                WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
             });
         });
     }
 
     if (window.PageAgent) {
-        contextMenu.appendItem(WebInspector.UIString("Capture Element Screenshot"), () => {
+        contextMenu.appendItem(WI.UIString("Capture Element Screenshot"), () => {
             PageAgent.snapshotNode(domNode.id, (error, dataURL) => {
                 if (error) {
-                    const target = WebInspector.mainTarget;
-                    const source = WebInspector.ConsoleMessage.MessageSource.Other;
-                    const level = WebInspector.ConsoleMessage.MessageLevel.Error;
-                    let consoleMessage = new WebInspector.ConsoleMessage(target, source, level, error);
+                    const target = WI.mainTarget;
+                    const source = WI.ConsoleMessage.MessageSource.Other;
+                    const level = WI.ConsoleMessage.MessageLevel.Error;
+                    let consoleMessage = new WI.ConsoleMessage(target, source, level, error);
                     consoleMessage.shouldRevealConsole = true;
 
-                    WebInspector.consoleLogViewController.appendConsoleMessage(consoleMessage);
+                    WI.consoleLogViewController.appendConsoleMessage(consoleMessage);
                     return;
                 }
 
@@ -223,8 +223,8 @@
                     Number.zeroPad(date.getMinutes(), 2),
                     Number.zeroPad(date.getSeconds(), 2),
                 ];
-                let filename = WebInspector.UIString("Screen Shot %s-%s-%s at %s.%s.%s").format(...values);
-                WebInspector.saveDataToFile({
+                let filename = WI.UIString("Screen Shot %s-%s-%s at %s.%s.%s").format(...values);
+                WI.saveDataToFile({
                     url: encodeURI(`web-inspector:///${filename}.png`),
                     content: parseDataURL(dataURL).data,
                     base64Encoded: true,
diff --git a/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js b/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js
index 565d9d3..3c428c8 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ControlToolbarItem = class ControlToolbarItem extends WebInspector.ButtonNavigationItem
+WI.ControlToolbarItem = class ControlToolbarItem extends WI.ButtonNavigationItem
 {
     constructor(identifier, toolTip, image, imageWidth, imageHeight)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
index 658add8..d7310f2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CookieStorageContentView = class CookieStorageContentView extends WebInspector.ContentView
+WI.CookieStorageContentView = class CookieStorageContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -31,8 +31,8 @@
 
         this.element.classList.add("cookie-storage");
 
-        this._refreshButtonNavigationItem = new WebInspector.ButtonNavigationItem("cookie-storage-refresh", WebInspector.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
-        this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
+        this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("cookie-storage-refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
+        this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
 
         this.update();
     }
@@ -56,7 +56,7 @@
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.CookieStorage;
+        cookie.type = WI.ContentViewCookieType.CookieStorage;
         cookie.host = this.representedObject.host;
     }
 
@@ -75,46 +75,46 @@
         if (!this._dataGrid) {
             var columns = {name: {}, value: {}, domain: {}, path: {}, expires: {}, size: {}, http: {}, secure: {}};
 
-            columns.name.title = WebInspector.UIString("Name");
+            columns.name.title = WI.UIString("Name");
             columns.name.sortable = true;
             columns.name.width = "24%";
             columns.name.locked = true;
 
-            columns.value.title = WebInspector.UIString("Value");
+            columns.value.title = WI.UIString("Value");
             columns.value.sortable = true;
             columns.value.width = "34%";
             columns.value.locked = true;
 
-            columns.domain.title = WebInspector.UIString("Domain");
+            columns.domain.title = WI.UIString("Domain");
             columns.domain.sortable = true;
             columns.domain.width = "7%";
 
-            columns.path.title = WebInspector.UIString("Path");
+            columns.path.title = WI.UIString("Path");
             columns.path.sortable = true;
             columns.path.width = "7%";
 
-            columns.expires.title = WebInspector.UIString("Expires");
+            columns.expires.title = WI.UIString("Expires");
             columns.expires.sortable = true;
             columns.expires.width = "7%";
 
-            columns.size.title = WebInspector.UIString("Size");
+            columns.size.title = WI.UIString("Size");
             columns.size.aligned = "right";
             columns.size.sortable = true;
             columns.size.width = "7%";
 
-            columns.http.title = WebInspector.UIString("HTTP");
+            columns.http.title = WI.UIString("HTTP");
             columns.http.aligned = "centered";
             columns.http.sortable = true;
             columns.http.width = "7%";
 
-            columns.secure.title = WebInspector.UIString("Secure");
+            columns.secure.title = WI.UIString("Secure");
             columns.secure.aligned = "centered";
             columns.secure.sortable = true;
             columns.secure.width = "7%";
 
-            this._dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCallback.bind(this));
+            this._dataGrid = new WI.DataGrid(columns, null, this._deleteCallback.bind(this));
             this._dataGrid.columnChooserEnabled = true;
-            this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
+            this._dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
             this.addSubview(this._dataGrid);
             this._dataGrid.updateLayout();
@@ -136,10 +136,10 @@
                 "secure": cookie.secure ? checkmark : "",
             };
 
-            if (cookie.type !== WebInspector.CookieType.Request)
-                data["expires"] = cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toLocaleString();
+            if (cookie.type !== WI.CookieType.Request)
+                data["expires"] = cookie.session ? WI.UIString("Session") : new Date(cookie.expires).toLocaleString();
 
-            var node = new WebInspector.DataGridNode(data);
+            var node = new WI.DataGridNode(data);
             node.cookie = cookie;
 
             this._dataGrid.appendChild(node);
@@ -157,7 +157,7 @@
         };
 
         let allResources = [];
-        for (let frame of WebInspector.frameResourceManager.frames) {
+        for (let frame of WI.frameResourceManager.frames) {
             // The main resource isn't in the list of resources, so add it as a candidate.
             allResources.push(frame.mainResource);
             allResources = allResources.concat(frame.resourceCollection.toArray());
@@ -167,7 +167,7 @@
 
         let cookiesForDomain = cookies.filter((cookie) => {
             return resourcesForDomain.some((resource) => {
-                return WebInspector.CookieStorageObject.cookieMatchesResourceURL(cookie, resource.url);
+                return WI.CookieStorageObject.cookieMatchesResourceURL(cookie, resource.url);
             });
         });
         return cookiesForDomain;
@@ -231,7 +231,7 @@
     }
 };
 
-WebInspector.CookieType = {
+WI.CookieType = {
     Request: 0,
     Response: 1
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/CookieStorageTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/CookieStorageTreeElement.js
index 4cc4f00..784e1bb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/CookieStorageTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/CookieStorageTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CookieStorageTreeElement = class CookieStorageTreeElement extends WebInspector.StorageTreeElement
+WI.CookieStorageTreeElement = class CookieStorageTreeElement extends WI.StorageTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.CookieStorageObject);
+        console.assert(representedObject instanceof WI.CookieStorageObject);
 
-        super("cookie-icon", WebInspector.displayNameForHost(representedObject.host), representedObject);
+        super("cookie-icon", WI.displayNameForHost(representedObject.host), representedObject);
     }
 
     // Public
@@ -41,6 +41,6 @@
 
     get categoryName()
     {
-        return WebInspector.UIString("Cookies");
+        return WI.UIString("Cookies");
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js
index a28dc76..926b139 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMBreakpointTreeElement = class DOMBreakpointTreeElement extends WebInspector.GeneralTreeElement
+WI.DOMBreakpointTreeElement = class DOMBreakpointTreeElement extends WI.GeneralTreeElement
 {
     constructor(breakpoint, className, title)
     {
-        console.assert(breakpoint instanceof WebInspector.DOMBreakpoint);
+        console.assert(breakpoint instanceof WI.DOMBreakpoint);
 
         if (!className)
-            className = WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;
+            className = WI.BreakpointTreeElement.GenericLineIconStyleClassName;
 
         if (!title)
-            title = WebInspector.DOMBreakpointTreeElement.displayNameForType(breakpoint.type);
+            title = WI.DOMBreakpointTreeElement.displayNameForType(breakpoint.type);
 
         super(["breakpoint", className], title, null, breakpoint);
 
@@ -41,7 +41,7 @@
         this._statusImageElement.classList.add("status-image", "resolved");
         this.status = this._statusImageElement;
 
-        breakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this);
+        breakpoint.addEventListener(WI.DOMBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this);
 
         this._updateStatus();
     }
@@ -51,12 +51,12 @@
     static displayNameForType(type)
     {
         switch (type) {
-        case WebInspector.DOMBreakpoint.Type.SubtreeModified:
-            return WebInspector.UIString("Subtree Modified");
-        case WebInspector.DOMBreakpoint.Type.AttributeModified:
-            return WebInspector.UIString("Attribute Modified");
-        case WebInspector.DOMBreakpoint.Type.NodeRemoved:
-            return WebInspector.UIString("Node Removed");
+        case WI.DOMBreakpoint.Type.SubtreeModified:
+            return WI.UIString("Subtree Modified");
+        case WI.DOMBreakpoint.Type.AttributeModified:
+            return WI.UIString("Attribute Modified");
+        case WI.DOMBreakpoint.Type.NodeRemoved:
+            return WI.UIString("Node Removed");
         default:
             console.error("Unexpected DOM breakpoint type: " + type);
             return null;
@@ -93,7 +93,7 @@
 
     ondelete()
     {
-        WebInspector.domDebuggerManager.removeDOMBreakpoint(this.representedObject);
+        WI.domDebuggerManager.removeDOMBreakpoint(this.representedObject);
         return true;
     }
 
@@ -112,12 +112,12 @@
     populateContextMenu(contextMenu, event)
     {
         let breakpoint = this.representedObject;
-        let label = breakpoint.disabled ? WebInspector.UIString("Enable Breakpoint") : WebInspector.UIString("Disable Breakpoint");
+        let label = breakpoint.disabled ? WI.UIString("Enable Breakpoint") : WI.UIString("Disable Breakpoint");
         contextMenu.appendItem(label, this._toggleBreakpoint.bind(this));
 
         contextMenu.appendSeparator();
-        contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"), function() {
-            WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);
+        contextMenu.appendItem(WI.UIString("Delete Breakpoint"), function() {
+            WI.domDebuggerManager.removeDOMBreakpoint(breakpoint);
         });
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js
index f0afbf5..8df14b5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMDetailsSidebarPanel = class DOMDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.DOMDetailsSidebarPanel = class DOMDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor(identifier, displayName, dontCreateNavigationItem)
     {
@@ -44,9 +44,9 @@
 
         var nodeToInspect = null;
 
-        // Iterate over the objects to find a WebInspector.DOMNode to inspect.
+        // Iterate over the objects to find a WI.DOMNode to inspect.
         for (var i = 0; i < objects.length; ++i) {
-            if (objects[i] instanceof WebInspector.DOMNode) {
+            if (objects[i] instanceof WI.DOMNode) {
                 nodeToInspect = objects[i];
                 break;
             }
@@ -102,7 +102,7 @@
     _mouseWasClicked(event)
     {
         if (this._domNode && this._domNode.ownerDocument) {
-            var mainResource = WebInspector.frameResourceManager.resourceForURL(this._domNode.ownerDocument.documentURL);
+            var mainResource = WI.frameResourceManager.resourceForURL(this._domNode.ownerDocument.documentURL);
             if (mainResource)
                 var parentFrame = mainResource.parentFrame;
         }
@@ -111,6 +111,6 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        WebInspector.handlePossibleLinkClick(event, parentFrame, options);
+        WI.handlePossibleLinkClick(event, parentFrame, options);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
index 17c22b2..6e3b90cc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel
+WI.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel extends WI.DOMDetailsSidebarPanel
 {
     constructor()
     {
-        super("dom-node-details", WebInspector.UIString("Node"));
+        super("dom-node-details", WI.UIString("Node"));
 
-        this._eventListenerGroupingMethodSetting = new WebInspector.Setting("dom-node-event-listener-grouping-method", WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);
+        this._eventListenerGroupingMethodSetting = new WI.Setting("dom-node-event-listener-grouping-method", WI.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);
 
         this.element.classList.add("dom-node");
 
@@ -42,30 +42,30 @@
     {
         super.initialLayout();
 
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified, this._attributesChanged, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved, this._attributesChanged, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified, this._characterDataModified, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CustomElementStateChanged, this._customElementStateChanged, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.AttributeModified, this._attributesChanged, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.AttributeRemoved, this._attributesChanged, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.CharacterDataModified, this._characterDataModified, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.CustomElementStateChanged, this._customElementStateChanged, this);
 
-        this._identityNodeTypeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"));
-        this._identityNodeNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));
-        this._identityNodeValueRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Value"));
-        this._identityNodeContentSecurityPolicyHashRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("CSP Hash"));
+        this._identityNodeTypeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Type"));
+        this._identityNodeNameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Name"));
+        this._identityNodeValueRow = new WI.DetailsSectionSimpleRow(WI.UIString("Value"));
+        this._identityNodeContentSecurityPolicyHashRow = new WI.DetailsSectionSimpleRow(WI.UIString("CSP Hash"));
 
-        var identityGroup = new WebInspector.DetailsSectionGroup([this._identityNodeTypeRow, this._identityNodeNameRow, this._identityNodeValueRow, this._identityNodeContentSecurityPolicyHashRow]);
-        var identitySection = new WebInspector.DetailsSection("dom-node-identity", WebInspector.UIString("Identity"), [identityGroup]);
+        var identityGroup = new WI.DetailsSectionGroup([this._identityNodeTypeRow, this._identityNodeNameRow, this._identityNodeValueRow, this._identityNodeContentSecurityPolicyHashRow]);
+        var identitySection = new WI.DetailsSection("dom-node-identity", WI.UIString("Identity"), [identityGroup]);
 
-        this._attributesDataGridRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Attributes"));
+        this._attributesDataGridRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Attributes"));
 
-        var attributesGroup = new WebInspector.DetailsSectionGroup([this._attributesDataGridRow]);
-        var attributesSection = new WebInspector.DetailsSection("dom-node-attributes", WebInspector.UIString("Attributes"), [attributesGroup]);
+        var attributesGroup = new WI.DetailsSectionGroup([this._attributesDataGridRow]);
+        var attributesSection = new WI.DetailsSection("dom-node-attributes", WI.UIString("Attributes"), [attributesGroup]);
 
-        this._propertiesRow = new WebInspector.DetailsSectionRow;
+        this._propertiesRow = new WI.DetailsSectionRow;
 
-        var propertiesGroup = new WebInspector.DetailsSectionGroup([this._propertiesRow]);
-        var propertiesSection = new WebInspector.DetailsSection("dom-node-properties", WebInspector.UIString("Properties"), [propertiesGroup]);
+        var propertiesGroup = new WI.DetailsSectionGroup([this._propertiesRow]);
+        var propertiesSection = new WI.DetailsSection("dom-node-properties", WI.UIString("Properties"), [propertiesGroup]);
 
-        let eventListenersFilterElement = useSVGSymbol("Images/FilterFieldGlyph.svg", "filter", WebInspector.UIString("Grouping Method"));
+        let eventListenersFilterElement = useSVGSymbol("Images/FilterFieldGlyph.svg", "filter", WI.UIString("Grouping Method"));
 
         let eventListenersGroupMethodSelectElement = eventListenersFilterElement.appendChild(document.createElement("select"));
         eventListenersGroupMethodSelectElement.addEventListener("change", (event) => {
@@ -80,13 +80,13 @@
             optionElement.textContent = text;
         }
 
-        createOption(WebInspector.UIString("Group by Event"), WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);
-        createOption(WebInspector.UIString("Group by Node"), WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node);
+        createOption(WI.UIString("Group by Event"), WI.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);
+        createOption(WI.UIString("Group by Node"), WI.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node);
 
         eventListenersGroupMethodSelectElement.value = this._eventListenerGroupingMethodSetting.value;
 
-        this._eventListenersSectionGroup = new WebInspector.DetailsSectionGroup;
-        let eventListenersSection = new WebInspector.DetailsSection("dom-node-event-listeners", WebInspector.UIString("Event Listeners"), [this._eventListenersSectionGroup], eventListenersFilterElement);
+        this._eventListenersSectionGroup = new WI.DetailsSectionGroup;
+        let eventListenersSection = new WI.DetailsSection("dom-node-event-listeners", WI.UIString("Event Listeners"), [this._eventListenersSectionGroup], eventListenersFilterElement);
 
         this.contentView.element.appendChild(identitySection.element);
         this.contentView.element.appendChild(attributesSection.element);
@@ -94,35 +94,35 @@
         this.contentView.element.appendChild(eventListenersSection.element);
 
         if (this._accessibilitySupported()) {
-            this._accessibilityEmptyRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Accessibility Information"));
-            this._accessibilityNodeActiveDescendantRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Shared Focus"));
-            this._accessibilityNodeBusyRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Busy"));
-            this._accessibilityNodeCheckedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Checked"));
-            this._accessibilityNodeChildrenRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Children"));
-            this._accessibilityNodeControlsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Controls"));
-            this._accessibilityNodeCurrentRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Current"));
-            this._accessibilityNodeDisabledRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Disabled"));
-            this._accessibilityNodeExpandedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Expanded"));
-            this._accessibilityNodeFlowsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Flows"));
-            this._accessibilityNodeFocusedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Focused"));
-            this._accessibilityNodeHeadingLevelRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Heading Level"));
-            this._accessibilityNodehierarchyLevelRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Hierarchy Level"));
-            this._accessibilityNodeIgnoredRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Ignored"));
-            this._accessibilityNodeInvalidRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Invalid"));
-            this._accessibilityNodeLiveRegionStatusRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Live"));
-            this._accessibilityNodeMouseEventRow = new WebInspector.DetailsSectionSimpleRow("");
-            this._accessibilityNodeLabelRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Label"));
-            this._accessibilityNodeOwnsRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Owns"));
-            this._accessibilityNodeParentRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Parent"));
-            this._accessibilityNodePressedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Pressed"));
-            this._accessibilityNodeReadonlyRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Readonly"));
-            this._accessibilityNodeRequiredRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Required"));
-            this._accessibilityNodeRoleRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Role"));
-            this._accessibilityNodeSelectedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected"));
-            this._accessibilityNodeSelectedChildrenRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected Items"));
+            this._accessibilityEmptyRow = new WI.DetailsSectionRow(WI.UIString("No Accessibility Information"));
+            this._accessibilityNodeActiveDescendantRow = new WI.DetailsSectionSimpleRow(WI.UIString("Shared Focus"));
+            this._accessibilityNodeBusyRow = new WI.DetailsSectionSimpleRow(WI.UIString("Busy"));
+            this._accessibilityNodeCheckedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Checked"));
+            this._accessibilityNodeChildrenRow = new WI.DetailsSectionSimpleRow(WI.UIString("Children"));
+            this._accessibilityNodeControlsRow = new WI.DetailsSectionSimpleRow(WI.UIString("Controls"));
+            this._accessibilityNodeCurrentRow = new WI.DetailsSectionSimpleRow(WI.UIString("Current"));
+            this._accessibilityNodeDisabledRow = new WI.DetailsSectionSimpleRow(WI.UIString("Disabled"));
+            this._accessibilityNodeExpandedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Expanded"));
+            this._accessibilityNodeFlowsRow = new WI.DetailsSectionSimpleRow(WI.UIString("Flows"));
+            this._accessibilityNodeFocusedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Focused"));
+            this._accessibilityNodeHeadingLevelRow = new WI.DetailsSectionSimpleRow(WI.UIString("Heading Level"));
+            this._accessibilityNodehierarchyLevelRow = new WI.DetailsSectionSimpleRow(WI.UIString("Hierarchy Level"));
+            this._accessibilityNodeIgnoredRow = new WI.DetailsSectionSimpleRow(WI.UIString("Ignored"));
+            this._accessibilityNodeInvalidRow = new WI.DetailsSectionSimpleRow(WI.UIString("Invalid"));
+            this._accessibilityNodeLiveRegionStatusRow = new WI.DetailsSectionSimpleRow(WI.UIString("Live"));
+            this._accessibilityNodeMouseEventRow = new WI.DetailsSectionSimpleRow("");
+            this._accessibilityNodeLabelRow = new WI.DetailsSectionSimpleRow(WI.UIString("Label"));
+            this._accessibilityNodeOwnsRow = new WI.DetailsSectionSimpleRow(WI.UIString("Owns"));
+            this._accessibilityNodeParentRow = new WI.DetailsSectionSimpleRow(WI.UIString("Parent"));
+            this._accessibilityNodePressedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Pressed"));
+            this._accessibilityNodeReadonlyRow = new WI.DetailsSectionSimpleRow(WI.UIString("Readonly"));
+            this._accessibilityNodeRequiredRow = new WI.DetailsSectionSimpleRow(WI.UIString("Required"));
+            this._accessibilityNodeRoleRow = new WI.DetailsSectionSimpleRow(WI.UIString("Role"));
+            this._accessibilityNodeSelectedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Selected"));
+            this._accessibilityNodeSelectedChildrenRow = new WI.DetailsSectionSimpleRow(WI.UIString("Selected Items"));
 
-            this._accessibilityGroup = new WebInspector.DetailsSectionGroup([this._accessibilityEmptyRow]);
-            var accessibilitySection = new WebInspector.DetailsSection("dom-node-accessibility", WebInspector.UIString("Accessibility"), [this._accessibilityGroup]);
+            this._accessibilityGroup = new WI.DetailsSectionGroup([this._accessibilityEmptyRow]);
+            var accessibilitySection = new WI.DetailsSection("dom-node-accessibility", WI.UIString("Accessibility"), [this._accessibilityGroup]);
 
             this.contentView.element.appendChild(accessibilitySection.element);
         }
@@ -178,10 +178,10 @@
         let dataGrid = this._attributesDataGridRow.dataGrid;
         if (!dataGrid) {
             const columns = {
-                name: {title: WebInspector.UIString("Name"), width: "30%"},
-                value: {title: WebInspector.UIString("Value")},
+                name: {title: WI.UIString("Name"), width: "30%"},
+                value: {title: WI.UIString("Value")},
             };
-            dataGrid = this._attributesDataGridRow.dataGrid = new WebInspector.DataGrid(columns);
+            dataGrid = this._attributesDataGridRow.dataGrid = new WI.DataGrid(columns);
         }
 
         dataGrid.removeChildren();
@@ -189,8 +189,8 @@
         let attributes = domNode.attributes();
         attributes.sort((a, b) => a.name.extendedLocaleCompare(b.name));
         for (let attribute of attributes) {
-            let dataGridNode = new WebInspector.EditableDataGridNode(attribute);
-            dataGridNode.addEventListener(WebInspector.EditableDataGridNode.Event.ValueChanged, this._attributeNodeValueChanged, this);
+            let dataGridNode = new WI.EditableDataGridNode(attribute);
+            dataGridNode.addEventListener(WI.EditableDataGridNode.Event.ValueChanged, this._attributeNodeValueChanged, this);
             dataGrid.appendChild(dataGridNode);
         }
 
@@ -205,8 +205,8 @@
         }
 
         let domNode = this.domNode;
-        RuntimeAgent.releaseObjectGroup(WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName);
-        WebInspector.RemoteObject.resolveNode(domNode, WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName, nodeResolved.bind(this));
+        RuntimeAgent.releaseObjectGroup(WI.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName);
+        WI.RemoteObject.resolveNode(domNode, WI.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName, nodeResolved.bind(this));
 
         function nodeResolved(object)
         {
@@ -265,7 +265,7 @@
             let element = this._propertiesRow.element;
             element.removeChildren();
 
-            let propertyPath = new WebInspector.PropertyPath(this._nodeRemoteObject, "node");
+            let propertyPath = new WI.PropertyPath(this._nodeRemoteObject, "node");
 
             let initialSection = true;
             for (let i = 0; i < prototypes.length; ++i) {
@@ -278,17 +278,17 @@
                 let title = prototypeName;
                 if (/Prototype$/.test(title)) {
                     prototypeName = prototypeName.replace(/Prototype$/, "");
-                    title = prototypeName + WebInspector.UIString(" (Prototype)");
+                    title = prototypeName + WI.UIString(" (Prototype)");
                 } else if (title === "Object")
-                    title = title + WebInspector.UIString(" (Prototype)");
+                    title = title + WI.UIString(" (Prototype)");
 
-                let mode = initialSection ? WebInspector.ObjectTreeView.Mode.Properties : WebInspector.ObjectTreeView.Mode.PureAPI;
-                let objectTree = new WebInspector.ObjectTreeView(prototype, mode, propertyPath);
+                let mode = initialSection ? WI.ObjectTreeView.Mode.Properties : WI.ObjectTreeView.Mode.PureAPI;
+                let objectTree = new WI.ObjectTreeView(prototype, mode, propertyPath);
                 objectTree.showOnlyProperties();
                 objectTree.setPrototypeNameOverride(prototypeName);
 
-                let detailsSection = new WebInspector.DetailsSection(prototype.description.hash + "-prototype-properties", title, null, null, true);
-                detailsSection.groups[0].rows = [new WebInspector.ObjectPropertiesDetailSectionRow(objectTree, detailsSection)];
+                let detailsSection = new WI.DetailsSection(prototype.description.hash + "-prototype-properties", title, null, null, true);
+                detailsSection.groups[0].rows = [new WI.ObjectPropertiesDetailSectionRow(objectTree, detailsSection)];
 
                 element.appendChild(detailsSection.element);
 
@@ -304,11 +304,11 @@
             return;
 
         function createEventListenerSection(title, eventListeners, options = {}) {
-            let groups = eventListeners.map((eventListener) => new WebInspector.EventListenerSectionGroup(eventListener, options));
+            let groups = eventListeners.map((eventListener) => new WI.EventListenerSectionGroup(eventListener, options));
 
             const optionsElement = null;
             const defaultCollapsedSettingValue = true;
-            let section = new WebInspector.DetailsSection(`${title}-event-listener-section`, title, groups, optionsElement, defaultCollapsedSettingValue);
+            let section = new WI.DetailsSection(`${title}-event-listener-section`, title, groups, optionsElement, defaultCollapsedSettingValue);
             section.element.classList.add("event-listener-section");
             return section;
         }
@@ -316,7 +316,7 @@
         function generateGroupsByEvent(eventListeners) {
             let eventListenerTypes = new Map;
             for (let eventListener of eventListeners) {
-                eventListener.node = WebInspector.domTreeManager.nodeForId(eventListener.nodeId);
+                eventListener.node = WI.domTreeManager.nodeForId(eventListener.nodeId);
 
                 let eventListenersForType = eventListenerTypes.get(eventListener.type);
                 if (!eventListenersForType)
@@ -338,7 +338,7 @@
         function generateGroupsByNode(eventListeners) {
             let eventListenerNodes = new Map;
             for (let eventListener of eventListeners) {
-                eventListener.node = WebInspector.domTreeManager.nodeForId(eventListener.nodeId);
+                eventListener.node = WI.domTreeManager.nodeForId(eventListener.nodeId);
 
                 let eventListenersForNode = eventListenerNodes.get(eventListener.node);
                 if (!eventListenersForNode)
@@ -373,18 +373,18 @@
                 return;
 
             if (!eventListeners.length) {
-                var emptyRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Event Listeners"));
+                var emptyRow = new WI.DetailsSectionRow(WI.UIString("No Event Listeners"));
                 emptyRow.showEmptyMessage();
                 this._eventListenersSectionGroup.rows = [emptyRow];
                 return;
             }
 
             switch (this._eventListenerGroupingMethodSetting.value) {
-            case WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event:
+            case WI.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event:
                 this._eventListenersSectionGroup.rows = generateGroupsByEvent.call(this, eventListeners);
                 break;
 
-            case WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node:
+            case WI.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node:
                 this._eventListenersSectionGroup.rows = generateGroupsByNode.call(this, eventListeners);
                 break;
             }
@@ -406,16 +406,16 @@
 
         function booleanValueToLocalizedStringIfTrue(property) {
             if (properties[property])
-                return WebInspector.UIString("Yes");
+                return WI.UIString("Yes");
             return "";
         }
 
         function booleanValueToLocalizedStringIfPropertyDefined(property) {
             if (properties[property] !== undefined) {
                 if (properties[property])
-                    return WebInspector.UIString("Yes");
+                    return WI.UIString("Yes");
                 else
-                    return WebInspector.UIString("No");
+                    return WI.UIString("No");
             }
             return "";
         }
@@ -423,9 +423,9 @@
         function linkForNodeId(nodeId) {
             var link = null;
             if (nodeId !== undefined && typeof nodeId === "number") {
-                var node = WebInspector.domTreeManager.nodeForId(nodeId);
+                var node = WI.domTreeManager.nodeForId(nodeId);
                 if (node)
-                    link = WebInspector.linkifyAccessibilityNodeReference(node);
+                    link = WI.linkifyAccessibilityNodeReference(node);
             }
             return link;
         }
@@ -442,10 +442,10 @@
             let linkList = container.createChild("ul", "node-link-list");
             let initiallyHiddenItems = [];
             for (let nodeId of nodeIds) {
-                let node = WebInspector.domTreeManager.nodeForId(nodeId);
+                let node = WI.domTreeManager.nodeForId(nodeId);
                 if (!node)
                     continue;
-                let link = WebInspector.linkifyAccessibilityNodeReference(node);
+                let link = WI.linkifyAccessibilityNodeReference(node);
                 hasLinks = true;
                 let li = linkList.createChild("li");
                 li.appendChild(link);
@@ -458,7 +458,7 @@
             container.appendChild(linkList);
             if (listItemCount > itemsToShow) {
                 let moreNodesButton = container.createChild("button", "expand-list-button");
-                moreNodesButton.textContent = WebInspector.UIString("%d More\u2026").format(listItemCount - itemsToShow);
+                moreNodesButton.textContent = WI.UIString("%d More\u2026").format(listItemCount - itemsToShow);
                 moreNodesButton.addEventListener("click", () => {
                     initiallyHiddenItems.forEach((element) => { element.hidden = false; });
                     moreNodesButton.remove();
@@ -485,11 +485,11 @@
                 var checked = "";
                 if (accessibilityProperties.checked !== undefined) {
                     if (accessibilityProperties.checked === DOMAgent.AccessibilityPropertiesChecked.True)
-                        checked = WebInspector.UIString("Yes");
+                        checked = WI.UIString("Yes");
                     else if (accessibilityProperties.checked === DOMAgent.AccessibilityPropertiesChecked.Mixed)
-                        checked = WebInspector.UIString("Mixed");
+                        checked = WI.UIString("Mixed");
                     else // DOMAgent.AccessibilityPropertiesChecked.False
-                        checked = WebInspector.UIString("No");
+                        checked = WI.UIString("No");
                 }
 
                 // Accessibility tree children are not a 1:1 mapping with DOM tree children.
@@ -499,22 +499,22 @@
                 var current = "";
                 switch (accessibilityProperties.current) {
                 case DOMAgent.AccessibilityPropertiesCurrent.True:
-                    current = WebInspector.UIString("True");
+                    current = WI.UIString("True");
                     break;
                 case DOMAgent.AccessibilityPropertiesCurrent.Page:
-                    current = WebInspector.UIString("Page");
+                    current = WI.UIString("Page");
                     break;
                 case DOMAgent.AccessibilityPropertiesCurrent.Location:
-                    current = WebInspector.UIString("Location");
+                    current = WI.UIString("Location");
                     break;
                 case DOMAgent.AccessibilityPropertiesCurrent.Step:
-                    current = WebInspector.UIString("Step");
+                    current = WI.UIString("Step");
                     break;
                 case DOMAgent.AccessibilityPropertiesCurrent.Date:
-                    current = WebInspector.UIString("Date");
+                    current = WI.UIString("Date");
                     break;
                 case DOMAgent.AccessibilityPropertiesCurrent.Time:
-                    current = WebInspector.UIString("Time");
+                    current = WI.UIString("Time");
                     break;
                 default:
                     current = "";
@@ -527,20 +527,20 @@
 
                 var ignored = "";
                 if (accessibilityProperties.ignored) {
-                    ignored = WebInspector.UIString("Yes");
+                    ignored = WI.UIString("Yes");
                     if (accessibilityProperties.hidden)
-                        ignored = WebInspector.UIString("%s (hidden)").format(ignored);
+                        ignored = WI.UIString("%s (hidden)").format(ignored);
                     else if (accessibilityProperties.ignoredByDefault)
-                        ignored = WebInspector.UIString("%s (default)").format(ignored);
+                        ignored = WI.UIString("%s (default)").format(ignored);
                 }
 
                 var invalid = "";
                 if (accessibilityProperties.invalid === DOMAgent.AccessibilityPropertiesInvalid.True)
-                    invalid = WebInspector.UIString("Yes");
+                    invalid = WI.UIString("Yes");
                 else if (accessibilityProperties.invalid === DOMAgent.AccessibilityPropertiesInvalid.Grammar)
-                    invalid = WebInspector.UIString("Grammar");
+                    invalid = WI.UIString("Grammar");
                 else if (accessibilityProperties.invalid === DOMAgent.AccessibilityPropertiesInvalid.Spelling)
-                    invalid = WebInspector.UIString("Spelling");
+                    invalid = WI.UIString("Spelling");
 
                 var label = accessibilityProperties.label;
 
@@ -549,10 +549,10 @@
                 var liveRegionStatusToken = accessibilityProperties.liveRegionStatus;
                 switch (liveRegionStatusToken) {
                 case DOMAgent.AccessibilityPropertiesLiveRegionStatus.Assertive:
-                    liveRegionStatus = WebInspector.UIString("Assertive");
+                    liveRegionStatus = WI.UIString("Assertive");
                     break;
                 case DOMAgent.AccessibilityPropertiesLiveRegionStatus.Polite:
-                    liveRegionStatus = WebInspector.UIString("Polite");
+                    liveRegionStatus = WI.UIString("Polite");
                     break;
                 default:
                     liveRegionStatus = "";
@@ -567,17 +567,17 @@
                             && liveRegionRelevant[0] === DOMAgent.LiveRegionRelevant.Additions
                             && liveRegionRelevant[1] === DOMAgent.LiveRegionRelevant.Removals
                             && liveRegionRelevant[2] === DOMAgent.LiveRegionRelevant.Text)
-                            liveRegionRelevant = [WebInspector.UIString("All Changes")];
+                            liveRegionRelevant = [WI.UIString("All Changes")];
                         else {
                             // Reassign localized strings in place: ["additions","text"] becomes ["Additions","Text"].
                             liveRegionRelevant = liveRegionRelevant.map(function(value) {
                                 switch (value) {
                                 case DOMAgent.LiveRegionRelevant.Additions:
-                                    return WebInspector.UIString("Additions");
+                                    return WI.UIString("Additions");
                                 case DOMAgent.LiveRegionRelevant.Removals:
-                                    return WebInspector.UIString("Removals");
+                                    return WI.UIString("Removals");
                                 case DOMAgent.LiveRegionRelevant.Text:
-                                    return WebInspector.UIString("Text");
+                                    return WI.UIString("Text");
                                 default: // If WebCore sends a new unhandled value, display as a String.
                                     return "\"" + value + "\"";
                                 }
@@ -593,7 +593,7 @@
                         liveRegionStatusNode.append(liveRegionStatus);
                         var clarificationNode = document.createElement("div");
                         clarificationNode.className = "clarification";
-                        clarificationNode.append(WebInspector.UIString("Region announced in its entirety."));
+                        clarificationNode.append(WI.UIString("Region announced in its entirety."));
                         liveRegionStatusNode.appendChild(clarificationNode);
                     }
                 }
@@ -603,7 +603,7 @@
                 var mouseEventNodeLink = null;
                 if (mouseEventNodeId) {
                     if (mouseEventNodeId === accessibilityProperties.nodeId)
-                        mouseEventTextValue = WebInspector.UIString("Yes");
+                        mouseEventTextValue = WI.UIString("Yes");
                     else
                         mouseEventNodeLink = linkForNodeId(mouseEventNodeId);
                 }
@@ -621,12 +621,12 @@
                 let hasPopup = accessibilityProperties.isPopupButton;
                 let roleType = null;
                 let buttonType = null;
-                let buttonTypePopupString = WebInspector.UIString("popup");
-                let buttonTypeToggleString = WebInspector.UIString("toggle");
-                let buttonTypePopupToggleString = WebInspector.UIString("popup, toggle");
+                let buttonTypePopupString = WI.UIString("popup");
+                let buttonTypeToggleString = WI.UIString("toggle");
+                let buttonTypePopupToggleString = WI.UIString("popup, toggle");
 
                 if (role === "" || role === "unknown")
-                    role = WebInspector.UIString("No matching ARIA role");
+                    role = WI.UIString("No matching ARIA role");
                 else if (role) {
                     if (role === "button") {
                         if (pressed)
@@ -640,15 +640,15 @@
                     }
 
                     if (!domNode.getAttribute("role"))
-                        roleType = WebInspector.UIString("default");
+                        roleType = WI.UIString("default");
                     else if (buttonType || domNode.getAttribute("role") !== role)
-                        roleType = WebInspector.UIString("computed");
+                        roleType = WI.UIString("computed");
 
                     if (buttonType && roleType)
-                        role = WebInspector.UIString("%s (%s, %s)").format(role, buttonType, roleType);
+                        role = WI.UIString("%s (%s, %s)").format(role, buttonType, roleType);
                     else if (roleType || buttonType) {
                         let extraInfo = roleType || buttonType;
-                        role = WebInspector.UIString("%s (%s)").format(role, extraInfo);
+                        role = WI.UIString("%s (%s)").format(role, extraInfo);
                     }
                 }
 
@@ -676,7 +676,7 @@
                 this._accessibilityNodeLiveRegionStatusRow.value = liveRegionStatusNode || liveRegionStatus;
 
                 // Row label changes based on whether the value is a delegate node link.
-                this._accessibilityNodeMouseEventRow.label = mouseEventNodeLink ? WebInspector.UIString("Click Listener") : WebInspector.UIString("Clickable");
+                this._accessibilityNodeMouseEventRow.label = mouseEventNodeLink ? WI.UIString("Click Listener") : WI.UIString("Clickable");
                 this._accessibilityNodeMouseEventRow.value = mouseEventNodeLink || mouseEventTextValue;
 
                 this._accessibilityNodeOwnsRow.value = ownedNodeLinkList || "";
@@ -687,10 +687,10 @@
                 this._accessibilityNodeRoleRow.value = role;
                 this._accessibilityNodeSelectedRow.value = selected;
 
-                this._accessibilityNodeSelectedChildrenRow.label = WebInspector.UIString("Selected Items");
+                this._accessibilityNodeSelectedChildrenRow.label = WI.UIString("Selected Items");
                 this._accessibilityNodeSelectedChildrenRow.value = selectedChildNodeLinkList || "";
                 if (selectedChildNodeLinkList && accessibilityProperties.selectedChildNodeIds.length === 1)
-                    this._accessibilityNodeSelectedChildrenRow.label = WebInspector.UIString("Selected Item");
+                    this._accessibilityNodeSelectedChildrenRow.label = WI.UIString("Selected Item");
 
                 // Display order, not alphabetical as above.
                 this._accessibilityGroup.rows = [
@@ -776,24 +776,24 @@
     {
         switch (this.domNode.nodeType()) {
         case Node.ELEMENT_NODE: {
-            const nodeName = WebInspector.UIString("Element");
+            const nodeName = WI.UIString("Element");
             const state = this._customElementState();
             return state === null ? nodeName : `${nodeName} (${state})`;
         }
         case Node.TEXT_NODE:
-            return WebInspector.UIString("Text Node");
+            return WI.UIString("Text Node");
         case Node.COMMENT_NODE:
-            return WebInspector.UIString("Comment");
+            return WI.UIString("Comment");
         case Node.DOCUMENT_NODE:
-            return WebInspector.UIString("Document");
+            return WI.UIString("Document");
         case Node.DOCUMENT_TYPE_NODE:
-            return WebInspector.UIString("Document Type");
+            return WI.UIString("Document Type");
         case Node.DOCUMENT_FRAGMENT_NODE:
-            return WebInspector.UIString("Document Fragment");
+            return WI.UIString("Document Fragment");
         case Node.CDATA_SECTION_NODE:
-            return WebInspector.UIString("Character Data");
+            return WI.UIString("Character Data");
         case Node.PROCESSING_INSTRUCTION_NODE:
-            return WebInspector.UIString("Processing Instruction");
+            return WI.UIString("Processing Instruction");
         default:
             console.error("Unknown DOM node type: ", this.domNode.nodeType());
             return this.domNode.nodeType();
@@ -804,23 +804,23 @@
     {
         const state = this.domNode.customElementState();
         switch (state) {
-        case WebInspector.DOMNode.CustomElementState.Builtin:
+        case WI.DOMNode.CustomElementState.Builtin:
             return null;
-        case WebInspector.DOMNode.CustomElementState.Custom:
-            return WebInspector.UIString("Custom");
-        case WebInspector.DOMNode.CustomElementState.Waiting:
-            return WebInspector.UIString("Undefined custom element");
-        case WebInspector.DOMNode.CustomElementState.Failed:
-            return WebInspector.UIString("Failed to upgrade");
+        case WI.DOMNode.CustomElementState.Custom:
+            return WI.UIString("Custom");
+        case WI.DOMNode.CustomElementState.Waiting:
+            return WI.UIString("Undefined custom element");
+        case WI.DOMNode.CustomElementState.Failed:
+            return WI.UIString("Failed to upgrade");
         }
         console.error("Unknown DOM custom element state: ", state);
         return null;
     }
 };
 
-WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod = {
+WI.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod = {
     Event: "event",
     Node: "node",
 };
 
-WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName = "dom-node-details-sidebar-properties-object-group";
+WI.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName = "dom-node-details-sidebar-properties-object-group";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js
index b9df122..fedc7ac 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js
@@ -23,23 +23,23 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMNodeTreeElement = class DOMNodeTreeElement extends WebInspector.GeneralTreeElement
+WI.DOMNodeTreeElement = class DOMNodeTreeElement extends WI.GeneralTreeElement
 {
     constructor(domNode)
     {
-        console.assert(domNode instanceof WebInspector.DOMNode);
+        console.assert(domNode instanceof WI.DOMNode);
 
         const subtitle = null;
         super("dom-node", domNode.displayName, subtitle, domNode, {hasChildren: true});
 
-        this.status = WebInspector.linkifyNodeReferenceElement(domNode, WebInspector.createGoToArrowButton());
+        this.status = WI.linkifyNodeReferenceElement(domNode, WI.createGoToArrowButton());
     }
 
     // Protected
 
     ondelete()
     {
-        WebInspector.domDebuggerManager.removeDOMBreakpointsForNode(this.representedObject);
+        WI.domDebuggerManager.removeDOMBreakpointsForNode(this.representedObject);
         return true;
     }
 
@@ -48,12 +48,12 @@
         contextMenu.appendSeparator();
 
         const allowEditing = true;
-        WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu, this.representedObject, allowEditing);
+        WI.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu, this.representedObject, allowEditing);
 
         contextMenu.appendSeparator();
 
-        contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"), () => {
-            WebInspector.domTreeManager.inspectElement(this.representedObject.id);
+        contextMenu.appendItem(WI.UIString("Reveal in DOM Tree"), () => {
+            WI.domTreeManager.inspectElement(this.representedObject.id);
         });
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js b/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
index 83f3233..7d951ba 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMStorageContentView = class DOMStorageContentView extends WebInspector.ContentView
+WI.DOMStorageContentView = class DOMStorageContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -32,20 +32,20 @@
 
         this.element.classList.add("dom-storage");
 
-        representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemsCleared, this.itemsCleared, this);
-        representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemAdded, this.itemAdded, this);
-        representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemRemoved, this.itemRemoved, this);
-        representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemUpdated, this.itemUpdated, this);
+        representedObject.addEventListener(WI.DOMStorageObject.Event.ItemsCleared, this.itemsCleared, this);
+        representedObject.addEventListener(WI.DOMStorageObject.Event.ItemAdded, this.itemAdded, this);
+        representedObject.addEventListener(WI.DOMStorageObject.Event.ItemRemoved, this.itemRemoved, this);
+        representedObject.addEventListener(WI.DOMStorageObject.Event.ItemUpdated, this.itemUpdated, this);
 
         let columns = {};
-        columns.key = {title: WebInspector.UIString("Key"), sortable: true};
-        columns.value = {title: WebInspector.UIString("Value"), sortable: true};
+        columns.key = {title: WI.UIString("Key"), sortable: true};
+        columns.value = {title: WI.UIString("Value"), sortable: true};
 
-        this._dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid = new WI.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.sortColumnIdentifier = "key";
         this._dataGrid.createSettings("dom-storage-content-view");
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
         this.addSubview(this._dataGrid);
 
@@ -56,7 +56,7 @@
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.DOMStorage;
+        cookie.type = WI.ContentViewCookieType.DOMStorage;
         cookie.isLocalStorage = this.representedObject.isLocalStorage();
         cookie.host = this.representedObject.host;
     }
@@ -93,7 +93,7 @@
                 return;
         }
 
-        this._dataGrid.appendChild(new WebInspector.DataGridNode({key, value}, false));
+        this._dataGrid.appendChild(new WI.DataGridNode({key, value}, false));
         this._sortDataGrid();
     }
 
@@ -137,7 +137,7 @@
                     continue;
 
                 value = this._truncateValue(value);
-                let node = new WebInspector.DataGridNode({key, value}, false);
+                let node = new WI.DataGridNode({key, value}, false);
                 this._dataGrid.appendChild(node);
             }
 
@@ -193,9 +193,9 @@
 
         function cleanup()
         {
-            editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);
-            editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);
-            editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);
+            editingNode.element.classList.remove(WI.DOMStorageContentView.MissingKeyStyleClassName);
+            editingNode.element.classList.remove(WI.DOMStorageContentView.MissingValueStyleClassName);
+            editingNode.element.classList.remove(WI.DOMStorageContentView.DuplicateKeyStyleClassName);
             editingNode.__hasUncommittedEdits = undefined;
             editingNode.__originalKey = undefined;
             editingNode.__originalValue = undefined;
@@ -204,23 +204,23 @@
         // If the key/value field was cleared, add "missing" style.
         if (isEditingKey) {
             if (key.length)
-                editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);
+                editingNode.element.classList.remove(WI.DOMStorageContentView.MissingKeyStyleClassName);
             else
-                editingNode.element.classList.add(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);
+                editingNode.element.classList.add(WI.DOMStorageContentView.MissingKeyStyleClassName);
         } else if (isEditingValue) {
             if (value.length)
-                editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);
+                editingNode.element.classList.remove(WI.DOMStorageContentView.MissingValueStyleClassName);
             else
-                editingNode.element.classList.add(WebInspector.DOMStorageContentView.MissingValueStyleClassName);
+                editingNode.element.classList.add(WI.DOMStorageContentView.MissingValueStyleClassName);
         }
 
         // Check for key duplicates. If this is a new row, or an existing row that changed key.
         var keyChanged = key !== editingNode.__originalKey;
         if (keyChanged) {
             if (domStorage.entries.has(key))
-                editingNode.element.classList.add(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);
+                editingNode.element.classList.add(WI.DOMStorageContentView.DuplicateKeyStyleClassName);
             else
-                editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);
+                editingNode.element.classList.remove(WI.DOMStorageContentView.DuplicateKeyStyleClassName);
         }
 
         // See if we are done editing this row or not.
@@ -241,7 +241,7 @@
         }
 
         // Done editing but leaving the row in an invalid state. Leave in uncommitted state.
-        var isDuplicate = editingNode.element.classList.contains(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);
+        var isDuplicate = editingNode.element.classList.contains(WI.DOMStorageContentView.DuplicateKeyStyleClassName);
         if (!key.length || !value.length || isDuplicate)
             return;
 
@@ -255,6 +255,6 @@
     }
 };
 
-WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName = "duplicate-key";
-WebInspector.DOMStorageContentView.MissingKeyStyleClassName = "missing-key";
-WebInspector.DOMStorageContentView.MissingValueStyleClassName = "missing-value";
+WI.DOMStorageContentView.DuplicateKeyStyleClassName = "duplicate-key";
+WI.DOMStorageContentView.MissingKeyStyleClassName = "missing-key";
+WI.DOMStorageContentView.MissingValueStyleClassName = "missing-value";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMStorageTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DOMStorageTreeElement.js
index bb2fe36..3dbf0ba 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMStorageTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMStorageTreeElement.js
@@ -23,34 +23,34 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMStorageTreeElement = class DOMStorageTreeElement extends WebInspector.StorageTreeElement
+WI.DOMStorageTreeElement = class DOMStorageTreeElement extends WI.StorageTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.DOMStorageObject);
+        console.assert(representedObject instanceof WI.DOMStorageObject);
 
         if (representedObject.isLocalStorage())
-            var className = WebInspector.DOMStorageTreeElement.LocalStorageIconStyleClassName;
+            var className = WI.DOMStorageTreeElement.LocalStorageIconStyleClassName;
         else
-            var className = WebInspector.DOMStorageTreeElement.SessionStorageIconStyleClassName;
+            var className = WI.DOMStorageTreeElement.SessionStorageIconStyleClassName;
 
-        super(className, WebInspector.displayNameForHost(representedObject.host), representedObject);
+        super(className, WI.displayNameForHost(representedObject.host), representedObject);
     }
 
     // Public
 
     get name()
     {
-        return WebInspector.displayNameForHost(this.representedObject.host);
+        return WI.displayNameForHost(this.representedObject.host);
     }
 
     get categoryName()
     {
         if (this.representedObject.isLocalStorage())
-            return WebInspector.UIString("Local Storage");
-        return WebInspector.UIString("Session Storage");
+            return WI.UIString("Local Storage");
+        return WI.UIString("Session Storage");
     }
 };
 
-WebInspector.DOMStorageTreeElement.LocalStorageIconStyleClassName = "local-storage-icon";
-WebInspector.DOMStorageTreeElement.SessionStorageIconStyleClassName = "session-storage-icon";
+WI.DOMStorageTreeElement.LocalStorageIconStyleClassName = "local-storage-icon";
+WI.DOMStorageTreeElement.SessionStorageIconStyleClassName = "session-storage-icon";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
index fc84e1d..3cec6c5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeContentView = class DOMTreeContentView extends WebInspector.ContentView
+WI.DOMTreeContentView = class DOMTreeContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -31,55 +31,55 @@
 
         super(representedObject);
 
-        this._compositingBordersButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("layer-borders", WebInspector.UIString("Show compositing borders"), WebInspector.UIString("Hide compositing borders"), "Images/LayerBorders.svg", 13, 13);
-        this._compositingBordersButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
+        this._compositingBordersButtonNavigationItem = new WI.ActivateButtonNavigationItem("layer-borders", WI.UIString("Show compositing borders"), WI.UIString("Hide compositing borders"), "Images/LayerBorders.svg", 13, 13);
+        this._compositingBordersButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
         this._compositingBordersButtonNavigationItem.enabled = !!PageAgent.getCompositingBordersVisible;
 
-        WebInspector.showPaintRectsSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showPaintRectsSettingChanged, this);
-        this._paintFlashingButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("paint-flashing", WebInspector.UIString("Enable paint flashing"), WebInspector.UIString("Disable paint flashing"), "Images/PaintFlashing.svg", 16, 16);
-        this._paintFlashingButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._togglePaintFlashing, this);
+        WI.showPaintRectsSetting.addEventListener(WI.Setting.Event.Changed, this._showPaintRectsSettingChanged, this);
+        this._paintFlashingButtonNavigationItem = new WI.ActivateButtonNavigationItem("paint-flashing", WI.UIString("Enable paint flashing"), WI.UIString("Disable paint flashing"), "Images/PaintFlashing.svg", 16, 16);
+        this._paintFlashingButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePaintFlashing, this);
         this._paintFlashingButtonNavigationItem.enabled = !!PageAgent.setShowPaintRects;
-        this._paintFlashingButtonNavigationItem.activated = PageAgent.setShowPaintRects && WebInspector.showPaintRectsSetting.value;
+        this._paintFlashingButtonNavigationItem.activated = PageAgent.setShowPaintRects && WI.showPaintRectsSetting.value;
 
-        WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
-        this._showsShadowDOMButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("shows-shadow-DOM", WebInspector.UIString("Show shadow DOM nodes"), WebInspector.UIString("Hide shadow DOM nodes"), "Images/ShadowDOM.svg", 13, 13);
-        this._showsShadowDOMButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleShowsShadowDOMSetting, this);
+        WI.showShadowDOMSetting.addEventListener(WI.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
+        this._showsShadowDOMButtonNavigationItem = new WI.ActivateButtonNavigationItem("shows-shadow-DOM", WI.UIString("Show shadow DOM nodes"), WI.UIString("Hide shadow DOM nodes"), "Images/ShadowDOM.svg", 13, 13);
+        this._showsShadowDOMButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleShowsShadowDOMSetting, this);
         this._showShadowDOMSettingChanged();
 
-        WebInspector.showPrintStylesSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showPrintStylesSettingChanged, this);
-        this._showPrintStylesButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("print-styles", WebInspector.UIString("Force Print Media Styles"), WebInspector.UIString("Use Default Media Styles"), "Images/Printer.svg", 16, 16);
-        this._showPrintStylesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._togglePrintStylesSetting, this);
+        WI.showPrintStylesSetting.addEventListener(WI.Setting.Event.Changed, this._showPrintStylesSettingChanged, this);
+        this._showPrintStylesButtonNavigationItem = new WI.ActivateButtonNavigationItem("print-styles", WI.UIString("Force Print Media Styles"), WI.UIString("Use Default Media Styles"), "Images/Printer.svg", 16, 16);
+        this._showPrintStylesButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePrintStylesSetting, this);
         this._showPrintStylesSettingChanged();
 
         this.element.classList.add("dom-tree");
         this.element.addEventListener("click", this._mouseWasClicked.bind(this), false);
 
-        this._domTreeOutline = new WebInspector.DOMTreeOutline(true, true, true);
-        this._domTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._domTreeElementAdded, this);
-        this._domTreeOutline.addEventListener(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged, this._selectedNodeDidChange, this);
+        this._domTreeOutline = new WI.DOMTreeOutline(true, true, true);
+        this._domTreeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._domTreeElementAdded, this);
+        this._domTreeOutline.addEventListener(WI.DOMTreeOutline.Event.SelectedNodeChanged, this._selectedNodeDidChange, this);
         this._domTreeOutline.wireToDomAgent();
         this._domTreeOutline.editable = true;
         this.element.appendChild(this._domTreeOutline.element);
 
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified, this._domNodeChanged, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved, this._domNodeChanged, this);
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified, this._domNodeChanged, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.AttributeModified, this._domNodeChanged, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.AttributeRemoved, this._domNodeChanged, this);
+        WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.CharacterDataModified, this._domNodeChanged, this);
 
-        this._lastSelectedNodePathSetting = new WebInspector.Setting("last-selected-node-path", null);
+        this._lastSelectedNodePathSetting = new WI.Setting("last-selected-node-path", null);
 
         this._numberOfSearchResults = null;
 
         this._breakpointGutterEnabled = false;
         this._pendingBreakpointNodeIdentifiers = new Set;
 
-        if (WebInspector.domDebuggerManager.supported) {
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
+        if (WI.domDebuggerManager.supported) {
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
 
-            WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded, this._domBreakpointAddedOrRemoved, this);
-            WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved, this._domBreakpointAddedOrRemoved, this);
+            WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointAdded, this._domBreakpointAddedOrRemoved, this);
+            WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved, this._domBreakpointAddedOrRemoved, this);
 
-            WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange, this._domBreakpointDisabledStateDidChange, this);
-            WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange, this._domBreakpointResolvedStateDidChange, this);
+            WI.DOMBreakpoint.addEventListener(WI.DOMBreakpoint.Event.DisabledStateDidChange, this._domBreakpointDisabledStateDidChange, this);
+            WI.DOMBreakpoint.addEventListener(WI.DOMBreakpoint.Event.ResolvedStateDidChange, this._domBreakpointResolvedStateDidChange, this);
 
             this._breakpointsEnabledDidChange();
         }
@@ -120,7 +120,7 @@
     {
         super.shown();
 
-        this._domTreeOutline.setVisible(true, WebInspector.isConsoleFocused());
+        this._domTreeOutline.setVisible(true, WI.isConsoleFocused());
         this._updateCompositingBordersButtonToMatchPageSettings();
 
         if (!this._domTreeOutline.rootDOMNode)
@@ -133,7 +133,7 @@
     {
         super.hidden();
 
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
         this._domTreeOutline.setVisible(false);
     }
 
@@ -141,12 +141,12 @@
     {
         super.closed();
 
-        WebInspector.showPaintRectsSetting.removeEventListener(null, null, this);
-        WebInspector.showShadowDOMSetting.removeEventListener(null, null, this);
-        WebInspector.debuggerManager.removeEventListener(null, null, this);
-        WebInspector.domTreeManager.removeEventListener(null, null, this);
-        WebInspector.domDebuggerManager.removeEventListener(null, null, this);
-        WebInspector.DOMBreakpoint.removeEventListener(null, null, this);
+        WI.showPaintRectsSetting.removeEventListener(null, null, this);
+        WI.showShadowDOMSetting.removeEventListener(null, null, this);
+        WI.debuggerManager.removeEventListener(null, null, this);
+        WI.domTreeManager.removeEventListener(null, null, this);
+        WI.domDebuggerManager.removeEventListener(null, null, this);
+        WI.DOMBreakpoint.removeEventListener(null, null, this);
 
         this._domTreeOutline.close();
         this._pendingBreakpointNodeIdentifiers.clear();
@@ -165,8 +165,8 @@
                 continue;
             }
 
-            var pathComponent = new WebInspector.DOMTreeElementPathComponent(treeElement, treeElement.representedObject);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._pathComponentSelected, this);
+            var pathComponent = new WI.DOMTreeElementPathComponent(treeElement, treeElement.representedObject);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._pathComponentSelected, this);
             pathComponents.unshift(pathComponent);
             treeElement = treeElement.parent;
         }
@@ -205,14 +205,14 @@
 
     get supportsSave()
     {
-        return WebInspector.canArchiveMainFrame();
+        return WI.canArchiveMainFrame();
     }
 
     get saveData()
     {
         function saveHandler(forceSaveAs)
         {
-            WebInspector.archiveMainFrame();
+            WI.archiveMainFrame();
         }
 
         return {customSaveHandler: saveHandler};
@@ -267,7 +267,7 @@
             this._searchIdentifier = searchIdentifier;
             this._numberOfSearchResults = resultsCount;
 
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+            this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
 
             this._showSearchHighlights();
 
@@ -355,7 +355,7 @@
 
             console.assert(nodeIdentifiers.length === 1);
 
-            var domNode = WebInspector.domTreeManager.nodeForId(nodeIdentifiers[0]);
+            var domNode = WI.domTreeManager.nodeForId(nodeIdentifiers[0]);
             console.assert(domNode);
             if (!domNode)
                 return;
@@ -372,7 +372,7 @@
 
     _restoreSelectedNodeAfterUpdate(documentURL, defaultNode)
     {
-        if (!WebInspector.domTreeManager.restoreSelectedNodeIsAllowed)
+        if (!WI.domTreeManager.restoreSelectedNodeIsAllowed)
             return;
 
         function selectNode(lastSelectedNode)
@@ -385,7 +385,7 @@
                 return;
 
             this._dontSetLastSelectedNodePath = true;
-            this.selectAndRevealDOMNode(nodeToFocus, WebInspector.isConsoleFocused());
+            this.selectAndRevealDOMNode(nodeToFocus, WI.isConsoleFocused());
             this._dontSetLastSelectedNodePath = false;
 
             // If this wasn't the last selected node, then expand it.
@@ -395,14 +395,14 @@
 
         function selectLastSelectedNode(nodeId)
         {
-            if (!WebInspector.domTreeManager.restoreSelectedNodeIsAllowed)
+            if (!WI.domTreeManager.restoreSelectedNodeIsAllowed)
                 return;
 
-            selectNode.call(this, WebInspector.domTreeManager.nodeForId(nodeId));
+            selectNode.call(this, WI.domTreeManager.nodeForId(nodeId));
         }
 
         if (documentURL && this._lastSelectedNodePathSetting.value && this._lastSelectedNodePathSetting.value.path && this._lastSelectedNodePathSetting.value.url === documentURL.hash)
-            WebInspector.domTreeManager.pushNodeByPathToFrontend(this._lastSelectedNodePathSetting.value.path, selectLastSelectedNode.bind(this));
+            WI.domTreeManager.pushNodeByPathToFrontend(this._lastSelectedNodePathSetting.value.path, selectLastSelectedNode.bind(this));
         else
             selectNode.call(this);
     }
@@ -414,8 +414,8 @@
 
         let treeElement = event.data.element;
         let node = treeElement.representedObject;
-        console.assert(node instanceof WebInspector.DOMNode);
-        if (!(node instanceof WebInspector.DOMNode))
+        console.assert(node instanceof WI.DOMNode);
+        if (!(node instanceof WI.DOMNode))
             return;
 
         if (!this._pendingBreakpointNodeIdentifiers.delete(node.id))
@@ -428,12 +428,12 @@
     {
         var selectedDOMNode = this._domTreeOutline.selectedDOMNode();
         if (selectedDOMNode && !this._dontSetLastSelectedNodePath)
-            this._lastSelectedNodePathSetting.value = {url: WebInspector.frameResourceManager.mainFrame.url.hash, path: selectedDOMNode.path()};
+            this._lastSelectedNodePathSetting.value = {url: WI.frameResourceManager.mainFrame.url.hash, path: selectedDOMNode.path()};
 
         if (selectedDOMNode)
             ConsoleAgent.addInspectedNode(selectedDOMNode.id);
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _pathComponentSelected(event)
@@ -441,8 +441,8 @@
         if (!event.data.pathComponent)
             return;
 
-        console.assert(event.data.pathComponent instanceof WebInspector.DOMTreeElementPathComponent);
-        console.assert(event.data.pathComponent.domTreeElement instanceof WebInspector.DOMTreeElement);
+        console.assert(event.data.pathComponent instanceof WI.DOMTreeElementPathComponent);
+        console.assert(event.data.pathComponent.domTreeElement instanceof WI.DOMTreeElement);
 
         this._domTreeOutline.selectDOMNode(event.data.pathComponent.domTreeElement.representedObject, true);
     }
@@ -453,7 +453,7 @@
         if (selectedDOMNode !== event.data.node)
             return;
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _mouseWasClicked(event)
@@ -466,7 +466,7 @@
         event.preventDefault();
         event.stopPropagation();
 
-        if (WebInspector.isBeingEdited(anchorElement)) {
+        if (WI.isBeingEdited(anchorElement)) {
             // Don't follow the link when it is being edited.
             return;
         }
@@ -483,16 +483,16 @@
 
         function followLink()
         {
-            // Since followLink is delayed, the call to WebInspector.openURL can't look at window.event
+            // Since followLink is delayed, the call to WI.openURL can't look at window.event
             // to see if the command key is down like it normally would. So we need to do that check
-            // before calling WebInspector.openURL.
+            // before calling WI.openURL.
             const options = {
                 alwaysOpenExternally: event ? event.metaKey : false,
                 lineNumber: anchorElement.lineNumber,
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             };
-            WebInspector.openURL(anchorElement.href, this._frame, options);
+            WI.openURL(anchorElement.href, this._frame, options);
         }
 
         // Start a timeout since this is a single click, if the timeout is canceled before it fires,
@@ -512,7 +512,7 @@
 
     _togglePaintFlashing(event)
     {
-        WebInspector.showPaintRectsSetting.value = !WebInspector.showPaintRectsSetting.value;
+        WI.showPaintRectsSetting.value = !WI.showPaintRectsSetting.value;
     }
 
     _updateCompositingBordersButtonToMatchPageSettings()
@@ -531,34 +531,34 @@
     {
         console.assert(PageAgent.setShowPaintRects);
 
-        this._paintFlashingButtonNavigationItem.activated = WebInspector.showPaintRectsSetting.value;
+        this._paintFlashingButtonNavigationItem.activated = WI.showPaintRectsSetting.value;
 
         PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);
     }
 
     _showShadowDOMSettingChanged(event)
     {
-        this._showsShadowDOMButtonNavigationItem.activated = WebInspector.showShadowDOMSetting.value;
+        this._showsShadowDOMButtonNavigationItem.activated = WI.showShadowDOMSetting.value;
     }
 
     _toggleShowsShadowDOMSetting(event)
     {
-        WebInspector.showShadowDOMSetting.value = !WebInspector.showShadowDOMSetting.value;
+        WI.showShadowDOMSetting.value = !WI.showShadowDOMSetting.value;
     }
 
     _showPrintStylesSettingChanged(event)
     {
-        this._showPrintStylesButtonNavigationItem.activated = WebInspector.showPrintStylesSetting.value;
+        this._showPrintStylesButtonNavigationItem.activated = WI.showPrintStylesSetting.value;
     }
 
     _togglePrintStylesSetting(event)
     {
-        WebInspector.showPrintStylesSetting.value = !WebInspector.showPrintStylesSetting.value;
+        WI.showPrintStylesSetting.value = !WI.showPrintStylesSetting.value;
 
-        let mediaType = WebInspector.showPrintStylesSetting.value ? "print" : "";
+        let mediaType = WI.showPrintStylesSetting.value ? "print" : "";
         PageAgent.setEmulatedMedia(mediaType);
 
-        WebInspector.cssStyleManager.mediaTypeChanged();
+        WI.cssStyleManager.mediaTypeChanged();
     }
 
     _showSearchHighlights()
@@ -579,7 +579,7 @@
             console.assert(nodeIdentifiers.length === this._numberOfSearchResults);
 
             for (var i = 0; i < nodeIdentifiers.length; ++i) {
-                var domNode = WebInspector.domTreeManager.nodeForId(nodeIdentifiers[i]);
+                var domNode = WI.domTreeManager.nodeForId(nodeIdentifiers[i]);
                 console.assert(domNode);
                 if (!domNode)
                     continue;
@@ -629,7 +629,7 @@
 
     _updateBreakpointStatus(nodeIdentifier)
     {
-        let domNode = WebInspector.domTreeManager.nodeForId(nodeIdentifier);
+        let domNode = WI.domTreeManager.nodeForId(nodeIdentifier);
         if (!domNode)
             return;
 
@@ -639,16 +639,16 @@
             return;
         }
 
-        let breakpoints = WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);
+        let breakpoints = WI.domDebuggerManager.domBreakpointsForNode(domNode);
         if (!breakpoints.length) {
-            treeElement.breakpointStatus = WebInspector.DOMTreeElement.BreakpointStatus.None;
+            treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.None;
             return;
         }
 
         this.breakpointGutterEnabled = true;
 
         let disabled = breakpoints.some((item) => item.disabled);
-        treeElement.breakpointStatus = disabled ? WebInspector.DOMTreeElement.BreakpointStatus.DisabledBreakpoint : WebInspector.DOMTreeElement.BreakpointStatus.Breakpoint;
+        treeElement.breakpointStatus = disabled ? WI.DOMTreeElement.BreakpointStatus.DisabledBreakpoint : WI.DOMTreeElement.BreakpointStatus.Breakpoint;
     }
 
     _restoreBreakpointsAfterUpdate()
@@ -658,7 +658,7 @@
         this.breakpointGutterEnabled = false;
 
         let updatedNodes = new Set;
-        for (let breakpoint of WebInspector.domDebuggerManager.domBreakpoints) {
+        for (let breakpoint of WI.domDebuggerManager.domBreakpoints) {
             if (updatedNodes.has(breakpoint.domNodeIdentifier))
                 continue;
 
@@ -668,6 +668,6 @@
 
     _breakpointsEnabledDidChange(event)
     {
-        this._domTreeOutline.element.classList.toggle("breakpoints-disabled", !WebInspector.debuggerManager.breakpointsEnabled);
+        this._domTreeOutline.element.classList.toggle("breakpoints-disabled", !WI.debuggerManager.breakpointsEnabled);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGrid.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGrid.js
index 0427575..d5a0abf 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGrid.js
@@ -24,12 +24,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeDataGrid = class DOMTreeDataGrid extends WebInspector.DataGrid
+WI.DOMTreeDataGrid = class DOMTreeDataGrid extends WI.DataGrid
 {
     constructor()
     {
         super({
-            name: {title: WebInspector.UIString("Node"), sortable: false, icon: true}
+            name: {title: WI.UIString("Node"), sortable: false, icon: true}
         });
 
         this._previousHoveredElement = null;
@@ -50,13 +50,13 @@
         if (!gridNode || this._previousHoveredElement === gridNode.domNode)
             return;
         this._previousHoveredElement = gridNode.domNode;
-        WebInspector.domTreeManager.highlightDOMNode(gridNode.domNode.id);
+        WI.domTreeManager.highlightDOMNode(gridNode.domNode.id);
     }
 
     _onmouseout(event) {
         if (!this._previousHoveredElement)
             return;
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
         this._previousHoveredElement = null;
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js
index 18b0df0..c0dbbab 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeDataGridNode = class DOMTreeDataGridNode extends WebInspector.DataGridNode
+WI.DOMTreeDataGridNode = class DOMTreeDataGridNode extends WI.DataGridNode
 {
     constructor(domNode)
     {
@@ -56,7 +56,7 @@
         let mainTitle = this._domNode.displayName;
         fragment.append(mainTitle);
 
-        let goToButton = fragment.appendChild(WebInspector.createGoToArrowButton());
+        let goToButton = fragment.appendChild(WI.createGoToArrowButton());
         goToButton.addEventListener("click", this._goToArrowWasClicked.bind(this), false);
 
         return fragment;
@@ -64,6 +64,6 @@
 
     _goToArrowWasClicked()
     {
-        WebInspector.showMainFrameDOMTree(this._domNode);
+        WI.showMainFrameDOMTree(this._domNode);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
index a5d5dd5..c9ed78a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
@@ -28,7 +28,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElement
+WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement
 {
     constructor(node, elementCloseTag)
     {
@@ -40,8 +40,8 @@
         if (this.representedObject.nodeType() === Node.ELEMENT_NODE && !elementCloseTag)
             this._canAddAttributes = true;
         this._searchQuery = null;
-        this._expandedChildrenLimit = WebInspector.DOMTreeElement.InitialChildrenLimit;
-        this._breakpointStatus = WebInspector.DOMTreeElement.BreakpointStatus.None;
+        this._expandedChildrenLimit = WI.DOMTreeElement.InitialChildrenLimit;
+        this._breakpointStatus = WI.DOMTreeElement.BreakpointStatus.None;
         this._animatingHighlight = false;
         this._shouldHighlightAfterReveal = false;
         this._boundHighlightAnimationEnd = this._highlightAnimationEnd.bind(this);
@@ -50,7 +50,7 @@
         this._recentlyModifiedAttributes = [];
         this._boundNodeChangedAnimationEnd = this._nodeChangedAnimationEnd.bind(this);
 
-        node.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged, this._nodePseudoClassesDidChange, this);
+        node.addEventListener(WI.DOMNode.Event.EnabledPseudoClassesChanged, this._nodePseudoClassesDidChange, this);
     }
 
     // Static
@@ -58,12 +58,12 @@
     static shadowRootTypeDisplayName(type)
     {
         switch (type) {
-        case WebInspector.DOMNode.ShadowRootType.UserAgent:
-            return WebInspector.UIString("User Agent");
-        case WebInspector.DOMNode.ShadowRootType.Open:
-            return WebInspector.UIString("Open");
-        case WebInspector.DOMNode.ShadowRootType.Closed:
-            return WebInspector.UIString("Closed");
+        case WI.DOMNode.ShadowRootType.UserAgent:
+            return WI.UIString("User Agent");
+        case WI.DOMNode.ShadowRootType.Open:
+            return WI.UIString("Open");
+        case WI.DOMNode.ShadowRootType.Closed:
+            return WI.UIString("Closed");
         }
     }
 
@@ -80,9 +80,9 @@
             return;
 
         let increment;
-        if (this._breakpointStatus === WebInspector.DOMTreeElement.BreakpointStatus.None)
+        if (this._breakpointStatus === WI.DOMTreeElement.BreakpointStatus.None)
             increment = 1;
-        else if (status === WebInspector.DOMTreeElement.BreakpointStatus.None)
+        else if (status === WI.DOMTreeElement.BreakpointStatus.None)
             increment = -1;
 
         this._breakpointStatus = status;
@@ -138,7 +138,7 @@
 
     emphasizeSearchHighlight()
     {
-        var highlightElement = this.title.querySelector("." + WebInspector.DOMTreeElement.SearchHighlightStyleClassName);
+        var highlightElement = this.title.querySelector("." + WI.DOMTreeElement.SearchHighlightStyleClassName);
         console.assert(highlightElement);
         if (!highlightElement)
             return;
@@ -147,7 +147,7 @@
             this._bouncyHighlightElement.remove();
 
         this._bouncyHighlightElement = document.createElement("div");
-        this._bouncyHighlightElement.className = WebInspector.DOMTreeElement.BouncyHighlightStyleClassName;
+        this._bouncyHighlightElement.className = WI.DOMTreeElement.BouncyHighlightStyleClassName;
         this._bouncyHighlightElement.textContent = highlightElement.textContent;
 
         // Position and show the bouncy highlight adjusting the coordinates to be inside the TreeOutline's space.
@@ -301,9 +301,9 @@
                 var naturalWidth = properties[2];
                 var naturalHeight = properties[3];
                 if (offsetHeight === naturalHeight && offsetWidth === naturalWidth)
-                    this.tooltip = WebInspector.UIString("%d \xd7 %d pixels").format(offsetWidth, offsetHeight);
+                    this.tooltip = WI.UIString("%d \xd7 %d pixels").format(offsetWidth, offsetHeight);
                 else
-                    this.tooltip = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)").format(offsetWidth, offsetHeight, naturalWidth, naturalHeight);
+                    this.tooltip = WI.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)").format(offsetWidth, offsetHeight, naturalWidth, naturalHeight);
             } catch (e) {
                 console.error(e);
             }
@@ -322,7 +322,7 @@
             object.callFunction(dimensions, undefined, false, setTooltip.bind(this));
             object.release();
         }
-        WebInspector.RemoteObject.resolveNode(node, "", resolvedNode.bind(this));
+        WI.RemoteObject.resolveNode(node, "", resolvedNode.bind(this));
     }
 
     updateSelectionArea()
@@ -387,7 +387,7 @@
 
     insertChildElement(child, index, closingTag)
     {
-        var newElement = new WebInspector.DOMTreeElement(child, closingTag);
+        var newElement = new WI.DOMTreeElement(child, closingTag);
         newElement.selectable = this.treeOutline._selectEnabled;
         this.insertChild(newElement, index);
         return newElement;
@@ -525,7 +525,7 @@
                 button.className = "show-all-nodes";
                 button.value = "";
 
-                var item = new WebInspector.TreeElement(button, null, false);
+                var item = new WI.TreeElement(button, null, false);
                 item.selectable = false;
                 item.expandAllButton = true;
 
@@ -536,7 +536,7 @@
             } else if (!this.expandAllButtonElement.__treeElement.parent)
                 this.insertChild(this.expandAllButtonElement.__treeElement, targetButtonIndex);
 
-            this.expandAllButtonElement.textContent = WebInspector.UIString("Show All Nodes (%d More)").format(totalChildrenCount - expandedChildCount);
+            this.expandAllButtonElement.textContent = WI.UIString("Show All Nodes (%d More)").format(totalChildrenCount - expandedChildCount);
         } else if (this.expandAllButtonElement)
             this.expandAllButtonElement = null;
     }
@@ -544,7 +544,7 @@
     handleLoadAllChildren()
     {
         var visibleChildren = this._visibleChildren();
-        this.expandedChildrenLimit = Math.max(visibleChildren.length, this.expandedChildrenLimit + WebInspector.DOMTreeElement.InitialChildrenLimit);
+        this.expandedChildrenLimit = Math.max(visibleChildren.length, this.expandedChildrenLimit + WI.DOMTreeElement.InitialChildrenLimit);
     }
 
     onexpand()
@@ -587,7 +587,7 @@
         this.updateSelectionArea();
 
         listItemElement.addEventListener("animationend", this._boundHighlightAnimationEnd);
-        listItemElement.classList.add(WebInspector.DOMTreeElement.HighlightStyleClassName);
+        listItemElement.classList.add(WI.DOMTreeElement.HighlightStyleClassName);
     }
 
     onselect(treeElement, selectedByUser)
@@ -595,7 +595,7 @@
         this.treeOutline.suppressRevealAndSelect = true;
         this.treeOutline.selectDOMNode(this.representedObject, selectedByUser);
         if (selectedByUser)
-            WebInspector.domTreeManager.highlightDOMNode(this.representedObject.id);
+            WI.domTreeManager.highlightDOMNode(this.representedObject.id);
         this.treeOutline.updateSelection();
         this.treeOutline.suppressRevealAndSelect = false;
     }
@@ -712,24 +712,24 @@
             if (event.target && event.target.tagName === "A") {
                 let url = event.target.href;
 
-                contextMenu.appendItem(WebInspector.UIString("Open in New Tab"), () => {
+                contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
                     const frame = null;
-                    WebInspector.openURL(url, frame, {alwaysOpenExternally: true});
+                    WI.openURL(url, frame, {alwaysOpenExternally: true});
                 });
 
-                if (WebInspector.frameResourceManager.resourceForURL(url)) {
-                    contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"), () => {
-                        let frame = WebInspector.frameResourceManager.frameForIdentifier(node.frameIdentifier);
+                if (WI.frameResourceManager.resourceForURL(url)) {
+                    contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
+                        let frame = WI.frameResourceManager.frameForIdentifier(node.frameIdentifier);
 
                         const options = {
                             ignoreNetworkTab: true,
                             ignoreSearchTab: true,
                         };
-                        WebInspector.openURL(url, frame, options);
+                        WI.openURL(url, frame, options);
                     });
                 }
 
-                contextMenu.appendItem(WebInspector.UIString("Copy Link Address"), () => {
+                contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
                     InspectorFrontendHost.copyText(url);
                 });
 
@@ -738,14 +738,14 @@
 
             // Add attribute-related actions.
             if (this.editable) {
-                contextMenu.appendItem(WebInspector.UIString("Add Attribute"), this._addNewAttribute.bind(this));
+                contextMenu.appendItem(WI.UIString("Add Attribute"), this._addNewAttribute.bind(this));
                 if (attribute)
-                    contextMenu.appendItem(WebInspector.UIString("Edit Attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
+                    contextMenu.appendItem(WI.UIString("Edit Attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
                 contextMenu.appendSeparator();
             }
 
-            if (WebInspector.cssStyleManager.canForcePseudoClasses()) {
-                let pseudoSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Forced Pseudo-Classes"));
+            if (WI.cssStyleManager.canForcePseudoClasses()) {
+                let pseudoSubMenu = contextMenu.appendSubMenuItem(WI.UIString("Forced Pseudo-Classes"));
                 this._populateForcedPseudoStateItems(pseudoSubMenu);
                 contextMenu.appendSeparator();
             }
@@ -759,7 +759,7 @@
         var node = this.representedObject;
         var enabledPseudoClasses = node.enabledPseudoClasses;
         // These strings don't need to be localized as they are CSS pseudo-classes.
-        WebInspector.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass) {
+        WI.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass) {
             var label = pseudoClass.capitalize();
             var enabled = enabledPseudoClasses.includes(pseudoClass);
             subMenu.appendCheckboxItem(label, function() {
@@ -771,7 +771,7 @@
     _populateTextContextMenu(contextMenu, textNode)
     {
         if (this.editable)
-            contextMenu.appendItem(WebInspector.UIString("Edit Text"), this._startEditingTextNode.bind(this, textNode));
+            contextMenu.appendItem(WI.UIString("Edit Text"), this._startEditingTextNode.bind(this, textNode));
 
         this._populateNodeContextMenu(contextMenu);
     }
@@ -782,11 +782,11 @@
 
         // Add free-form node-related actions.
         if (this.editable)
-            contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._editAsHTML.bind(this));
+            contextMenu.appendItem(WI.UIString("Edit as HTML"), this._editAsHTML.bind(this));
         if (!node.isPseudoElement())
-            contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
+            contextMenu.appendItem(WI.UIString("Copy as HTML"), this._copyHTML.bind(this));
         if (this.editable)
-            contextMenu.appendItem(WebInspector.UIString("Delete Node"), this.remove.bind(this));
+            contextMenu.appendItem(WI.UIString("Delete Node"), this.remove.bind(this));
     }
 
     _startEditing()
@@ -848,7 +848,7 @@
 
     _startEditingAttribute(attribute, elementForSelection)
     {
-        if (WebInspector.isBeingEdited(attribute))
+        if (WI.isBeingEdited(attribute))
             return true;
 
         var attributeNameElement = attribute.getElementsByClassName("html-attribute-name")[0];
@@ -874,9 +874,9 @@
         // Remove zero-width spaces that were added by nodeTitleInfo.
         removeZeroWidthSpaceRecursive(attribute);
 
-        var config = new WebInspector.EditingConfig(this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName);
+        var config = new WI.EditingConfig(this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName);
         config.setNumberCommitHandler(this._attributeNumberEditingCommitted.bind(this));
-        this._editing = WebInspector.startEditing(attribute, config);
+        this._editing = WI.startEditing(attribute, config);
 
         window.getSelection().setBaseAndExtent(elementForSelection, 0, elementForSelection, 1);
 
@@ -885,12 +885,12 @@
 
     _startEditingTextNode(textNode)
     {
-        if (WebInspector.isBeingEdited(textNode))
+        if (WI.isBeingEdited(textNode))
             return true;
 
-        var config = new WebInspector.EditingConfig(this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this));
+        var config = new WI.EditingConfig(this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this));
         config.spellcheck = true;
-        this._editing = WebInspector.startEditing(textNode, config);
+        this._editing = WI.startEditing(textNode, config);
         window.getSelection().setBaseAndExtent(textNode, 0, textNode, 1);
 
         return true;
@@ -905,10 +905,10 @@
         }
 
         var tagName = tagNameElement.textContent;
-        if (WebInspector.DOMTreeElement.EditTagBlacklist[tagName.toLowerCase()])
+        if (WI.DOMTreeElement.EditTagBlacklist[tagName.toLowerCase()])
             return false;
 
-        if (WebInspector.isBeingEdited(tagNameElement))
+        if (WI.isBeingEdited(tagNameElement))
             return true;
 
         let closingTagElement = this._distinctClosingTagElement();
@@ -937,8 +937,8 @@
 
         tagNameElement.addEventListener("keyup", keyupListener, false);
 
-        var config = new WebInspector.EditingConfig(editingComitted.bind(this), editingCancelled.bind(this), tagName);
-        this._editing = WebInspector.startEditing(tagNameElement, config);
+        var config = new WI.EditingConfig(editingComitted.bind(this), editingCancelled.bind(this), tagName);
+        this._editing = WI.startEditing(tagNameElement, config);
         window.getSelection().setBaseAndExtent(tagNameElement, 0, tagNameElement, 1);
         return true;
     }
@@ -947,7 +947,7 @@
     {
         if (error)
             return;
-        if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement))
+        if (this._htmlEditElement && WI.isBeingEdited(this._htmlEditElement))
             return;
 
         this._htmlEditElement = document.createElement("div");
@@ -993,9 +993,9 @@
             this.updateSelectionArea();
         }
 
-        var config = new WebInspector.EditingConfig(commit.bind(this), dispose.bind(this));
+        var config = new WI.EditingConfig(commit.bind(this), dispose.bind(this));
         config.setMultiline(true);
-        this._editing = WebInspector.startEditing(this._htmlEditElement, config);
+        this._editing = WI.startEditing(this._htmlEditElement, config);
     }
 
     _attributeEditingCommitted(element, newText, oldText, attributeName, moveDirection)
@@ -1114,7 +1114,7 @@
                 return;
             }
 
-            var node = WebInspector.domTreeManager.nodeForId(nodeId);
+            var node = WI.domTreeManager.nodeForId(nodeId);
 
             // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
             treeOutline._updateModifiedNodes();
@@ -1306,13 +1306,13 @@
             case Node.DOCUMENT_FRAGMENT_NODE:
                 var fragmentElement = info.titleDOM.createChild("span", "html-fragment");
                 if (node.shadowRootType()) {
-                    fragmentElement.textContent = WebInspector.UIString("Shadow Content (%s)").format(WebInspector.DOMTreeElement.shadowRootTypeDisplayName(node.shadowRootType()));
+                    fragmentElement.textContent = WI.UIString("Shadow Content (%s)").format(WI.DOMTreeElement.shadowRootTypeDisplayName(node.shadowRootType()));
                     this.listItemElement.classList.add("shadow");
                 } else if (node.parentNode && node.parentNode.templateContent() === node) {
-                    fragmentElement.textContent = WebInspector.UIString("Template Content");
+                    fragmentElement.textContent = WI.UIString("Template Content");
                     this.listItemElement.classList.add("template");
                 } else {
-                    fragmentElement.textContent = WebInspector.UIString("Document Fragment");
+                    fragmentElement.textContent = WI.UIString("Document Fragment");
                     this.listItemElement.classList.add("fragment");
                 }
                 break;
@@ -1341,9 +1341,9 @@
                 this._buildTagDOM(info.titleDOM, tagName, false, false);
 
                 var textChild = this._singleTextChild(node);
-                var showInlineText = textChild && textChild.nodeValue().length < WebInspector.DOMTreeElement.MaximumInlineTextChildLength;
+                var showInlineText = textChild && textChild.nodeValue().length < WI.DOMTreeElement.MaximumInlineTextChildLength;
 
-                if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WebInspector.DOMTreeElement.ForbiddenClosingTagElements[tagName]))) {
+                if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WI.DOMTreeElement.ForbiddenClosingTagElements[tagName]))) {
                     if (this.hasChildren) {
                         var textNodeElement = info.titleDOM.createChild("span", "html-text-node");
                         textNodeElement.textContent = ellipsis;
@@ -1360,9 +1360,9 @@
                     var nodeNameLowerCase = node.nodeName().toLowerCase();
 
                     if (nodeNameLowerCase === "script")
-                        textNodeElement.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(), "text/javascript"));
+                        textNodeElement.appendChild(WI.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(), "text/javascript"));
                     else if (nodeNameLowerCase === "style")
-                        textNodeElement.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(), "text/css"));
+                        textNodeElement.appendChild(WI.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(), "text/css"));
                     else
                         textNodeElement.textContent = textChild.nodeValue();
 
@@ -1376,10 +1376,10 @@
             case Node.TEXT_NODE:
                 if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
                     var newNode = info.titleDOM.createChild("span", "html-text-node large");
-                    newNode.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(), "text/javascript"));
+                    newNode.appendChild(WI.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(), "text/javascript"));
                 } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
                     var newNode = info.titleDOM.createChild("span", "html-text-node large");
-                    newNode.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(), "text/css"));
+                    newNode.appendChild(WI.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(), "text/css"));
                 } else {
                     info.titleDOM.append("\"");
                     var textNodeElement = info.titleDOM.createChild("span", "html-text-node");
@@ -1450,7 +1450,7 @@
     {
         if (node.nodeType() === Node.ELEMENT_NODE) {
             var textChild = this._singleTextChild(node);
-            if (textChild && textChild.nodeValue().length < WebInspector.DOMTreeElement.MaximumInlineTextChildLength)
+            if (textChild && textChild.nodeValue().length < WI.DOMTreeElement.MaximumInlineTextChildLength)
                 return true;
         }
         return false;
@@ -1586,7 +1586,7 @@
             matchRanges.push({offset: 0, length: text.length});
 
         this._highlightResult = [];
-        WebInspector.highlightRangesWithStyleClass(this.title, matchRanges, WebInspector.DOMTreeElement.SearchHighlightStyleClassName, this._highlightResult);
+        WI.highlightRangesWithStyleClass(this.title, matchRanges, WI.DOMTreeElement.SearchHighlightStyleClassName, this._highlightResult);
     }
 
     _markNodeChanged()
@@ -1647,7 +1647,7 @@
         if (!listItemElement)
             return;
 
-        let hasBreakpoint = this._breakpointStatus !== WebInspector.DOMTreeElement.BreakpointStatus.None;
+        let hasBreakpoint = this._breakpointStatus !== WI.DOMTreeElement.BreakpointStatus.None;
         let hasSubtreeBreakpoints = !!this._subtreeBreakpointCount;
 
         if (!hasBreakpoint && !hasSubtreeBreakpoints) {
@@ -1668,19 +1668,19 @@
 
         this.listItemElement.insertBefore(this._statusImageElement, this.listItemElement.firstChild);
 
-        let disabled = this._breakpointStatus === WebInspector.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;
+        let disabled = this._breakpointStatus === WI.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;
         this._statusImageElement.classList.toggle("disabled", disabled);
     }
 
     _statusImageClicked(event)
     {
-        if (this._breakpointStatus === WebInspector.DOMTreeElement.BreakpointStatus.None)
+        if (this._breakpointStatus === WI.DOMTreeElement.BreakpointStatus.None)
             return;
 
         if (event.button !== 0 || event.ctrlKey)
             return;
 
-        let breakpoints = WebInspector.domDebuggerManager.domBreakpointsForNode(this.representedObject);
+        let breakpoints = WI.domDebuggerManager.domBreakpointsForNode(this.representedObject);
         if (!breakpoints || !breakpoints.length)
             return;
 
@@ -1690,20 +1690,20 @@
 
     _statusImageContextmenu(event)
     {
-        let hasBreakpoint = this._breakpointStatus !== WebInspector.DOMTreeElement.BreakpointStatus.None;
+        let hasBreakpoint = this._breakpointStatus !== WI.DOMTreeElement.BreakpointStatus.None;
         let hasSubtreeBreakpoints = !!this._subtreeBreakpointCount;
         if (!hasBreakpoint && !hasSubtreeBreakpoints)
             return;
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
         if (hasBreakpoint) {
             const allowEditing = true;
-            WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu, this.representedObject, allowEditing);
+            WI.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu, this.representedObject, allowEditing);
             return;
         }
 
-        contextMenu.appendItem(WebInspector.UIString("Reveal Breakpoint"), () => {
-            let breakpointTreeElement = this.selfOrDescendant((treeElement) => treeElement.breakpointStatus && treeElement.breakpointStatus !== WebInspector.DOMTreeElement.BreakpointStatus.None);
+        contextMenu.appendItem(WI.UIString("Reveal Breakpoint"), () => {
+            let breakpointTreeElement = this.selfOrDescendant((treeElement) => treeElement.breakpointStatus && treeElement.breakpointStatus !== WI.DOMTreeElement.BreakpointStatus.None);
             console.assert(breakpointTreeElement, "Missing breakpoint descendant.", this);
             if (!breakpointTreeElement)
                 return;
@@ -1719,38 +1719,38 @@
             return;
 
         listItemElement.removeEventListener("animationend", this._boundHighlightAnimationEnd);
-        listItemElement.classList.remove(WebInspector.DOMTreeElement.HighlightStyleClassName);
+        listItemElement.classList.remove(WI.DOMTreeElement.HighlightStyleClassName);
 
         this._animatingHighlight = false;
     }
 };
 
-WebInspector.DOMTreeElement.InitialChildrenLimit = 500;
-WebInspector.DOMTreeElement.MaximumInlineTextChildLength = 80;
+WI.DOMTreeElement.InitialChildrenLimit = 500;
+WI.DOMTreeElement.MaximumInlineTextChildLength = 80;
 
 // A union of HTML4 and HTML5-Draft elements that explicitly
 // or implicitly (for HTML5) forbid the closing tag.
-WebInspector.DOMTreeElement.ForbiddenClosingTagElements = [
+WI.DOMTreeElement.ForbiddenClosingTagElements = [
     "area", "base", "basefont", "br", "canvas", "col", "command", "embed", "frame",
     "hr", "img", "input", "keygen", "link", "meta", "param", "source",
     "wbr", "track", "menuitem"
 ].keySet();
 
 // These tags we do not allow editing their tag name.
-WebInspector.DOMTreeElement.EditTagBlacklist = [
+WI.DOMTreeElement.EditTagBlacklist = [
     "html", "head", "body"
 ].keySet();
 
-WebInspector.DOMTreeElement.ChangeType = {
+WI.DOMTreeElement.ChangeType = {
     Attribute: "dom-tree-element-change-type-attribute"
 };
 
-WebInspector.DOMTreeElement.BreakpointStatus = {
+WI.DOMTreeElement.BreakpointStatus = {
     None: Symbol("none"),
     Breakpoint: Symbol("breakpoint"),
     DisabledBreakpoint: Symbol("disabled-breakpoint"),
 };
 
-WebInspector.DOMTreeElement.HighlightStyleClassName = "highlight";
-WebInspector.DOMTreeElement.SearchHighlightStyleClassName = "search-highlight";
-WebInspector.DOMTreeElement.BouncyHighlightStyleClassName = "bouncy-highlight";
+WI.DOMTreeElement.HighlightStyleClassName = "highlight";
+WI.DOMTreeElement.SearchHighlightStyleClassName = "search-highlight";
+WI.DOMTreeElement.BouncyHighlightStyleClassName = "bouncy-highlight";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElementPathComponent.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElementPathComponent.js
index 212aa9f..9ea1ed9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElementPathComponent.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElementPathComponent.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeElementPathComponent = class DOMTreeElementPathComponent extends WebInspector.HierarchicalPathComponent
+WI.DOMTreeElementPathComponent = class DOMTreeElementPathComponent extends WI.HierarchicalPathComponent
 {
     constructor(domTreeElement, representedObject)
     {
@@ -35,45 +35,45 @@
         switch (node.nodeType()) {
         case Node.ELEMENT_NODE:
             if (node.isPseudoElement()) {
-                className = WebInspector.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName;
+                className = WI.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName;
                 title = "::" + node.pseudoType();
             } else {
-                className = WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
+                className = WI.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
                 title = node.displayName;
             }
             break;
 
         case Node.TEXT_NODE:
-            className = WebInspector.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName;
             title = "\"" + node.nodeValue().trimEnd(32) + "\"";
             break;
 
         case Node.COMMENT_NODE:
-            className = WebInspector.DOMTreeElementPathComponent.DOMCommentIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMCommentIconStyleClassName;
             title = "<!--" + node.nodeValue().trimEnd(32) + "-->";
             break;
 
         case Node.DOCUMENT_TYPE_NODE:
-            className = WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;
             title = "<!DOCTYPE>";
             break;
 
         case Node.DOCUMENT_NODE:
-            className = WebInspector.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName;
             title = node.nodeNameInCorrectCase();
             break;
 
         case Node.CDATA_SECTION_NODE:
-            className = WebInspector.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName;
             title = "<![CDATA[" + node.trimEnd(32) + "]]>";
             break;
 
         case Node.DOCUMENT_FRAGMENT_NODE:
             // FIXME: At some point we might want a different icon for this.
             // <rdar://problem/12800950> Need icon for DOCUMENT_FRAGMENT_NODE and PROCESSING_INSTRUCTION_NODE
-            className = WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;
             if (node.shadowRootType())
-                title = WebInspector.UIString("Shadow Content");
+                title = WI.UIString("Shadow Content");
             else
                 title = node.displayName;
             break;
@@ -81,13 +81,13 @@
         case Node.PROCESSING_INSTRUCTION_NODE:
             // FIXME: At some point we might want a different icon for this.
             // <rdar://problem/12800950> Need icon for DOCUMENT_FRAGMENT_NODE and PROCESSING_INSTRUCTION_NODE.
-            className = WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;
             title = node.nodeNameInCorrectCase();
             break;
 
         default:
             console.error("Unknown DOM node type: ", node.nodeType());
-            className = WebInspector.DOMTreeElementPathComponent.DOMNodeIconStyleClassName;
+            className = WI.DOMTreeElementPathComponent.DOMNodeIconStyleClassName;
             title = node.nodeNameInCorrectCase();
         }
 
@@ -107,7 +107,7 @@
     {
         if (!this._domTreeElement.previousSibling)
             return null;
-        return new WebInspector.DOMTreeElementPathComponent(this._domTreeElement.previousSibling);
+        return new WI.DOMTreeElementPathComponent(this._domTreeElement.previousSibling);
     }
 
     get nextSibling()
@@ -116,7 +116,7 @@
             return null;
         if (this._domTreeElement.nextSibling.isCloseTag())
             return null;
-        return new WebInspector.DOMTreeElementPathComponent(this._domTreeElement.nextSibling);
+        return new WI.DOMTreeElementPathComponent(this._domTreeElement.nextSibling);
     }
 
     // Protected
@@ -124,20 +124,20 @@
     mouseOver()
     {
         var nodeId = this._domTreeElement.representedObject.id;
-        WebInspector.domTreeManager.highlightDOMNode(nodeId);
+        WI.domTreeManager.highlightDOMNode(nodeId);
     }
 
     mouseOut()
     {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
     }
 };
 
-WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName = "dom-element-icon";
-WebInspector.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName = "dom-pseudo-element-icon";
-WebInspector.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName = "dom-text-node-icon";
-WebInspector.DOMTreeElementPathComponent.DOMCommentIconStyleClassName = "dom-comment-icon";
-WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName = "dom-document-type-icon";
-WebInspector.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName = "dom-document-icon";
-WebInspector.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName = "dom-character-data-icon";
-WebInspector.DOMTreeElementPathComponent.DOMNodeIconStyleClassName = "dom-node-icon";
+WI.DOMTreeElementPathComponent.DOMElementIconStyleClassName = "dom-element-icon";
+WI.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName = "dom-pseudo-element-icon";
+WI.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName = "dom-text-node-icon";
+WI.DOMTreeElementPathComponent.DOMCommentIconStyleClassName = "dom-comment-icon";
+WI.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName = "dom-document-type-icon";
+WI.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName = "dom-document-icon";
+WI.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName = "dom-character-data-icon";
+WI.DOMTreeElementPathComponent.DOMNodeIconStyleClassName = "dom-node-icon";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
index 6f975b7..d713bfc5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
@@ -28,7 +28,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeOutline = class DOMTreeOutline extends WebInspector.TreeOutline
+WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline
 {
     constructor(omitRootDOMNode, selectEnabled, excludeRevealElementContextMenu)
     {
@@ -43,7 +43,7 @@
         this.element.addEventListener("drop", this._ondrop.bind(this), false);
         this.element.addEventListener("dragend", this._ondragend.bind(this), false);
 
-        this.element.classList.add("dom", WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add("dom", WI.SyntaxHighlightedStyleClassName);
 
         this._includeRootDOMNode = !omitRootDOMNode;
         this._selectEnabled = selectEnabled;
@@ -55,22 +55,22 @@
         this._editing = false;
         this._visible = false;
 
-        this._hideElementKeyboardShortcut = new WebInspector.KeyboardShortcut(null, "H", this._hideElement.bind(this), this.element);
+        this._hideElementKeyboardShortcut = new WI.KeyboardShortcut(null, "H", this._hideElement.bind(this), this.element);
         this._hideElementKeyboardShortcut.implicitlyPreventsDefault = false;
 
-        WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
+        WI.showShadowDOMSetting.addEventListener(WI.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
     }
 
     // Public
 
     wireToDomAgent()
     {
-        this._elementsTreeUpdater = new WebInspector.DOMTreeUpdater(this);
+        this._elementsTreeUpdater = new WI.DOMTreeUpdater(this);
     }
 
     close()
     {
-        WebInspector.showShadowDOMSetting.removeEventListener(null, null, this);
+        WI.showShadowDOMSetting.removeEventListener(null, null, this);
 
         if (this._elementsTreeUpdater) {
             this._elementsTreeUpdater.close();
@@ -164,14 +164,14 @@
 
         var treeElement;
         if (this._includeRootDOMNode) {
-            treeElement = new WebInspector.DOMTreeElement(this.rootDOMNode);
+            treeElement = new WI.DOMTreeElement(this.rootDOMNode);
             treeElement.selectable = this._selectEnabled;
             this.appendChild(treeElement);
         } else {
             // FIXME: this could use findTreeElement to reuse a tree element if it already exists
             var node = this.rootDOMNode.firstChild;
             while (node) {
-                treeElement = new WebInspector.DOMTreeElement(node);
+                treeElement = new WI.DOMTreeElement(node);
                 treeElement.selectable = this._selectEnabled;
                 this.appendChild(treeElement);
                 node = node.nextSibling;
@@ -197,7 +197,7 @@
 
     _selectedNodeChanged()
     {
-        this.dispatchEventToListeners(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged);
+        this.dispatchEventToListeners(WI.DOMTreeOutline.Event.SelectedNodeChanged);
     }
 
     findTreeElement(node)
@@ -251,7 +251,7 @@
             treeElement._populateNodeContextMenu(contextMenu);
 
         const options = {excludeRevealElement: this._excludeRevealElementContextMenu};
-        WebInspector.appendContextMenuItemsForDOMNode(contextMenu, treeElement.representedObject, options);
+        WI.appendContextMenuItemsForDOMNode(contextMenu, treeElement.representedObject, options);
 
         super.populateContextMenu(contextMenu, event, treeElement);
     }
@@ -267,7 +267,7 @@
         if (!node || this._suppressRevealAndSelect)
             return;
 
-        if (!WebInspector.showShadowDOMSetting.value) {
+        if (!WI.showShadowDOMSetting.value) {
             while (node && node.isInShadowTree())
                 node = node.parentNode;
             if (!node)
@@ -312,7 +312,7 @@
                 element._createTooltipForNode();
         }
 
-        WebInspector.domTreeManager.highlightDOMNode(element ? element.representedObject.id : 0);
+        WI.domTreeManager.highlightDOMNode(element ? element.representedObject.id : 0);
     }
 
     _onmouseout(event)
@@ -326,7 +326,7 @@
             this._previousHoveredElement = null;
         }
 
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
     }
 
     _ondragstart(event)
@@ -345,14 +345,14 @@
         event.dataTransfer.effectAllowed = "copyMove";
         this._nodeBeingDragged = treeElement.representedObject;
 
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
 
         return true;
     }
 
     _ondragover(event)
     {
-        if (event.dataTransfer.types.includes(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType)) {
+        if (event.dataTransfer.types.includes(WI.CSSStyleDetailsSidebarPanel.ToggledClassesDragType)) {
             event.preventDefault();
             event.dataTransfer.dropEffect = "copy";
             return false;
@@ -394,7 +394,7 @@
             return false;
 
         var node = treeElement.representedObject;
-        if (!(node instanceof WebInspector.DOMNode))
+        if (!(node instanceof WI.DOMNode))
             return false;
 
         if (!node.parentNode || node.parentNode.nodeType() !== Node.ELEMENT_NODE)
@@ -413,7 +413,7 @@
                 return;
 
             this._updateModifiedNodes();
-            var newNode = WebInspector.domTreeManager.nodeForId(newNodeId);
+            var newNode = WI.domTreeManager.nodeForId(newNodeId);
             if (newNode)
                 this.selectDOMNode(newNode, true);
         }
@@ -434,7 +434,7 @@
 
             this._nodeBeingDragged.moveTo(parentNode, anchorNode, callback.bind(this));
         } else {
-            let className = event.dataTransfer.getData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType);
+            let className = event.dataTransfer.getData(WI.CSSStyleDetailsSidebarPanel.ToggledClassesDragType);
             if (className && treeElement)
                 treeElement.representedObject.toggleClass(className, true);
         }
@@ -485,7 +485,7 @@
 
     _hideElement(event, keyboardShortcut)
     {
-        if (!this.selectedTreeElement || WebInspector.isEditingAnyField())
+        if (!this.selectedTreeElement || WI.isEditingAnyField())
             return;
 
         event.preventDefault();
@@ -528,10 +528,10 @@
             object.release();
         }
 
-        WebInspector.RemoteObject.resolveNode(effectiveNode, "", resolvedNode);
+        WI.RemoteObject.resolveNode(effectiveNode, "", resolvedNode);
     }
 };
 
-WebInspector.DOMTreeOutline.Event = {
+WI.DOMTreeOutline.Event = {
     SelectedNodeChanged: "dom-tree-outline-selected-node-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js
index 83f7ae7..1c8b15d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js
@@ -28,15 +28,15 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeUpdater = function(treeOutline)
+WI.DOMTreeUpdater = function(treeOutline)
 {
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeInserted, this._nodeInserted, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified, this._attributesUpdated, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved, this._attributesUpdated, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified, this._characterDataModified, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated, this._documentUpdated, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeInserted, this._nodeInserted, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.AttributeModified, this._attributesUpdated, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.AttributeRemoved, this._attributesUpdated, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.CharacterDataModified, this._characterDataModified, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.DocumentUpdated, this._documentUpdated, this);
+    WI.domTreeManager.addEventListener(WI.DOMTreeManager.Event.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
 
     this._treeOutline = treeOutline;
 
@@ -50,10 +50,10 @@
     this._textContentAttributeSymbol = Symbol("text-content-attribute");
 };
 
-WebInspector.DOMTreeUpdater.prototype = {
+WI.DOMTreeUpdater.prototype = {
     close: function()
     {
-        WebInspector.domTreeManager.removeEventListener(null, null, this);
+        WI.domTreeManager.removeEventListener(null, null, this);
     },
 
     _documentUpdated: function(event)
@@ -149,7 +149,7 @@
 
     _reset: function()
     {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
 
         this._recentlyInsertedNodes.clear();
         this._recentlyDeletedNodes.clear();
diff --git a/Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.js b/Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.js
index 13c585e..3973070 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DashboardContainerView = class DashboardContainerView extends WebInspector.Object
+WI.DashboardContainerView = class DashboardContainerView extends WI.Object
 {
     constructor()
     {
         super();
 
-        this._toolbarItem = new WebInspector.NavigationItem("dashboard-container", "group", WebInspector.UIString("Activity Viewer"));
+        this._toolbarItem = new WI.NavigationItem("dashboard-container", "group", WI.UIString("Activity Viewer"));
 
         this._advanceForwardArrowElement = this._toolbarItem.element.appendChild(document.createElement("div"));
         this._advanceForwardArrowElement.className = "advance-arrow advance-forward";
@@ -111,16 +111,16 @@
 
     _dismissAdvanceArrows()
     {
-        this._advanceForwardArrowElement.classList.add(WebInspector.DashboardContainerView.InactiveStyleClassName);
-        this._advanceBackwardArrowElement.classList.add(WebInspector.DashboardContainerView.InactiveStyleClassName);
+        this._advanceForwardArrowElement.classList.add(WI.DashboardContainerView.InactiveStyleClassName);
+        this._advanceBackwardArrowElement.classList.add(WI.DashboardContainerView.InactiveStyleClassName);
     }
 
     _updateAdvanceArrowVisibility()
     {
         var canAdvanceForward = this._currentIndex < this._dashboardStack.length - 1;
         var canAdvanceBackward = this._currentIndex > 0;
-        this._advanceForwardArrowElement.classList.toggle(WebInspector.DashboardContainerView.InactiveStyleClassName, !canAdvanceForward);
-        this._advanceBackwardArrowElement.classList.toggle(WebInspector.DashboardContainerView.InactiveStyleClassName, !canAdvanceBackward);
+        this._advanceForwardArrowElement.classList.toggle(WI.DashboardContainerView.InactiveStyleClassName, !canAdvanceForward);
+        this._advanceBackwardArrowElement.classList.toggle(WI.DashboardContainerView.InactiveStyleClassName, !canAdvanceBackward);
     }
 
     _dashboardViewForRepresentedObject(representedObject, onlyReturnExistingViews)
@@ -137,7 +137,7 @@
             return null;
 
         // No existing content view found, make a new one.
-        dashboardView = WebInspector.DashboardView.create(representedObject);
+        dashboardView = WI.DashboardView.create(representedObject);
 
         console.assert(dashboardView, "Unknown representedObject", representedObject);
         if (!dashboardView)
@@ -158,10 +158,10 @@
 
         var advanceDirection = null;
         if (this._currentIndex < index)
-            advanceDirection = WebInspector.DashboardContainerView.AdvanceDirection.Forward;
+            advanceDirection = WI.DashboardContainerView.AdvanceDirection.Forward;
         else
-            advanceDirection = WebInspector.DashboardContainerView.AdvanceDirection.Backward;
-        var initialDirection = WebInspector.DashboardContainerView.AdvanceDirection.None;
+            advanceDirection = WI.DashboardContainerView.AdvanceDirection.Backward;
+        var initialDirection = WI.DashboardContainerView.AdvanceDirection.None;
         var isInitialDashboard = this._currentIndex === -1;
         if (!isInitialDashboard)
             this._hideDashboardView(this.currentDashboardView, advanceDirection);
@@ -172,19 +172,19 @@
 
     _showDashboardView(dashboardView, advanceDirection)
     {
-        console.assert(dashboardView instanceof WebInspector.DashboardView);
+        console.assert(dashboardView instanceof WI.DashboardView);
 
         dashboardView.shown();
         this._dismissAdvanceArrows();
 
         var animationClass = null;
-        if (advanceDirection === WebInspector.DashboardContainerView.AdvanceDirection.Forward)
-            animationClass = WebInspector.DashboardContainerView.ForwardIncomingDashboardStyleClassName;
-        if (advanceDirection === WebInspector.DashboardContainerView.AdvanceDirection.Backward)
-            animationClass = WebInspector.DashboardContainerView.BackwardIncomingDashboardStyleClassName;
+        if (advanceDirection === WI.DashboardContainerView.AdvanceDirection.Forward)
+            animationClass = WI.DashboardContainerView.ForwardIncomingDashboardStyleClassName;
+        if (advanceDirection === WI.DashboardContainerView.AdvanceDirection.Backward)
+            animationClass = WI.DashboardContainerView.BackwardIncomingDashboardStyleClassName;
 
         var container = this;
-        dashboardView.element.classList.add(WebInspector.DashboardContainerView.VisibleDashboardStyleClassName);
+        dashboardView.element.classList.add(WI.DashboardContainerView.VisibleDashboardStyleClassName);
 
         function animationEnded(event) {
             if (event.target !== dashboardView.element)
@@ -205,17 +205,17 @@
 
     _hideDashboardView(dashboardView, advanceDirection, callback)
     {
-        console.assert(dashboardView instanceof WebInspector.DashboardView);
+        console.assert(dashboardView instanceof WI.DashboardView);
         console.assert(this.currentDashboardView === dashboardView);
 
         dashboardView.hidden();
         this._dismissAdvanceArrows();
 
         var animationClass = null;
-        if (advanceDirection === WebInspector.DashboardContainerView.AdvanceDirection.Forward)
-            animationClass = WebInspector.DashboardContainerView.ForwardOutgoingDashboardStyleClassName;
-        if (advanceDirection === WebInspector.DashboardContainerView.AdvanceDirection.Backward)
-            animationClass = WebInspector.DashboardContainerView.BackwardOutgoingDashboardStyleClassName;
+        if (advanceDirection === WI.DashboardContainerView.AdvanceDirection.Forward)
+            animationClass = WI.DashboardContainerView.ForwardOutgoingDashboardStyleClassName;
+        if (advanceDirection === WI.DashboardContainerView.AdvanceDirection.Backward)
+            animationClass = WI.DashboardContainerView.BackwardOutgoingDashboardStyleClassName;
 
         var container = this;
 
@@ -225,7 +225,7 @@
 
             dashboardView.element.removeEventListener("animationend", animationEnded);
             dashboardView.element.classList.remove(animationClass);
-            dashboardView.element.classList.remove(WebInspector.DashboardContainerView.VisibleDashboardStyleClassName);
+            dashboardView.element.classList.remove(WI.DashboardContainerView.VisibleDashboardStyleClassName);
             container._updateAdvanceArrowVisibility();
 
             if (typeof callback === "function")
@@ -236,12 +236,12 @@
             dashboardView.element.classList.add(animationClass);
             dashboardView.element.addEventListener("animationend", animationEnded);
         } else
-            dashboardView.element.classList.remove(WebInspector.DashboardContainerView.VisibleDashboardStyleClassName);
+            dashboardView.element.classList.remove(WI.DashboardContainerView.VisibleDashboardStyleClassName);
     }
 
     _closeDashboardView(dashboardView)
     {
-        console.assert(dashboardView instanceof WebInspector.DashboardView);
+        console.assert(dashboardView instanceof WI.DashboardView);
 
         function dissociateDashboardView() {
             dashboardView.closed();
@@ -251,7 +251,7 @@
         var index = this._dashboardStack.indexOf(dashboardView);
 
         if (this.currentDashboardView === dashboardView) {
-            var direction = WebInspector.DashboardContainerView.AdvanceDirection.Backward;
+            var direction = WI.DashboardContainerView.AdvanceDirection.Backward;
             this._hideDashboardView(this.currentDashboardView, direction, dissociateDashboardView);
             this._dashboardStack.splice(index, 1);
             --this._currentIndex;
@@ -268,16 +268,16 @@
     }
 };
 
-WebInspector.DashboardContainerView.VisibleDashboardStyleClassName = "visible";
-WebInspector.DashboardContainerView.InactiveStyleClassName = "inactive";
+WI.DashboardContainerView.VisibleDashboardStyleClassName = "visible";
+WI.DashboardContainerView.InactiveStyleClassName = "inactive";
 
-WebInspector.DashboardContainerView.AdvanceDirection = {
+WI.DashboardContainerView.AdvanceDirection = {
     Forward: Symbol("dashboard-container-view-advance-direction-forward"),
     Backward: Symbol("dashboard-container-view-advance-direction-backward"),
     None: Symbol("dashboard-container-view-advance-direction-none")
 };
 
-WebInspector.DashboardContainerView.ForwardIncomingDashboardStyleClassName = "slide-in-down";
-WebInspector.DashboardContainerView.BackwardIncomingDashboardStyleClassName = "slide-in-up";
-WebInspector.DashboardContainerView.ForwardOutgoingDashboardStyleClassName = "slide-out-down";
-WebInspector.DashboardContainerView.BackwardOutgoingDashboardStyleClassName = "slide-out-up";
+WI.DashboardContainerView.ForwardIncomingDashboardStyleClassName = "slide-in-down";
+WI.DashboardContainerView.BackwardIncomingDashboardStyleClassName = "slide-in-up";
+WI.DashboardContainerView.ForwardOutgoingDashboardStyleClassName = "slide-out-down";
+WI.DashboardContainerView.BackwardOutgoingDashboardStyleClassName = "slide-out-up";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DashboardView.js b/Source/WebInspectorUI/UserInterface/Views/DashboardView.js
index f6f57a5..0f45cba 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DashboardView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DashboardView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DashboardView = class DashboardView extends WebInspector.Object
+WI.DashboardView = class DashboardView extends WI.Object
 {
     constructor(representedObject, identifier)
     {
@@ -44,11 +44,11 @@
     {
         console.assert(representedObject);
 
-        if (representedObject instanceof WebInspector.DefaultDashboard)
-            return new WebInspector.DefaultDashboardView(representedObject);
+        if (representedObject instanceof WI.DefaultDashboard)
+            return new WI.DefaultDashboardView(representedObject);
 
-        if (representedObject instanceof WebInspector.DebuggerDashboard)
-            return new WebInspector.DebuggerDashboardView(representedObject);
+        if (representedObject instanceof WI.DebuggerDashboard)
+            return new WI.DebuggerDashboardView(representedObject);
 
         throw "Can't make a DashboardView for an unknown representedObject.";
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/DataGrid.js b/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
index 18c9581..2b41bce 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DataGrid.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DataGrid = class DataGrid extends WebInspector.View
+WI.DataGrid = class DataGrid extends WI.View
 {
     constructor(columnsData, editCallback, deleteCallback, preferredColumnOrder)
     {
@@ -35,7 +35,7 @@
         this._settingsIdentifier = null;
         this._sortColumnIdentifier = null;
         this._sortColumnIdentifierSetting = null;
-        this._sortOrder = WebInspector.DataGrid.SortOrder.Indeterminate;
+        this._sortOrder = WI.DataGrid.SortOrder.Indeterminate;
         this._sortOrderSetting = null;
         this._columnVisibilitySetting = null;
         this._columnChooserEnabled = false;
@@ -145,7 +145,7 @@
         if (this._scrollbarWidth === scrollbarWidth)
             return;
 
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             this._headerWrapperElement.style.setProperty("padding-left", `${scrollbarWidth}px`);
         else
             this._headerWrapperElement.style.setProperty("padding-right", `${scrollbarWidth}px`);
@@ -168,13 +168,13 @@
             };
         }
 
-        var dataGrid = new WebInspector.DataGrid(columnsData, undefined, undefined, columnNames);
+        var dataGrid = new WI.DataGrid(columnsData, undefined, undefined, columnNames);
         for (var i = 0; i < values.length / numColumns; ++i) {
             var data = {};
             for (var j = 0; j < columnNames.length; ++j)
                 data[columnNames[j]] = values[numColumns * i + j];
 
-            var node = new WebInspector.DataGridNode(data, false);
+            var node = new WI.DataGridNode(data, false);
             dataGrid.appendChild(node);
         }
 
@@ -208,9 +208,9 @@
             dataGrid.sortNodes(comparator);
         }
 
-        dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, sortDataGrid, this);
+        dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, sortDataGrid, this);
 
-        dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         dataGrid.sortColumnIdentifier = columnNames[0];
 
         return dataGrid;
@@ -260,10 +260,10 @@
 
         var sortHeaderCellElement = this._headerTableCellElements.get(this._sortColumnIdentifier);
 
-        sortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnAscendingStyleClassName, this._sortOrder === WebInspector.DataGrid.SortOrder.Ascending);
-        sortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnDescendingStyleClassName, this._sortOrder === WebInspector.DataGrid.SortOrder.Descending);
+        sortHeaderCellElement.classList.toggle(WI.DataGrid.SortColumnAscendingStyleClassName, this._sortOrder === WI.DataGrid.SortOrder.Ascending);
+        sortHeaderCellElement.classList.toggle(WI.DataGrid.SortColumnDescendingStyleClassName, this._sortOrder === WI.DataGrid.SortOrder.Descending);
 
-        this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);
+        this.dispatchEventToListeners(WI.DataGrid.Event.SortChanged);
     }
 
     get sortColumnIdentifier()
@@ -364,9 +364,9 @@
 
         this._settingsIdentifier = identifier;
 
-        this._sortColumnIdentifierSetting = new WebInspector.Setting(this._settingsIdentifier + "-sort", this._sortColumnIdentifier);
-        this._sortOrderSetting = new WebInspector.Setting(this._settingsIdentifier + "-sort-order", this._sortOrder);
-        this._columnVisibilitySetting = new WebInspector.Setting(this._settingsIdentifier + "-column-visibility", {});
+        this._sortColumnIdentifierSetting = new WI.Setting(this._settingsIdentifier + "-sort", this._sortColumnIdentifier);
+        this._sortOrderSetting = new WI.Setting(this._settingsIdentifier + "-sort-order", this._sortOrder);
+        this._columnVisibilitySetting = new WI.Setting(this._settingsIdentifier + "-column-visibility", {});
 
         if (!this.columns)
             return;
@@ -399,7 +399,7 @@
         const nodeWasHidden = node.hidden;
         this._applyFiltersToNode(node);
         if (nodeWasHidden !== node.hidden)
-            this.dispatchEventToListeners(WebInspector.DataGrid.Event.NodeWasFiltered, {node});
+            this.dispatchEventToListeners(WI.DataGrid.Event.NodeWasFiltered, {node});
 
         return nodeWasHidden !== node.hidden;
     }
@@ -411,8 +411,8 @@
             node.hidden = false;
 
             // If the node was expanded during filtering, collapse it again.
-            if (node.expanded && node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]) {
-                node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol] = false;
+            if (node.expanded && node[WI.DataGrid.WasExpandedDuringFilteringSymbol]) {
+                node[WI.DataGrid.WasExpandedDuringFilteringSymbol] = false;
                 node.collapse();
             }
 
@@ -448,7 +448,7 @@
 
                 // Only expand if the built-in filters matched, not custom filters.
                 if (flags.expandNode && !currentAncestor.expanded) {
-                    currentAncestor[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol] = true;
+                    currentAncestor[WI.DataGrid.WasExpandedDuringFilteringSymbol] = true;
                     currentAncestor.expand();
                 }
 
@@ -461,8 +461,8 @@
             makeVisible();
 
             // If the node didn't match a built-in filter and was expanded earlier during filtering, collapse it again.
-            if (!flags.expandNode && node.expanded && node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]) {
-                node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol] = false;
+            if (!flags.expandNode && node.expanded && node[WI.DataGrid.WasExpandedDuringFilteringSymbol]) {
+                node[WI.DataGrid.WasExpandedDuringFilteringSymbol] = false;
                 node.collapse();
             }
 
@@ -480,17 +480,17 @@
 
         if (oldSortColumnIdentifier) {
             let oldSortHeaderCellElement = this._headerTableCellElements.get(oldSortColumnIdentifier);
-            oldSortHeaderCellElement.classList.remove(WebInspector.DataGrid.SortColumnAscendingStyleClassName);
-            oldSortHeaderCellElement.classList.remove(WebInspector.DataGrid.SortColumnDescendingStyleClassName);
+            oldSortHeaderCellElement.classList.remove(WI.DataGrid.SortColumnAscendingStyleClassName);
+            oldSortHeaderCellElement.classList.remove(WI.DataGrid.SortColumnDescendingStyleClassName);
         }
 
         if (this._sortColumnIdentifier) {
             let newSortHeaderCellElement = this._headerTableCellElements.get(this._sortColumnIdentifier);
-            newSortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnAscendingStyleClassName, this._sortOrder === WebInspector.DataGrid.SortOrder.Ascending);
-            newSortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnDescendingStyleClassName, this._sortOrder === WebInspector.DataGrid.SortOrder.Descending);
+            newSortHeaderCellElement.classList.toggle(WI.DataGrid.SortColumnAscendingStyleClassName, this._sortOrder === WI.DataGrid.SortOrder.Ascending);
+            newSortHeaderCellElement.classList.toggle(WI.DataGrid.SortColumnDescendingStyleClassName, this._sortOrder === WI.DataGrid.SortOrder.Descending);
         }
 
-        this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);
+        this.dispatchEventToListeners(WI.DataGrid.Event.SortChanged);
     }
 
     _hasFilterDelegate()
@@ -515,7 +515,7 @@
         this._editingNode.select();
 
         var element = this._editingNode._element.children[columnIndex];
-        WebInspector.startEditing(element, this._startEditingConfig(element));
+        WI.startEditing(element, this._startEditingConfig(element));
         window.getSelection().setBaseAndExtent(element, 0, element, 1);
     }
 
@@ -537,14 +537,14 @@
             return this._startEditingNodeAtColumnIndex(this._editingNode, 0);
 
         this._editing = true;
-        WebInspector.startEditing(element, this._startEditingConfig(element));
+        WI.startEditing(element, this._startEditingConfig(element));
 
         window.getSelection().setBaseAndExtent(element, 0, element, 1);
     }
 
     _startEditingConfig(element)
     {
-        return new WebInspector.EditingConfig(this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
+        return new WI.EditingConfig(this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
     }
 
     _editingCommitted(element, newText, oldText, context, moveDirection)
@@ -686,7 +686,7 @@
             insertionIndex = this.orderedColumns.length;
         insertionIndex = Number.constrain(insertionIndex, 0, this.orderedColumns.length);
 
-        var listeners = new WebInspector.EventListenerSet(this, "DataGrid column DOM listeners");
+        var listeners = new WI.EventListenerSet(this, "DataGrid column DOM listeners");
 
         // Copy configuration properties instead of keeping a reference to the passed-in object.
         var column = Object.shallowCopy(columnData);
@@ -724,7 +724,7 @@
 
         if (column["headerView"]) {
             let headerView = column["headerView"];
-            console.assert(headerView instanceof WebInspector.View);
+            console.assert(headerView instanceof WI.View);
 
             headerCellElement.appendChild(headerView.element);
             this.addSubview(headerView);
@@ -738,7 +738,7 @@
 
         if (column["sortable"]) {
             listeners.register(headerCellElement, "click", this._headerCellClicked);
-            headerCellElement.classList.add(WebInspector.DataGrid.SortableColumnStyleClassName);
+            headerCellElement.classList.add(WI.DataGrid.SortableColumnStyleClassName);
         }
 
         if (column["group"])
@@ -982,7 +982,7 @@
             // This resizer is associated with the column to its right.
             var resizer = this.resizers[i];
             if (!resizer) {
-                resizer = this.resizers[i] = new WebInspector.Resizer(WebInspector.Resizer.RuleOrientation.Vertical, this);
+                resizer = this.resizers[i] = new WI.Resizer(WI.Resizer.RuleOrientation.Vertical, this);
                 this.element.appendChild(resizer.element);
             }
 
@@ -990,19 +990,19 @@
 
             if (this._isColumnVisible(this.orderedColumns[i])) {
                 resizer.element.style.removeProperty("display");
-                resizer.element.style.setProperty(WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left", `${leadingOffset}px`);
-                resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol] = i;
+                resizer.element.style.setProperty(WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left", `${leadingOffset}px`);
+                resizer[WI.DataGrid.PreviousColumnOrdinalSymbol] = i;
                 if (previousResizer)
-                    previousResizer[WebInspector.DataGrid.NextColumnOrdinalSymbol] = i;
+                    previousResizer[WI.DataGrid.NextColumnOrdinalSymbol] = i;
                 previousResizer = resizer;
             } else {
                 resizer.element.style.setProperty("display", "none");
-                resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol] = 0;
-                resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol] = 0;
+                resizer[WI.DataGrid.PreviousColumnOrdinalSymbol] = 0;
+                resizer[WI.DataGrid.NextColumnOrdinalSymbol] = 0;
             }
         }
         if (previousResizer)
-            previousResizer[WebInspector.DataGrid.NextColumnOrdinalSymbol] = this.orderedColumns.length - 1;
+            previousResizer[WI.DataGrid.NextColumnOrdinalSymbol] = this.orderedColumns.length - 1;
     }
 
     _positionHeaderViews()
@@ -1033,9 +1033,9 @@
         // Apply leading offsets and widths.
         for (let i = 0; i < headerViews.length; ++i) {
             let headerView = headerViews[i];
-            headerView.element.style.setProperty(WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left", `${offsets[i]}px`);
+            headerView.element.style.setProperty(WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left", `${offsets[i]}px`);
             headerView.element.style.width = columnWidths[i] + "px";
-            headerView.updateLayout(WebInspector.View.LayoutReason.Resize);
+            headerView.updateLayout(WI.View.LayoutReason.Resize);
         }
     }
 
@@ -1155,7 +1155,7 @@
         var emptyData = {};
         for (var identifier of this.columns.keys())
             emptyData[identifier] = "";
-        this.placeholderNode = new WebInspector.PlaceholderDataGridNode(emptyData);
+        this.placeholderNode = new WI.PlaceholderDataGridNode(emptyData);
         this.appendChild(this.placeholderNode);
     }
 
@@ -1326,7 +1326,7 @@
             if (bNode.isPlaceholderNode)
                 return -1;
 
-            var reverseFactor = this.sortOrder !== WebInspector.DataGrid.SortOrder.Ascending ? -1 : 1;
+            var reverseFactor = this.sortOrder !== WI.DataGrid.SortOrder.Ascending ? -1 : 1;
             return reverseFactor * comparator(aNode, bNode);
         }
 
@@ -1358,7 +1358,7 @@
 
     _toggledSortOrder()
     {
-        return this._sortOrder !== WebInspector.DataGrid.SortOrder.Descending ? WebInspector.DataGrid.SortOrder.Descending : WebInspector.DataGrid.SortOrder.Ascending;
+        return this._sortOrder !== WI.DataGrid.SortOrder.Descending ? WI.DataGrid.SortOrder.Descending : WI.DataGrid.SortOrder.Ascending;
     }
 
     _selectSortColumnAndSetOrder(columnIdentifier, sortOrder)
@@ -1372,7 +1372,7 @@
         if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey || this._editing)
             return;
 
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
 
         var handled = false;
         var nextSelectedNode;
@@ -1481,7 +1481,7 @@
     _headerCellClicked(event)
     {
         let cell = event.target.enclosingNodeOrSelfWithNodeName("th");
-        if (!cell || !cell.columnIdentifier || !cell.classList.contains(WebInspector.DataGrid.SortableColumnStyleClassName))
+        if (!cell || !cell.columnIdentifier || !cell.classList.contains(WI.DataGrid.SortableColumnStyleClassName))
             return;
 
         let sortOrder = this._sortColumnIdentifier === cell.columnIdentifier ? this._toggledSortOrder() : this.sortOrder;
@@ -1556,12 +1556,12 @@
 
     _collapserButtonCollapseColumnsToolTip()
     {
-        return WebInspector.UIString("Collapse columns");
+        return WI.UIString("Collapse columns");
     }
 
     _collapserButtonExpandColumnsToolTip()
     {
-        return WebInspector.UIString("Expand columns");
+        return WI.UIString("Expand columns");
     }
 
     willToggleColumnGroup(columnGroup, willCollapse)
@@ -1599,10 +1599,10 @@
 
     _contextMenuInHeader(event)
     {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         if (this._hasCopyableData())
-            contextMenu.appendItem(WebInspector.UIString("Copy Table"), this._copyTable.bind(this));
+            contextMenu.appendItem(WI.UIString("Copy Table"), this._copyTable.bind(this));
 
         let headerCellElement = event.target.enclosingNodeOrSelfWithNodeName("th");
         if (!headerCellElement)
@@ -1617,15 +1617,15 @@
         if (column.sortable) {
             contextMenu.appendSeparator();
 
-            if (this.sortColumnIdentifier !== columnIdentifier || this.sortOrder !== WebInspector.DataGrid.SortOrder.Ascending) {
-                contextMenu.appendItem(WebInspector.UIString("Sort Ascending"), () => {
-                    this._selectSortColumnAndSetOrder(columnIdentifier, WebInspector.DataGrid.SortOrder.Ascending);
+            if (this.sortColumnIdentifier !== columnIdentifier || this.sortOrder !== WI.DataGrid.SortOrder.Ascending) {
+                contextMenu.appendItem(WI.UIString("Sort Ascending"), () => {
+                    this._selectSortColumnAndSetOrder(columnIdentifier, WI.DataGrid.SortOrder.Ascending);
                 });
             }
 
-            if (this.sortColumnIdentifier !== columnIdentifier || this.sortOrder !== WebInspector.DataGrid.SortOrder.Descending) {
-                contextMenu.appendItem(WebInspector.UIString("Sort Descending"), () => {
-                    this._selectSortColumnAndSetOrder(columnIdentifier, WebInspector.DataGrid.SortOrder.Descending);
+            if (this.sortColumnIdentifier !== columnIdentifier || this.sortOrder !== WI.DataGrid.SortOrder.Descending) {
+                contextMenu.appendItem(WI.UIString("Sort Descending"), () => {
+                    this._selectSortColumnAndSetOrder(columnIdentifier, WI.DataGrid.SortOrder.Descending);
                 });
             }
         }
@@ -1651,7 +1651,7 @@
 
     _contextMenuInDataTable(event)
     {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         let gridNode = this.dataGridNodeFromNode(event.target);
 
@@ -1659,33 +1659,33 @@
             gridNode.appendContextMenuItems(contextMenu);
 
         if (this.dataGrid._refreshCallback && (!gridNode || gridNode !== this.placeholderNode))
-            contextMenu.appendItem(WebInspector.UIString("Refresh"), this._refreshCallback.bind(this));
+            contextMenu.appendItem(WI.UIString("Refresh"), this._refreshCallback.bind(this));
 
         if (gridNode) {
             if (gridNode.selectable && gridNode.copyable && !gridNode.isEventWithinDisclosureTriangle(event)) {
-                contextMenu.appendItem(WebInspector.UIString("Copy Row"), this._copyRow.bind(this, event.target));
-                contextMenu.appendItem(WebInspector.UIString("Copy Table"), this._copyTable.bind(this));
+                contextMenu.appendItem(WI.UIString("Copy Row"), this._copyRow.bind(this, event.target));
+                contextMenu.appendItem(WI.UIString("Copy Table"), this._copyTable.bind(this));
 
                 if (this.dataGrid._editCallback) {
                     if (gridNode === this.placeholderNode)
-                        contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
+                        contextMenu.appendItem(WI.UIString("Add New"), this._startEditing.bind(this, event.target));
                     else {
                         let element = event.target.enclosingNodeOrSelfWithNodeName("td");
                         let columnIdentifier = element.__columnIdentifier;
                         let columnTitle = this.dataGrid.columns.get(columnIdentifier)["title"];
-                        contextMenu.appendItem(WebInspector.UIString("Edit “%s”").format(columnTitle), this._startEditing.bind(this, event.target));
+                        contextMenu.appendItem(WI.UIString("Edit “%s”").format(columnTitle), this._startEditing.bind(this, event.target));
                     }
                 }
 
                 if (this.dataGrid._deleteCallback && gridNode !== this.placeholderNode)
-                    contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
+                    contextMenu.appendItem(WI.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
             }
 
             if (gridNode.children.some((child) => child.hasChildren) || (gridNode.hasChildren && !gridNode.children.length)) {
                 contextMenu.appendSeparator();
 
-                contextMenu.appendItem(WebInspector.UIString("Expand All"), gridNode.expandRecursively.bind(gridNode));
-                contextMenu.appendItem(WebInspector.UIString("Collapse All"), gridNode.collapseRecursively.bind(gridNode));
+                contextMenu.appendItem(WI.UIString("Expand All"), gridNode.expandRecursively.bind(gridNode));
+                contextMenu.appendItem(WI.UIString("Collapse All"), gridNode.collapseRecursively.bind(gridNode));
             }
         }
     }
@@ -1781,7 +1781,7 @@
     get resizeMethod()
     {
         if (!this._resizeMethod)
-            return WebInspector.DataGrid.ResizeMethod.Nearest;
+            return WI.DataGrid.ResizeMethod.Nearest;
         return this._resizeMethod;
     }
 
@@ -1792,7 +1792,7 @@
 
     resizerDragStarted(resizer)
     {
-        if (!resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol])
+        if (!resizer[WI.DataGrid.NextColumnOrdinalSymbol])
             return true; // Abort the drag;
 
         this._currentResizer = resizer;
@@ -1804,7 +1804,7 @@
         if (resizer !== this._currentResizer)
             return;
 
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
         if (isRTL)
             positionDelta *= -1;
 
@@ -1817,17 +1817,17 @@
 
         // Constrain the dragpoint to be within the space made up by the
         // column directly to the left and the column directly to the right.
-        var leftColumnIndex = resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol];
-        var rightColumnIndex = resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol];
+        var leftColumnIndex = resizer[WI.DataGrid.PreviousColumnOrdinalSymbol];
+        var rightColumnIndex = resizer[WI.DataGrid.NextColumnOrdinalSymbol];
         var firstRowCells = this._headerTableBodyElement.rows[0].cells;
         let leadingEdgeOfPreviousColumn = 0;
         for (let i = 0; i < leftColumnIndex; ++i)
             leadingEdgeOfPreviousColumn += firstRowCells[i].offsetWidth;
 
         // Differences for other resize methods
-        if (this.resizeMethod === WebInspector.DataGrid.ResizeMethod.Last) {
+        if (this.resizeMethod === WI.DataGrid.ResizeMethod.Last) {
             rightColumnIndex = this.resizers.length;
-        } else if (this.resizeMethod === WebInspector.DataGrid.ResizeMethod.First) {
+        } else if (this.resizeMethod === WI.DataGrid.ResizeMethod.First) {
             leadingEdgeOfPreviousColumn += firstRowCells[leftColumnIndex].offsetWidth - firstRowCells[0].offsetWidth;
             leftColumnIndex = 0;
         }
@@ -1835,8 +1835,8 @@
         let trailingEdgeOfNextColumn = leadingEdgeOfPreviousColumn + firstRowCells[leftColumnIndex].offsetWidth + firstRowCells[rightColumnIndex].offsetWidth;
 
         // Give each column some padding so that they don't disappear.
-        let leftMinimum = leadingEdgeOfPreviousColumn + WebInspector.DataGrid.ColumnResizePadding;
-        let rightMaximum = trailingEdgeOfNextColumn - WebInspector.DataGrid.ColumnResizePadding;
+        let leftMinimum = leadingEdgeOfPreviousColumn + WI.DataGrid.ColumnResizePadding;
+        let rightMaximum = trailingEdgeOfNextColumn - WI.DataGrid.ColumnResizePadding;
 
         dragPoint = Number.constrain(dragPoint, leftMinimum, rightMaximum);
 
@@ -1907,7 +1907,7 @@
         }
 
         let items = createIteratorForNodesToBeFiltered.call(this);
-        this._applyFilterToNodesTask = new WebInspector.YieldableTask(this, items, {workInterval: 100});
+        this._applyFilterToNodesTask = new WI.YieldableTask(this, items, {workInterval: 100});
 
         this._filterDidModifyNodeWhileProcessingItems = false;
 
@@ -1930,7 +1930,7 @@
 
         this._filterDidModifyNodeWhileProcessingItems = false;
 
-        this.dispatchEventToListeners(WebInspector.DataGrid.Event.FilterDidChange);
+        this.dispatchEventToListeners(WI.DataGrid.Event.FilterDidChange);
     }
 
     yieldableTaskDidFinish(task)
@@ -1939,7 +1939,7 @@
     }
 };
 
-WebInspector.DataGrid.Event = {
+WI.DataGrid.Event = {
     SortChanged: "datagrid-sort-changed",
     SelectedNodeChanged: "datagrid-selected-node-changed",
     ExpandedNode: "datagrid-expanded-node",
@@ -1948,25 +1948,25 @@
     NodeWasFiltered: "datagrid-node-was-filtered"
 };
 
-WebInspector.DataGrid.ResizeMethod = {
+WI.DataGrid.ResizeMethod = {
     Nearest: "nearest",
     First: "first",
     Last: "last"
 };
 
-WebInspector.DataGrid.SortOrder = {
+WI.DataGrid.SortOrder = {
     Indeterminate: "data-grid-sort-order-indeterminate",
     Ascending: "data-grid-sort-order-ascending",
     Descending: "data-grid-sort-order-descending"
 };
 
-WebInspector.DataGrid.PreviousColumnOrdinalSymbol = Symbol("previous-column-ordinal");
-WebInspector.DataGrid.NextColumnOrdinalSymbol = Symbol("next-column-ordinal");
-WebInspector.DataGrid.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering");
+WI.DataGrid.PreviousColumnOrdinalSymbol = Symbol("previous-column-ordinal");
+WI.DataGrid.NextColumnOrdinalSymbol = Symbol("next-column-ordinal");
+WI.DataGrid.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering");
 
-WebInspector.DataGrid.ColumnResizePadding = 10;
-WebInspector.DataGrid.CenterResizerOverBorderAdjustment = 3;
+WI.DataGrid.ColumnResizePadding = 10;
+WI.DataGrid.CenterResizerOverBorderAdjustment = 3;
 
-WebInspector.DataGrid.SortColumnAscendingStyleClassName = "sort-ascending";
-WebInspector.DataGrid.SortColumnDescendingStyleClassName = "sort-descending";
-WebInspector.DataGrid.SortableColumnStyleClassName = "sortable";
+WI.DataGrid.SortColumnAscendingStyleClassName = "sort-ascending";
+WI.DataGrid.SortColumnDescendingStyleClassName = "sort-descending";
+WI.DataGrid.SortableColumnStyleClassName = "sortable";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js
index a64d069..4264a45 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DataGridNode = class DataGridNode extends WebInspector.Object
+WI.DataGridNode = class DataGridNode extends WI.Object
 {
     constructor(data, hasChildren, classNames)
     {
@@ -373,7 +373,7 @@
         if (columnIdentifier === this.dataGrid.disclosureColumnIdentifier) {
             cellElement.classList.add("disclosure");
             if (this.indentPadding) {
-                if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+                if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
                     cellElement.style.setProperty("padding-right", `${this.indentPadding}px`);
                 else
                     cellElement.style.setProperty("padding-left", `${this.indentPadding}px`);
@@ -405,11 +405,11 @@
     }
 
     // Share these functions with DataGrid. They are written to work with a DataGridNode this object.
-    appendChild() { return WebInspector.DataGrid.prototype.appendChild.apply(this, arguments); }
-    insertChild() { return WebInspector.DataGrid.prototype.insertChild.apply(this, arguments); }
-    removeChild() { return WebInspector.DataGrid.prototype.removeChild.apply(this, arguments); }
-    removeChildren() { return WebInspector.DataGrid.prototype.removeChildren.apply(this, arguments); }
-    removeChildrenRecursive() { return WebInspector.DataGrid.prototype.removeChildrenRecursive.apply(this, arguments); }
+    appendChild() { return WI.DataGrid.prototype.appendChild.apply(this, arguments); }
+    insertChild() { return WI.DataGrid.prototype.insertChild.apply(this, arguments); }
+    removeChild() { return WI.DataGrid.prototype.removeChild.apply(this, arguments); }
+    removeChildren() { return WI.DataGrid.prototype.removeChildren.apply(this, arguments); }
+    removeChildrenRecursive() { return WI.DataGrid.prototype.removeChildrenRecursive.apply(this, arguments); }
 
     _recalculateSiblings(myIndex)
     {
@@ -446,7 +446,7 @@
         this.dispatchEventToListeners("collapsed");
 
         if (this.dataGrid) {
-            this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.CollapsedNode, {dataGridNode: this});
+            this.dataGrid.dispatchEventToListeners(WI.DataGrid.Event.CollapsedNode, {dataGridNode: this});
             this.dataGrid._noteRowsChanged();
         }
     }
@@ -496,7 +496,7 @@
         this.dispatchEventToListeners("expanded");
 
         if (this.dataGrid) {
-            this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.ExpandedNode, {dataGridNode: this});
+            this.dataGrid.dispatchEventToListeners(WI.DataGrid.Event.ExpandedNode, {dataGridNode: this});
             this.dataGrid._noteRowsChanged();
         }
     }
@@ -566,7 +566,7 @@
             this._element.classList.add("selected");
 
         if (!suppressSelectedEvent)
-            this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.SelectedNodeChanged, {oldSelectedNode});
+            this.dataGrid.dispatchEventToListeners(WI.DataGrid.Event.SelectedNodeChanged, {oldSelectedNode});
     }
 
     revealAndSelect()
@@ -587,7 +587,7 @@
             this._element.classList.remove("selected");
 
         if (!suppressDeselectedEvent)
-            this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.SelectedNodeChanged, {oldSelectedNode: this});
+            this.dataGrid.dispatchEventToListeners(WI.DataGrid.Event.SelectedNodeChanged, {oldSelectedNode: this});
     }
 
     traverseNextNode(skipHidden, stayWithin, dontPopulate, info)
@@ -657,7 +657,7 @@
 
         let computedStyle = window.getComputedStyle(cell);
         let start = 0;
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             start += cell.totalOffsetRight - computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX) - this.disclosureToggleWidth;
         else
             start += cell.totalOffsetLeft + computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);
@@ -756,7 +756,7 @@
 };
 
 // Used to create a new table row when entering new data by editing cells.
-WebInspector.PlaceholderDataGridNode = class PlaceholderDataGridNode extends WebInspector.DataGridNode
+WI.PlaceholderDataGridNode = class PlaceholderDataGridNode extends WI.DataGridNode
 {
     constructor(data)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseContentView.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseContentView.js
index 490cf22..016db3b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseContentView = class DatabaseContentView extends WebInspector.ContentView
+WI.DatabaseContentView = class DatabaseContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -33,7 +33,7 @@
 
         this.element.classList.add("storage-view", "query", "monospace");
 
-        this._prompt = new WebInspector.ConsolePrompt(this, "text/x-sql");
+        this._prompt = new WI.ConsolePrompt(this, "text/x-sql");
         this.addSubview(this._prompt);
 
         this.element.addEventListener("click", this._messagesClicked.bind(this), true);
@@ -43,7 +43,7 @@
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.Database;
+        cookie.type = WI.ContentViewCookieType.Database;
         cookie.host = this.representedObject.host;
         cookie.name = this.representedObject.name;
     }
@@ -88,7 +88,7 @@
     _queryFinished(query, columnNames, values)
     {
         let trimmedQuery = query.trim();
-        let queryView = new WebInspector.DatabaseUserQuerySuccessView(trimmedQuery, columnNames, values);
+        let queryView = new WI.DatabaseUserQuerySuccessView(trimmedQuery, columnNames, values);
         this.insertSubviewBefore(queryView, this._prompt);
 
         if (queryView.dataGrid)
@@ -97,7 +97,7 @@
         this._prompt.element.scrollIntoView(false);
 
         if (trimmedQuery.match(/^create /i) || trimmedQuery.match(/^drop table /i))
-            this.dispatchEventToListeners(WebInspector.DatabaseContentView.Event.SchemaUpdated, this.database);
+            this.dispatchEventToListeners(WI.DatabaseContentView.Event.SchemaUpdated, this.database);
     }
 
     _queryError(query, error)
@@ -106,16 +106,16 @@
         if (error.message)
             message = error.message;
         else if (error.code === 2)
-            message = WebInspector.UIString("Database no longer has expected version.");
+            message = WI.UIString("Database no longer has expected version.");
         else
-            message = WebInspector.UIString("An unexpected error %s occurred.").format(error.code);
+            message = WI.UIString("An unexpected error %s occurred.").format(error.code);
 
-        let queryView = new WebInspector.DatabaseUserQueryErrorView(query, message);
+        let queryView = new WI.DatabaseUserQueryErrorView(query, message);
         this.insertSubviewBefore(queryView, this._prompt);
         this._prompt.element.scrollIntoView(false);
     }
 };
 
-WebInspector.DatabaseContentView.Event = {
+WI.DatabaseContentView.Event = {
     SchemaUpdated: "SchemaUpdated"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseHostTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseHostTreeElement.js
index a355df2..34a12a3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseHostTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseHostTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseHostTreeElement = class DatabaseHostTreeElement extends WebInspector.StorageTreeElement
+WI.DatabaseHostTreeElement = class DatabaseHostTreeElement extends WI.StorageTreeElement
 {
     constructor(host)
     {
-        super(WebInspector.FolderTreeElement.FolderIconStyleClassName, WebInspector.displayNameForHost(host), null);
+        super(WI.FolderTreeElement.FolderIconStyleClassName, WI.displayNameForHost(host), null);
 
         this._host = host;
 
@@ -39,11 +39,11 @@
 
     get name()
     {
-        return WebInspector.displayNameForHost(this._host);
+        return WI.displayNameForHost(this._host);
     }
 
     get categoryName()
     {
-        return WebInspector.UIString("Databases");
+        return WI.UIString("Databases");
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js
index e3461c9..9037f6a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseTableContentView = class DatabaseTableContentView extends WebInspector.ContentView
+WI.DatabaseTableContentView = class DatabaseTableContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -31,8 +31,8 @@
 
         this.element.classList.add("database-table");
 
-        this._refreshButtonNavigationItem = new WebInspector.ButtonNavigationItem("database-table-refresh", WebInspector.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
-        this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
+        this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("database-table-refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
+        this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
         this._messageTextViewElement = null;
 
         this.update();
@@ -52,7 +52,7 @@
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.DatabaseTable;
+        cookie.type = WI.ContentViewCookieType.DatabaseTable;
         cookie.host = this.representedObject.host;
         cookie.name = this.representedObject.name;
         cookie.database = this.representedObject.database.name;
@@ -86,7 +86,7 @@
             this._messageTextViewElement.remove();
 
         if (columnNames.length) {
-            this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
+            this._dataGrid = WI.DataGrid.createSortableDataGrid(columnNames, values);
 
             this.addSubview(this._dataGrid);
             this._dataGrid.updateLayout();
@@ -95,7 +95,7 @@
 
         // We were returned a table with no columns. This can happen when a table has
         // no data, the SELECT query only returns column names when there is data.
-        this._messageTextViewElement = WebInspector.createMessageTextView(WebInspector.UIString("The “%s”\ntable is empty.").format(this.representedObject.name), false);
+        this._messageTextViewElement = WI.createMessageTextView(WI.UIString("The “%s”\ntable is empty.").format(this.representedObject.name), false);
         this.element.appendChild(this._messageTextViewElement);
     }
 
@@ -109,7 +109,7 @@
         if (this._messageTextViewElement)
             this._messageTextViewElement.remove();
 
-        this._messageTextViewElement = WebInspector.createMessageTextView(WebInspector.UIString("An error occurred trying to read the “%s” table.").format(this.representedObject.name), true);
+        this._messageTextViewElement = WI.createMessageTextView(WI.UIString("An error occurred trying to read the “%s” table.").format(this.representedObject.name), true);
         this.element.appendChild(this._messageTextViewElement);
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseTableTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseTableTreeElement.js
index 7937090..6bd802f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseTableTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseTableTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseTableTreeElement = class DatabaseTableTreeElement extends WebInspector.GeneralTreeElement
+WI.DatabaseTableTreeElement = class DatabaseTableTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.DatabaseTableObject);
+        console.assert(representedObject instanceof WI.DatabaseTableObject);
 
         const subtitle = null;
         super("database-table-icon", representedObject.name, subtitle, representedObject);
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseTreeElement.js
index 87678fe..cb3e3a9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseTreeElement = class DatabaseTreeElement extends WebInspector.GeneralTreeElement
+WI.DatabaseTreeElement = class DatabaseTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.DatabaseObject);
+        console.assert(representedObject instanceof WI.DatabaseObject);
 
         const subtitle = null;
         super("database-icon", representedObject.name, subtitle, representedObject, {hasChildren: true});
@@ -58,8 +58,8 @@
         function tableNamesCallback(tableNames)
         {
             for (var i = 0; i < tableNames.length; ++i) {
-                var databaseTable = new WebInspector.DatabaseTableObject(tableNames[i], this.representedObject);
-                this.appendChild(new WebInspector.DatabaseTableTreeElement(databaseTable));
+                var databaseTable = new WI.DatabaseTableObject(tableNames[i], this.representedObject);
+                this.appendChild(new WI.DatabaseTableTreeElement(databaseTable));
             }
 
             this.hasChildren = tableNames.length;
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryErrorView.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryErrorView.js
index c7a505d..4ba04c9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryErrorView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryErrorView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseUserQueryErrorView = class DatabaseUserQueryErrorView extends WebInspector.DatabaseUserQueryViewBase
+WI.DatabaseUserQueryErrorView = class DatabaseUserQueryErrorView extends WI.DatabaseUserQueryViewBase
 {
     constructor(query, message)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQuerySuccessView.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQuerySuccessView.js
index 0944dc9..30be6ef 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQuerySuccessView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQuerySuccessView.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseUserQuerySuccessView = class DatabaseUserQuerySuccessView extends WebInspector.DatabaseUserQueryViewBase
+WI.DatabaseUserQuerySuccessView = class DatabaseUserQuerySuccessView extends WI.DatabaseUserQueryViewBase
 {
     constructor(query, columnNames, values)
     {
         super(query);
 
-        this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
+        this._dataGrid = WI.DataGrid.createSortableDataGrid(columnNames, values);
         if (this._dataGrid) {
             this._dataGrid.inline = true;
 
@@ -38,7 +38,7 @@
             this._dataGrid.updateLayoutIfNeeded();
         } else {
             this.resultElement.classList.add("no-results");
-            this.resultElement.textContent = WebInspector.UIString("Query returned no results.");
+            this.resultElement.textContent = WI.UIString("Query returned no results.");
         }
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryViewBase.js b/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryViewBase.js
index 25deb33..ac7cc17 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryViewBase.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DatabaseUserQueryViewBase.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseUserQueryViewBase = class DatabaseUserQueryViewBase extends WebInspector.View
+WI.DatabaseUserQueryViewBase = class DatabaseUserQueryViewBase extends WI.View
 {
     constructor(query)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.js b/Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.js
index 1d7652c..b1a4016 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.js
@@ -23,26 +23,26 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerDashboardView = class DebuggerDashboardView extends WebInspector.DashboardView
+WI.DebuggerDashboardView = class DebuggerDashboardView extends WI.DashboardView
 {
     constructor(representedObject)
     {
         super(representedObject, "debugger");
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._rebuildLocation, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._rebuildLocation, this);
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this.element.appendChild(this._navigationBar.element);
 
-        var tooltip = WebInspector.UIString("Continue script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName, WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);
-        this._debuggerResumeButtonItem = new WebInspector.ActivateButtonNavigationItem("debugger-dashboard-pause", tooltip, tooltip, "Images/Resume.svg", 15, 15);
+        var tooltip = WI.UIString("Continue script execution (%s or %s)").format(WI.pauseOrResumeKeyboardShortcut.displayName, WI.pauseOrResumeAlternateKeyboardShortcut.displayName);
+        this._debuggerResumeButtonItem = new WI.ActivateButtonNavigationItem("debugger-dashboard-pause", tooltip, tooltip, "Images/Resume.svg", 15, 15);
         this._debuggerResumeButtonItem.activated = true;
-        this._debuggerResumeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._resumeButtonClicked, this);
+        this._debuggerResumeButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._resumeButtonClicked, this);
         this._navigationBar.addNavigationItem(this._debuggerResumeButtonItem);
 
         var message = this._messageElement = document.createElement("div");
         message.classList.add("message");
-        message.title = message.textContent = WebInspector.UIString("Debugger Paused");
+        message.title = message.textContent = WI.UIString("Debugger Paused");
         this.element.appendChild(message);
 
         var dividerElement = document.createElement("div");
@@ -60,20 +60,20 @@
 
     _rebuildLocation()
     {
-        if (!WebInspector.debuggerManager.activeCallFrame)
+        if (!WI.debuggerManager.activeCallFrame)
             return;
 
         this._locationElement.removeChildren();
 
-        var callFrame = WebInspector.debuggerManager.activeCallFrame;
-        var functionName = callFrame.functionName || WebInspector.UIString("(anonymous function)");
+        var callFrame = WI.debuggerManager.activeCallFrame;
+        var functionName = callFrame.functionName || WI.UIString("(anonymous function)");
 
-        var iconClassName = WebInspector.DebuggerDashboardView.FunctionIconStyleClassName;
+        var iconClassName = WI.DebuggerDashboardView.FunctionIconStyleClassName;
 
         // This is more than likely an event listener function with an "on" prefix and it is
         // as long or longer than the shortest event listener name -- "oncut".
         if (callFrame.functionName && callFrame.functionName.startsWith("on") && callFrame.functionName.length >= 5)
-            iconClassName = WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName;
+            iconClassName = WI.DebuggerDashboardView.EventListenerIconStyleClassName;
 
         var iconElement = document.createElement("div");
         iconElement.classList.add(iconClassName);
@@ -93,15 +93,15 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        let linkElement = WebInspector.createSourceCodeLocationLink(WebInspector.debuggerManager.activeCallFrame.sourceCodeLocation, options);
+        let linkElement = WI.createSourceCodeLocationLink(WI.debuggerManager.activeCallFrame.sourceCodeLocation, options);
         this._locationElement.appendChild(linkElement);
     }
 
     _resumeButtonClicked()
     {
-        WebInspector.debuggerManager.resume();
+        WI.debuggerManager.resume();
     }
 };
 
-WebInspector.DebuggerDashboardView.FunctionIconStyleClassName = WebInspector.CallFrameView.FunctionIconStyleClassName;
-WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName = WebInspector.CallFrameView.EventListenerIconStyleClassName;
+WI.DebuggerDashboardView.FunctionIconStyleClassName = WI.CallFrameView.FunctionIconStyleClassName;
+WI.DebuggerDashboardView.EventListenerIconStyleClassName = WI.CallFrameView.EventListenerIconStyleClassName;
diff --git a/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
index 4a85b07..b9ec25a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
@@ -23,51 +23,51 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspector.NavigationSidebarPanel
+WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSidebarPanel
 {
     constructor(contentBrowser)
     {
-        super("debugger", WebInspector.UIString("Debugger"), true);
+        super("debugger", WI.UIString("Debugger"), true);
 
         this.contentBrowser = contentBrowser;
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
-        WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded, this._resourceAdded, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
+        WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceAdded, this);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptRemoved, this._scriptRemoved, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, this._debuggerCallFramesDidChange, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._debuggerActiveCallFrameDidChange, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.WaitingToPause, this._debuggerWaitingToPause, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptRemoved, this._scriptRemoved, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, this._debuggerCallFramesDidChange, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._debuggerActiveCallFrameDidChange, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.WaitingToPause, this._debuggerWaitingToPause, this);
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
 
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded, this._targetAdded, this);
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, this._targetAdded, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
 
         this._timelineRecordingWarningElement = document.createElement("div");
         this._timelineRecordingWarningElement.classList.add("warning-banner");
-        this._timelineRecordingWarningElement.append(WebInspector.UIString("Debugger disabled during Timeline recording"), " ");
+        this._timelineRecordingWarningElement.append(WI.UIString("Debugger disabled during Timeline recording"), " ");
         let stopRecordingLink = this._timelineRecordingWarningElement.appendChild(document.createElement("a"));
-        stopRecordingLink.textContent = WebInspector.UIString("Stop recording");
-        stopRecordingLink.addEventListener("click", () => { WebInspector.timelineManager.stopCapturing(); });
+        stopRecordingLink.textContent = WI.UIString("Stop recording");
+        stopRecordingLink.addEventListener("click", () => { WI.timelineManager.stopCapturing(); });
 
         this._breakpointsDisabledWarningElement = document.createElement("div");
         this._breakpointsDisabledWarningElement.classList.add("warning-banner");
-        this._breakpointsDisabledWarningElement.append(WebInspector.UIString("Breakpoints disabled"), document.createElement("br"));
+        this._breakpointsDisabledWarningElement.append(WI.UIString("Breakpoints disabled"), document.createElement("br"));
         let enableBreakpointsLink = this._breakpointsDisabledWarningElement.appendChild(document.createElement("a"));
-        enableBreakpointsLink.textContent = WebInspector.UIString("Enable breakpoints");
-        enableBreakpointsLink.addEventListener("click", () => { WebInspector.debuggerToggleBreakpoints(); });
+        enableBreakpointsLink.textContent = WI.UIString("Enable breakpoints");
+        enableBreakpointsLink.addEventListener("click", () => { WI.debuggerToggleBreakpoints(); });
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this.addSubview(this._navigationBar);
 
         var breakpointsImage = {src: "Images/Breakpoints.svg", width: 15, height: 15};
@@ -77,46 +77,46 @@
         var stepIntoImage = {src: "Images/StepInto.svg", width: 15, height: 15};
         var stepOutImage = {src: "Images/StepOut.svg", width: 15, height: 15};
 
-        var toolTip = WebInspector.UIString("Enable all breakpoints (%s)").format(WebInspector.toggleBreakpointsKeyboardShortcut.displayName);
-        var altToolTip = WebInspector.UIString("Disable all breakpoints (%s)").format(WebInspector.toggleBreakpointsKeyboardShortcut.displayName);
+        var toolTip = WI.UIString("Enable all breakpoints (%s)").format(WI.toggleBreakpointsKeyboardShortcut.displayName);
+        var altToolTip = WI.UIString("Disable all breakpoints (%s)").format(WI.toggleBreakpointsKeyboardShortcut.displayName);
 
-        this._debuggerBreakpointsButtonItem = new WebInspector.ActivateButtonNavigationItem("debugger-breakpoints", toolTip, altToolTip, breakpointsImage.src, breakpointsImage.width, breakpointsImage.height);
-        this._debuggerBreakpointsButtonItem.activated = WebInspector.debuggerManager.breakpointsEnabled;
-        this._debuggerBreakpointsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.debuggerToggleBreakpoints, this);
+        this._debuggerBreakpointsButtonItem = new WI.ActivateButtonNavigationItem("debugger-breakpoints", toolTip, altToolTip, breakpointsImage.src, breakpointsImage.width, breakpointsImage.height);
+        this._debuggerBreakpointsButtonItem.activated = WI.debuggerManager.breakpointsEnabled;
+        this._debuggerBreakpointsButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.debuggerToggleBreakpoints, this);
         this._navigationBar.addNavigationItem(this._debuggerBreakpointsButtonItem);
 
-        toolTip = WebInspector.UIString("Pause script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName, WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);
-        altToolTip = WebInspector.UIString("Continue script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName, WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);
+        toolTip = WI.UIString("Pause script execution (%s or %s)").format(WI.pauseOrResumeKeyboardShortcut.displayName, WI.pauseOrResumeAlternateKeyboardShortcut.displayName);
+        altToolTip = WI.UIString("Continue script execution (%s or %s)").format(WI.pauseOrResumeKeyboardShortcut.displayName, WI.pauseOrResumeAlternateKeyboardShortcut.displayName);
 
-        this._debuggerPauseResumeButtonItem = new WebInspector.ToggleButtonNavigationItem("debugger-pause-resume", toolTip, altToolTip, pauseImage.src, resumeImage.src, pauseImage.width, pauseImage.height);
-        this._debuggerPauseResumeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.debuggerPauseResumeToggle, this);
+        this._debuggerPauseResumeButtonItem = new WI.ToggleButtonNavigationItem("debugger-pause-resume", toolTip, altToolTip, pauseImage.src, resumeImage.src, pauseImage.width, pauseImage.height);
+        this._debuggerPauseResumeButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.debuggerPauseResumeToggle, this);
         this._navigationBar.addNavigationItem(this._debuggerPauseResumeButtonItem);
 
-        this._debuggerStepOverButtonItem = new WebInspector.ButtonNavigationItem("debugger-step-over", WebInspector.UIString("Step over (%s or %s)").format(WebInspector.stepOverKeyboardShortcut.displayName, WebInspector.stepOverAlternateKeyboardShortcut.displayName), stepOverImage.src, stepOverImage.width, stepOverImage.height);
-        this._debuggerStepOverButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.debuggerStepOver, this);
+        this._debuggerStepOverButtonItem = new WI.ButtonNavigationItem("debugger-step-over", WI.UIString("Step over (%s or %s)").format(WI.stepOverKeyboardShortcut.displayName, WI.stepOverAlternateKeyboardShortcut.displayName), stepOverImage.src, stepOverImage.width, stepOverImage.height);
+        this._debuggerStepOverButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.debuggerStepOver, this);
         this._debuggerStepOverButtonItem.enabled = false;
         this._navigationBar.addNavigationItem(this._debuggerStepOverButtonItem);
 
-        this._debuggerStepIntoButtonItem = new WebInspector.ButtonNavigationItem("debugger-step-into", WebInspector.UIString("Step into (%s or %s)").format(WebInspector.stepIntoKeyboardShortcut.displayName, WebInspector.stepIntoAlternateKeyboardShortcut.displayName), stepIntoImage.src, stepIntoImage.width, stepIntoImage.height);
-        this._debuggerStepIntoButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.debuggerStepInto, this);
+        this._debuggerStepIntoButtonItem = new WI.ButtonNavigationItem("debugger-step-into", WI.UIString("Step into (%s or %s)").format(WI.stepIntoKeyboardShortcut.displayName, WI.stepIntoAlternateKeyboardShortcut.displayName), stepIntoImage.src, stepIntoImage.width, stepIntoImage.height);
+        this._debuggerStepIntoButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.debuggerStepInto, this);
         this._debuggerStepIntoButtonItem.enabled = false;
         this._navigationBar.addNavigationItem(this._debuggerStepIntoButtonItem);
 
-        this._debuggerStepOutButtonItem = new WebInspector.ButtonNavigationItem("debugger-step-out", WebInspector.UIString("Step out (%s or %s)").format(WebInspector.stepOutKeyboardShortcut.displayName, WebInspector.stepOutAlternateKeyboardShortcut.displayName), stepOutImage.src, stepOutImage.width, stepOutImage.height);
-        this._debuggerStepOutButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, WebInspector.debuggerStepOut, this);
+        this._debuggerStepOutButtonItem = new WI.ButtonNavigationItem("debugger-step-out", WI.UIString("Step out (%s or %s)").format(WI.stepOutKeyboardShortcut.displayName, WI.stepOutAlternateKeyboardShortcut.displayName), stepOutImage.src, stepOutImage.width, stepOutImage.height);
+        this._debuggerStepOutButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.debuggerStepOut, this);
         this._debuggerStepOutButtonItem.enabled = false;
         this._navigationBar.addNavigationItem(this._debuggerStepOutButtonItem);
 
         // Add this offset-sections class name so the sticky headers don't overlap the navigation bar.
-        this.element.classList.add(WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName);
+        this.element.classList.add(WI.DebuggerSidebarPanel.OffsetSectionsStyleClassName);
 
-        this._allExceptionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allExceptionsBreakpoint, WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName, WebInspector.UIString("All Exceptions"));
-        this._allUncaughtExceptionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint, WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName, WebInspector.UIString("Uncaught Exceptions"));
-        this._assertionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.assertionsBreakpoint, WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName, WebInspector.UIString("Assertion Failures"));
+        this._allExceptionsBreakpointTreeElement = new WI.BreakpointTreeElement(WI.debuggerManager.allExceptionsBreakpoint, WI.DebuggerSidebarPanel.ExceptionIconStyleClassName, WI.UIString("All Exceptions"));
+        this._allUncaughtExceptionsBreakpointTreeElement = new WI.BreakpointTreeElement(WI.debuggerManager.allUncaughtExceptionsBreakpoint, WI.DebuggerSidebarPanel.ExceptionIconStyleClassName, WI.UIString("Uncaught Exceptions"));
+        this._assertionsBreakpointTreeElement = new WI.BreakpointTreeElement(WI.debuggerManager.assertionsBreakpoint, WI.DebuggerSidebarPanel.AssertionIconStyleClassName, WI.UIString("Assertion Failures"));
 
         this.suppressFilteringOnTreeElements([this._allExceptionsBreakpointTreeElement, this._allUncaughtExceptionsBreakpointTreeElement, this._assertionsBreakpointTreeElement]);
 
-        this.filterBar.placeholder = WebInspector.UIString("Filter List");
+        this.filterBar.placeholder = WI.UIString("Filter List");
 
         function showResourcesWithIssuesOnlyFilterFunction(treeElement)
         {
@@ -125,38 +125,38 @@
                 return true;
 
             // Keep issues.
-            if (treeElement instanceof WebInspector.IssueTreeElement)
+            if (treeElement instanceof WI.IssueTreeElement)
                 return true;
 
             // Keep resources with issues.
             if (treeElement.hasChildren) {
                 for (let child of treeElement.children) {
-                    if (child instanceof WebInspector.IssueTreeElement)
+                    if (child instanceof WI.IssueTreeElement)
                         return true;
                 }
             }
             return false;
         }
 
-        this.filterBar.addFilterBarButton("debugger-show-resources-with-issues-only", showResourcesWithIssuesOnlyFilterFunction.bind(this), false, WebInspector.UIString("Only show resources with issues"), WebInspector.UIString("Show all resources"), "Images/Errors.svg", 15, 15);
+        this.filterBar.addFilterBarButton("debugger-show-resources-with-issues-only", showResourcesWithIssuesOnlyFilterFunction.bind(this), false, WI.UIString("Only show resources with issues"), WI.UIString("Show all resources"), "Images/Errors.svg", 15, 15);
 
         this._breakpointsContentTreeOutline = this.contentTreeOutline;
 
-        let breakpointsRow = new WebInspector.DetailsSectionRow;
+        let breakpointsRow = new WI.DetailsSectionRow;
         breakpointsRow.element.appendChild(this._breakpointsContentTreeOutline.element);
 
-        let breakpointsGroup = new WebInspector.DetailsSectionGroup([breakpointsRow]);
-        let breakpointsSection = new WebInspector.DetailsSection("breakpoints", WebInspector.UIString("Breakpoints"), [breakpointsGroup]);
+        let breakpointsGroup = new WI.DetailsSectionGroup([breakpointsRow]);
+        let breakpointsSection = new WI.DetailsSection("breakpoints", WI.UIString("Breakpoints"), [breakpointsGroup]);
         this.contentView.element.appendChild(breakpointsSection.element);
 
         this._breakpointSectionElement = breakpointsSection.element;
 
-        this._breakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._breakpointsContentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
         this._breakpointsContentTreeOutline.ondelete = this._breakpointTreeOutlineDeleteTreeElement.bind(this);
         this._breakpointsContentTreeOutline.populateContextMenu = function(contextMenu, event, treeElement) {
             this._breakpointTreeOutlineContextMenuTreeElement(contextMenu, event, treeElement);
 
-            WebInspector.TreeOutline.prototype.populateContextMenu(contextMenu, event, treeElement);
+            WI.TreeOutline.prototype.populateContextMenu(contextMenu, event, treeElement);
         }.bind(this);
 
         this._breakpointsContentTreeOutline.appendChild(this._allExceptionsBreakpointTreeElement);
@@ -166,66 +166,66 @@
         if (DebuggerAgent.setPauseOnAssertions)
             this._breakpointsContentTreeOutline.appendChild(this._assertionsBreakpointTreeElement);
 
-        if (WebInspector.domDebuggerManager.supported) {
+        if (WI.domDebuggerManager.supported) {
             this._domBreakpointsContentTreeOutline = this.createContentTreeOutline(true);
-            this._domBreakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._domBreakpointAddedOrRemoved, this);
-            this._domBreakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementRemoved, this._domBreakpointAddedOrRemoved, this);
-            this._domBreakpointTreeController = new WebInspector.DOMBreakpointTreeController(this._domBreakpointsContentTreeOutline);
+            this._domBreakpointsContentTreeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._domBreakpointAddedOrRemoved, this);
+            this._domBreakpointsContentTreeOutline.addEventListener(WI.TreeOutline.Event.ElementRemoved, this._domBreakpointAddedOrRemoved, this);
+            this._domBreakpointTreeController = new WI.DOMBreakpointTreeController(this._domBreakpointsContentTreeOutline);
 
-            this._domBreakpointsRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Breakpoints"));
+            this._domBreakpointsRow = new WI.DetailsSectionRow(WI.UIString("No Breakpoints"));
             this._domBreakpointsRow.element.appendChild(this._domBreakpointsContentTreeOutline.element);
             this._domBreakpointsRow.showEmptyMessage();
 
             const defaultCollapsed = true;
 
-            let domBreakpointsGroup = new WebInspector.DetailsSectionGroup([this._domBreakpointsRow]);
-            this._domBreakpointsSection = new WebInspector.DetailsSection("dom-breakpoints", WebInspector.UIString("DOM Breakpoints"), [domBreakpointsGroup], null, defaultCollapsed);
+            let domBreakpointsGroup = new WI.DetailsSectionGroup([this._domBreakpointsRow]);
+            this._domBreakpointsSection = new WI.DetailsSection("dom-breakpoints", WI.UIString("DOM Breakpoints"), [domBreakpointsGroup], null, defaultCollapsed);
             this.contentView.element.appendChild(this._domBreakpointsSection.element);
 
             this._xhrBreakpointsContentTreeOutline = this.createContentTreeOutline(true);
-            this._xhrBreakpointTreeController = new WebInspector.XHRBreakpointTreeController(this._xhrBreakpointsContentTreeOutline);
+            this._xhrBreakpointTreeController = new WI.XHRBreakpointTreeController(this._xhrBreakpointsContentTreeOutline);
 
-            this._xhrBreakpointsRow = new WebInspector.DetailsSectionRow;
+            this._xhrBreakpointsRow = new WI.DetailsSectionRow;
             this._xhrBreakpointsRow.element.appendChild(this._xhrBreakpointsContentTreeOutline.element);
 
-            let navigationBar = new WebInspector.NavigationBar;
+            let navigationBar = new WI.NavigationBar;
             let navigationBarWrapper = document.createElement("div");
             navigationBarWrapper.appendChild(navigationBar.element);
 
-            let addXHRBreakpointButton = new WebInspector.ButtonNavigationItem("add-xhr-breakpoint", WebInspector.UIString("Add XHR Breakpoint"), "Images/Plus13.svg", 13, 13);
-            addXHRBreakpointButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._addXHRBreakpointButtonClicked, this);
+            let addXHRBreakpointButton = new WI.ButtonNavigationItem("add-xhr-breakpoint", WI.UIString("Add XHR Breakpoint"), "Images/Plus13.svg", 13, 13);
+            addXHRBreakpointButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._addXHRBreakpointButtonClicked, this);
             navigationBar.addNavigationItem(addXHRBreakpointButton);
 
-            let xhrBreakpointsGroup = new WebInspector.DetailsSectionGroup([this._xhrBreakpointsRow]);
-            let xhrBreakpointsSection = new WebInspector.DetailsSection("xhr-breakpoints", WebInspector.UIString("XHR Breakpoints"), [xhrBreakpointsGroup], navigationBarWrapper, defaultCollapsed);
+            let xhrBreakpointsGroup = new WI.DetailsSectionGroup([this._xhrBreakpointsRow]);
+            let xhrBreakpointsSection = new WI.DetailsSection("xhr-breakpoints", WI.UIString("XHR Breakpoints"), [xhrBreakpointsGroup], navigationBarWrapper, defaultCollapsed);
             this.contentView.element.appendChild(xhrBreakpointsSection.element);
         }
 
         this._scriptsContentTreeOutline = this.createContentTreeOutline();
-        this._scriptsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._scriptsContentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
         this._scriptsContentTreeOutline.includeSourceMapResourceChildren = true;
 
-        let scriptsRow = new WebInspector.DetailsSectionRow;
+        let scriptsRow = new WI.DetailsSectionRow;
         scriptsRow.element.appendChild(this._scriptsContentTreeOutline.element);
 
-        let scriptsGroup = new WebInspector.DetailsSectionGroup([scriptsRow]);
-        this._scriptsSection = new WebInspector.DetailsSection("scripts", WebInspector.UIString("Sources"), [scriptsGroup]);
+        let scriptsGroup = new WI.DetailsSectionGroup([scriptsRow]);
+        this._scriptsSection = new WI.DetailsSection("scripts", WI.UIString("Sources"), [scriptsGroup]);
         this.contentView.element.appendChild(this._scriptsSection.element);
 
         const suppressFiltering = true;
         this._callStackTreeOutline = this.createContentTreeOutline(suppressFiltering);
-        this._callStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._callStackTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
 
-        this._mainTargetTreeElement = new WebInspector.ThreadTreeElement(WebInspector.mainTarget);
+        this._mainTargetTreeElement = new WI.ThreadTreeElement(WI.mainTarget);
         this._callStackTreeOutline.appendChild(this._mainTargetTreeElement);
 
         this._updateCallStackTreeOutline();
 
-        this._callStackRow = new WebInspector.DetailsSectionRow;
+        this._callStackRow = new WI.DetailsSectionRow;
         this._callStackRow.element.appendChild(this._callStackTreeOutline.element);
 
-        this._callStackGroup = new WebInspector.DetailsSectionGroup([this._callStackRow]);
-        this._callStackSection = new WebInspector.DetailsSection("call-stack", WebInspector.UIString("Call Stack"), [this._callStackGroup]);
+        this._callStackGroup = new WI.DetailsSectionGroup([this._callStackRow]);
+        this._callStackSection = new WI.DetailsSection("call-stack", WI.UIString("Call Stack"), [this._callStackGroup]);
 
         this._showingSingleThreadCallStack = true;
 
@@ -234,25 +234,25 @@
         this._pauseReasonTreeOutline = null;
 
         this._pauseReasonLinkContainerElement = document.createElement("span");
-        this._pauseReasonTextRow = new WebInspector.DetailsSectionTextRow;
-        this._pauseReasonGroup = new WebInspector.DetailsSectionGroup([this._pauseReasonTextRow]);
-        this._pauseReasonSection = new WebInspector.DetailsSection("paused-reason", WebInspector.UIString("Pause Reason"), [this._pauseReasonGroup], this._pauseReasonLinkContainerElement);
+        this._pauseReasonTextRow = new WI.DetailsSectionTextRow;
+        this._pauseReasonGroup = new WI.DetailsSectionGroup([this._pauseReasonTextRow]);
+        this._pauseReasonSection = new WI.DetailsSection("paused-reason", WI.UIString("Pause Reason"), [this._pauseReasonGroup], this._pauseReasonLinkContainerElement);
 
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
-        WebInspector.IssueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
-        WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._handleIssueAdded, this);
-        WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.Cleared, this._handleIssuesCleared, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
+        WI.IssueMessage.addEventListener(WI.IssueMessage.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
+        WI.issueManager.addEventListener(WI.IssueManager.Event.IssueWasAdded, this._handleIssueAdded, this);
+        WI.issueManager.addEventListener(WI.IssueManager.Event.Cleared, this._handleIssuesCleared, this);
 
-        if (WebInspector.frameResourceManager.mainFrame)
-            this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);
+        if (WI.frameResourceManager.mainFrame)
+            this._addResourcesRecursivelyForFrame(WI.frameResourceManager.mainFrame);
 
-        for (var script of WebInspector.debuggerManager.knownNonResourceScripts)
+        for (var script of WI.debuggerManager.knownNonResourceScripts)
             this._addScript(script);
 
-        if (WebInspector.debuggerManager.paused)
+        if (WI.debuggerManager.paused)
             this._debuggerDidPause(null);
 
-        if (WebInspector.timelineManager.isCapturing() && WebInspector.debuggerManager.breakpointsDisabledTemporarily)
+        if (WI.timelineManager.isCapturing() && WI.debuggerManager.breakpointsDisabledTemporarily)
             this._timelineCapturingWillStart(null);
 
         this._updateBreakpointsDisabledBanner();
@@ -272,23 +272,23 @@
         this._domBreakpointTreeController.disconnect();
         this._domBreakpointTreeController = null;
 
-        WebInspector.Frame.removeEventListener(null, null, this);
-        WebInspector.debuggerManager.removeEventListener(null, null, this);
-        WebInspector.Breakpoint.removeEventListener(null, null, this);
-        WebInspector.IssueMessage.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
+        WI.debuggerManager.removeEventListener(null, null, this);
+        WI.Breakpoint.removeEventListener(null, null, this);
+        WI.IssueMessage.removeEventListener(null, null, this);
     }
 
     showDefaultContentView()
     {
-        if (WebInspector.frameResourceManager.mainFrame) {
-            let mainTreeElement = this._scriptsContentTreeOutline.findTreeElement(WebInspector.frameResourceManager.mainFrame.mainResource);
+        if (WI.frameResourceManager.mainFrame) {
+            let mainTreeElement = this._scriptsContentTreeOutline.findTreeElement(WI.frameResourceManager.mainFrame.mainResource);
             if (mainTreeElement && this.showDefaultContentViewForTreeElement(mainTreeElement))
                 return;
         }
 
         let currentTreeElement = this._scriptsContentTreeOutline.children[0];
         while (currentTreeElement && !currentTreeElement.root) {
-            if (currentTreeElement instanceof WebInspector.ResourceTreeElement || currentTreeElement instanceof WebInspector.ScriptTreeElement) {
+            if (currentTreeElement instanceof WI.ResourceTreeElement || currentTreeElement instanceof WI.ScriptTreeElement) {
                 if (this.showDefaultContentViewForTreeElement(currentTreeElement))
                     return;
             }
@@ -300,7 +300,7 @@
     treeElementForRepresentedObject(representedObject)
     {
         // The main resource is used as the representedObject instead of Frame in our tree.
-        if (representedObject instanceof WebInspector.Frame)
+        if (representedObject instanceof WI.Frame)
             representedObject = representedObject.mainResource;
 
         let treeElement = this._breakpointsContentTreeOutline.findTreeElement(representedObject);
@@ -311,7 +311,7 @@
             return treeElement;
 
         // Only special case Script objects.
-        if (!(representedObject instanceof WebInspector.Script)) {
+        if (!(representedObject instanceof WI.Script)) {
             console.error("Didn't find a TreeElement for representedObject", representedObject);
             return null;
         }
@@ -343,23 +343,23 @@
 
         var representedObject = selectedTreeElement.representedObject;
 
-        if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint) {
-            cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey] = true;
+        if (representedObject === WI.debuggerManager.allExceptionsBreakpoint) {
+            cookie[WI.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey] = true;
             return;
         }
 
-        if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint) {
-            cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey] = true;
+        if (representedObject === WI.debuggerManager.allUncaughtExceptionsBreakpoint) {
+            cookie[WI.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey] = true;
             return;
         }
 
-        if (representedObject === WebInspector.debuggerManager.assertionsBreakpoint) {
-            cookie[WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey] = true;
+        if (representedObject === WI.debuggerManager.assertionsBreakpoint) {
+            cookie[WI.DebuggerSidebarPanel.SelectedAssertionsCookieKey] = true;
             return;
         }
 
-        if (representedObject === WebInspector.domDebuggerManager.allRequestsBreakpoint) {
-            cookie[WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey] = true;
+        if (representedObject === WI.domDebuggerManager.allRequestsBreakpoint) {
+            cookie[WI.DebuggerSidebarPanel.SelectedAllRequestsCookieKey] = true;
             return;
         }
 
@@ -371,14 +371,14 @@
         console.assert(cookie);
 
         // Eagerly resolve the special breakpoints; otherwise, use the default behavior.
-        if (cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey])
+        if (cookie[WI.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey])
             this._allExceptionsBreakpointTreeElement.revealAndSelect();
-        else if (cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey])
+        else if (cookie[WI.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey])
             this._allUncaughtExceptionsBreakpointTreeElement.revealAndSelect();
-        else if (cookie[WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey])
+        else if (cookie[WI.DebuggerSidebarPanel.SelectedAssertionsCookieKey])
             this._assertionsBreakpointTreeElement.revealAndSelect();
-        else if (cookie[WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey])
-            this._xhrBreakpointTreeController.revealAndSelect(WebInspector.domDebuggerManager.allRequestsBreakpoint);
+        else if (cookie[WI.DebuggerSidebarPanel.SelectedAllRequestsCookieKey])
+            this._xhrBreakpointTreeController.revealAndSelect(WI.domDebuggerManager.allRequestsBreakpoint);
         else
             super.restoreStateFromCookie(cookie, relaxedMatchDelay);
     }
@@ -403,7 +403,7 @@
         this._debuggerStepIntoButtonItem.enabled = true;
         this._debuggerStepOutButtonItem.enabled = true;
 
-        this.element.classList.add(WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName);
+        this.element.classList.add(WI.DebuggerSidebarPanel.DebuggerPausedStyleClassName);
     }
 
     _debuggerDidResume(event)
@@ -418,12 +418,12 @@
         this._debuggerStepIntoButtonItem.enabled = false;
         this._debuggerStepOutButtonItem.enabled = false;
 
-        this.element.classList.remove(WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName);
+        this.element.classList.remove(WI.DebuggerSidebarPanel.DebuggerPausedStyleClassName);
     }
 
     _breakpointsEnabledDidChange(event)
     {
-        this._debuggerBreakpointsButtonItem.activated = WebInspector.debuggerManager.breakpointsEnabled;
+        this._debuggerBreakpointsButtonItem.activated = WI.debuggerManager.breakpointsEnabled;
 
         this._updateBreakpointsDisabledBanner();
     }
@@ -446,7 +446,7 @@
         if (breakpoint.disabled)
             breakpoint.resolved = true;
 
-        let breakpointTreeElement = new WebInspector.BreakpointTreeElement(breakpoint);
+        let breakpointTreeElement = new WI.BreakpointTreeElement(breakpoint);
         parentTreeElement.insertChild(breakpointTreeElement, insertionIndexForObjectInListSortedByFunction(breakpointTreeElement, parentTreeElement.children, this._compareTreeElements));
         if (parentTreeElement.children.length === 1)
             parentTreeElement.expand();
@@ -455,14 +455,14 @@
 
     _addBreakpointsForSourceCode(sourceCode)
     {
-        var breakpoints = WebInspector.debuggerManager.breakpointsForSourceCode(sourceCode);
+        var breakpoints = WI.debuggerManager.breakpointsForSourceCode(sourceCode);
         for (var i = 0; i < breakpoints.length; ++i)
             this._addBreakpoint(breakpoints[i], sourceCode);
     }
 
     _addIssuesForSourceCode(sourceCode)
     {
-        var issues = WebInspector.issueManager.issuesForSourceCode(sourceCode);
+        var issues = WI.issueManager.issuesForSourceCode(sourceCode);
         for (var issue of issues)
             this._addIssue(issue);
     }
@@ -471,12 +471,12 @@
     {
         let treeElement = treeOutline.getCachedTreeElement(sourceCode);
         if (!treeElement) {
-            if (sourceCode instanceof WebInspector.SourceMapResource)
-                treeElement = new WebInspector.SourceMapResourceTreeElement(sourceCode);
-            else if (sourceCode instanceof WebInspector.Resource)
-                treeElement = new WebInspector.ResourceTreeElement(sourceCode);
-            else if (sourceCode instanceof WebInspector.Script)
-                treeElement = new WebInspector.ScriptTreeElement(sourceCode);
+            if (sourceCode instanceof WI.SourceMapResource)
+                treeElement = new WI.SourceMapResourceTreeElement(sourceCode);
+            else if (sourceCode instanceof WI.Resource)
+                treeElement = new WI.ResourceTreeElement(sourceCode);
+            else if (sourceCode instanceof WI.Script)
+                treeElement = new WI.ScriptTreeElement(sourceCode);
         }
 
         if (!treeElement) {
@@ -512,7 +512,7 @@
 
     _addResource(resource)
     {
-        if (![WebInspector.Resource.Type.Document, WebInspector.Resource.Type.Script].includes(resource.type))
+        if (![WI.Resource.Type.Document, WI.Resource.Type.Script].includes(resource.type))
             return;
 
         let treeElement = this._addTreeElementForSourceCodeToTreeOutline(resource, this._scriptsContentTreeOutline);
@@ -561,7 +561,7 @@
 
     _updateBreakpointsDisabledBanner()
     {
-        let breakpointsEnabled = WebInspector.debuggerManager.breakpointsEnabled;
+        let breakpointsEnabled = WI.debuggerManager.breakpointsEnabled;
         let timelineWarningShowing = !!this._timelineRecordingWarningElement.parentElement;
 
         if (!breakpointsEnabled && !timelineWarningShowing)
@@ -618,7 +618,7 @@
     {
         for (var i = this._breakpointsContentTreeOutline.children.length - 1; i >= 0; --i) {
             var treeElement = this._breakpointsContentTreeOutline.children[i];
-            if (!(treeElement instanceof WebInspector.ScriptTreeElement))
+            if (!(treeElement instanceof WI.ScriptTreeElement))
                 continue;
 
             this._breakpointsContentTreeOutline.removeChildAtIndex(i, true, true);
@@ -626,7 +626,7 @@
 
         this._scriptsContentTreeOutline.removeChildren();
 
-        this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);
+        this._addResourcesRecursivelyForFrame(WI.frameResourceManager.mainFrame);
     }
 
     _breakpointAdded(event)
@@ -666,7 +666,7 @@
     _targetAdded(event)
     {
         let target = event.data.target;
-        let treeElement = new WebInspector.ThreadTreeElement(target);
+        let treeElement = new WI.ThreadTreeElement(target);
         this._callStackTreeOutline.appendChild(treeElement);
 
         this._updateCallStackTreeOutline();
@@ -683,7 +683,7 @@
 
     _updateCallStackTreeOutline()
     {
-        let singleThreadShowing = WebInspector.targets.size === 1;
+        let singleThreadShowing = WI.targets.size === 1;
         this._callStackTreeOutline.element.classList.toggle("single-thread", singleThreadShowing);
         this._mainTargetTreeElement.selectable = !singleThreadShowing;
     }
@@ -743,24 +743,24 @@
             this._activeCallFrameTreeElement = null;
         }
 
-        if (!WebInspector.debuggerManager.activeCallFrame)
+        if (!WI.debuggerManager.activeCallFrame)
             return;
 
-        this._activeCallFrameTreeElement = this._callStackTreeOutline.findTreeElement(WebInspector.debuggerManager.activeCallFrame);
+        this._activeCallFrameTreeElement = this._callStackTreeOutline.findTreeElement(WI.debuggerManager.activeCallFrame);
         if (this._activeCallFrameTreeElement)
             this._activeCallFrameTreeElement.isActiveCallFrame = true;
     }
 
     _breakpointsBeneathTreeElement(treeElement)
     {
-        console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement);
-        if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
+        console.assert(treeElement instanceof WI.ResourceTreeElement || treeElement instanceof WI.ScriptTreeElement);
+        if (!(treeElement instanceof WI.ResourceTreeElement) && !(treeElement instanceof WI.ScriptTreeElement))
             return [];
 
         var breakpoints = [];
         var breakpointTreeElements = treeElement.children;
         for (var i = 0; i < breakpointTreeElements.length; ++i) {
-            console.assert(breakpointTreeElements[i] instanceof WebInspector.BreakpointTreeElement);
+            console.assert(breakpointTreeElements[i] instanceof WI.BreakpointTreeElement);
             console.assert(breakpointTreeElements[i].breakpoint);
             var breakpoint = breakpointTreeElements[i].breakpoint;
             if (breakpoint)
@@ -774,8 +774,8 @@
     {
         for (var i = 0; i < breakpoints.length; ++i) {
             var breakpoint = breakpoints[i];
-            if (WebInspector.debuggerManager.isBreakpointRemovable(breakpoint))
-                WebInspector.debuggerManager.removeBreakpoint(breakpoint);
+            if (WI.debuggerManager.isBreakpointRemovable(breakpoint))
+                WI.debuggerManager.removeBreakpoint(breakpoint);
         }
     }
 
@@ -788,8 +788,8 @@
     _breakpointTreeOutlineDeleteTreeElement(treeElement)
     {
         console.assert(treeElement.selected);
-        console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement);
-        if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
+        console.assert(treeElement instanceof WI.ResourceTreeElement || treeElement instanceof WI.ScriptTreeElement);
+        if (!(treeElement instanceof WI.ResourceTreeElement) && !(treeElement instanceof WI.ScriptTreeElement))
             return false;
 
         var wasTopResourceTreeElement = treeElement.previousSibling === this._assertionsBreakpointTreeElement || treeElement.previousSibling === this._allUncaughtExceptionsBreakpointTreeElement;
@@ -808,7 +808,7 @@
     {
         // This check is necessary since the context menu is created by the TreeOutline, meaning
         // that any child could be the target of the context menu event.
-        if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
+        if (!(treeElement instanceof WI.ResourceTreeElement) && !(treeElement instanceof WI.ScriptTreeElement))
             return;
 
         let breakpoints = this._breakpointsBeneathTreeElement(treeElement);
@@ -823,10 +823,10 @@
         };
 
         if (shouldDisable)
-            contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"), toggleAllResourceBreakpoints);
+            contextMenu.appendItem(WI.UIString("Disable Breakpoints"), toggleAllResourceBreakpoints);
         else
-            contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"), toggleAllResourceBreakpoints);
-        contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), removeAllResourceBreakpoints);
+            contextMenu.appendItem(WI.UIString("Enable Breakpoints"), toggleAllResourceBreakpoints);
+        contextMenu.appendItem(WI.UIString("Delete Breakpoints"), removeAllResourceBreakpoints);
     }
 
     _treeSelectionDidChange(event)
@@ -843,53 +843,53 @@
             ignoreSearchTab: true,
         };
 
-        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
-            WebInspector.showSourceCode(treeElement.representedObject, options);
+        if (treeElement instanceof WI.ResourceTreeElement || treeElement instanceof WI.ScriptTreeElement) {
+            WI.showSourceCode(treeElement.representedObject, options);
             return;
         }
 
-        if (treeElement instanceof WebInspector.CallFrameTreeElement) {
+        if (treeElement instanceof WI.CallFrameTreeElement) {
             let callFrame = treeElement.callFrame;
             if (callFrame.id)
-                WebInspector.debuggerManager.activeCallFrame = callFrame;
+                WI.debuggerManager.activeCallFrame = callFrame;
 
             if (callFrame.sourceCodeLocation)
-                WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation, options);
+                WI.showSourceCodeLocation(callFrame.sourceCodeLocation, options);
 
             return;
         }
 
-        if (treeElement instanceof WebInspector.IssueTreeElement) {
-            WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation, options);
+        if (treeElement instanceof WI.IssueTreeElement) {
+            WI.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation, options);
             return;
         }
 
-        if (!(treeElement instanceof WebInspector.BreakpointTreeElement))
+        if (!(treeElement instanceof WI.BreakpointTreeElement))
             return;
 
         let breakpoint = treeElement.breakpoint;
         if (treeElement.treeOutline === this._pauseReasonTreeOutline) {
-            WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation, options);
+            WI.showSourceCodeLocation(breakpoint.sourceCodeLocation, options);
             return;
         }
 
         if (!treeElement.parent.representedObject)
             return;
 
-        console.assert(treeElement.parent.representedObject instanceof WebInspector.SourceCode);
-        if (!(treeElement.parent.representedObject instanceof WebInspector.SourceCode))
+        console.assert(treeElement.parent.representedObject instanceof WI.SourceCode);
+        if (!(treeElement.parent.representedObject instanceof WI.SourceCode))
             return;
 
-        WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation, options);
+        WI.showSourceCodeLocation(breakpoint.sourceCodeLocation, options);
     }
 
     _compareTopLevelTreeElements(a, b)
     {
         function isSpecialBreakpoint(treeElement)
         {
-            return treeElement.representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint
-                || treeElement.representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint
-                || treeElement.representedObject === WebInspector.debuggerManager.assertionsBreakpoint;
+            return treeElement.representedObject === WI.debuggerManager.allExceptionsBreakpoint
+                || treeElement.representedObject === WI.debuggerManager.allUncaughtExceptionsBreakpoint
+                || treeElement.representedObject === WI.debuggerManager.assertionsBreakpoint;
         }
 
         if (isSpecialBreakpoint(a))
@@ -927,33 +927,33 @@
 
     _updatePauseReasonSection()
     {
-        let target = WebInspector.debuggerManager.activeCallFrame.target;
-        let targetData = WebInspector.debuggerManager.dataForTarget(target);
+        let target = WI.debuggerManager.activeCallFrame.target;
+        let targetData = WI.debuggerManager.dataForTarget(target);
         let {pauseReason, pauseData} = targetData;
 
         switch (pauseReason) {
-        case WebInspector.DebuggerManager.PauseReason.Assertion:
+        case WI.DebuggerManager.PauseReason.Assertion:
             // FIXME: We should include the assertion condition string.
             console.assert(pauseData, "Expected data with an assertion, but found none.");
             if (pauseData && pauseData.message) {
-                this._pauseReasonTextRow.text = WebInspector.UIString("Assertion with message: %s").format(pauseData.message);
+                this._pauseReasonTextRow.text = WI.UIString("Assertion with message: %s").format(pauseData.message);
                 return true;
             }
 
-            this._pauseReasonTextRow.text = WebInspector.UIString("Assertion Failed");
+            this._pauseReasonTextRow.text = WI.UIString("Assertion Failed");
             this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
             return true;
 
-        case WebInspector.DebuggerManager.PauseReason.Breakpoint:
+        case WI.DebuggerManager.PauseReason.Breakpoint:
             console.assert(pauseData, "Expected breakpoint identifier, but found none.");
             if (pauseData && pauseData.breakpointId) {
                 const suppressFiltering = true;
                 this._pauseReasonTreeOutline = this.createContentTreeOutline(suppressFiltering);
-                this._pauseReasonTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+                this._pauseReasonTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
 
-                let breakpoint = WebInspector.debuggerManager.breakpointForIdentifier(pauseData.breakpointId);
-                let breakpointTreeElement = new WebInspector.BreakpointTreeElement(breakpoint, WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, WebInspector.UIString("Triggered Breakpoint"));
-                let breakpointDetailsSection = new WebInspector.DetailsSectionRow;
+                let breakpoint = WI.debuggerManager.breakpointForIdentifier(pauseData.breakpointId);
+                let breakpointTreeElement = new WI.BreakpointTreeElement(breakpoint, WI.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, WI.UIString("Triggered Breakpoint"));
+                let breakpointDetailsSection = new WI.DetailsSectionRow;
                 this._pauseReasonTreeOutline.appendChild(breakpointTreeElement);
                 breakpointDetailsSection.element.appendChild(this._pauseReasonTreeOutline.element);
 
@@ -962,27 +962,27 @@
             }
             break;
 
-        case WebInspector.DebuggerManager.PauseReason.CSPViolation:
+        case WI.DebuggerManager.PauseReason.CSPViolation:
             console.assert(pauseData, "Expected data with a CSP Violation, but found none.");
             if (pauseData) {
                 // COMPATIBILITY (iOS 8): 'directive' was 'directiveText'.
-                this._pauseReasonTextRow.text = WebInspector.UIString("Content Security Policy violation of directive: %s").format(pauseData.directive || pauseData.directiveText);
+                this._pauseReasonTextRow.text = WI.UIString("Content Security Policy violation of directive: %s").format(pauseData.directive || pauseData.directiveText);
                 this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
                 return true;
             }
             break;
 
-        case WebInspector.DebuggerManager.PauseReason.DebuggerStatement:
-            this._pauseReasonTextRow.text = WebInspector.UIString("Debugger Statement");
+        case WI.DebuggerManager.PauseReason.DebuggerStatement:
+            this._pauseReasonTextRow.text = WI.UIString("Debugger Statement");
             this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
             return true;
 
-        case WebInspector.DebuggerManager.PauseReason.DOM:
-            console.assert(WebInspector.domDebuggerManager.supported);
+        case WI.DebuggerManager.PauseReason.DOM:
+            console.assert(WI.domDebuggerManager.supported);
             console.assert(pauseData, "Expected DOM breakpoint data, but found none.");
             if (pauseData && pauseData.nodeId) {
-                let domNode = WebInspector.domTreeManager.nodeForId(pauseData.nodeId);
-                let domBreakpoints = WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);
+                let domNode = WI.domTreeManager.nodeForId(pauseData.nodeId);
+                let domBreakpoints = WI.domDebuggerManager.domBreakpointsForNode(domNode);
                 let domBreakpoint;
                 for (let breakpoint of domBreakpoints) {
                     if (breakpoint.type === pauseData.type) {
@@ -997,35 +997,35 @@
                 const suppressFiltering = true;
                 this._pauseReasonTreeOutline = this.createContentTreeOutline(suppressFiltering);
 
-                let type = WebInspector.DOMBreakpointTreeElement.displayNameForType(domBreakpoint.type);
-                let domBreakpointTreeElement = new WebInspector.DOMBreakpointTreeElement(domBreakpoint, WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, type);
-                let domBreakpointRow = new WebInspector.DetailsSectionRow;
+                let type = WI.DOMBreakpointTreeElement.displayNameForType(domBreakpoint.type);
+                let domBreakpointTreeElement = new WI.DOMBreakpointTreeElement(domBreakpoint, WI.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, type);
+                let domBreakpointRow = new WI.DetailsSectionRow;
                 this._pauseReasonTreeOutline.appendChild(domBreakpointTreeElement);
                 domBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element);
 
-                let ownerElementRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Element"), WebInspector.linkifyNodeReference(domNode));
+                let ownerElementRow = new WI.DetailsSectionSimpleRow(WI.UIString("Element"), WI.linkifyNodeReference(domNode));
                 this._pauseReasonGroup.rows = [domBreakpointRow, ownerElementRow];
 
-                if (domBreakpoint.type !== WebInspector.DOMBreakpoint.Type.SubtreeModified)
+                if (domBreakpoint.type !== WI.DOMBreakpoint.Type.SubtreeModified)
                     return true;
 
                 console.assert(pauseData.targetNode);
 
-                let remoteObject = WebInspector.RemoteObject.fromPayload(pauseData.targetNode, target);
+                let remoteObject = WI.RemoteObject.fromPayload(pauseData.targetNode, target);
                 remoteObject.pushNodeToFrontend((nodeId) => {
                     if (!nodeId)
                         return;
 
-                    let node = WebInspector.domTreeManager.nodeForId(nodeId);
+                    let node = WI.domTreeManager.nodeForId(nodeId);
                     console.assert(node, "Missing node for id.", nodeId);
                     if (!node)
                         return;
 
                     let fragment = document.createDocumentFragment();
-                    let description = pauseData.insertion ? WebInspector.UIString("Child added to ") : WebInspector.UIString("Removed descendant ");
-                    fragment.append(description, WebInspector.linkifyNodeReference(node));
+                    let description = pauseData.insertion ? WI.UIString("Child added to ") : WI.UIString("Removed descendant ");
+                    fragment.append(description, WI.linkifyNodeReference(node));
 
-                    let targetDescriptionRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Details"), fragment);
+                    let targetDescriptionRow = new WI.DetailsSectionSimpleRow(WI.UIString("Details"), fragment);
                     targetDescriptionRow.element.classList.add("target-description");
 
                     this._pauseReasonGroup.rows = this._pauseReasonGroup.rows.concat(targetDescriptionRow);
@@ -1035,34 +1035,34 @@
             }
             break;
 
-        case WebInspector.DebuggerManager.PauseReason.Exception:
+        case WI.DebuggerManager.PauseReason.Exception:
             console.assert(pauseData, "Expected data with an exception, but found none.");
             if (pauseData) {
                 // FIXME: We should improve the appearance of thrown objects. This works well for exception strings.
-                var data = WebInspector.RemoteObject.fromPayload(pauseData, target);
-                this._pauseReasonTextRow.text = WebInspector.UIString("Exception with thrown value: %s").format(data.description);
+                var data = WI.RemoteObject.fromPayload(pauseData, target);
+                this._pauseReasonTextRow.text = WI.UIString("Exception with thrown value: %s").format(data.description);
                 this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
                 return true;
             }
             break;
 
-        case WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement:
-            this._pauseReasonTextRow.text = WebInspector.UIString("Immediate Pause Requested");
+        case WI.DebuggerManager.PauseReason.PauseOnNextStatement:
+            this._pauseReasonTextRow.text = WI.UIString("Immediate Pause Requested");
             this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
             return true;
 
-        case WebInspector.DebuggerManager.PauseReason.XHR:
-            console.assert(WebInspector.domDebuggerManager.supported);
+        case WI.DebuggerManager.PauseReason.XHR:
+            console.assert(WI.domDebuggerManager.supported);
             console.assert(pauseData, "Expected XHR breakpoint data, but found none.");
             if (pauseData) {
                 if (pauseData.breakpointURL) {
-                    let xhrBreakpoint = WebInspector.domDebuggerManager.xhrBreakpointForURL(pauseData.breakpointURL);
+                    let xhrBreakpoint = WI.domDebuggerManager.xhrBreakpointForURL(pauseData.breakpointURL);
                     console.assert(xhrBreakpoint, "Expected XHR breakpoint for URL.", pauseData.breakpointURL);
 
                     this._pauseReasonTreeOutline = this.createContentTreeOutline(true);
 
-                    let xhrBreakpointTreeElement = new WebInspector.XHRBreakpointTreeElement(xhrBreakpoint, WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, WebInspector.UIString("Triggered XHR Breakpoint"));
-                    let xhrBreakpointRow = new WebInspector.DetailsSectionRow;
+                    let xhrBreakpointTreeElement = new WI.XHRBreakpointTreeElement(xhrBreakpoint, WI.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, WI.UIString("Triggered XHR Breakpoint"));
+                    let xhrBreakpointRow = new WI.DetailsSectionRow;
                     this._pauseReasonTreeOutline.appendChild(xhrBreakpointTreeElement);
                     xhrBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element);
 
@@ -1070,7 +1070,7 @@
                     this._pauseReasonGroup.rows = [xhrBreakpointRow, this._pauseReasonTextRow];
                 } else {
                     console.assert(pauseData.breakpointURL === "", "Should be the All Requests breakpoint which has an empty URL");
-                    this._pauseReasonTextRow.text = WebInspector.UIString("Requesting: %s").format(pauseData.url);
+                    this._pauseReasonTextRow.text = WI.UIString("Requesting: %s").format(pauseData.url);
                     this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
                 }
                 this._pauseReasonTextRow.element.title = pauseData.url;
@@ -1078,7 +1078,7 @@
             }
             break;
 
-        case WebInspector.DebuggerManager.PauseReason.Other:
+        case WI.DebuggerManager.PauseReason.Other:
             console.error("Paused for unknown reason. We should always have a reason.");
             break;
         }
@@ -1090,7 +1090,7 @@
     {
         this._pauseReasonLinkContainerElement.removeChildren();
 
-        var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+        var activeCallFrame = WI.debuggerManager.activeCallFrame;
         if (!activeCallFrame)
             return;
 
@@ -1103,16 +1103,16 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        let linkElement = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, options);
+        let linkElement = WI.createSourceCodeLocationLink(sourceCodeLocation, options);
         this._pauseReasonLinkContainerElement.appendChild(linkElement);
     }
 
     _addDebuggerObject(debuggerObject)
     {
-        if (debuggerObject instanceof WebInspector.Breakpoint)
+        if (debuggerObject instanceof WI.Breakpoint)
             return this._addBreakpoint(debuggerObject);
 
-        if (debuggerObject instanceof WebInspector.IssueMessage)
+        if (debuggerObject instanceof WI.IssueMessage)
             return this._addIssue(debuggerObject);
 
         return null;
@@ -1128,7 +1128,7 @@
         if (!parentTreeElement)
             return null;
 
-        issueTreeElement = new WebInspector.IssueTreeElement(issueMessage);
+        issueTreeElement = new WI.IssueTreeElement(issueMessage);
 
         parentTreeElement.insertChild(issueTreeElement, insertionIndexForObjectInListSortedByFunction(issueTreeElement, parentTreeElement.children, this._compareTreeElements));
         if (parentTreeElement.children.length === 1)
@@ -1154,7 +1154,7 @@
         let issueTreeElements = [];
 
         while (currentTreeElement && !currentTreeElement.root) {
-            if (currentTreeElement instanceof WebInspector.IssueTreeElement)
+            if (currentTreeElement instanceof WI.IssueTreeElement)
                 issueTreeElements.push(currentTreeElement);
             currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, true);
         }
@@ -1180,31 +1180,31 @@
 
     _addXHRBreakpointButtonClicked(event)
     {
-        let popover = new WebInspector.XHRBreakpointPopover(this);
-        popover.show(event.target.element, [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+        let popover = new WI.XHRBreakpointPopover(this);
+        popover.show(event.target.element, [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]);
     }
 
     // Popover delegate
 
     willDismissPopover(popover)
     {
-        if (popover.result !== WebInspector.InputPopover.Result.Committed)
+        if (popover.result !== WI.InputPopover.Result.Committed)
             return;
 
         let url = popover.value;
         if (!url)
             return;
 
-        WebInspector.domDebuggerManager.addXHRBreakpoint(new WebInspector.XHRBreakpoint(popover.type, url));
+        WI.domDebuggerManager.addXHRBreakpoint(new WI.XHRBreakpoint(popover.type, url));
     }
 };
 
-WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName = "paused";
-WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName = "breakpoint-exception-icon";
-WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName = "breakpoint-assertion-icon";
-WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName = "breakpoint-paused-icon";
+WI.DebuggerSidebarPanel.DebuggerPausedStyleClassName = "paused";
+WI.DebuggerSidebarPanel.ExceptionIconStyleClassName = "breakpoint-exception-icon";
+WI.DebuggerSidebarPanel.AssertionIconStyleClassName = "breakpoint-assertion-icon";
+WI.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName = "breakpoint-paused-icon";
 
-WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey = "debugger-sidebar-panel-all-exceptions-breakpoint";
-WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey = "debugger-sidebar-panel-all-uncaught-exceptions-breakpoint";
-WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey = "debugger-sidebar-panel-assertions-breakpoint";
-WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey = "debugger-sidebar-panel-all-requests-breakpoint";
+WI.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey = "debugger-sidebar-panel-all-exceptions-breakpoint";
+WI.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey = "debugger-sidebar-panel-all-uncaught-exceptions-breakpoint";
+WI.DebuggerSidebarPanel.SelectedAssertionsCookieKey = "debugger-sidebar-panel-assertions-breakpoint";
+WI.DebuggerSidebarPanel.SelectedAllRequestsCookieKey = "debugger-sidebar-panel-all-requests-breakpoint";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js
index 72ad26a..1c4eba0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js
@@ -23,22 +23,22 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerTabContentView = class DebuggerTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.DebuggerTabContentView = class DebuggerTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.DebuggerTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.ScopeChainDetailsSidebarPanel, WebInspector.ResourceDetailsSidebarPanel, WebInspector.ProbeDetailsSidebarPanel];
+        let {image, title} = WI.DebuggerTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.ScopeChainDetailsSidebarPanel, WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel];
 
-        super(identifier || "debugger", "debugger", tabBarItem, WebInspector.DebuggerSidebarPanel, detailsSidebarPanelConstructors);
+        super(identifier || "debugger", "debugger", tabBarItem, WI.DebuggerSidebarPanel, detailsSidebarPanelConstructors);
     }
 
     static tabInfo()
     {
         return {
             image: "Images/Debugger.svg",
-            title: WebInspector.UIString("Debugger"),
+            title: WI.UIString("Debugger"),
         };
     }
 
@@ -46,7 +46,7 @@
 
     get type()
     {
-        return WebInspector.DebuggerTabContentView.Type;
+        return WI.DebuggerTabContentView.Type;
     }
 
     get supportsSplitContentBrowser()
@@ -56,13 +56,13 @@
 
     canShowRepresentedObject(representedObject)
     {
-        if (representedObject instanceof WebInspector.Script)
+        if (representedObject instanceof WI.Script)
             return true;
 
-        if (!(representedObject instanceof WebInspector.Resource))
+        if (!(representedObject instanceof WI.Resource))
             return false;
 
-        return representedObject.type === WebInspector.Resource.Type.Document || representedObject.type === WebInspector.Resource.Type.Script;
+        return representedObject.type === WI.Resource.Type.Document || representedObject.type === WI.Resource.Type.Script;
     }
 
     showDetailsSidebarPanels()
@@ -72,7 +72,7 @@
         if (!this._showScopeChainDetailsSidebarPanel)
             return;
 
-        let scopeChainDetailsSidebarPanel = WebInspector.instanceForClass(WebInspector.ScopeChainDetailsSidebarPanel);
+        let scopeChainDetailsSidebarPanel = WI.instanceForClass(WI.ScopeChainDetailsSidebarPanel);
         if (!scopeChainDetailsSidebarPanel.parentSidebar)
             return;
 
@@ -88,7 +88,7 @@
 
     revealAndSelectBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
 
         var treeElement = this.navigationSidebarPanel.treeElementForRepresentedObject(breakpoint);
         if (treeElement)
@@ -96,4 +96,4 @@
     }
 };
 
-WebInspector.DebuggerTabContentView.Type = "debugger";
+WI.DebuggerTabContentView.Type = "debugger";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js b/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js
index 79ce123..ef7b66e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js
@@ -23,39 +23,39 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DefaultDashboardView = class DefaultDashboardView extends WebInspector.DashboardView
+WI.DefaultDashboardView = class DefaultDashboardView extends WI.DashboardView
 {
     constructor(representedObject)
     {
         super(representedObject, "default");
 
-        representedObject.addEventListener(WebInspector.DefaultDashboard.Event.DataDidChange, () => { this._updateDisplaySoon(); });
+        representedObject.addEventListener(WI.DefaultDashboard.Event.DataDidChange, () => { this._updateDisplaySoon(); });
         this._scheduledUpdateIdentifier = undefined;
 
         this._items = {
             resourcesCount: {
-                tooltip: WebInspector.UIString("Show page resources"),
+                tooltip: WI.UIString("Show page resources"),
                 handler: this._resourcesItemWasClicked
             },
             resourcesSize: {
-                tooltip: WebInspector.UIString("Show network information"),
+                tooltip: WI.UIString("Show network information"),
                 handler: this._networkItemWasClicked
             },
             time: {
-                tooltip: WebInspector.UIString("Show page load timing"),
+                tooltip: WI.UIString("Show page load timing"),
                 handler: this._timelineItemWasClicked
             },
             logs: {
-                tooltip: WebInspector.UIString("Show messages logged to the Console"),
-                handler: this._consoleItemWasClicked.bind(this, WebInspector.LogContentView.Scopes.Logs)
+                tooltip: WI.UIString("Show messages logged to the Console"),
+                handler: this._consoleItemWasClicked.bind(this, WI.LogContentView.Scopes.Logs)
             },
             errors: {
-                tooltip: WebInspector.UIString("Show errors logged to the Console"),
-                handler: this._consoleItemWasClicked.bind(this, WebInspector.LogContentView.Scopes.Errors)
+                tooltip: WI.UIString("Show errors logged to the Console"),
+                handler: this._consoleItemWasClicked.bind(this, WI.LogContentView.Scopes.Errors)
             },
             issues: {
-                tooltip: WebInspector.UIString("Show warnings logged to the Console"),
-                handler: this._consoleItemWasClicked.bind(this, WebInspector.LogContentView.Scopes.Warnings)
+                tooltip: WI.UIString("Show warnings logged to the Console"),
+                handler: this._consoleItemWasClicked.bind(this, WI.LogContentView.Scopes.Warnings)
             }
         };
 
@@ -124,7 +124,7 @@
     _itemWasClicked(name)
     {
         var item = this._items[name];
-        if (!item.container.classList.contains(WebInspector.DefaultDashboardView.EnabledItemStyleClassName))
+        if (!item.container.classList.contains(WI.DefaultDashboardView.EnabledItemStyleClassName))
             return;
 
         if (item.handler)
@@ -133,22 +133,22 @@
 
     _resourcesItemWasClicked()
     {
-        WebInspector.showResourcesTab();
+        WI.showResourcesTab();
     }
 
     _networkItemWasClicked()
     {
-        WebInspector.showNetworkTab();
+        WI.showNetworkTab();
     }
 
     _timelineItemWasClicked()
     {
-        WebInspector.showTimelineTab();
+        WI.showTimelineTab();
     }
 
     _consoleItemWasClicked(scope)
     {
-        WebInspector.showConsoleTab(scope);
+        WI.showConsoleTab(scope);
     }
 
     _setConsoleItemValue(itemName, newValue)
@@ -189,12 +189,12 @@
     {
         if (enabled) {
             item.container.title = item.tooltip;
-            item.container.classList.add(WebInspector.DefaultDashboardView.EnabledItemStyleClassName);
+            item.container.classList.add(WI.DefaultDashboardView.EnabledItemStyleClassName);
         } else {
             item.container.title = "";
-            item.container.classList.remove(WebInspector.DefaultDashboardView.EnabledItemStyleClassName);
+            item.container.classList.remove(WI.DefaultDashboardView.EnabledItemStyleClassName);
         }
     }
 };
 
-WebInspector.DefaultDashboardView.EnabledItemStyleClassName = "enabled";
+WI.DefaultDashboardView.EnabledItemStyleClassName = "enabled";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSection.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSection.js
index b10506f..30aa13e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSection.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSection.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSection = class DetailsSection extends WebInspector.Object
+WI.DetailsSection = class DetailsSection extends WI.Object
 {
     constructor(identifier, title, groups, optionsElement, defaultCollapsedSettingValue)
     {
@@ -56,9 +56,9 @@
 
         this._identifier = identifier;
         this.title = title;
-        this.groups = groups || [new WebInspector.DetailsSectionGroup];
+        this.groups = groups || [new WI.DetailsSectionGroup];
 
-        this._collapsedSetting = new WebInspector.Setting(identifier + "-details-section-collapsed", !!defaultCollapsedSettingValue);
+        this._collapsedSetting = new WI.Setting(identifier + "-details-section-collapsed", !!defaultCollapsedSettingValue);
         this.collapsed = this._collapsedSetting.value;
         this._expandedByUser = false;
     }
@@ -100,19 +100,19 @@
 
     get collapsed()
     {
-        return this._element.classList.contains(WebInspector.DetailsSection.CollapsedStyleClassName);
+        return this._element.classList.contains(WI.DetailsSection.CollapsedStyleClassName);
     }
 
     set collapsed(flag)
     {
         if (flag)
-            this._element.classList.add(WebInspector.DetailsSection.CollapsedStyleClassName);
+            this._element.classList.add(WI.DetailsSection.CollapsedStyleClassName);
         else
-            this._element.classList.remove(WebInspector.DetailsSection.CollapsedStyleClassName);
+            this._element.classList.remove(WI.DetailsSection.CollapsedStyleClassName);
 
         this._collapsedSetting.value = flag || false;
 
-        this.dispatchEventToListeners(WebInspector.DetailsSection.Event.CollapsedStateChanged, {collapsed: this._collapsedSetting.value});
+        this.dispatchEventToListeners(WI.DetailsSection.Event.CollapsedStateChanged, {collapsed: this._collapsedSetting.value});
     }
 
     get groups()
@@ -151,18 +151,18 @@
 
     _optionsElementMouseDown(event)
     {
-        this._headerElement.classList.add(WebInspector.DetailsSection.MouseOverOptionsElementStyleClassName);
+        this._headerElement.classList.add(WI.DetailsSection.MouseOverOptionsElementStyleClassName);
     }
 
     _optionsElementMouseUp(event)
     {
-        this._headerElement.classList.remove(WebInspector.DetailsSection.MouseOverOptionsElementStyleClassName);
+        this._headerElement.classList.remove(WI.DetailsSection.MouseOverOptionsElementStyleClassName);
     }
 };
 
-WebInspector.DetailsSection.CollapsedStyleClassName = "collapsed";
-WebInspector.DetailsSection.MouseOverOptionsElementStyleClassName = "mouse-over-options-element";
+WI.DetailsSection.CollapsedStyleClassName = "collapsed";
+WI.DetailsSection.MouseOverOptionsElementStyleClassName = "mouse-over-options-element";
 
-WebInspector.DetailsSection.Event = {
+WI.DetailsSection.Event = {
     CollapsedStateChanged: "details-section-collapsed-state-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionDataGridRow.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionDataGridRow.js
index 1c8d7e3..fee6872 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionDataGridRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionDataGridRow.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSectionDataGridRow = class DetailsSectionDataGridRow extends WebInspector.DetailsSectionRow
+WI.DetailsSectionDataGridRow = class DetailsSectionDataGridRow extends WI.DetailsSectionRow
 {
     constructor(dataGrid, emptyMessage)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionGroup.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionGroup.js
index e5d904a..b39f183 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionGroup.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionGroup.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSectionGroup = class DetailsSectionGroup extends WebInspector.Object
+WI.DetailsSectionGroup = class DetailsSectionGroup extends WI.Object
 {
     constructor(rows)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionRow.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionRow.js
index 8e98df5..671df1f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionRow.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSectionRow = class DetailsSectionRow extends WebInspector.Object
+WI.DetailsSectionRow = class DetailsSectionRow extends WI.Object
 {
     constructor(emptyMessage)
     {
@@ -57,7 +57,7 @@
 
     showEmptyMessage()
     {
-        this.element.classList.add(WebInspector.DetailsSectionRow.EmptyStyleClassName);
+        this.element.classList.add(WI.DetailsSectionRow.EmptyStyleClassName);
 
         if (this._emptyMessage instanceof Node) {
             this.element.removeChildren();
@@ -68,9 +68,9 @@
 
     hideEmptyMessage()
     {
-        this.element.classList.remove(WebInspector.DetailsSectionRow.EmptyStyleClassName);
+        this.element.classList.remove(WI.DetailsSectionRow.EmptyStyleClassName);
         this.element.removeChildren();
     }
 };
 
-WebInspector.DetailsSectionRow.EmptyStyleClassName = "empty";
+WI.DetailsSectionRow.EmptyStyleClassName = "empty";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionSimpleRow.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionSimpleRow.js
index 2efcd8e..8e4c34c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionSimpleRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionSimpleRow.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSectionSimpleRow = class DetailsSectionSimpleRow extends WebInspector.DetailsSectionRow
+WI.DetailsSectionSimpleRow = class DetailsSectionSimpleRow extends WI.DetailsSectionRow
 {
     constructor(label, value)
     {
@@ -43,7 +43,7 @@
         // <div> set to "display: table-cell" selects text outside the cell.
         //
         // On triple-click, adjust the selection range to include only the value
-        // element if the selection extends WebInspector.beyond it.
+        // element if the selection extends WI.beyond it.
         var valueElementClicked = function(event) {
             event.stopPropagation();
 
@@ -91,16 +91,16 @@
         this._value = value || "";
 
         if (this._value) {
-            this.element.classList.remove(WebInspector.DetailsSectionSimpleRow.EmptyStyleClassName);
+            this.element.classList.remove(WI.DetailsSectionSimpleRow.EmptyStyleClassName);
 
             // If the value has space characters that cause word wrapping then we don't need the data class.
             if (/[\s\u200b]/.test(this._value))
-                this.element.classList.remove(WebInspector.DetailsSectionSimpleRow.DataStyleClassName);
+                this.element.classList.remove(WI.DetailsSectionSimpleRow.DataStyleClassName);
             else
-                this.element.classList.add(WebInspector.DetailsSectionSimpleRow.DataStyleClassName);
+                this.element.classList.add(WI.DetailsSectionSimpleRow.DataStyleClassName);
         } else {
-            this.element.classList.add(WebInspector.DetailsSectionSimpleRow.EmptyStyleClassName);
-            this.element.classList.remove(WebInspector.DetailsSectionSimpleRow.DataStyleClassName);
+            this.element.classList.add(WI.DetailsSectionSimpleRow.EmptyStyleClassName);
+            this.element.classList.remove(WI.DetailsSectionSimpleRow.DataStyleClassName);
         }
 
         if (value instanceof Node) {
@@ -121,5 +121,5 @@
     }
 };
 
-WebInspector.DetailsSectionSimpleRow.DataStyleClassName = "data";
-WebInspector.DetailsSectionSimpleRow.EmptyStyleClassName = "empty";
+WI.DetailsSectionSimpleRow.DataStyleClassName = "data";
+WI.DetailsSectionSimpleRow.EmptyStyleClassName = "empty";
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionTextRow.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionTextRow.js
index 5b8eb90..104e778 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSectionTextRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSectionTextRow.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSectionTextRow = class DetailsSectionTextRow extends WebInspector.DetailsSectionRow
+WI.DetailsSectionTextRow = class DetailsSectionTextRow extends WI.DetailsSectionRow
 {
     constructor(text)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js
index 8d523bd..ae93990 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DetailsSidebarPanel.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DetailsSidebarPanel = class DetailsSidebarPanel extends WebInspector.SidebarPanel
+WI.DetailsSidebarPanel = class DetailsSidebarPanel extends WI.SidebarPanel
 {
     constructor(identifier, displayName, dontCreateNavigationItem)
     {
@@ -32,7 +32,7 @@
         this.element.classList.add("details");
 
         if (!dontCreateNavigationItem)
-            this._navigationItem = new WebInspector.RadioButtonNavigationItem(identifier, displayName);
+            this._navigationItem = new WI.RadioButtonNavigationItem(identifier, displayName);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Views/Dialog.js b/Source/WebInspectorUI/UserInterface/Views/Dialog.js
index 54dd971..f04ee0a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Dialog.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Dialog.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Dialog = class Dialog extends WebInspector.View
+WI.Dialog = class Dialog extends WI.View
 {
     constructor(delegate)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js
index eb9e96a..8463eab 100644
--- a/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DividerNavigationItem = class DividerNavigationItem extends WebInspector.NavigationItem
+WI.DividerNavigationItem = class DividerNavigationItem extends WI.NavigationItem
 {
     // Protected
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/EditableDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/EditableDataGridNode.js
index f0d08d0..21e4c23 100644
--- a/Source/WebInspectorUI/UserInterface/Views/EditableDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/EditableDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.EditableDataGridNode = class EditableDataGridNode extends WebInspector.DataGridNode
+WI.EditableDataGridNode = class EditableDataGridNode extends WI.DataGridNode
 {
     constructor(data)
     {
@@ -62,10 +62,10 @@
 
     _handleKeyPress(columnIdentifier, event)
     {
-        if (event.keyCode === WebInspector.KeyboardShortcut.Key.Escape.keyCode)
+        if (event.keyCode === WI.KeyboardShortcut.Key.Escape.keyCode)
             this.dataGrid.element.focus();
 
-        if (event.keyCode === WebInspector.KeyboardShortcut.Key.Enter.keyCode)
+        if (event.keyCode === WI.KeyboardShortcut.Key.Enter.keyCode)
             this._notifyInputElementValueChanged(columnIdentifier, event.target.value);
     }
 
@@ -77,10 +77,10 @@
     _notifyInputElementValueChanged(columnIdentifier, value)
     {
         if (value !== this.data[columnIdentifier])
-            this.dispatchEventToListeners(WebInspector.EditableDataGridNode.Event.ValueChanged, {value, columnIdentifier});
+            this.dispatchEventToListeners(WI.EditableDataGridNode.Event.ValueChanged, {value, columnIdentifier});
     }
 };
 
-WebInspector.EditableDataGridNode.Event = {
+WI.EditableDataGridNode.Event = {
     ValueChanged: "editable-data-grid-node-value-changed",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js b/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js
index c676c65..4495ca3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js
+++ b/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.isBeingEdited = function(element)
+WI.isBeingEdited = function(element)
 {
     while (element) {
         if (element.__editing)
@@ -34,28 +34,28 @@
     return false;
 };
 
-WebInspector.markBeingEdited = function(element, value)
+WI.markBeingEdited = function(element, value)
 {
     if (value) {
         if (element.__editing)
             return false;
         element.__editing = true;
-        WebInspector.__editingCount = (WebInspector.__editingCount || 0) + 1;
+        WI.__editingCount = (WI.__editingCount || 0) + 1;
     } else {
         if (!element.__editing)
             return false;
         delete element.__editing;
-        --WebInspector.__editingCount;
+        --WI.__editingCount;
     }
     return true;
 };
 
-WebInspector.isEditingAnyField = function()
+WI.isEditingAnyField = function()
 {
-    return !!WebInspector.__editingCount;
+    return !!WI.__editingCount;
 };
 
-WebInspector.isEventTargetAnEditableField = function(event)
+WI.isEventTargetAnEditableField = function(event)
 {
     var textInputTypes = {"text": true, "search": true, "tel": true, "url": true, "email": true, "password": true};
     if (event.target instanceof HTMLInputElement)
@@ -71,13 +71,13 @@
     if (event.target.enclosingNodeOrSelfWithClass("text-prompt"))
         return true;
 
-    if (WebInspector.isBeingEdited(event.target))
+    if (WI.isBeingEdited(event.target))
         return true;
 
     return false;
 };
 
-WebInspector.EditingConfig = class EditingConfig
+WI.EditingConfig = class EditingConfig
 {
     constructor(commitHandler, cancelHandler, context)
     {
@@ -108,12 +108,12 @@
     }
 };
 
-WebInspector.startEditing = function(element, config)
+WI.startEditing = function(element, config)
 {
-    if (!WebInspector.markBeingEdited(element, true))
+    if (!WI.markBeingEdited(element, true))
         return null;
 
-    config = config || new WebInspector.EditingConfig(function() {}, function() {});
+    config = config || new WI.EditingConfig(function() {}, function() {});
     var committedCallback = config.commitHandler;
     var cancelledCallback = config.cancelHandler;
     var pasteCallback = config.pasteHandler;
@@ -147,7 +147,7 @@
 
     function cleanUpAfterEditing()
     {
-        WebInspector.markBeingEdited(element, false);
+        WI.markBeingEdited(element, false);
 
         this.classList.remove("editing");
         this.contentEditable = false;
@@ -170,7 +170,7 @@
         if (pasteCallback)
             element.removeEventListener("paste", pasteEventListener, true);
 
-        WebInspector.restoreFocusFromElement(element);
+        WI.restoreFocusFromElement(element);
     }
 
     function editingCancelled()
@@ -197,7 +197,7 @@
         var hasOnlyMetaModifierKey = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
         if (isEnterKey(event) && (!config.multiline || hasOnlyMetaModifierKey))
             return "commit";
-        else if (event.keyCode === WebInspector.KeyboardShortcut.Key.Escape.keyCode || event.keyIdentifier === "U+001B")
+        else if (event.keyCode === WI.KeyboardShortcut.Key.Escape.keyCode || event.keyIdentifier === "U+001B")
             return "cancel";
         else if (event.keyIdentifier === "U+0009") // Tab key
             return "move-" + (event.shiftKey ? "backward" : "forward");
@@ -242,7 +242,7 @@
             if (!range.commonAncestorContainer.isSelfOrDescendant(element))
                 return false;
 
-            let wordRange = range.startContainer.rangeOfWord(range.startOffset, WebInspector.EditingSupport.StyleValueDelimiters, element);
+            let wordRange = range.startContainer.rangeOfWord(range.startOffset, WI.EditingSupport.StyleValueDelimiters, element);
             let word = wordRange.toString();
             let wordPrefix = "";
             let wordSuffix = "";
@@ -258,7 +258,7 @@
                 }
             }
 
-            let matches = WebInspector.EditingSupport.CSSNumberRegex.exec(word);
+            let matches = WI.EditingSupport.CSSNumberRegex.exec(word);
             if (!matches || matches.length !== 4)
                 return;
 
@@ -325,7 +325,7 @@
     };
 };
 
-WebInspector.EditingSupport = {
+WI.EditingSupport = {
     StyleValueDelimiters: " \xA0\t\n\"':;,/()",
     CSSNumberRegex: /(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/,
     NumberRegex: /^(-?(?:\d+(?:\.\d+)?|\.\d+))$/
diff --git a/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js
index 2ec95ca..ce48a9c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js
@@ -23,28 +23,28 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ElementsTabContentView = class ElementsTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.ElementsTabContentView = class ElementsTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.ElementsTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.DOMNodeDetailsSidebarPanel, WebInspector.CSSStyleDetailsSidebarPanel];
+        let {image, title} = WI.ElementsTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.DOMNodeDetailsSidebarPanel, WI.CSSStyleDetailsSidebarPanel];
 
         if (window.LayerTreeAgent)
-            detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);
+            detailsSidebarPanelConstructors.push(WI.LayerTreeDetailsSidebarPanel);
 
         super(identifier || "elements", "elements", tabBarItem, null, detailsSidebarPanelConstructors, true);
 
-        WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     }
 
     static tabInfo()
     {
         return {
             image: "Images/Elements.svg",
-            title: WebInspector.UIString("Elements"),
+            title: WI.UIString("Elements"),
         };
     }
 
@@ -57,7 +57,7 @@
 
     get type()
     {
-        return WebInspector.ElementsTabContentView.Type;
+        return WI.ElementsTabContentView.Type;
     }
 
     get supportsSplitContentBrowser()
@@ -67,7 +67,7 @@
 
     canShowRepresentedObject(representedObject)
     {
-        return representedObject instanceof WebInspector.DOMTree;
+        return representedObject instanceof WI.DOMTree;
     }
 
     showRepresentedObject(representedObject, cookie)
@@ -79,7 +79,7 @@
             return;
 
         let domTreeContentView = this.contentBrowser.currentContentView;
-        console.assert(domTreeContentView instanceof WebInspector.DOMTreeContentView, "Unexpected DOMTreeContentView representedObject.", domTreeContentView);
+        console.assert(domTreeContentView instanceof WI.DOMTreeContentView, "Unexpected DOMTreeContentView representedObject.", domTreeContentView);
 
         domTreeContentView.selectAndRevealDOMNode(cookie.nodeToSelect);
 
@@ -100,8 +100,8 @@
     {
         super.closed();
 
-        WebInspector.frameResourceManager.removeEventListener(null, null, this);
-        WebInspector.Frame.removeEventListener(null, null, this);
+        WI.frameResourceManager.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
     }
 
     // Private
@@ -110,7 +110,7 @@
     {
         this.contentBrowser.contentViewContainer.closeAllContentViews();
 
-        var mainFrame = WebInspector.frameResourceManager.mainFrame;
+        var mainFrame = WI.frameResourceManager.mainFrame;
         if (mainFrame)
             this.contentBrowser.showContentViewForRepresentedObject(mainFrame.domTree);
     }
@@ -129,4 +129,4 @@
     }
 };
 
-WebInspector.ElementsTabContentView.Type = "elements";
+WI.ElementsTabContentView.Type = "elements";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js b/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js
index edd59e8..f6d0e75 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ErrorObjectView = class ErrorObjectView extends WebInspector.Object
+WI.ErrorObjectView = class ErrorObjectView extends WI.Object
 {
     constructor(object)
     {
         super();
 
-        console.assert(object instanceof WebInspector.RemoteObject && object.subtype === "error", object);
+        console.assert(object instanceof WI.RemoteObject && object.subtype === "error", object);
 
         this._object = object;
 
@@ -38,12 +38,12 @@
 
         this._element = document.createElement("div");
         this._element.classList.add("error-object");
-        var previewElement = WebInspector.FormattedValue.createElementForError(this._object);
+        var previewElement = WI.FormattedValue.createElementForError(this._object);
         this._element.append(previewElement);
         previewElement.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this));
 
         this._outlineElement = this._element.appendChild(document.createElement("div"));
-        this._outline = new WebInspector.TreeOutline(this._outlineElement);
+        this._outline = new WI.TreeOutline(this._outlineElement);
     }
 
     // Static
@@ -61,7 +61,7 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        let a = WebInspector.linkifyLocation(sourceURL, new WebInspector.SourceCodePosition(parseInt(lineNumber) - 1, parseInt(columnNumber)), options);
+        let a = WI.linkifyLocation(sourceURL, new WI.SourceCodePosition(parseInt(lineNumber) - 1, parseInt(columnNumber)), options);
         a.classList.add("error-object-link");
         span.appendChild(a);
 
@@ -141,8 +141,8 @@
 
     _buildStackTrace(stackString)
     {
-        let stackTrace = WebInspector.StackTrace.fromString(this._object.target, stackString);
-        let stackTraceElement = new WebInspector.StackTraceView(stackTrace).element;
+        let stackTrace = WI.StackTrace.fromString(this._object.target, stackString);
+        let stackTraceElement = new WI.StackTraceView(stackTrace).element;
         this._outlineElement.appendChild(stackTraceElement);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js b/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js
index bf48719f..cdf987e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js
+++ b/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.EventListenerSectionGroup = class EventListenerSectionGroup extends WebInspector.DetailsSectionGroup
+WI.EventListenerSectionGroup = class EventListenerSectionGroup extends WI.DetailsSectionGroup
 {
     constructor(eventListener, options = {})
     {
@@ -33,24 +33,24 @@
 
         var rows = [];
         if (!options.hideType)
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Event"), this._eventListener.type));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Event"), this._eventListener.type));
         if (!options.hideNode)
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"), this._nodeTextOrLink()));
-        rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Function"), this._functionTextOrLink()));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Node"), this._nodeTextOrLink()));
+        rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Function"), this._functionTextOrLink()));
 
         if (this._eventListener.useCapture)
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Capturing"), WebInspector.UIString("Yes")));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Capturing"), WI.UIString("Yes")));
         else
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Bubbling"), WebInspector.UIString("Yes")));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Bubbling"), WI.UIString("Yes")));
 
         if (this._eventListener.isAttribute)
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Attribute"), WebInspector.UIString("Yes")));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Attribute"), WI.UIString("Yes")));
 
         if (this._eventListener.passive)
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Passive"), WebInspector.UIString("Yes")));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Passive"), WI.UIString("Yes")));
 
         if (this._eventListener.once)
-            rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Once"), WebInspector.UIString("Yes")));
+            rows.push(new WI.DetailsSectionSimpleRow(WI.UIString("Once"), WI.UIString("Yes")));
 
         this.rows = rows;
     }
@@ -67,7 +67,7 @@
         if (node.nodeType() === Node.DOCUMENT_NODE)
             return "document";
 
-        return WebInspector.linkifyNodeReference(node);
+        return WI.linkifyNodeReference(node);
     }
 
     _functionTextOrLink()
@@ -78,13 +78,13 @@
             var functionName = match[1];
         } else {
             var anonymous = true;
-            var functionName = WebInspector.UIString("(anonymous function)");
+            var functionName = WI.UIString("(anonymous function)");
         }
 
         if (!this._eventListener.location)
             return functionName;
 
-        var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(this._eventListener.location.scriptId, WebInspector.mainTarget);
+        var sourceCode = WI.debuggerManager.scriptForIdentifier(this._eventListener.location.scriptId, WI.mainTarget);
         if (!sourceCode)
             return functionName;
 
@@ -95,7 +95,7 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        let linkElement = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, options);
+        let linkElement = WI.createSourceCodeLocationLink(sourceCodeLocation, options);
 
         if (anonymous)
             return linkElement;
diff --git a/Source/WebInspectorUI/UserInterface/Views/FilterBar.js b/Source/WebInspectorUI/UserInterface/Views/FilterBar.js
index 2e7cc7e..1e29fbd 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FilterBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FilterBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FilterBar = class FilterBar extends WebInspector.Object
+WI.FilterBar = class FilterBar extends WI.Object
 {
     constructor(element)
     {
@@ -32,7 +32,7 @@
         this._element = element || document.createElement("div");
         this._element.classList.add("filter-bar");
 
-        this._filtersNavigationBar = new WebInspector.NavigationBar;
+        this._filtersNavigationBar = new WI.NavigationBar;
         this._element.appendChild(this._filtersNavigationBar.element);
 
         this._filterFunctionsMap = new Map;
@@ -86,9 +86,9 @@
 
     addFilterBarButton(identifier, filterFunction, activatedByDefault, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight)
     {
-        var filterBarButton = new WebInspector.FilterBarButton(identifier, filterFunction, activatedByDefault, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight);
-        filterBarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._handleFilterBarButtonClicked, this);
-        filterBarButton.addEventListener(WebInspector.FilterBarButton.Event.ActivatedStateToggled, this._handleFilterButtonToggled, this);
+        var filterBarButton = new WI.FilterBarButton(identifier, filterFunction, activatedByDefault, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight);
+        filterBarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleFilterBarButtonClicked, this);
+        filterBarButton.addEventListener(WI.FilterBarButton.Event.ActivatedStateToggled, this._handleFilterButtonToggled, this);
         this._filtersNavigationBar.addNavigationItem(filterBarButton);
         if (filterBarButton.activated) {
             this._filterFunctionsMap.set(filterBarButton.identifier, filterBarButton.filterFunction);
@@ -138,11 +138,11 @@
     {
         if (this.hasFilterChanged()) {
             this._lastFilterValue = this.filters;
-            this.dispatchEventToListeners(WebInspector.FilterBar.Event.FilterDidChange);
+            this.dispatchEventToListeners(WI.FilterBar.Event.FilterDidChange);
         }
     }
 };
 
-WebInspector.FilterBar.Event = {
+WI.FilterBar.Event = {
     FilterDidChange: "filter-bar-text-filter-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/FilterBarButton.js b/Source/WebInspectorUI/UserInterface/Views/FilterBarButton.js
index b954bb1..55d8099 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FilterBarButton.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FilterBarButton.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FilterBarButton = class FilterBarButton extends WebInspector.ActivateButtonNavigationItem
+WI.FilterBarButton = class FilterBarButton extends WI.ActivateButtonNavigationItem
 {
     constructor(identifier, filterFunction, activatedByDefault, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight, role)
     {
@@ -31,7 +31,7 @@
 
         this._filterFunction = filterFunction;
 
-        this._activatedSetting = new WebInspector.Setting(identifier, activatedByDefault);
+        this._activatedSetting = new WI.Setting(identifier, activatedByDefault);
 
         this.activated = !!this._activatedSetting.value;
     }
@@ -47,10 +47,10 @@
     {
         this.activated = !this.activated;
         this._activatedSetting.value = this.activated;
-        this.dispatchEventToListeners(WebInspector.FilterBarButton.Event.ActivatedStateToggled);
+        this.dispatchEventToListeners(WI.FilterBarButton.Event.ActivatedStateToggled);
     }
 };
 
-WebInspector.FilterBarButton.Event = {
+WI.FilterBarButton.Event = {
     ActivatedStateToggled: "filter-bar-activated-state-toggled"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/FilterBarNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/FilterBarNavigationItem.js
index 5b754bb..a023fae 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FilterBarNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FilterBarNavigationItem.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FilterBarNavigationItem = class FilterBarNavigationItem extends WebInspector.NavigationItem
+WI.FilterBarNavigationItem = class FilterBarNavigationItem extends WI.NavigationItem
 {
     constructor()
     {
         super();
 
-        this._filterBar = new WebInspector.FilterBar(this.element);
+        this._filterBar = new WI.FilterBar(this.element);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Views/FindBanner.js b/Source/WebInspectorUI/UserInterface/Views/FindBanner.js
index 5c7afa1..b27eacb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FindBanner.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FindBanner.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FindBanner = class FindBanner extends WebInspector.NavigationItem
+WI.FindBanner = class FindBanner extends WI.NavigationItem
 {
     constructor(delegate, className, fixed = false)
     {
@@ -57,7 +57,7 @@
         this.element.appendChild(this._previousResultButton);
 
         let previousResultButtonGlyphElement = document.createElement("div");
-        previousResultButtonGlyphElement.classList.add(WebInspector.FindBanner.SegmentGlyphStyleClassName);
+        previousResultButtonGlyphElement.classList.add(WI.FindBanner.SegmentGlyphStyleClassName);
         this._previousResultButton.appendChild(previousResultButtonGlyphElement);
 
         this._nextResultButton = document.createElement("button");
@@ -67,17 +67,17 @@
         this.element.appendChild(this._nextResultButton);
 
         let nextResultButtonGlyphElement = document.createElement("div");
-        nextResultButtonGlyphElement.classList.add(WebInspector.FindBanner.SegmentGlyphStyleClassName);
+        nextResultButtonGlyphElement.classList.add(WI.FindBanner.SegmentGlyphStyleClassName);
         this._nextResultButton.appendChild(nextResultButtonGlyphElement);
 
         if (fixed)
-            this._clearAndBlurKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this._clearAndBlur.bind(this), this.element);
+            this._clearAndBlurKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape, this._clearAndBlur.bind(this), this.element);
         else {
             let doneButtonElement = document.createElement("button");
-            doneButtonElement.textContent = WebInspector.UIString("Done");
+            doneButtonElement.textContent = WI.UIString("Done");
             doneButtonElement.addEventListener("click", this._doneButtonClicked.bind(this));
             this.element.appendChild(doneButtonElement);
-            this._hideKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this.hide.bind(this), this.element);
+            this._hideKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape, this.hide.bind(this), this.element);
         }
 
         this._numberOfResults = null;
@@ -85,10 +85,10 @@
         this._searchKeyPressed = false;
         this._previousSearchValue = "";
 
-        this._populateFindKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "E", this._populateSearchQueryFromSelection.bind(this));
+        this._populateFindKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "E", this._populateSearchQueryFromSelection.bind(this));
         this._populateFindKeyboardShortcut.implicitlyPreventsDefault = false;
-        this._findNextKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "G", this._nextResultButtonClicked.bind(this));
-        this._findPreviousKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "G", this._previousResultButtonClicked.bind(this));
+        this._findNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._nextResultButtonClicked.bind(this));
+        this._findPreviousKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._previousResultButtonClicked.bind(this));
 
         this.disableKeyboardShortcuts();
     }
@@ -114,11 +114,11 @@
         if (numberOfResults === null)
             this._resultCountLabel.textContent = "";
         else if (numberOfResults <= 0)
-            this._resultCountLabel.textContent = WebInspector.UIString("Not found");
+            this._resultCountLabel.textContent = WI.UIString("Not found");
         else if (numberOfResults === 1)
-            this._resultCountLabel.textContent = WebInspector.UIString("1 match");
+            this._resultCountLabel.textContent = WI.UIString("1 match");
         else if (numberOfResults > 1)
-            this._resultCountLabel.textContent = WebInspector.UIString("%d matches").format(numberOfResults);
+            this._resultCountLabel.textContent = WI.UIString("%d matches").format(numberOfResults);
     }
 
     get targetElement()
@@ -130,19 +130,19 @@
     {
         function delayedWork()
         {
-            oldTargetElement.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);
-            this.element.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);
+            oldTargetElement.classList.remove(WI.FindBanner.NoTransitionStyleClassName);
+            this.element.classList.remove(WI.FindBanner.NoTransitionStyleClassName);
         }
 
         if (this._targetElement) {
             var oldTargetElement = this._targetElement;
 
-            this._targetElement.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);
-            this._targetElement.classList.remove(WebInspector.FindBanner.SupportsFindBannerStyleClassName);
-            this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName);
+            this._targetElement.classList.add(WI.FindBanner.NoTransitionStyleClassName);
+            this._targetElement.classList.remove(WI.FindBanner.SupportsFindBannerStyleClassName);
+            this._targetElement.classList.remove(WI.FindBanner.ShowingFindBannerStyleClassName);
 
-            this.element.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);
-            this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);
+            this.element.classList.add(WI.FindBanner.NoTransitionStyleClassName);
+            this.element.classList.remove(WI.FindBanner.ShowingStyleClassName);
 
             // Delay so we can remove the no transition style class after the other style changes are committed.
             setTimeout(delayedWork.bind(this), 0);
@@ -151,12 +151,12 @@
         this._targetElement = element || null;
 
         if (this._targetElement)
-            this._targetElement.classList.add(WebInspector.FindBanner.SupportsFindBannerStyleClassName);
+            this._targetElement.classList.add(WI.FindBanner.SupportsFindBannerStyleClassName);
     }
 
     get showing()
     {
-        return this.element.classList.contains(WebInspector.FindBanner.ShowingStyleClassName);
+        return this.element.classList.contains(WI.FindBanner.ShowingStyleClassName);
     }
 
     focus()
@@ -196,8 +196,8 @@
 
         function delayedWork()
         {
-            this._targetElement.classList.add(WebInspector.FindBanner.ShowingFindBannerStyleClassName);
-            this.element.classList.add(WebInspector.FindBanner.ShowingStyleClassName);
+            this._targetElement.classList.add(WI.FindBanner.ShowingFindBannerStyleClassName);
+            this.element.classList.add(WI.FindBanner.ShowingStyleClassName);
 
             this._inputField.select();
         }
@@ -206,7 +206,7 @@
         // the document. Adding the class right away will prevent the animation from working the first time.
         setTimeout(delayedWork.bind(this), 0);
 
-        this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidShow);
+        this.dispatchEventToListeners(WI.FindBanner.Event.DidShow);
     }
 
     hide()
@@ -217,10 +217,10 @@
 
         this._inputField.blur();
 
-        this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName);
-        this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);
+        this._targetElement.classList.remove(WI.FindBanner.ShowingFindBannerStyleClassName);
+        this.element.classList.remove(WI.FindBanner.ShowingStyleClassName);
 
-        this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidHide);
+        this.dispatchEventToListeners(WI.FindBanner.Event.DidHide);
     }
 
     enableKeyboardShortcuts()
@@ -310,13 +310,13 @@
     }
 };
 
-WebInspector.FindBanner.SupportsFindBannerStyleClassName = "supports-find-banner";
-WebInspector.FindBanner.ShowingFindBannerStyleClassName = "showing-find-banner";
-WebInspector.FindBanner.NoTransitionStyleClassName = "no-find-banner-transition";
-WebInspector.FindBanner.ShowingStyleClassName = "showing";
-WebInspector.FindBanner.SegmentGlyphStyleClassName = "glyph";
+WI.FindBanner.SupportsFindBannerStyleClassName = "supports-find-banner";
+WI.FindBanner.ShowingFindBannerStyleClassName = "showing-find-banner";
+WI.FindBanner.NoTransitionStyleClassName = "no-find-banner-transition";
+WI.FindBanner.ShowingStyleClassName = "showing";
+WI.FindBanner.SegmentGlyphStyleClassName = "glyph";
 
-WebInspector.FindBanner.Event = {
+WI.FindBanner.Event = {
     DidShow: "find-banner-did-show",
     DidHide: "find-banner-did-hide"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js
index ecc02d1..7d551ea 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FlexibleSpaceNavigationItem = class FlexibleSpaceNavigationItem extends WebInspector.NavigationItem
+WI.FlexibleSpaceNavigationItem = class FlexibleSpaceNavigationItem extends WI.NavigationItem
 {
     // Protected
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/FolderTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/FolderTreeElement.js
index ec6678d..db099f3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FolderTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FolderTreeElement.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FolderTreeElement = class FolderTreeElement extends WebInspector.GeneralTreeElement
+WI.FolderTreeElement = class FolderTreeElement extends WI.GeneralTreeElement
 {
     constructor(title, representedObject)
     {
-        console.assert(!representedObject || representedObject instanceof WebInspector.Collection);
+        console.assert(!representedObject || representedObject instanceof WI.Collection);
 
-        const classNames = [WebInspector.FolderTreeElement.FolderIconStyleClassName];
+        const classNames = [WI.FolderTreeElement.FolderIconStyleClassName];
         const subtitle = null;
         super(classNames, title, subtitle, representedObject, {hasChildren: true});
     }
 };
 
-WebInspector.FolderTreeElement.FolderIconStyleClassName = "folder-icon";
+WI.FolderTreeElement.FolderIconStyleClassName = "folder-icon";
diff --git a/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js
index fae52fb..a6e7821 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FolderizedTreeElement = class FolderizedTreeElement extends WebInspector.GeneralTreeElement
+WI.FolderizedTreeElement = class FolderizedTreeElement extends WI.GeneralTreeElement
 {
     constructor(classNames, title, subtitle, representedObject)
     {
@@ -116,7 +116,7 @@
 
         this._newChildQueue.push(representedObject);
         if (!this._newChildQueueTimeoutIdentifier)
-            this._newChildQueueTimeoutIdentifier = setTimeout(this._populateFromNewChildQueue.bind(this), WebInspector.FolderizedTreeElement.NewChildQueueUpdateInterval);
+            this._newChildQueueTimeoutIdentifier = setTimeout(this._populateFromNewChildQueue.bind(this), WI.FolderizedTreeElement.NewChildQueueUpdateInterval);
     }
 
     removeChildForRepresentedObject(representedObject)
@@ -229,8 +229,8 @@
     _compareTreeElementsByMainTitle(a, b)
     {
         // Folders before anything.
-        let aIsFolder = a instanceof WebInspector.FolderTreeElement;
-        let bIsFolder = b instanceof WebInspector.FolderTreeElement;
+        let aIsFolder = a instanceof WI.FolderTreeElement;
+        let bIsFolder = b instanceof WI.FolderTreeElement;
         if (aIsFolder && !bIsFolder)
             return -1;
         if (bIsFolder && !aIsFolder)
@@ -264,8 +264,8 @@
         if (oldParent === this)
             return;
 
-        console.assert(oldParent instanceof WebInspector.FolderTreeElement);
-        if (!(oldParent instanceof WebInspector.FolderTreeElement))
+        console.assert(oldParent instanceof WI.FolderTreeElement);
+        if (!(oldParent instanceof WI.FolderTreeElement))
             return;
 
         // Remove the old parent folder if it is now empty.
@@ -282,8 +282,8 @@
 
         function createFolderTreeElement(settings)
         {
-            let folderTreeElement = new WebInspector.FolderTreeElement(settings.displayName, settings.representedObject);
-            let folderExpandedSetting = new WebInspector.Setting(settings.type + "-folder-expanded-" + this._folderSettingsKey, false);
+            let folderTreeElement = new WI.FolderTreeElement(settings.displayName, settings.representedObject);
+            let folderExpandedSetting = new WI.Setting(settings.type + "-folder-expanded-" + this._folderSettingsKey, false);
             this._folderExpandedSettingMap.set(folderTreeElement, folderExpandedSetting);
 
             if (folderExpandedSetting.value)
@@ -358,7 +358,7 @@
                 return true;
 
             // If there are lots of this resource type, then count it as a large category.
-            if (childCount >= WebInspector.FolderizedTreeElement.LargeChildCountThreshold) {
+            if (childCount >= WI.FolderizedTreeElement.LargeChildCountThreshold) {
                 // If we already have other resources in other small or medium categories, make folders.
                 if (numberOfSmallCategories || numberOfMediumCategories)
                     return true;
@@ -368,9 +368,9 @@
             }
 
             // Check if this is a medium category.
-            if (childCount >= WebInspector.FolderizedTreeElement.MediumChildCountThreshold) {
+            if (childCount >= WI.FolderizedTreeElement.MediumChildCountThreshold) {
                 // If this is the medium category that puts us over the maximum allowed, make folders.
-                return ++numberOfMediumCategories >= WebInspector.FolderizedTreeElement.NumberOfMediumCategoriesThreshold;
+                return ++numberOfMediumCategories >= WI.FolderizedTreeElement.NumberOfMediumCategoriesThreshold;
             }
 
             // This is a small category.
@@ -387,7 +387,7 @@
     }
 };
 
-WebInspector.FolderizedTreeElement.MediumChildCountThreshold = 5;
-WebInspector.FolderizedTreeElement.LargeChildCountThreshold = 15;
-WebInspector.FolderizedTreeElement.NumberOfMediumCategoriesThreshold = 2;
-WebInspector.FolderizedTreeElement.NewChildQueueUpdateInterval = 500;
+WI.FolderizedTreeElement.MediumChildCountThreshold = 5;
+WI.FolderizedTreeElement.LargeChildCountThreshold = 15;
+WI.FolderizedTreeElement.NumberOfMediumCategoriesThreshold = 2;
+WI.FolderizedTreeElement.NewChildQueueUpdateInterval = 500;
diff --git a/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js b/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js
index f6bfd0e..9315a5c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FontResourceContentView = class FontResourceContentView extends WebInspector.ResourceContentView
+WI.FontResourceContentView = class FontResourceContentView extends WI.ResourceContentView
 {
     constructor(resource)
     {
@@ -46,7 +46,7 @@
             return;
 
         // Start at the maximum size and try progressively smaller font sizes until minimum is reached or the preview element is not as wide as the main element.
-        for (var fontSize = WebInspector.FontResourceContentView.MaximumFontSize; fontSize >= WebInspector.FontResourceContentView.MinimumFontSize; fontSize -= 5) {
+        for (var fontSize = WI.FontResourceContentView.MaximumFontSize; fontSize >= WI.FontResourceContentView.MinimumFontSize; fontSize -= 5) {
             this._previewElement.style.fontSize = fontSize + "px";
             if (this._previewElement.offsetWidth <= this.element.offsetWidth)
                 break;
@@ -61,7 +61,7 @@
             return;
         }
 
-        const uniqueFontName = "WebInspectorFontPreview" + (++WebInspector.FontResourceContentView._uniqueFontIdentifier);
+        const uniqueFontName = "WebInspectorFontPreview" + (++WI.FontResourceContentView._uniqueFontIdentifier);
 
         var format = "";
 
@@ -92,7 +92,7 @@
             return metricElement;
         }
 
-        var lines = WebInspector.FontResourceContentView.PreviewLines;
+        var lines = WI.FontResourceContentView.PreviewLines;
         for (var i = 0; i < lines.length; ++i) {
             var lineElement = document.createElement("div");
             lineElement.className = "line";
@@ -148,9 +148,9 @@
     }
 };
 
-WebInspector.FontResourceContentView._uniqueFontIdentifier = 0;
+WI.FontResourceContentView._uniqueFontIdentifier = 0;
 
-WebInspector.FontResourceContentView.PreviewLines = ["ABCDEFGHIJKLM", "NOPQRSTUVWXYZ", "abcdefghijklm", "nopqrstuvwxyz", "1234567890"];
+WI.FontResourceContentView.PreviewLines = ["ABCDEFGHIJKLM", "NOPQRSTUVWXYZ", "abcdefghijklm", "nopqrstuvwxyz", "1234567890"];
 
-WebInspector.FontResourceContentView.MaximumFontSize = 72;
-WebInspector.FontResourceContentView.MinimumFontSize = 12;
+WI.FontResourceContentView.MaximumFontSize = 72;
+WI.FontResourceContentView.MinimumFontSize = 12;
diff --git a/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js b/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js
index ce5d27c..19c7efb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FormattedValue = {};
+WI.FormattedValue = {};
 
-WebInspector.FormattedValue.hasSimpleDisplay = function(object)
+WI.FormattedValue.hasSimpleDisplay = function(object)
 {
     switch (object.type) {
     case "boolean":
@@ -47,25 +47,25 @@
     return false;
 };
 
-WebInspector.FormattedValue.classNameForTypes = function(type, subtype)
+WI.FormattedValue.classNameForTypes = function(type, subtype)
 {
     return "formatted-" + (subtype ? subtype : type);
 };
 
-WebInspector.FormattedValue.classNameForObject = function(object)
+WI.FormattedValue.classNameForObject = function(object)
 {
-    return WebInspector.FormattedValue.classNameForTypes(object.type, object.subtype);
+    return WI.FormattedValue.classNameForTypes(object.type, object.subtype);
 };
 
-WebInspector.FormattedValue.createLinkifiedElementString = function(string)
+WI.FormattedValue.createLinkifiedElementString = function(string)
 {
     var span = document.createElement("span");
     span.className = "formatted-string";
-    span.append("\"", WebInspector.linkifyStringAsFragment(string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")), "\"");
+    span.append("\"", WI.linkifyStringAsFragment(string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")), "\"");
     return span;
 };
 
-WebInspector.FormattedValue.createElementForNode = function(object)
+WI.FormattedValue.createElementForNode = function(object)
 {
     var span = document.createElement("span");
     span.className = "formatted-node";
@@ -76,9 +76,9 @@
             return;
         }
 
-        var treeOutline = new WebInspector.DOMTreeOutline;
+        var treeOutline = new WI.DOMTreeOutline;
         treeOutline.setVisible(true);
-        treeOutline.rootDOMNode = WebInspector.domTreeManager.nodeForId(nodeId);
+        treeOutline.rootDOMNode = WI.domTreeManager.nodeForId(nodeId);
         if (!treeOutline.children[0].hasChildren)
             treeOutline.element.classList.add("single-node");
         span.appendChild(treeOutline.element);
@@ -87,7 +87,7 @@
     return span;
 };
 
-WebInspector.FormattedValue.createElementForError = function(object)
+WI.FormattedValue.createElementForError = function(object)
 {
     var span = document.createElement("span");
     span.classList.add("formatted-error");
@@ -109,12 +109,12 @@
     if (!preview.sourceURL)
         return span;
 
-    var sourceLinkWithPrefix = WebInspector.ErrorObjectView.makeSourceLinkWithPrefix(preview.sourceURL, preview.line, preview.column);
+    var sourceLinkWithPrefix = WI.ErrorObjectView.makeSourceLinkWithPrefix(preview.sourceURL, preview.line, preview.column);
     span.append(sourceLinkWithPrefix);
     return span;
 };
 
-WebInspector.FormattedValue.createElementForNodePreview = function(preview)
+WI.FormattedValue.createElementForNodePreview = function(preview)
 {
     var value = preview.value || preview.description;
     var span = document.createElement("span");
@@ -175,7 +175,7 @@
     return span;
 };
 
-WebInspector.FormattedValue.createElementForFunctionWithName = function(description)
+WI.FormattedValue.createElementForFunctionWithName = function(description)
 {
     var span = document.createElement("span");
     span.classList.add("formatted-function");
@@ -183,10 +183,10 @@
     return span;
 };
 
-WebInspector.FormattedValue.createElementForTypesAndValue = function(type, subtype, displayString, size, isPreview, hadException)
+WI.FormattedValue.createElementForTypesAndValue = function(type, subtype, displayString, size, isPreview, hadException)
 {
     var span = document.createElement("span");
-    span.classList.add(WebInspector.FormattedValue.classNameForTypes(type, subtype));
+    span.classList.add(WI.FormattedValue.classNameForTypes(type, subtype));
 
     // Exception.
     if (hadException) {
@@ -196,7 +196,7 @@
 
     // String: quoted and replace newlines as nice unicode symbols.
     if (type === "string") {
-        displayString = displayString.truncate(WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH);
+        displayString = displayString.truncate(WI.FormattedValue.MAX_PREVIEW_STRING_LENGTH);
         span.textContent = doubleQuotedString(displayString.replace(/\n/g, "\u21B5"));
         return span;
     }
@@ -223,60 +223,60 @@
     return span;
 };
 
-WebInspector.FormattedValue.createElementForRemoteObject = function(object, hadException)
+WI.FormattedValue.createElementForRemoteObject = function(object, hadException)
 {
-    return WebInspector.FormattedValue.createElementForTypesAndValue(object.type, object.subtype, object.description, object.size, false, hadException);
+    return WI.FormattedValue.createElementForTypesAndValue(object.type, object.subtype, object.description, object.size, false, hadException);
 };
 
-WebInspector.FormattedValue.createElementForObjectPreview = function(objectPreview)
+WI.FormattedValue.createElementForObjectPreview = function(objectPreview)
 {
-    return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type, objectPreview.subtype, objectPreview.description, objectPreview.size, true, false);
+    return WI.FormattedValue.createElementForTypesAndValue(objectPreview.type, objectPreview.subtype, objectPreview.description, objectPreview.size, true, false);
 };
 
-WebInspector.FormattedValue.createElementForPropertyPreview = function(propertyPreview)
+WI.FormattedValue.createElementForPropertyPreview = function(propertyPreview)
 {
-    return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type, propertyPreview.subtype, propertyPreview.value, undefined, true, false);
+    return WI.FormattedValue.createElementForTypesAndValue(propertyPreview.type, propertyPreview.subtype, propertyPreview.value, undefined, true, false);
 };
 
-WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview = function(objectPreview, previewViewMode)
+WI.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview = function(objectPreview, previewViewMode)
 {
     if (objectPreview.subtype === "node")
-        return WebInspector.FormattedValue.createElementForNodePreview(objectPreview);
+        return WI.FormattedValue.createElementForNodePreview(objectPreview);
 
     if (objectPreview.type === "function")
-        return WebInspector.FormattedValue.createElementForFunctionWithName(objectPreview.description);
+        return WI.FormattedValue.createElementForFunctionWithName(objectPreview.description);
 
-    return new WebInspector.ObjectPreviewView(objectPreview, previewViewMode).element;
+    return new WI.ObjectPreviewView(objectPreview, previewViewMode).element;
 };
 
-WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject = function(object, previewViewMode)
+WI.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject = function(object, previewViewMode)
 {
     if (object.subtype === "node")
-        return WebInspector.FormattedValue.createElementForNode(object);
+        return WI.FormattedValue.createElementForNode(object);
 
     if (object.subtype === "error")
-        return WebInspector.FormattedValue.createElementForError(object);
+        return WI.FormattedValue.createElementForError(object);
 
     if (object.preview)
-        return new WebInspector.ObjectPreviewView(object.preview, previewViewMode);
+        return new WI.ObjectPreviewView(object.preview, previewViewMode);
 
-    return WebInspector.FormattedValue.createElementForRemoteObject(object);
+    return WI.FormattedValue.createElementForRemoteObject(object);
 };
 
-WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject = function(object, propertyPath, forceExpanding)
+WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject = function(object, propertyPath, forceExpanding)
 {
     if (object.subtype === "node")
-        return WebInspector.FormattedValue.createElementForNode(object);
+        return WI.FormattedValue.createElementForNode(object);
 
     if (object.subtype === "null")
-        return WebInspector.FormattedValue.createElementForRemoteObject(object);
+        return WI.FormattedValue.createElementForRemoteObject(object);
 
     if (object.type === "object" || object.subtype === "class") {
-        var objectTree = new WebInspector.ObjectTreeView(object, null, propertyPath, forceExpanding);
+        var objectTree = new WI.ObjectTreeView(object, null, propertyPath, forceExpanding);
         return objectTree.element;
     }
 
-    return WebInspector.FormattedValue.createElementForRemoteObject(object);
+    return WI.FormattedValue.createElementForRemoteObject(object);
 };
 
-WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH = 140;
+WI.FormattedValue.MAX_PREVIEW_STRING_LENGTH = 140;
diff --git a/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js b/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js
index 530538e..f329160 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FrameDOMTreeContentView = class FrameDOMTreeContentView extends WebInspector.DOMTreeContentView
+WI.FrameDOMTreeContentView = class FrameDOMTreeContentView extends WI.DOMTreeContentView
 {
     constructor(domTree)
     {
-        console.assert(domTree instanceof WebInspector.DOMTree, domTree);
+        console.assert(domTree instanceof WI.DOMTree, domTree);
 
         super(domTree);
 
         this._domTree = domTree;
-        this._domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
+        this._domTree.addEventListener(WI.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
 
         this._requestRootDOMNode();
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js
index 737fe82..b4951f3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.ResourceTreeElement
+WI.FrameTreeElement = class FrameTreeElement extends WI.ResourceTreeElement
 {
     constructor(frame)
     {
-        console.assert(frame instanceof WebInspector.Frame);
+        console.assert(frame instanceof WI.Frame);
 
         super(frame.mainResource, frame);
 
@@ -35,39 +35,39 @@
 
         this._updateExpandedSetting();
 
-        frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
-        frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._resourceWasRemoved, this);
-        frame.addEventListener(WebInspector.Frame.Event.ExtraScriptAdded, this._extraScriptAdded, this);
-        frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasAdded, this._childFrameWasAdded, this);
-        frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
+        frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+        frame.addEventListener(WI.Frame.Event.ResourceWasRemoved, this._resourceWasRemoved, this);
+        frame.addEventListener(WI.Frame.Event.ExtraScriptAdded, this._extraScriptAdded, this);
+        frame.addEventListener(WI.Frame.Event.ChildFrameWasAdded, this._childFrameWasAdded, this);
+        frame.addEventListener(WI.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
 
-        frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, this._childContentFlowWasAdded, this);
-        frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved, this._childContentFlowWasRemoved, this);
-        frame.domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
+        frame.domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasAdded, this._childContentFlowWasAdded, this);
+        frame.domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasRemoved, this._childContentFlowWasRemoved, this);
+        frame.domTree.addEventListener(WI.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
 
         this.shouldRefreshChildren = true;
         this.folderSettingsKey = this._frame.url.hash;
 
-        this.registerFolderizeSettings("frames", WebInspector.UIString("Frames"), this._frame.childFrameCollection, WebInspector.FrameTreeElement);
-        this.registerFolderizeSettings("flows", WebInspector.UIString("Flows"), this._frame.domTree.contentFlowCollection, WebInspector.ContentFlowTreeElement);
-        this.registerFolderizeSettings("extra-scripts", WebInspector.UIString("Extra Scripts"), this._frame.extraScriptCollection, WebInspector.ScriptTreeElement);
+        this.registerFolderizeSettings("frames", WI.UIString("Frames"), this._frame.childFrameCollection, WI.FrameTreeElement);
+        this.registerFolderizeSettings("flows", WI.UIString("Flows"), this._frame.domTree.contentFlowCollection, WI.ContentFlowTreeElement);
+        this.registerFolderizeSettings("extra-scripts", WI.UIString("Extra Scripts"), this._frame.extraScriptCollection, WI.ScriptTreeElement);
 
-        if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value)
-            this.registerFolderizeSettings("canvases", WebInspector.UIString("Canvases"), this._frame.canvasCollection, WebInspector.CanvasTreeElement);
+        if (window.CanvasAgent && WI.settings.experimentalShowCanvasContextsInResources.value)
+            this.registerFolderizeSettings("canvases", WI.UIString("Canvases"), this._frame.canvasCollection, WI.CanvasTreeElement);
 
         function forwardingConstructor(representedObject, ...extraArguments) {
-            if (representedObject instanceof WebInspector.CSSStyleSheet)
-                return new WebInspector.CSSStyleSheetTreeElement(representedObject, ...extraArguments);
-            return new WebInspector.ResourceTreeElement(representedObject, ...extraArguments);
+            if (representedObject instanceof WI.CSSStyleSheet)
+                return new WI.CSSStyleSheetTreeElement(representedObject, ...extraArguments);
+            return new WI.ResourceTreeElement(representedObject, ...extraArguments);
         }
 
-        for (let [key, value] of Object.entries(WebInspector.Resource.Type)) {
-            let folderName = WebInspector.Resource.displayNameForType(value, true);
+        for (let [key, value] of Object.entries(WI.Resource.Type)) {
+            let folderName = WI.Resource.displayNameForType(value, true);
 
             let treeElementConstructor = forwardingConstructor;
-            if (value === WebInspector.Resource.Type.WebSocket)
-                treeElementConstructor = WebInspector.WebSocketResourceTreeElement;
+            if (value === WI.Resource.Type.WebSocket)
+                treeElementConstructor = WI.WebSocketResourceTreeElement;
 
             this.registerFolderizeSettings(key, folderName, this._frame.resourceCollectionForType(value), treeElementConstructor);
         }
@@ -121,23 +121,23 @@
     onattach()
     {
         // Immediate superclasses are skipped, since Frames handle their own SourceMapResources.
-        WebInspector.GeneralTreeElement.prototype.onattach.call(this);
+        WI.GeneralTreeElement.prototype.onattach.call(this);
 
-        WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
+        WI.cssStyleManager.addEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
 
-        if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) {
-            this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemAdded, this._canvasWasAdded, this);
-            this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemRemoved, this._canvasWasRemoved, this);
+        if (window.CanvasAgent && WI.settings.experimentalShowCanvasContextsInResources.value) {
+            this._frame.canvasCollection.addEventListener(WI.Collection.Event.ItemAdded, this._canvasWasAdded, this);
+            this._frame.canvasCollection.addEventListener(WI.Collection.Event.ItemRemoved, this._canvasWasRemoved, this);
         }
     }
 
     ondetach()
     {
-        WebInspector.cssStyleManager.removeEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
+        WI.cssStyleManager.removeEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
 
-        if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) {
-            this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemAdded, this._canvasWasAdded, this);
-            this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemRemoved, this._canvasWasRemoved, this);
+        if (window.CanvasAgent && WI.settings.experimentalShowCanvasContextsInResources.value) {
+            this._frame.canvasCollection.removeEventListener(WI.Collection.Event.ItemAdded, this._canvasWasAdded, this);
+            this._frame.canvasCollection.removeEventListener(WI.Collection.Event.ItemRemoved, this._canvasWasRemoved, this);
         }
 
         super.ondetach();
@@ -150,11 +150,11 @@
         if (a === b)
             return 0;
 
-        var aIsResource = a instanceof WebInspector.ResourceTreeElement;
-        var bIsResource = b instanceof WebInspector.ResourceTreeElement;
+        var aIsResource = a instanceof WI.ResourceTreeElement;
+        var bIsResource = b instanceof WI.ResourceTreeElement;
 
         if (aIsResource && bIsResource)
-            return WebInspector.ResourceTreeElement.compareResourceTreeElements(a, b);
+            return WI.ResourceTreeElement.compareResourceTreeElements(a, b);
 
         if (!aIsResource && !bIsResource) {
             // When both components are not resources then default to base class comparison.
@@ -199,13 +199,13 @@
                 this.addChildForRepresentedObject(extraScript);
         }
 
-        if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) {
+        if (window.CanvasAgent && WI.settings.experimentalShowCanvasContextsInResources.value) {
             for (let canvas of this._frame.canvasCollection.items)
                 this.addChildForRepresentedObject(canvas);
         }
 
         const doNotCreateIfMissing = true;
-        WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._frame, this.addRepresentedObjectToNewChildQueue.bind(this), doNotCreateIfMissing);
+        WI.cssStyleManager.preferredInspectorStyleSheetForFrame(this._frame, this.addRepresentedObjectToNewChildQueue.bind(this), doNotCreateIfMissing);
     }
 
     onexpand()
@@ -226,7 +226,7 @@
 
     _updateExpandedSetting()
     {
-        this._expandedSetting = new WebInspector.Setting("frame-expanded-" + this._frame.url.hash, this._frame.isMainFrame() ? true : false);
+        this._expandedSetting = new WI.Setting("frame-expanded-" + this._frame.url.hash, this._frame.isMainFrame() ? true : false);
         if (this._expandedSetting.value)
             this.expand();
         else
diff --git a/Source/WebInspectorUI/UserInterface/Views/GeneralTabBarItem.js b/Source/WebInspectorUI/UserInterface/Views/GeneralTabBarItem.js
index 8662afd..eef306e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GeneralTabBarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GeneralTabBarItem.js
@@ -24,15 +24,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GeneralTabBarItem = class GeneralTabBarItem extends WebInspector.TabBarItem
+WI.GeneralTabBarItem = class GeneralTabBarItem extends WI.TabBarItem
 {
     constructor(image, title, representedObject)
     {
         super(image, title, representedObject);
 
         let closeButtonElement = document.createElement("div");
-        closeButtonElement.classList.add(WebInspector.TabBarItem.CloseButtonStyleClassName);
-        closeButtonElement.title = WebInspector.UIString("Click to close this tab; Option-click to close all tabs except this one");
+        closeButtonElement.classList.add(WI.TabBarItem.CloseButtonStyleClassName);
+        closeButtonElement.title = WI.UIString("Click to close this tab; Option-click to close all tabs except this one");
         this.element.insertBefore(closeButtonElement, this.element.firstChild);
 
         this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
@@ -77,15 +77,15 @@
             let tabBarItems = this._parentTabBar.tabBarItems;
             for (let i = tabBarItems.length - 1; i >= 0; --i) {
                 let item = tabBarItems[i];
-                if (item === this || item instanceof WebInspector.PinnedTabBarItem)
+                if (item === this || item instanceof WI.PinnedTabBarItem)
                     continue;
                 this._parentTabBar.removeTabBarItem(item);
             }
         };
 
-        let hasOtherNonPinnedTabs = this._parentTabBar.tabBarItems.some((item) => item !== this && !(item instanceof WebInspector.PinnedTabBarItem));
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
-        contextMenu.appendItem(WebInspector.UIString("Close Tab"), closeTab, this.isDefaultTab);
-        contextMenu.appendItem(WebInspector.UIString("Close Other Tabs"), closeOtherTabs, !hasOtherNonPinnedTabs);
+        let hasOtherNonPinnedTabs = this._parentTabBar.tabBarItems.some((item) => item !== this && !(item instanceof WI.PinnedTabBarItem));
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
+        contextMenu.appendItem(WI.UIString("Close Tab"), closeTab, this.isDefaultTab);
+        contextMenu.appendItem(WI.UIString("Close Other Tabs"), closeOtherTabs, !hasOtherNonPinnedTabs);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js
index 40980c3..d08e125 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GeneralTreeElement = class GeneralTreeElement extends WebInspector.TreeElement
+WI.GeneralTreeElement = class GeneralTreeElement extends WI.TreeElement
 {
     constructor(classNames, title, subtitle, representedObject, options)
     {
@@ -130,7 +130,7 @@
         this._mainTitle = x;
         this._updateTitleElements();
         this.didChange();
-        this.dispatchEventToListeners(WebInspector.GeneralTreeElement.Event.MainTitleDidChange);
+        this.dispatchEventToListeners(WI.GeneralTreeElement.Event.MainTitleDidChange);
     }
 
     get subtitle()
@@ -164,7 +164,7 @@
 
         if (!this._statusElement) {
             this._statusElement = document.createElement("div");
-            this._statusElement.className = WebInspector.GeneralTreeElement.StatusElementStyleClassName;
+            this._statusElement.className = WI.GeneralTreeElement.StatusElementStyleClassName;
         }
 
         this._status = x;
@@ -245,20 +245,20 @@
             return;
 
         this._disclosureButton = document.createElement("button");
-        this._disclosureButton.className = WebInspector.GeneralTreeElement.DisclosureButtonStyleClassName;
+        this._disclosureButton.className = WI.GeneralTreeElement.DisclosureButtonStyleClassName;
 
         // Don't allow the disclosure button to be keyboard focusable. The TreeOutline is focusable and has
         // its own keybindings for toggling expand and collapse.
         this._disclosureButton.tabIndex = -1;
 
         this._iconElement = document.createElement("img");
-        this._iconElement.className = WebInspector.GeneralTreeElement.IconElementStyleClassName;
+        this._iconElement.className = WI.GeneralTreeElement.IconElementStyleClassName;
 
         this._titlesElement = document.createElement("div");
-        this._titlesElement.className = WebInspector.GeneralTreeElement.TitlesElementStyleClassName;
+        this._titlesElement.className = WI.GeneralTreeElement.TitlesElementStyleClassName;
 
         this._mainTitleElement = document.createElement("span");
-        this._mainTitleElement.className = WebInspector.GeneralTreeElement.MainTitleElementStyleClassName;
+        this._mainTitleElement.className = WI.GeneralTreeElement.MainTitleElementStyleClassName;
         this._titlesElement.appendChild(this._mainTitleElement);
 
         this._createdElements = true;
@@ -270,7 +270,7 @@
             return;
 
         this._subtitleElement = document.createElement("span");
-        this._subtitleElement.className = WebInspector.GeneralTreeElement.SubtitleElementStyleClassName;
+        this._subtitleElement.className = WI.GeneralTreeElement.SubtitleElementStyleClassName;
         this._titlesElement.appendChild(this._subtitleElement);
     }
 
@@ -291,7 +291,7 @@
             this._createSubtitleElementIfNeeded();
             if (this._subtitleElement.textContent !== this._subtitle)
                 this._subtitleElement.textContent = this._subtitle;
-            this._titlesElement.classList.remove(WebInspector.GeneralTreeElement.NoSubtitleStyleClassName);
+            this._titlesElement.classList.remove(WI.GeneralTreeElement.NoSubtitleStyleClassName);
         } else if (this._subtitle instanceof Node) {
             this._createSubtitleElementIfNeeded();
             this._subtitleElement.removeChildren();
@@ -299,7 +299,7 @@
         } else {
             if (this._subtitleElement)
                 this._subtitleElement.textContent = "";
-            this._titlesElement.classList.add(WebInspector.GeneralTreeElement.NoSubtitleStyleClassName);
+            this._titlesElement.classList.add(WI.GeneralTreeElement.NoSubtitleStyleClassName);
         }
 
         // Set a default tooltip if there isn't a custom one already assigned.
@@ -342,14 +342,14 @@
     }
 };
 
-WebInspector.GeneralTreeElement.DisclosureButtonStyleClassName = "disclosure-button";
-WebInspector.GeneralTreeElement.IconElementStyleClassName = "icon";
-WebInspector.GeneralTreeElement.StatusElementStyleClassName = "status";
-WebInspector.GeneralTreeElement.TitlesElementStyleClassName = "titles";
-WebInspector.GeneralTreeElement.MainTitleElementStyleClassName = "title";
-WebInspector.GeneralTreeElement.SubtitleElementStyleClassName = "subtitle";
-WebInspector.GeneralTreeElement.NoSubtitleStyleClassName = "no-subtitle";
+WI.GeneralTreeElement.DisclosureButtonStyleClassName = "disclosure-button";
+WI.GeneralTreeElement.IconElementStyleClassName = "icon";
+WI.GeneralTreeElement.StatusElementStyleClassName = "status";
+WI.GeneralTreeElement.TitlesElementStyleClassName = "titles";
+WI.GeneralTreeElement.MainTitleElementStyleClassName = "title";
+WI.GeneralTreeElement.SubtitleElementStyleClassName = "subtitle";
+WI.GeneralTreeElement.NoSubtitleStyleClassName = "no-subtitle";
 
-WebInspector.GeneralTreeElement.Event = {
+WI.GeneralTreeElement.Event = {
     MainTitleDidChange: "general-tree-element-main-title-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElementPathComponent.js b/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElementPathComponent.js
index 4a1de05..8a57e32 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElementPathComponent.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElementPathComponent.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GeneralTreeElementPathComponent = class GeneralTreeElementPathComponent extends WebInspector.HierarchicalPathComponent
+WI.GeneralTreeElementPathComponent = class GeneralTreeElementPathComponent extends WI.HierarchicalPathComponent
 {
     constructor(generalTreeElement, representedObject)
     {
         super(generalTreeElement.mainTitle, generalTreeElement.classNames, representedObject || generalTreeElement.representedObject);
 
         this._generalTreeElement = generalTreeElement;
-        generalTreeElement.addEventListener(WebInspector.GeneralTreeElement.Event.MainTitleDidChange, this._mainTitleDidChange, this);
+        generalTreeElement.addEventListener(WI.GeneralTreeElement.Event.MainTitleDidChange, this._mainTitleDidChange, this);
     }
 
     // Public
@@ -49,7 +49,7 @@
         if (!previousSibling)
             return null;
 
-        return new WebInspector.GeneralTreeElementPathComponent(previousSibling);
+        return new WI.GeneralTreeElementPathComponent(previousSibling);
     }
 
     get nextSibling()
@@ -61,7 +61,7 @@
         if (!nextSibling)
             return null;
 
-        return new WebInspector.GeneralTreeElementPathComponent(nextSibling);
+        return new WI.GeneralTreeElementPathComponent(nextSibling);
     }
 
     // Private
diff --git a/Source/WebInspectorUI/UserInterface/Views/GenericResourceContentView.js b/Source/WebInspectorUI/UserInterface/Views/GenericResourceContentView.js
index 3a5df70..4641294 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GenericResourceContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GenericResourceContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GenericResourceContentView = class GenericResourceContentView extends WebInspector.ResourceContentView
+WI.GenericResourceContentView = class GenericResourceContentView extends WI.ResourceContentView
 {
     constructor(resource)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/GoToLineDialog.js b/Source/WebInspectorUI/UserInterface/Views/GoToLineDialog.js
index c954a86..9bb2348 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GoToLineDialog.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GoToLineDialog.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GoToLineDialog = class GoToLineDialog extends WebInspector.Dialog
+WI.GoToLineDialog = class GoToLineDialog extends WI.Dialog
 {
     constructor(delegate)
     {
@@ -35,7 +35,7 @@
 
         this._input = field.appendChild(document.createElement("input"));
         this._input.type = "text";
-        this._input.placeholder = WebInspector.UIString("Line Number");
+        this._input.placeholder = WI.UIString("Line Number");
         this._input.spellcheck = false;
 
         this._clearIcon = field.appendChild(document.createElement("img"));
@@ -83,19 +83,19 @@
     _handleInputEvent(event)
     {
         let force = this._input.value !== "";
-        this.element.classList.toggle(WebInspector.GoToLineDialog.NonEmptyClassName, force);
+        this.element.classList.toggle(WI.GoToLineDialog.NonEmptyClassName, force);
     }
 
     _handleKeydownEvent(event)
     {
-        if (event.keyCode === WebInspector.KeyboardShortcut.Key.Escape.keyCode) {
+        if (event.keyCode === WI.KeyboardShortcut.Key.Escape.keyCode) {
             if (this._input.value === "")
                 this.dismiss();
             else
                 this._clear();
 
             event.preventDefault();
-        } else if (event.keyCode === WebInspector.KeyboardShortcut.Key.Enter.keyCode) {
+        } else if (event.keyCode === WI.KeyboardShortcut.Key.Enter.keyCode) {
             let value = parseInt(this._input.value, 10);
 
             if (this.representedObjectIsValid(value)) {
@@ -130,8 +130,8 @@
     _clear()
     {
         this._input.value = "";
-        this.element.classList.remove(WebInspector.GoToLineDialog.NonEmptyClassName);
+        this.element.classList.remove(WI.GoToLineDialog.NonEmptyClassName);
     }
 };
 
-WebInspector.GoToLineDialog.NonEmptyClassName = "non-empty";
+WI.GoToLineDialog.NonEmptyClassName = "non-empty";
diff --git a/Source/WebInspectorUI/UserInterface/Views/GradientEditor.js b/Source/WebInspectorUI/UserInterface/Views/GradientEditor.js
index 20d7b1d..192f4b4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GradientEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GradientEditor.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GradientEditor = class GradientEditor extends WebInspector.Object
+WI.GradientEditor = class GradientEditor extends WI.Object
 {
     constructor()
     {
@@ -36,23 +36,23 @@
         this._gradient = null;
         this._gradientTypes = {
             "linear-gradient": {
-                type: WebInspector.LinearGradient,
-                label: WebInspector.UIString("Linear Gradient"),
+                type: WI.LinearGradient,
+                label: WI.UIString("Linear Gradient"),
                 repeats: false
             },
             "radial-gradient": {
-                type: WebInspector.RadialGradient,
-                label: WebInspector.UIString("Radial Gradient"),
+                type: WI.RadialGradient,
+                label: WI.UIString("Radial Gradient"),
                 repeats: false
             },
             "repeating-linear-gradient": {
-                type: WebInspector.LinearGradient,
-                label: WebInspector.UIString("Repeating Linear Gradient"),
+                type: WI.LinearGradient,
+                label: WI.UIString("Repeating Linear Gradient"),
                 repeats: true
             },
             "repeating-radial-gradient": {
-                type: WebInspector.RadialGradient,
-                label: WebInspector.UIString("Repeating Radial Gradient"),
+                type: WI.RadialGradient,
+                label: WI.UIString("Repeating Radial Gradient"),
                 repeats: true
             }
         };
@@ -67,17 +67,17 @@
         }
         this._gradientTypePicker.addEventListener("change", this._gradientTypeChanged.bind(this));
 
-        this._gradientSlider = new WebInspector.GradientSlider(this);
+        this._gradientSlider = new WI.GradientSlider(this);
         this._element.appendChild(this._gradientSlider.element);
 
-        this._colorPicker = new WebInspector.ColorPicker;
+        this._colorPicker = new WI.ColorPicker;
         this._colorPicker.colorWheel.dimension = 190;
         this._colorPicker.enableColorComponentInputs = false;
-        this._colorPicker.addEventListener(WebInspector.ColorPicker.Event.ColorChanged, this._colorPickerColorChanged, this);
+        this._colorPicker.addEventListener(WI.ColorPicker.Event.ColorChanged, this._colorPickerColorChanged, this);
 
         let angleContainerElement = this._element.appendChild(document.createElement("div"));
         angleContainerElement.classList.add("gradient-angle");
-        angleContainerElement.append(WebInspector.UIString("Angle"));
+        angleContainerElement.append(WI.UIString("Angle"));
 
         let boundAngleValueChanged = this._angleValueChanged.bind(this);
 
@@ -93,10 +93,10 @@
         this._angleUnitsSelectElement.addEventListener("change", this._angleUnitsChanged.bind(this));
 
         const angleUnitsData = [
-            {name: WebInspector.LinearGradient.AngleUnits.DEG, min: 0, max: 360, step: 1},
-            {name: WebInspector.LinearGradient.AngleUnits.RAD, min: 0, max: 2 * Math.PI, step: 0.01},
-            {name: WebInspector.LinearGradient.AngleUnits.GRAD, min: 0, max: 400, step: 1},
-            {name: WebInspector.LinearGradient.AngleUnits.TURN, min: 0, max: 1, step: 0.01}
+            {name: WI.LinearGradient.AngleUnits.DEG, min: 0, max: 360, step: 1},
+            {name: WI.LinearGradient.AngleUnits.RAD, min: 0, max: 2 * Math.PI, step: 0.01},
+            {name: WI.LinearGradient.AngleUnits.GRAD, min: 0, max: 400, step: 1},
+            {name: WI.LinearGradient.AngleUnits.TURN, min: 0, max: 1, step: 0.01}
         ];
 
         this._angleUnitsConfiguration = new Map(angleUnitsData.map(({name, min, max, step}) => {
@@ -117,8 +117,8 @@
         if (!gradient)
             return;
 
-        const isLinear = gradient instanceof WebInspector.LinearGradient;
-        const isRadial = gradient instanceof WebInspector.RadialGradient;
+        const isLinear = gradient instanceof WI.LinearGradient;
+        const isRadial = gradient instanceof WI.RadialGradient;
         console.assert(isLinear || isRadial);
         if (!isLinear && !isRadial)
             return;
@@ -146,7 +146,7 @@
     {
         this._gradient.stops = gradientSlider.stops;
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
+        this.dispatchEventToListeners(WI.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
     }
 
     gradientSliderStopWasSelected(gradientSlider, stop)
@@ -167,36 +167,36 @@
         // animate the popover's frame to fit its new content.
         this._angleInputElement.blur();
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.ColorPickerToggled);
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
+        this.dispatchEventToListeners(WI.GradientEditor.Event.ColorPickerToggled);
+        this.dispatchEventToListeners(WI.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
     }
 
     // Private
 
     _updateCSSClassForGradientType()
     {
-        const isRadial = this._gradient instanceof WebInspector.RadialGradient;
+        const isRadial = this._gradient instanceof WI.RadialGradient;
         this._element.classList.toggle("radial-gradient", isRadial);
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.ColorPickerToggled);
+        this.dispatchEventToListeners(WI.GradientEditor.Event.ColorPickerToggled);
     }
 
     _gradientTypeChanged(event)
     {
         const descriptor = this._gradientTypes[this._gradientTypePicker.value];
         if (!(this._gradient instanceof descriptor.type)) {
-            if (descriptor.type === WebInspector.LinearGradient) {
-                this._gradient = new WebInspector.LinearGradient({value: 180, units: WebInspector.LinearGradient.AngleUnits.DEG}, this._gradient.stops);
+            if (descriptor.type === WI.LinearGradient) {
+                this._gradient = new WI.LinearGradient({value: 180, units: WI.LinearGradient.AngleUnits.DEG}, this._gradient.stops);
 
                 this._angleUnitsChanged();
             } else
-                this._gradient = new WebInspector.RadialGradient("", this._gradient.stops);
+                this._gradient = new WI.RadialGradient("", this._gradient.stops);
 
             this._updateCSSClassForGradientType();
         }
         this._gradient.repeats = descriptor.repeats;
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
+        this.dispatchEventToListeners(WI.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
     }
 
     _colorPickerColorChanged(event)
@@ -204,7 +204,7 @@
         this._gradientSlider.selectedStop.color = event.target.color;
         this._gradientSlider.stops = this._gradient.stops;
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
+        this.dispatchEventToListeners(WI.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
     }
 
     _angleValueChanged(event)
@@ -217,11 +217,11 @@
             this._gradient.angleValue = this._angleInputElement.value = parseFloat(this._angleSliderElement.value) || 0;
             break;
         default:
-            WebInspector.reportInternalError("Input event fired for disabled color component input");
+            WI.reportInternalError("Input event fired for disabled color component input");
             return;
         }
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
+        this.dispatchEventToListeners(WI.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
     }
 
     _angleUnitsChanged(event)
@@ -229,7 +229,7 @@
         let units = this._angleUnitsSelectElement.value;
         let configuration = this._angleUnitsConfiguration.get(units);
         if (!configuration) {
-            WebInspector.reportInternalError(`Missing configuration data for selected angle units "${units}"`);
+            WI.reportInternalError(`Missing configuration data for selected angle units "${units}"`);
             return;
         }
 
@@ -240,11 +240,11 @@
         this._angleInputElement.step = this._angleSliderElement.step = configuration.step;
         this._angleInputElement.value = this._angleSliderElement.value = this._gradient.angleValue;
 
-        this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
+        this.dispatchEventToListeners(WI.GradientEditor.Event.GradientChanged, {gradient: this._gradient});
     }
 };
 
-WebInspector.GradientEditor.Event = {
+WI.GradientEditor.Event = {
     GradientChanged: "gradient-editor-gradient-changed",
     ColorPickerToggled: "gradient-editor-color-picker-toggled"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/GradientSlider.js b/Source/WebInspectorUI/UserInterface/Views/GradientSlider.js
index 5a94198..32aefb7 100644
--- a/Source/WebInspectorUI/UserInterface/Views/GradientSlider.js
+++ b/Source/WebInspectorUI/UserInterface/Views/GradientSlider.js
@@ -26,7 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.GradientSlider = class GradientSlider extends WebInspector.Object
+WI.GradientSlider = class GradientSlider extends WI.Object
 {
     constructor(delegate)
     {
@@ -41,7 +41,7 @@
         this._selectedKnob = null;
         this._canvas = document.createElement("canvas");
 
-        this._keyboardShortcutEsc = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape);
+        this._keyboardShortcutEsc = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape);
     }
 
     // Public
@@ -58,7 +58,7 @@
             this._addArea.addEventListener("mousemove", this);
             this._addArea.addEventListener("mouseout", this);
             this._addArea.addEventListener("click", this);
-            this._addArea.className = WebInspector.GradientSlider.AddAreaClassName;
+            this._addArea.className = WI.GradientSlider.AddAreaClassName;
         }
         return this._element;
     }
@@ -112,7 +112,7 @@
 
     knobXDidChange(knob)
     {
-        knob.stop.offset = knob.x / WebInspector.GradientSlider.Width;
+        knob.stop.offset = knob.x / WI.GradientSlider.Width;
         this._sortStops();
         this._updateCanvas();
     }
@@ -124,7 +124,7 @@
 
     knobWillDetach(knob)
     {
-        knob.element.classList.add(WebInspector.GradientSlider.DetachingClassName);
+        knob.element.classList.add(WI.GradientSlider.DetachingClassName);
 
         this._stops.remove(knob.stop);
         this._knobs.remove(knob);
@@ -143,9 +143,9 @@
             this.delegate.gradientSliderStopWasSelected(this, knob.stop);
 
         if (this._selectedKnob)
-            WebInspector.addWindowKeydownListener(this);
+            WI.addWindowKeydownListener(this);
         else
-            WebInspector.removeWindowKeydownListener(this);
+            WI.removeWindowKeydownListener(this);
     }
 
     // Private
@@ -175,9 +175,9 @@
 
         this._knobs.push(this._shadowKnob);
 
-        this._shadowKnob.element.classList.remove(WebInspector.GradientSlider.ShadowClassName);
+        this._shadowKnob.element.classList.remove(WI.GradientSlider.ShadowClassName);
 
-        var stop = {offset: this._shadowKnob.x / WebInspector.GradientSlider.Width, color: this._shadowKnob.wellColor};
+        var stop = {offset: this._shadowKnob.x / WI.GradientSlider.Width, color: this._shadowKnob.wellColor};
         this._stops.push(stop);
         this._sortStops();
         this._updateStops();
@@ -190,15 +190,15 @@
     _updateShadowKnob(event)
     {
         if (!this._shadowKnob) {
-            this._shadowKnob = new WebInspector.GradientSliderKnob(this);
-            this._shadowKnob.element.classList.add(WebInspector.GradientSlider.ShadowClassName);
+            this._shadowKnob = new WI.GradientSliderKnob(this);
+            this._shadowKnob.element.classList.add(WI.GradientSlider.ShadowClassName);
             this.element.appendChild(this._shadowKnob.element);
         }
 
         this._shadowKnob.x = window.webkitConvertPointFromPageToNode(this.element, new WebKitPoint(event.pageX, event.pageY)).x;
 
         var colorData = this._canvas.getContext("2d").getImageData(this._shadowKnob.x - 1, 0, 1, 1).data;
-        this._shadowKnob.wellColor = new WebInspector.Color(WebInspector.Color.Format.RGB, [colorData[0], colorData[1], colorData[2], colorData[3] / 255]);
+        this._shadowKnob.wellColor = new WI.Color(WI.Color.Format.RGB, [colorData[0], colorData[1], colorData[2], colorData[3] / 255]);
     }
 
     _sortStops()
@@ -216,8 +216,8 @@
 
     _updateCanvas()
     {
-        var w = WebInspector.GradientSlider.Width;
-        var h = WebInspector.GradientSlider.Height;
+        var w = WI.GradientSlider.Width;
+        var h = WI.GradientSlider.Height;
 
         this._canvas.width = w;
         this._canvas.height = h;
@@ -243,7 +243,7 @@
             this._knobs.pop().element.remove();
 
         while (this._knobs.length < this._stops.length) {
-            var knob = new WebInspector.GradientSliderKnob(this);
+            var knob = new WI.GradientSliderKnob(this);
             this.element.appendChild(knob.element);
             this._knobs.push(knob);
         }
@@ -253,20 +253,20 @@
             var knob = this._knobs[i];
 
             knob.stop = stop;
-            knob.x = Math.round(stop.offset * WebInspector.GradientSlider.Width);
+            knob.x = Math.round(stop.offset * WI.GradientSlider.Width);
             knob.selected = stop === selectedStop;
         }
     }
 };
 
-WebInspector.GradientSlider.Width = 238;
-WebInspector.GradientSlider.Height = 19;
+WI.GradientSlider.Width = 238;
+WI.GradientSlider.Height = 19;
 
-WebInspector.GradientSlider.AddAreaClassName = "add-area";
-WebInspector.GradientSlider.DetachingClassName = "detaching";
-WebInspector.GradientSlider.ShadowClassName = "shadow";
+WI.GradientSlider.AddAreaClassName = "add-area";
+WI.GradientSlider.DetachingClassName = "detaching";
+WI.GradientSlider.ShadowClassName = "shadow";
 
-WebInspector.GradientSliderKnob = class GradientSliderKnob extends WebInspector.Object
+WI.GradientSliderKnob = class GradientSliderKnob extends WI.Object
 {
     constructor(delegate)
     {
@@ -340,7 +340,7 @@
 
     get selected()
     {
-        return this._element.classList.contains(WebInspector.GradientSliderKnob.SelectedClassName);
+        return this._element.classList.contains(WI.GradientSliderKnob.SelectedClassName);
     }
 
     set selected(selected)
@@ -348,7 +348,7 @@
         if (this.selected === selected)
             return;
 
-        this._element.classList.toggle(WebInspector.GradientSliderKnob.SelectedClassName, selected);
+        this._element.classList.toggle(WI.GradientSliderKnob.SelectedClassName, selected);
 
         if (this.delegate && typeof this.delegate.knobSelectionChanged === "function")
             this.delegate.knobSelectionChanged(this);
@@ -394,7 +394,7 @@
 
     _handleMousemove(event)
     {
-        var w = WebInspector.GradientSlider.Width;
+        var w = WI.GradientSlider.Width;
 
         this._moved = true;
 
@@ -427,7 +427,7 @@
 
         if (this._detaching) {
             this.element.addEventListener("transitionend", this);
-            this.element.classList.add(WebInspector.GradientSliderKnob.FadeOutClassName);
+            this.element.classList.add(WI.GradientSliderKnob.FadeOutClassName);
             this.selected = false;
         } else if (!this._moved)
             this.selected = !this.selected;
@@ -436,7 +436,7 @@
     _handleTransitionEnd(event)
     {
         this.element.removeEventListener("transitionend", this);
-        this.element.classList.remove(WebInspector.GradientSliderKnob.FadeOutClassName);
+        this.element.classList.remove(WI.GradientSliderKnob.FadeOutClassName);
         this.element.remove();
     }
 
@@ -446,5 +446,5 @@
     }
 };
 
-WebInspector.GradientSliderKnob.SelectedClassName = "selected";
-WebInspector.GradientSliderKnob.FadeOutClassName = "fade-out";
+WI.GradientSliderKnob.SelectedClassName = "selected";
+WI.GradientSliderKnob.FadeOutClassName = "fade-out";
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js
index f6d2e2f..393f448 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapAllocationsTimelineDataGridNode = class HeapAllocationsTimelineDataGridNode extends WebInspector.TimelineDataGridNode
+WI.HeapAllocationsTimelineDataGridNode = class HeapAllocationsTimelineDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(heapAllocationsTimelineRecord, zeroTime, heapAllocationsView)
     {
@@ -39,8 +39,8 @@
             liveSize: this._record.heapSnapshot.liveSize,
         };
 
-        this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes, this._heapSnapshotCollectedNodes, this);
-        this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated, this._heapSnapshotInvalidated, this);
+        this._record.heapSnapshot.addEventListener(WI.HeapSnapshotProxy.Event.CollectedNodes, this._heapSnapshotCollectedNodes, this);
+        this._record.heapSnapshot.addEventListener(WI.HeapSnapshotProxy.Event.Invalidated, this._heapSnapshotInvalidated, this);
     }
 
     // Public
@@ -58,7 +58,7 @@
             var titleElement = fragment.appendChild(document.createElement("span"));
             titleElement.textContent = this._data.name;
             if (!this._record.heapSnapshot.invalid) {
-                var goToButton = fragment.appendChild(WebInspector.createGoToArrowButton());
+                var goToButton = fragment.appendChild(WI.createGoToArrowButton());
                 goToButton.addEventListener("click", (event) => {
                     this._heapAllocationsView.showHeapSnapshotTimelineRecord(this._record);
                 });
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js
index c2698f9..6d6caa2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapAllocationsTimelineDataGridNodePathComponent = class HeapAllocationsTimelineDataGridNodePathComponent extends WebInspector.TimelineDataGridNodePathComponent
+WI.HeapAllocationsTimelineDataGridNodePathComponent = class HeapAllocationsTimelineDataGridNodePathComponent extends WI.TimelineDataGridNodePathComponent
 {
     // Protected
 
@@ -36,7 +36,7 @@
         if (!previousSibling)
             return null;
 
-        return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(previousSibling);
+        return new WI.HeapAllocationsTimelineDataGridNodePathComponent(previousSibling);
     }
 
     get nextSibling()
@@ -48,6 +48,6 @@
         if (!nextSibling)
             return null;
 
-        return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(nextSibling);
+        return new WI.HeapAllocationsTimelineDataGridNodePathComponent(nextSibling);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js
index 8826d83..eea29c8 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapAllocationsTimelineOverviewGraph = class HeapAllocationsTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
+WI.HeapAllocationsTimelineOverviewGraph = class HeapAllocationsTimelineOverviewGraph extends WI.TimelineOverviewGraph
 {
     constructor(timeline, timelineOverview)
     {
@@ -32,7 +32,7 @@
         this.element.classList.add("heap-allocations");
 
         this._heapAllocationsTimeline = timeline;
-        this._heapAllocationsTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._heapAllocationTimelineRecordAdded, this);
+        this._heapAllocationsTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._heapAllocationTimelineRecordAdded, this);
 
         this._selectedImageElement = null;
 
@@ -78,9 +78,9 @@
             if (x <= 1)
                 x = 1;
 
-            let imageElement = record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
+            let imageElement = record[WI.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
             if (!imageElement) {
-                imageElement = record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol] = document.createElement("img");
+                imageElement = record[WI.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol] = document.createElement("img");
                 imageElement.classList.add("snapshot");
                 imageElement.addEventListener("click", () => {
                     if (record.heapSnapshot.invalid)
@@ -89,7 +89,7 @@
                 });
             }
 
-            imageElement.style.setProperty(WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left", `${x}px`);
+            imageElement.style.setProperty(WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left", `${x}px`);
 
             if (record.heapSnapshot.invalid)
                 imageElement.classList.add("invalid");
@@ -117,7 +117,7 @@
             return;
         }
 
-        let imageElement = this.selectedRecord[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
+        let imageElement = this.selectedRecord[WI.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
         if (!imageElement)
             return;
 
@@ -132,4 +132,4 @@
     }
 };
 
-WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol = Symbol("record-element-association");
+WI.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol = Symbol("record-element-association");
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
index b5f51e6..762f92b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
@@ -23,54 +23,54 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WebInspector.TimelineView
+WI.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline, extraArguments);
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.HeapAllocations, timeline);
+        console.assert(timeline.type === WI.TimelineRecord.Type.HeapAllocations, timeline);
 
         this.element.classList.add("heap-allocations");
 
         let columns = {
             name: {
-                title: WebInspector.UIString("Name"),
+                title: WI.UIString("Name"),
                 width: "150px",
                 icon: true,
             },
             timestamp: {
-                title: WebInspector.UIString("Time"),
+                title: WI.UIString("Time"),
                 width: "80px",
                 sortable: true,
                 aligned: "right",
             },
             size: {
-                title: WebInspector.UIString("Size"),
+                title: WI.UIString("Size"),
                 width: "80px",
                 sortable: true,
                 aligned: "right",
             },
             liveSize: {
-                title: WebInspector.UIString("Live Size"),
+                title: WI.UIString("Live Size"),
                 width: "80px",
                 sortable: true,
                 aligned: "right",
             },
         };
 
-        let snapshotTooltip = WebInspector.UIString("Take snapshot");
-        this._takeHeapSnapshotButtonItem = new WebInspector.ButtonNavigationItem("take-snapshot", snapshotTooltip, "Images/Camera.svg", 16, 16);
-        this._takeHeapSnapshotButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._takeHeapSnapshotClicked, this);
+        let snapshotTooltip = WI.UIString("Take snapshot");
+        this._takeHeapSnapshotButtonItem = new WI.ButtonNavigationItem("take-snapshot", snapshotTooltip, "Images/Camera.svg", 16, 16);
+        this._takeHeapSnapshotButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._takeHeapSnapshotClicked, this);
 
-        let defaultToolTip = WebInspector.UIString("Compare snapshots");
-        let activatedToolTip = WebInspector.UIString("Cancel comparison");
-        this._compareHeapSnapshotsButtonItem = new WebInspector.ActivateButtonNavigationItem("compare-heap-snapshots", defaultToolTip, activatedToolTip, "Images/Compare.svg", 16, 16);
-        this._compareHeapSnapshotsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._compareHeapSnapshotsClicked, this);
+        let defaultToolTip = WI.UIString("Compare snapshots");
+        let activatedToolTip = WI.UIString("Cancel comparison");
+        this._compareHeapSnapshotsButtonItem = new WI.ActivateButtonNavigationItem("compare-heap-snapshots", defaultToolTip, activatedToolTip, "Images/Compare.svg", 16, 16);
+        this._compareHeapSnapshotsButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._compareHeapSnapshotsClicked, this);
         this._compareHeapSnapshotsButtonItem.enabled = false;
         this._compareHeapSnapshotsButtonItem.activated = false;
 
-        this._compareHeapSnapshotHelpTextItem = new WebInspector.TextNavigationItem("compare-heap-snapshot-help-text", "");
+        this._compareHeapSnapshotHelpTextItem = new WI.TextNavigationItem("compare-heap-snapshot-help-text", "");
 
         this._selectingComparisonHeapSnapshots = false;
         this._baselineDataGridNode = null;
@@ -80,28 +80,28 @@
         this._snapshotListScrollTop = 0;
         this._showingSnapshotList = true;
 
-        this._snapshotListPathComponent = new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot List"), "snapshot-list-icon", "snapshot-list", false, false);
-        this._snapshotListPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._snapshotListPathComponentClicked, this);
+        this._snapshotListPathComponent = new WI.HierarchicalPathComponent(WI.UIString("Snapshot List"), "snapshot-list-icon", "snapshot-list", false, false);
+        this._snapshotListPathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._snapshotListPathComponentClicked, this);
 
-        this._dataGrid = new WebInspector.TimelineDataGrid(columns);
+        this._dataGrid = new WI.TimelineDataGrid(columns);
         this._dataGrid.sortColumnIdentifier = "timestamp";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("heap-allocations-timeline-view");
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
 
         this.addSubview(this._dataGrid);
 
-        this._contentViewContainer = new WebInspector.ContentViewContainer;
-        this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
+        this._contentViewContainer = new WI.ContentViewContainer;
+        this._contentViewContainer.addEventListener(WI.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
 
         this._pendingRecords = [];
         this._pendingZeroTimeDataGridNodes = [];
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._heapAllocationsTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._heapAllocationsTimelineRecordAdded, this);
 
-        WebInspector.HeapSnapshotProxy.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated, this._heapSnapshotInvalidated, this);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().addEventListener("HeapSnapshot.CollectionEvent", this._heapSnapshotCollectionEvent, this);
+        WI.HeapSnapshotProxy.addEventListener(WI.HeapSnapshotProxy.Event.Invalidated, this._heapSnapshotInvalidated, this);
+        WI.HeapSnapshotWorkerProxy.singleton().addEventListener("HeapSnapshot.CollectionEvent", this._heapSnapshotCollectionEvent, this);
     }
 
     // Public
@@ -130,8 +130,8 @@
 
         this._dataGrid.scrollContainer.scrollTop = this._snapshotListScrollTop;
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     showHeapSnapshotTimelineRecord(heapSnapshotTimelineRecord)
@@ -203,11 +203,11 @@
         if (this._heapSnapshotDiff) {
             let firstSnapshotIdentifier = this._heapSnapshotDiff.snapshot1.identifier;
             let secondSnapshotIdentifier = this._heapSnapshotDiff.snapshot2.identifier;
-            let diffComponent = new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot Comparison (%d and %d)").format(firstSnapshotIdentifier, secondSnapshotIdentifier), "snapshot-diff-icon", "snapshot-diff");
+            let diffComponent = new WI.HierarchicalPathComponent(WI.UIString("Snapshot Comparison (%d and %d)").format(firstSnapshotIdentifier, secondSnapshotIdentifier), "snapshot-diff-icon", "snapshot-diff");
             components.push(diffComponent);
         } else if (this._dataGrid.selectedNode) {
-            let heapSnapshotPathComponent = new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(this._dataGrid.selectedNode);
-            heapSnapshotPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._snapshotPathComponentSelected, this);
+            let heapSnapshotPathComponent = new WI.HeapAllocationsTimelineDataGridNodePathComponent(this._dataGrid.selectedNode);
+            heapSnapshotPathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._snapshotPathComponentSelected, this);
             components.push(heapSnapshotPathComponent);
         }
 
@@ -244,16 +244,16 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
 
         this._dataGrid.closed();
 
         this._contentViewContainer.closeAllContentViews();
 
-        WebInspector.ContentView.removeEventListener(null, null, this);
-        WebInspector.HeapSnapshotProxy.removeEventListener(null, null, this);
-        WebInspector.HeapSnapshotWorkerProxy.singleton().removeEventListener("HeapSnapshot.CollectionEvent", this._heapSnapshotCollectionEvent, this);
+        WI.ContentView.removeEventListener(null, null, this);
+        WI.HeapSnapshotProxy.removeEventListener(null, null, this);
+        WI.HeapSnapshotWorkerProxy.singleton().removeEventListener("HeapSnapshot.CollectionEvent", this._heapSnapshotCollectionEvent, this);
     }
 
     layout()
@@ -267,7 +267,7 @@
 
         if (this._pendingRecords.length) {
             for (let heapAllocationsTimelineRecord of this._pendingRecords) {
-                let dataGridNode = new WebInspector.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, this.zeroTime, this);
+                let dataGridNode = new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, this.zeroTime, this);
                 this._dataGrid.addRowInSortOrder(null, dataGridNode);
                 if (!this.zeroTime)
                     this._pendingZeroTimeDataGridNodes.push(dataGridNode);
@@ -327,21 +327,21 @@
 
     _snapshotPathComponentSelected(event)
     {
-        console.assert(event.data.pathComponent.representedObject instanceof WebInspector.HeapAllocationsTimelineRecord);
+        console.assert(event.data.pathComponent.representedObject instanceof WI.HeapAllocationsTimelineRecord);
         this.showHeapSnapshotTimelineRecord(event.data.pathComponent.representedObject);
     }
 
     _currentContentViewDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     _contentViewSelectionPathComponentDidChange(event)
     {
         if (event.target !== this._contentViewContainer.currentContentView)
             return;
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _heapSnapshotInvalidated(event)
@@ -385,10 +385,10 @@
     _takeHeapSnapshotClicked()
     {
         HeapAgent.snapshot(function(error, timestamp, snapshotStringData) {
-            let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+            let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
             workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
-                let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
-                WebInspector.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+                let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+                WI.timelineManager.heapSnapshotAdded(timestamp, snapshot);
             });
         });
     }
@@ -407,7 +407,7 @@
 
         this._compareHeapSnapshotsButtonItem.activated = false;
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     _compareHeapSnapshotsClicked(event)
@@ -425,9 +425,9 @@
 
         this._selectingComparisonHeapSnapshots = true;
         this._baselineHeapSnapshotTimelineRecord = null;
-        this._compareHeapSnapshotHelpTextItem.text = WebInspector.UIString("Select baseline snapshot");
+        this._compareHeapSnapshotHelpTextItem.text = WI.UIString("Select baseline snapshot");
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     _dataGridNodeSelected(event)
@@ -453,8 +453,8 @@
             this._baselineDataGridNode.markAsBaseline();
             this._baselineHeapSnapshotTimelineRecord = heapAllocationsTimelineRecord;
             this._dataGrid.selectedNode.deselect();
-            this._compareHeapSnapshotHelpTextItem.text = WebInspector.UIString("Select comparison snapshot");
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+            this._compareHeapSnapshotHelpTextItem.text = WI.UIString("Select comparison snapshot");
+            this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
             return;
         }
 
@@ -464,9 +464,9 @@
         if (snapshot1.identifier > snapshot2.identifier)
             [snapshot1, snapshot2] = [snapshot2, snapshot1];
 
-        let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+        let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
         workerProxy.createSnapshotDiff(snapshot1.proxyObjectId, snapshot2.proxyObjectId, ({objectId, snapshotDiff: serializedSnapshotDiff}) => {
-            let diff = WebInspector.HeapSnapshotDiffProxy.deserialize(objectId, serializedSnapshotDiff);
+            let diff = WI.HeapSnapshotDiffProxy.deserialize(objectId, serializedSnapshotDiff);
             this.showHeapSnapshotDiff(diff);
         });
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js
index 2a691c1..369fb00 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js
@@ -23,7 +23,7 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.HeapSnapshotClassDataGridNode = class HeapSnapshotClassDataGridNode extends WebInspector.DataGridNode
+WI.HeapSnapshotClassDataGridNode = class HeapSnapshotClassDataGridNode extends WI.DataGridNode
 {
     constructor(data, tree)
     {
@@ -63,7 +63,7 @@
             let {className} = this._data;
             let fragment = document.createDocumentFragment();
             let iconElement = fragment.appendChild(document.createElement("img"));
-            iconElement.classList.add("icon", WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className));
+            iconElement.classList.add("icon", WI.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className));
             let nameElement = fragment.appendChild(document.createElement("span"));
             nameElement.classList.add("class-name");
             nameElement.textContent = className;
@@ -97,7 +97,7 @@
         let nodesToRemove = [];
 
         this.forEachImmediateChild((dataGridNode) => {
-            if (dataGridNode instanceof WebInspector.HeapSnapshotInstanceDataGridNode) {
+            if (dataGridNode instanceof WI.HeapSnapshotInstanceDataGridNode) {
                 let heapSnapshotNode = dataGridNode.node;
                 if (heapSnapshotNode.id in collectedNodes)
                     nodesToRemove.push(dataGridNode);
@@ -141,14 +141,14 @@
             this._sortInstances();
 
             // Batch.
-            if (instances.length > WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit) {
+            if (instances.length > WI.HeapSnapshotClassDataGridNode.ChildrenBatchLimit) {
                 this._batched = true;
-                this._fetchBatch(WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit);
+                this._fetchBatch(WI.HeapSnapshotClassDataGridNode.ChildrenBatchLimit);
                 return;
             }
 
             for (let instance of this._instances)
-                this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree));
+                this.appendChild(new WI.HeapSnapshotInstanceDataGridNode(instance, this._tree));
         });
     }
 
@@ -169,7 +169,7 @@
         if (count) {
             for (let i = 0; i <= count; ++i) {
                 let instance = this._instances[oldCount + i];
-                this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree));
+                this.appendChild(new WI.HeapSnapshotInstanceDataGridNode(instance, this._tree));
             }
         }
 
@@ -193,27 +193,27 @@
         this.removeChildren();
 
         for (let i = 0; i < count; ++i)
-            this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(this._instances[i], this._tree));
+            this.appendChild(new WI.HeapSnapshotInstanceDataGridNode(this._instances[i], this._tree));
     }
 
     _removeFetchMoreDataGridNode()
     {
-        console.assert(this.children[this.children.length - 1] instanceof WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode);
+        console.assert(this.children[this.children.length - 1] instanceof WI.HeapSnapshotInstanceFetchMoreDataGridNode);
 
         this.removeChild(this.children[this.children.length - 1]);
     }
 
     _appendFetchMoreDataGridNode()
     {
-        console.assert(!(this.children[this.children.length - 1] instanceof WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode));
+        console.assert(!(this.children[this.children.length - 1] instanceof WI.HeapSnapshotInstanceFetchMoreDataGridNode));
 
         let count = this.children.length;
         let totalCount = this._instances.length;
         let remainingCount = totalCount - count;
-        let batchSize = remainingCount >= WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit ? WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit : 0;
+        let batchSize = remainingCount >= WI.HeapSnapshotClassDataGridNode.ChildrenBatchLimit ? WI.HeapSnapshotClassDataGridNode.ChildrenBatchLimit : 0;
 
-        this.appendChild(new WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode(this._tree, batchSize, remainingCount, this._fetchBatch.bind(this)));
+        this.appendChild(new WI.HeapSnapshotInstanceFetchMoreDataGridNode(this._tree, batchSize, remainingCount, this._fetchBatch.bind(this)));
     }
 };
 
-WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit = 100;
+WI.HeapSnapshotClassDataGridNode.ChildrenBatchLimit = 100;
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js
index 30f96f8..d2091ad 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js
@@ -23,20 +23,20 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapSnapshotClusterContentView = class HeapSnapshotClusterContentView extends WebInspector.ClusterContentView
+WI.HeapSnapshotClusterContentView = class HeapSnapshotClusterContentView extends WI.ClusterContentView
 {
     constructor(heapSnapshot)
     {
         super(heapSnapshot);
 
-        console.assert(heapSnapshot instanceof WebInspector.HeapSnapshotProxy || heapSnapshot instanceof WebInspector.HeapSnapshotDiffProxy);
+        console.assert(heapSnapshot instanceof WI.HeapSnapshotProxy || heapSnapshot instanceof WI.HeapSnapshotDiffProxy);
 
         this._heapSnapshot = heapSnapshot;
 
         function createPathComponent(displayName, className, identifier)
         {
-            let pathComponent = new WebInspector.HierarchicalPathComponent(displayName, className, identifier, false, true);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+            let pathComponent = new WI.HierarchicalPathComponent(displayName, className, identifier, false, true);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
             pathComponent.comparisonData = heapSnapshot;
             return pathComponent;
         }
@@ -45,15 +45,15 @@
         this._instancesContentView = null;
         this._objectGraphContentView = null;
 
-        this._instancesPathComponent = createPathComponent.call(this, WebInspector.UIString("Instances"), "heap-snapshot-instances-icon", WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);
-        this._objectGraphPathComponent = createPathComponent.call(this, WebInspector.UIString("Object Graph"), "heap-snapshot-object-graph-icon", WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier);
+        this._instancesPathComponent = createPathComponent.call(this, WI.UIString("Instances"), "heap-snapshot-instances-icon", WI.HeapSnapshotClusterContentView.InstancesIdentifier);
+        this._objectGraphPathComponent = createPathComponent.call(this, WI.UIString("Object Graph"), "heap-snapshot-object-graph-icon", WI.HeapSnapshotClusterContentView.ObjectGraphIdentifier);
 
         if (this._supportsObjectGraph()) {
             this._instancesPathComponent.nextSibling = this._objectGraphPathComponent;
             this._objectGraphPathComponent.previousSibling = this._instancesPathComponent;
         }
 
-        this._currentContentViewSetting = new WebInspector.Setting("heap-snapshot-cluster-current-view", WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);
+        this._currentContentViewSetting = new WI.Setting("heap-snapshot-cluster-current-view", WI.HeapSnapshotClusterContentView.InstancesIdentifier);
     }
 
     // Static
@@ -110,7 +110,7 @@
     get instancesContentView()
     {
         if (!this._instancesContentView)
-            this._instancesContentView = new WebInspector.HeapSnapshotInstancesContentView(this._heapSnapshot);
+            this._instancesContentView = new WI.HeapSnapshotInstancesContentView(this._heapSnapshot);
         return this._instancesContentView;
     }
 
@@ -120,7 +120,7 @@
             return null;
 
         if (!this._objectGraphContentView)
-            this._objectGraphContentView = new WebInspector.HeapSnapshotObjectGraphContentView(this._heapSnapshot);
+            this._objectGraphContentView = new WI.HeapSnapshotObjectGraphContentView(this._heapSnapshot);
         return this._objectGraphContentView;
     }
 
@@ -153,31 +153,31 @@
 
     saveToCookie(cookie)
     {
-        cookie[WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
+        cookie[WI.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
     }
 
     restoreFromCookie(cookie)
     {
-        this._showContentViewForIdentifier(cookie[WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey]);
+        this._showContentViewForIdentifier(cookie[WI.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey]);
     }
 
     showInstances()
     {
         this._shownInitialContent = true;
-        return this._showContentViewForIdentifier(WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);
+        return this._showContentViewForIdentifier(WI.HeapSnapshotClusterContentView.InstancesIdentifier);
     }
 
     showObjectGraph()
     {
         this._shownInitialContent = true;
-        return this._showContentViewForIdentifier(WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier);
+        return this._showContentViewForIdentifier(WI.HeapSnapshotClusterContentView.ObjectGraphIdentifier);
     }
 
     // Private
 
     _supportsObjectGraph()
     {
-        return this._heapSnapshot instanceof WebInspector.HeapSnapshotProxy;
+        return this._heapSnapshot instanceof WI.HeapSnapshotProxy;
     }
 
     _pathComponentForContentView(contentView)
@@ -199,9 +199,9 @@
         if (!contentView)
             return null;
         if (contentView === this._instancesContentView)
-            return WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier;
+            return WI.HeapSnapshotClusterContentView.InstancesIdentifier;
         if (contentView === this._objectGraphContentView)
-            return WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier;
+            return WI.HeapSnapshotClusterContentView.ObjectGraphIdentifier;
         console.error("Unknown contentView.");
         return null;
     }
@@ -211,10 +211,10 @@
         let contentViewToShow = null;
 
         switch (identifier) {
-        case WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier:
+        case WI.HeapSnapshotClusterContentView.InstancesIdentifier:
             contentViewToShow = this.instancesContentView;
             break;
-        case WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier:
+        case WI.HeapSnapshotClusterContentView.ObjectGraphIdentifier:
             contentViewToShow = this.objectGraphContentView;
             break;
         }
@@ -237,7 +237,7 @@
     }
 };
 
-WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey = "heap-snapshot-cluster-content-view-identifier";
+WI.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey = "heap-snapshot-cluster-content-view-identifier";
 
-WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier = "instances";
-WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier = "object-graph";
+WI.HeapSnapshotClusterContentView.InstancesIdentifier = "instances";
+WI.HeapSnapshotClusterContentView.ObjectGraphIdentifier = "object-graph";
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js
index 61efbce..62cddbf 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js
@@ -23,25 +23,25 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HeapSnapshotContentView = class HeapSnapshotContentView extends WebInspector.ContentView
+WI.HeapSnapshotContentView = class HeapSnapshotContentView extends WI.ContentView
 {
     constructor(representedObject, identifier, columns, heapSnapshotDataGridTreeConstructor)
     {
-        console.assert(representedObject instanceof WebInspector.HeapSnapshotProxy || representedObject instanceof WebInspector.HeapSnapshotDiffProxy);
+        console.assert(representedObject instanceof WI.HeapSnapshotProxy || representedObject instanceof WI.HeapSnapshotDiffProxy);
 
         super(representedObject);
 
         this.element.classList.add("heap-snapshot");
 
-        this._dataGrid = new WebInspector.DataGrid(columns);
+        this._dataGrid = new WI.DataGrid(columns);
         this._dataGrid.sortColumnIdentifier = "retainedSize";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Descending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Descending;
         this._dataGrid.createSettings(identifier);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
-        let sortComparator = WebInspector.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
+        let sortComparator = WI.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
         this._heapSnapshotDataGridTree = new heapSnapshotDataGridTreeConstructor(this.representedObject, sortComparator);
-        this._heapSnapshotDataGridTree.addEventListener(WebInspector.HeapSnapshotDataGridTree.Event.DidPopulate, this._heapSnapshotDataGridTreeDidPopulate, this);
+        this._heapSnapshotDataGridTree.addEventListener(WI.HeapSnapshotDataGridTree.Event.DidPopulate, this._heapSnapshotDataGridTreeDidPopulate, this);
 
         for (let child of this._heapSnapshotDataGridTree.children)
             this._dataGrid.appendChild(child);
@@ -78,7 +78,7 @@
         if (!this._heapSnapshotDataGridTree)
             return;
 
-        this._heapSnapshotDataGridTree.sortComparator = WebInspector.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
+        this._heapSnapshotDataGridTree.sortComparator = WI.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
 
         this._dataGrid.removeChildren();
         for (let child of this._heapSnapshotDataGridTree.children)
@@ -93,66 +93,66 @@
     }
 };
 
-WebInspector.HeapSnapshotInstancesContentView = class HeapSnapshotInstancesContentView extends WebInspector.HeapSnapshotContentView
+WI.HeapSnapshotInstancesContentView = class HeapSnapshotInstancesContentView extends WI.HeapSnapshotContentView
 {
     constructor(representedObject)
     {
         let columns = {
             retainedSize: {
-                title: WebInspector.UIString("Retained Size"),
-                tooltip: WebInspector.UIString("Size of current object plus all objects it keeps alive"),
+                title: WI.UIString("Retained Size"),
+                tooltip: WI.UIString("Size of current object plus all objects it keeps alive"),
                 width: "140px",
                 aligned: "right",
                 sortable: true,
             },
             size: {
-                title: WebInspector.UIString("Self Size"),
+                title: WI.UIString("Self Size"),
                 width: "90px",
                 aligned: "right",
                 sortable: true,
             },
             count: {
-                title: WebInspector.UIString("Count"),
+                title: WI.UIString("Count"),
                 width: "75px",
                 aligned: "right",
                 sortable: true,
             },
             className: {
-                title: WebInspector.UIString("Name"),
+                title: WI.UIString("Name"),
                 sortable: true,
                 disclosure: true,
             }
         };
 
-        super(representedObject, "heap-snapshot-instances-content-view", columns, WebInspector.HeapSnapshotInstancesDataGridTree);
+        super(representedObject, "heap-snapshot-instances-content-view", columns, WI.HeapSnapshotInstancesDataGridTree);
     }
 };
 
-WebInspector.HeapSnapshotObjectGraphContentView = class HeapSnapshotObjectGraphContentView extends WebInspector.HeapSnapshotContentView
+WI.HeapSnapshotObjectGraphContentView = class HeapSnapshotObjectGraphContentView extends WI.HeapSnapshotContentView
 {
     constructor(representedObject)
     {
         let columns = {
             retainedSize: {
-                title: WebInspector.UIString("Retained Size"),
-                tooltip: WebInspector.UIString("Size of current object plus all objects it keeps alive"),
+                title: WI.UIString("Retained Size"),
+                tooltip: WI.UIString("Size of current object plus all objects it keeps alive"),
                 width: "140px",
                 aligned: "right",
                 sortable: true,
             },
             size: {
-                title: WebInspector.UIString("Self Size"),
+                title: WI.UIString("Self Size"),
                 width: "90px",
                 aligned: "right",
                 sortable: true,
             },
             className: {
-                title: WebInspector.UIString("Name"),
+                title: WI.UIString("Name"),
                 sortable: true,
                 disclosure: true,
             }
         };
 
-        super(representedObject, "heap-snapshot-object-graph-content-view", columns, WebInspector.HeapSnapshotObjectGraphDataGridTree);
+        super(representedObject, "heap-snapshot-object-graph-content-view", columns, WI.HeapSnapshotObjectGraphDataGridTree);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotDataGridTree.js b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotDataGridTree.js
index eb293bf..a488b54 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotDataGridTree.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotDataGridTree.js
@@ -23,16 +23,16 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.HeapSnapshotDataGridTree = class HeapSnapshotDataGridTree extends WebInspector.Object
+WI.HeapSnapshotDataGridTree = class HeapSnapshotDataGridTree extends WI.Object
 {
     constructor(heapSnapshot, sortComparator)
     {
         super();
 
-        console.assert(heapSnapshot instanceof WebInspector.HeapSnapshotProxy || heapSnapshot instanceof WebInspector.HeapSnapshotDiffProxy);
+        console.assert(heapSnapshot instanceof WI.HeapSnapshotProxy || heapSnapshot instanceof WI.HeapSnapshotDiffProxy);
 
         this._heapSnapshot = heapSnapshot;
-        this._heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes, this._heapSnapshotCollectedNodes, this);
+        this._heapSnapshot.addEventListener(WI.HeapSnapshotProxy.Event.CollectedNodes, this._heapSnapshotCollectedNodes, this);
 
         this._children = [];
         this._sortComparator = sortComparator;
@@ -49,7 +49,7 @@
 
     static buildSortComparator(columnIdentifier, sortOrder)
     {
-        let multiplier = sortOrder === WebInspector.DataGrid.SortOrder.Ascending ? 1 : -1;
+        let multiplier = sortOrder === WI.DataGrid.SortOrder.Ascending ? 1 : -1;
         let numberCompare = (columnIdentifier, a, b) => multiplier * (a.data[columnIdentifier] - b.data[columnIdentifier]);
         let nameCompare = (a, b) => {
             // Sort by property name if available. Property names before no property name.
@@ -97,10 +97,10 @@
     get popover()
     {
         if (!this._popover) {
-            this._popover = new WebInspector.Popover(this);
+            this._popover = new WI.Popover(this);
             this._popover.windowResizeHandler = () => {
-                let bounds = WebInspector.Rect.rectFromClientRect(this._popoverTargetElement.getBoundingClientRect());
-                this._popover.present(bounds.pad(2), [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+                let bounds = WI.Rect.rectFromClientRect(this._popoverTargetElement.getBoundingClientRect());
+                this._popover.present(bounds.pad(2), [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]);
             };
         }
 
@@ -191,7 +191,7 @@
     {
         this.sort();
 
-        this.dispatchEventToListeners(WebInspector.HeapSnapshotDataGridTree.Event.DidPopulate);
+        this.dispatchEventToListeners(WI.HeapSnapshotDataGridTree.Event.DidPopulate);
     }
 
     // Private
@@ -202,11 +202,11 @@
     }
 };
 
-WebInspector.HeapSnapshotDataGridTree.Event = {
+WI.HeapSnapshotDataGridTree.Event = {
     DidPopulate: "heap-snapshot-data-grid-tree-did-populate",
 };
 
-WebInspector.HeapSnapshotInstancesDataGridTree = class HeapSnapshotInstancesDataGridTree extends WebInspector.HeapSnapshotDataGridTree
+WI.HeapSnapshotInstancesDataGridTree = class HeapSnapshotInstancesDataGridTree extends WI.HeapSnapshotDataGridTree
 {
     get alwaysShowRetainedSize()
     {
@@ -225,7 +225,7 @@
             if (!liveCount)
                 continue;
 
-            this.appendChild(new WebInspector.HeapSnapshotClassDataGridNode({className, size, retainedSize, count: liveCount}, this));
+            this.appendChild(new WI.HeapSnapshotClassDataGridNode({className, size, retainedSize, count: liveCount}, this));
         }
 
         this.didPopulate();
@@ -245,7 +245,7 @@
     }
 };
 
-WebInspector.HeapSnapshotObjectGraphDataGridTree = class HeapSnapshotInstancesDataGridTree extends WebInspector.HeapSnapshotDataGridTree
+WI.HeapSnapshotObjectGraphDataGridTree = class HeapSnapshotInstancesDataGridTree extends WI.HeapSnapshotDataGridTree
 {
     get alwaysShowRetainedSize()
     {
@@ -256,7 +256,7 @@
     {
         this.heapSnapshot.instancesWithClassName("GlobalObject", (instances) => {
             for (let instance of instances)
-                this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this));
+                this.appendChild(new WI.HeapSnapshotInstanceDataGridNode(instance, this));
         });
 
         this.heapSnapshot.instancesWithClassName("Window", (instances) => {
@@ -265,7 +265,7 @@
                 // In any case, ignore objects not dominated by the root, as they
                 // are probably not what we want.
                 if (instance.dominatorNodeIdentifier === 0)
-                    this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this));
+                    this.appendChild(new WI.HeapSnapshotInstanceDataGridNode(instance, this));
             }
 
             this.didPopulate();
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js
index fc4229b..566f350 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js
@@ -23,7 +23,7 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.HeapSnapshotInstanceDataGridNode = class HeapSnapshotInstanceDataGridNode extends WebInspector.DataGridNode
+WI.HeapSnapshotInstanceDataGridNode = class HeapSnapshotInstanceDataGridNode extends WI.DataGridNode
 {
     constructor(node, tree, edge, base)
     {
@@ -32,9 +32,9 @@
 
         super(node, hasChildren);
 
-        console.assert(node instanceof WebInspector.HeapSnapshotNodeProxy);
-        console.assert(!edge || edge instanceof WebInspector.HeapSnapshotEdgeProxy);
-        console.assert(!base || base instanceof WebInspector.HeapSnapshotInstanceDataGridNode);
+        console.assert(node instanceof WI.HeapSnapshotNodeProxy);
+        console.assert(!edge || edge instanceof WI.HeapSnapshotEdgeProxy);
+        console.assert(!base || base instanceof WI.HeapSnapshotInstanceDataGridNode);
 
         this._node = node;
         this._tree = tree;
@@ -54,22 +54,22 @@
     {
         let heapObjectIdentifier = node.id;
         let shouldRevealConsole = true;
-        let text = WebInspector.UIString("Heap Snapshot Object (%s)").format("@" + heapObjectIdentifier);
+        let text = WI.UIString("Heap Snapshot Object (%s)").format("@" + heapObjectIdentifier);
 
         node.shortestGCRootPath((gcRootPath) => {
             if (gcRootPath.length) {
                 gcRootPath = gcRootPath.slice().reverse();
                 let windowIndex = gcRootPath.findIndex((x) => {
-                    return x instanceof WebInspector.HeapSnapshotNodeProxy && x.className === "Window";
+                    return x instanceof WI.HeapSnapshotNodeProxy && x.className === "Window";
                 });
 
-                let heapSnapshotRootPath = WebInspector.HeapSnapshotRootPath.emptyPath();
+                let heapSnapshotRootPath = WI.HeapSnapshotRootPath.emptyPath();
                 for (let i = windowIndex === -1 ? 0 : windowIndex; i < gcRootPath.length; ++i) {
                     let component = gcRootPath[i];
-                    if (component instanceof WebInspector.HeapSnapshotNodeProxy) {
+                    if (component instanceof WI.HeapSnapshotNodeProxy) {
                         if (component.className === "Window")
                             heapSnapshotRootPath = heapSnapshotRootPath.appendGlobalScopeName(component, "window");
-                    } else if (component instanceof WebInspector.HeapSnapshotEdgeProxy)
+                    } else if (component instanceof WI.HeapSnapshotEdgeProxy)
                         heapSnapshotRootPath = heapSnapshotRootPath.appendEdge(component);
                 }
 
@@ -79,13 +79,13 @@
 
             if (node.className === "string") {
                 HeapAgent.getPreview(heapObjectIdentifier, function(error, string, functionDetails, objectPreviewPayload) {
-                    let remoteObject = error ? WebInspector.RemoteObject.fromPrimitiveValue(undefined) : WebInspector.RemoteObject.fromPrimitiveValue(string);
-                    WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, shouldRevealConsole);
+                    let remoteObject = error ? WI.RemoteObject.fromPrimitiveValue(undefined) : WI.RemoteObject.fromPrimitiveValue(string);
+                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, shouldRevealConsole);
                 });
             } else {
-                HeapAgent.getRemoteObject(heapObjectIdentifier, WebInspector.RuntimeManager.ConsoleObjectGroup, function(error, remoteObjectPayload) {
-                    let remoteObject = error ? WebInspector.RemoteObject.fromPrimitiveValue(undefined) : WebInspector.RemoteObject.fromPayload(remoteObjectPayload, WebInspector.assumingMainTarget());
-                    WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, shouldRevealConsole);
+                HeapAgent.getRemoteObject(heapObjectIdentifier, WI.RuntimeManager.ConsoleObjectGroup, function(error, remoteObjectPayload) {
+                    let remoteObject = error ? WI.RemoteObject.fromPrimitiveValue(undefined) : WI.RemoteObject.fromPayload(remoteObjectPayload, WI.assumingMainTarget());
+                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, shouldRevealConsole);
                 });
             }
         });
@@ -102,7 +102,7 @@
             return "";
 
         if (!this._propertyName)
-            this._propertyName = WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge(this._edge);
+            this._propertyName = WI.HeapSnapshotRootPath.pathComponentForIndividualEdge(this._edge);
         return this._propertyName;
     }
 
@@ -151,7 +151,7 @@
             containerElement.addEventListener("contextmenu", this._contextMenuHandler.bind(this));
 
             let iconElement = containerElement.appendChild(document.createElement("img"));
-            iconElement.classList.add("icon", WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className, internal));
+            iconElement.classList.add("icon", WI.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className, internal));
 
             if (this._edge) {
                 let nameElement = containerElement.appendChild(document.createElement("span"));
@@ -165,7 +165,7 @@
             let idElement = containerElement.appendChild(document.createElement("span"));
             idElement.classList.add("object-id");
             idElement.textContent = "@" + id;
-            idElement.addEventListener("click", WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, this._node));
+            idElement.addEventListener("click", WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, this._node));
             idElement.addEventListener("mouseover", this._mouseoverHandler.bind(this));
 
             let spacerElement = containerElement.appendChild(document.createElement("span"));
@@ -218,7 +218,7 @@
         this.removeEventListener("populate", this._populate, this);
 
         function propertyName(edge) {
-            return edge ? WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge(edge) : "";
+            return edge ? WI.HeapSnapshotRootPath.pathComponentForIndividualEdge(edge) : "";
         }
 
         this._node.retainedNodes((instances, edges) => {
@@ -238,16 +238,16 @@
                 if (instance.__edge && instance.__edge.isPrivateSymbol())
                     continue;
 
-                this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree, instance.__edge, this._base || this));
+                this.appendChild(new WI.HeapSnapshotInstanceDataGridNode(instance, this._tree, instance.__edge, this._base || this));
             }
         });
     }
 
     _contextMenuHandler(event)
     {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
         contextMenu.appendSeparator();
-        contextMenu.appendItem(WebInspector.UIString("Log Value"), WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, this._node));
+        contextMenu.appendItem(WI.UIString("Log Value"), WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, this._node));
     }
 
     _populateError(containerElement)
@@ -257,7 +257,7 @@
 
         let previewErrorElement = containerElement.appendChild(document.createElement("span"));
         previewErrorElement.classList.add("preview-error");
-        previewErrorElement.textContent = WebInspector.UIString("No preview available");
+        previewErrorElement.textContent = WI.UIString("No preview available");
     }
 
     _populateWindowPreview(containerElement)
@@ -272,15 +272,15 @@
                 return this.location.href;
             }
 
-            let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload, WebInspector.assumingMainTarget());
+            let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload, WI.assumingMainTarget());
             remoteObject.callFunctionJSON(inspectedPage_window_getLocationHref, undefined, (href) => {
                 remoteObject.release();
 
                 if (!href)
                     this._populateError(containerElement);
                 else {
-                    let primitiveRemoteObject = WebInspector.RemoteObject.fromPrimitiveValue(href);
-                    containerElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));
+                    let primitiveRemoteObject = WI.RemoteObject.fromPrimitiveValue(href);
+                    containerElement.appendChild(WI.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));
                 }
             });
         });
@@ -295,8 +295,8 @@
             }
 
             if (string) {
-                let primitiveRemoteObject = WebInspector.RemoteObject.fromPrimitiveValue(string);
-                containerElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));
+                let primitiveRemoteObject = WI.RemoteObject.fromPrimitiveValue(string);
+                containerElement.appendChild(WI.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));
                 return;
             }
 
@@ -304,13 +304,13 @@
                 let {location, name, displayName} = functionDetails;
                 let functionNameElement = containerElement.appendChild(document.createElement("span"));
                 functionNameElement.classList.add("function-name");
-                functionNameElement.textContent = name || displayName || WebInspector.UIString("(anonymous function)");
-                let sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId, WebInspector.assumingMainTarget());
+                functionNameElement.textContent = name || displayName || WI.UIString("(anonymous function)");
+                let sourceCode = WI.debuggerManager.scriptForIdentifier(location.scriptId, WI.assumingMainTarget());
                 if (sourceCode) {
                     let locationElement = containerElement.appendChild(document.createElement("span"));
                     locationElement.classList.add("location");
                     let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber);
-                    sourceCodeLocation.populateLiveDisplayLocationString(locationElement, "textContent", WebInspector.SourceCodeLocation.ColumnStyle.Hidden, WebInspector.SourceCodeLocation.NameStyle.Short);
+                    sourceCodeLocation.populateLiveDisplayLocationString(locationElement, "textContent", WI.SourceCodeLocation.ColumnStyle.Hidden, WI.SourceCodeLocation.NameStyle.Short);
 
                     const options = {
                         dontFloat: true,
@@ -318,15 +318,15 @@
                         ignoreNetworkTab: true,
                         ignoreSearchTab: true,
                     };
-                    let goToArrowButtonLink = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, options);
+                    let goToArrowButtonLink = WI.createSourceCodeLocationLink(sourceCodeLocation, options);
                     containerElement.appendChild(goToArrowButtonLink);
                 }
                 return;
             }
 
             if (objectPreviewPayload) {
-                let objectPreview = WebInspector.ObjectPreview.fromPayload(objectPreviewPayload);
-                let previewElement = WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview(objectPreview);
+                let objectPreview = WI.ObjectPreview.fromPayload(objectPreviewPayload);
+                let previewElement = WI.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview(objectPreview);
                 containerElement.appendChild(previewElement);
                 return;
             }
@@ -335,7 +335,7 @@
 
     _mouseoverHandler(event)
     {
-        let targetFrame = WebInspector.Rect.rectFromClientRect(event.target.getBoundingClientRect());
+        let targetFrame = WI.Rect.rectFromClientRect(event.target.getBoundingClientRect());
         if (!targetFrame.size.width && !targetFrame.size.height)
             return;
 
@@ -352,11 +352,11 @@
             let idElement = document.createElement("span");
             idElement.classList.add("object-id");
             idElement.textContent = "@" + node.id;
-            idElement.addEventListener("click", WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, node));
+            idElement.addEventListener("click", WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, node));
 
             let title = popoverContentElement.appendChild(document.createElement("div"));
             title.classList.add("title");
-            let localizedString = WebInspector.UIString("Shortest property path to %s").format("@@@");
+            let localizedString = WI.UIString("Shortest property path to %s").format("@@@");
             let [before, after] = localizedString.split(/\s*@@@\s*/);
             title.append(before + " ", idElement, " " + after);
         }
@@ -369,13 +369,13 @@
 
             path = path.slice().reverse();
             let windowIndex = path.findIndex((x) => {
-                return x instanceof WebInspector.HeapSnapshotNodeProxy && x.className === "Window";
+                return x instanceof WI.HeapSnapshotNodeProxy && x.className === "Window";
             });
 
             let edge = null;
             for (let i = windowIndex === -1 ? 0 : windowIndex; i < path.length; ++i) {
                 let component = path[i];
-                if (component instanceof WebInspector.HeapSnapshotEdgeProxy) {
+                if (component instanceof WI.HeapSnapshotEdgeProxy) {
                     edge = component;
                     continue;
                 }
@@ -410,7 +410,7 @@
             containerElement.classList.add("node");
 
             let iconElement = containerElement.appendChild(document.createElement("img"));
-            iconElement.classList.add("icon", WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(node.className, node.internal));
+            iconElement.classList.add("icon", WI.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(node.className, node.internal));
 
             let classNameElement = containerElement.appendChild(document.createElement("span"));
             classNameElement.textContent = sanitizeClassName(node.className) + " ";
@@ -418,7 +418,7 @@
             let idElement = containerElement.appendChild(document.createElement("span"));
             idElement.classList.add("object-id");
             idElement.textContent = "@" + node.id;
-            idElement.addEventListener("click", WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, node));
+            idElement.addEventListener("click", WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null, node));
 
             // Extra.
             if (node.className === "Function") {
@@ -428,7 +428,7 @@
                 HeapAgent.getPreview(node.id, function(error, string, functionDetails, objectPreviewPayload) {
                     if (functionDetails) {
                         let location = functionDetails.location;
-                        let sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId, WebInspector.assumingMainTarget());
+                        let sourceCode = WI.debuggerManager.scriptForIdentifier(location.scriptId, WI.assumingMainTarget());
                         if (sourceCode) {
                             let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber);
 
@@ -438,7 +438,7 @@
                                 ignoreNetworkTab: true,
                                 ignoreSearchTab: true,
                             };
-                            let goToArrowButtonLink = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, options);
+                            let goToArrowButtonLink = WI.createSourceCodeLocationLink(sourceCodeLocation, options);
                             containerElement.replaceChild(goToArrowButtonLink, goToArrowPlaceHolderElement);
                         }
                     }
@@ -448,20 +448,20 @@
 
         function sanitizeClassName(className) {
             if (className.endsWith("LexicalEnvironment"))
-                return WebInspector.UIString("Scope");
+                return WI.UIString("Scope");
             return className;
         }
 
         function stringifyEdge(edge) {
             switch (edge.type) {
-            case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:
-            case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:
+            case WI.HeapSnapshotEdgeProxy.EdgeType.Property:
+            case WI.HeapSnapshotEdgeProxy.EdgeType.Variable:
                 if (/^(?![0-9])\w+$/.test(edge.data))
                     return edge.data;
                 return "[" + doubleQuotedString(edge.data) + "]";
-            case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:
+            case WI.HeapSnapshotEdgeProxy.EdgeType.Index:
                 return "[" + edge.data + "]";
-            case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:
+            case WI.HeapSnapshotEdgeProxy.EdgeType.Internal:
             default:
                 return null;
             }
@@ -476,13 +476,13 @@
                 appendPath(path);
             } else if (this._node.gcRoot) {
                 let textElement = popoverContentElement.appendChild(document.createElement("div"));
-                textElement.textContent = WebInspector.UIString("This object is a root");
+                textElement.textContent = WI.UIString("This object is a root");
             } else {
                 let emptyElement = popoverContentElement.appendChild(document.createElement("div"));
-                emptyElement.textContent = WebInspector.UIString("This object is referenced by internal objects");
+                emptyElement.textContent = WI.UIString("This object is referenced by internal objects");
             }
 
-            this._tree.popover.presentNewContentWithFrame(popoverContentElement, targetFrame.pad(2), [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+            this._tree.popover.presentNewContentWithFrame(popoverContentElement, targetFrame.pad(2), [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]);
         });
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceFetchMoreDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceFetchMoreDataGridNode.js
index 2f7cf46..81cf95f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceFetchMoreDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceFetchMoreDataGridNode.js
@@ -23,7 +23,7 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode = class HeapSnapshotInstanceFetchMoreDataGridNode extends WebInspector.DataGridNode
+WI.HeapSnapshotInstanceFetchMoreDataGridNode = class HeapSnapshotInstanceFetchMoreDataGridNode extends WI.DataGridNode
 {
     constructor(tree, batchCount, remainingCount, fetchCallback)
     {
@@ -51,13 +51,13 @@
         if (this._batchCount) {
             let buttonElement = fragment.appendChild(document.createElement("span"));
             buttonElement.classList.add("more");
-            buttonElement.textContent = WebInspector.UIString("Show %d More").format(this._batchCount);
+            buttonElement.textContent = WI.UIString("Show %d More").format(this._batchCount);
             buttonElement.addEventListener("click", (event) => { this._fetchCallback(this._batchCount); });
         }
 
         let buttonElement = fragment.appendChild(document.createElement("span"));
         buttonElement.classList.add("more");
-        buttonElement.textContent = WebInspector.UIString("Show Remaining (%d)").format(this._remainingCount);
+        buttonElement.textContent = WI.UIString("Show Remaining (%d)").format(this._remainingCount);
         buttonElement.addEventListener("click", (event) => { this._fetchCallback(this._remainingCount); });
 
         return fragment;
diff --git a/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js b/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js
index 8806ad2..fc108f3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HierarchicalPathComponent = class HierarchicalPathComponent extends WebInspector.Object
+WI.HierarchicalPathComponent = class HierarchicalPathComponent extends WI.Object
 {
     constructor(displayName, styleClassNames, representedObject, textOnly, showSelectorArrows)
     {
@@ -133,10 +133,10 @@
     get minimumWidth()
     {
         if (this._collapsed)
-            return WebInspector.HierarchicalPathComponent.MinimumWidthCollapsed;
+            return WI.HierarchicalPathComponent.MinimumWidthCollapsed;
         if (this._selectorArrows)
-            return WebInspector.HierarchicalPathComponent.MinimumWidth + WebInspector.HierarchicalPathComponent.SelectorArrowsWidth;
-        return WebInspector.HierarchicalPathComponent.MinimumWidth;
+            return WI.HierarchicalPathComponent.MinimumWidth + WI.HierarchicalPathComponent.SelectorArrowsWidth;
+        return WI.HierarchicalPathComponent.MinimumWidth;
     }
 
     get forcedWidth()
@@ -150,9 +150,9 @@
     set forcedWidth(width)
     {
         if (typeof width === "number") {
-            let minimumWidthForOneCharacterTruncatedTitle = WebInspector.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle;
+            let minimumWidthForOneCharacterTruncatedTitle = WI.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle;
             if (this.selectorArrows)
-                minimumWidthForOneCharacterTruncatedTitle += WebInspector.HierarchicalPathComponent.SelectorArrowsWidth;
+                minimumWidthForOneCharacterTruncatedTitle += WI.HierarchicalPathComponent.SelectorArrowsWidth;
 
             // If the width is less than the minimum width required to show a single character and ellipsis, then
             // just collapse down to the bare minimum to show only the icon.
@@ -296,21 +296,21 @@
 
     _selectElementMouseUp(event)
     {
-        this.dispatchEventToListeners(WebInspector.HierarchicalPathComponent.Event.Clicked, {pathComponent: this.selectedPathComponent});
+        this.dispatchEventToListeners(WI.HierarchicalPathComponent.Event.Clicked, {pathComponent: this.selectedPathComponent});
     }
 
     _selectElementSelectionChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, {pathComponent: this.selectedPathComponent});
+        this.dispatchEventToListeners(WI.HierarchicalPathComponent.Event.SiblingWasSelected, {pathComponent: this.selectedPathComponent});
     }
 };
 
-WebInspector.HierarchicalPathComponent.MinimumWidth = 32;
-WebInspector.HierarchicalPathComponent.MinimumWidthCollapsed = 24;
-WebInspector.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle = 54;
-WebInspector.HierarchicalPathComponent.SelectorArrowsWidth = 12;
+WI.HierarchicalPathComponent.MinimumWidth = 32;
+WI.HierarchicalPathComponent.MinimumWidthCollapsed = 24;
+WI.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle = 54;
+WI.HierarchicalPathComponent.SelectorArrowsWidth = 12;
 
-WebInspector.HierarchicalPathComponent.Event = {
+WI.HierarchicalPathComponent.Event = {
     SiblingWasSelected: "hierarchical-path-component-sibling-was-selected",
     Clicked: "hierarchical-path-component-clicked"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js
index fa95fbf..f0f13635 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HierarchicalPathNavigationItem = class HierarchicalPathNavigationItem extends WebInspector.NavigationItem
+WI.HierarchicalPathNavigationItem = class HierarchicalPathNavigationItem extends WI.NavigationItem
 {
     constructor(identifier, components)
     {
@@ -61,13 +61,13 @@
             return;
 
         for (var i = 0; this._components && i < this._components.length; ++i)
-            this._components[i].removeEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._siblingPathComponentWasSelected, this);
+            this._components[i].removeEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._siblingPathComponentWasSelected, this);
 
         // Make a shallow copy of the newComponents array using slice.
         this._components = newComponents.slice(0);
 
         for (var i = 0; i < this._components.length; ++i)
-            this._components[i].addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._siblingPathComponentWasSelected, this);
+            this._components[i].addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._siblingPathComponentWasSelected, this);
 
         this.element.removeChildren();
         delete this._collapsedComponent;
@@ -87,15 +87,15 @@
 
     get alwaysShowLastPathComponentSeparator()
     {
-        return this.element.classList.contains(WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);
+        return this.element.classList.contains(WI.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);
     }
 
     set alwaysShowLastPathComponentSeparator(flag)
     {
         if (flag)
-            this.element.classList.add(WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);
+            this.element.classList.add(WI.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);
         else
-            this.element.classList.remove(WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);
+            this.element.classList.remove(WI.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);
     }
 
     updateLayout(expandOnly)
@@ -129,7 +129,7 @@
                 continue;
 
             // Skip flexible space items since they can take up no space at the minimum width.
-            if (navigationBar.navigationItems[i] instanceof WebInspector.FlexibleSpaceNavigationItem)
+            if (navigationBar.navigationItems[i] instanceof WI.FlexibleSpaceNavigationItem)
                 continue;
 
             totalOtherItemsWidth += navigationBar.navigationItems[i].element.realOffsetWidth;
@@ -186,7 +186,7 @@
         var i = middle;
 
         // Create a component that will represent the hidden components with a ellipse as the display name.
-        this._collapsedComponent = new WebInspector.HierarchicalPathComponent(ellipsis, []);
+        this._collapsedComponent = new WI.HierarchicalPathComponent(ellipsis, []);
         this._collapsedComponent.collapsed = true;
 
         // Insert it in the middle, it doesn't matter exactly where since the elements around it will be hidden soon.
@@ -244,12 +244,12 @@
 
     _siblingPathComponentWasSelected(event)
     {
-        this.dispatchEventToListeners(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected, event.data);
+        this.dispatchEventToListeners(WI.HierarchicalPathNavigationItem.Event.PathComponentWasSelected, event.data);
     }
 };
 
-WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName = "always-show-last-path-component-separator";
+WI.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName = "always-show-last-path-component-separator";
 
-WebInspector.HierarchicalPathNavigationItem.Event = {
+WI.HierarchicalPathNavigationItem.Event = {
     PathComponentWasSelected: "hierarchical-path-navigation-item-path-component-was-selected"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/HoverMenu.js b/Source/WebInspectorUI/UserInterface/Views/HoverMenu.js
index 09a6c9b..c2b5ab9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/HoverMenu.js
+++ b/Source/WebInspectorUI/UserInterface/Views/HoverMenu.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.HoverMenu = class HoverMenu extends WebInspector.Object
+WI.HoverMenu = class HoverMenu extends WI.Object
 {
     constructor(delegate)
     {
@@ -54,7 +54,7 @@
 
         document.body.appendChild(this._element);
         this._drawOutline(rects);
-        this._element.classList.add(WebInspector.HoverMenu.VisibleClassName);
+        this._element.classList.add(WI.HoverMenu.VisibleClassName);
 
         window.addEventListener("scroll", this, true);
     }
@@ -67,7 +67,7 @@
         if (discrete)
             this._element.remove();
 
-        this._element.classList.remove(WebInspector.HoverMenu.VisibleClassName);
+        this._element.classList.remove(WI.HoverMenu.VisibleClassName);
 
         window.removeEventListener("scroll", this, true);
     }
@@ -85,7 +85,7 @@
             this._handleClickEvent(event);
             break;
         case "transitionend":
-            if (!this._element.classList.contains(WebInspector.HoverMenu.VisibleClassName))
+            if (!this._element.classList.contains(WI.HoverMenu.VisibleClassName))
                 this._element.remove();
             break;
         }
@@ -116,7 +116,7 @@
         else
             this._drawOverlappingLines(rects);
 
-        var bounds = WebInspector.Rect.unionOfRects(rects).pad(3); // padding + 1/2 stroke-width
+        var bounds = WI.Rect.unionOfRects(rects).pad(3); // padding + 1/2 stroke-width
 
         var style = this._element.style;
         style.left = bounds.minX() + "px";
@@ -210,7 +210,7 @@
         var lastLineMaxX = rects.lastValue.maxX() + PADDING;
 
         if (firstLineMinX === minX && lastLineMaxX === maxX)
-            return this._addRect(new WebInspector.Rect(minX, minY, maxX - minX, maxY - minY));
+            return this._addRect(new WI.Rect(minX, minY, maxX - minX, maxY - minY));
 
         var lastLineMinY = rects.lastValue.minY() + PADDING;
         if (rects[0].minX() === minX + PADDING) {
@@ -272,4 +272,4 @@
     }
 };
 
-WebInspector.HoverMenu.VisibleClassName = "visible";
+WI.HoverMenu.VisibleClassName = "visible";
diff --git a/Source/WebInspectorUI/UserInterface/Views/IdleTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/IdleTreeElement.js
index 828badf..7927701 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IdleTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IdleTreeElement.js
@@ -23,10 +23,10 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IdleTreeElement = class IdleTreeElement extends WebInspector.GeneralTreeElement
+WI.IdleTreeElement = class IdleTreeElement extends WI.GeneralTreeElement
 {
     constructor()
     {
-        super("idle", WebInspector.UIString("Idle"));
+        super("idle", WI.UIString("Idle"));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js b/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js
index 9e0a6c4..9ec59f0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ImageResourceContentView = class ImageResourceContentView extends WebInspector.ResourceContentView
+WI.ImageResourceContentView = class ImageResourceContentView extends WI.ResourceContentView
 {
     constructor(resource)
     {
@@ -31,11 +31,11 @@
 
         this._imageElement = null;
 
-        const toolTip = WebInspector.UIString("Show Grid");
-        const activatedToolTip = WebInspector.UIString("Hide Grid");
-        this._showGridButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-grid", toolTip, activatedToolTip, "Images/NavigationItemCheckers.svg", 13, 13);
-        this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._showGridButtonClicked, this);
-        this._showGridButtonNavigationItem.activated = !!WebInspector.settings.showImageGrid.value;
+        const toolTip = WI.UIString("Show Grid");
+        const activatedToolTip = WI.UIString("Hide Grid");
+        this._showGridButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-grid", toolTip, activatedToolTip, "Images/NavigationItemCheckers.svg", 13, 13);
+        this._showGridButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._showGridButtonClicked, this);
+        this._showGridButtonNavigationItem.activated = !!WI.settings.showImageGrid.value;
     }
 
     // Public
@@ -72,12 +72,12 @@
 
         this._updateImageGrid();
 
-        WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed, this._updateImageGrid, this);
+        WI.settings.showImageGrid.addEventListener(WI.Setting.Event.Changed, this._updateImageGrid, this);
     }
 
     hidden()
     {
-        WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed, this._updateImageGrid, this);
+        WI.settings.showImageGrid.removeEventListener(WI.Setting.Event.Changed, this._updateImageGrid, this);
 
         super.hidden();
     }
@@ -89,14 +89,14 @@
         if (!this._imageElement)
             return;
 
-        let activated = WebInspector.settings.showImageGrid.value;
+        let activated = WI.settings.showImageGrid.value;
         this._showGridButtonNavigationItem.activated = activated;
         this._imageElement.classList.toggle("show-grid", activated);
     }
 
     _showGridButtonClicked(event)
     {
-        WebInspector.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated;
+        WI.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated;
 
         this._updateImageGrid();
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndeterminateProgressSpinner.js b/Source/WebInspectorUI/UserInterface/Views/IndeterminateProgressSpinner.js
index 22e156a..6c70426 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndeterminateProgressSpinner.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndeterminateProgressSpinner.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndeterminateProgressSpinner = class IndeterminateProgressSpinner extends WebInspector.Object
+WI.IndeterminateProgressSpinner = class IndeterminateProgressSpinner extends WI.Object
 {
     constructor()
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseContentView.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseContentView.js
index d6e9f39..495d313 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseContentView = class IndexedDatabaseContentView extends WebInspector.ContentView
+WI.IndexedDatabaseContentView = class IndexedDatabaseContentView extends WI.ContentView
 {
     constructor(database)
     {
@@ -31,11 +31,11 @@
 
         this._element.classList.add("indexed-database");
 
-        this._databaseHostRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Host"));
-        this._databaseSecurityOriginRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Security Origin"));
-        this._databaseVersionRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Version"));
-        this._databaseGroup = new WebInspector.DetailsSectionGroup([this._databaseHostRow, this._databaseSecurityOriginRow, this._databaseVersionRow]);
-        this._databaseSection = new WebInspector.DetailsSection("indexed-database-details", WebInspector.UIString("Database"), [this._databaseGroup]);
+        this._databaseHostRow = new WI.DetailsSectionSimpleRow(WI.UIString("Host"));
+        this._databaseSecurityOriginRow = new WI.DetailsSectionSimpleRow(WI.UIString("Security Origin"));
+        this._databaseVersionRow = new WI.DetailsSectionSimpleRow(WI.UIString("Version"));
+        this._databaseGroup = new WI.DetailsSectionGroup([this._databaseHostRow, this._databaseSecurityOriginRow, this._databaseVersionRow]);
+        this._databaseSection = new WI.DetailsSection("indexed-database-details", WI.UIString("Database"), [this._databaseGroup]);
 
         this.element.append(this._databaseSection.element);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseDetailsSidebarPanel.js
index 9d3c4eb..9aa07ef 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseDetailsSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseDetailsSidebarPanel = class IndexedDatabaseDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.IndexedDatabaseDetailsSidebarPanel = class IndexedDatabaseDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("indexed-database-details", WebInspector.UIString("Storage"));
+        super("indexed-database-details", WI.UIString("Storage"));
 
         this.element.classList.add("indexed-database");
 
@@ -49,11 +49,11 @@
         this._index = null;
 
         for (let object of objects) {
-            if (object instanceof WebInspector.IndexedDatabaseObjectStore) {
+            if (object instanceof WI.IndexedDatabaseObjectStore) {
                 console.assert(!this._database, "Shouldn't have multiple IndexedDatabase objects in the list.");
                 this._objectStore = object;
                 this._database = this._objectStore.parentDatabase;
-            } else if (object instanceof WebInspector.IndexedDatabaseObjectStoreIndex) {
+            } else if (object instanceof WI.IndexedDatabaseObjectStoreIndex) {
                 console.assert(!this._database, "Shouldn't have multiple IndexedDatabase objects in the list.");
                 this._index = object;
                 this._objectStore = this._index.parentObjectStore;
@@ -74,24 +74,24 @@
     {
         super.initialLayout();
 
-        this._databaseNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));
-        this._databaseVersionRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Version"));
-        this._databaseSecurityOriginRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Security Origin"));
-        let databaseGroup = new WebInspector.DetailsSectionGroup([this._databaseNameRow, this._databaseVersionRow, this._databaseSecurityOriginRow]);
-        this._databaseSection = new WebInspector.DetailsSection("indexed-database-database", WebInspector.UIString("Database"), [databaseGroup]);
+        this._databaseNameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Name"));
+        this._databaseVersionRow = new WI.DetailsSectionSimpleRow(WI.UIString("Version"));
+        this._databaseSecurityOriginRow = new WI.DetailsSectionSimpleRow(WI.UIString("Security Origin"));
+        let databaseGroup = new WI.DetailsSectionGroup([this._databaseNameRow, this._databaseVersionRow, this._databaseSecurityOriginRow]);
+        this._databaseSection = new WI.DetailsSection("indexed-database-database", WI.UIString("Database"), [databaseGroup]);
 
-        this._objectStoreNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));
-        this._objectStoreKeyPathRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Key Path"));
-        this._objectStoreAutoIncrementRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Auto Increment"));
-        let objectStoreGroup = new WebInspector.DetailsSectionGroup([this._objectStoreNameRow, this._objectStoreKeyPathRow, this._objectStoreAutoIncrementRow]);
-        this._objectStoreSection = new WebInspector.DetailsSection("indexed-database-object-store", WebInspector.UIString("Object Store"), [objectStoreGroup]);
+        this._objectStoreNameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Name"));
+        this._objectStoreKeyPathRow = new WI.DetailsSectionSimpleRow(WI.UIString("Key Path"));
+        this._objectStoreAutoIncrementRow = new WI.DetailsSectionSimpleRow(WI.UIString("Auto Increment"));
+        let objectStoreGroup = new WI.DetailsSectionGroup([this._objectStoreNameRow, this._objectStoreKeyPathRow, this._objectStoreAutoIncrementRow]);
+        this._objectStoreSection = new WI.DetailsSection("indexed-database-object-store", WI.UIString("Object Store"), [objectStoreGroup]);
 
-        this._indexNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));
-        this._indexKeyPathRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Key Path"));
-        this._indexUniqueRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Unique"));
-        this._indexMultiEntryRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Multi-Entry"));
-        let indexGroup = new WebInspector.DetailsSectionGroup([this._indexNameRow, this._indexKeyPathRow, this._indexUniqueRow, this._indexMultiEntryRow]);
-        this._indexSection = new WebInspector.DetailsSection("indexed-database-index", WebInspector.UIString("Index"), [indexGroup]);
+        this._indexNameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Name"));
+        this._indexKeyPathRow = new WI.DetailsSectionSimpleRow(WI.UIString("Key Path"));
+        this._indexUniqueRow = new WI.DetailsSectionSimpleRow(WI.UIString("Unique"));
+        this._indexMultiEntryRow = new WI.DetailsSectionSimpleRow(WI.UIString("Multi-Entry"));
+        let indexGroup = new WI.DetailsSectionGroup([this._indexNameRow, this._indexKeyPathRow, this._indexUniqueRow, this._indexMultiEntryRow]);
+        this._indexSection = new WI.DetailsSection("indexed-database-index", WI.UIString("Index"), [indexGroup]);
 
         this.contentView.element.appendChild(this._databaseSection.element);
         this.contentView.element.appendChild(this._objectStoreSection.element);
@@ -117,7 +117,7 @@
             this._objectStoreSection.element.hidden = false;
             this._objectStoreNameRow.value = this._objectStore.name;
             this._objectStoreKeyPathRow.value = this._keyPathString(this._objectStore.keyPath);
-            this._objectStoreAutoIncrementRow.value = this._objectStore.autoIncrement ? WebInspector.UIString("Yes") : WebInspector.UIString("No");
+            this._objectStoreAutoIncrementRow.value = this._objectStore.autoIncrement ? WI.UIString("Yes") : WI.UIString("No");
         }
 
         if (!this._index)
@@ -126,12 +126,12 @@
             this._indexSection.element.hidden = false;
             this._indexNameRow.value = this._index.name;
             this._indexKeyPathRow.value = this._keyPathString(this._index.keyPath);
-            this._indexUniqueRow.value = this._index.unique ? WebInspector.UIString("Yes") : WebInspector.UIString("No");
+            this._indexUniqueRow.value = this._index.unique ? WI.UIString("Yes") : WI.UIString("No");
 
             if (this._index.keyPath.type !== IndexedDBAgent.KeyPathType.Array)
                 this._indexMultiEntryRow.value = null;
             else
-                this._indexMultiEntryRow.value = this._index.multiEntry ? WebInspector.UIString("Yes") : WebInspector.UIString("No");
+                this._indexMultiEntryRow.value = this._index.multiEntry ? WI.UIString("Yes") : WI.UIString("No");
         }
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseEntryDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseEntryDataGridNode.js
index 53f9384..3098077 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseEntryDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseEntryDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseEntryDataGridNode = class IndexedDatabaseEntryDataGridNode extends WebInspector.DataGridNode
+WI.IndexedDatabaseEntryDataGridNode = class IndexedDatabaseEntryDataGridNode extends WI.DataGridNode
 {
     constructor(entry)
     {
@@ -42,8 +42,8 @@
     createCellContent(columnIdentifier, cell)
     {
         var value = this._entry[columnIdentifier];
-        if (value instanceof WebInspector.RemoteObject)
-            return WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(value, null, true);
+        if (value instanceof WI.RemoteObject)
+            return WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(value, null, true);
 
         return super.createCellContent(columnIdentifier, cell);
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseHostTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseHostTreeElement.js
index d4fb60c..ccee2d5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseHostTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseHostTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseHostTreeElement = class IndexedDatabaseHostTreeElement extends WebInspector.StorageTreeElement
+WI.IndexedDatabaseHostTreeElement = class IndexedDatabaseHostTreeElement extends WI.StorageTreeElement
 {
     constructor(host)
     {
-        super(WebInspector.FolderTreeElement.FolderIconStyleClassName, WebInspector.displayNameForHost(host), null);
+        super(WI.FolderTreeElement.FolderIconStyleClassName, WI.displayNameForHost(host), null);
 
         this._host = host;
 
@@ -39,11 +39,11 @@
 
     get name()
     {
-        return WebInspector.displayNameForHost(this._host);
+        return WI.displayNameForHost(this._host);
     }
 
     get categoryName()
     {
-        return WebInspector.UIString("Indexed Databases");
+        return WI.UIString("Indexed Databases");
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js
index 8cc45f6..9a6eea0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStoreContentView = class IndexedDatabaseObjectStoreContentView extends WebInspector.ContentView
+WI.IndexedDatabaseObjectStoreContentView = class IndexedDatabaseObjectStoreContentView extends WI.ContentView
 {
     constructor(objectStoreOrIndex)
     {
@@ -31,10 +31,10 @@
 
         this.element.classList.add("indexed-database-object-store");
 
-        if (objectStoreOrIndex instanceof WebInspector.IndexedDatabaseObjectStore) {
+        if (objectStoreOrIndex instanceof WI.IndexedDatabaseObjectStore) {
             this._objectStore = objectStoreOrIndex;
             this._objectStoreIndex = null;
-        } else if (objectStoreOrIndex instanceof WebInspector.IndexedDatabaseObjectStoreIndex) {
+        } else if (objectStoreOrIndex instanceof WI.IndexedDatabaseObjectStoreIndex) {
             this._objectStore = objectStoreOrIndex.parentObjectStore;
             this._objectStoreIndex = objectStoreOrIndex;
         }
@@ -44,7 +44,7 @@
             if (!keyPath)
                 return "";
             if (keyPath instanceof Array)
-                return keyPath.join(WebInspector.UIString(", "));
+                return keyPath.join(WI.UIString(", "));
             console.assert(keyPath instanceof String || typeof keyPath === "string");
             return keyPath;
         }
@@ -52,22 +52,22 @@
         var displayPrimaryKeyPath = displayKeyPath(this._objectStore.keyPath);
 
         var columnInfo = {
-            primaryKey: {title: displayPrimaryKeyPath ? WebInspector.UIString("Primary Key \u2014 %s").format(displayPrimaryKeyPath) : WebInspector.UIString("Primary Key")},
+            primaryKey: {title: displayPrimaryKeyPath ? WI.UIString("Primary Key \u2014 %s").format(displayPrimaryKeyPath) : WI.UIString("Primary Key")},
             key: {},
-            value: {title: WebInspector.UIString("Value")}
+            value: {title: WI.UIString("Value")}
         };
 
         if (this._objectStoreIndex) {
             // When there is an index, show the key path in the Key column.
             var displayIndexKeyPath = displayKeyPath(this._objectStoreIndex.keyPath);
-            columnInfo.key.title = WebInspector.UIString("Index Key \u2014 %s").format(displayIndexKeyPath);
+            columnInfo.key.title = WI.UIString("Index Key \u2014 %s").format(displayIndexKeyPath);
         } else {
             // Only need to show Key for indexes -- it is the same as Primary Key
             // when there is no index being used.
             delete columnInfo.key;
         }
 
-        this._dataGrid = new WebInspector.DataGrid(columnInfo);
+        this._dataGrid = new WI.DataGrid(columnInfo);
         this._dataGrid.variableHeightRows = true;
         this._dataGrid.scrollContainer.addEventListener("scroll", this._dataGridScrolled.bind(this));
         this.addSubview(this._dataGrid);
@@ -77,11 +77,11 @@
         this._fetchingMoreData = false;
         this._fetchMoreData();
 
-        this._refreshButtonNavigationItem = new WebInspector.ButtonNavigationItem("indexed-database-object-store-refresh", WebInspector.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
-        this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
+        this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("indexed-database-object-store-refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
+        this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
 
-        this._clearButtonNavigationItem = new WebInspector.ButtonNavigationItem("indexed-database-object-store-clear", WebInspector.UIString("Clear object store"), "Images/NavigationItemTrash.svg", 15, 15);
-        this._clearButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearButtonClicked, this);
+        this._clearButtonNavigationItem = new WI.ButtonNavigationItem("indexed-database-object-store-clear", WI.UIString("Clear object store"), "Images/NavigationItemTrash.svg", 15, 15);
+        this._clearButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._clearButtonClicked, this);
     }
 
     // Public
@@ -100,7 +100,7 @@
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.IndexedDatabaseObjectStore;
+        cookie.type = WI.ContentViewCookieType.IndexedDatabaseObjectStore;
         cookie.securityOrigin = this._objectStore.parentDatabase.securityOrigin;
         cookie.databaseName = this._objectStore.parentDatabase.name;
         cookie.objectStoreName = this._objectStore.name;
@@ -145,7 +145,7 @@
             this._moreEntriesAvailable = moreAvailable;
 
             for (var entry of entries) {
-                var dataGridNode = new WebInspector.IndexedDatabaseEntryDataGridNode(entry);
+                var dataGridNode = new WI.IndexedDatabaseEntryDataGridNode(entry);
                 this._dataGrid.appendChild(dataGridNode);
             }
 
@@ -157,7 +157,7 @@
 
         this._fetchingMoreData = true;
 
-        WebInspector.storageManager.requestIndexedDatabaseData(this._objectStore, this._objectStoreIndex, this._entries.length, 25, processEntries.bind(this));
+        WI.storageManager.requestIndexedDatabaseData(this._objectStore, this._objectStoreIndex, this._entries.length, 25, processEntries.bind(this));
     }
 
     _refreshButtonClicked()
@@ -168,7 +168,7 @@
 
     _clearButtonClicked()
     {
-        WebInspector.storageManager.clearObjectStore(this._objectStore);
+        WI.storageManager.clearObjectStore(this._objectStore);
         this._reset();
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreIndexTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreIndexTreeElement.js
index 4651394..68e5186 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreIndexTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreIndexTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStoreIndexTreeElement = class IndexedDatabaseObjectStoreIndexTreeElement extends WebInspector.GeneralTreeElement
+WI.IndexedDatabaseObjectStoreIndexTreeElement = class IndexedDatabaseObjectStoreIndexTreeElement extends WI.GeneralTreeElement
 {
     constructor(objectStoreIndex)
     {
-        console.assert(objectStoreIndex instanceof WebInspector.IndexedDatabaseObjectStoreIndex);
+        console.assert(objectStoreIndex instanceof WI.IndexedDatabaseObjectStoreIndex);
 
         const subtitle = null;
         super("database-table-icon", objectStoreIndex.name, subtitle, objectStoreIndex);
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreTreeElement.js
index e76b1be..f89728b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStoreTreeElement = class IndexedDatabaseObjectStoreTreeElement extends WebInspector.GeneralTreeElement
+WI.IndexedDatabaseObjectStoreTreeElement = class IndexedDatabaseObjectStoreTreeElement extends WI.GeneralTreeElement
 {
     constructor(objectStore)
     {
-        console.assert(objectStore instanceof WebInspector.IndexedDatabaseObjectStore);
+        console.assert(objectStore instanceof WI.IndexedDatabaseObjectStore);
 
         const subtitle = null;
         super("database-table-icon", objectStore.name, subtitle, objectStore, {hasChildren: !!objectStore.indexes.length});
@@ -59,6 +59,6 @@
         this.removeChildren();
 
         for (var objectStoreIndex of this._objectStore.indexes)
-            this.appendChild(new WebInspector.IndexedDatabaseObjectStoreIndexTreeElement(objectStoreIndex));
+            this.appendChild(new WI.IndexedDatabaseObjectStoreIndexTreeElement(objectStoreIndex));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseTreeElement.js
index fff29be..1585ea2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseTreeElement = class IndexedDatabaseTreeElement extends WebInspector.GeneralTreeElement
+WI.IndexedDatabaseTreeElement = class IndexedDatabaseTreeElement extends WI.GeneralTreeElement
 {
     constructor(indexedDatabase)
     {
-        console.assert(indexedDatabase instanceof WebInspector.IndexedDatabase);
+        console.assert(indexedDatabase instanceof WI.IndexedDatabase);
 
         const subtitle = null;
         super("database-icon", indexedDatabase.name, subtitle, indexedDatabase, {hasChildren: !!indexedDatabase.objectStores.length});
@@ -59,6 +59,6 @@
         this.removeChildren();
 
         for (var objectStore of this._indexedDatabase.objectStores)
-            this.appendChild(new WebInspector.IndexedDatabaseObjectStoreTreeElement(objectStore));
+            this.appendChild(new WI.IndexedDatabaseObjectStoreTreeElement(objectStore));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js b/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js
index 85a09d5..bbb31d8 100644
--- a/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js
+++ b/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.InlineSwatch = class InlineSwatch extends WebInspector.Object
+WI.InlineSwatch = class InlineSwatch extends WI.Object
 {
     constructor(type, value, readOnly)
     {
@@ -36,23 +36,23 @@
         this._swatchElement.classList.add("inline-swatch", this._type.split("-").lastValue);
 
         switch (this._type) {
-        case WebInspector.InlineSwatch.Type.Color:
-            this._swatchElement.title = WebInspector.UIString("Click to select a color. Shift-click to switch color formats.");
+        case WI.InlineSwatch.Type.Color:
+            this._swatchElement.title = WI.UIString("Click to select a color. Shift-click to switch color formats.");
             break;
-        case WebInspector.InlineSwatch.Type.Gradient:
-            this._swatchElement.title = WebInspector.UIString("Edit custom gradient");
+        case WI.InlineSwatch.Type.Gradient:
+            this._swatchElement.title = WI.UIString("Edit custom gradient");
             break;
-        case WebInspector.InlineSwatch.Type.Bezier:
-            this._swatchElement.title = WebInspector.UIString("Edit “cubic-bezier“ function");
+        case WI.InlineSwatch.Type.Bezier:
+            this._swatchElement.title = WI.UIString("Edit “cubic-bezier“ function");
             break;
-        case WebInspector.InlineSwatch.Type.Spring:
-            this._swatchElement.title = WebInspector.UIString("Edit “spring“ function");
+        case WI.InlineSwatch.Type.Spring:
+            this._swatchElement.title = WI.UIString("Edit “spring“ function");
             break;
-        case WebInspector.InlineSwatch.Type.Variable:
-            this._swatchElement.title = WebInspector.UIString("View variable value");
+        case WI.InlineSwatch.Type.Variable:
+            this._swatchElement.title = WI.UIString("View variable value");
             break;
         default:
-            WebInspector.reportInternalError(`Unknown InlineSwatch type "${type}"`);
+            WI.reportInternalError(`Unknown InlineSwatch type "${type}"`);
             break;
         }
 
@@ -60,7 +60,7 @@
         if (!readOnly) {
             this._boundSwatchElementClicked = this._swatchElementClicked.bind(this);
             this._swatchElement.addEventListener("click", this._boundSwatchElementClicked);
-            if (this._type === WebInspector.InlineSwatch.Type.Color)
+            if (this._type === WI.InlineSwatch.Type.Color)
                 this._swatchElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
         }
 
@@ -103,7 +103,7 @@
         if (this._boundSwatchElementClicked)
             this._swatchElement.addEventListener("click", this._boundSwatchElementClicked);
 
-        this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Deactivated);
+        this.dispatchEventToListeners(WI.InlineSwatch.Event.Deactivated);
     }
 
     // Private
@@ -111,14 +111,14 @@
     _fallbackValue()
     {
         switch (this._type) {
-        case WebInspector.InlineSwatch.Type.Bezier:
-            return WebInspector.CubicBezier.fromString("linear");
-        case WebInspector.InlineSwatch.Type.Gradient:
-            return WebInspector.Gradient.fromString("linear-gradient(transparent, transparent)");
-        case WebInspector.InlineSwatch.Type.Spring:
-            return WebInspector.Spring.fromString("1 100 10 0");
-        case WebInspector.InlineSwatch.Type.Color:
-            return WebInspector.Color.fromString("white");
+        case WI.InlineSwatch.Type.Bezier:
+            return WI.CubicBezier.fromString("linear");
+        case WI.InlineSwatch.Type.Gradient:
+            return WI.Gradient.fromString("linear-gradient(transparent, transparent)");
+        case WI.InlineSwatch.Type.Spring:
+            return WI.Spring.fromString("1 100 10 0");
+        case WI.InlineSwatch.Type.Color:
+            return WI.Color.fromString("white");
         default:
             return null;
         }
@@ -126,18 +126,18 @@
 
     _updateSwatch(dontFireEvents)
     {
-        if (this._type === WebInspector.InlineSwatch.Type.Color || this._type === WebInspector.InlineSwatch.Type.Gradient)
+        if (this._type === WI.InlineSwatch.Type.Color || this._type === WI.InlineSwatch.Type.Gradient)
             this._swatchInnerElement.style.background = this._value ? this._value.toString() : null;
 
         if (!dontFireEvents)
-            this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.ValueChanged, {value: this._value});
+            this.dispatchEventToListeners(WI.InlineSwatch.Event.ValueChanged, {value: this._value});
     }
 
     _swatchElementClicked(event)
     {
-        this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.BeforeClicked);
+        this.dispatchEventToListeners(WI.InlineSwatch.Event.BeforeClicked);
 
-        if (this._type === WebInspector.InlineSwatch.Type.Color && event.shiftKey && this._value) {
+        if (this._type === WI.InlineSwatch.Type.Color && event.shiftKey && this._value) {
             let nextFormat = this._value.nextFormat();
             console.assert(nextFormat);
             if (!nextFormat)
@@ -148,36 +148,36 @@
             return;
         }
 
-        let bounds = WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
-        let popover = new WebInspector.Popover(this);
+        let bounds = WI.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
+        let popover = new WI.Popover(this);
 
         popover.windowResizeHandler = () => {
-            let bounds = WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
-            popover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_X]);
+            let bounds = WI.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
+            popover.present(bounds.pad(2), [WI.RectEdge.MIN_X]);
         };
 
         this._valueEditor = null;
-        if (this._type === WebInspector.InlineSwatch.Type.Color) {
-            this._valueEditor = new WebInspector.ColorPicker;
-            this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.ColorChanged, this._valueEditorValueDidChange, this);
-            this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.FormatChanged, (event) => popover.update());
-        } else if (this._type === WebInspector.InlineSwatch.Type.Gradient) {
-            this._valueEditor = new WebInspector.GradientEditor;
-            this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged, this._valueEditorValueDidChange, this);
-            this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled, (event) => popover.update());
-        } else if (this._type === WebInspector.InlineSwatch.Type.Bezier) {
-            this._valueEditor = new WebInspector.BezierEditor;
-            this._valueEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged, this._valueEditorValueDidChange, this);
-        } else if (this._type === WebInspector.InlineSwatch.Type.Spring) {
-            this._valueEditor = new WebInspector.SpringEditor;
-            this._valueEditor.addEventListener(WebInspector.SpringEditor.Event.SpringChanged, this._valueEditorValueDidChange, this);
-        } else if (this._type === WebInspector.InlineSwatch.Type.Variable) {
+        if (this._type === WI.InlineSwatch.Type.Color) {
+            this._valueEditor = new WI.ColorPicker;
+            this._valueEditor.addEventListener(WI.ColorPicker.Event.ColorChanged, this._valueEditorValueDidChange, this);
+            this._valueEditor.addEventListener(WI.ColorPicker.Event.FormatChanged, (event) => popover.update());
+        } else if (this._type === WI.InlineSwatch.Type.Gradient) {
+            this._valueEditor = new WI.GradientEditor;
+            this._valueEditor.addEventListener(WI.GradientEditor.Event.GradientChanged, this._valueEditorValueDidChange, this);
+            this._valueEditor.addEventListener(WI.GradientEditor.Event.ColorPickerToggled, (event) => popover.update());
+        } else if (this._type === WI.InlineSwatch.Type.Bezier) {
+            this._valueEditor = new WI.BezierEditor;
+            this._valueEditor.addEventListener(WI.BezierEditor.Event.BezierChanged, this._valueEditorValueDidChange, this);
+        } else if (this._type === WI.InlineSwatch.Type.Spring) {
+            this._valueEditor = new WI.SpringEditor;
+            this._valueEditor.addEventListener(WI.SpringEditor.Event.SpringChanged, this._valueEditorValueDidChange, this);
+        } else if (this._type === WI.InlineSwatch.Type.Variable) {
             this._valueEditor = {};
 
             this._valueEditor.element = document.createElement("div");
             this._valueEditor.element.classList.add("inline-swatch-variable-popover");
 
-            this._valueEditor.codeMirror = WebInspector.CodeMirrorEditor.create(this._valueEditor.element, {
+            this._valueEditor.codeMirror = WI.CodeMirrorEditor.create(this._valueEditor.element, {
                 mode: "css",
                 readOnly: "nocursor",
             });
@@ -190,35 +190,35 @@
             return;
 
         popover.content = this._valueEditor.element;
-        popover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_X]);
+        popover.present(bounds.pad(2), [WI.RectEdge.MIN_X]);
 
         if (this._boundSwatchElementClicked)
             this._swatchElement.removeEventListener("click", this._boundSwatchElementClicked);
 
-        this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Activated);
+        this.dispatchEventToListeners(WI.InlineSwatch.Event.Activated);
 
         let value = this._value || this._fallbackValue();
-        if (this._type === WebInspector.InlineSwatch.Type.Color)
+        if (this._type === WI.InlineSwatch.Type.Color)
             this._valueEditor.color = value;
-        else if (this._type === WebInspector.InlineSwatch.Type.Gradient)
+        else if (this._type === WI.InlineSwatch.Type.Gradient)
             this._valueEditor.gradient = value;
-        else if (this._type === WebInspector.InlineSwatch.Type.Bezier)
+        else if (this._type === WI.InlineSwatch.Type.Bezier)
             this._valueEditor.bezier = value;
-        else if (this._type === WebInspector.InlineSwatch.Type.Spring)
+        else if (this._type === WI.InlineSwatch.Type.Spring)
             this._valueEditor.spring = value;
-        else if (this._type === WebInspector.InlineSwatch.Type.Variable)
+        else if (this._type === WI.InlineSwatch.Type.Variable)
             this._valueEditor.codeMirror.setValue(value);
     }
 
     _valueEditorValueDidChange(event)
     {
-        if (this._type === WebInspector.InlineSwatch.Type.Color)
+        if (this._type === WI.InlineSwatch.Type.Color)
             this._value = event.data.color;
-        else if (this._type === WebInspector.InlineSwatch.Type.Gradient)
+        else if (this._type === WI.InlineSwatch.Type.Gradient)
             this._value = event.data.gradient;
-        else if (this._type === WebInspector.InlineSwatch.Type.Bezier)
+        else if (this._type === WI.InlineSwatch.Type.Bezier)
             this._value = event.data.bezier;
-        else if (this._type === WebInspector.InlineSwatch.Type.Spring)
+        else if (this._type === WI.InlineSwatch.Type.Spring)
             this._value = event.data.spring;
 
         this._updateSwatch();
@@ -229,11 +229,11 @@
         if (!this._value)
             return;
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
-        if (this._value.isKeyword() && this._value.format !== WebInspector.Color.Format.Keyword) {
-            contextMenu.appendItem(WebInspector.UIString("Format: Keyword"), () => {
-                this._value.format = WebInspector.Color.Format.Keyword;
+        if (this._value.isKeyword() && this._value.format !== WI.Color.Format.Keyword) {
+            contextMenu.appendItem(WI.UIString("Format: Keyword"), () => {
+                this._value.format = WI.Color.Format.Keyword;
                 this._updateSwatch();
             });
         }
@@ -246,26 +246,26 @@
             });
         }
 
-        if (this._value.simple && this._value.format !== WebInspector.Color.Format.HSL) {
-            contextMenu.appendItem(WebInspector.UIString("Format: HSL"), () => {
-                this._value.format = WebInspector.Color.Format.HSL;
+        if (this._value.simple && this._value.format !== WI.Color.Format.HSL) {
+            contextMenu.appendItem(WI.UIString("Format: HSL"), () => {
+                this._value.format = WI.Color.Format.HSL;
                 this._updateSwatch();
             });
-        } else if (this._value.format !== WebInspector.Color.Format.HSLA) {
-            contextMenu.appendItem(WebInspector.UIString("Format: HSLA"), () => {
-                this._value.format = WebInspector.Color.Format.HSLA;
+        } else if (this._value.format !== WI.Color.Format.HSLA) {
+            contextMenu.appendItem(WI.UIString("Format: HSLA"), () => {
+                this._value.format = WI.Color.Format.HSLA;
                 this._updateSwatch();
             });
         }
 
-        if (this._value.simple && this._value.format !== WebInspector.Color.Format.RGB) {
-            contextMenu.appendItem(WebInspector.UIString("Format: RGB"), () => {
-                this._value.format = WebInspector.Color.Format.RGB;
+        if (this._value.simple && this._value.format !== WI.Color.Format.RGB) {
+            contextMenu.appendItem(WI.UIString("Format: RGB"), () => {
+                this._value.format = WI.Color.Format.RGB;
                 this._updateSwatch();
             });
-        } else if (this._value.format !== WebInspector.Color.Format.RGBA) {
-            contextMenu.appendItem(WebInspector.UIString("Format: RGBA"), () => {
-                this._value.format = WebInspector.Color.Format.RGBA;
+        } else if (this._value.format !== WI.Color.Format.RGBA) {
+            contextMenu.appendItem(WI.UIString("Format: RGBA"), () => {
+                this._value.format = WI.Color.Format.RGBA;
                 this._updateSwatch();
             });
         }
@@ -273,15 +273,15 @@
 
     _getNextValidHEXFormat()
     {
-        if (this._type !== WebInspector.InlineSwatch.Type.Color)
+        if (this._type !== WI.InlineSwatch.Type.Color)
             return false;
 
         function hexMatchesCurrentColor(hexInfo) {
-            let nextIsSimple = hexInfo.format === WebInspector.Color.Format.ShortHEX || hexInfo.format === WebInspector.Color.Format.HEX;
+            let nextIsSimple = hexInfo.format === WI.Color.Format.ShortHEX || hexInfo.format === WI.Color.Format.HEX;
             if (nextIsSimple && !this._value.simple)
                 return false;
 
-            let nextIsShort = hexInfo.format === WebInspector.Color.Format.ShortHEX || hexInfo.format === WebInspector.Color.Format.ShortHEXAlpha;
+            let nextIsShort = hexInfo.format === WI.Color.Format.ShortHEX || hexInfo.format === WI.Color.Format.ShortHEXAlpha;
             if (nextIsShort && !this._value.canBeSerializedAsShortHEX())
                 return false;
 
@@ -290,20 +290,20 @@
 
         const hexFormats = [
             {
-                format: WebInspector.Color.Format.ShortHEX,
-                title: WebInspector.UIString("Format: Short Hex")
+                format: WI.Color.Format.ShortHEX,
+                title: WI.UIString("Format: Short Hex")
             },
             {
-                format: WebInspector.Color.Format.ShortHEXAlpha,
-                title: WebInspector.UIString("Format: Short Hex with Alpha")
+                format: WI.Color.Format.ShortHEXAlpha,
+                title: WI.UIString("Format: Short Hex with Alpha")
             },
             {
-                format: WebInspector.Color.Format.HEX,
-                title: WebInspector.UIString("Format: Hex")
+                format: WI.Color.Format.HEX,
+                title: WI.UIString("Format: Hex")
             },
             {
-                format: WebInspector.Color.Format.HEXAlpha,
-                title: WebInspector.UIString("Format: Hex with Alpha")
+                format: WI.Color.Format.HEXAlpha,
+                title: WI.UIString("Format: Hex with Alpha")
             }
         ];
 
@@ -324,7 +324,7 @@
     }
 };
 
-WebInspector.InlineSwatch.Type = {
+WI.InlineSwatch.Type = {
     Color: "inline-swatch-type-color",
     Gradient: "inline-swatch-type-gradient",
     Bezier: "inline-swatch-type-bezier",
@@ -332,7 +332,7 @@
     Variable: "inline-swatch-type-variable",
 };
 
-WebInspector.InlineSwatch.Event = {
+WI.InlineSwatch.Event = {
     BeforeClicked: "inline-swatch-before-clicked",
     ValueChanged: "inline-swatch-value-changed",
     Activated: "inline-swatch-activated",
diff --git a/Source/WebInspectorUI/UserInterface/Views/InputPopover.js b/Source/WebInspectorUI/UserInterface/Views/InputPopover.js
index a63dddf..2f9d6d0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/InputPopover.js
+++ b/Source/WebInspectorUI/UserInterface/Views/InputPopover.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.InputPopover = class InputPopover extends WebInspector.Popover
+WI.InputPopover = class InputPopover extends WI.Popover
 {
     constructor(message, delegate)
     {
@@ -31,7 +31,7 @@
 
         this._message = message;
         this._value = null;
-        this._result = WebInspector.InputPopover.Result.None;
+        this._result = WI.InputPopover.Result.None;
 
         this._targetElement = null;
         this._preferredEdges = null;
@@ -64,7 +64,7 @@
             if (!isEnterKey(event))
                 return;
 
-            this._result = WebInspector.InputPopover.Result.Committed;
+            this._result = WI.InputPopover.Result.Committed;
             this._value = event.target.value;
 
             this.dismiss();
@@ -83,14 +83,14 @@
         if (!this._targetElement)
             return;
 
-        let targetFrame = WebInspector.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());
+        let targetFrame = WI.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());
         this.present(targetFrame, this._preferredEdges);
 
         this._inputElement.select();
     }
 };
 
-WebInspector.InputPopover.Result = {
+WI.InputPopover.Result = {
     None: Symbol("result-none"),
     Cancelled: Symbol("result-cancelled"),
     Committed: Symbol("result-committed"),
diff --git a/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js
index 4be581c..170b3b8 100644
--- a/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js
@@ -23,28 +23,28 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IssueTreeElement = class IssueTreeElement extends WebInspector.GeneralTreeElement
+WI.IssueTreeElement = class IssueTreeElement extends WI.GeneralTreeElement
 {
     constructor(issueMessage)
     {
         var levelStyleClassName;
         switch (issueMessage.level) {
         case "error":
-            levelStyleClassName = WebInspector.IssueTreeElement.ErrorStyleClassName;
+            levelStyleClassName = WI.IssueTreeElement.ErrorStyleClassName;
             break;
         case "warning":
-            levelStyleClassName = WebInspector.IssueTreeElement.WarningStyleClassName;
+            levelStyleClassName = WI.IssueTreeElement.WarningStyleClassName;
             break;
         }
 
         const title = null;
         const subtitle = null;
-        super([WebInspector.IssueTreeElement.StyleClassName, levelStyleClassName], title, subtitle, issueMessage);
+        super([WI.IssueTreeElement.StyleClassName, levelStyleClassName], title, subtitle, issueMessage);
 
         this._issueMessage = issueMessage;
         this._updateTitles();
 
-        this._issueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange, this._updateTitles, this);
+        this._issueMessage.addEventListener(WI.IssueMessage.Event.DisplayLocationDidChange, this._updateTitles, this);
     }
 
     // Public
@@ -62,14 +62,14 @@
         var displayColumnNumber = this._issueMessage.sourceCodeLocation.displayColumnNumber;
         var title;
         if (displayColumnNumber > 0)
-            title = WebInspector.UIString("Line %d:%d").format(displayLineNumber + 1, displayColumnNumber + 1); // The user visible line and column numbers are 1-based.
+            title = WI.UIString("Line %d:%d").format(displayLineNumber + 1, displayColumnNumber + 1); // The user visible line and column numbers are 1-based.
         else
-            title = WebInspector.UIString("Line %d").format(displayLineNumber + 1); // The user visible line number is 1-based.
+            title = WI.UIString("Line %d").format(displayLineNumber + 1); // The user visible line number is 1-based.
 
         this.mainTitle = title + " " + this._issueMessage.text;
     }
 };
 
-WebInspector.IssueTreeElement.StyleClassName = "issue";
-WebInspector.IssueTreeElement.ErrorStyleClassName = "error";
-WebInspector.IssueTreeElement.WarningStyleClassName = "warning";
+WI.IssueTreeElement.StyleClassName = "issue";
+WI.IssueTreeElement.ErrorStyleClassName = "error";
+WI.IssueTreeElement.WarningStyleClassName = "warning";
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayerTreeDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/LayerTreeDataGridNode.js
index dd7c898..81e1f21 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayerTreeDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayerTreeDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayerTreeDataGridNode = class LayerTreeDataGridNode extends WebInspector.DataGridNode
+WI.LayerTreeDataGridNode = class LayerTreeDataGridNode extends WI.DataGridNode
 {
     constructor(layer)
     {
@@ -60,10 +60,10 @@
     {
         this._layer = layer;
 
-        var domNode = WebInspector.domTreeManager.nodeForId(layer.nodeId);
+        var domNode = WI.domTreeManager.nodeForId(layer.nodeId);
 
         this.data = {
-            name: domNode ? domNode.displayName : WebInspector.UIString("Unknown node"),
+            name: domNode ? domNode.displayName : WI.UIString("Unknown node"),
             paintCount: layer.paintCount || emDash,
             memory: Number.bytesToString(layer.memory || 0)
         };
@@ -100,7 +100,7 @@
 
         fragment.appendChild(document.createElement("img")).className = "icon";
 
-        var goToButton = this._makeOutlet("goToButton", fragment.appendChild(WebInspector.createGoToArrowButton()));
+        var goToButton = this._makeOutlet("goToButton", fragment.appendChild(WI.createGoToArrowButton()));
         goToButton.addEventListener("click", this._goToArrowWasClicked.bind(this), false);
 
         var label = this._makeOutlet("label", fragment.appendChild(document.createElement("span")));
@@ -114,7 +114,7 @@
 
         var reflectionLabel = this._makeOutlet("reflectionLabel", document.createElement("span"));
         reflectionLabel.className = "reflection";
-        reflectionLabel.textContent = " \u2014 " + WebInspector.UIString("Reflection");
+        reflectionLabel.textContent = " \u2014 " + WI.UIString("Reflection");
 
         return fragment;
     }
@@ -135,7 +135,7 @@
 
         this._outlets.nameLabel.textContent = data;
 
-        if (WebInspector.domTreeManager.nodeForId(layer.nodeId))
+        if (WI.domTreeManager.nodeForId(layer.nodeId))
             label.parentNode.insertBefore(this._outlets.goToButton, label.parentNode.firstChild);
         else if (this._outlets.goToButton.parentNode)
             label.parentNode.removeChild(this._outlets.goToButton);
@@ -159,7 +159,7 @@
 
     _goToArrowWasClicked()
     {
-        var domNode = WebInspector.domTreeManager.nodeForId(this._layer.nodeId);
-        WebInspector.showMainFrameDOMTree(domNode);
+        var domNode = WI.domTreeManager.nodeForId(this._layer.nodeId);
+        WI.showMainFrameDOMTree(domNode);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
index 2bbfa86..ed3c47a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayerTreeDetailsSidebarPanel = class LayerTreeDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel
+WI.LayerTreeDetailsSidebarPanel = class LayerTreeDetailsSidebarPanel extends WI.DOMDetailsSidebarPanel
 {
     constructor()
     {
-        super("layer-tree", WebInspector.UIString("Layers"));
+        super("layer-tree", WI.UIString("Layers"));
 
         this._dataGridNodesByLayerId = new Map;
 
@@ -38,7 +38,7 @@
 
     shown()
     {
-        WebInspector.layerTreeManager.addEventListener(WebInspector.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
+        WI.layerTreeManager.addEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
 
         console.assert(this.parentSidebar);
 
@@ -47,7 +47,7 @@
 
     hidden()
     {
-        WebInspector.layerTreeManager.removeEventListener(WebInspector.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
+        WI.layerTreeManager.removeEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
 
         super.hidden();
     }
@@ -56,7 +56,7 @@
 
     supportsDOMNode(nodeToInspect)
     {
-        return WebInspector.layerTreeManager.supported && nodeToInspect.nodeType() === Node.ELEMENT_NODE;
+        return WI.layerTreeManager.supported && nodeToInspect.nodeType() === Node.ELEMENT_NODE;
     }
 
     // Protected
@@ -65,7 +65,7 @@
     {
         super.initialLayout();
 
-        WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
+        WI.showShadowDOMSetting.addEventListener(WI.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
 
         this._buildLayerInfoSection();
         this._buildDataGridSection();
@@ -79,7 +79,7 @@
         if (!this.domNode)
             return;
 
-        WebInspector.layerTreeManager.layersForNode(this.domNode, (layerForNode, childLayers) => {
+        WI.layerTreeManager.layersForNode(this.domNode, (layerForNode, childLayers) => {
             this._unfilteredChildLayers = childLayers;
             this._updateDisplayWithLayers(layerForNode, childLayers);
         });
@@ -111,18 +111,18 @@
         var rows = this._layerInfoRows = {};
         var rowsArray = [];
 
-        rowsArray.push(rows["Width"] = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width")));
-        rowsArray.push(rows["Height"] = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height")));
-        rowsArray.push(rows["Paints"] = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Paints")));
-        rowsArray.push(rows["Memory"] = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Memory")));
+        rowsArray.push(rows["Width"] = new WI.DetailsSectionSimpleRow(WI.UIString("Width")));
+        rowsArray.push(rows["Height"] = new WI.DetailsSectionSimpleRow(WI.UIString("Height")));
+        rowsArray.push(rows["Paints"] = new WI.DetailsSectionSimpleRow(WI.UIString("Paints")));
+        rowsArray.push(rows["Memory"] = new WI.DetailsSectionSimpleRow(WI.UIString("Memory")));
 
-        this._layerInfoGroup = new WebInspector.DetailsSectionGroup(rowsArray);
+        this._layerInfoGroup = new WI.DetailsSectionGroup(rowsArray);
 
-        var emptyRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Layer Available"));
+        var emptyRow = new WI.DetailsSectionRow(WI.UIString("No Layer Available"));
         emptyRow.showEmptyMessage();
-        this._noLayerInformationGroup = new WebInspector.DetailsSectionGroup([emptyRow]);
+        this._noLayerInformationGroup = new WI.DetailsSectionGroup([emptyRow]);
 
-        this._layerInfoSection = new WebInspector.DetailsSection("layer-info", WebInspector.UIString("Layer Info"), [this._noLayerInformationGroup]);
+        this._layerInfoSection = new WI.DetailsSection("layer-info", WI.UIString("Layer Info"), [this._noLayerInformationGroup]);
 
         this.contentView.element.appendChild(this._layerInfoSection.element);
     }
@@ -131,26 +131,26 @@
     {
         var columns = {name: {}, paintCount: {}, memory: {}};
 
-        columns.name.title = WebInspector.UIString("Node");
+        columns.name.title = WI.UIString("Node");
         columns.name.sortable = false;
 
-        columns.paintCount.title = WebInspector.UIString("Paints");
+        columns.paintCount.title = WI.UIString("Paints");
         columns.paintCount.sortable = true;
         columns.paintCount.aligned = "right";
         columns.paintCount.width = "50px";
 
-        columns.memory.title = WebInspector.UIString("Memory");
+        columns.memory.title = WI.UIString("Memory");
         columns.memory.sortable = true;
         columns.memory.aligned = "right";
         columns.memory.width = "70px";
 
-        this._dataGrid = new WebInspector.DataGrid(columns);
+        this._dataGrid = new WI.DataGrid(columns);
         this._dataGrid.inline = true;
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._selectedDataGridNodeChanged, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, this._sortDataGrid, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._selectedDataGridNodeChanged, this);
 
         this._dataGrid.sortColumnIdentifier = "memory";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Descending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Descending;
         this._dataGrid.createSettings("layer-tree-details-sidebar-panel");
 
         var element = this._dataGrid.element;
@@ -158,9 +158,9 @@
         element.addEventListener("blur", this._dataGridLostFocus.bind(this), false);
         element.addEventListener("click", this._dataGridWasClicked.bind(this), false);
 
-        this._childLayersRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Child Layers"));
-        var group = new WebInspector.DetailsSectionGroup([this._childLayersRow]);
-        var section = new WebInspector.DetailsSection("layer-children", WebInspector.UIString("Child Layers"), [group], null, true);
+        this._childLayersRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Child Layers"));
+        var group = new WI.DetailsSectionGroup([this._childLayersRow]);
+        var section = new WI.DetailsSection("layer-children", WI.UIString("Child Layers"), [group], null, true);
 
         this.contentView.element.appendChild(section.element);
     }
@@ -198,7 +198,7 @@
             this._highlightSelectedNode();
             this._showPopoverForSelectedNode();
         } else {
-            WebInspector.domTreeManager.hideDOMNodeHighlight();
+            WI.domTreeManager.hideDOMNodeHighlight();
             this._hidePopover();
         }
     }
@@ -211,7 +211,7 @@
 
     _dataGridLostFocus(event)
     {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
         this._hidePopover();
     }
 
@@ -229,14 +229,14 @@
 
         var layer = dataGridNode.layer;
         if (layer.isGeneratedContent || layer.isReflection || layer.isAnonymous)
-            WebInspector.domTreeManager.highlightRect(layer.bounds, true);
+            WI.domTreeManager.highlightRect(layer.bounds, true);
         else
-            WebInspector.domTreeManager.highlightDOMNode(layer.nodeId);
+            WI.domTreeManager.highlightDOMNode(layer.nodeId);
     }
 
     _updateDisplayWithLayers(layerForNode, childLayers)
     {
-        if (!WebInspector.showShadowDOMSetting.value) {
+        if (!WI.showShadowDOMSetting.value) {
             childLayers = childLayers.filter(function(layer) {
                 return !layer.isInShadowTree;
             });
@@ -266,7 +266,7 @@
     _updateDataGrid(layerForNode, childLayers)
     {
         let dataGrid = this._dataGrid;
-        let mutations = WebInspector.layerTreeManager.layerTreeMutations(this._childLayers, childLayers);
+        let mutations = WI.layerTreeManager.layerTreeMutations(this._childLayers, childLayers);
 
         mutations.removals.forEach(function(layer) {
             let node = this._dataGridNodesByLayerId.get(layer.layerId);
@@ -295,7 +295,7 @@
 
     _dataGridNodeForLayer(layer)
     {
-        let node = new WebInspector.LayerTreeDataGridNode(layer);
+        let node = new WI.LayerTreeDataGridNode(layer);
         this._dataGridNodesByLayerId.set(layer.layerId, node);
 
         return node;
@@ -316,8 +316,8 @@
             totalMemory += layer.memory || 0;
         });
 
-        this._layersCountLabel.textContent = WebInspector.UIString("Layer Count: %d").format(layerCount);
-        this._layersMemoryLabel.textContent = WebInspector.UIString("Memory: %s").format(Number.bytesToString(totalMemory));
+        this._layersCountLabel.textContent = WI.UIString("Layer Count: %d").format(layerCount);
+        this._layersMemoryLabel.textContent = WI.UIString("Memory: %s").format(Number.bytesToString(totalMemory));
     }
 
     _showPopoverForSelectedNode()
@@ -340,16 +340,16 @@
 
         var popover = this._popover;
         if (!popover) {
-            popover = this._popover = new WebInspector.Popover;
+            popover = this._popover = new WI.Popover;
             popover.windowResizeHandler = () => { this._updatePopoverForSelectedNode(); };
         }
 
-        var targetFrame = WebInspector.Rect.rectFromClientRect(dataGridNode.element.getBoundingClientRect());
+        var targetFrame = WI.Rect.rectFromClientRect(dataGridNode.element.getBoundingClientRect());
 
         if (content)
             popover.content = content;
 
-        popover.present(targetFrame.pad(2), [WebInspector.RectEdge.MIN_X]);
+        popover.present(targetFrame.pad(2), [WI.RectEdge.MIN_X]);
     }
 
     _hidePopover()
@@ -363,11 +363,11 @@
         var content = document.createElement("div");
         content.className = "layer-tree-popover";
 
-        content.appendChild(document.createElement("p")).textContent = WebInspector.UIString("Reasons for compositing:");
+        content.appendChild(document.createElement("p")).textContent = WI.UIString("Reasons for compositing:");
 
         var list = content.appendChild(document.createElement("ul"));
 
-        WebInspector.layerTreeManager.reasonsForCompositingLayer(layer, (compositingReasons) => {
+        WI.layerTreeManager.reasonsForCompositingLayer(layer, (compositingReasons) => {
             if (isEmptyObject(compositingReasons)) {
                 callback(content);
                 return;
@@ -389,58 +389,58 @@
         }
 
         if (compositingReasons.transform3D)
-            addReason(WebInspector.UIString("Element has a 3D transform"));
+            addReason(WI.UIString("Element has a 3D transform"));
         if (compositingReasons.video)
-            addReason(WebInspector.UIString("Element is <video>"));
+            addReason(WI.UIString("Element is <video>"));
         if (compositingReasons.canvas)
-            addReason(WebInspector.UIString("Element is <canvas>"));
+            addReason(WI.UIString("Element is <canvas>"));
         if (compositingReasons.plugin)
-            addReason(WebInspector.UIString("Element is a plug-in"));
+            addReason(WI.UIString("Element is a plug-in"));
         if (compositingReasons.iFrame)
-            addReason(WebInspector.UIString("Element is <iframe>"));
+            addReason(WI.UIString("Element is <iframe>"));
         if (compositingReasons.backfaceVisibilityHidden)
-            addReason(WebInspector.UIString("Element has “backface-visibility: hidden” style"));
+            addReason(WI.UIString("Element has “backface-visibility: hidden” style"));
         if (compositingReasons.clipsCompositingDescendants)
-            addReason(WebInspector.UIString("Element clips compositing descendants"));
+            addReason(WI.UIString("Element clips compositing descendants"));
         if (compositingReasons.animation)
-            addReason(WebInspector.UIString("Element is animated"));
+            addReason(WI.UIString("Element is animated"));
         if (compositingReasons.filters)
-            addReason(WebInspector.UIString("Element has CSS filters applied"));
+            addReason(WI.UIString("Element has CSS filters applied"));
         if (compositingReasons.positionFixed)
-            addReason(WebInspector.UIString("Element has “position: fixed” style"));
+            addReason(WI.UIString("Element has “position: fixed” style"));
         if (compositingReasons.positionSticky)
-            addReason(WebInspector.UIString("Element has “position: sticky” style"));
+            addReason(WI.UIString("Element has “position: sticky” style"));
         if (compositingReasons.overflowScrollingTouch)
-            addReason(WebInspector.UIString("Element has “-webkit-overflow-scrolling: touch” style"));
+            addReason(WI.UIString("Element has “-webkit-overflow-scrolling: touch” style"));
         if (compositingReasons.stacking)
-            addReason(WebInspector.UIString("Element may overlap another compositing element"));
+            addReason(WI.UIString("Element may overlap another compositing element"));
         if (compositingReasons.overlap)
-            addReason(WebInspector.UIString("Element overlaps other compositing element"));
+            addReason(WI.UIString("Element overlaps other compositing element"));
         if (compositingReasons.negativeZIndexChildren)
-            addReason(WebInspector.UIString("Element has children with a negative z-index"));
+            addReason(WI.UIString("Element has children with a negative z-index"));
         if (compositingReasons.transformWithCompositedDescendants)
-            addReason(WebInspector.UIString("Element has a 2D transform and composited descendants"));
+            addReason(WI.UIString("Element has a 2D transform and composited descendants"));
         if (compositingReasons.opacityWithCompositedDescendants)
-            addReason(WebInspector.UIString("Element has opacity applied and composited descendants"));
+            addReason(WI.UIString("Element has opacity applied and composited descendants"));
         if (compositingReasons.maskWithCompositedDescendants)
-            addReason(WebInspector.UIString("Element is masked and composited descendants"));
+            addReason(WI.UIString("Element is masked and composited descendants"));
         if (compositingReasons.reflectionWithCompositedDescendants)
-            addReason(WebInspector.UIString("Element has a reflection and composited descendants"));
+            addReason(WI.UIString("Element has a reflection and composited descendants"));
         if (compositingReasons.filterWithCompositedDescendants)
-            addReason(WebInspector.UIString("Element has CSS filters applied and composited descendants"));
+            addReason(WI.UIString("Element has CSS filters applied and composited descendants"));
         if (compositingReasons.blendingWithCompositedDescendants)
-            addReason(WebInspector.UIString("Element has CSS blending applied and composited descendants"));
+            addReason(WI.UIString("Element has CSS blending applied and composited descendants"));
         if (compositingReasons.isolatesCompositedBlendingDescendants)
-            addReason(WebInspector.UIString("Element is a stacking context and has composited descendants with CSS blending applied"));
+            addReason(WI.UIString("Element is a stacking context and has composited descendants with CSS blending applied"));
         if (compositingReasons.perspective)
-            addReason(WebInspector.UIString("Element has perspective applied"));
+            addReason(WI.UIString("Element has perspective applied"));
         if (compositingReasons.preserve3D)
-            addReason(WebInspector.UIString("Element has “transform-style: preserve-3d” style"));
+            addReason(WI.UIString("Element has “transform-style: preserve-3d” style"));
         if (compositingReasons.willChange)
-            addReason(WebInspector.UIString("Element has “will-change” style with includes opacity, transform, transform-style, perspective, filter or backdrop-filter"));
+            addReason(WI.UIString("Element has “will-change” style with includes opacity, transform, transform-style, perspective, filter or backdrop-filter"));
         if (compositingReasons.root)
-            addReason(WebInspector.UIString("Element is the root element"));
+            addReason(WI.UIString("Element is the root element"));
         if (compositingReasons.blending)
-            addReason(WebInspector.UIString("Element has “blend-mode” style"));
+            addReason(WI.UIString("Element has “blend-mode” style"));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGrid.js b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGrid.js
index a16c243..c49ab5e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGrid.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutTimelineDataGrid = class LayoutTimelineDataGrid extends WebInspector.TimelineDataGrid
+WI.LayoutTimelineDataGrid = class LayoutTimelineDataGrid extends WI.TimelineDataGrid
 {
     // Protected
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js
index ab0266e..0be35f9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutTimelineDataGridNode = class LayoutTimelineDataGridNode extends WebInspector.TimelineDataGridNode
+WI.LayoutTimelineDataGridNode = class LayoutTimelineDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(layoutTimelineRecord, baseStartTime)
     {
@@ -69,10 +69,10 @@
 
         case "width":
         case "height":
-            return isNaN(value) ? emDash : WebInspector.UIString("%dpx").format(value);
+            return isNaN(value) ? emDash : WI.UIString("%dpx").format(value);
 
         case "area":
-            return isNaN(value) ? emDash : WebInspector.UIString("%dpx²").format(value);
+            return isNaN(value) ? emDash : WI.UIString("%dpx²").format(value);
 
         case "startTime":
             return isNaN(value) ? emDash : Number.secondsToString(value - this._baseStartTime, true);
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js
index 00edba9..6e54acb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutTimelineOverviewGraph = class LayoutTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
+WI.LayoutTimelineOverviewGraph = class LayoutTimelineOverviewGraph extends WI.TimelineOverviewGraph
 {
     constructor(timeline, timelineOverview)
     {
@@ -32,7 +32,7 @@
         this.element.classList.add("layout");
 
         this._layoutTimeline = timeline;
-        this._layoutTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._layoutTimelineRecordAdded, this);
+        this._layoutTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._layoutTimelineRecordAdded, this);
 
         this.reset();
     }
@@ -79,7 +79,7 @@
         {
             var timelineRecordBar = row.recordBars[recordBarIndex];
             if (!timelineRecordBar)
-                timelineRecordBar = row.recordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
+                timelineRecordBar = row.recordBars[recordBarIndex] = new WI.TimelineRecordBar(records, renderMode);
             else {
                 timelineRecordBar.renderMode = renderMode;
                 timelineRecordBar.records = records;
@@ -91,7 +91,7 @@
             ++recordBarIndex;
         }
 
-        WebInspector.TimelineRecordBar.createCombinedBars(row.records, secondsPerPixel, this, createBar.bind(this));
+        WI.TimelineRecordBar.createCombinedBars(row.records, secondsPerPixel, this, createBar.bind(this));
 
         // Remove the remaining unused TimelineRecordBars.
         for (; recordBarIndex < row.recordBars.length; ++recordBarIndex) {
@@ -103,9 +103,9 @@
     _layoutTimelineRecordAdded(event)
     {
         var layoutTimelineRecord = event.data.record;
-        console.assert(layoutTimelineRecord instanceof WebInspector.LayoutTimelineRecord);
+        console.assert(layoutTimelineRecord instanceof WI.LayoutTimelineRecord);
 
-        if (layoutTimelineRecord.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint || layoutTimelineRecord.eventType === WebInspector.LayoutTimelineRecord.EventType.Composite)
+        if (layoutTimelineRecord.eventType === WI.LayoutTimelineRecord.EventType.Paint || layoutTimelineRecord.eventType === WI.LayoutTimelineRecord.EventType.Composite)
             this._timelinePaintRecordRow.records.push(layoutTimelineRecord);
         else
             this._timelineLayoutRecordRow.records.push(layoutTimelineRecord);
diff --git a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
index cbeed2a..56e0aa6 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
@@ -23,26 +23,26 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutTimelineView = class LayoutTimelineView extends WebInspector.TimelineView
+WI.LayoutTimelineView = class LayoutTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline, extraArguments);
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.Layout, timeline);
+        console.assert(timeline.type === WI.TimelineRecord.Type.Layout, timeline);
 
         let columns = {type: {}, name: {}, location: {}, area: {}, width: {}, height: {}, startTime: {}, totalTime: {}};
 
-        columns.name.title = WebInspector.UIString("Type");
+        columns.name.title = WI.UIString("Type");
         columns.name.width = "15%";
 
         var typeToLabelMap = new Map;
-        for (var key in WebInspector.LayoutTimelineRecord.EventType) {
-            var value = WebInspector.LayoutTimelineRecord.EventType[key];
-            typeToLabelMap.set(value, WebInspector.LayoutTimelineRecord.displayNameForEventType(value));
+        for (var key in WI.LayoutTimelineRecord.EventType) {
+            var value = WI.LayoutTimelineRecord.EventType[key];
+            typeToLabelMap.set(value, WI.LayoutTimelineRecord.displayNameForEventType(value));
         }
 
-        columns.type.scopeBar = WebInspector.TimelineDataGrid.createColumnScopeBar("layout", typeToLabelMap);
+        columns.type.scopeBar = WI.TimelineDataGrid.createColumnScopeBar("layout", typeToLabelMap);
         columns.type.hidden = true;
         columns.type.locked = true;
 
@@ -52,36 +52,36 @@
 
         this._scopeBar = columns.type.scopeBar;
 
-        columns.location.title = WebInspector.UIString("Initiator");
+        columns.location.title = WI.UIString("Initiator");
         columns.location.width = "25%";
 
-        columns.area.title = WebInspector.UIString("Area");
+        columns.area.title = WI.UIString("Area");
         columns.area.width = "8%";
 
-        columns.width.title = WebInspector.UIString("Width");
+        columns.width.title = WI.UIString("Width");
         columns.width.width = "8%";
 
-        columns.height.title = WebInspector.UIString("Height");
+        columns.height.title = WI.UIString("Height");
         columns.height.width = "8%";
 
-        columns.startTime.title = WebInspector.UIString("Start Time");
+        columns.startTime.title = WI.UIString("Start Time");
         columns.startTime.width = "8%";
         columns.startTime.aligned = "right";
 
-        columns.totalTime.title = WebInspector.UIString("Duration");
+        columns.totalTime.title = WI.UIString("Duration");
         columns.totalTime.width = "8%";
         columns.totalTime.aligned = "right";
 
         for (var column in columns)
             columns[column].sortable = true;
 
-        this._dataGrid = new WebInspector.LayoutTimelineDataGrid(columns);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridSelectedNodeChanged, this);
+        this._dataGrid = new WI.LayoutTimelineDataGrid(columns);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridSelectedNodeChanged, this);
 
         this.setupDataGrid(this._dataGrid);
 
         this._dataGrid.sortColumnIdentifier = "startTime";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("layout-timeline-view");
 
         this._hoveredTreeElement = null;
@@ -95,7 +95,7 @@
         this.element.classList.add("layout");
         this.addSubview(this._dataGrid);
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._layoutTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._layoutTimelineRecordAdded, this);
 
         this._pendingRecords = [];
     }
@@ -111,12 +111,12 @@
         let pathComponents = [];
 
         while (dataGridNode && !dataGridNode.root) {
-            console.assert(dataGridNode instanceof WebInspector.TimelineDataGridNode);
+            console.assert(dataGridNode instanceof WI.TimelineDataGridNode);
             if (dataGridNode.hidden)
                 return null;
 
-            let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+            let pathComponent = new WI.TimelineDataGridNodePathComponent(dataGridNode);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
             pathComponents.unshift(pathComponent);
             dataGridNode = dataGridNode.parent;
         }
@@ -144,7 +144,7 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
 
         this._dataGrid.closed();
@@ -201,7 +201,7 @@
             return;
 
         for (var layoutTimelineRecord of this._pendingRecords) {
-            let dataGridNode = new WebInspector.LayoutTimelineDataGridNode(layoutTimelineRecord, this.zeroTime);
+            let dataGridNode = new WI.LayoutTimelineDataGridNode(layoutTimelineRecord, this.zeroTime);
 
             this._dataGrid.addRowInSortOrder(null, dataGridNode);
 
@@ -214,9 +214,9 @@
                 }
 
                 let childRecord = entry.children[entry.index];
-                console.assert(childRecord.type === WebInspector.TimelineRecord.Type.Layout, childRecord);
+                console.assert(childRecord.type === WI.TimelineRecord.Type.Layout, childRecord);
 
-                let childDataGridNode = new WebInspector.LayoutTimelineDataGridNode(childRecord, this.zeroTime);
+                let childDataGridNode = new WI.LayoutTimelineDataGridNode(childRecord, this.zeroTime);
                 console.assert(entry.parentDataGridNode, "entry without parent!");
                 this._dataGrid.addRowInSortOrder(null, childDataGridNode, entry.parentDataGridNode);
 
@@ -232,10 +232,10 @@
     _layoutTimelineRecordAdded(event)
     {
         var layoutTimelineRecord = event.data.record;
-        console.assert(layoutTimelineRecord instanceof WebInspector.LayoutTimelineRecord);
+        console.assert(layoutTimelineRecord instanceof WI.LayoutTimelineRecord);
 
         // Only add top-level records, to avoid processing child records multiple times.
-        if (layoutTimelineRecord.parent instanceof WebInspector.LayoutTimelineRecord)
+        if (layoutTimelineRecord.parent instanceof WI.LayoutTimelineRecord)
             return;
 
         this._pendingRecords.push(layoutTimelineRecord);
diff --git a/Source/WebInspectorUI/UserInterface/Views/LineChart.js b/Source/WebInspectorUI/UserInterface/Views/LineChart.js
index 7b2fb9b..867bdb9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LineChart.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LineChart.js
@@ -38,7 +38,7 @@
 //      </svg>
 //  </div>
 
-WebInspector.LineChart = class LineChart
+WI.LineChart = class LineChart
 {
     constructor(size)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/LogContentView.js b/Source/WebInspectorUI/UserInterface/Views/LogContentView.js
index 57de164..f76e870 100644
--- a/Source/WebInspectorUI/UserInterface/Views/LogContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/LogContentView.js
@@ -25,7 +25,7 @@
 
 // FIXME: <https://webkit.org/b/143545> Web Inspector: LogContentView should use higher level objects
 
-WebInspector.LogContentView = class LogContentView extends WebInspector.ContentView
+WI.LogContentView = class LogContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
@@ -49,17 +49,17 @@
         this.messagesElement.addEventListener("dragstart", this._ondragstart.bind(this), true);
         this.element.appendChild(this.messagesElement);
 
-        this.prompt = WebInspector.quickConsole.prompt;
+        this.prompt = WI.quickConsole.prompt;
 
-        this._keyboardShortcutCommandA = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "A");
-        this._keyboardShortcutEsc = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape);
+        this._keyboardShortcutCommandA = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "A");
+        this._keyboardShortcutEsc = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape);
 
-        this._logViewController = new WebInspector.JavaScriptLogViewController(this.messagesElement, this.element, this.prompt, this, "console-prompt-history");
+        this._logViewController = new WI.JavaScriptLogViewController(this.messagesElement, this.element, this.prompt, this, "console-prompt-history");
         this._lastMessageView = null;
 
         const fixed = true;
-        this._findBanner = new WebInspector.FindBanner(this, "console-find-banner", fixed);
-        this._findBanner.inputField.placeholder = WebInspector.UIString("Filter Console Log");
+        this._findBanner = new WI.FindBanner(this, "console-find-banner", fixed);
+        this._findBanner.inputField.placeholder = WI.UIString("Filter Console Log");
         this._findBanner.targetElement = this.element;
 
         this._currentSearchQuery = "";
@@ -68,32 +68,32 @@
         this._selectedSearchMatchIsValid = false;
 
         var scopeBarItems = [
-            new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.All, WebInspector.UIString("All"), true),
-            new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Errors, WebInspector.UIString("Errors"), false, "errors"),
-            new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Warnings, WebInspector.UIString("Warnings"), false, "warnings"),
-            new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Logs, WebInspector.UIString("Logs"), false, "logs")
+            new WI.ScopeBarItem(WI.LogContentView.Scopes.All, WI.UIString("All"), true),
+            new WI.ScopeBarItem(WI.LogContentView.Scopes.Errors, WI.UIString("Errors"), false, "errors"),
+            new WI.ScopeBarItem(WI.LogContentView.Scopes.Warnings, WI.UIString("Warnings"), false, "warnings"),
+            new WI.ScopeBarItem(WI.LogContentView.Scopes.Logs, WI.UIString("Logs"), false, "logs")
         ];
 
-        this._scopeBar = new WebInspector.ScopeBar("log-scope-bar", scopeBarItems, scopeBarItems[0]);
-        this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+        this._scopeBar = new WI.ScopeBar("log-scope-bar", scopeBarItems, scopeBarItems[0]);
+        this._scopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
 
-        this._garbageCollectNavigationItem = new WebInspector.ButtonNavigationItem("clear-log", WebInspector.UIString("Collect garbage"), "Images/NavigationItemGarbageCollect.svg", 16, 16);
-        this._garbageCollectNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._garbageCollect, this);
+        this._garbageCollectNavigationItem = new WI.ButtonNavigationItem("clear-log", WI.UIString("Collect garbage"), "Images/NavigationItemGarbageCollect.svg", 16, 16);
+        this._garbageCollectNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._garbageCollect, this);
 
-        this._clearLogNavigationItem = new WebInspector.ButtonNavigationItem("clear-log", WebInspector.UIString("Clear log (%s or %s)").format(WebInspector.clearKeyboardShortcut.displayName, this._logViewController.messagesAlternateClearKeyboardShortcut.displayName), "Images/NavigationItemClear.svg", 16, 16);
-        this._clearLogNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearLog, this);
+        this._clearLogNavigationItem = new WI.ButtonNavigationItem("clear-log", WI.UIString("Clear log (%s or %s)").format(WI.clearKeyboardShortcut.displayName, this._logViewController.messagesAlternateClearKeyboardShortcut.displayName), "Images/NavigationItemClear.svg", 16, 16);
+        this._clearLogNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._clearLog, this);
 
-        this._showConsoleTabNavigationItem = new WebInspector.ButtonNavigationItem("show-tab", WebInspector.UIString("Show Console tab"), "Images/SplitToggleUp.svg", 16, 16);
-        this._showConsoleTabNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._showConsoleTab, this);
+        this._showConsoleTabNavigationItem = new WI.ButtonNavigationItem("show-tab", WI.UIString("Show Console tab"), "Images/SplitToggleUp.svg", 16, 16);
+        this._showConsoleTabNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._showConsoleTab, this);
 
         this.messagesElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), false);
 
-        WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.SessionStarted, this._sessionStarted, this);
-        WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, this._messageAdded, this);
-        WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, this._previousMessageRepeatCountUpdated, this);
-        WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._logCleared, this);
+        WI.logManager.addEventListener(WI.LogManager.Event.SessionStarted, this._sessionStarted, this);
+        WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, this._messageAdded, this);
+        WI.logManager.addEventListener(WI.LogManager.Event.PreviousMessageRepeatCountUpdated, this._previousMessageRepeatCountUpdated, this);
+        WI.logManager.addEventListener(WI.LogManager.Event.Cleared, this._logCleared, this);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
     }
 
     // Public
@@ -106,9 +106,9 @@
 
         navigationItems.push(this._clearLogNavigationItem);
 
-        if (WebInspector.isShowingSplitConsole())
+        if (WI.isShowingSplitConsole())
             navigationItems.push(this._showConsoleTabNavigationItem);
-        else if (WebInspector.isShowingConsoleTab())
+        else if (WI.isShowingConsoleTab())
             navigationItems.unshift(this._findBanner);
         return navigationItems;
     }
@@ -142,11 +142,11 @@
 
     didAppendConsoleMessageView(messageView)
     {
-        console.assert(messageView instanceof WebInspector.ConsoleMessageView || messageView instanceof WebInspector.ConsoleCommandView);
+        console.assert(messageView instanceof WI.ConsoleMessageView || messageView instanceof WI.ConsoleCommandView);
 
         // Nest the message.
-        var type = messageView instanceof WebInspector.ConsoleCommandView ? null : messageView.message.type;
-        if (this._nestingLevel && type !== WebInspector.ConsoleMessage.MessageType.EndGroup) {
+        var type = messageView instanceof WI.ConsoleCommandView ? null : messageView.message.type;
+        if (this._nestingLevel && type !== WI.ConsoleMessage.MessageType.EndGroup) {
             var x = 16 * this._nestingLevel;
             var messageElement = messageView.element;
             messageElement.style.left = x + "px";
@@ -155,11 +155,11 @@
 
         // Update the nesting level.
         switch (type) {
-        case WebInspector.ConsoleMessage.MessageType.StartGroup:
-        case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
+        case WI.ConsoleMessage.MessageType.StartGroup:
+        case WI.ConsoleMessage.MessageType.StartGroupCollapsed:
             ++this._nestingLevel;
             break;
-        case WebInspector.ConsoleMessage.MessageType.EndGroup:
+        case WI.ConsoleMessage.MessageType.EndGroup:
             if (this._nestingLevel > 0)
                 --this._nestingLevel;
             break;
@@ -169,12 +169,12 @@
 
         // Some results don't populate until further backend dispatches occur (like the DOM tree).
         // We want to remove focusable children after those pending dispatches too.
-        let target = messageView.message ? messageView.message.target : WebInspector.runtimeManager.activeExecutionContext.target;
+        let target = messageView.message ? messageView.message.target : WI.runtimeManager.activeExecutionContext.target;
         target.connection.runAfterPendingDispatches(this._clearFocusableChildren.bind(this));
 
-        if (type && type !== WebInspector.ConsoleMessage.MessageType.EndGroup) {
-            console.assert(messageView.message instanceof WebInspector.ConsoleMessage);
-            if (!(messageView.message instanceof WebInspector.ConsoleCommandResultMessage))
+        if (type && type !== WI.ConsoleMessage.MessageType.EndGroup) {
+            console.assert(messageView.message instanceof WI.ConsoleMessage);
+            if (!(messageView.message instanceof WI.ConsoleCommandResultMessage))
                 this._markScopeBarItemUnread(messageView.message.level);
 
             console.assert(messageView.element instanceof Element);
@@ -188,7 +188,7 @@
 
     get supportsCustomFindBanner()
     {
-        return WebInspector.isShowingConsoleTab();
+        return WI.isShowingConsoleTab();
     }
 
     showCustomFindBanner()
@@ -204,7 +204,7 @@
         if (!this.visible)
             return false;
 
-        if (WebInspector.isShowingSplitConsole())
+        if (WI.isShowingSplitConsole())
             return false;
 
         return true;
@@ -281,7 +281,7 @@
 
         if (onlySelected) {
             messages = messages.filter(function(message) {
-                return message.classList.contains(WebInspector.LogContentView.SelectedStyleClassName);
+                return message.classList.contains(WI.LogContentView.SelectedStyleClassName);
             });
         }
 
@@ -303,13 +303,13 @@
 
     _sessionStarted(event)
     {
-        if (WebInspector.settings.clearLogOnNavigate.value) {
+        if (WI.settings.clearLogOnNavigate.value) {
             this._reappendProvisionalMessages();
             return;
         }
 
         const isFirstSession = false;
-        const newSessionReason = event.data.wasReloaded ? WebInspector.ConsoleSession.NewSessionReason.PageReloaded : WebInspector.ConsoleSession.NewSessionReason.PageNavigated;
+        const newSessionReason = event.data.wasReloaded ? WI.ConsoleSession.NewSessionReason.PageReloaded : WI.ConsoleSession.NewSessionReason.PageNavigated;
         this._logViewController.startNewSession(isFirstSession, {newSessionReason, timestamp: event.data.timestamp});
 
         this._clearProvisionalState();
@@ -320,16 +320,16 @@
         var messageLevel;
 
         switch (level) {
-        case WebInspector.ConsoleMessage.MessageLevel.Warning:
-            messageLevel = WebInspector.LogContentView.Scopes.Warnings;
+        case WI.ConsoleMessage.MessageLevel.Warning:
+            messageLevel = WI.LogContentView.Scopes.Warnings;
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Error:
-            messageLevel = WebInspector.LogContentView.Scopes.Errors;
+        case WI.ConsoleMessage.MessageLevel.Error:
+            messageLevel = WI.LogContentView.Scopes.Errors;
             break;
-        case WebInspector.ConsoleMessage.MessageLevel.Log:
-        case WebInspector.ConsoleMessage.MessageLevel.Info:
-        case WebInspector.ConsoleMessage.MessageLevel.Debug:
-            messageLevel = WebInspector.LogContentView.Scopes.Logs;
+        case WI.ConsoleMessage.MessageLevel.Log:
+        case WI.ConsoleMessage.MessageLevel.Info:
+        case WI.ConsoleMessage.MessageLevel.Debug:
+            messageLevel = WI.LogContentView.Scopes.Logs;
             break;
         }
 
@@ -343,7 +343,7 @@
             return;
 
         let item = this._scopeBar.item(messageLevel);
-        if (item && !item.selected && !this._scopeBar.item(WebInspector.LogContentView.Scopes.All).selected)
+        if (item && !item.selected && !this._scopeBar.item(WI.LogContentView.Scopes.All).selected)
             item.element.classList.add("unread");
     }
 
@@ -386,16 +386,16 @@
         if (event.target.enclosingNodeOrSelfWithNodeName("a"))
             return;
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         if (this._selectedMessages.length) {
-            contextMenu.appendItem(WebInspector.UIString("Copy Selected"), () => {
+            contextMenu.appendItem(WI.UIString("Copy Selected"), () => {
                 InspectorFrontendHost.copyText(this._formatMessagesAsData(true));
             });
 
-            contextMenu.appendItem(WebInspector.UIString("Save Selected"), () => {
+            contextMenu.appendItem(WI.UIString("Save Selected"), () => {
                 const forceSaveAs = true;
-                WebInspector.saveDataToFile({
+                WI.saveDataToFile({
                     url: "web-inspector:///Console.txt",
                     content: this._formatMessagesAsData(true),
                 }, forceSaveAs);
@@ -404,7 +404,7 @@
             contextMenu.appendSeparator();
         }
 
-        contextMenu.appendItem(WebInspector.UIString("Clear Log"), this._clearLog.bind(this));
+        contextMenu.appendItem(WI.UIString("Clear Log"), this._clearLog.bind(this));
         contextMenu.appendSeparator();
     }
 
@@ -420,7 +420,7 @@
             return;
         }
 
-        this._mouseDownWrapper = event.target.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);
+        this._mouseDownWrapper = event.target.enclosingNodeOrSelfWithClass(WI.LogContentView.ItemWrapperStyleClassName);
         this._mouseDownShiftKey = event.shiftKey;
         this._mouseDownCommandKey = event.metaKey;
         this._mouseMoveIsRowSelection = false;
@@ -439,12 +439,12 @@
     _mousemove(event)
     {
         var selection = window.getSelection();
-        var wrapper = event.target.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);
+        var wrapper = event.target.enclosingNodeOrSelfWithClass(WI.LogContentView.ItemWrapperStyleClassName);
 
         if (!wrapper) {
             // No wrapper under the mouse, so look at the selection to try and find one.
             if (!selection.isCollapsed) {
-                wrapper = selection.focusNode.parentNode.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);
+                wrapper = selection.focusNode.parentNode.enclosingNodeOrSelfWithClass(WI.LogContentView.ItemWrapperStyleClassName);
                 selection.removeAllRanges();
             }
 
@@ -477,7 +477,7 @@
         window.removeEventListener("mouseup", this);
 
         var selection = window.getSelection();
-        var wrapper = event.target.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);
+        var wrapper = event.target.enclosingNodeOrSelfWithClass(WI.LogContentView.ItemWrapperStyleClassName);
 
         if (wrapper && (selection.isCollapsed || event.shiftKey)) {
             selection.removeAllRanges();
@@ -505,7 +505,7 @@
 
     _ondragstart(event)
     {
-        if (event.target.enclosingNodeOrSelfWithClass(WebInspector.DOMTreeOutline.StyleClassName)) {
+        if (event.target.enclosingNodeOrSelfWithClass(WI.DOMTreeOutline.StyleClassName)) {
             event.stopPropagation();
             event.preventDefault();
         }
@@ -531,7 +531,7 @@
 
         var alreadySelectedMessage = this._selectedMessages.includes(message);
         if (alreadySelectedMessage && this._selectedMessages.length && multipleSelection) {
-            message.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);
+            message.classList.remove(WI.LogContentView.SelectedStyleClassName);
             this._selectedMessages.remove(message);
             return;
         }
@@ -555,18 +555,18 @@
 
             for (var i = startIndex; i <= endIndex; ++i) {
                 var messageInRange = messages[i];
-                if (i >= newRange[0] && i <= newRange[1] && !messageInRange.classList.contains(WebInspector.LogContentView.SelectedStyleClassName)) {
-                    messageInRange.classList.add(WebInspector.LogContentView.SelectedStyleClassName);
+                if (i >= newRange[0] && i <= newRange[1] && !messageInRange.classList.contains(WI.LogContentView.SelectedStyleClassName)) {
+                    messageInRange.classList.add(WI.LogContentView.SelectedStyleClassName);
                     this._selectedMessages.push(messageInRange);
-                } else if (i < newRange[0] || i > newRange[1] && messageInRange.classList.contains(WebInspector.LogContentView.SelectedStyleClassName)) {
-                    messageInRange.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);
+                } else if (i < newRange[0] || i > newRange[1] && messageInRange.classList.contains(WI.LogContentView.SelectedStyleClassName)) {
+                    messageInRange.classList.remove(WI.LogContentView.SelectedStyleClassName);
                     this._selectedMessages.remove(messageInRange);
                 }
             }
 
             this._selectionRange = newRange;
         } else {
-            message.classList.add(WebInspector.LogContentView.SelectedStyleClassName);
+            message.classList.add(WI.LogContentView.SelectedStyleClassName);
             this._selectedMessages.push(message);
         }
 
@@ -610,10 +610,10 @@
     {
         var node = message;
 
-        if (node.classList.contains(WebInspector.LogContentView.FilteredOutStyleClassName))
+        if (node.classList.contains(WI.LogContentView.FilteredOutStyleClassName))
             return false;
 
-        if (this.hasPerformedSearch && node.classList.contains(WebInspector.LogContentView.FilteredOutBySearchStyleClassName))
+        if (this.hasPerformedSearch && node.classList.contains(WI.LogContentView.FilteredOutBySearchStyleClassName))
             return false;
 
         if (message.classList.contains("console-group-title"))
@@ -630,13 +630,13 @@
 
     _isMessageSelected(message)
     {
-        return message.classList.contains(WebInspector.LogContentView.SelectedStyleClassName);
+        return message.classList.contains(WI.LogContentView.SelectedStyleClassName);
     }
 
     _clearMessagesSelection()
     {
         this._selectedMessages.forEach(function(message) {
-            message.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);
+            message.classList.remove(WI.LogContentView.SelectedStyleClassName);
         });
         this._selectedMessages = [];
         delete this._referenceMessageForRangeSelection;
@@ -649,7 +649,7 @@
         var messages = this._visibleMessageElements();
         for (var i = 0; i < messages.length; ++i) {
             var message = messages[i];
-            message.classList.add(WebInspector.LogContentView.SelectedStyleClassName);
+            message.classList.add(WI.LogContentView.SelectedStyleClassName);
             this._selectedMessages.push(message);
         }
     }
@@ -662,7 +662,7 @@
     _unfilteredMessageElements()
     {
         return this._allMessageElements().filter(function(message) {
-            return !message.classList.contains(WebInspector.LogContentView.FilteredOutStyleClassName);
+            return !message.classList.contains(WI.LogContentView.FilteredOutStyleClassName);
         });
     }
 
@@ -674,7 +674,7 @@
             return unfilteredMessages;
 
         return unfilteredMessages.filter(function(message) {
-            return !message.classList.contains(WebInspector.LogContentView.FilteredOutBySearchStyleClassName);
+            return !message.classList.contains(WI.LogContentView.FilteredOutBySearchStyleClassName);
         });
     }
 
@@ -692,18 +692,18 @@
 
     _showConsoleTab()
     {
-        WebInspector.showConsoleTab();
+        WI.showConsoleTab();
     }
 
     _clearLog()
     {
-        WebInspector.logManager.requestClearMessages();
+        WI.logManager.requestClearMessages();
     }
 
     _garbageCollect()
     {
         // COMPATIBILITY (iOS 10.3): Worker targets did not support HeapAgent.
-        for (let target of WebInspector.targets) {
+        for (let target of WI.targets) {
             if (target.HeapAgent)
                 target.HeapAgent.gc();
         }
@@ -713,7 +713,7 @@
     {
         var item = this._scopeBar.selectedItems[0];
 
-        if (item.id === WebInspector.LogContentView.Scopes.All) {
+        if (item.id === WI.LogContentView.Scopes.All) {
             for (var item of this._scopeBar.items)
                 item.element.classList.remove("unread");
         } else
@@ -724,10 +724,10 @@
 
     _filterMessageElements(messageElements)
     {
-        var showsAll = this._scopeBar.item(WebInspector.LogContentView.Scopes.All).selected;
+        var showsAll = this._scopeBar.item(WI.LogContentView.Scopes.All).selected;
 
         messageElements.forEach(function(messageElement) {
-            var visible = showsAll || messageElement.__commandView instanceof WebInspector.ConsoleCommandView || messageElement.__message instanceof WebInspector.ConsoleCommandResultMessage;
+            var visible = showsAll || messageElement.__commandView instanceof WI.ConsoleCommandView || messageElement.__message instanceof WI.ConsoleCommandResultMessage;
             if (!visible) {
                 var messageLevel = this._scopeFromMessageLevel(messageElement.__message.level);
 
@@ -737,11 +737,11 @@
 
             var classList = messageElement.classList;
             if (visible)
-                classList.remove(WebInspector.LogContentView.FilteredOutStyleClassName);
+                classList.remove(WI.LogContentView.FilteredOutStyleClassName);
             else {
                 this._selectedMessages.remove(messageElement);
-                classList.remove(WebInspector.LogContentView.SelectedStyleClassName);
-                classList.add(WebInspector.LogContentView.FilteredOutStyleClassName);
+                classList.remove(WI.LogContentView.SelectedStyleClassName);
+                classList.add(WI.LogContentView.FilteredOutStyleClassName);
             }
         }, this);
 
@@ -750,7 +750,7 @@
 
     _keyDown(event)
     {
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
 
         if (this._keyboardShortcutCommandA.matchesEvent(event))
             this._commandAWasPressed(event);
@@ -927,7 +927,7 @@
     performSearch(searchQuery)
     {
         if (!isEmptyObject(this._searchHighlightDOMChanges))
-            WebInspector.revertDomChanges(this._searchHighlightDOMChanges);
+            WI.revertDomChanges(this._searchHighlightDOMChanges);
 
         this._currentSearchQuery = searchQuery;
         this._searchHighlightDOMChanges = [];
@@ -937,12 +937,12 @@
         let numberOfResults = 0;
 
         if (this._currentSearchQuery === "") {
-            this.element.classList.remove(WebInspector.LogContentView.SearchInProgressStyleClassName);
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+            this.element.classList.remove(WI.LogContentView.SearchInProgressStyleClassName);
+            this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
             return;
         }
 
-        this.element.classList.add(WebInspector.LogContentView.SearchInProgressStyleClassName);
+        this.element.classList.add(WI.LogContentView.SearchInProgressStyleClassName);
 
         let searchRegex = new RegExp(this._currentSearchQuery.escapeForRegExp(), "gi");
         this._unfilteredMessageElements().forEach(function(message) {
@@ -959,18 +959,18 @@
                 this._highlightRanges(message, matchRanges);
 
             let classList = message.classList;
-            if (!isEmptyObject(matchRanges) || message.__commandView instanceof WebInspector.ConsoleCommandView || message.__message instanceof WebInspector.ConsoleCommandResultMessage)
-                classList.remove(WebInspector.LogContentView.FilteredOutBySearchStyleClassName);
+            if (!isEmptyObject(matchRanges) || message.__commandView instanceof WI.ConsoleCommandView || message.__message instanceof WI.ConsoleCommandResultMessage)
+                classList.remove(WI.LogContentView.FilteredOutBySearchStyleClassName);
             else
-                classList.add(WebInspector.LogContentView.FilteredOutBySearchStyleClassName);
+                classList.add(WI.LogContentView.FilteredOutBySearchStyleClassName);
         }, this);
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
 
         this._findBanner.numberOfResults = numberOfResults;
 
         if (!this._selectedSearchMatchIsValid && this._selectedSearchMatch) {
-            this._selectedSearchMatch.highlight.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);
+            this._selectedSearchMatch.highlight.classList.remove(WI.LogContentView.SelectedStyleClassName);
             this._selectedSearchMatch = null;
         }
     }
@@ -982,7 +982,7 @@
 
     _highlightRanges(message, matchRanges)
     {
-        var highlightedElements = WebInspector.highlightRangesWithStyleClass(message, matchRanges, WebInspector.LogContentView.HighlightedStyleClassName, this._searchHighlightDOMChanges);
+        var highlightedElements = WI.highlightRangesWithStyleClass(message, matchRanges, WI.LogContentView.HighlightedStyleClassName, this._searchHighlightDOMChanges);
 
         console.assert(highlightedElements.length === matchRanges.length);
 
@@ -1012,10 +1012,10 @@
             index = this._searchMatches.length - 1;
 
         if (this._selectedSearchMatch)
-            this._selectedSearchMatch.highlight.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);
+            this._selectedSearchMatch.highlight.classList.remove(WI.LogContentView.SelectedStyleClassName);
 
         this._selectedSearchMatch = this._searchMatches[index];
-        this._selectedSearchMatch.highlight.classList.add(WebInspector.LogContentView.SelectedStyleClassName);
+        this._selectedSearchMatch.highlight.classList.add(WI.LogContentView.SelectedStyleClassName);
 
         this._ensureMessageIsVisible(this._selectedSearchMatch.message);
     }
@@ -1045,16 +1045,16 @@
     }
 };
 
-WebInspector.LogContentView.Scopes = {
+WI.LogContentView.Scopes = {
     All: "log-all",
     Errors: "log-errors",
     Warnings: "log-warnings",
     Logs: "log-logs"
 };
 
-WebInspector.LogContentView.ItemWrapperStyleClassName = "console-item";
-WebInspector.LogContentView.FilteredOutStyleClassName = "filtered-out";
-WebInspector.LogContentView.SelectedStyleClassName = "selected";
-WebInspector.LogContentView.SearchInProgressStyleClassName = "search-in-progress";
-WebInspector.LogContentView.FilteredOutBySearchStyleClassName = "filtered-out-by-search";
-WebInspector.LogContentView.HighlightedStyleClassName = "highlighted";
+WI.LogContentView.ItemWrapperStyleClassName = "console-item";
+WI.LogContentView.FilteredOutStyleClassName = "filtered-out";
+WI.LogContentView.SelectedStyleClassName = "selected";
+WI.LogContentView.SearchInProgressStyleClassName = "search-in-progress";
+WI.LogContentView.FilteredOutBySearchStyleClassName = "filtered-out-by-search";
+WI.LogContentView.HighlightedStyleClassName = "highlighted";
diff --git a/Source/WebInspectorUI/UserInterface/Views/MemoryCategoryView.js b/Source/WebInspectorUI/UserInterface/Views/MemoryCategoryView.js
index 0356550..22d0137 100644
--- a/Source/WebInspectorUI/UserInterface/Views/MemoryCategoryView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/MemoryCategoryView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryCategoryView = class MemoryCategoryView extends WebInspector.Object
+WI.MemoryCategoryView = class MemoryCategoryView extends WI.Object
 {
     constructor(category, displayName)
     {
@@ -52,8 +52,8 @@
         this._graphElement.classList.add("graph");
 
         // FIXME: <https://webkit.org/b/153758> Web Inspector: Memory Timeline View should be responsive / resizable
-        let size = new WebInspector.Size(800, 75);
-        this._chart = new WebInspector.LineChart(size);
+        let size = new WI.Size(800, 75);
+        this._chart = new WI.LineChart(size);
         this._graphElement.appendChild(this._chart.element);
     }
 
@@ -118,7 +118,7 @@
         this._cachedMinSize = minSize;
         this._cachedMaxSize = maxSize;
 
-        this._detailsMaxElement.textContent = WebInspector.UIString("Highest: %s").format(Number.isFinite(maxSize) ? Number.bytesToString(maxSize) : emDash);
-        this._detailsMinElement.textContent = WebInspector.UIString("Lowest: %s").format(Number.isFinite(minSize) ? Number.bytesToString(minSize) : emDash);
+        this._detailsMaxElement.textContent = WI.UIString("Highest: %s").format(Number.isFinite(maxSize) ? Number.bytesToString(maxSize) : emDash);
+        this._detailsMinElement.textContent = WI.UIString("Lowest: %s").format(Number.isFinite(minSize) ? Number.bytesToString(minSize) : emDash);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js
index ad2cc88..77f8b1d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryTimelineOverviewGraph = class MemoryTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
+WI.MemoryTimelineOverviewGraph = class MemoryTimelineOverviewGraph extends WI.TimelineOverviewGraph
 {
     constructor(timeline, timelineOverview)
     {
@@ -31,16 +31,16 @@
 
         this.element.classList.add("memory");
 
-        console.assert(timeline instanceof WebInspector.MemoryTimeline);
+        console.assert(timeline instanceof WI.MemoryTimeline);
 
         this._memoryTimeline = timeline;
-        this._memoryTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._memoryTimelineRecordAdded, this);
-        this._memoryTimeline.addEventListener(WebInspector.MemoryTimeline.Event.MemoryPressureEventAdded, this._memoryTimelineMemoryPressureEventAdded, this);
+        this._memoryTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._memoryTimelineRecordAdded, this);
+        this._memoryTimeline.addEventListener(WI.MemoryTimeline.Event.MemoryPressureEventAdded, this._memoryTimelineMemoryPressureEventAdded, this);
 
         this._didInitializeCategories = false;
 
-        let size = new WebInspector.Size(0, this.height);
-        this._chart = new WebInspector.StackedLineChart(size);
+        let size = new WI.Size(0, this.height);
+        this._chart = new WI.StackedLineChart(size);
         this.element.appendChild(this._chart.element);
 
         this._legendElement = this.element.appendChild(document.createElement("div"));
@@ -91,7 +91,7 @@
             return;
 
         if (this._chart.size.width !== graphWidth || this._chart.size.height !== this.height)
-            this._chart.size = new WebInspector.Size(graphWidth, this.height);
+            this._chart.size = new WI.Size(graphWidth, this.height);
 
         let graphStartTime = this.startTime;
         let visibleEndTime = Math.min(this.endTime, this.currentTime);
@@ -120,7 +120,7 @@
             }
 
             let memoryPressureEvent = visibleMemoryPressureEventMarkers[i];
-            let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+            let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
             markerElement.style.setProperty(property, `${xScale(memoryPressureEvent.timestamp)}px`);
         }
 
@@ -224,7 +224,7 @@
             this._legendElement.textContent = "";
         } else {
             this._legendElement.hidden = false;
-            this._legendElement.textContent = WebInspector.UIString("Maximum Size: %s").format(Number.bytesToString(this._maxSize));
+            this._legendElement.textContent = WI.UIString("Maximum Size: %s").format(Number.bytesToString(this._maxSize));
         }
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js
index fa08d2d..f35a38b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MemoryTimelineView = class MemoryTimelineView extends WebInspector.TimelineView
+WI.MemoryTimelineView = class MemoryTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
@@ -31,7 +31,7 @@
 
         this._recording = extraArguments.recording;
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.Memory, timeline);
+        console.assert(timeline.type === WI.TimelineRecord.Type.Memory, timeline);
 
         this.element.classList.add("memory");
 
@@ -56,9 +56,9 @@
             return chartFlexContainerElement;
         }
 
-        let usageTooltip = WebInspector.UIString("Breakdown of each memory category at the end of the selected time range");
-        let usageChartContainerElement = createChartContainer(overviewElement, WebInspector.UIString("Breakdown"), usageTooltip);
-        this._usageCircleChart = new WebInspector.CircleChart({size: 120, innerRadiusRatio: 0.5});
+        let usageTooltip = WI.UIString("Breakdown of each memory category at the end of the selected time range");
+        let usageChartContainerElement = createChartContainer(overviewElement, WI.UIString("Breakdown"), usageTooltip);
+        this._usageCircleChart = new WI.CircleChart({size: 120, innerRadiusRatio: 0.5});
         usageChartContainerElement.appendChild(this._usageCircleChart.element);
         this._usageLegendElement = usageChartContainerElement.appendChild(document.createElement("div"));
         this._usageLegendElement.classList.add("legend", "usage");
@@ -66,9 +66,9 @@
         let dividerElement = overviewElement.appendChild(document.createElement("div"));
         dividerElement.classList.add("divider");
 
-        let maxComparisonTooltip = WebInspector.UIString("Comparison of total memory size at the end of the selected time range to the maximum memory size in this recording");
-        let maxComparisonChartContainerElement = createChartContainer(overviewElement, WebInspector.UIString("Max Comparison"), maxComparisonTooltip);
-        this._maxComparisonCircleChart = new WebInspector.CircleChart({size: 120, innerRadiusRatio: 0.5});
+        let maxComparisonTooltip = WI.UIString("Comparison of total memory size at the end of the selected time range to the maximum memory size in this recording");
+        let maxComparisonChartContainerElement = createChartContainer(overviewElement, WI.UIString("Max Comparison"), maxComparisonTooltip);
+        this._maxComparisonCircleChart = new WI.CircleChart({size: 120, innerRadiusRatio: 0.5});
         maxComparisonChartContainerElement.appendChild(this._maxComparisonCircleChart.element);
         this._maxComparisonLegendElement = maxComparisonChartContainerElement.appendChild(document.createElement("div"));
         this._maxComparisonLegendElement.classList.add("legend", "maximum");
@@ -76,13 +76,13 @@
         let detailsContainerElement = this._detailsContainerElement = contentElement.appendChild(document.createElement("div"));
         detailsContainerElement.classList.add("details");
 
-        this._timelineRuler = new WebInspector.TimelineRuler;
+        this._timelineRuler = new WI.TimelineRuler;
         this.addSubview(this._timelineRuler);
         detailsContainerElement.appendChild(this._timelineRuler.element);
 
         let detailsSubtitleElement = detailsContainerElement.appendChild(document.createElement("div"));
         detailsSubtitleElement.classList.add("subtitle");
-        detailsSubtitleElement.textContent = WebInspector.UIString("Categories");
+        detailsSubtitleElement.textContent = WI.UIString("Categories");
 
         this._didInitializeCategories = false;
         this._categoryViews = [];
@@ -92,7 +92,7 @@
         this._maxComparisonMaximumSizeElement = null;
         this._maxComparisonCurrentSizeElement = null;
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._memoryTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._memoryTimelineRecordAdded, this);
     }
 
     // Static
@@ -100,14 +100,14 @@
     static displayNameForCategory(category)
     {
         switch (category) {
-        case WebInspector.MemoryCategory.Type.JavaScript:
-            return WebInspector.UIString("JavaScript");
-        case WebInspector.MemoryCategory.Type.Images:
-            return WebInspector.UIString("Images");
-        case WebInspector.MemoryCategory.Type.Layers:
-            return WebInspector.UIString("Layers");
-        case WebInspector.MemoryCategory.Type.Page:
-            return WebInspector.UIString("Page");
+        case WI.MemoryCategory.Type.JavaScript:
+            return WI.UIString("JavaScript");
+        case WI.MemoryCategory.Type.Images:
+            return WI.UIString("Images");
+        case WI.MemoryCategory.Type.Layers:
+            return WI.UIString("Layers");
+        case WI.MemoryCategory.Type.Page:
+            return WI.UIString("Page");
         }
     }
 
@@ -117,7 +117,7 @@
     {
         super.shown();
 
-        this._timelineRuler.updateLayout(WebInspector.View.LayoutReason.Resize);
+        this._timelineRuler.updateLayout(WI.View.LayoutReason.Resize);
     }
 
     hidden()
@@ -127,7 +127,7 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
     }
 
@@ -371,7 +371,7 @@
             segments.push(type);
 
             // Per-category graph.
-            let categoryView = new WebInspector.MemoryCategoryView(type, WebInspector.MemoryTimelineView.displayNameForCategory(type));
+            let categoryView = new WI.MemoryCategoryView(type, WI.MemoryTimelineView.displayNameForCategory(type));
             this._categoryViews.push(categoryView);
             if (!lastCategoryViewElement)
                 this._detailsContainerElement.appendChild(categoryView.element);
@@ -380,7 +380,7 @@
             lastCategoryViewElement = categoryView.element;
 
             // Usage legend rows.
-            let sizeElement = appendLegendRow.call(this, this._usageLegendElement, type, WebInspector.MemoryTimelineView.displayNameForCategory(type));
+            let sizeElement = appendLegendRow.call(this, this._usageLegendElement, type, WI.MemoryTimelineView.displayNameForCategory(type));
             this._usageLegendSizeElementMap.set(type, sizeElement);
         }
 
@@ -388,14 +388,14 @@
 
         // Max comparison legend rows.
         this._maxComparisonCircleChart.segments = ["current", "remainder"];
-        this._maxComparisonMaximumSizeElement = appendLegendRow.call(this, this._maxComparisonLegendElement, "remainder", WebInspector.UIString("Maximum"), WebInspector.UIString("Maximum maximum memory size in this recording"));
-        this._maxComparisonCurrentSizeElement = appendLegendRow.call(this, this._maxComparisonLegendElement, "current", WebInspector.UIString("Current"), WebInspector.UIString("Total memory size at the end of the selected time range"));
+        this._maxComparisonMaximumSizeElement = appendLegendRow.call(this, this._maxComparisonLegendElement, "remainder", WI.UIString("Maximum"), WI.UIString("Maximum maximum memory size in this recording"));
+        this._maxComparisonCurrentSizeElement = appendLegendRow.call(this, this._maxComparisonLegendElement, "current", WI.UIString("Current"), WI.UIString("Total memory size at the end of the selected time range"));
     }
 
     _memoryTimelineRecordAdded(event)
     {
         let memoryTimelineRecord = event.data.record;
-        console.assert(memoryTimelineRecord instanceof WebInspector.MemoryTimelineRecord);
+        console.assert(memoryTimelineRecord instanceof WI.MemoryTimelineRecord);
 
         if (!this._didInitializeCategories)
             this._initializeCategoryViews(memoryTimelineRecord);
diff --git a/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js b/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js
index e71d8da..8da5b44 100644
--- a/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.MultipleScopeBarItem = class MultipleScopeBarItem extends WebInspector.Object
+WI.MultipleScopeBarItem = class MultipleScopeBarItem extends WI.Object
 {
     constructor(scopeBarItems)
     {
@@ -91,7 +91,7 @@
                 scopeBarItem.selected = false;
             }
 
-            scopeBarItem.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
+            scopeBarItem.addEventListener(WI.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
 
             this._selectElement.appendChild(createOption(scopeBarItem));
         }
@@ -137,8 +137,8 @@
             this._selectedScopeBarItem.selected = true;
         }
 
-        var withModifier = WebInspector.modifierKeys.metaKey && !WebInspector.modifierKeys.ctrlKey && !WebInspector.modifierKeys.altKey && !WebInspector.modifierKeys.shiftKey;
-        this.dispatchEventToListeners(WebInspector.ScopeBarItem.Event.SelectionChanged, {withModifier});
+        var withModifier = WI.modifierKeys.metaKey && !WI.modifierKeys.ctrlKey && !WI.modifierKeys.altKey && !WI.modifierKeys.shiftKey;
+        this.dispatchEventToListeners(WI.ScopeBarItem.Event.SelectionChanged, {withModifier});
 
         this._ignoreItemSelectedEvent = false;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js b/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
index 2c4f98c..f54f20b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NavigationBar = class NavigationBar extends WebInspector.View
+WI.NavigationBar = class NavigationBar extends WI.View
 {
     constructor(element, navigationItems, role, label)
     {
@@ -62,8 +62,8 @@
 
     insertNavigationItem(navigationItem, index, parentElement)
     {
-        console.assert(navigationItem instanceof WebInspector.NavigationItem);
-        if (!(navigationItem instanceof WebInspector.NavigationItem))
+        console.assert(navigationItem instanceof WI.NavigationItem);
+        if (!(navigationItem instanceof WI.NavigationItem))
             return null;
 
         if (navigationItem.parentNavigationBar)
@@ -95,8 +95,8 @@
 
     removeNavigationItem(navigationItem)
     {
-        console.assert(navigationItem instanceof WebInspector.NavigationItem);
-        if (!(navigationItem instanceof WebInspector.NavigationItem))
+        console.assert(navigationItem instanceof WI.NavigationItem);
+        if (!(navigationItem instanceof WI.NavigationItem))
             return null;
 
         if (!navigationItem._parentNavigationBar)
@@ -134,7 +134,7 @@
             return;
 
         // Only radio navigation items can be selected.
-        if (!(navigationItem instanceof WebInspector.RadioButtonNavigationItem))
+        if (!(navigationItem instanceof WI.RadioButtonNavigationItem))
             navigationItem = null;
 
         if (this._selectedNavigationItem === navigationItem)
@@ -151,7 +151,7 @@
         // When the mouse is down don't dispatch the selected event, it will be dispatched on mouse up.
         // This prevents sending the event while the user is scrubbing the bar.
         if (!this._mouseIsDown)
-            this.dispatchEventToListeners(WebInspector.NavigationBar.Event.NavigationItemSelected);
+            this.dispatchEventToListeners(WI.NavigationBar.Event.NavigationItemSelected);
     }
 
     get navigationItems()
@@ -186,13 +186,13 @@
 
     layout()
     {
-        if (this.layoutReason !== WebInspector.View.LayoutReason.Resize && !this._forceLayout)
+        if (this.layoutReason !== WI.View.LayoutReason.Resize && !this._forceLayout)
             return;
 
         this._forceLayout = false;
 
         // Remove the collapsed style class to test if the items can fit at full width.
-        this.element.classList.remove(WebInspector.NavigationBar.CollapsedStyleClassName);
+        this.element.classList.remove(WI.NavigationBar.CollapsedStyleClassName);
 
         // Tell each navigation item to update to full width if needed.
         for (let navigationItem of this._navigationItems)
@@ -201,7 +201,7 @@
         let totalItemWidth = 0;
         for (let navigationItem of this._navigationItems) {
             // Skip flexible space items since they can take up no space at the minimum width.
-            if (navigationItem instanceof WebInspector.FlexibleSpaceNavigationItem)
+            if (navigationItem instanceof WI.FlexibleSpaceNavigationItem)
                 continue;
 
             totalItemWidth += navigationItem.element.realOffsetWidth;
@@ -211,7 +211,7 @@
 
         // Add the collapsed class back if the items are wider than the bar.
         if (totalItemWidth > barWidth)
-            this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);
+            this.element.classList.add(WI.NavigationBar.CollapsedStyleClassName);
 
         // Give each navigation item the opportunity to collapse further.
         for (let navigationItem of this._navigationItems)
@@ -231,7 +231,7 @@
         if (!this._focused)
             this.element.removeAttribute("tabindex");
 
-        var itemElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.RadioButtonNavigationItem.StyleClassName);
+        var itemElement = event.target.enclosingNodeOrSelfWithClass(WI.RadioButtonNavigationItem.StyleClassName);
         if (!itemElement || !itemElement.navigationItem)
             return;
 
@@ -266,7 +266,7 @@
         event.preventDefault();
         event.stopPropagation();
 
-        var itemElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.RadioButtonNavigationItem.StyleClassName);
+        var itemElement = event.target.enclosingNodeOrSelfWithClass(WI.RadioButtonNavigationItem.StyleClassName);
         if (!itemElement || !itemElement.navigationItem || !this.element.contains(itemElement)) {
             // Find the element that is at the X position of the mouse, even when the mouse is no longer
             // vertically in the navigation bar.
@@ -274,7 +274,7 @@
             if (!element)
                 return;
 
-            itemElement = element.enclosingNodeOrSelfWithClass(WebInspector.RadioButtonNavigationItem.StyleClassName);
+            itemElement = element.enclosingNodeOrSelfWithClass(WI.RadioButtonNavigationItem.StyleClassName);
             if (!itemElement || !itemElement.navigationItem || !this.element.contains(itemElement))
                 return;
         }
@@ -311,7 +311,7 @@
         // Dispatch the selected event here since the selectedNavigationItem setter surpresses it
         // while the mouse is down to prevent sending it while scrubbing the bar.
         if (this._previousSelectedNavigationItem !== this.selectedNavigationItem)
-            this.dispatchEventToListeners(WebInspector.NavigationBar.Event.NavigationItemSelected);
+            this.dispatchEventToListeners(WI.NavigationBar.Event.NavigationItemSelected);
 
         delete this._previousSelectedNavigationItem;
 
@@ -338,14 +338,14 @@
 
             do {
                 selectedNavigationItemIndex = Math.max(0, selectedNavigationItemIndex - 1);
-            } while (selectedNavigationItemIndex && !(this._navigationItems[selectedNavigationItemIndex] instanceof WebInspector.RadioButtonNavigationItem));
+            } while (selectedNavigationItemIndex && !(this._navigationItems[selectedNavigationItemIndex] instanceof WI.RadioButtonNavigationItem));
         } else if (event.keyIdentifier === "Right") {
             do {
                 selectedNavigationItemIndex = Math.min(selectedNavigationItemIndex + 1, this._navigationItems.length - 1);
-            } while (selectedNavigationItemIndex < this._navigationItems.length - 1 && !(this._navigationItems[selectedNavigationItemIndex] instanceof WebInspector.RadioButtonNavigationItem));
+            } while (selectedNavigationItemIndex < this._navigationItems.length - 1 && !(this._navigationItems[selectedNavigationItemIndex] instanceof WI.RadioButtonNavigationItem));
         }
 
-        if (!(this._navigationItems[selectedNavigationItemIndex] instanceof WebInspector.RadioButtonNavigationItem))
+        if (!(this._navigationItems[selectedNavigationItemIndex] instanceof WI.RadioButtonNavigationItem))
             return;
 
         this.selectedNavigationItem = this._navigationItems[selectedNavigationItemIndex];
@@ -363,16 +363,16 @@
 
     _calculateMinimumWidth()
     {
-        const wasCollapsed = this.element.classList.contains(WebInspector.NavigationBar.CollapsedStyleClassName);
+        const wasCollapsed = this.element.classList.contains(WI.NavigationBar.CollapsedStyleClassName);
 
         // Add the collapsed style class to calculate the width of the items when they are collapsed.
         if (!wasCollapsed)
-            this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);
+            this.element.classList.add(WI.NavigationBar.CollapsedStyleClassName);
 
         let totalItemWidth = 0;
         for (let item of this._navigationItems) {
             // Skip flexible space items since they can take up no space at the minimum width.
-            if (item instanceof WebInspector.FlexibleSpaceNavigationItem)
+            if (item instanceof WI.FlexibleSpaceNavigationItem)
                 continue;
 
             totalItemWidth += item.minimumWidth;
@@ -380,14 +380,14 @@
 
         // Remove the collapsed style class if we were not collapsed before.
         if (!wasCollapsed)
-            this.element.classList.remove(WebInspector.NavigationBar.CollapsedStyleClassName);
+            this.element.classList.remove(WI.NavigationBar.CollapsedStyleClassName);
 
         return totalItemWidth;
     }
 };
 
-WebInspector.NavigationBar.CollapsedStyleClassName = "collapsed";
+WI.NavigationBar.CollapsedStyleClassName = "collapsed";
 
-WebInspector.NavigationBar.Event = {
+WI.NavigationBar.Event = {
     NavigationItemSelected: "navigation-bar-navigation-item-selected"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
index 33a7ba4..3f875ba 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NavigationItem = class NavigationItem extends WebInspector.Object
+WI.NavigationItem = class NavigationItem extends WI.Object
 {
     constructor(identifier, role, label)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
index bcf1bf4..1734c93 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebInspector.SidebarPanel
+WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel
 {
     constructor(identifier, displayName, shouldAutoPruneStaleTopLevelResourceTreeElements)
     {
@@ -33,21 +33,21 @@
 
         this.contentView.element.addEventListener("scroll", this.soon._updateContentOverflowShadowVisibility);
 
-        this._contentTreeOutlineGroup = new WebInspector.TreeOutlineGroup;
+        this._contentTreeOutlineGroup = new WI.TreeOutlineGroup;
         this._contentTreeOutline = this.createContentTreeOutline();
 
-        this._filterBar = new WebInspector.FilterBar;
-        this._filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange, this._filterDidChange, this);
+        this._filterBar = new WI.FilterBar;
+        this._filterBar.addEventListener(WI.FilterBar.Event.FilterDidChange, this._filterDidChange, this);
         this.element.appendChild(this._filterBar.element);
 
         this._bottomOverflowShadowElement = document.createElement("div");
-        this._bottomOverflowShadowElement.className = WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName;
+        this._bottomOverflowShadowElement.className = WI.NavigationSidebarPanel.OverflowShadowElementStyleClassName;
         this.element.appendChild(this._bottomOverflowShadowElement);
 
         this._boundUpdateContentOverflowShadowVisibility = this.soon._updateContentOverflowShadowVisibility;
         window.addEventListener("resize", this._boundUpdateContentOverflowShadowVisibility);
 
-        this._filtersSetting = new WebInspector.Setting(identifier + "-navigation-sidebar-filters", {});
+        this._filtersSetting = new WI.Setting(identifier + "-navigation-sidebar-filters", {});
         this._filterBar.filters = this._filtersSetting.value;
 
         this._emptyContentPlaceholderElements = new Map;
@@ -56,9 +56,9 @@
         this._shouldAutoPruneStaleTopLevelResourceTreeElements = shouldAutoPruneStaleTopLevelResourceTreeElements || false;
 
         if (this._shouldAutoPruneStaleTopLevelResourceTreeElements) {
-            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._checkForStaleResources, this);
-            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._checkForStaleResources, this);
-            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._checkForStaleResources, this);
+            WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._checkForStaleResources, this);
+            WI.Frame.addEventListener(WI.Frame.Event.ChildFrameWasRemoved, this._checkForStaleResources, this);
+            WI.Frame.addEventListener(WI.Frame.Event.ResourceWasRemoved, this._checkForStaleResources, this);
         }
 
         this._pendingViewStateCookie = null;
@@ -70,7 +70,7 @@
     closed()
     {
         window.removeEventListener("resize", this._boundUpdateContentOverflowShadowVisibility);
-        WebInspector.Frame.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
     }
 
     get contentBrowser()
@@ -122,21 +122,21 @@
 
     createContentTreeOutline(suppressFiltering)
     {
-        let contentTreeOutline = new WebInspector.TreeOutline;
+        let contentTreeOutline = new WI.TreeOutline;
         contentTreeOutline.allowsRepeatSelection = true;
-        contentTreeOutline.element.classList.add(WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName);
+        contentTreeOutline.element.classList.add(WI.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName);
 
         this._contentTreeOutlineGroup.add(contentTreeOutline);
 
         this.contentView.element.appendChild(contentTreeOutline.element);
 
         if (!suppressFiltering) {
-            contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._treeElementAddedOrChanged, this);
-            contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDidChange, this._treeElementAddedOrChanged, this);
-            contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange, this);
+            contentTreeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._treeElementAddedOrChanged, this);
+            contentTreeOutline.addEventListener(WI.TreeOutline.Event.ElementDidChange, this._treeElementAddedOrChanged, this);
+            contentTreeOutline.addEventListener(WI.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange, this);
         }
 
-        contentTreeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol] = suppressFiltering;
+        contentTreeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol] = suppressFiltering;
 
         return contentTreeOutline;
     }
@@ -146,7 +146,7 @@
         console.assert(Array.isArray(treeElements), "TreeElements should be an array.");
 
         for (let treeElement of treeElements)
-            treeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol] = true;
+            treeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol] = true;
 
         this._updateFilter();
     }
@@ -183,7 +183,7 @@
                 return false;
 
             // contentView.parentContainer may be null. Check for selected tab, too.
-            let selectedTabContentView = WebInspector.tabBrowser.selectedTabContentView;
+            let selectedTabContentView = WI.tabBrowser.selectedTabContentView;
             if (selectedTabContentView && selectedTabContentView.contentBrowser !== this.contentBrowser)
                 return false;
         }
@@ -207,7 +207,7 @@
         if (!representedObject)
             return;
 
-        cookie[WebInspector.TypeIdentifierCookieKey] = representedObject.constructor.TypeIdentifier;
+        cookie[WI.TypeIdentifierCookieKey] = representedObject.constructor.TypeIdentifier;
 
         if (representedObject.saveIdentityToCookie) {
             representedObject.saveIdentityToCookie(cookie);
@@ -334,8 +334,8 @@
             treeElement.hidden = false;
 
             // If this tree element was expanded during filtering, collapse it again.
-            if (treeElement.expanded && treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]) {
-                treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol] = false;
+            if (treeElement.expanded && treeElement[WI.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]) {
+                treeElement[WI.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol] = false;
                 treeElement.collapse();
             }
 
@@ -388,15 +388,15 @@
             }
         }
 
-        let suppressFiltering = treeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol];
+        let suppressFiltering = treeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol];
 
         if (suppressFiltering || (matchTextFilter(filterableData.text) && this.matchTreeElementAgainstFilterFunctions(treeElement, flags) && this.matchTreeElementAgainstCustomFilters(treeElement, flags))) {
             // Make this element visible since it matches.
             makeVisible();
 
             // If this tree element didn't match a built-in filter and was expanded earlier during filtering, collapse it again.
-            if (!flags.expandTreeElement && treeElement.expanded && treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]) {
-                treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol] = false;
+            if (!flags.expandTreeElement && treeElement.expanded && treeElement[WI.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]) {
+                treeElement[WI.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol] = false;
                 treeElement.collapse();
             }
 
@@ -429,7 +429,7 @@
             // we should remove the issues for that resource.
             for (var i = contentTreeOutline.children.length - 1; i >= 0; --i) {
                 var treeElement = contentTreeOutline.children[i];
-                if (!(treeElement instanceof WebInspector.ResourceTreeElement))
+                if (!(treeElement instanceof WI.ResourceTreeElement))
                     continue;
 
                 var resource = treeElement.resource;
@@ -487,7 +487,7 @@
             let unfilteredTreeElementFound = false;
             let currentTreeElement = treeOutline.children[0];
             while (currentTreeElement) {
-                let suppressFilteringForTreeElement = currentTreeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol];
+                let suppressFilteringForTreeElement = currentTreeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol];
                 if (!suppressFilteringForTreeElement) {
                     filterableTreeElementFound = true;
 
@@ -507,12 +507,12 @@
             }
 
             // All top level tree elements are hidden, so filtering hid everything. Show a message.
-            this.showEmptyContentPlaceholder(WebInspector.UIString("No Filter Results"), treeOutline);
+            this.showEmptyContentPlaceholder(WI.UIString("No Filter Results"), treeOutline);
             this._emptyFilterResults.set(treeOutline, true);
         }
 
         for (let treeOutline of this.contentTreeOutlines) {
-            if (treeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol])
+            if (treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol])
                 continue;
 
             checkTreeOutlineForEmptyFilterResults.call(this, treeOutline);
@@ -528,7 +528,7 @@
     {
         let selectedTreeElement;
         for (let treeOutline of this.contentTreeOutlines) {
-            if (treeOutline.hidden || treeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol])
+            if (treeOutline.hidden || treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol])
                 continue;
 
             selectedTreeElement = treeOutline.selectedTreeElement;
@@ -547,12 +547,12 @@
 
         // Update all trees that allow filtering.
         for (let treeOutline of this.contentTreeOutlines) {
-            if (treeOutline.hidden || treeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol])
+            if (treeOutline.hidden || treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol])
                 continue;
 
             let currentTreeElement = treeOutline.children[0];
             while (currentTreeElement && !currentTreeElement.root) {
-                if (!currentTreeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]) {
+                if (!currentTreeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) {
                     const currentTreeElementWasHidden = currentTreeElement.hidden;
                     this.applyFiltersToTreeElement(currentTreeElement);
                     if (currentTreeElementWasHidden !== currentTreeElement.hidden)
@@ -577,7 +577,7 @@
         let treeElement = event.data.element;
         let currentTreeElement = treeElement;
         while (currentTreeElement && !currentTreeElement.root) {
-            if (!currentTreeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]) {
+            if (!currentTreeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) {
                 const currentTreeElementWasHidden = currentTreeElement.hidden;
                 this.applyFiltersToTreeElement(currentTreeElement);
                 if (currentTreeElementWasHidden !== currentTreeElement.hidden)
@@ -623,15 +623,15 @@
 
     _isTreeElementWithoutRepresentedObject(treeElement)
     {
-        return treeElement instanceof WebInspector.FolderTreeElement
-            || treeElement instanceof WebInspector.DatabaseHostTreeElement
-            || treeElement instanceof WebInspector.IndexedDatabaseHostTreeElement
-            || treeElement instanceof WebInspector.ApplicationCacheManifestTreeElement
-            || treeElement instanceof WebInspector.ThreadTreeElement
-            || treeElement instanceof WebInspector.IdleTreeElement
-            || treeElement instanceof WebInspector.DOMBreakpointTreeElement
-            || treeElement instanceof WebInspector.XHRBreakpointTreeElement
-            || treeElement instanceof WebInspector.CSSStyleSheetTreeElement
+        return treeElement instanceof WI.FolderTreeElement
+            || treeElement instanceof WI.DatabaseHostTreeElement
+            || treeElement instanceof WI.IndexedDatabaseHostTreeElement
+            || treeElement instanceof WI.ApplicationCacheManifestTreeElement
+            || treeElement instanceof WI.ThreadTreeElement
+            || treeElement instanceof WI.IdleTreeElement
+            || treeElement instanceof WI.DOMBreakpointTreeElement
+            || treeElement instanceof WI.XHRBreakpointTreeElement
+            || treeElement instanceof WI.CSSStyleSheetTreeElement
             || typeof treeElement.representedObject === "string"
             || treeElement.representedObject instanceof String;
     }
@@ -671,7 +671,7 @@
             if (!representedObject)
                 return false;
 
-            var typeIdentifier = cookie[WebInspector.TypeIdentifierCookieKey];
+            var typeIdentifier = cookie[WI.TypeIdentifierCookieKey];
             if (typeIdentifier !== representedObject.constructor.TypeIdentifier)
                 return false;
 
@@ -722,11 +722,11 @@
             return emptyContentPlaceholderElement;
 
         emptyContentPlaceholderElement = document.createElement("div");
-        emptyContentPlaceholderElement.classList.add(WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName);
+        emptyContentPlaceholderElement.classList.add(WI.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName);
         this._emptyContentPlaceholderElements.set(treeOutline, emptyContentPlaceholderElement);
 
         let emptyContentPlaceholderMessageElement = document.createElement("div");
-        emptyContentPlaceholderMessageElement.className = WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName;
+        emptyContentPlaceholderMessageElement.className = WI.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName;
         emptyContentPlaceholderElement.appendChild(emptyContentPlaceholderMessageElement);
 
         return emptyContentPlaceholderElement;
@@ -749,10 +749,10 @@
     }
 };
 
-WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol = Symbol("suppress-filtering");
-WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering");
+WI.NavigationSidebarPanel.SuppressFilteringSymbol = Symbol("suppress-filtering");
+WI.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering");
 
-WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName = "overflow-shadow";
-WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName = "navigation-sidebar-panel-content-tree-outline";
-WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName = "empty-content-placeholder";
-WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName = "message";
+WI.NavigationSidebarPanel.OverflowShadowElementStyleClassName = "overflow-shadow";
+WI.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName = "navigation-sidebar-panel-content-tree-outline";
+WI.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName = "empty-content-placeholder";
+WI.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName = "message";
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js
index 4449880..2827ec4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js
@@ -23,86 +23,86 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkGridContentView = class NetworkGridContentView extends WebInspector.ContentView
+WI.NetworkGridContentView = class NetworkGridContentView extends WI.ContentView
 {
     constructor(representedObject, extraArguments)
     {
         console.assert(extraArguments);
-        console.assert(extraArguments.networkSidebarPanel instanceof WebInspector.NetworkSidebarPanel);
+        console.assert(extraArguments.networkSidebarPanel instanceof WI.NetworkSidebarPanel);
 
         super(representedObject);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
         this._networkSidebarPanel = extraArguments.networkSidebarPanel;
 
         this._contentTreeOutline = this._networkSidebarPanel.contentTreeOutline;
-        this._contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._contentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
 
         let columns = {domain: {}, type: {}, method: {}, scheme: {}, statusCode: {}, cached: {}, protocol: {}, priority: {}, remoteAddress: {}, connectionIdentifier: {}, size: {}, transferSize: {}, requestSent: {}, latency: {}, duration: {}, graph: {}};
 
-        columns.domain.title = columns.domain.tooltip = WebInspector.UIString("Domain");
+        columns.domain.title = columns.domain.tooltip = WI.UIString("Domain");
         columns.domain.width = "10%";
 
-        columns.type.title = columns.type.tooltip = WebInspector.UIString("Type");
+        columns.type.title = columns.type.tooltip = WI.UIString("Type");
         columns.type.width = "6%";
 
-        columns.method.title = columns.method.tooltip = WebInspector.UIString("Method");
+        columns.method.title = columns.method.tooltip = WI.UIString("Method");
         columns.method.width = "5%";
 
-        columns.scheme.title = columns.scheme.tooltip = WebInspector.UIString("Scheme");
+        columns.scheme.title = columns.scheme.tooltip = WI.UIString("Scheme");
         columns.scheme.width = "5%";
 
-        columns.statusCode.title = columns.statusCode.tooltip = WebInspector.UIString("Status");
+        columns.statusCode.title = columns.statusCode.tooltip = WI.UIString("Status");
         columns.statusCode.width = "5%";
 
-        columns.cached.title = columns.cached.tooltip = WebInspector.UIString("Cached");
+        columns.cached.title = columns.cached.tooltip = WI.UIString("Cached");
         columns.cached.width = "8%";
 
-        columns.protocol.title = columns.protocol.tooltip = WebInspector.UIString("Protocol");
+        columns.protocol.title = columns.protocol.tooltip = WI.UIString("Protocol");
         columns.protocol.width = "5%";
         columns.protocol.hidden = true;
 
-        columns.priority.title = columns.priority.tooltip = WebInspector.UIString("Priority");
+        columns.priority.title = columns.priority.tooltip = WI.UIString("Priority");
         columns.priority.width = "5%";
         columns.priority.hidden = true;
 
-        columns.remoteAddress.title = columns.remoteAddress.tooltip = WebInspector.UIString("IP Address");
+        columns.remoteAddress.title = columns.remoteAddress.tooltip = WI.UIString("IP Address");
         columns.remoteAddress.width = "8%";
         columns.remoteAddress.hidden = true;
 
-        columns.connectionIdentifier.title = columns.connectionIdentifier.tooltip = WebInspector.UIString("Connection ID");
+        columns.connectionIdentifier.title = columns.connectionIdentifier.tooltip = WI.UIString("Connection ID");
         columns.connectionIdentifier.width = "5%";
         columns.connectionIdentifier.hidden = true;
         columns.connectionIdentifier.aligned = "right";
 
-        columns.size.title = columns.size.tooltip = WebInspector.UIString("Size");
+        columns.size.title = columns.size.tooltip = WI.UIString("Size");
         columns.size.width = "6%";
         columns.size.aligned = "right";
 
-        columns.transferSize.title = columns.transferSize.tooltip = WebInspector.UIString("Transferred");
+        columns.transferSize.title = columns.transferSize.tooltip = WI.UIString("Transferred");
         columns.transferSize.width = "8%";
         columns.transferSize.aligned = "right";
 
-        columns.requestSent.title = columns.requestSent.tooltip = WebInspector.UIString("Start Time");
+        columns.requestSent.title = columns.requestSent.tooltip = WI.UIString("Start Time");
         columns.requestSent.width = "9%";
         columns.requestSent.aligned = "right";
 
-        columns.latency.title = columns.latency.tooltip = WebInspector.UIString("Latency");
+        columns.latency.title = columns.latency.tooltip = WI.UIString("Latency");
         columns.latency.width = "9%";
         columns.latency.aligned = "right";
 
-        columns.duration.title = columns.duration.tooltip = WebInspector.UIString("Duration");
+        columns.duration.title = columns.duration.tooltip = WI.UIString("Duration");
         columns.duration.width = "9%";
         columns.duration.aligned = "right";
 
         for (let column in columns)
             columns[column].sortable = true;
 
-        this._timelineRuler = new WebInspector.TimelineRuler;
+        this._timelineRuler = new WI.TimelineRuler;
         this._timelineRuler.allowsClippedLabels = true;
 
-        columns.graph.title = WebInspector.UIString("Timeline");
+        columns.graph.title = WI.UIString("Timeline");
         columns.graph.width = "20%";
         columns.graph.headerView = this._timelineRuler;
         columns.graph.sortable = false;
@@ -115,33 +115,33 @@
             delete columns.connectionIdentifier;
         }
 
-        this._dataGrid = new WebInspector.TimelineDataGrid(columns, this._contentTreeOutline);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
+        this._dataGrid = new WI.TimelineDataGrid(columns, this._contentTreeOutline);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
         this._dataGrid.sortDelegate = this;
         this._dataGrid.sortColumnIdentifier = "requestSent";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("network-grid-content-view");
 
         this.element.classList.add("network-grid");
         this.addSubview(this._dataGrid);
 
-        let networkTimeline = WebInspector.timelineManager.persistentNetworkTimeline;
-        networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
-        networkTimeline.addEventListener(WebInspector.Timeline.Event.Reset, this._networkTimelineReset, this);
+        let networkTimeline = WI.timelineManager.persistentNetworkTimeline;
+        networkTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
+        networkTimeline.addEventListener(WI.Timeline.Event.Reset, this._networkTimelineReset, this);
 
         // COMPATIBILITY (iOS 10.3): Network.setDisableResourceCaching did not exist.
         if (window.NetworkAgent && NetworkAgent.setResourceCachingDisabled) {
-            let toolTipForDisableResourceCache = WebInspector.UIString("Ignore the resource cache when loading resources");
-            let activatedToolTipForDisableResourceCache = WebInspector.UIString("Use the resource cache when loading resources");
-            this._disableResourceCacheNavigationItem = new WebInspector.ActivateButtonNavigationItem("disable-resource-cache", toolTipForDisableResourceCache, activatedToolTipForDisableResourceCache, "Images/IgnoreCaches.svg", 16, 16);
-            this._disableResourceCacheNavigationItem.activated = WebInspector.resourceCachingDisabledSetting.value;
+            let toolTipForDisableResourceCache = WI.UIString("Ignore the resource cache when loading resources");
+            let activatedToolTipForDisableResourceCache = WI.UIString("Use the resource cache when loading resources");
+            this._disableResourceCacheNavigationItem = new WI.ActivateButtonNavigationItem("disable-resource-cache", toolTipForDisableResourceCache, activatedToolTipForDisableResourceCache, "Images/IgnoreCaches.svg", 16, 16);
+            this._disableResourceCacheNavigationItem.activated = WI.resourceCachingDisabledSetting.value;
 
-            this._disableResourceCacheNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleDisableResourceCache, this);
-            WebInspector.resourceCachingDisabledSetting.addEventListener(WebInspector.Setting.Event.Changed, this._resourceCachingDisabledSettingChanged, this);
+            this._disableResourceCacheNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleDisableResourceCache, this);
+            WI.resourceCachingDisabledSetting.addEventListener(WI.Setting.Event.Changed, this._resourceCachingDisabledSettingChanged, this);
         }
 
-        this._clearNetworkItemsNavigationItem = new WebInspector.ButtonNavigationItem("clear-network-items", WebInspector.UIString("Clear Network Items (%s)").format(WebInspector.clearKeyboardShortcut.displayName), "Images/NavigationItemClear.svg", 16, 16);
-        this._clearNetworkItemsNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, () => this.reset());
+        this._clearNetworkItemsNavigationItem = new WI.ButtonNavigationItem("clear-network-items", WI.UIString("Clear Network Items (%s)").format(WI.clearKeyboardShortcut.displayName), "Images/NavigationItemClear.svg", 16, 16);
+        this._clearNetworkItemsNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, () => this.reset());
 
         this._pendingRecords = [];
         this._loadingResourceCount = 0;
@@ -165,8 +165,8 @@
         if (!this._contentTreeOutline.selectedTreeElement || this._contentTreeOutline.selectedTreeElement.hidden)
             return null;
 
-        var pathComponent = new WebInspector.GeneralTreeElementPathComponent(this._contentTreeOutline.selectedTreeElement);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._treeElementPathComponentSelected, this);
+        var pathComponent = new WI.GeneralTreeElementPathComponent(this._contentTreeOutline.selectedTreeElement);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._treeElementPathComponentSelected, this);
         return [pathComponent];
     }
 
@@ -187,7 +187,7 @@
 
         this._dataGrid.shown();
 
-        this._dataGrid.updateLayout(WebInspector.View.LayoutReason.Resize);
+        this._dataGrid.updateLayout(WI.View.LayoutReason.Resize);
 
         if (this._loadingResourceCount && !this._scheduledCurrentTimeUpdateIdentifier)
             this._startUpdatingCurrentTime();
@@ -248,7 +248,7 @@
 
         if (!this._scheduledCurrentTimeUpdateIdentifier) {
             this._timelineRuler.endTime = this.endTime;
-            this._endTime = this._lastRecordEndTime + WebInspector.TimelineRecordBar.MinimumWidthPixels * this.secondsPerPixel;
+            this._endTime = this._lastRecordEndTime + WI.TimelineRecordBar.MinimumWidthPixels * this.secondsPerPixel;
         }
 
         this._timelineRuler.endTime = this.endTime;
@@ -272,7 +272,7 @@
     dataGridSortComparator(sortColumnIdentifier, sortDirection, node1, node2)
     {
         if (sortColumnIdentifier === "priority")
-            return WebInspector.Resource.comparePriority(node1.data.priority, node2.data.priority) * sortDirection;
+            return WI.Resource.comparePriority(node1.data.priority, node2.data.priority) * sortDirection;
 
         return null;
     }
@@ -281,12 +281,12 @@
 
     _resourceCachingDisabledSettingChanged()
     {
-        this._disableResourceCacheNavigationItem.activated = WebInspector.resourceCachingDisabledSetting.value;
+        this._disableResourceCacheNavigationItem.activated = WI.resourceCachingDisabledSetting.value;
     }
 
     _toggleDisableResourceCache()
     {
-        WebInspector.resourceCachingDisabledSetting.value = !WebInspector.resourceCachingDisabledSetting.value;
+        WI.resourceCachingDisabledSetting.value = !WI.resourceCachingDisabledSetting.value;
     }
 
     _processPendingRecords()
@@ -300,11 +300,11 @@
             if (treeElement)
                 continue;
 
-            treeElement = new WebInspector.ResourceTreeElement(resourceTimelineRecord.resource);
+            treeElement = new WI.ResourceTreeElement(resourceTimelineRecord.resource);
 
             const includesGraph = false;
             const shouldShowPopover = true;
-            let dataGridNode = new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord, includesGraph, this, shouldShowPopover);
+            let dataGridNode = new WI.ResourceTimelineDataGridNode(resourceTimelineRecord, includesGraph, this, shouldShowPopover);
 
             this._dataGrid.addRowInSortOrder(treeElement, dataGridNode);
         }
@@ -315,7 +315,7 @@
     _mainResourceDidChange(event)
     {
         let frame = event.target;
-        if (!frame.isMainFrame() || WebInspector.settings.clearNetworkOnNavigate.value)
+        if (!frame.isMainFrame() || WI.settings.clearNetworkOnNavigate.value)
             return;
 
         for (let dataGridNode of this._dataGrid.children)
@@ -330,14 +330,14 @@
     _networkTimelineRecordAdded(event)
     {
         let resourceTimelineRecord = event.data.record;
-        console.assert(resourceTimelineRecord instanceof WebInspector.ResourceTimelineRecord);
+        console.assert(resourceTimelineRecord instanceof WI.ResourceTimelineRecord);
 
         let update = (event) => {
-            if (event.target[WebInspector.NetworkGridContentView.ResourceDidFinishOrFail])
+            if (event.target[WI.NetworkGridContentView.ResourceDidFinishOrFail])
                 return;
 
             event.target.removeEventListener(null, null, this);
-            event.target[WebInspector.NetworkGridContentView.ResourceDidFinishOrFail] = true;
+            event.target[WI.NetworkGridContentView.ResourceDidFinishOrFail] = true;
 
             this._loadingResourceCount--;
             if (this._loadingResourceCount)
@@ -358,9 +358,9 @@
         if (resource.finished || resource.failed || resource.canceled)
             return;
 
-        resource[WebInspector.NetworkGridContentView.ResourceDidFinishOrFail] = false;
-        resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, update, this);
-        resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail, update, this);
+        resource[WI.NetworkGridContentView.ResourceDidFinishOrFail] = false;
+        resource.addEventListener(WI.Resource.Event.LoadingDidFinish, update, this);
+        resource.addEventListener(WI.Resource.Event.LoadingDidFail, update, this);
 
         this._loadingResourceCount++;
         if (this._scheduledCurrentTimeUpdateIdentifier)
@@ -370,7 +370,7 @@
             this._startTime = this._endTime = resourceTimelineRecord.startTime;
 
         // FIXME: <https://webkit.org/b/153634> Web Inspector: some background tabs think they are the foreground tab and do unnecessary work
-        if (!(WebInspector.tabBrowser.selectedTabContentView instanceof WebInspector.NetworkTabContentView))
+        if (!(WI.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView))
             return;
 
         this._startUpdatingCurrentTime();
@@ -386,14 +386,14 @@
 
     _treeSelectionDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
 
         if (!this._networkSidebarPanel.canShowDifferentContentView())
             return;
 
         let treeElement = event.data.selectedElement;
-        if (treeElement instanceof WebInspector.ResourceTreeElement) {
-            WebInspector.showRepresentedObject(treeElement.representedObject);
+        if (treeElement instanceof WI.ResourceTreeElement) {
+            WI.showRepresentedObject(treeElement.representedObject);
             return;
         }
 
@@ -402,7 +402,7 @@
 
     _dataGridNodeSelected(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _update(timestamp)
@@ -427,7 +427,7 @@
             return;
 
         // Don't update the current time if the Inspector is not visible, as the requestAnimationFrames won't work.
-        if (!WebInspector.visible)
+        if (!WI.visible)
             return;
 
         if (!this._updateCallback)
@@ -451,4 +451,4 @@
     }
 };
 
-WebInspector.NetworkGridContentView.ResourceDidFinishOrFail = Symbol("ResourceDidFinishOrFail");
+WI.NetworkGridContentView.ResourceDidFinishOrFail = Symbol("ResourceDidFinishOrFail");
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js
index 6611035..0f7bf86 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkSidebarPanel = class NetworkSidebarPanel extends WebInspector.NavigationSidebarPanel
+WI.NetworkSidebarPanel = class NetworkSidebarPanel extends WI.NavigationSidebarPanel
 {
     constructor(contentBrowser)
     {
-        super("network", WebInspector.UIString("Network"), false);
+        super("network", WI.UIString("Network"), false);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
         this.contentBrowser = contentBrowser;
 
-        this.filterBar.placeholder = WebInspector.UIString("Filter Resource List");
+        this.filterBar.placeholder = WI.UIString("Filter Resource List");
 
         this.contentTreeOutline.element.classList.add("network-grid");
         this.contentTreeOutline.disclosureButtons = false;
@@ -49,7 +49,7 @@
     showDefaultContentView()
     {
         if (!this._networkGridView)
-            this._networkGridView = new WebInspector.NetworkGridContentView(null, {networkSidebarPanel: this});
+            this._networkGridView = new WI.NetworkGridContentView(null, {networkSidebarPanel: this});
 
         this.contentBrowser.showContentView(this._networkGridView);
     }
@@ -59,7 +59,7 @@
         if (this._clickedTreeElementGoToArrow)
             return true;
 
-        if (this.contentBrowser.currentContentView instanceof WebInspector.NetworkGridContentView)
+        if (this.contentBrowser.currentContentView instanceof WI.NetworkGridContentView)
             return false;
 
         return !this.restoringState;
@@ -69,34 +69,34 @@
 
     initialLayout()
     {
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this.addSubview(this._navigationBar);
 
         this._resourcesTitleBarElement = document.createElement("div");
-        this._resourcesTitleBarElement.textContent = WebInspector.UIString("Name");
+        this._resourcesTitleBarElement.textContent = WI.UIString("Name");
         this._resourcesTitleBarElement.classList.add("title-bar");
         this.element.appendChild(this._resourcesTitleBarElement);
 
         let scopeItemPrefix = "network-sidebar-";
         let scopeBarItems = [];
 
-        scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix + "type-all", WebInspector.UIString("All Resources"), true));
+        scopeBarItems.push(new WI.ScopeBarItem(scopeItemPrefix + "type-all", WI.UIString("All Resources"), true));
 
-        for (let key in WebInspector.Resource.Type) {
-            let value = WebInspector.Resource.Type[key];
-            let scopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + value, WebInspector.Resource.displayNameForType(value, true));
-            scopeBarItem[WebInspector.NetworkSidebarPanel.ResourceTypeSymbol] = value;
+        for (let key in WI.Resource.Type) {
+            let value = WI.Resource.Type[key];
+            let scopeBarItem = new WI.ScopeBarItem(scopeItemPrefix + value, WI.Resource.displayNameForType(value, true));
+            scopeBarItem[WI.NetworkSidebarPanel.ResourceTypeSymbol] = value;
             scopeBarItems.push(scopeBarItem);
         }
 
-        this._scopeBar = new WebInspector.ScopeBar("network-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
-        this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+        this._scopeBar = new WI.ScopeBar("network-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
+        this._scopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
 
         this._navigationBar.addNavigationItem(this._scopeBar);
 
-        WebInspector.timelineManager.persistentNetworkTimeline.addEventListener(WebInspector.Timeline.Event.Reset, this._networkTimelineReset, this);
+        WI.timelineManager.persistentNetworkTimeline.addEventListener(WI.Timeline.Event.Reset, this._networkTimelineReset, this);
 
-        this.contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);
+        this.contentBrowser.addEventListener(WI.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);
         this._contentBrowserCurrentContentViewDidChange();
     }
 
@@ -104,7 +104,7 @@
     {
         console.assert(cookie);
 
-        cookie[WebInspector.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WebInspector.NetworkGridContentView;
+        cookie[WI.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WI.NetworkGridContentView;
 
         super.saveStateToCookie(cookie);
     }
@@ -115,7 +115,7 @@
 
         // Don't call NavigationSidebarPanel.restoreStateFromCookie, because it tries to match based
         // on type selected tree element. This would cause the grid to be deselected.
-        if (cookie[WebInspector.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey])
+        if (cookie[WI.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey])
             return;
 
         super.restoreStateFromCookie(cookie, relaxedMatchDelay);
@@ -139,14 +139,14 @@
 
         function match()
         {
-            if (treeElement instanceof WebInspector.FrameTreeElement)
-                return selectedScopeBarItem[WebInspector.NetworkSidebarPanel.ResourceTypeSymbol] === WebInspector.Resource.Type.Document;
+            if (treeElement instanceof WI.FrameTreeElement)
+                return selectedScopeBarItem[WI.NetworkSidebarPanel.ResourceTypeSymbol] === WI.Resource.Type.Document;
 
-            console.assert(treeElement instanceof WebInspector.ResourceTreeElement, "Unknown treeElement", treeElement);
-            if (!(treeElement instanceof WebInspector.ResourceTreeElement))
+            console.assert(treeElement instanceof WI.ResourceTreeElement, "Unknown treeElement", treeElement);
+            if (!(treeElement instanceof WI.ResourceTreeElement))
                 return false;
 
-            return treeElement.resource.type === selectedScopeBarItem[WebInspector.NetworkSidebarPanel.ResourceTypeSymbol];
+            return treeElement.resource.type === selectedScopeBarItem[WI.NetworkSidebarPanel.ResourceTypeSymbol];
         }
 
         var matched = match();
@@ -157,23 +157,23 @@
 
     treeElementAddedOrChanged(treeElement)
     {
-        if (treeElement.status && treeElement.status[WebInspector.NetworkSidebarPanel.TreeElementStatusButtonSymbol] || !treeElement.treeOutline)
+        if (treeElement.status && treeElement.status[WI.NetworkSidebarPanel.TreeElementStatusButtonSymbol] || !treeElement.treeOutline)
             return;
 
         var fragment = document.createDocumentFragment();
 
-        var closeButton = new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/Close.svg", null, WebInspector.UIString("Close resource view")));
+        var closeButton = new WI.TreeElementStatusButton(useSVGSymbol("Images/Close.svg", null, WI.UIString("Close resource view")));
         closeButton.element.classList.add("close");
-        closeButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementCloseButtonClicked, this);
+        closeButton.addEventListener(WI.TreeElementStatusButton.Event.Clicked, this._treeElementCloseButtonClicked, this);
         fragment.appendChild(closeButton.element);
 
-        let goToButton = new WebInspector.TreeElementStatusButton(WebInspector.createGoToArrowButton());
-        goToButton[WebInspector.NetworkSidebarPanel.TreeElementSymbol] = treeElement;
-        goToButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementGoToArrowWasClicked, this);
+        let goToButton = new WI.TreeElementStatusButton(WI.createGoToArrowButton());
+        goToButton[WI.NetworkSidebarPanel.TreeElementSymbol] = treeElement;
+        goToButton.addEventListener(WI.TreeElementStatusButton.Event.Clicked, this._treeElementGoToArrowWasClicked, this);
         fragment.appendChild(goToButton.element);
 
         treeElement.status = fragment;
-        treeElement.status[WebInspector.NetworkSidebarPanel.TreeElementStatusButtonSymbol] = true;
+        treeElement.status[WI.NetworkSidebarPanel.TreeElementStatusButtonSymbol] = true;
     }
 
     // Private
@@ -181,7 +181,7 @@
     _mainResourceDidChange(event)
     {
         let frame = event.target;
-        if (!frame.isMainFrame() || WebInspector.settings.clearNetworkOnNavigate.value)
+        if (!frame.isMainFrame() || WI.settings.clearNetworkOnNavigate.value)
             return;
 
         for (let treeElement of this.contentTreeOutline.children)
@@ -196,7 +196,7 @@
 
     _contentBrowserCurrentContentViewDidChange(event)
     {
-        var didShowNetworkGridContentView = this.contentBrowser.currentContentView instanceof WebInspector.NetworkGridContentView;
+        var didShowNetworkGridContentView = this.contentBrowser.currentContentView instanceof WI.NetworkGridContentView;
         this.element.classList.toggle("network-grid-content-view-showing", didShowNetworkGridContentView);
     }
 
@@ -204,8 +204,8 @@
     {
         this._clickedTreeElementGoToArrow = true;
 
-        let treeElement = event.target[WebInspector.NetworkSidebarPanel.TreeElementSymbol];
-        console.assert(treeElement instanceof WebInspector.TreeElement);
+        let treeElement = event.target[WI.NetworkSidebarPanel.TreeElementSymbol];
+        console.assert(treeElement instanceof WI.TreeElement);
 
         treeElement.select(true, true);
 
@@ -229,8 +229,8 @@
     }
 };
 
-WebInspector.NetworkSidebarPanel.ResourceTypeSymbol = Symbol("resource-type");
-WebInspector.NetworkSidebarPanel.TreeElementSymbol = Symbol("tree-element");
-WebInspector.NetworkSidebarPanel.TreeElementStatusButtonSymbol = Symbol("tree-element-status-button");
+WI.NetworkSidebarPanel.ResourceTypeSymbol = Symbol("resource-type");
+WI.NetworkSidebarPanel.TreeElementSymbol = Symbol("tree-element");
+WI.NetworkSidebarPanel.TreeElementStatusButtonSymbol = Symbol("tree-element-status-button");
 
-WebInspector.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey = "network-sidebar-panel-showing-network-grid-content-view";
+WI.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey = "network-sidebar-panel-showing-network-grid-content-view";
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js
index 956da59..0cc337d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js
@@ -23,22 +23,22 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkTabContentView = class NetworkTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.NetworkTabContentView = class NetworkTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.NetworkTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.ResourceDetailsSidebarPanel, WebInspector.ProbeDetailsSidebarPanel];
+        let {image, title} = WI.NetworkTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel];
 
-        super(identifier || "network", "network", tabBarItem, WebInspector.NetworkSidebarPanel, detailsSidebarPanelConstructors);
+        super(identifier || "network", "network", tabBarItem, WI.NetworkSidebarPanel, detailsSidebarPanelConstructors);
     }
 
     static tabInfo()
     {
         return {
             image: "Images/Network.svg",
-            title: WebInspector.UIString("Network"),
+            title: WI.UIString("Network"),
         };
     }
 
@@ -51,12 +51,12 @@
 
     get type()
     {
-        return WebInspector.NetworkTabContentView.Type;
+        return WI.NetworkTabContentView.Type;
     }
 
     canShowRepresentedObject(representedObject)
     {
-        if (!(representedObject instanceof WebInspector.Resource))
+        if (!(representedObject instanceof WI.Resource))
             return false;
 
         return !!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
@@ -70,4 +70,4 @@
     }
 };
 
-WebInspector.NetworkTabContentView.Type = "network";
+WI.NetworkTabContentView.Type = "network";
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js
index ee73b62..bea7b64 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkTimelineOverviewGraph = class NetworkTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
+WI.NetworkTimelineOverviewGraph = class NetworkTimelineOverviewGraph extends WI.TimelineOverviewGraph
 {
     constructor(timeline, timelineOverview)
     {
@@ -32,8 +32,8 @@
 
         this.element.classList.add("network");
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
-        timeline.addEventListener(WebInspector.Timeline.Event.TimesUpdated, this.needsLayout, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.TimesUpdated, this.needsLayout, this);
 
         this.reset();
     }
@@ -47,7 +47,7 @@
         this._nextDumpRow = 0;
         this._timelineRecordGridRows = [];
 
-        for (var i = 0; i < WebInspector.NetworkTimelineOverviewGraph.MaximumRowCount; ++i)
+        for (var i = 0; i < WI.NetworkTimelineOverviewGraph.MaximumRowCount; ++i)
             this._timelineRecordGridRows.push([]);
 
         this.element.removeChildren();
@@ -75,7 +75,7 @@
         {
             let timelineRecordBar = rowRecordBars[recordBarIndex];
             if (!timelineRecordBar)
-                timelineRecordBar = rowRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
+                timelineRecordBar = rowRecordBars[recordBarIndex] = new WI.TimelineRecordBar(records, renderMode);
             else {
                 timelineRecordBar.renderMode = renderMode;
                 timelineRecordBar.records = records;
@@ -92,7 +92,7 @@
 
             recordBarIndex = 0;
 
-            WebInspector.TimelineRecordBar.createCombinedBars(rowRecords, secondsPerPixel, this, createBar.bind(this, rowElement, rowRecordBars));
+            WI.TimelineRecordBar.createCombinedBars(rowRecords, secondsPerPixel, this, createBar.bind(this, rowElement, rowRecordBars));
 
             // Remove the remaining unused TimelineRecordBars.
             for (; recordBarIndex < rowRecordBars.length; ++recordBarIndex) {
@@ -107,14 +107,14 @@
     _networkTimelineRecordAdded(event)
     {
         var resourceTimelineRecord = event.data.record;
-        console.assert(resourceTimelineRecord instanceof WebInspector.ResourceTimelineRecord);
+        console.assert(resourceTimelineRecord instanceof WI.ResourceTimelineRecord);
 
         function compareByStartTime(a, b)
         {
             return a.startTime - b.startTime;
         }
 
-        let minimumBarPaddingTime = WebInspector.TimelineOverview.MinimumDurationPerPixel * (WebInspector.TimelineRecordBar.MinimumWidthPixels + WebInspector.TimelineRecordBar.MinimumMarginPixels);
+        let minimumBarPaddingTime = WI.TimelineOverview.MinimumDurationPerPixel * (WI.TimelineRecordBar.MinimumWidthPixels + WI.TimelineRecordBar.MinimumMarginPixels);
 
         // Try to find a row that has room and does not overlap a previous record.
         var foundRowForRecord = false;
@@ -148,7 +148,7 @@
 
         // We didn't find a empty spot, so dump into the designated dump row.
         if (!foundRowForRecord) {
-            if (this._nextDumpRow >= WebInspector.NetworkTimelineOverviewGraph.MaximumRowCount)
+            if (this._nextDumpRow >= WI.NetworkTimelineOverviewGraph.MaximumRowCount)
                 this._nextDumpRow = 0;
             insertObjectIntoSortedArray(resourceTimelineRecord, this._timelineRecordGridRows[this._nextDumpRow++], compareByStartTime);
         }
@@ -157,4 +157,4 @@
     }
 };
 
-WebInspector.NetworkTimelineOverviewGraph.MaximumRowCount = 6;
+WI.NetworkTimelineOverviewGraph.MaximumRowCount = 6;
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
index 9bdb74e..a39271c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
@@ -23,92 +23,92 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkTimelineView = class NetworkTimelineView extends WebInspector.TimelineView
+WI.NetworkTimelineView = class NetworkTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline, extraArguments);
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.Network);
+        console.assert(timeline.type === WI.TimelineRecord.Type.Network);
 
         let columns = {name: {}, domain: {}, type: {}, method: {}, scheme: {}, statusCode: {}, cached: {}, protocol: {}, priority: {}, remoteAddress: {}, connectionIdentifier: {}, size: {}, transferSize: {}, requestSent: {}, latency: {}, duration: {}, graph: {}};
 
-        columns.name.title = WebInspector.UIString("Name");
+        columns.name.title = WI.UIString("Name");
         columns.name.icon = true;
         columns.name.width = "10%";
         columns.name.locked = true;
 
-        columns.domain.title = WebInspector.UIString("Domain");
+        columns.domain.title = WI.UIString("Domain");
         columns.domain.width = "8%";
 
-        columns.type.title = WebInspector.UIString("Type");
+        columns.type.title = WI.UIString("Type");
         columns.type.width = "7%";
 
         let typeToLabelMap = new Map;
-        for (let key in WebInspector.Resource.Type) {
-            let value = WebInspector.Resource.Type[key];
-            typeToLabelMap.set(value, WebInspector.Resource.displayNameForType(value, true));
+        for (let key in WI.Resource.Type) {
+            let value = WI.Resource.Type[key];
+            typeToLabelMap.set(value, WI.Resource.displayNameForType(value, true));
         }
 
-        columns.type.scopeBar = WebInspector.TimelineDataGrid.createColumnScopeBar("network", typeToLabelMap);
+        columns.type.scopeBar = WI.TimelineDataGrid.createColumnScopeBar("network", typeToLabelMap);
         this._scopeBar = columns.type.scopeBar;
 
-        columns.method.title = WebInspector.UIString("Method");
+        columns.method.title = WI.UIString("Method");
         columns.method.width = "4%";
 
-        columns.scheme.title = WebInspector.UIString("Scheme");
+        columns.scheme.title = WI.UIString("Scheme");
         columns.scheme.width = "4%";
 
-        columns.statusCode.title = WebInspector.UIString("Status");
+        columns.statusCode.title = WI.UIString("Status");
         columns.statusCode.width = "4%";
 
-        columns.cached.title = WebInspector.UIString("Cached");
+        columns.cached.title = WI.UIString("Cached");
         columns.cached.width = "6%";
 
-        columns.protocol.title = WebInspector.UIString("Protocol");
+        columns.protocol.title = WI.UIString("Protocol");
         columns.protocol.width = "5%";
         columns.protocol.hidden = true;
 
-        columns.priority.title = WebInspector.UIString("Priority");
+        columns.priority.title = WI.UIString("Priority");
         columns.priority.width = "5%";
         columns.priority.hidden = true;
 
-        columns.remoteAddress.title = WebInspector.UIString("IP Address");
+        columns.remoteAddress.title = WI.UIString("IP Address");
         columns.remoteAddress.width = "8%";
         columns.remoteAddress.hidden = true;
 
-        columns.connectionIdentifier.title = WebInspector.UIString("Connection ID");
+        columns.connectionIdentifier.title = WI.UIString("Connection ID");
         columns.connectionIdentifier.width = "5%";
         columns.connectionIdentifier.hidden = true;
         columns.connectionIdentifier.aligned = "right";
 
-        columns.size.title = WebInspector.UIString("Size");
+        columns.size.title = WI.UIString("Size");
         columns.size.width = "6%";
         columns.size.aligned = "right";
 
-        columns.transferSize.title = WebInspector.UIString("Transferred");
+        columns.transferSize.title = WI.UIString("Transferred");
         columns.transferSize.width = "8%";
         columns.transferSize.aligned = "right";
 
-        columns.requestSent.title = WebInspector.UIString("Start Time");
+        columns.requestSent.title = WI.UIString("Start Time");
         columns.requestSent.width = "9%";
         columns.requestSent.aligned = "right";
 
-        columns.latency.title = WebInspector.UIString("Latency");
+        columns.latency.title = WI.UIString("Latency");
         columns.latency.width = "9%";
         columns.latency.aligned = "right";
 
-        columns.duration.title = WebInspector.UIString("Duration");
+        columns.duration.title = WI.UIString("Duration");
         columns.duration.width = "9%";
         columns.duration.aligned = "right";
 
         for (let column in columns)
             columns[column].sortable = true;
 
-        this._timelineRuler = new WebInspector.TimelineRuler;
+        this._timelineRuler = new WI.TimelineRuler;
         this._timelineRuler.allowsClippedLabels = true;
 
-        columns.graph.title = WebInspector.UIString("Timeline");
+        columns.graph.title = WI.UIString("Timeline");
         columns.graph.width = "15%";
         columns.graph.headerView = this._timelineRuler;
         columns.graph.sortable = false;
@@ -121,10 +121,10 @@
             delete columns.connectionIdentifier;
         }
 
-        this._dataGrid = new WebInspector.TimelineDataGrid(columns);
+        this._dataGrid = new WI.TimelineDataGrid(columns);
         this._dataGrid.sortDelegate = this;
         this._dataGrid.sortColumnIdentifier = "requestSent";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("network-timeline-view");
 
         this.setupDataGrid(this._dataGrid);
@@ -132,7 +132,7 @@
         this.element.classList.add("network");
         this.addSubview(this._dataGrid);
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
 
         this._pendingRecords = [];
         this._resourceDataGridNodeMap = new Map;
@@ -147,10 +147,10 @@
         if (!this._dataGrid.selectedNode || this._dataGrid.selectedNode.hidden)
             return null;
 
-        console.assert(this._dataGrid.selectedNode instanceof WebInspector.ResourceTimelineDataGridNode);
+        console.assert(this._dataGrid.selectedNode instanceof WI.ResourceTimelineDataGridNode);
 
-        let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(this._dataGrid.selectedNode, this._dataGrid.selectedNode.resource);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+        let pathComponent = new WI.TimelineDataGridNodePathComponent(this._dataGrid.selectedNode, this._dataGrid.selectedNode.resource);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
         return [pathComponent];
     }
 
@@ -170,7 +170,7 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
 
         this._dataGrid.closed();
@@ -191,7 +191,7 @@
     dataGridSortComparator(sortColumnIdentifier, sortDirection, node1, node2)
     {
         if (sortColumnIdentifier === "priority")
-            return WebInspector.Resource.comparePriority(node1.data.priority, node2.data.priority) * sortDirection;
+            return WI.Resource.comparePriority(node1.data.priority, node2.data.priority) * sortDirection;
         
         if (sortColumnIdentifier == "name") {
             let displayName1 = node1.displayName();
@@ -211,7 +211,7 @@
     dataGridNodePathComponentSelected(event)
     {
         let pathComponent = event.data.pathComponent;
-        console.assert(pathComponent instanceof WebInspector.TimelineDataGridNodePathComponent);
+        console.assert(pathComponent instanceof WI.TimelineDataGridNodePathComponent);
 
         let dataGridNode = pathComponent.timelineDataGridNode;
         console.assert(dataGridNode.dataGrid === this._dataGrid);
@@ -256,7 +256,7 @@
 
             const includesGraph = false;
             const shouldShowPopover = true;
-            dataGridNode = new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord, includesGraph, this, shouldShowPopover);
+            dataGridNode = new WI.ResourceTimelineDataGridNode(resourceTimelineRecord, includesGraph, this, shouldShowPopover);
             this._resourceDataGridNodeMap.set(resourceTimelineRecord.resource, dataGridNode);
 
             this._dataGrid.addRowInSortOrder(null, dataGridNode);
@@ -268,7 +268,7 @@
     _networkTimelineRecordAdded(event)
     {
         var resourceTimelineRecord = event.data.record;
-        console.assert(resourceTimelineRecord instanceof WebInspector.ResourceTimelineRecord);
+        console.assert(resourceTimelineRecord instanceof WI.ResourceTimelineRecord);
 
         this._pendingRecords.push(resourceTimelineRecord);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js
index 5d5cf07..e0f3062 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NewTabContentView = class NewTabContentView extends WebInspector.TabContentView
+WI.NewTabContentView = class NewTabContentView extends WI.TabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.NewTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
+        let {image, title} = WI.NewTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
         tabBarItem.isDefaultTab = true;
 
         super(identifier || "new-tab", "new-tab", tabBarItem);
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.TabTypesChanged, this._updateShownTabs.bind(this));
+        WI.notifications.addEventListener(WI.Notification.TabTypesChanged, this._updateShownTabs.bind(this));
 
         this._tabElementsByTabClass = new Map;
         this._updateShownTabs();
@@ -43,7 +43,7 @@
     {
         return {
             image: "Images/NewTab.svg",
-            title: WebInspector.UIString("New Tab"),
+            title: WI.UIString("New Tab"),
         };
     }
 
@@ -61,20 +61,20 @@
 
     get type()
     {
-        return WebInspector.NewTabContentView.Type;
+        return WI.NewTabContentView.Type;
     }
 
     shown()
     {
-        WebInspector.tabBrowser.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._updateTabItems, this);
-        WebInspector.tabBrowser.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved, this._updateTabItems, this);
+        WI.tabBrowser.tabBar.addEventListener(WI.TabBar.Event.TabBarItemAdded, this._updateTabItems, this);
+        WI.tabBrowser.tabBar.addEventListener(WI.TabBar.Event.TabBarItemRemoved, this._updateTabItems, this);
 
         this._updateTabItems();
     }
 
     hidden()
     {
-        WebInspector.tabBrowser.tabBar.removeEventListener(null, null, this);
+        WI.tabBrowser.tabBar.removeEventListener(null, null, this);
     }
 
     get supportsSplitContentBrowser()
@@ -93,7 +93,7 @@
             let tabItemElement = document.createElement("div");
             tabItemElement.classList.add("tab-item");
             tabItemElement.addEventListener("click", this._createNewTabWithType.bind(this, tabClass.Type));
-            tabItemElement[WebInspector.NewTabContentView.TypeSymbol] = tabClass.Type;
+            tabItemElement[WI.NewTabContentView.TypeSymbol] = tabClass.Type;
 
             let boxElement = tabItemElement.appendChild(document.createElement("div"));
             boxElement.classList.add("box");
@@ -116,21 +116,21 @@
 
     _createNewTabWithType(tabType, event)
     {
-        if (!WebInspector.isNewTabWithTypeAllowed(tabType))
+        if (!WI.isNewTabWithTypeAllowed(tabType))
             return;
 
         const canCreateAdditionalTabs = this._allowableTabTypes().length > 1;
         const options = {
             referencedView: this,
-            shouldReplaceTab: !canCreateAdditionalTabs || !WebInspector.modifierKeys.metaKey,
-            shouldShowNewTab: !WebInspector.modifierKeys.metaKey
+            shouldReplaceTab: !canCreateAdditionalTabs || !WI.modifierKeys.metaKey,
+            shouldShowNewTab: !WI.modifierKeys.metaKey
         };
-        WebInspector.createNewTabWithType(tabType, options);
+        WI.createNewTabWithType(tabType, options);
     }
 
     _updateShownTabs()
     {
-        let allTabClasses = Array.from(WebInspector.knownTabClasses());
+        let allTabClasses = Array.from(WI.knownTabClasses());
         let allowedTabClasses = allTabClasses.filter((tabClass) => tabClass.isTabAllowed() && !tabClass.isEphemeral());
         allowedTabClasses.sort((a, b) => a.tabInfo().title.extendedLocaleCompare(b.tabInfo().title));
 
@@ -144,20 +144,20 @@
     _allowableTabTypes()
     {
         let tabTypes = this._shownTabClasses.map((tabClass) => tabClass.Type);
-        return tabTypes.filter((type) => WebInspector.isNewTabWithTypeAllowed(type));
+        return tabTypes.filter((type) => WI.isNewTabWithTypeAllowed(type));
     }
 
     _updateTabItems()
     {
         for (let [tabClass, tabItemElement] of this._tabElementsByTabClass.entries()) {
-            let allowed = WebInspector.isNewTabWithTypeAllowed(tabClass.Type);
-            tabItemElement.classList.toggle(WebInspector.NewTabContentView.DisabledStyleClassName, !allowed);
+            let allowed = WI.isNewTabWithTypeAllowed(tabClass.Type);
+            tabItemElement.classList.toggle(WI.NewTabContentView.DisabledStyleClassName, !allowed);
         }
     }
 };
 
-WebInspector.NewTabContentView.Type = "new-tab";
-WebInspector.NewTabContentView.TypeSymbol = Symbol("type");
+WI.NewTabContentView.Type = "new-tab";
+WI.NewTabContentView.TypeSymbol = Symbol("type");
 
-WebInspector.NewTabContentView.TabItemStyleClassName = "tab-item";
-WebInspector.NewTabContentView.DisabledStyleClassName = "disabled";
+WI.NewTabContentView.TabItemStyleClassName = "tab-item";
+WI.NewTabContentView.DisabledStyleClassName = "disabled";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js b/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
index d7631dca..9c24bb0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
@@ -23,16 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectPreviewView = class ObjectPreviewView extends WebInspector.Object
+WI.ObjectPreviewView = class ObjectPreviewView extends WI.Object
 {
     constructor(preview, mode)
     {
-        console.assert(preview instanceof WebInspector.ObjectPreview);
+        console.assert(preview instanceof WI.ObjectPreview);
 
         super();
 
         this._preview = preview;
-        this._mode = mode || WebInspector.ObjectPreviewView.Mode.Full;
+        this._mode = mode || WI.ObjectPreviewView.Mode.Full;
 
         this._element = document.createElement("span");
         this._element.className = "object-preview";
@@ -93,8 +93,8 @@
     setOriginatingObjectInfo(remoteObject, propertyPath)
     {
         console.assert(!this._remoteObject);
-        console.assert(remoteObject instanceof WebInspector.RemoteObject);
-        console.assert(!propertyPath || propertyPath instanceof WebInspector.PropertyPath);
+        console.assert(remoteObject instanceof WI.RemoteObject);
+        console.assert(!propertyPath || propertyPath instanceof WI.PropertyPath);
 
         this._remoteObject = remoteObject;
         this._propertyPath = propertyPath || null;
@@ -108,16 +108,16 @@
     {
         // Display null / regexps as simple formatted values even in title.
         if (this._preview.subtype === "regexp" || this._preview.subtype === "null")
-            this._titleElement.appendChild(WebInspector.FormattedValue.createElementForObjectPreview(this._preview));
+            this._titleElement.appendChild(WI.FormattedValue.createElementForObjectPreview(this._preview));
         else if (this._preview.subtype === "node")
-            this._titleElement.appendChild(WebInspector.FormattedValue.createElementForNodePreview(this._preview));
+            this._titleElement.appendChild(WI.FormattedValue.createElementForNodePreview(this._preview));
         else
             this._titleElement.textContent = this._preview.description || "";
     }
 
     _numberOfPropertiesToShowInMode()
     {
-        return this._mode === WebInspector.ObjectPreviewView.Mode.Brief ? 3 : Infinity;
+        return this._mode === WI.ObjectPreviewView.Mode.Brief ? 3 : Infinity;
     }
 
     _appendPreview(element, preview)
@@ -234,9 +234,9 @@
             if (property.valuePreview)
                 this._appendPreview(element, property.valuePreview);
             else if (property.subtype === "node")
-                element.appendChild(WebInspector.FormattedValue.createElementForNodePreview(property));
+                element.appendChild(WI.FormattedValue.createElementForNodePreview(property));
             else
-                element.appendChild(WebInspector.FormattedValue.createElementForPropertyPreview(property));
+                element.appendChild(WI.FormattedValue.createElementForPropertyPreview(property));
         }
 
         if (numberAdded === limit && preview.propertyPreviews.length > limit) {
@@ -258,33 +258,33 @@
     _appendValuePreview(element, preview)
     {
         if (preview.subtype === "node") {
-            element.appendChild(WebInspector.FormattedValue.createElementForNodePreview(preview));
+            element.appendChild(WI.FormattedValue.createElementForNodePreview(preview));
             return false;
         }
 
-        element.appendChild(WebInspector.FormattedValue.createElementForObjectPreview(preview));
+        element.appendChild(WI.FormattedValue.createElementForObjectPreview(preview));
         return true;
     }
 
     _contextMenuHandler(event)
     {
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         event.__addedObjectPreviewContextMenuItems = true;
 
-        contextMenu.appendItem(WebInspector.UIString("Log Value"), () => {
+        contextMenu.appendItem(WI.UIString("Log Value"), () => {
             let isImpossible = !this._propertyPath || this._propertyPath.isFullPathImpossible();
-            let text = isImpossible ? WebInspector.UIString("Selected Value") : this._propertyPath.displayPath(WebInspector.PropertyPath.Type.Value);
+            let text = isImpossible ? WI.UIString("Selected Value") : this._propertyPath.displayPath(WI.PropertyPath.Type.Value);
 
             if (!isImpossible)
-                WebInspector.quickConsole.prompt.pushHistoryItem(text);
+                WI.quickConsole.prompt.pushHistoryItem(text);
 
-            WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, this._remoteObject, isImpossible);
+            WI.consoleLogViewController.appendImmediateExecutionWithResult(text, this._remoteObject, isImpossible);
         });
     }
 };
 
-WebInspector.ObjectPreviewView.Mode = {
+WI.ObjectPreviewView.Mode = {
     Brief: Symbol("object-preview-brief"),
     Full: Symbol("object-preview-full"),
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js b/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js
index e085a1e..5d4ab06 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesDetailSectionRow.js
@@ -23,23 +23,23 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectPropertiesDetailSectionRow = class ObjectPropertiesDetailSectionRow extends WebInspector.DetailsSectionRow
+WI.ObjectPropertiesDetailSectionRow = class ObjectPropertiesDetailSectionRow extends WI.DetailsSectionRow
 {
     constructor(objectTree, sectionForDeferredExpand)
     {
         super();
 
-        console.assert(objectTree instanceof WebInspector.ObjectTreeView);
-        console.assert(!sectionForDeferredExpand || sectionForDeferredExpand instanceof WebInspector.DetailsSection);
+        console.assert(objectTree instanceof WI.ObjectTreeView);
+        console.assert(!sectionForDeferredExpand || sectionForDeferredExpand instanceof WI.DetailsSection);
 
         this._objectTree = objectTree;
 
         this.hideEmptyMessage();
-        this.element.classList.add("properties", WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add("properties", WI.SyntaxHighlightedStyleClassName);
         this.element.appendChild(objectTree.element);
 
         if (sectionForDeferredExpand && sectionForDeferredExpand.collapsed)
-            sectionForDeferredExpand.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged, this._detailsSectionCollapsedStateChanged, this);
+            sectionForDeferredExpand.addEventListener(WI.DetailsSection.Event.CollapsedStateChanged, this._detailsSectionCollapsedStateChanged, this);
         else
             this._objectTree.expand();
     }
@@ -56,6 +56,6 @@
 
         this._objectTree.expand();
 
-        event.target.removeEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged, this._detailsSectionCollapsedStateChanged, this);
+        event.target.removeEventListener(WI.DetailsSection.Event.CollapsedStateChanged, this._detailsSectionCollapsedStateChanged, this);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js
index c36262b..0cbf175 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectTreeArrayIndexTreeElement = class ObjectTreeArrayIndexTreeElement extends WebInspector.ObjectTreeBaseTreeElement
+WI.ObjectTreeArrayIndexTreeElement = class ObjectTreeArrayIndexTreeElement extends WI.ObjectTreeBaseTreeElement
 {
     constructor(property, propertyPath)
     {
@@ -69,7 +69,7 @@
 
         var resolvedValue = this.resolvedValue();
         if (resolvedValue)
-            valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(resolvedValue, this.resolvedValuePropertyPath()));
+            valueElement.appendChild(WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(resolvedValue, this.resolvedValuePropertyPath()));
         else {
             if (this.property.hasGetter())
                 container.appendChild(this.createGetterElement(true));
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js
index 7967965..5f59ed9 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectTreeBaseTreeElement = class ObjectTreeBaseTreeElement extends WebInspector.GeneralTreeElement
+WI.ObjectTreeBaseTreeElement = class ObjectTreeBaseTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject, propertyPath, property)
     {
         console.assert(representedObject);
-        console.assert(propertyPath instanceof WebInspector.PropertyPath);
-        console.assert(!property || property instanceof WebInspector.PropertyDescriptor);
+        console.assert(propertyPath instanceof WI.PropertyPath);
+        console.assert(!property || property instanceof WI.PropertyDescriptor);
 
         const classNames = null;
         const title = null;
@@ -72,9 +72,9 @@
     {
         console.assert(this._property);
         if (this._getterValue)
-            return this._propertyPath.appendPropertyDescriptor(this._getterValue, this._property, WebInspector.PropertyPath.Type.Value);
+            return this._propertyPath.appendPropertyDescriptor(this._getterValue, this._property, WI.PropertyPath.Type.Value);
         if (this._property.hasValue())
-            return this._propertyPath.appendPropertyDescriptor(this._property.value, this._property, WebInspector.PropertyPath.Type.Value);
+            return this._propertyPath.appendPropertyDescriptor(this._property.value, this._property, WI.PropertyPath.Type.Value);
         return null;
     }
 
@@ -94,18 +94,18 @@
     {
         console.assert(this._property);
         if (this._getterValue || this._property.hasValue())
-            return WebInspector.PropertyPath.Type.Value;
+            return WI.PropertyPath.Type.Value;
         if (this._property.hasGetter())
-            return WebInspector.PropertyPath.Type.Getter;
+            return WI.PropertyPath.Type.Getter;
         if (this._property.hasSetter())
-            return WebInspector.PropertyPath.Type.Setter;
-        return WebInspector.PropertyPath.Type.Value;
+            return WI.PropertyPath.Type.Setter;
+        return WI.PropertyPath.Type.Value;
     }
 
     propertyPathString(propertyPath)
     {
         if (propertyPath.isFullPathImpossible())
-            return WebInspector.UIString("Unable to determine path to property from root");
+            return WI.UIString("Unable to determine path to property from root");
 
         return propertyPath.displayPath(this.propertyPathType());
     }
@@ -117,11 +117,11 @@
 
         if (!interactive) {
             getterElement.classList.add("disabled");
-            getterElement.title = WebInspector.UIString("Getter");
+            getterElement.title = WI.UIString("Getter");
             return getterElement;
         }
 
-        getterElement.title = WebInspector.UIString("Invoke getter");
+        getterElement.title = WI.UIString("Invoke getter");
         getterElement.addEventListener("click", (event) => {
             event.stopPropagation();
             var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
@@ -141,7 +141,7 @@
     {
         var setterElement = document.createElement("img");
         setterElement.className = "setter";
-        setterElement.title = WebInspector.UIString("Setter");
+        setterElement.title = WI.UIString("Setter");
 
         if (!interactive)
             setterElement.classList.add("disabled");
@@ -169,14 +169,14 @@
             return;
 
         if (this._property && this._property.symbol)
-            contextMenu.appendItem(WebInspector.UIString("Log Symbol"), this._logSymbolProperty.bind(this));
+            contextMenu.appendItem(WI.UIString("Log Symbol"), this._logSymbolProperty.bind(this));
 
-        contextMenu.appendItem(WebInspector.UIString("Log Value"), this._logValue.bind(this));
+        contextMenu.appendItem(WI.UIString("Log Value"), this._logValue.bind(this));
 
         let propertyPath = this.resolvedValuePropertyPath();
         if (propertyPath && !propertyPath.isFullPathImpossible()) {
-            contextMenu.appendItem(WebInspector.UIString("Copy Path to Property"), () => {
-                InspectorFrontendHost.copyText(propertyPath.displayPath(WebInspector.PropertyPath.Type.Value));
+            contextMenu.appendItem(WI.UIString("Copy Path to Property"), () => {
+                InspectorFrontendHost.copyText(propertyPath.displayPath(WI.PropertyPath.Type.Value));
             });
         }
 
@@ -195,8 +195,8 @@
         if (!symbol)
             return;
 
-        var text = WebInspector.UIString("Selected Symbol");
-        WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, symbol, true);
+        var text = WI.UIString("Selected Symbol");
+        WI.consoleLogViewController.appendImmediateExecutionWithResult(text, symbol, true);
     }
 
     _logValue(value)
@@ -207,12 +207,12 @@
 
         var propertyPath = this.resolvedValuePropertyPath();
         var isImpossible = propertyPath.isFullPathImpossible();
-        var text = isImpossible ? WebInspector.UIString("Selected Value") : propertyPath.displayPath(this.propertyPathType());
+        var text = isImpossible ? WI.UIString("Selected Value") : propertyPath.displayPath(this.propertyPathType());
 
         if (!isImpossible)
-            WebInspector.quickConsole.prompt.pushHistoryItem(text);
+            WI.quickConsole.prompt.pushHistoryItem(text);
 
-        WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, resolvedValue, isImpossible);
+        WI.consoleLogViewController.appendImmediateExecutionWithResult(text, resolvedValue, isImpossible);
     }
 
     _appendMenusItemsForObject(contextMenu, resolvedValue)
@@ -220,13 +220,13 @@
         if (resolvedValue.type === "function") {
             // FIXME: We should better handle bound functions.
             if (!isFunctionStringNativeCode(resolvedValue.description)) {
-                contextMenu.appendItem(WebInspector.UIString("Jump to Definition"), function() {
+                contextMenu.appendItem(WI.UIString("Jump to Definition"), function() {
                     resolvedValue.target.DebuggerAgent.getFunctionDetails(resolvedValue.objectId, function(error, response) {
                         if (error)
                             return;
 
                         let location = response.location;
-                        let sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId, resolvedValue.target);
+                        let sourceCode = WI.debuggerManager.scriptForIdentifier(location.scriptId, resolvedValue.target);
                         if (!sourceCode)
                             return;
 
@@ -236,7 +236,7 @@
                             ignoreNetworkTab: true,
                             ignoreSearchTab: true,
                         };
-                        WebInspector.showSourceCodeLocation(sourceCodeLocation, options);
+                        WI.showSourceCodeLocation(sourceCodeLocation, options);
                     });
                 });
             }
@@ -244,22 +244,22 @@
         }
 
         if (resolvedValue.subtype === "node") {
-            contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), function() {
+            contextMenu.appendItem(WI.UIString("Copy as HTML"), function() {
                 resolvedValue.pushNodeToFrontend(function(nodeId) {
-                    WebInspector.domTreeManager.nodeForId(nodeId).copyNode();
+                    WI.domTreeManager.nodeForId(nodeId).copyNode();
                 });
             });
 
-            contextMenu.appendItem(WebInspector.UIString("Scroll Into View"), function() {
+            contextMenu.appendItem(WI.UIString("Scroll Into View"), function() {
                 function scrollIntoView() { this.scrollIntoViewIfNeeded(true); }
                 resolvedValue.callFunction(scrollIntoView, undefined, false, function() {});
             });
 
             contextMenu.appendSeparator();
 
-            contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"), function() {
+            contextMenu.appendItem(WI.UIString("Reveal in DOM Tree"), function() {
                 resolvedValue.pushNodeToFrontend(function(nodeId) {
-                    WebInspector.domTreeManager.inspectElement(nodeId);
+                    WI.domTreeManager.inspectElement(nodeId);
                 });
             });
             return;
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js
index 0f505e3..5f1bb0d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectTreeMapEntryTreeElement = class ObjectTreeMapEntryTreeElement extends WebInspector.ObjectTreeBaseTreeElement
+WI.ObjectTreeMapEntryTreeElement = class ObjectTreeMapEntryTreeElement extends WI.ObjectTreeBaseTreeElement
 {
     constructor(object, propertyPath)
     {
-        console.assert(object instanceof WebInspector.RemoteObject);
+        console.assert(object instanceof WI.RemoteObject);
 
         // Treat the same as an array-index just with different strings and widths.
         super(object, propertyPath);
@@ -54,7 +54,7 @@
 
     propertyPathType()
     {
-        return WebInspector.PropertyPath.Type.Value;
+        return WI.PropertyPath.Type.Value;
     }
 
     titleFragment()
@@ -75,13 +75,13 @@
         // Value.
         var valueElement = container.appendChild(document.createElement("span"));
         valueElement.className = "index-value";
-        valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object, propertyPath));
+        valueElement.appendChild(WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object, propertyPath));
 
         return container;
     }
 };
 
-WebInspector.ObjectTreeMapKeyTreeElement = class ObjectTreeMapKeyTreeElement extends WebInspector.ObjectTreeMapEntryTreeElement
+WI.ObjectTreeMapKeyTreeElement = class ObjectTreeMapKeyTreeElement extends WI.ObjectTreeMapEntryTreeElement
 {
     constructor(object, propertyPath)
     {
@@ -96,7 +96,7 @@
 
     displayPropertyName()
     {
-        return WebInspector.UIString("key");
+        return WI.UIString("key");
     }
 
     resolvedValuePropertyPath()
@@ -105,7 +105,7 @@
     }
 };
 
-WebInspector.ObjectTreeMapValueTreeElement = class ObjectTreeMapValueTreeElement extends WebInspector.ObjectTreeMapEntryTreeElement
+WI.ObjectTreeMapValueTreeElement = class ObjectTreeMapValueTreeElement extends WI.ObjectTreeMapEntryTreeElement
 {
     constructor(object, propertyPath, key)
     {
@@ -122,7 +122,7 @@
 
     displayPropertyName()
     {
-        return WebInspector.UIString("value");
+        return WI.UIString("value");
     }
 
     resolvedValuePropertyPath()
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js
index c539b83..950307b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectTreePropertyTreeElement = class ObjectTreePropertyTreeElement extends WebInspector.ObjectTreeBaseTreeElement
+WI.ObjectTreePropertyTreeElement = class ObjectTreePropertyTreeElement extends WI.ObjectTreeBaseTreeElement
 {
     constructor(property, propertyPath, mode, prototypeName)
     {
         super(property, propertyPath, property);
 
-        this._mode = mode || WebInspector.ObjectTreeView.Mode.Properties;
+        this._mode = mode || WI.ObjectTreeView.Mode.Properties;
         this._prototypeName = prototypeName;
 
         this.mainTitle = this._titleFragment();
@@ -93,7 +93,7 @@
         var valueHasChildren = (resolvedValue && resolvedValue.hasChildren);
         var wasThrown = this.hadError();
 
-        if (this._mode === WebInspector.ObjectTreeView.Mode.Properties)
+        if (this._mode === WI.ObjectTreeView.Mode.Properties)
             this.hasChildren = !wasThrown && valueHasChildren;
         else
             this.hasChildren = !wasThrown && valueHasChildren && (this.property.name === "__proto__" || this._alwaysDisplayAsProperty());
@@ -118,7 +118,7 @@
         if (this.property.name === "__proto__")
             return this._createTitlePrototype();
 
-        if (this._mode === WebInspector.ObjectTreeView.Mode.Properties)
+        if (this._mode === WI.ObjectTreeView.Mode.Properties)
             return this._createTitlePropertyStyle();
         else
             return this._createTitleAPIStyle();
@@ -131,7 +131,7 @@
 
         var nameElement = document.createElement("span");
         nameElement.className = "prototype-name";
-        nameElement.textContent = WebInspector.UIString("%s Prototype").format(this._sanitizedPrototypeString(this.property.value));
+        nameElement.textContent = WI.UIString("%s Prototype").format(this._sanitizedPrototypeString(this.property.value));
         nameElement.title = this.propertyPathString(this.thisPropertyPath());
         return nameElement;
     }
@@ -147,7 +147,7 @@
         nameElement.title = this.propertyPathString(this.thisPropertyPath());
 
         // Property attributes.
-        if (this._mode === WebInspector.ObjectTreeView.Mode.Properties) {
+        if (this._mode === WI.ObjectTreeView.Mode.Properties) {
             if (!this.property.enumerable)
                 nameElement.classList.add("not-enumerable");
         }
@@ -157,12 +157,12 @@
         var resolvedValue = this.resolvedValue();
         if (resolvedValue) {
             if (resolvedValue.preview) {
-                this._previewView = new WebInspector.ObjectPreviewView(resolvedValue.preview);
+                this._previewView = new WI.ObjectPreviewView(resolvedValue.preview);
                 valueOrGetterElement = this._previewView.element;
             } else {
                 this._loadPreviewLazilyIfNeeded();
 
-                valueOrGetterElement = WebInspector.FormattedValue.createElementForRemoteObject(resolvedValue, this.hadError());
+                valueOrGetterElement = WI.FormattedValue.createElementForRemoteObject(resolvedValue, this.hadError());
 
                 // Special case a function property string.
                 if (resolvedValue.type === "function")
@@ -171,7 +171,7 @@
         } else {
             valueOrGetterElement = document.createElement("span");
             if (this.property.hasGetter())
-                valueOrGetterElement.appendChild(this.createGetterElement(this._mode !== WebInspector.ObjectTreeView.Mode.ClassAPI));
+                valueOrGetterElement.appendChild(this.createGetterElement(this._mode !== WI.ObjectTreeView.Mode.ClassAPI));
             if (this.property.hasSetter())
                 valueOrGetterElement.appendChild(this.createSetterElement());
         }
@@ -214,7 +214,7 @@
             var spacer = container.appendChild(document.createElement("span"));
             spacer.className = "spacer";
             if (this.property.hasGetter())
-                container.appendChild(this.createGetterElement(this._mode !== WebInspector.ObjectTreeView.Mode.ClassAPI));
+                container.appendChild(this.createGetterElement(this._mode !== WI.ObjectTreeView.Mode.ClassAPI));
             if (this.property.hasSetter())
                 container.appendChild(this.createSetterElement());
         }
@@ -269,8 +269,8 @@
         if (isFunctionStringNativeCode(resolvedValue.description)) {
             // Native function on a prototype, likely "Foo.prototype.method".
             if (this._prototypeName) {
-                if (WebInspector.NativePrototypeFunctionParameters[this._prototypeName]) {
-                    var params = WebInspector.NativePrototypeFunctionParameters[this._prototypeName][this._property.name];
+                if (WI.NativePrototypeFunctionParameters[this._prototypeName]) {
+                    var params = WI.NativePrototypeFunctionParameters[this._prototypeName][this._property.name];
                     return params ? "(" + params + ")" : "()";
                 }
             }
@@ -282,8 +282,8 @@
                 var match = parentDescription.match(/^function\s+([^)]+?)\(/);
                 if (match) {
                     var name = match[1];
-                    if (WebInspector.NativeConstructorFunctionParameters[name]) {
-                        var params = WebInspector.NativeConstructorFunctionParameters[name][this._property.name];
+                    if (WI.NativeConstructorFunctionParameters[name]) {
+                        var params = WI.NativeConstructorFunctionParameters[name][this._property.name];
                         return params ? "(" + params + ")" : "()";
                     }
                 }
@@ -292,8 +292,8 @@
             // Native DOM constructor or on native objects that are not functions.
             if (parentDescription.endsWith("Constructor") || ["Math", "JSON", "Reflect", "Console"].includes(parentDescription)) {
                 var name = parentDescription;
-                if (WebInspector.NativeConstructorFunctionParameters[name]) {
-                    var params = WebInspector.NativeConstructorFunctionParameters[name][this._property.name];
+                if (WI.NativeConstructorFunctionParameters[name]) {
+                    var params = WI.NativeConstructorFunctionParameters[name][this._property.name];
                     return params ? "(" + params + ")" : "()";
                 }
             }
@@ -322,12 +322,12 @@
             return;
 
         var resolvedValue = this.resolvedValue();
-        if (resolvedValue.isCollectionType() && this._mode === WebInspector.ObjectTreeView.Mode.Properties)
+        if (resolvedValue.isCollectionType() && this._mode === WI.ObjectTreeView.Mode.Properties)
             resolvedValue.getCollectionEntries(0, 100, this._updateChildrenInternal.bind(this, this._updateEntries, this._mode));
-        else if (this._mode === WebInspector.ObjectTreeView.Mode.ClassAPI || this._mode === WebInspector.ObjectTreeView.Mode.PureAPI)
-            resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WebInspector.ObjectTreeView.Mode.ClassAPI));
+        else if (this._mode === WI.ObjectTreeView.Mode.ClassAPI || this._mode === WI.ObjectTreeView.Mode.PureAPI)
+            resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WI.ObjectTreeView.Mode.ClassAPI));
         else if (this.property.name === "__proto__")
-            resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WebInspector.ObjectTreeView.Mode.PrototypeAPI));
+            resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WI.ObjectTreeView.Mode.PrototypeAPI));
         else
             resolvedValue.getDisplayablePropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, this._mode));
     }
@@ -337,8 +337,8 @@
         this.removeChildren();
 
         if (!list) {
-            var errorMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("Could not fetch properties. Object may no longer exist."));
-            this.appendChild(new WebInspector.TreeElement(errorMessageElement, null, false));
+            var errorMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("Could not fetch properties. Object may no longer exist."));
+            this.appendChild(new WI.TreeElement(errorMessageElement, null, false));
             return;
         }
 
@@ -349,33 +349,33 @@
     {
         for (var entry of entries) {
             if (entry.key) {
-                this.appendChild(new WebInspector.ObjectTreeMapKeyTreeElement(entry.key, propertyPath));
-                this.appendChild(new WebInspector.ObjectTreeMapValueTreeElement(entry.value, propertyPath, entry.key));
+                this.appendChild(new WI.ObjectTreeMapKeyTreeElement(entry.key, propertyPath));
+                this.appendChild(new WI.ObjectTreeMapValueTreeElement(entry.value, propertyPath, entry.key));
             } else
-                this.appendChild(new WebInspector.ObjectTreeSetIndexTreeElement(entry.value, propertyPath));
+                this.appendChild(new WI.ObjectTreeSetIndexTreeElement(entry.value, propertyPath));
         }
 
         if (!this.children.length) {
-            var emptyMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Entries"));
-            this.appendChild(new WebInspector.TreeElement(emptyMessageElement, null, false));
+            var emptyMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("No Entries"));
+            this.appendChild(new WI.TreeElement(emptyMessageElement, null, false));
         }
 
         // Show the prototype so users can see the API.
         var resolvedValue = this.resolvedValue();
         resolvedValue.getOwnPropertyDescriptor("__proto__", (propertyDescriptor) => {
             if (propertyDescriptor)
-                this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode));
+                this.appendChild(new WI.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode));
         });
     }
 
     _updateProperties(properties, propertyPath, mode)
     {
-        properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+        properties.sort(WI.ObjectTreeView.comparePropertyDescriptors);
 
         var resolvedValue = this.resolvedValue();
         var isArray = resolvedValue.isArray();
-        var isPropertyMode = mode === WebInspector.ObjectTreeView.Mode.Properties || this._getterValue;
-        var isAPI = mode !== WebInspector.ObjectTreeView.Mode.Properties;
+        var isPropertyMode = mode === WI.ObjectTreeView.Mode.Properties || this._getterValue;
+        var isAPI = mode !== WI.ObjectTreeView.Mode.Properties;
 
         var prototypeName;
         if (this.property.name === "__proto__") {
@@ -398,19 +398,19 @@
 
             if (isArray && isPropertyMode) {
                 if (propertyDescriptor.isIndexProperty())
-                    this.appendChild(new WebInspector.ObjectTreeArrayIndexTreeElement(propertyDescriptor, propertyPath));
+                    this.appendChild(new WI.ObjectTreeArrayIndexTreeElement(propertyDescriptor, propertyPath));
                 else if (propertyDescriptor.name === "__proto__")
-                    this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode, prototypeName));
+                    this.appendChild(new WI.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode, prototypeName));
             } else
-                this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode, prototypeName));
+                this.appendChild(new WI.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode, prototypeName));
 
             if (propertyDescriptor.name === "__proto__")
                 hadProto = true;
         }
 
         if (!this.children.length || (hadProto && this.children.length === 1)) {
-            var emptyMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));
-            this.insertChild(new WebInspector.TreeElement(emptyMessageElement, null, false), 0);
+            var emptyMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("No Properties"));
+            this.insertChild(new WI.TreeElement(emptyMessageElement, null, false), 0);
         }
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js
index 7a5c8c7..ae22b2d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeSetIndexTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectTreeSetIndexTreeElement = class ObjectTreeSetIndexTreeElement extends WebInspector.ObjectTreeBaseTreeElement
+WI.ObjectTreeSetIndexTreeElement = class ObjectTreeSetIndexTreeElement extends WI.ObjectTreeBaseTreeElement
 {
     constructor(object, propertyPath)
     {
-        console.assert(object instanceof WebInspector.RemoteObject);
+        console.assert(object instanceof WI.RemoteObject);
 
         // Treat the same as an array-index just with different strings and widths.
         super(object, propertyPath);
@@ -69,7 +69,7 @@
         var nameElement = container.appendChild(document.createElement("span"));
         nameElement.className = "index-name";
         nameElement.textContent = "\u2022";
-        nameElement.title = WebInspector.UIString("Unable to determine path to property from root");
+        nameElement.title = WI.UIString("Unable to determine path to property from root");
 
         // Space. For copy/paste to have space between the bullet and value.
         container.append(" ");
@@ -77,7 +77,7 @@
         // Value.
         var valueElement = container.appendChild(document.createElement("span"));
         valueElement.className = "index-value";
-        valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object, propertyPath));
+        valueElement.appendChild(WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object, propertyPath));
 
         return container;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
index e68a874..a141459 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
@@ -23,20 +23,20 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ObjectTreeView = class ObjectTreeView extends WebInspector.Object
+WI.ObjectTreeView = class ObjectTreeView extends WI.Object
 {
     constructor(object, mode, propertyPath, forceExpanding)
     {
         super();
 
-        console.assert(object instanceof WebInspector.RemoteObject);
-        console.assert(!propertyPath || propertyPath instanceof WebInspector.PropertyPath);
+        console.assert(object instanceof WI.RemoteObject);
+        console.assert(!propertyPath || propertyPath instanceof WI.PropertyPath);
 
-        var providedPropertyPath = propertyPath instanceof WebInspector.PropertyPath;
+        var providedPropertyPath = propertyPath instanceof WI.PropertyPath;
 
         this._object = object;
-        this._mode = mode || WebInspector.ObjectTreeView.defaultModeForObject(object);
-        this._propertyPath = propertyPath || new WebInspector.PropertyPath(this._object, "this");
+        this._mode = mode || WI.ObjectTreeView.defaultModeForObject(object);
+        this._propertyPath = propertyPath || new WI.PropertyPath(this._object, "this");
         this._expanded = false;
         this._hasLosslessPreview = false;
         this._includeProtoProperty = true;
@@ -54,7 +54,7 @@
         this._element.className = "object-tree";
 
         if (this._object.preview) {
-            this._previewView = new WebInspector.ObjectPreviewView(this._object.preview);
+            this._previewView = new WI.ObjectPreviewView(this._object.preview);
             this._previewView.setOriginatingObjectInfo(this._object, providedPropertyPath ? propertyPath : null);
             this._previewView.element.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this));
             this._element.appendChild(this._previewView.element);
@@ -66,12 +66,12 @@
         } else {
             this._titleElement = document.createElement("span");
             this._titleElement.className = "title";
-            this._titleElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(this._object));
+            this._titleElement.appendChild(WI.FormattedValue.createElementForRemoteObject(this._object));
             this._titleElement.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this));
             this._element.appendChild(this._titleElement);
         }
 
-        this._outline = new WebInspector.TreeOutline;
+        this._outline = new WI.TreeOutline;
         this._outline.compact = true;
         this._outline.customIndent = true;
         this._outline.element.classList.add("object");
@@ -85,9 +85,9 @@
     static defaultModeForObject(object)
     {
         if (object.subtype === "class")
-            return WebInspector.ObjectTreeView.Mode.ClassAPI;
+            return WI.ObjectTreeView.Mode.ClassAPI;
 
-        return WebInspector.ObjectTreeView.Mode.Properties;
+        return WI.ObjectTreeView.Mode.Properties;
     }
 
     static createEmptyMessageElement(message)
@@ -246,11 +246,11 @@
 
     update()
     {
-        if (this._object.isCollectionType() && this._mode === WebInspector.ObjectTreeView.Mode.Properties)
+        if (this._object.isCollectionType() && this._mode === WI.ObjectTreeView.Mode.Properties)
             this._object.getCollectionEntries(0, 100, this._updateChildren.bind(this, this._updateEntries));
         else if (this._object.isClass())
             this._object.classPrototype.getDisplayablePropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
-        else if (this._mode === WebInspector.ObjectTreeView.Mode.PureAPI)
+        else if (this._mode === WI.ObjectTreeView.Mode.PureAPI)
             this._object.getOwnPropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
         else
             this._object.getDisplayablePropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
@@ -263,35 +263,35 @@
         this._outline.removeChildren();
 
         if (!list) {
-            var errorMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("Could not fetch properties. Object may no longer exist."));
-            this._outline.appendChild(new WebInspector.TreeElement(errorMessageElement, null, false));
+            var errorMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("Could not fetch properties. Object may no longer exist."));
+            this._outline.appendChild(new WI.TreeElement(errorMessageElement, null, false));
             return;
         }
 
         handler.call(this, list, this._propertyPath);
 
-        this.dispatchEventToListeners(WebInspector.ObjectTreeView.Event.Updated);
+        this.dispatchEventToListeners(WI.ObjectTreeView.Event.Updated);
     }
 
     _updateEntries(entries, propertyPath)
     {
         for (var entry of entries) {
             if (entry.key) {
-                this._outline.appendChild(new WebInspector.ObjectTreeMapKeyTreeElement(entry.key, propertyPath));
-                this._outline.appendChild(new WebInspector.ObjectTreeMapValueTreeElement(entry.value, propertyPath, entry.key));
+                this._outline.appendChild(new WI.ObjectTreeMapKeyTreeElement(entry.key, propertyPath));
+                this._outline.appendChild(new WI.ObjectTreeMapValueTreeElement(entry.value, propertyPath, entry.key));
             } else
-                this._outline.appendChild(new WebInspector.ObjectTreeSetIndexTreeElement(entry.value, propertyPath));
+                this._outline.appendChild(new WI.ObjectTreeSetIndexTreeElement(entry.value, propertyPath));
         }
 
         if (!this._outline.children.length) {
-            var emptyMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Entries"));
-            this._outline.appendChild(new WebInspector.TreeElement(emptyMessageElement, null, false));
+            var emptyMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("No Entries"));
+            this._outline.appendChild(new WI.TreeElement(emptyMessageElement, null, false));
         }
 
         // Show the prototype so users can see the API.
         this._object.getOwnPropertyDescriptor("__proto__", (propertyDescriptor) => {
             if (propertyDescriptor)
-                this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode));
+                this._outline.appendChild(new WI.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode));
         });
     }
 
@@ -300,10 +300,10 @@
         if (this._extraProperties)
             properties = properties.concat(this._extraProperties);
 
-        properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+        properties.sort(WI.ObjectTreeView.comparePropertyDescriptors);
 
         var isArray = this._object.isArray();
-        var isPropertyMode = this._mode === WebInspector.ObjectTreeView.Mode.Properties;
+        var isPropertyMode = this._mode === WI.ObjectTreeView.Mode.Properties;
 
         var hadProto = false;
         for (var propertyDescriptor of properties) {
@@ -319,16 +319,16 @@
 
             if (isArray && isPropertyMode) {
                 if (propertyDescriptor.isIndexProperty())
-                    this._outline.appendChild(new WebInspector.ObjectTreeArrayIndexTreeElement(propertyDescriptor, propertyPath));
+                    this._outline.appendChild(new WI.ObjectTreeArrayIndexTreeElement(propertyDescriptor, propertyPath));
                 else if (propertyDescriptor.name === "__proto__")
-                    this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode, this._prototypeNameOverride));
+                    this._outline.appendChild(new WI.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode, this._prototypeNameOverride));
             } else
-                this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode, this._prototypeNameOverride));
+                this._outline.appendChild(new WI.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode, this._prototypeNameOverride));
         }
 
         if (!this._outline.children.length || (hadProto && this._outline.children.length === 1)) {
-            var emptyMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));
-            this._outline.insertChild(new WebInspector.TreeElement(emptyMessageElement, null, false), 0);
+            var emptyMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("No Properties"));
+            this._outline.insertChild(new WI.TreeElement(emptyMessageElement, null, false), 0);
         }
     }
 
@@ -356,8 +356,8 @@
         this._trackingEntries = true;
 
         if (this._inConsole) {
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._untrackWeakEntries, this);
-            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.SessionStarted, this._untrackWeakEntries, this);
+            WI.logManager.addEventListener(WI.LogManager.Event.Cleared, this._untrackWeakEntries, this);
+            WI.logManager.addEventListener(WI.LogManager.Event.SessionStarted, this._untrackWeakEntries, this);
         }
     }
 
@@ -374,8 +374,8 @@
         this._object.releaseWeakCollectionEntries();
 
         if (this._inConsole) {
-            WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.Cleared, this._untrackWeakEntries, this);
-            WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.SessionStarted, this._untrackWeakEntries, this);
+            WI.logManager.removeEventListener(WI.LogManager.Event.Cleared, this._untrackWeakEntries, this);
+            WI.logManager.removeEventListener(WI.LogManager.Event.SessionStarted, this._untrackWeakEntries, this);
         }
 
         // FIXME: This only tries to release weak entries if this object was a WeakMap.
@@ -384,13 +384,13 @@
     }
 };
 
-WebInspector.ObjectTreeView.Mode = {
+WI.ObjectTreeView.Mode = {
     Properties: Symbol("object-tree-properties"),      // Properties
     PrototypeAPI: Symbol("object-tree-prototype-api"), // API view on a live object instance, so getters can be invoked.
     ClassAPI: Symbol("object-tree-class-api"),         // API view without an object instance, can not invoke getters.
     PureAPI: Symbol("object-tree-pure-api"),           // API view without special displayable property handling, just own properties. Getters can be invoked if the property path has a non-prototype object.
 };
 
-WebInspector.ObjectTreeView.Event = {
+WI.ObjectTreeView.Event = {
     Updated: "object-tree-updated",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js b/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js
index 58a72f7..98d7068 100644
--- a/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js
+++ b/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.OpenResourceDialog = class OpenResourceDialog extends WebInspector.Dialog
+WI.OpenResourceDialog = class OpenResourceDialog extends WI.Dialog
 {
     constructor(delegate)
     {
@@ -36,7 +36,7 @@
 
         this._inputElement = fieldElement.appendChild(document.createElement("input"));
         this._inputElement.type = "text";
-        this._inputElement.placeholder = WebInspector.UIString("File or Resource");
+        this._inputElement.placeholder = WI.UIString("File or Resource");
         this._inputElement.spellcheck = false;
 
         this._clearIconElement = fieldElement.appendChild(document.createElement("img"));
@@ -47,17 +47,17 @@
         this._clearIconElement.addEventListener("mousedown", this._handleMousedownEvent.bind(this));
         this._clearIconElement.addEventListener("click", this._handleClickEvent.bind(this));
 
-        this._treeOutline = new WebInspector.TreeOutline;
+        this._treeOutline = new WI.TreeOutline;
         this._treeOutline.allowsRepeatSelection = true;
         this._treeOutline.disclosureButtons = false;
         this._treeOutline.large = true;
 
-        this._treeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._treeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
         this._treeOutline.element.addEventListener("focus", () => { this._inputElement.focus(); });
 
         this.element.appendChild(this._treeOutline.element);
 
-        this._queryController = new WebInspector.ResourceQueryController;
+        this._queryController = new WI.ResourceQueryController;
         this._filteredResults = [];
     }
 
@@ -90,12 +90,12 @@
         {
             let treeElement = null;
 
-            if (representedObject instanceof WebInspector.SourceMapResource)
-                treeElement = new WebInspector.SourceMapResourceTreeElement(representedObject);
-            else if (representedObject instanceof WebInspector.Resource)
-                treeElement = new WebInspector.ResourceTreeElement(representedObject);
-            else if (representedObject instanceof WebInspector.Script)
-                treeElement = new WebInspector.ScriptTreeElement(representedObject);
+            if (representedObject instanceof WI.SourceMapResource)
+                treeElement = new WI.SourceMapResourceTreeElement(representedObject);
+            else if (representedObject instanceof WI.Resource)
+                treeElement = new WI.ResourceTreeElement(representedObject);
+            else if (representedObject instanceof WI.Script)
+                treeElement = new WI.ScriptTreeElement(representedObject);
 
             return treeElement;
         }
@@ -110,7 +110,7 @@
                 continue;
 
             treeElement.mainTitle = createHighlightedTitleFragment(resource.displayName, result.matchingTextRanges);
-            treeElement[WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol] = result.cookie;
+            treeElement[WI.OpenResourceDialog.ResourceMatchCookieDataSymbol] = result.cookie;
             this._treeOutline.appendChild(treeElement);
         }
 
@@ -120,26 +120,26 @@
 
     didDismissDialog()
     {
-        WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
-        WebInspector.Target.removeEventListener(WebInspector.Target.Event.ResourceAdded, this._resourceWasAdded, this);
-        WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
+        WI.Frame.removeEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.removeEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+        WI.Target.removeEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
+        WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
 
         this._queryController.reset();
     }
 
     didPresentDialog()
     {
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
-        WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded, this._resourceWasAdded, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+        WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
 
-        if (WebInspector.frameResourceManager.mainFrame)
-            this._addResourcesForFrame(WebInspector.frameResourceManager.mainFrame);
+        if (WI.frameResourceManager.mainFrame)
+            this._addResourcesForFrame(WI.frameResourceManager.mainFrame);
 
-        for (let target of WebInspector.targets) {
-            if (target !== WebInspector.mainTarget)
+        for (let target of WI.targets) {
+            if (target !== WI.mainTarget)
                 this._addResourcesForTarget(target);
         }
 
@@ -153,25 +153,25 @@
 
     _handleKeydownEvent(event)
     {
-        if (event.keyCode === WebInspector.KeyboardShortcut.Key.Escape.keyCode) {
+        if (event.keyCode === WI.KeyboardShortcut.Key.Escape.keyCode) {
             if (this._inputElement.value === "")
                 this.dismiss();
             else
                 this._clear();
 
             event.preventDefault();
-        } else if (event.keyCode === WebInspector.KeyboardShortcut.Key.Enter.keyCode) {
+        } else if (event.keyCode === WI.KeyboardShortcut.Key.Enter.keyCode) {
             if (this._treeOutline.selectedTreeElement) {
-                this.dismiss(this._treeOutline.selectedTreeElement.representedObject, this._treeOutline.selectedTreeElement[WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol]);
+                this.dismiss(this._treeOutline.selectedTreeElement.representedObject, this._treeOutline.selectedTreeElement[WI.OpenResourceDialog.ResourceMatchCookieDataSymbol]);
                 event.preventDefault();
                 return;
             }
 
             // ":<line>:<column>" jumps to a location for the current ContentView.
             if (/^:\d/.test(this._inputElement.value)) {
-                let visibleContentView = WebInspector.focusedOrVisibleContentView();
+                let visibleContentView = WI.focusedOrVisibleContentView();
                 let representedObject = visibleContentView ? visibleContentView.representedObject : null;
-                if (representedObject && representedObject instanceof WebInspector.SourceCode) {
+                if (representedObject && representedObject instanceof WI.SourceCode) {
                     let [, lineNumber, columnNumber] = this._inputElement.value.split(":");
                     lineNumber = lineNumber ? parseInt(lineNumber, 10) - 1 : 0;
                     columnNumber = columnNumber ? parseInt(columnNumber, 10) - 1 : 0;
@@ -182,12 +182,12 @@
             }
 
             this._inputElement.select();
-        } else if (event.keyCode === WebInspector.KeyboardShortcut.Key.Up.keyCode || event.keyCode === WebInspector.KeyboardShortcut.Key.Down.keyCode) {
+        } else if (event.keyCode === WI.KeyboardShortcut.Key.Up.keyCode || event.keyCode === WI.KeyboardShortcut.Key.Down.keyCode) {
             let treeElement = this._treeOutline.selectedTreeElement;
             if (!treeElement)
                 return;
 
-            let adjacentSiblingProperty = event.keyCode === WebInspector.KeyboardShortcut.Key.Up.keyCode ? "previousSibling" : "nextSibling";
+            let adjacentSiblingProperty = event.keyCode === WI.KeyboardShortcut.Key.Up.keyCode ? "previousSibling" : "nextSibling";
             treeElement = treeElement[adjacentSiblingProperty];
             if (treeElement)
                 treeElement.revealAndSelect(true, false, true, true);
@@ -198,7 +198,7 @@
 
     _handleKeyupEvent(event)
     {
-        if (event.keyCode === WebInspector.KeyboardShortcut.Key.Up.keyCode || event.keyCode === WebInspector.KeyboardShortcut.Key.Down.keyCode)
+        if (event.keyCode === WI.KeyboardShortcut.Key.Up.keyCode || event.keyCode === WI.KeyboardShortcut.Key.Down.keyCode)
             return;
 
         this._updateFilter();
@@ -257,7 +257,7 @@
         if (!event.data.selectedByUser)
             return;
 
-        this.dismiss(treeElement.representedObject, treeElement[WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol]);
+        this.dismiss(treeElement.representedObject, treeElement[WI.OpenResourceDialog.ResourceMatchCookieDataSymbol]);
     }
 
     _addResource(resource, suppressFilterUpdate)
@@ -296,7 +296,7 @@
         for (let resource of target.resourceCollection.items)
             this._addResource(resource, suppressFilterUpdate);
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(target);
+        let targetData = WI.debuggerManager.dataForTarget(target);
         for (let script of targetData.scripts) {
             if (script.resource)
                 continue;
@@ -325,11 +325,11 @@
         if (script.resource)
             return;
 
-        if (script.target === WebInspector.mainTarget)
+        if (script.target === WI.mainTarget)
             return;
 
         this._addResource(script);
     }
 };
 
-WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol = Symbol("open-resource-dialog-resource-match-cookie-data");
+WI.OpenResourceDialog.ResourceMatchCookieDataSymbol = Symbol("open-resource-dialog-resource-match-cookie-data");
diff --git a/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
index ca7fcf8..a895b77 100644
--- a/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.OverviewTimelineView = class OverviewTimelineView extends WebInspector.TimelineView
+WI.OverviewTimelineView = class OverviewTimelineView extends WI.TimelineView
 {
     constructor(recording, extraArguments)
     {
@@ -33,34 +33,34 @@
 
         let columns = {name: {}, graph: {}};
 
-        columns.name.title = WebInspector.UIString("Name");
+        columns.name.title = WI.UIString("Name");
         columns.name.width = "20%";
         columns.name.icon = true;
         columns.name.disclosure = true;
 
-        this._timelineRuler = new WebInspector.TimelineRuler;
+        this._timelineRuler = new WI.TimelineRuler;
         this._timelineRuler.allowsClippedLabels = true;
 
         columns.graph.width = "80%";
         columns.graph.headerView = this._timelineRuler;
 
-        this._dataGrid = new WebInspector.DataGrid(columns);
+        this._dataGrid = new WI.DataGrid(columns);
 
         this.setupDataGrid(this._dataGrid);
 
-        this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
+        this._currentTimeMarker = new WI.TimelineMarker(0, WI.TimelineMarker.Type.CurrentTime);
         this._timelineRuler.addMarker(this._currentTimeMarker);
 
         this.element.classList.add("overview");
         this.addSubview(this._dataGrid);
 
-        this._networkTimeline = recording.timelines.get(WebInspector.TimelineRecord.Type.Network);
+        this._networkTimeline = recording.timelines.get(WI.TimelineRecord.Type.Network);
         if (this._networkTimeline)
-            this._networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
+            this._networkTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
 
-        recording.addEventListener(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded, this._sourceCodeTimelineAdded, this);
-        recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
-        recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
+        recording.addEventListener(WI.TimelineRecording.Event.SourceCodeTimelineAdded, this._sourceCodeTimelineAdded, this);
+        recording.addEventListener(WI.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
+        recording.addEventListener(WI.TimelineRecording.Event.Reset, this._recordingReset, this);
 
         this._pendingRepresentedObjects = [];
         this._resourceDataGridNodeMap = new Map;
@@ -82,7 +82,7 @@
     {
         super.shown();
 
-        this._timelineRuler.updateLayout(WebInspector.View.LayoutReason.Resize);
+        this._timelineRuler.updateLayout(WI.View.LayoutReason.Resize);
     }
 
     closed()
@@ -101,12 +101,12 @@
         let pathComponents = [];
 
         while (dataGridNode && !dataGridNode.root) {
-            console.assert(dataGridNode instanceof WebInspector.TimelineDataGridNode);
+            console.assert(dataGridNode instanceof WI.TimelineDataGridNode);
             if (dataGridNode.hidden)
                 return null;
 
-            let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+            let pathComponent = new WI.TimelineDataGridNodePathComponent(dataGridNode);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
             pathComponents.unshift(pathComponent);
             dataGridNode = dataGridNode.parent;
         }
@@ -164,9 +164,9 @@
     {
         function getStartTime(dataGridNode)
         {
-            if (dataGridNode instanceof WebInspector.ResourceTimelineDataGridNode)
+            if (dataGridNode instanceof WI.ResourceTimelineDataGridNode)
                 return dataGridNode.resource.firstTimestamp;
-            if (dataGridNode instanceof WebInspector.SourceCodeTimelineTimelineDataGridNode)
+            if (dataGridNode instanceof WI.SourceCodeTimelineTimelineDataGridNode)
                 return dataGridNode.sourceCodeTimeline.startTime;
 
             console.error("Unknown data grid node.", dataGridNode);
@@ -209,11 +209,11 @@
 
         let resourceTimelineRecord = this._networkTimeline ? this._networkTimeline.recordForResource(resource) : null;
         if (!resourceTimelineRecord)
-            resourceTimelineRecord = new WebInspector.ResourceTimelineRecord(resource);
+            resourceTimelineRecord = new WI.ResourceTimelineRecord(resource);
 
         const includesGraph = true;
         const shouldShowPopover = false;
-        let resourceDataGridNode = new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord, includesGraph, this, shouldShowPopover);
+        let resourceDataGridNode = new WI.ResourceTimelineDataGridNode(resourceTimelineRecord, includesGraph, this, shouldShowPopover);
         this._resourceDataGridNodeMap.set(resource, resourceDataGridNode);
 
         let expandedByDefault = false;
@@ -244,7 +244,7 @@
     _addSourceCodeTimeline(sourceCodeTimeline)
     {
         let parentDataGridNode = sourceCodeTimeline.sourceCodeLocation ? this._addResourceToDataGridIfNeeded(sourceCodeTimeline.sourceCode) : null;
-        let sourceCodeTimelineDataGridNode = new WebInspector.SourceCodeTimelineTimelineDataGridNode(sourceCodeTimeline, this);
+        let sourceCodeTimelineDataGridNode = new WI.SourceCodeTimelineTimelineDataGridNode(sourceCodeTimeline, this);
         this._resourceDataGridNodeMap.set(sourceCodeTimeline, sourceCodeTimelineDataGridNode);
 
         this._insertDataGridNode(sourceCodeTimelineDataGridNode, parentDataGridNode);
@@ -256,9 +256,9 @@
             return;
 
         for (var representedObject of this._pendingRepresentedObjects) {
-            if (representedObject instanceof WebInspector.Resource)
+            if (representedObject instanceof WI.Resource)
                 this._addResourceToDataGridIfNeeded(representedObject);
-            else if (representedObject instanceof WebInspector.SourceCodeTimeline)
+            else if (representedObject instanceof WI.SourceCodeTimeline)
                 this._addSourceCodeTimeline(representedObject);
             else
                 console.error("Unknown represented object");
@@ -270,7 +270,7 @@
     _networkTimelineRecordAdded(event)
     {
         var resourceTimelineRecord = event.data.record;
-        console.assert(resourceTimelineRecord instanceof WebInspector.ResourceTimelineRecord);
+        console.assert(resourceTimelineRecord instanceof WI.ResourceTimelineRecord);
 
         this._pendingRepresentedObjects.push(resourceTimelineRecord.resource);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js b/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js
index b41fd6b..6f14f17 100644
--- a/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PinnedTabBarItem = class PinnedTabBarItem extends WebInspector.TabBarItem
+WI.PinnedTabBarItem = class PinnedTabBarItem extends WI.TabBarItem
 {
     constructor(image, title, representedObject)
     {
@@ -40,12 +40,12 @@
     {
         event.preventDefault();
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
-        this.dispatchEventToListeners(WebInspector.PinnedTabBarItem.Event.ContextMenu, {contextMenu});
+        this.dispatchEventToListeners(WI.PinnedTabBarItem.Event.ContextMenu, {contextMenu});
     }
 };
 
-WebInspector.PinnedTabBarItem.Event = {
+WI.PinnedTabBarItem.Event = {
     ContextMenu: "pinned-tab-bar-item-context-menu",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/Popover.js b/Source/WebInspectorUI/UserInterface/Views/Popover.js
index 0cee06e..084adca 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Popover.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Popover.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Popover = class Popover extends WebInspector.Object
+WI.Popover = class Popover extends WI.Object
 {
     constructor(delegate)
     {
@@ -31,10 +31,10 @@
 
         this.delegate = delegate;
         this._edge = null;
-        this._frame = new WebInspector.Rect;
+        this._frame = new WI.Rect;
         this._content = null;
-        this._targetFrame = new WebInspector.Rect;
-        this._anchorPoint = new WebInspector.Point;
+        this._targetFrame = new WI.Rect;
+        this._anchorPoint = new WI.Point;
         this._preferredEdges = null;
         this._resizeHandler = null;
 
@@ -63,7 +63,7 @@
 
     get visible()
     {
-        return this._element.parentNode === document.body && !this._element.classList.contains(WebInspector.Popover.FadeOutClassName);
+        return this._element.parentNode === document.body && !this._element.classList.contains(WI.Popover.FadeOutClassName);
     }
 
     set frame(frame)
@@ -151,9 +151,9 @@
         window.removeEventListener("resize", this, true);
         window.removeEventListener("keypress", this, true);
 
-        WebInspector.quickConsole.keyboardShortcutDisabled = false;
+        WI.quickConsole.keyboardShortcutDisabled = false;
 
-        this._element.classList.add(WebInspector.Popover.FadeOutClassName);
+        this._element.classList.add(WI.Popover.FadeOutClassName);
 
         if (this.delegate && typeof this.delegate.willDismissPopover === "function")
             this.delegate.willDismissPopover(this);
@@ -164,8 +164,8 @@
         switch (event.type) {
         case "mousedown":
         case "scroll":
-            if (!this._element.contains(event.target) && !event.target.enclosingNodeOrSelfWithClass(WebInspector.Popover.IgnoreAutoDismissClassName)
-                && !event[WebInspector.Popover.EventPreventDismissSymbol]) {
+            if (!this._element.contains(event.target) && !event.target.enclosingNodeOrSelfWithClass(WI.Popover.IgnoreAutoDismissClassName)
+                && !event[WI.Popover.EventPreventDismissSymbol]) {
                 this.dismiss();
             }
             break;
@@ -174,13 +174,13 @@
                 this._resizeHandler();
             break;
         case "keypress":
-            if (event.keyCode === WebInspector.KeyboardShortcut.Key.Escape.keyCode)
+            if (event.keyCode === WI.KeyboardShortcut.Key.Escape.keyCode)
                 this.dismiss();
             break;
         case "transitionend":
             if (event.target === this._element) {
                 document.body.removeChild(this._element);
-                this._element.classList.remove(WebInspector.Popover.FadeOutClassName);
+                this._element.classList.remove(WI.Popover.FadeOutClassName);
                 this._container.textContent = "";
                 if (this.delegate && typeof this.delegate.didDismissPopover === "function")
                     this.delegate.didDismissPopover(this);
@@ -207,7 +207,7 @@
         if (this._element.parentNode !== document.body)
             document.body.appendChild(this._element);
         else
-            this._element.classList.remove(WebInspector.Popover.FadeOutClassName);
+            this._element.classList.remove(WI.Popover.FadeOutClassName);
 
         this._dismissing = false;
 
@@ -225,18 +225,18 @@
 
             // Get the ideal size for the popover to fit its content.
             var popoverBounds = this._element.getBoundingClientRect();
-            this._preferredSize = new WebInspector.Size(Math.ceil(popoverBounds.width), Math.ceil(popoverBounds.height));
+            this._preferredSize = new WI.Size(Math.ceil(popoverBounds.width), Math.ceil(popoverBounds.height));
         }
 
-        var titleBarOffset = WebInspector.Platform.name === "mac" && WebInspector.Platform.version.release >= 10 ? 22 : 0;
-        var containerFrame = new WebInspector.Rect(0, titleBarOffset, window.innerWidth, window.innerHeight - titleBarOffset);
+        var titleBarOffset = WI.Platform.name === "mac" && WI.Platform.version.release >= 10 ? 22 : 0;
+        var containerFrame = new WI.Rect(0, titleBarOffset, window.innerWidth, window.innerHeight - titleBarOffset);
         // The frame of the window with a little inset to make sure we have room for shadows.
-        containerFrame = containerFrame.inset(WebInspector.Popover.ShadowEdgeInsets);
+        containerFrame = containerFrame.inset(WI.Popover.ShadowEdgeInsets);
 
         // Work out the metrics for all edges.
         var metrics = new Array(preferredEdges.length);
-        for (var edgeName in WebInspector.RectEdge) {
-            var edge = WebInspector.RectEdge[edgeName];
+        for (var edgeName in WI.RectEdge) {
+            var edge = WI.RectEdge[edgeName];
             var item = {
                 edge,
                 metrics: this._bestMetricsForEdge(this._preferredSize, targetFrame, containerFrame, edge)
@@ -269,22 +269,22 @@
 
         this._edge = bestEdge;
 
-        if (bestFrame === WebInspector.Rect.ZERO_RECT) {
+        if (bestFrame === WI.Rect.ZERO_RECT) {
             // The target for the popover is offscreen.
             this.dismiss();
         } else {
             switch (bestEdge) {
-            case WebInspector.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
-                anchorPoint = new WebInspector.Point(bestFrame.size.width - WebInspector.Popover.ShadowPadding, targetFrame.midY() - bestFrame.minY());
+            case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
+                anchorPoint = new WI.Point(bestFrame.size.width - WI.Popover.ShadowPadding, targetFrame.midY() - bestFrame.minY());
                 break;
-            case WebInspector.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
-                anchorPoint = new WebInspector.Point(WebInspector.Popover.ShadowPadding, targetFrame.midY() - bestFrame.minY());
+            case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
+                anchorPoint = new WI.Point(WI.Popover.ShadowPadding, targetFrame.midY() - bestFrame.minY());
                 break;
-            case WebInspector.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
-                anchorPoint = new WebInspector.Point(targetFrame.midX() - bestFrame.minX(), bestFrame.size.height - WebInspector.Popover.ShadowPadding);
+            case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
+                anchorPoint = new WI.Point(targetFrame.midX() - bestFrame.minX(), bestFrame.size.height - WI.Popover.ShadowPadding);
                 break;
-            case WebInspector.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
-                anchorPoint = new WebInspector.Point(targetFrame.midX() - bestFrame.minX(), WebInspector.Popover.ShadowPadding);
+            case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
+                anchorPoint = new WI.Point(targetFrame.midX() - bestFrame.minX(), WI.Popover.ShadowPadding);
                 break;
             }
 
@@ -299,7 +299,7 @@
             }
 
             // Make sure content is centered in case either of the dimension is smaller than the minimal bounds.
-            if (this._preferredSize.width < WebInspector.Popover.MinWidth || this._preferredSize.height < WebInspector.Popover.MinHeight)
+            if (this._preferredSize.width < WI.Popover.MinWidth || this._preferredSize.height < WI.Popover.MinHeight)
                 this._container.classList.add("center");
             else
                 this._container.classList.remove("center");
@@ -318,13 +318,13 @@
     _cssClassNameForEdge()
     {
         switch (this._edge) {
-        case WebInspector.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
+        case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
             return "arrow-right";
-        case WebInspector.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
+        case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
             return "arrow-left";
-        case WebInspector.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
+        case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
             return "arrow-down";
-        case WebInspector.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
+        case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
             return "arrow-up";
         }
         console.error("Unknown edge.");
@@ -343,7 +343,7 @@
         var startTime = Date.now();
         var duration = 350;
         var epsilon = 1 / (200 * duration);
-        var spline = new WebInspector.CubicBezier(0.25, 0.1, 0.25, 1);
+        var spline = new WI.CubicBezier(0.25, 0.1, 0.25, 1);
 
         var fromFrame = this._frame.copy();
         var fromAnchor = this._anchorPoint.copy();
@@ -357,14 +357,14 @@
         {
             var progress = spline.solve(Math.min((Date.now() - startTime) / duration, 1), epsilon);
 
-            this.frame = new WebInspector.Rect(
+            this.frame = new WI.Rect(
                 animatedValue(fromFrame.minX(), toFrame.minX(), progress),
                 animatedValue(fromFrame.minY(), toFrame.minY(), progress),
                 animatedValue(fromFrame.size.width, toFrame.size.width, progress),
                 animatedValue(fromFrame.size.height, toFrame.size.height, progress)
             ).round();
 
-            this._setAnchorPoint(new WebInspector.Point(
+            this._setAnchorPoint(new WI.Point(
                 animatedValue(fromAnchor.x, toAnchor.x, progress),
                 animatedValue(fromAnchor.y, toAnchor.y, progress)
             ));
@@ -399,23 +399,23 @@
         // Bounds of the path don't take into account the arrow, but really only the tight bounding box
         // of the content contained within the frame.
         var bounds;
-        var arrowHeight = WebInspector.Popover.AnchorSize.height;
+        var arrowHeight = WI.Popover.AnchorSize.height;
         switch (this._edge) {
-        case WebInspector.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
-            bounds = new WebInspector.Rect(0, 0, width - arrowHeight, height);
+        case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
+            bounds = new WI.Rect(0, 0, width - arrowHeight, height);
             break;
-        case WebInspector.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
-            bounds = new WebInspector.Rect(arrowHeight, 0, width - arrowHeight, height);
+        case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
+            bounds = new WI.Rect(arrowHeight, 0, width - arrowHeight, height);
             break;
-        case WebInspector.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
-            bounds = new WebInspector.Rect(0, 0, width, height - arrowHeight);
+        case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
+            bounds = new WI.Rect(0, 0, width, height - arrowHeight);
             break;
-        case WebInspector.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
-            bounds = new WebInspector.Rect(0, arrowHeight, width, height - arrowHeight);
+        case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
+            bounds = new WI.Rect(0, arrowHeight, width, height - arrowHeight);
             break;
         }
 
-        bounds = bounds.inset(WebInspector.Popover.ShadowEdgeInsets);
+        bounds = bounds.inset(WI.Popover.ShadowEdgeInsets);
 
         // Clip the frame.
         ctx.fillStyle = "black";
@@ -448,34 +448,34 @@
     _bestMetricsForEdge(preferredSize, targetFrame, containerFrame, edge)
     {
         var x, y;
-        var width = preferredSize.width + (WebInspector.Popover.ShadowPadding * 2) + (WebInspector.Popover.ContentPadding * 2);
-        var height = preferredSize.height + (WebInspector.Popover.ShadowPadding * 2) + (WebInspector.Popover.ContentPadding * 2);
-        var arrowLength = WebInspector.Popover.AnchorSize.height;
+        var width = preferredSize.width + (WI.Popover.ShadowPadding * 2) + (WI.Popover.ContentPadding * 2);
+        var height = preferredSize.height + (WI.Popover.ShadowPadding * 2) + (WI.Popover.ContentPadding * 2);
+        var arrowLength = WI.Popover.AnchorSize.height;
 
         switch (edge) {
-        case WebInspector.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
+        case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
             width += arrowLength;
-            x = targetFrame.origin.x - width + WebInspector.Popover.ShadowPadding;
+            x = targetFrame.origin.x - width + WI.Popover.ShadowPadding;
             y = targetFrame.origin.y - (height - targetFrame.size.height) / 2;
             break;
-        case WebInspector.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
+        case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
             width += arrowLength;
-            x = targetFrame.origin.x + targetFrame.size.width - WebInspector.Popover.ShadowPadding;
+            x = targetFrame.origin.x + targetFrame.size.width - WI.Popover.ShadowPadding;
             y = targetFrame.origin.y - (height - targetFrame.size.height) / 2;
             break;
-        case WebInspector.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
+        case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
             height += arrowLength;
             x = targetFrame.origin.x - (width - targetFrame.size.width) / 2;
-            y = targetFrame.origin.y - height + WebInspector.Popover.ShadowPadding;
+            y = targetFrame.origin.y - height + WI.Popover.ShadowPadding;
             break;
-        case WebInspector.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
+        case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
             height += arrowLength;
             x = targetFrame.origin.x - (width - targetFrame.size.width) / 2;
-            y = targetFrame.origin.y + targetFrame.size.height - WebInspector.Popover.ShadowPadding;
+            y = targetFrame.origin.y + targetFrame.size.height - WI.Popover.ShadowPadding;
             break;
         }
 
-        if (edge === WebInspector.RectEdge.MIN_X || edge === WebInspector.RectEdge.MAX_X) {
+        if (edge === WI.RectEdge.MIN_X || edge === WI.RectEdge.MAX_X) {
             if (y < containerFrame.minY())
                 y = containerFrame.minY();
             if (y + height > containerFrame.maxY())
@@ -487,45 +487,45 @@
                 x = containerFrame.maxX() - width;
         }
 
-        var preferredFrame = new WebInspector.Rect(x, y, width, height);
+        var preferredFrame = new WI.Rect(x, y, width, height);
         var bestFrame = preferredFrame.intersectionWithRect(containerFrame);
 
-        width = bestFrame.size.width - (WebInspector.Popover.ShadowPadding * 2);
-        height = bestFrame.size.height - (WebInspector.Popover.ShadowPadding * 2);
+        width = bestFrame.size.width - (WI.Popover.ShadowPadding * 2);
+        height = bestFrame.size.height - (WI.Popover.ShadowPadding * 2);
 
         switch (edge) {
-        case WebInspector.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
-        case WebInspector.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
+        case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
+        case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
             width -= arrowLength;
             break;
-        case WebInspector.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
-        case WebInspector.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
+        case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
+        case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
             height -= arrowLength;
             break;
         }
 
         return {
             frame: bestFrame,
-            contentSize: new WebInspector.Size(width, height)
+            contentSize: new WI.Size(width, height)
         };
     }
 
     _drawFrame(ctx, bounds, anchorEdge)
     {
-        let cornerRadius = WebInspector.Popover.CornerRadius;
-        let arrowHalfLength = WebInspector.Popover.AnchorSize.width * 0.5;
+        let cornerRadius = WI.Popover.CornerRadius;
+        let arrowHalfLength = WI.Popover.AnchorSize.width * 0.5;
         let anchorPoint = this._anchorPoint;
 
         // Prevent the arrow from being positioned against one of the popover's rounded corners.
         let arrowPadding = cornerRadius + arrowHalfLength;
-        if (anchorEdge === WebInspector.RectEdge.MIN_Y || anchorEdge === WebInspector.RectEdge.MAX_Y)
+        if (anchorEdge === WI.RectEdge.MIN_Y || anchorEdge === WI.RectEdge.MAX_Y)
             anchorPoint.x = Number.constrain(anchorPoint.x, bounds.minX() + arrowPadding, bounds.maxX() - arrowPadding);
         else
             anchorPoint.y = Number.constrain(anchorPoint.y, bounds.minY() + arrowPadding, bounds.maxY() - arrowPadding);
 
         ctx.beginPath();
         switch (anchorEdge) {
-        case WebInspector.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
+        case WI.RectEdge.MIN_X: // Displayed on the left of the target, arrow points right.
             ctx.moveTo(bounds.maxX(), bounds.minY() + cornerRadius);
             ctx.lineTo(bounds.maxX(), anchorPoint.y - arrowHalfLength);
             ctx.lineTo(anchorPoint.x, anchorPoint.y);
@@ -535,7 +535,7 @@
             ctx.arcTo(bounds.minX(), bounds.minY(), bounds.maxX(), bounds.minY(), cornerRadius);
             ctx.arcTo(bounds.maxX(), bounds.minY(), bounds.maxX(), bounds.maxY(), cornerRadius);
             break;
-        case WebInspector.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
+        case WI.RectEdge.MAX_X: // Displayed on the right of the target, arrow points left.
             ctx.moveTo(bounds.minX(), bounds.maxY() - cornerRadius);
             ctx.lineTo(bounds.minX(), anchorPoint.y + arrowHalfLength);
             ctx.lineTo(anchorPoint.x, anchorPoint.y);
@@ -545,7 +545,7 @@
             ctx.arcTo(bounds.maxX(), bounds.maxY(), bounds.minX(), bounds.maxY(), cornerRadius);
             ctx.arcTo(bounds.minX(), bounds.maxY(), bounds.minX(), bounds.minY(), cornerRadius);
             break;
-        case WebInspector.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
+        case WI.RectEdge.MIN_Y: // Displayed above the target, arrow points down.
             ctx.moveTo(bounds.maxX() - cornerRadius, bounds.maxY());
             ctx.lineTo(anchorPoint.x + arrowHalfLength, bounds.maxY());
             ctx.lineTo(anchorPoint.x, anchorPoint.y);
@@ -555,7 +555,7 @@
             ctx.arcTo(bounds.maxX(), bounds.minY(), bounds.maxX(), bounds.maxY(), cornerRadius);
             ctx.arcTo(bounds.maxX(), bounds.maxY(), bounds.minX(), bounds.maxY(), cornerRadius);
             break;
-        case WebInspector.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
+        case WI.RectEdge.MAX_Y: // Displayed below the target, arrow points up.
             ctx.moveTo(bounds.minX() + cornerRadius, bounds.minY());
             ctx.lineTo(anchorPoint.x - arrowHalfLength, bounds.minY());
             ctx.lineTo(anchorPoint.x, anchorPoint.y);
@@ -579,18 +579,18 @@
             window.addEventListener("resize", this, true);
             window.addEventListener("keypress", this, true);
 
-            WebInspector.quickConsole.keyboardShortcutDisabled = true;
+            WI.quickConsole.keyboardShortcutDisabled = true;
         }
     }
 };
 
-WebInspector.Popover.FadeOutClassName = "fade-out";
-WebInspector.Popover.CornerRadius = 5;
-WebInspector.Popover.MinWidth = 40;
-WebInspector.Popover.MinHeight = 40;
-WebInspector.Popover.ShadowPadding = 5;
-WebInspector.Popover.ContentPadding = 5;
-WebInspector.Popover.AnchorSize = new WebInspector.Size(22, 11);
-WebInspector.Popover.ShadowEdgeInsets = new WebInspector.EdgeInsets(WebInspector.Popover.ShadowPadding);
-WebInspector.Popover.IgnoreAutoDismissClassName = "popover-ignore-auto-dismiss";
-WebInspector.Popover.EventPreventDismissSymbol = Symbol("popover-event-prevent-dismiss");
+WI.Popover.FadeOutClassName = "fade-out";
+WI.Popover.CornerRadius = 5;
+WI.Popover.MinWidth = 40;
+WI.Popover.MinHeight = 40;
+WI.Popover.ShadowPadding = 5;
+WI.Popover.ContentPadding = 5;
+WI.Popover.AnchorSize = new WI.Size(22, 11);
+WI.Popover.ShadowEdgeInsets = new WI.EdgeInsets(WI.Popover.ShadowPadding);
+WI.Popover.IgnoreAutoDismissClassName = "popover-ignore-auto-dismiss";
+WI.Popover.EventPreventDismissSymbol = Symbol("popover-event-prevent-dismiss");
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProbeDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/ProbeDetailsSidebarPanel.js
index 08bc329..5bdd39f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProbeDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProbeDetailsSidebarPanel.js
@@ -24,11 +24,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeDetailsSidebarPanel = class ProbeDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.ProbeDetailsSidebarPanel = class ProbeDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("probe", WebInspector.UIString("Probes"));
+        super("probe", WI.UIString("Probes"));
 
         this._probeSetSections = new Map;
         this._inspectedProbeSets = [];
@@ -62,7 +62,7 @@
             objects = [objects];
 
         var inspectedProbeSets = objects.filter(function(object) {
-            return object instanceof WebInspector.ProbeSet;
+            return object instanceof WI.ProbeSet;
         });
 
         inspectedProbeSets.sort(function sortBySourceLocation(aProbeSet, bProbeSet) {
@@ -90,11 +90,11 @@
     {
         super.initialLayout();
 
-        WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetAdded, this._probeSetAdded, this);
-        WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetRemoved, this._probeSetRemoved, this);
+        WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetAdded, this._probeSetAdded, this);
+        WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetRemoved, this._probeSetRemoved, this);
 
         // Initialize sidebar sections for probe sets that already exist.
-        for (var probeSet of WebInspector.probeManager.probeSets)
+        for (var probeSet of WI.probeManager.probeSets)
             this._probeSetAdded(probeSet);
     }
 
@@ -112,13 +112,13 @@
     _probeSetAdded(probeSetOrEvent)
     {
         var probeSet;
-        if (probeSetOrEvent instanceof WebInspector.ProbeSet)
+        if (probeSetOrEvent instanceof WI.ProbeSet)
             probeSet = probeSetOrEvent;
         else
             probeSet = probeSetOrEvent.data.probeSet;
         console.assert(!this._probeSetSections.has(probeSet), "New probe group ", probeSet, " already has its own sidebar.");
 
-        var newSection = new WebInspector.ProbeSetDetailsSection(probeSet);
+        var newSection = new WI.ProbeSetDetailsSection(probeSet);
         this._probeSetSections.set(probeSet, newSection);
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGrid.js b/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGrid.js
index 6f2252f..c07c158 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGrid.js
@@ -24,15 +24,15 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSetDataGrid = class ProbeSetDataGrid extends WebInspector.DataGrid
+WI.ProbeSetDataGrid = class ProbeSetDataGrid extends WI.DataGrid
 {
     constructor(probeSet)
     {
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Invalid ProbeSet argument: ", probeSet);
+        console.assert(probeSet instanceof WI.ProbeSet, "Invalid ProbeSet argument: ", probeSet);
 
         var columns = {};
         for (var probe of probeSet.probes) {
-            var title = probe.expression || WebInspector.UIString("(uninitialized)");
+            var title = probe.expression || WI.UIString("(uninitialized)");
             columns[probe.id] = {title};
         }
 
@@ -46,11 +46,11 @@
         this._lastUpdatedFrame = null;
         this._nodesSinceLastNavigation = [];
 
-        this._listenerSet = new WebInspector.EventListenerSet(this, "ProbeSetDataGrid instance listeners");
-        this._listenerSet.register(probeSet, WebInspector.ProbeSet.Event.ProbeAdded, this._setupProbe);
-        this._listenerSet.register(probeSet, WebInspector.ProbeSet.Event.ProbeRemoved, this._teardownProbe);
-        this._listenerSet.register(probeSet, WebInspector.ProbeSet.Event.SamplesCleared, this._setupData);
-        this._listenerSet.register(WebInspector.Probe, WebInspector.Probe.Event.ExpressionChanged, this._probeExpressionChanged);
+        this._listenerSet = new WI.EventListenerSet(this, "ProbeSetDataGrid instance listeners");
+        this._listenerSet.register(probeSet, WI.ProbeSet.Event.ProbeAdded, this._setupProbe);
+        this._listenerSet.register(probeSet, WI.ProbeSet.Event.ProbeRemoved, this._teardownProbe);
+        this._listenerSet.register(probeSet, WI.ProbeSet.Event.SamplesCleared, this._setupData);
+        this._listenerSet.register(WI.Probe, WI.Probe.Event.ExpressionChanged, this._probeExpressionChanged);
         this._listenerSet.install();
 
         this._setupData();
@@ -92,10 +92,10 @@
         for (var frame of this._data.frames)
             this._updateNodeForFrame(frame);
 
-        this._dataListeners = new WebInspector.EventListenerSet(this, "ProbeSetDataGrid data table listeners");
-        this._dataListeners.register(this._data, WebInspector.ProbeSetDataTable.Event.FrameInserted, this._dataFrameInserted);
-        this._dataListeners.register(this._data, WebInspector.ProbeSetDataTable.Event.SeparatorInserted, this._dataSeparatorInserted);
-        this._dataListeners.register(this._data, WebInspector.ProbeSetDataTable.Event.WillRemove, this._teardownData);
+        this._dataListeners = new WI.EventListenerSet(this, "ProbeSetDataGrid data table listeners");
+        this._dataListeners.register(this._data, WI.ProbeSetDataTable.Event.FrameInserted, this._dataFrameInserted);
+        this._dataListeners.register(this._data, WI.ProbeSetDataTable.Event.SeparatorInserted, this._dataSeparatorInserted);
+        this._dataListeners.register(this._data, WI.ProbeSetDataTable.Event.WillRemove, this._teardownData);
         this._dataListeners.install();
     }
 
@@ -109,20 +109,20 @@
 
     _updateNodeForFrame(frame)
     {
-        console.assert(frame instanceof WebInspector.ProbeSetDataFrame, "Invalid ProbeSetDataFrame argument: ", frame);
+        console.assert(frame instanceof WI.ProbeSetDataFrame, "Invalid ProbeSetDataFrame argument: ", frame);
         var node = null;
         if (this._frameNodes.has(frame)) {
             node = this._frameNodes.get(frame);
             node.frame = frame;
             node.refresh();
         } else {
-            node = new WebInspector.ProbeSetDataGridNode(this);
+            node = new WI.ProbeSetDataGridNode(this);
             node.frame = frame;
             this._frameNodes.set(frame, node);
             node.createCells();
 
             var sortFunction = function(a, b) {
-                return WebInspector.ProbeSetDataFrame.compare(a.frame, b.frame);
+                return WI.ProbeSetDataFrame.compare(a.frame, b.frame);
             };
             var insertionIndex = insertionIndexForObjectInListSortedByFunction(node, this.children, sortFunction);
             if (insertionIndex === this.children.length)
@@ -141,7 +141,7 @@
         node.element.classList.add("data-updated");
         window.setTimeout(function() {
             node.element.classList.remove("data-updated");
-        }, WebInspector.ProbeSetDataGrid.DataUpdatedAnimationDuration);
+        }, WI.ProbeSetDataGrid.DataUpdatedAnimationDuration);
 
         this._nodesSinceLastNavigation.push(node);
     }
@@ -190,4 +190,4 @@
     }
 };
 
-WebInspector.ProbeSetDataGrid.DataUpdatedAnimationDuration = 300; // milliseconds
+WI.ProbeSetDataGrid.DataUpdatedAnimationDuration = 300; // milliseconds
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGridNode.js
index 97d45a6..b69dbd1 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGridNode.js
@@ -24,11 +24,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSetDataGridNode = class ProbeSetDataGridNode extends WebInspector.DataGridNode
+WI.ProbeSetDataGridNode = class ProbeSetDataGridNode extends WI.DataGridNode
 {
     constructor(dataGrid)
     {
-        console.assert(dataGrid instanceof WebInspector.ProbeSetDataGrid, "Invalid ProbeSetDataGrid argument:", dataGrid);
+        console.assert(dataGrid instanceof WI.ProbeSetDataGrid, "Invalid ProbeSetDataGrid argument:", dataGrid);
 
         super();
         this.dataGrid = dataGrid; // This is set to null in DataGridNode's constructor.
@@ -53,14 +53,14 @@
 
     set frame(value)
     {
-        console.assert(value instanceof WebInspector.ProbeSetDataFrame, "Invalid ProbeSetDataFrame argument: ", value);
+        console.assert(value instanceof WI.ProbeSetDataFrame, "Invalid ProbeSetDataFrame argument: ", value);
         this._frame = value;
 
         var data = {};
         for (var probe of this.dataGrid.probeSet.probes) {
             var sample = this.frame[probe.id];
             if (!sample || !sample.object)
-                data[probe.id] = WebInspector.ProbeSetDataFrame.MissingValue;
+                data[probe.id] = WI.ProbeSetDataFrame.MissingValue;
             else
                 data[probe.id] = sample.object;
         }
@@ -75,13 +75,13 @@
     createCellContent(columnIdentifier, cell)
     {
         var sample = this.data[columnIdentifier];
-        if (sample === WebInspector.ProbeSetDataFrame.MissingValue) {
+        if (sample === WI.ProbeSetDataFrame.MissingValue) {
             cell.classList.add("unknown-value");
             return sample;
         }
 
-        if (sample instanceof WebInspector.RemoteObject)
-            return WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(sample, null);
+        if (sample instanceof WI.RemoteObject)
+            return WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(sample, null);
 
         return sample;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProbeSetDetailsSection.js b/Source/WebInspectorUI/UserInterface/Views/ProbeSetDetailsSection.js
index 69ab0ae..0439ca5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProbeSetDetailsSection.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProbeSetDetailsSection.js
@@ -24,51 +24,51 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSetDetailsSection = class ProbeSetDetailsSection extends WebInspector.DetailsSection
+WI.ProbeSetDetailsSection = class ProbeSetDetailsSection extends WI.DetailsSection
 {
     constructor(probeSet)
     {
-        console.assert(probeSet instanceof WebInspector.ProbeSet, "Invalid ProbeSet argument:", probeSet);
+        console.assert(probeSet instanceof WI.ProbeSet, "Invalid ProbeSet argument:", probeSet);
 
         var optionsElement = document.createElement("div");
-        var dataGrid = new WebInspector.ProbeSetDataGrid(probeSet);
+        var dataGrid = new WI.ProbeSetDataGrid(probeSet);
 
-        var singletonRow = new WebInspector.DetailsSectionRow;
+        var singletonRow = new WI.DetailsSectionRow;
         singletonRow.element.appendChild(dataGrid.element);
 
-        var probeSectionGroup = new WebInspector.DetailsSectionGroup([singletonRow]);
+        var probeSectionGroup = new WI.DetailsSectionGroup([singletonRow]);
 
         super("probe", "", [probeSectionGroup], optionsElement);
 
         this.element.classList.add("probe-set");
 
-        this._listenerSet = new WebInspector.EventListenerSet(this, "ProbeSetDetailsSection UI listeners");
+        this._listenerSet = new WI.EventListenerSet(this, "ProbeSetDetailsSection UI listeners");
         this._probeSet = probeSet;
         this._dataGrid = dataGrid;
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this._optionsElement.appendChild(this._navigationBar.element);
 
-        this._addProbeButtonItem = new WebInspector.ButtonNavigationItem("add-probe", WebInspector.UIString("Add probe expression"), "Images/Plus13.svg", 13, 13);
-        this._addProbeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._addProbeButtonClicked, this);
+        this._addProbeButtonItem = new WI.ButtonNavigationItem("add-probe", WI.UIString("Add probe expression"), "Images/Plus13.svg", 13, 13);
+        this._addProbeButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._addProbeButtonClicked, this);
         this._navigationBar.addNavigationItem(this._addProbeButtonItem);
 
-        this._clearSamplesButtonItem = new WebInspector.ButtonNavigationItem("clear-samples", WebInspector.UIString("Clear samples"), "Images/NavigationItemTrash.svg", 14, 14);
-        this._clearSamplesButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearSamplesButtonClicked, this);
+        this._clearSamplesButtonItem = new WI.ButtonNavigationItem("clear-samples", WI.UIString("Clear samples"), "Images/NavigationItemTrash.svg", 14, 14);
+        this._clearSamplesButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._clearSamplesButtonClicked, this);
         this._clearSamplesButtonItem.enabled = this._probeSetHasSamples();
         this._navigationBar.addNavigationItem(this._clearSamplesButtonItem);
 
-        this._removeProbeButtonItem = new WebInspector.ButtonNavigationItem("remove-probe", WebInspector.UIString("Remove probe"), "Images/CloseLarge.svg", 12, 12);
-        this._removeProbeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._removeProbeButtonClicked, this);
+        this._removeProbeButtonItem = new WI.ButtonNavigationItem("remove-probe", WI.UIString("Remove probe"), "Images/CloseLarge.svg", 12, 12);
+        this._removeProbeButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._removeProbeButtonClicked, this);
         this._navigationBar.addNavigationItem(this._removeProbeButtonItem);
 
-        this._listenerSet.register(this._probeSet, WebInspector.ProbeSet.Event.SampleAdded, this._probeSetSamplesChanged);
-        this._listenerSet.register(this._probeSet, WebInspector.ProbeSet.Event.SamplesCleared, this._probeSetSamplesChanged);
+        this._listenerSet.register(this._probeSet, WI.ProbeSet.Event.SampleAdded, this._probeSetSamplesChanged);
+        this._listenerSet.register(this._probeSet, WI.ProbeSet.Event.SamplesCleared, this._probeSetSamplesChanged);
 
         // Update the source link when the breakpoint's resolved state changes,
         // so that it can become a live location link when possible.
         this._updateLinkElement();
-        this._listenerSet.register(this._probeSet.breakpoint, WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._updateLinkElement);
+        this._listenerSet.register(this._probeSet.breakpoint, WI.Breakpoint.Event.ResolvedStateDidChange, this._updateLinkElement);
 
         this._listenerSet.install();
     }
@@ -100,15 +100,15 @@
 
         var breakpoint = this._probeSet.breakpoint;
         if (breakpoint.sourceCodeLocation.sourceCode)
-            this.titleElement = WebInspector.createSourceCodeLocationLink(breakpoint.sourceCodeLocation, options);
+            this.titleElement = WI.createSourceCodeLocationLink(breakpoint.sourceCodeLocation, options);
         else {
             // Fallback for when we can't create a live source link.
             console.assert(!breakpoint.resolved);
 
-            this.titleElement = WebInspector.linkifyLocation(breakpoint.contentIdentifier, breakpoint.sourceCodeLocation.position, options);
+            this.titleElement = WI.linkifyLocation(breakpoint.contentIdentifier, breakpoint.sourceCodeLocation.position, options);
         }
 
-        this.titleElement.classList.add(WebInspector.ProbeSetDetailsSection.DontFloatLinkStyleClassName);
+        this.titleElement.classList.add(WI.ProbeSetDetailsSection.DontFloatLinkStyleClassName);
     }
 
     _addProbeButtonClicked(event)
@@ -122,21 +122,21 @@
             visiblePopover.dismiss();
         }
 
-        let popover = new WebInspector.Popover;
+        let popover = new WI.Popover;
         let content = document.createElement("div");
-        content.classList.add(WebInspector.ProbeSetDetailsSection.ProbePopoverElementStyleClassName);
-        content.createChild("div").textContent = WebInspector.UIString("Add New Probe Expression");
+        content.classList.add(WI.ProbeSetDetailsSection.ProbePopoverElementStyleClassName);
+        content.createChild("div").textContent = WI.UIString("Add New Probe Expression");
         let textBox = content.createChild("input");
         textBox.addEventListener("keypress", createProbeFromEnteredExpression.bind(this, popover));
         textBox.addEventListener("click", function (event) { event.target.select(); });
         textBox.type = "text";
-        textBox.placeholder = WebInspector.UIString("Expression");
+        textBox.placeholder = WI.UIString("Expression");
         popover.content = content;
-        let target = WebInspector.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());
-        popover.present(target, [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+        let target = WI.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());
+        popover.present(target, [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]);
         popover.windowResizeHandler = () => {
-            let target = WebInspector.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());
-            popover.present(target, [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+            let target = WI.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());
+            popover.present(target, [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]);
         };
         textBox.select();
     }
@@ -162,5 +162,5 @@
     }
 };
 
-WebInspector.ProbeSetDetailsSection.DontFloatLinkStyleClassName = "dont-float";
-WebInspector.ProbeSetDetailsSection.ProbePopoverElementStyleClassName = "probe-popover";
+WI.ProbeSetDetailsSection.DontFloatLinkStyleClassName = "dont-float";
+WI.ProbeSetDetailsSection.ProbePopoverElementStyleClassName = "probe-popover";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js
index f9ac9a1..76f5beb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js
@@ -23,7 +23,7 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.ProfileDataGridNode = class ProfileDataGridNode extends WebInspector.DataGridNode
+WI.ProfileDataGridNode = class ProfileDataGridNode extends WI.DataGridNode
 {
     constructor(callingContextTreeNode, tree)
     {
@@ -52,15 +52,15 @@
     {
         let title = this._node.name;
         if (!title)
-            return WebInspector.UIString("(anonymous function)");
+            return WI.UIString("(anonymous function)");
         if (title === "(program)")
-            return WebInspector.UIString("(program)");
+            return WI.UIString("(program)");
         return title;
     }
 
     iconClassName()
     {
-        let script = WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID, WebInspector.assumingMainTarget());
+        let script = WI.debuggerManager.scriptForIdentifier(this._node.sourceID, WI.assumingMainTarget());
         if (!script || !script.url)
             return "native-icon";
         if (this._node.name === "(program)")
@@ -111,14 +111,14 @@
     appendContextMenuItems(contextMenu)
     {
         let disableFocus = this === this._tree.currentFocusNode;
-        contextMenu.appendItem(WebInspector.UIString("Focus on Subtree"), () => {
+        contextMenu.appendItem(WI.UIString("Focus on Subtree"), () => {
             this._tree.addFocusNode(this);
         }, disableFocus);
 
         // FIXME: <https://webkit.org/b/155072> Web Inspector: Charge to Caller should work with Bottom Up Profile View
-        let disableChargeToCaller = this._tree.callingContextTree.type === WebInspector.CallingContextTree.Type.BottomUp;
-        contextMenu.appendItem(WebInspector.UIString("Charge ‘%s’ to Callers").format(this.displayName()), () => {
-            this._tree.addModifier({type: WebInspector.ProfileDataGridTree.ModifierType.ChargeToCaller, source: this._node});
+        let disableChargeToCaller = this._tree.callingContextTree.type === WI.CallingContextTree.Type.BottomUp;
+        contextMenu.appendItem(WI.UIString("Charge ‘%s’ to Callers").format(this.displayName()), () => {
+            this._tree.addModifier({type: WI.ProfileDataGridTree.ModifierType.ChargeToCaller, source: this._node});
         }, disableChargeToCaller);
 
         contextMenu.appendSeparator();
@@ -130,7 +130,7 @@
     {
         if (columnIdentifier === "function") {
             let filterableData = [this.displayName()];
-            let script = WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID, WebInspector.assumingMainTarget());
+            let script = WI.debuggerManager.scriptForIdentifier(this._node.sourceID, WI.assumingMainTarget());
             if (script && script.url && this._node.line >= 0 && this._node.column >= 0)
                 filterableData.push(script.url);
             return filterableData;
@@ -147,13 +147,13 @@
         // This doesn't handle removing a single modifier and re-inserting a single child.
 
         // FIXME: <https://webkit.org/b/155072> Web Inspector: Charge to Caller should work with Bottom Up Profile View
-        let isBottomUp = this._tree.callingContextTree.type === WebInspector.CallingContextTree.Type.BottomUp;
+        let isBottomUp = this._tree.callingContextTree.type === WI.CallingContextTree.Type.BottomUp;
         if (!this._tree.hasModifiers() || isBottomUp) {
             // Add back child data grid nodes that were previously charged to us.
             if (!this.shouldRefreshChildren && this._childrenToChargeToSelf.size) {
                 for (let child of this._childrenToChargeToSelf) {
                     console.assert(child.hasStackTraceInTimeRange(this._tree.startTime, this._tree.endTime));
-                    this.appendChild(new WebInspector.ProfileDataGridNode(child, this._tree));
+                    this.appendChild(new WI.ProfileDataGridNode(child, this._tree));
                 }
 
                 this.sort();
@@ -172,7 +172,7 @@
         this._node.forEachChild((child) => {
             if (child.hasStackTraceInTimeRange(this._tree.startTime, this._tree.endTime)) {
                 for (let {type, source} of this._tree.modifiers) {
-                    if (type === WebInspector.ProfileDataGridTree.ModifierType.ChargeToCaller) {
+                    if (type === WI.ProfileDataGridTree.ModifierType.ChargeToCaller) {
                         if (child.equals(source)) {
                             this._childrenToChargeToSelf.add(child);
                             this._extraSelfTimeFromChargedChildren += child.filteredTimestampsAndDuration(this._tree.startTime, this._tree.endTime).duration;
@@ -232,14 +232,14 @@
         let titleElement = fragment.appendChild(document.createElement("span"));
         titleElement.textContent = title;
 
-        let script = WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID, WebInspector.assumingMainTarget());
+        let script = WI.debuggerManager.scriptForIdentifier(this._node.sourceID, WI.assumingMainTarget());
         if (script && script.url && this._node.line >= 0 && this._node.column >= 0) {
             // Convert from 1-based line and column to 0-based.
             let sourceCodeLocation = script.createSourceCodeLocation(this._node.line - 1, this._node.column - 1);
 
             let locationElement = fragment.appendChild(document.createElement("span"));
             locationElement.classList.add("location");
-            sourceCodeLocation.populateLiveDisplayLocationString(locationElement, "textContent", WebInspector.SourceCodeLocation.ColumnStyle.Hidden, WebInspector.SourceCodeLocation.NameStyle.Short);
+            sourceCodeLocation.populateLiveDisplayLocationString(locationElement, "textContent", WI.SourceCodeLocation.ColumnStyle.Hidden, WI.SourceCodeLocation.NameStyle.Short);
 
             const options = {
                 dontFloat: true,
@@ -247,7 +247,7 @@
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             };
-            fragment.appendChild(WebInspector.createSourceCodeLocationLink(sourceCodeLocation, options));
+            fragment.appendChild(WI.createSourceCodeLocationLink(sourceCodeLocation, options));
         }
 
         return fragment;
@@ -263,7 +263,7 @@
         this._node.forEachChild((child) => {
             if (!this._childrenToChargeToSelf.has(child)) {
                 if (child.hasStackTraceInTimeRange(this._tree.startTime, this._tree.endTime))
-                    this.appendChild(new WebInspector.ProfileDataGridNode(child, this._tree));
+                    this.appendChild(new WI.ProfileDataGridNode(child, this._tree));
             }
         });
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js b/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js
index 165657c..86fff2e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js
@@ -23,13 +23,13 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.ProfileDataGridTree = class ProfileDataGridTree extends WebInspector.Object
+WI.ProfileDataGridTree = class ProfileDataGridTree extends WI.Object
 {
     constructor(callingContextTree, startTime, endTime, sortComparator)
     {
         super();
 
-        console.assert(callingContextTree instanceof WebInspector.CallingContextTree);
+        console.assert(callingContextTree instanceof WI.CallingContextTree);
         console.assert(typeof sortComparator === "function");
 
         this._children = [];
@@ -50,7 +50,7 @@
 
     static buildSortComparator(columnIdentifier, sortOrder)
     {
-        let ascending = sortOrder === WebInspector.DataGrid.SortOrder.Ascending;
+        let ascending = sortOrder === WI.DataGrid.SortOrder.Ascending;
         return function(a, b) {
             let result = a.data[columnIdentifier] - b.data[columnIdentifier];
             return ascending ? result : -result;
@@ -142,7 +142,7 @@
 
     addFocusNode(profileDataGridNode)
     {
-        console.assert(profileDataGridNode instanceof WebInspector.ProfileDataGridNode);
+        console.assert(profileDataGridNode instanceof WI.ProfileDataGridNode);
 
         // Save the original parent for when we rollback.
         this._saveFocusedNodeOriginalParent(profileDataGridNode);
@@ -153,7 +153,7 @@
 
     rollbackFocusNode(profileDataGridNode)
     {
-        console.assert(profileDataGridNode instanceof WebInspector.ProfileDataGridNode);
+        console.assert(profileDataGridNode instanceof WI.ProfileDataGridNode);
 
         let index = this._focusNodes.indexOf(profileDataGridNode);
         console.assert(index !== -1, "rollbackFocusNode should be rolling back to a previous focused node");
@@ -212,7 +212,7 @@
             // All nodes in the time range in the calling context tree.
             this._callingContextTree.forEachChild((child) => {
                 if (child.hasStackTraceInTimeRange(this._startTime, this._endTime))
-                    this.appendChild(new WebInspector.ProfileDataGridNode(child, this));
+                    this.appendChild(new WI.ProfileDataGridNode(child, this));
             });
         }
 
@@ -228,7 +228,7 @@
         // FIXME: This re-creates top level children, without remembering their expanded / unexpanded state.
         this._repopulate();
 
-        this.dispatchEventToListeners(WebInspector.ProfileDataGridTree.Event.FocusChanged);
+        this.dispatchEventToListeners(WI.ProfileDataGridTree.Event.FocusChanged);
 
         if (this._focusParentsToExpand) {
             for (let profileDataGridNode of this._focusParentsToExpand)
@@ -277,15 +277,15 @@
 
     _modifiersChanged()
     {
-        this.dispatchEventToListeners(WebInspector.ProfileDataGridTree.Event.ModifiersChanged);
+        this.dispatchEventToListeners(WI.ProfileDataGridTree.Event.ModifiersChanged);
     }
 };
 
-WebInspector.ProfileDataGridTree.Event = {
+WI.ProfileDataGridTree.Event = {
     FocusChanged: "profile-data-grid-tree-focus-changed",
     ModifiersChanged: "profile-data-grid-tree-modifiers-changed",
 };
 
-WebInspector.ProfileDataGridTree.ModifierType = {
+WI.ProfileDataGridTree.ModifierType = {
     ChargeToCaller: "charge",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js
index b620a4c..01645d1 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProfileNodeDataGridNode = class ProfileNodeDataGridNode extends WebInspector.TimelineDataGridNode
+WI.ProfileNodeDataGridNode = class ProfileNodeDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(profileNode, baseStartTime, rangeStartTime, rangeEndTime)
     {
@@ -136,14 +136,14 @@
         let title = this._profileNode.functionName;
         if (!title) {
             switch (this._profileNode.type) {
-            case WebInspector.ProfileNode.Type.Function:
-                title = WebInspector.UIString("(anonymous function)");
+            case WI.ProfileNode.Type.Function:
+                title = WI.UIString("(anonymous function)");
                 break;
-            case WebInspector.ProfileNode.Type.Program:
-                title = WebInspector.UIString("(program)");
+            case WI.ProfileNode.Type.Program:
+                title = WI.UIString("(program)");
                 break;
             default:
-                title = WebInspector.UIString("(anonymous function)");
+                title = WI.UIString("(anonymous function)");
                 console.error("Unknown ProfileNode type: " + this._profileNode.type);
             }
         }
@@ -155,13 +155,13 @@
     {
         let className;
         switch (this._profileNode.type) {
-        case WebInspector.ProfileNode.Type.Function:
-            className = WebInspector.CallFrameView.FunctionIconStyleClassName;
+        case WI.ProfileNode.Type.Function:
+            className = WI.CallFrameView.FunctionIconStyleClassName;
             if (!this._profileNode.sourceCodeLocation)
-                className = WebInspector.CallFrameView.NativeIconStyleClassName;
+                className = WI.CallFrameView.NativeIconStyleClassName;
             break;
-        case WebInspector.ProfileNode.Type.Program:
-            className = WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
+        case WI.ProfileNode.Type.Program:
+            className = WI.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
             break;
         }
 
@@ -170,7 +170,7 @@
         // This is more than likely an event listener function with an "on" prefix and it is
         // as long or longer than the shortest event listener name -- "oncut".
         if (this._profileNode.functionName && this._profileNode.functionName.startsWith("on") && this._profileNode.functionName.length >= 5)
-            className = WebInspector.CallFrameView.EventListenerIconStyleClassName;
+            className = WI.CallFrameView.EventListenerIconStyleClassName;
 
         return [className];
     }
@@ -186,6 +186,6 @@
         this.removeChildren();
 
         for (let node of this._profileNode.childNodes)
-            this.appendChild(new WebInspector.ProfileNodeDataGridNode(node, this.baseStartTime, this.rangeStartTime, this.rangeEndTime));
+            this.appendChild(new WI.ProfileNodeDataGridNode(node, this.baseStartTime, this.rangeStartTime, this.rangeEndTime));
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProfileNodeTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ProfileNodeTreeElement.js
index 36f67d5..8ec8d12 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProfileNodeTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProfileNodeTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProfileNodeTreeElement = class ProfileNodeTreeElement extends WebInspector.GeneralTreeElement
+WI.ProfileNodeTreeElement = class ProfileNodeTreeElement extends WI.GeneralTreeElement
 {
     constructor(profileNode, delegate)
     {
@@ -34,14 +34,14 @@
 
         if (!title) {
             switch (profileNode.type) {
-            case WebInspector.ProfileNode.Type.Function:
-                title = WebInspector.UIString("(anonymous function)");
+            case WI.ProfileNode.Type.Function:
+                title = WI.UIString("(anonymous function)");
                 break;
-            case WebInspector.ProfileNode.Type.Program:
-                title = WebInspector.UIString("(program)");
+            case WI.ProfileNode.Type.Program:
+                title = WI.UIString("(program)");
                 break;
             default:
-                title = WebInspector.UIString("(anonymous function)");
+                title = WI.UIString("(anonymous function)");
                 console.error("Unknown ProfileNode type: " + profileNode.type);
             }
         }
@@ -55,13 +55,13 @@
         var className;
 
         switch (profileNode.type) {
-        case WebInspector.ProfileNode.Type.Function:
-            className = WebInspector.CallFrameView.FunctionIconStyleClassName;
+        case WI.ProfileNode.Type.Function:
+            className = WI.CallFrameView.FunctionIconStyleClassName;
             if (!sourceCodeLocation)
-                className = WebInspector.CallFrameView.NativeIconStyleClassName;
+                className = WI.CallFrameView.NativeIconStyleClassName;
             break;
-        case WebInspector.ProfileNode.Type.Program:
-            className = WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
+        case WI.ProfileNode.Type.Program:
+            className = WI.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
             break;
         }
 
@@ -70,7 +70,7 @@
         // This is more than likely an event listener function with an "on" prefix and it is
         // as long or longer than the shortest event listener name -- "oncut".
         if (profileNode.functionName && profileNode.functionName.startsWith("on") && profileNode.functionName.length >= 5)
-            className = WebInspector.CallFrameView.EventListenerIconStyleClassName;
+            className = WI.CallFrameView.EventListenerIconStyleClassName;
 
         super([className], title, subtitle, profileNode, {hasChildren: !!profileNode.childNodes.length});
 
@@ -126,7 +126,7 @@
         }
 
         for (var childProfileNode of this._profileNode.childNodes) {
-            var childTreeElement = new WebInspector.ProfileNodeTreeElement(childProfileNode);
+            var childTreeElement = new WI.ProfileNodeTreeElement(childProfileNode);
             this.appendChild(childTreeElement);
         }
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/ProfileView.js b/Source/WebInspectorUI/UserInterface/Views/ProfileView.js
index b6a503a..a23c515 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ProfileView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ProfileView.js
@@ -23,13 +23,13 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-WebInspector.ProfileView = class ProfileView extends WebInspector.ContentView
+WI.ProfileView = class ProfileView extends WI.ContentView
 {
     constructor(callingContextTree, extraArguments)
     {
         super(callingContextTree);
 
-        console.assert(callingContextTree instanceof WebInspector.CallingContextTree);
+        console.assert(callingContextTree instanceof WI.CallingContextTree);
 
         this._startTime = 0;
         this._endTime = Infinity;
@@ -41,32 +41,32 @@
 
         let columns = {
             totalTime: {
-                title: WebInspector.UIString("Total Time"),
+                title: WI.UIString("Total Time"),
                 width: "120px",
                 sortable: true,
                 aligned: "right",
             },
             selfTime: {
-                title: WebInspector.UIString("Self Time"),
+                title: WI.UIString("Self Time"),
                 width: "75px",
                 sortable: true,
                 aligned: "right",
             },
             function: {
-                title: WebInspector.UIString("Function"),
+                title: WI.UIString("Function"),
                 disclosure: true,
             },
         };
 
-        this._dataGrid = new WebInspector.DataGrid(columns);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._dataGridSortChanged, this);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.ExpandedNode, this._dataGridNodeExpanded, this);
+        this._dataGrid = new WI.DataGrid(columns);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, this._dataGridSortChanged, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.ExpandedNode, this._dataGridNodeExpanded, this);
         this._dataGrid.element.addEventListener("mouseover", this._mouseOverDataGrid.bind(this));
         this._dataGrid.element.addEventListener("mouseleave", this._mouseLeaveDataGrid.bind(this));
         this._dataGrid.indentWidth = 20;
         this._dataGrid.sortColumnIdentifier = "totalTime";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Descending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Descending;
         this._dataGrid.createSettings("profile-view");
 
         // Currently we create a new ProfileView for each CallingContextTree, so
@@ -127,8 +127,8 @@
             for (let profileDataGridNode of this._profileDataGridTree.focusNodes) {
                 let displayName = profileDataGridNode.displayName();
                 let className = profileDataGridNode.iconClassName();
-                let pathComponent = new WebInspector.HierarchicalPathComponent(displayName, className, profileDataGridNode);
-                pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
+                let pathComponent = new WI.HierarchicalPathComponent(displayName, className, profileDataGridNode);
+                pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
                 pathComponents.push(pathComponent);
             }
         }
@@ -142,14 +142,14 @@
     {
         let hadFocusNodes = this.hasFocusNodes();
 
-        let sortComparator = WebInspector.ProfileDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
-        this._profileDataGridTree = new WebInspector.ProfileDataGridTree(this._callingContextTree, this._startTime, this._endTime, sortComparator);
-        this._profileDataGridTree.addEventListener(WebInspector.ProfileDataGridTree.Event.FocusChanged, this._dataGridTreeFocusChanged, this);
-        this._profileDataGridTree.addEventListener(WebInspector.ProfileDataGridTree.Event.ModifiersChanged, this._dataGridTreeModifiersChanged, this);
+        let sortComparator = WI.ProfileDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
+        this._profileDataGridTree = new WI.ProfileDataGridTree(this._callingContextTree, this._startTime, this._endTime, sortComparator);
+        this._profileDataGridTree.addEventListener(WI.ProfileDataGridTree.Event.FocusChanged, this._dataGridTreeFocusChanged, this);
+        this._profileDataGridTree.addEventListener(WI.ProfileDataGridTree.Event.ModifiersChanged, this._dataGridTreeModifiersChanged, this);
         this._repopulateDataGridFromTree();
 
         if (hadFocusNodes)
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+            this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _repopulateDataGridFromTree()
@@ -192,7 +192,7 @@
         this._repopulateDataGridFromTree();
         this._profileDataGridTree.refresh();
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _dataGridTreeModifiersChanged(event)
@@ -205,7 +205,7 @@
         if (!this._profileDataGridTree)
             return;
 
-        this._profileDataGridTree.sortComparator = WebInspector.ProfileDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
+        this._profileDataGridTree.sortComparator = WI.ProfileDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
         this._repopulateDataGridFromTree();
     }
 
@@ -213,14 +213,14 @@
     {
         let oldSelectedNode = event.data.oldSelectedNode;
         if (oldSelectedNode) {
-            this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected, oldSelectedNode);
-            oldSelectedNode.forEachChildInSubtree((node) => this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected, node));
+            this._removeGuidanceElement(WI.ProfileView.GuidanceType.Selected, oldSelectedNode);
+            oldSelectedNode.forEachChildInSubtree((node) => this._removeGuidanceElement(WI.ProfileView.GuidanceType.Selected, node));
         }
 
         let newSelectedNode = this._dataGrid.selectedNode;
         if (newSelectedNode) {
-            this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected, newSelectedNode);
-            newSelectedNode.forEachChildInSubtree((node) => this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected, node, newSelectedNode));
+            this._removeGuidanceElement(WI.ProfileView.GuidanceType.Selected, newSelectedNode);
+            newSelectedNode.forEachChildInSubtree((node) => this._appendGuidanceElement(WI.ProfileView.GuidanceType.Selected, node, newSelectedNode));
 
             this._sharedData.selectedNodeHash = newSelectedNode.callingContextTreeNode.hash;
         }
@@ -232,12 +232,12 @@
 
         if (this._dataGrid.selectedNode) {
             if (expandedNode.isInSubtreeOfNode(this._dataGrid.selectedNode))
-                expandedNode.forEachImmediateChild((node) => this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected, node, this._dataGrid.selectedNode));
+                expandedNode.forEachImmediateChild((node) => this._appendGuidanceElement(WI.ProfileView.GuidanceType.Selected, node, this._dataGrid.selectedNode));
         }
 
         if (this._hoveredDataGridNode) {
             if (expandedNode.isInSubtreeOfNode(this._hoveredDataGridNode))
-                expandedNode.forEachImmediateChild((node) => this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, node, this._hoveredDataGridNode));
+                expandedNode.forEachImmediateChild((node) => this._appendGuidanceElement(WI.ProfileView.GuidanceType.Hover, node, this._hoveredDataGridNode));
         }
     }
 
@@ -248,15 +248,15 @@
             return;
 
         if (this._hoveredDataGridNode) {
-            this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, this._hoveredDataGridNode);
-            this._hoveredDataGridNode.forEachChildInSubtree((node) => this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, node));
+            this._removeGuidanceElement(WI.ProfileView.GuidanceType.Hover, this._hoveredDataGridNode);
+            this._hoveredDataGridNode.forEachChildInSubtree((node) => this._removeGuidanceElement(WI.ProfileView.GuidanceType.Hover, node));
         }
 
         this._hoveredDataGridNode = hoveredDataGridNode;
 
         if (this._hoveredDataGridNode) {
-            this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, this._hoveredDataGridNode, this._hoveredDataGridNode);
-            this._hoveredDataGridNode.forEachChildInSubtree((node) => this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, node, this._hoveredDataGridNode));
+            this._appendGuidanceElement(WI.ProfileView.GuidanceType.Hover, this._hoveredDataGridNode, this._hoveredDataGridNode);
+            this._hoveredDataGridNode.forEachChildInSubtree((node) => this._appendGuidanceElement(WI.ProfileView.GuidanceType.Hover, node, this._hoveredDataGridNode));
         }
     }
 
@@ -265,8 +265,8 @@
         if (!this._hoveredDataGridNode)
             return;
 
-        this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, this._hoveredDataGridNode);
-        this._hoveredDataGridNode.forEachChildInSubtree((node) => this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover, node));
+        this._removeGuidanceElement(WI.ProfileView.GuidanceType.Hover, this._hoveredDataGridNode);
+        this._hoveredDataGridNode.forEachChildInSubtree((node) => this._removeGuidanceElement(WI.ProfileView.GuidanceType.Hover, node));
 
         this._hoveredDataGridNode = null;
     }
@@ -302,7 +302,7 @@
     }
 };
 
-WebInspector.ProfileView.GuidanceType = {
+WI.ProfileView.GuidanceType = {
     Selected: "selected",
     Hover: "hover",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js b/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
index 993e4b6..8d5d628 100644
--- a/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
+++ b/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.QuickConsole = class QuickConsole extends WebInspector.View
+WI.QuickConsole = class QuickConsole extends WI.View
 {
     constructor(element)
     {
         super(element);
 
-        this._toggleOrFocusKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this._toggleOrFocus.bind(this));
+        this._toggleOrFocusKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape, this._toggleOrFocus.bind(this));
 
-        this._mainExecutionContextPathComponent = this._createExecutionContextPathComponent(WebInspector.mainTarget.executionContext);
+        this._mainExecutionContextPathComponent = this._createExecutionContextPathComponent(WI.mainTarget.executionContext);
 
         this._otherExecutionContextPathComponents = [];
         this._frameToPathComponent = new Map;
@@ -42,7 +42,7 @@
         this.element.classList.add("quick-console");
         this.element.addEventListener("mousedown", this._handleMouseDown.bind(this));
 
-        this.prompt = new WebInspector.ConsolePrompt(null, "text/javascript");
+        this.prompt = new WI.ConsolePrompt(null, "text/javascript");
         this.prompt.element.classList.add("text-prompt");
         this.addSubview(this.prompt);
 
@@ -51,33 +51,33 @@
         // and not toggle the console. Install our own Escape key handler that will trigger
         // when the ConsolePrompt is empty, to restore toggling behavior. A better solution
         // would be for CodeMirror's event handler to pass if it doesn't do anything.
-        this.prompt.escapeKeyHandlerWhenEmpty = function() { WebInspector.toggleSplitConsole(); };
+        this.prompt.escapeKeyHandlerWhenEmpty = function() { WI.toggleSplitConsole(); };
 
-        this._navigationBar = new WebInspector.QuickConsoleNavigationBar;
+        this._navigationBar = new WI.QuickConsoleNavigationBar;
         this.addSubview(this._navigationBar);
 
-        this._executionContextSelectorItem = new WebInspector.HierarchicalPathNavigationItem;
+        this._executionContextSelectorItem = new WI.HierarchicalPathNavigationItem;
         this._executionContextSelectorItem.showSelectorArrows = true;
         this._navigationBar.addNavigationItem(this._executionContextSelectorItem);
 
-        this._executionContextSelectorDivider = new WebInspector.DividerNavigationItem;
+        this._executionContextSelectorDivider = new WI.DividerNavigationItem;
         this._navigationBar.addNavigationItem(this._executionContextSelectorDivider);
 
         this._rebuildExecutionContextPathComponents();
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextsChanged, this);
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
+        WI.Frame.addEventListener(WI.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextsChanged, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._debuggerActiveCallFrameDidChange, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._debuggerActiveCallFrameDidChange, this);
 
-        WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.ActiveExecutionContextChanged, this._activeExecutionContextChanged, this);
+        WI.runtimeManager.addEventListener(WI.RuntimeManager.Event.ActiveExecutionContextChanged, this._activeExecutionContextChanged, this);
 
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded, this._targetAdded, this);
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, this._targetAdded, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
 
-        WebInspector.consoleDrawer.addEventListener(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged, this._updateStyles, this);
+        WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._updateStyles, this);
 
-        WebInspector.TabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._updateStyles, this);
+        WI.TabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._updateStyles, this);
     }
 
     // Public
@@ -89,12 +89,12 @@
 
     get selectedExecutionContext()
     {
-        return WebInspector.runtimeManager.activeExecutionContext;
+        return WI.runtimeManager.activeExecutionContext;
     }
 
     set selectedExecutionContext(executionContext)
     {
-        WebInspector.runtimeManager.activeExecutionContext = executionContext;
+        WI.runtimeManager.activeExecutionContext = executionContext;
     }
 
     // Protected
@@ -120,14 +120,14 @@
     _executionContextPathComponentsToDisplay()
     {
         // If we are in the debugger the console will use the active call frame, don't show the selector.
-        if (WebInspector.debuggerManager.activeCallFrame)
+        if (WI.debuggerManager.activeCallFrame)
             return [];
 
         // If there is only the Main ExecutionContext, don't show the selector.
         if (!this._otherExecutionContextPathComponents.length)
             return [];
 
-        if (this.selectedExecutionContext === WebInspector.mainTarget.executionContext)
+        if (this.selectedExecutionContext === WI.mainTarget.executionContext)
             return [this._mainExecutionContextPathComponent];
 
         return this._otherExecutionContextPathComponents.filter((component) => component.representedObject === this.selectedExecutionContext);
@@ -182,11 +182,11 @@
 
     _createExecutionContextPathComponent(executionContext, preferredName)
     {
-        console.assert(executionContext instanceof WebInspector.ExecutionContext);
+        console.assert(executionContext instanceof WI.ExecutionContext);
 
-        let pathComponent = new WebInspector.HierarchicalPathComponent(preferredName || executionContext.name, "execution-context", executionContext, true, true);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
+        let pathComponent = new WI.HierarchicalPathComponent(preferredName || executionContext.name, "execution-context", executionContext, true, true);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
         pathComponent.truncatedDisplayNameLength = 50;
         return pathComponent;
     }
@@ -203,8 +203,8 @@
         let bExecutionContext = b.representedObject;
 
         // "Targets" (workers) at the top.
-        let aNonMainTarget = aExecutionContext.target !== WebInspector.mainTarget;
-        let bNonMainTarget = bExecutionContext.target !== WebInspector.mainTarget;
+        let aNonMainTarget = aExecutionContext.target !== WI.mainTarget;
+        let bNonMainTarget = bExecutionContext.target !== WI.mainTarget;
         if (aNonMainTarget && !bNonMainTarget)
             return -1;
         if (bNonMainTarget && !aNonMainTarget)
@@ -213,9 +213,9 @@
             return a.displayName.extendedLocaleCompare(b.displayName);
 
         // "Main Frame" follows.
-        if (aExecutionContext === WebInspector.mainTarget.executionContext)
+        if (aExecutionContext === WI.mainTarget.executionContext)
             return -1;
-        if (bExecutionContext === WebInspector.mainTarget.executionContext)
+        if (bExecutionContext === WI.mainTarget.executionContext)
             return 1;
 
         // Only Frame contexts remain.
@@ -254,8 +254,8 @@
 
     _removeOtherExecutionContextPathComponent(executionContextPathComponent, skipRebuild)
     {
-        executionContextPathComponent.removeEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
-        executionContextPathComponent.removeEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
+        executionContextPathComponent.removeEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+        executionContextPathComponent.removeEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
 
         let prev = executionContextPathComponent.previousSibling;
         let next = executionContextPathComponent.nextSibling;
@@ -294,8 +294,8 @@
     _targetAdded(event)
     {
         let target = event.data.target;
-        console.assert(target.type === WebInspector.Target.Type.Worker);
-        let preferredName = WebInspector.UIString("Worker \u2014 %s").format(target.displayName);
+        console.assert(target.type === WI.Target.Type.Worker);
+        let preferredName = WI.UIString("Worker \u2014 %s").format(target.displayName);
         let executionContextPathComponent = this._createExecutionContextPathComponent(target.executionContext, preferredName);
 
         this._targetToPathComponent.set(target, executionContextPathComponent);
@@ -309,7 +309,7 @@
         this._removeOtherExecutionContextPathComponent(executionContextPathComponent);
 
         if (this.selectedExecutionContext === executionContextPathComponent.representedObject)
-            this.selectedExecutionContext = WebInspector.mainTarget.executionContext;
+            this.selectedExecutionContext = WI.mainTarget.executionContext;
     }
 
     _pathComponentSelected(event)
@@ -331,13 +331,13 @@
     _toggleOrFocus(event)
     {
         if (this.prompt.focused)
-            WebInspector.toggleSplitConsole();
-        else if (!WebInspector.isEditingAnyField() && !WebInspector.isEventTargetAnEditableField(event))
+            WI.toggleSplitConsole();
+        else if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event))
             this.prompt.focus();
     }
 
     _updateStyles()
     {
-        this.element.classList.toggle("showing-log", WebInspector.isShowingConsoleTab() || WebInspector.isShowingSplitConsole());
+        this.element.classList.toggle("showing-log", WI.isShowingConsoleTab() || WI.isShowingSplitConsole());
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/QuickConsoleNavigationBar.js b/Source/WebInspectorUI/UserInterface/Views/QuickConsoleNavigationBar.js
index 73eac72..07d3945 100644
--- a/Source/WebInspectorUI/UserInterface/Views/QuickConsoleNavigationBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/QuickConsoleNavigationBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.QuickConsoleNavigationBar = class QuickConsoleNavigationBar extends WebInspector.NavigationBar
+WI.QuickConsoleNavigationBar = class QuickConsoleNavigationBar extends WI.NavigationBar
 {
     get sizesToFit()
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js
index 4ceac6d..643ee93 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RadioButtonNavigationItem = class RadioButtonNavigationItem extends WebInspector.ButtonNavigationItem
+WI.RadioButtonNavigationItem = class RadioButtonNavigationItem extends WI.ButtonNavigationItem
 {
     constructor(identifier, toolTip, image, imageWidth, imageHeight)
     {
@@ -36,28 +36,28 @@
 
     get selected()
     {
-        return this.element.classList.contains(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
+        return this.element.classList.contains(WI.RadioButtonNavigationItem.SelectedStyleClassName);
     }
 
     set selected(flag)
     {
         if (flag) {
-            this.element.classList.add(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
+            this.element.classList.add(WI.RadioButtonNavigationItem.SelectedStyleClassName);
             this.element.setAttribute("aria-selected", "true");
         } else {
-            this.element.classList.remove(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
+            this.element.classList.remove(WI.RadioButtonNavigationItem.SelectedStyleClassName);
             this.element.setAttribute("aria-selected", "false");
         }
     }
 
     get active()
     {
-        return this.element.classList.contains(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName);
+        return this.element.classList.contains(WI.RadioButtonNavigationItem.ActiveStyleClassName);
     }
 
     set active(flag)
     {
-        this.element.classList.toggle(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName, flag);
+        this.element.classList.toggle(WI.RadioButtonNavigationItem.ActiveStyleClassName, flag);
     }
 
     updateLayout(expandOnly)
@@ -68,7 +68,7 @@
         var isSelected = this.selected;
 
         if (!isSelected) {
-            this.element.classList.add(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
+            this.element.classList.add(WI.RadioButtonNavigationItem.SelectedStyleClassName);
             this.element.setAttribute("aria-selected", "true");
         }
 
@@ -81,7 +81,7 @@
         }
 
         if (!isSelected) {
-            this.element.classList.remove(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
+            this.element.classList.remove(WI.RadioButtonNavigationItem.SelectedStyleClassName);
             this.element.setAttribute("aria-selected", "false");
         }
     }
@@ -94,6 +94,6 @@
     }
 };
 
-WebInspector.RadioButtonNavigationItem.StyleClassName = "radio";
-WebInspector.RadioButtonNavigationItem.ActiveStyleClassName = "active";
-WebInspector.RadioButtonNavigationItem.SelectedStyleClassName = "selected";
+WI.RadioButtonNavigationItem.StyleClassName = "radio";
+WI.RadioButtonNavigationItem.ActiveStyleClassName = "active";
+WI.RadioButtonNavigationItem.SelectedStyleClassName = "selected";
diff --git a/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js
index aaa72f9..a82da6b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingActionTreeElement = class RecordingActionTreeElement extends WebInspector.GeneralTreeElement
+WI.RecordingActionTreeElement = class RecordingActionTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject, index, recordingType)
     {
-        console.assert(representedObject instanceof WebInspector.RecordingAction);
+        console.assert(representedObject instanceof WI.RecordingAction);
 
-        let {classNames, copyText, titleFragment} = WebInspector.RecordingActionTreeElement._generateDOM(representedObject, recordingType);
+        let {classNames, copyText, titleFragment} = WI.RecordingActionTreeElement._generateDOM(representedObject, recordingType);
 
         const subtitle = null;
         super(classNames, titleFragment, subtitle, representedObject);
@@ -45,7 +45,7 @@
         let classNames = ["action"];
         let copyText = recordingAction.name;
 
-        let isInitialState = recordingAction instanceof WebInspector.RecordingInitialStateAction;
+        let isInitialState = recordingAction instanceof WI.RecordingInitialStateAction;
         if (recordingAction.isFunction)
             classNames.push("function");
         else if (!isInitialState) {
@@ -93,16 +93,16 @@
                 let swizzleType = recordingAction.parameterSwizzleTypeForTypeAtIndex(recordingType, i);
                 if (swizzleType && typeof parameter !== "string") {
                     parameterElement.classList.add("swizzled");
-                    if (parameter === WebInspector.Recording.Swizzle.Invalid) {
+                    if (parameter === WI.Recording.Swizzle.Invalid) {
                         parameterElement.classList.add("missing");
 
                         hasMissingParameter = true;
                     }
 
                     if (parameter instanceof CanvasGradient)
-                        parameterElement.textContent = WebInspector.unlocalizedString("Gradient");
+                        parameterElement.textContent = WI.unlocalizedString("Gradient");
                     else if (parameter instanceof CanvasPattern)
-                        parameterElement.textContent = WebInspector.unlocalizedString("Pattern");
+                        parameterElement.textContent = WI.unlocalizedString("Pattern");
                     else
                         parameterElement.textContent = swizzleType;
 
@@ -168,7 +168,7 @@
 
     populateContextMenu(contextMenu, event)
     {
-        contextMenu.appendItem(WebInspector.UIString("Copy Action"), () => {
+        contextMenu.appendItem(WI.UIString("Copy Action"), () => {
             InspectorFrontendHost.copyText("context." + this._copyText + ";");
         });
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js b/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js
index 33bd5bf..b707b96 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingContentView = class RecordingContentView extends WebInspector.ContentView
+WI.RecordingContentView = class RecordingContentView extends WI.ContentView
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.Recording);
+        console.assert(representedObject instanceof WI.Recording);
 
         super(representedObject);
 
@@ -37,10 +37,10 @@
 
         this.element.classList.add("recording", this.representedObject.type);
 
-        if (this.representedObject.type === WebInspector.Recording.Type.Canvas2D) {
-            this._showGridButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-grid", WebInspector.UIString("Show Grid"), WebInspector.UIString("Hide Grid"), "Images/NavigationItemCheckers.svg", 13, 13);
-            this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._showGridButtonClicked, this);
-            this._showGridButtonNavigationItem.activated = !!WebInspector.settings.showImageGrid.value;
+        if (this.representedObject.type === WI.Recording.Type.Canvas2D) {
+            this._showGridButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-grid", WI.UIString("Show Grid"), WI.UIString("Hide Grid"), "Images/NavigationItemCheckers.svg", 13, 13);
+            this._showGridButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._showGridButtonClicked, this);
+            this._showGridButtonNavigationItem.activated = !!WI.settings.showImageGrid.value;
         }
 
         this._previewContainer = this.element.appendChild(document.createElement("div"));
@@ -51,7 +51,7 @@
 
     get navigationItems()
     {
-        if (this.representedObject.type === WebInspector.Recording.Type.Canvas2D)
+        if (this.representedObject.type === WI.Recording.Type.Canvas2D)
             return [this._showGridButtonNavigationItem];
         return [];
     }
@@ -64,7 +64,7 @@
 
         this._index = index;
 
-        if (this.representedObject.type === WebInspector.Recording.Type.Canvas2D)
+        if (this.representedObject.type === WI.Recording.Type.Canvas2D)
             this._generateContentCanvas2D(index, options);
     }
 
@@ -74,7 +74,7 @@
     {
         super.shown();
 
-        if (this.representedObject.type === WebInspector.Recording.Type.Canvas2D)
+        if (this.representedObject.type === WI.Recording.Type.Canvas2D)
             this._updateImageGrid();
     }
 
@@ -106,7 +106,7 @@
             return;
         }
 
-        let snapshotIndex = Math.floor(index / WebInspector.RecordingContentView.SnapshotInterval);
+        let snapshotIndex = Math.floor(index / WI.RecordingContentView.SnapshotInterval);
         let snapshot = this._snapshots[snapshotIndex];
 
         let actions = this.representedObject.actions;
@@ -124,7 +124,7 @@
                     continue;
 
                 try {
-                    if (WebInspector.RecordingAction.functionForType(this.representedObject.type, name))
+                    if (WI.RecordingAction.functionForType(this.representedObject.type, name))
                         snapshot.context[name](...snapshot.state[name]);
                     else
                         snapshot.context[name] = snapshot.state[name];
@@ -154,7 +154,7 @@
 
         if (!snapshot) {
             snapshot = this._snapshots[snapshotIndex] = {};
-            snapshot.index = snapshotIndex * WebInspector.RecordingContentView.SnapshotInterval;
+            snapshot.index = snapshotIndex * WI.RecordingContentView.SnapshotInterval;
             while (snapshot.index && actions[snapshot.index].name !== "beginPath")
                 --snapshot.index;
 
@@ -179,9 +179,9 @@
                 for (let key in initialState.attributes) {
                     let value = initialState.attributes[key];
                     if (key === "strokeStyle" || key === "fillStyle")
-                        value = this.representedObject.swizzle(value, WebInspector.Recording.Swizzle.CanvasStyle);
+                        value = this.representedObject.swizzle(value, WI.Recording.Swizzle.CanvasStyle);
 
-                    if (value === WebInspector.Recording.Swizzle.Invalid)
+                    if (value === WI.Recording.Swizzle.Invalid)
                         continue;
 
                     snapshot.state[key] = value;
@@ -243,7 +243,7 @@
         if (!action.valid)
             return;
 
-        if (action.parameters.includes(WebInspector.Recording.Swizzle.Invalid))
+        if (action.parameters.includes(WI.Recording.Swizzle.Invalid))
             return;
 
         try {
@@ -257,7 +257,7 @@
                     context[name] = action.parameters[0];
             }
         } catch (e) {
-            WebInspector.Recording.synthesizeError(WebInspector.UIString("“%s” threw an error.").format(action.name));
+            WI.Recording.synthesizeError(WI.UIString("“%s” threw an error.").format(action.name));
 
             action.valid = false;
         }
@@ -265,20 +265,20 @@
 
     _updateImageGrid()
     {
-        let activated = WebInspector.settings.showImageGrid.value;
+        let activated = WI.settings.showImageGrid.value;
         this._showGridButtonNavigationItem.activated = activated;
 
-        let snapshotIndex = Math.floor(this._index / WebInspector.RecordingContentView.SnapshotInterval);
+        let snapshotIndex = Math.floor(this._index / WI.RecordingContentView.SnapshotInterval);
         if (!isNaN(this._index) && this._snapshots[snapshotIndex])
             this._snapshots[snapshotIndex].element.classList.toggle("show-grid", activated);
     }
 
     _showGridButtonClicked(event)
     {
-        WebInspector.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated;
+        WI.settings.showImageGrid.value = !this._showGridButtonNavigationItem.activated;
 
         this._updateImageGrid();
     }
 };
 
-WebInspector.RecordingContentView.SnapshotInterval = 5000;
+WI.RecordingContentView.SnapshotInterval = 5000;
diff --git a/Source/WebInspectorUI/UserInterface/Views/RecordingNavigationSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/RecordingNavigationSidebarPanel.js
index d822bc4..736de76 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RecordingNavigationSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RecordingNavigationSidebarPanel.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingNavigationSidebarPanel = class RecordingNavigationSidebarPanel extends WebInspector.NavigationSidebarPanel
+WI.RecordingNavigationSidebarPanel = class RecordingNavigationSidebarPanel extends WI.NavigationSidebarPanel
 {
     constructor()
     {
-        super("recording", WebInspector.UIString("Recording"));
+        super("recording", WI.UIString("Recording"));
 
         this.contentTreeOutline.customIndent = true;
 
-        this.filterBar.placeholder = WebInspector.UIString("Filter Actions");
+        this.filterBar.placeholder = WI.UIString("Filter Actions");
 
         this.recording = null;
 
@@ -60,19 +60,19 @@
         if (this._recording) {
             this.contentTreeOutline.element.dataset.indent = Number.countDigits(this._recording.actions.length);
 
-            if (this._recording.actions[0] instanceof WebInspector.RecordingInitialStateAction)
-                this.contentTreeOutline.appendChild(new WebInspector.RecordingActionTreeElement(this._recording.actions[0], 0, this._recording.type));
+            if (this._recording.actions[0] instanceof WI.RecordingInitialStateAction)
+                this.contentTreeOutline.appendChild(new WI.RecordingActionTreeElement(this._recording.actions[0], 0, this._recording.type));
 
             let cumulativeActionIndex = 1;
             this._recording.frames.forEach((frame, frameIndex) => {
-                let folder = new WebInspector.FolderTreeElement(WebInspector.UIString("Frame %d").format((frameIndex + 1).toLocaleString()));
+                let folder = new WI.FolderTreeElement(WI.UIString("Frame %d").format((frameIndex + 1).toLocaleString()));
                 this.contentTreeOutline.appendChild(folder);
 
                 for (let i = 0; i < frame.actions.length; ++i)
-                    folder.appendChild(new WebInspector.RecordingActionTreeElement(frame.actions[i], cumulativeActionIndex + i, this._recording.type));
+                    folder.appendChild(new WI.RecordingActionTreeElement(frame.actions[i], cumulativeActionIndex + i, this._recording.type));
 
                 if (frame.incomplete)
-                    folder.subtitle = WebInspector.UIString("Incomplete");
+                    folder.subtitle = WI.UIString("Incomplete");
 
                 if (this._recording.frames.length === 1)
                     folder.expand();
@@ -81,7 +81,7 @@
             });
         }
 
-        this.updateEmptyContentPlaceholder(WebInspector.UIString("No Recording Data"));
+        this.updateEmptyContentPlaceholder(WI.UIString("No Recording Data"));
 
         if (this._exportButton)
             this._exportButton.disabled = !this.contentTreeOutline.children.length;
@@ -94,7 +94,7 @@
             return;
 
         let treeOutline = this.contentTreeOutline;
-        if (!(this._recording.actions[0] instanceof WebInspector.RecordingInitialStateAction) || index) {
+        if (!(this._recording.actions[0] instanceof WI.RecordingInitialStateAction) || index) {
             treeOutline = treeOutline.children[0];
             while (index > treeOutline.children.length) {
                 index -= treeOutline.children.length;
@@ -111,7 +111,7 @@
 
         const omitFocus = false;
         const selectedByUser = false;
-        let suppressOnSelect = !(treeElementToSelect instanceof WebInspector.FolderTreeElement);
+        let suppressOnSelect = !(treeElementToSelect instanceof WI.FolderTreeElement);
         const suppressOnDeselect = true;
         treeElementToSelect.revealAndSelect(omitFocus, selectedByUser, suppressOnSelect, suppressOnDeselect);
     }
@@ -124,15 +124,15 @@
 
         const role = "button";
 
-        const importLabel = WebInspector.UIString("Import");
-        let importNavigationItem = new WebInspector.NavigationItem("recording-import", role, importLabel);
+        const importLabel = WI.UIString("Import");
+        let importNavigationItem = new WI.NavigationItem("recording-import", role, importLabel);
 
         this._importButton = importNavigationItem.element.appendChild(document.createElement("button"));
         this._importButton.textContent = importLabel;
         this._importButton.addEventListener("click", this._importNavigationItemClicked.bind(this));
 
-        const exportLabel = WebInspector.UIString("Export");
-        let exportNavigationItem = new WebInspector.NavigationItem("recording-export", role, exportLabel);
+        const exportLabel = WI.UIString("Export");
+        let exportNavigationItem = new WI.NavigationItem("recording-export", role, exportLabel);
 
         this._exportButton = exportNavigationItem.element.appendChild(document.createElement("button"));
         this._exportButton.textContent = exportLabel;
@@ -140,14 +140,14 @@
         this._exportButton.addEventListener("click", this._exportNavigationItemClicked.bind(this));
 
         const element = null;
-        this.addSubview(new WebInspector.NavigationBar(element, [importNavigationItem, exportNavigationItem]));
+        this.addSubview(new WI.NavigationBar(element, [importNavigationItem, exportNavigationItem]));
     }
 
     // Private
 
     _importNavigationItemClicked(event)
     {
-        WebInspector.loadDataFromFile((data) => {
+        WI.loadDataFromFile((data) => {
             if (!data)
                 return;
 
@@ -155,11 +155,11 @@
             try {
                 payload = JSON.parse(data);
             } catch (e) {
-                WebInspector.Recording.synthesizeError(e);
+                WI.Recording.synthesizeError(e);
                 return;
             }
 
-            this.dispatchEventToListeners(WebInspector.RecordingNavigationSidebarPanel.Event.Import, {payload});
+            this.dispatchEventToListeners(WI.RecordingNavigationSidebarPanel.Event.Import, {payload});
         });
     }
 
@@ -169,13 +169,13 @@
             return;
 
         const forceSaveAs = true;
-        WebInspector.saveDataToFile({
+        WI.saveDataToFile({
             url: "web-inspector:///Recording.json",
             content: JSON.stringify(this._recording.toJSON()),
         }, forceSaveAs);
     }
 };
 
-WebInspector.RecordingNavigationSidebarPanel.Event = {
+WI.RecordingNavigationSidebarPanel.Event = {
     Import: "recording-navigation-sidebar-panel-import",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js
index 088f99d..5cd4110 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RecordingStateDetailsSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingStateDetailsSidebarPanel = class RecordingStateDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.RecordingStateDetailsSidebarPanel = class RecordingStateDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("recording-state", WebInspector.UIString("State"));
+        super("recording-state", WI.UIString("State"));
 
         this._recording = null;
         this._index = NaN;
@@ -49,7 +49,7 @@
         if (!(objects instanceof Array))
             objects = [objects];
 
-        this.recording = objects.find((object) => object instanceof WebInspector.Recording && object.type === WebInspector.Recording.Type.Canvas2D);
+        this.recording = objects.find((object) => object instanceof WI.Recording && object.type === WI.Recording.Type.Canvas2D);
 
         return !!this._recording;
     }
@@ -74,7 +74,7 @@
 
         this._index = index;
 
-        if (this._recording.type === WebInspector.Recording.Type.Canvas2D)
+        if (this._recording.type === WI.Recording.Type.Canvas2D)
             this._generateDetailsCanvas2D(context, options);
 
         this.updateLayoutIfNeeded();
@@ -85,9 +85,9 @@
     _generateDetailsCanvas2D(context, options = {})
     {
         if (!this._dataGrid) {
-            this._dataGrid = new WebInspector.DataGrid({
-                name: {title: WebInspector.UIString("Name")},
-                value: {title: WebInspector.UIString("Value")},
+            this._dataGrid = new WI.DataGrid({
+                name: {title: WI.UIString("Name")},
+                value: {title: WI.UIString("Value")},
             });
         }
         if (!this._dataGrid.parentView)
@@ -135,9 +135,9 @@
                     value = document.createElement("span");
                     value.classList.add("unavailable");
                     if (isGradient)
-                        value.textContent = WebInspector.unlocalizedString("Gradient");
+                        value.textContent = WI.unlocalizedString("Gradient");
                     else if (isPattern)
-                        value.textContent = WebInspector.unlocalizedString("Pattern");
+                        value.textContent = WI.unlocalizedString("Pattern");
                 } else {
                     if (value instanceof DOMMatrix)
                         value = [value.a, value.b, value.c, value.d, value.e, value.f];
@@ -153,7 +153,7 @@
                 classNames.push("non-standard");
 
             const hasChildren = false;
-            this._dataGrid.appendChild(new WebInspector.DataGridNode({name, value}, hasChildren, classNames));
+            this._dataGrid.appendChild(new WI.DataGridNode({name, value}, hasChildren, classNames));
         }
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/RecordingTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/RecordingTabContentView.js
index 7492487..745ff8e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RecordingTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RecordingTabContentView.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RecordingTabContentView = class RecordingTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.RecordingTabContentView = class RecordingTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor()
     {
-        let {image, title} = WebInspector.RecordingTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
+        let {image, title} = WI.RecordingTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
 
-        const navigationSidebarPanelConstructor = WebInspector.RecordingNavigationSidebarPanel;
-        const detailsSidebarPanelConstructors = [WebInspector.RecordingStateDetailsSidebarPanel, WebInspector.CanvasDetailsSidebarPanel];
+        const navigationSidebarPanelConstructor = WI.RecordingNavigationSidebarPanel;
+        const detailsSidebarPanelConstructors = [WI.RecordingStateDetailsSidebarPanel, WI.CanvasDetailsSidebarPanel];
         const disableBackForward = true;
-        let flexibleNavigationItem = new WebInspector.ScrubberNavigationItem;
+        let flexibleNavigationItem = new WI.ScrubberNavigationItem;
         super("recording", "recording", tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors, disableBackForward, flexibleNavigationItem);
 
         this._visualActionIndexes = [];
@@ -41,10 +41,10 @@
         this._scrubberNavigationItem = flexibleNavigationItem;
         this._scrubberNavigationItem.value = 0;
         this._scrubberNavigationItem.disabled = true;
-        this._scrubberNavigationItem.addEventListener(WebInspector.ScrubberNavigationItem.Event.ValueChanged, this._scrubberNavigationItemValueChanged, this);
+        this._scrubberNavigationItem.addEventListener(WI.ScrubberNavigationItem.Event.ValueChanged, this._scrubberNavigationItemValueChanged, this);
 
-        this.navigationSidebarPanel.addEventListener(WebInspector.RecordingNavigationSidebarPanel.Event.Import, this._navigationSidebarImport, this);
-        this.navigationSidebarPanel.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._navigationSidebarTreeOutlineSelectionChanged, this);
+        this.navigationSidebarPanel.addEventListener(WI.RecordingNavigationSidebarPanel.Event.Import, this._navigationSidebarImport, this);
+        this.navigationSidebarPanel.contentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._navigationSidebarTreeOutlineSelectionChanged, this);
 
         this._recording = null;
     }
@@ -55,7 +55,7 @@
     {
         return {
             image: "Images/Recording.svg",
-            title: WebInspector.UIString("Recording"),
+            title: WI.UIString("Recording"),
         };
     }
 
@@ -63,7 +63,7 @@
 
     get type()
     {
-        return WebInspector.RecordingTabContentView.Type;
+        return WI.RecordingTabContentView.Type;
     }
 
     canShowRepresentedObject(representedObject)
@@ -73,7 +73,7 @@
         if (this._recording)
             return false;
 
-        return representedObject instanceof WebInspector.Recording;
+        return representedObject instanceof WI.Recording;
     }
 
     showRepresentedObject(representedObject, cookie)
@@ -156,9 +156,9 @@
 
     _navigationSidebarImport(event)
     {
-        let recording = WebInspector.Recording.fromPayload(event.data.payload);
+        let recording = WI.Recording.fromPayload(event.data.payload);
         if (!recording) {
-            WebInspector.Recording.synthesizeError(WebInspector.UIString("unsupported version."));
+            WI.Recording.synthesizeError(WI.UIString("unsupported version."));
             return;
         }
 
@@ -173,10 +173,10 @@
 
         let options = {suppressNavigationUpdate: true};
         let selectedTreeElement = this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement;
-        if (selectedTreeElement instanceof WebInspector.FolderTreeElement)
+        if (selectedTreeElement instanceof WI.FolderTreeElement)
             selectedTreeElement = selectedTreeElement.children.lastValue;
         this._updateActionIndex(selectedTreeElement.index, options);
     }
 };
 
-WebInspector.RecordingTabContentView.Type = "recording";
+WI.RecordingTabContentView.Type = "recording";
diff --git a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js
index 38ecbf4..1b0f2bc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RenderingFrameTimelineDataGridNode = class RenderingFrameTimelineDataGridNode extends WebInspector.TimelineDataGridNode
+WI.RenderingFrameTimelineDataGridNode = class RenderingFrameTimelineDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(renderingFrameTimelineRecord, baseStartTime)
     {
@@ -43,11 +43,11 @@
     get data()
     {
         if (!this._cachedData) {
-            let name = WebInspector.TimelineTabContentView.displayNameForRecord(this._record);
-            let scriptTime = this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Script);
-            let layoutTime = this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Layout);
-            let paintTime = this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Paint);
-            let otherTime = this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Other);
+            let name = WI.TimelineTabContentView.displayNameForRecord(this._record);
+            let scriptTime = this._record.durationForTask(WI.RenderingFrameTimelineRecord.TaskType.Script);
+            let layoutTime = this._record.durationForTask(WI.RenderingFrameTimelineRecord.TaskType.Layout);
+            let paintTime = this._record.durationForTask(WI.RenderingFrameTimelineRecord.TaskType.Paint);
+            let otherTime = this._record.durationForTask(WI.RenderingFrameTimelineRecord.TaskType.Other);
             this._cachedData = {
                 name,
                 startTime: this._record.startTime,
diff --git a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js
index 0b9d061..91dc40a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RenderingFrameTimelineOverviewGraph = class RenderingFrameTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
+WI.RenderingFrameTimelineOverviewGraph = class RenderingFrameTimelineOverviewGraph extends WI.TimelineOverviewGraph
 {
     constructor(timeline, timelineOverview)
     {
@@ -33,7 +33,7 @@
         this.element.addEventListener("click", this._mouseClicked.bind(this));
 
         this._renderingFrameTimeline = timeline;
-        this._renderingFrameTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._timelineRecordAdded, this);
+        this._renderingFrameTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._timelineRecordAdded, this);
 
         this._selectedFrameMarker = document.createElement("div");
         this._selectedFrameMarker.classList.add("frame-marker");
@@ -58,8 +58,8 @@
         }, 0);
 
         this._graphHeightSeconds = maximumFrameDuration * 1.1;  // Add 10% margin above frames.
-        this._graphHeightSeconds = Math.min(this._graphHeightSeconds, WebInspector.RenderingFrameTimelineOverviewGraph.MaximumGraphHeightSeconds);
-        this._graphHeightSeconds = Math.max(this._graphHeightSeconds, WebInspector.RenderingFrameTimelineOverviewGraph.MinimumGraphHeightSeconds);
+        this._graphHeightSeconds = Math.min(this._graphHeightSeconds, WI.RenderingFrameTimelineOverviewGraph.MaximumGraphHeightSeconds);
+        this._graphHeightSeconds = Math.max(this._graphHeightSeconds, WI.RenderingFrameTimelineOverviewGraph.MinimumGraphHeightSeconds);
         return this._graphHeightSeconds;
     }
 
@@ -78,10 +78,10 @@
     {
         super.recordWasFiltered(record, filtered);
 
-        if (!(record instanceof WebInspector.RenderingFrameTimelineRecord))
+        if (!(record instanceof WI.RenderingFrameTimelineRecord))
             return;
 
-        record[WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol] = filtered;
+        record[WI.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol] = filtered;
 
         // Set filtered style if the frame element is within the visible range.
         const startIndex = Math.floor(this.startTime);
@@ -117,7 +117,7 @@
             let record = records[i];
             let timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex];
             if (!timelineRecordFrame)
-                timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex] = new WebInspector.TimelineRecordFrame(this, record);
+                timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex] = new WI.TimelineRecordFrame(this, record);
             else
                 timelineRecordFrame.record = record;
 
@@ -125,7 +125,7 @@
             if (!timelineRecordFrame.element.parentNode)
                 this.element.appendChild(timelineRecordFrame.element);
 
-            timelineRecordFrame.filtered = record[WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol] || false;
+            timelineRecordFrame.filtered = record[WI.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol] || false;
             ++recordFrameIndex;
         }
 
@@ -194,7 +194,7 @@
 
                 var label = document.createElement("div");
                 label.classList.add("label");
-                label.innerText = WebInspector.UIString("%d fps").format(framesPerSecond);
+                label.innerText = WI.UIString("%d fps").format(framesPerSecond);
                 divider.appendChild(label);
 
                 this.element.appendChild(divider);
@@ -226,7 +226,7 @@
         this._selectedFrameMarker.style.width = frameWidth + "px";
 
         var markerLeftPosition = this.selectedRecord.frameIndex - this.startTime;
-        let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+        let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
         this._selectedFrameMarker.style.setProperty(property, ((markerLeftPosition / this.timelineOverview.visibleDuration) * 100).toFixed(2) + "%");
 
         if (!this._selectedFrameMarker.parentElement)
@@ -248,7 +248,7 @@
     _mouseClicked(event)
     {
         let position = 0;
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             position = this.element.totalOffsetRight - event.pageX;
         else
             position = event.pageX - this.element.totalOffsetLeft;
@@ -258,7 +258,7 @@
             return;
 
         var newSelectedRecord = this._renderingFrameTimeline.records[frameIndex];
-        if (newSelectedRecord[WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol])
+        if (newSelectedRecord[WI.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol])
             return;
 
         if (this.selectedRecord === newSelectedRecord)
@@ -276,7 +276,7 @@
     }
 };
 
-WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol = Symbol("rendering-frame-overview-graph-record-was-filtered");
+WI.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol = Symbol("rendering-frame-overview-graph-record-was-filtered");
 
-WebInspector.RenderingFrameTimelineOverviewGraph.MaximumGraphHeightSeconds = 0.037;
-WebInspector.RenderingFrameTimelineOverviewGraph.MinimumGraphHeightSeconds = 0.0185;
+WI.RenderingFrameTimelineOverviewGraph.MaximumGraphHeightSeconds = 0.037;
+WI.RenderingFrameTimelineOverviewGraph.MinimumGraphHeightSeconds = 0.0185;
diff --git a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
index 5b72890..f839e11 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
@@ -23,63 +23,63 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RenderingFrameTimelineView = class RenderingFrameTimelineView extends WebInspector.TimelineView
+WI.RenderingFrameTimelineView = class RenderingFrameTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline, extraArguments);
 
-        console.assert(WebInspector.TimelineRecord.Type.RenderingFrame);
+        console.assert(WI.TimelineRecord.Type.RenderingFrame);
 
         var scopeBarItems = [];
-        for (var key in WebInspector.RenderingFrameTimelineView.DurationFilter) {
-            var value = WebInspector.RenderingFrameTimelineView.DurationFilter[key];
-            scopeBarItems.push(new WebInspector.ScopeBarItem(value, WebInspector.RenderingFrameTimelineView.displayNameForDurationFilter(value)));
+        for (var key in WI.RenderingFrameTimelineView.DurationFilter) {
+            var value = WI.RenderingFrameTimelineView.DurationFilter[key];
+            scopeBarItems.push(new WI.ScopeBarItem(value, WI.RenderingFrameTimelineView.displayNameForDurationFilter(value)));
         }
 
-        this._scopeBar = new WebInspector.ScopeBar("rendering-frame-scope-bar", scopeBarItems, scopeBarItems[0], true);
-        this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+        this._scopeBar = new WI.ScopeBar("rendering-frame-scope-bar", scopeBarItems, scopeBarItems[0], true);
+        this._scopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
 
         let columns = {name: {}, totalTime: {}, scriptTime: {}, layoutTime: {}, paintTime: {}, otherTime: {}, startTime: {}, location: {}};
 
-        columns.name.title = WebInspector.UIString("Name");
+        columns.name.title = WI.UIString("Name");
         columns.name.width = "20%";
         columns.name.icon = true;
         columns.name.disclosure = true;
         columns.name.locked = true;
 
-        columns.totalTime.title = WebInspector.UIString("Total Time");
+        columns.totalTime.title = WI.UIString("Total Time");
         columns.totalTime.width = "15%";
         columns.totalTime.aligned = "right";
 
-        columns.scriptTime.title = WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Script);
+        columns.scriptTime.title = WI.RenderingFrameTimelineRecord.displayNameForTaskType(WI.RenderingFrameTimelineRecord.TaskType.Script);
         columns.scriptTime.width = "10%";
         columns.scriptTime.aligned = "right";
 
-        columns.layoutTime.title = WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Layout);
+        columns.layoutTime.title = WI.RenderingFrameTimelineRecord.displayNameForTaskType(WI.RenderingFrameTimelineRecord.TaskType.Layout);
         columns.layoutTime.width = "10%";
         columns.layoutTime.aligned = "right";
 
-        columns.paintTime.title = WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Paint);
+        columns.paintTime.title = WI.RenderingFrameTimelineRecord.displayNameForTaskType(WI.RenderingFrameTimelineRecord.TaskType.Paint);
         columns.paintTime.width = "10%";
         columns.paintTime.aligned = "right";
 
-        columns.otherTime.title = WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Other);
+        columns.otherTime.title = WI.RenderingFrameTimelineRecord.displayNameForTaskType(WI.RenderingFrameTimelineRecord.TaskType.Other);
         columns.otherTime.width = "10%";
         columns.otherTime.aligned = "right";
 
-        columns.startTime.title = WebInspector.UIString("Start Time");
+        columns.startTime.title = WI.UIString("Start Time");
         columns.startTime.width = "15%";
         columns.startTime.aligned = "right";
 
-        columns.location.title = WebInspector.UIString("Location");
+        columns.location.title = WI.UIString("Location");
 
         for (var column in columns)
             columns[column].sortable = true;
 
-        this._dataGrid = new WebInspector.TimelineDataGrid(columns);
+        this._dataGrid = new WI.TimelineDataGrid(columns);
         this._dataGrid.sortColumnIdentifier = "startTime";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("rendering-frame-timeline-view");
 
         this.setupDataGrid(this._dataGrid);
@@ -87,7 +87,7 @@
         this.element.classList.add("rendering-frame");
         this.addSubview(this._dataGrid);
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._renderingFrameTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._renderingFrameTimelineRecordAdded, this);
 
         this._pendingRecords = [];
     }
@@ -95,12 +95,12 @@
     static displayNameForDurationFilter(filter)
     {
         switch (filter) {
-            case WebInspector.RenderingFrameTimelineView.DurationFilter.All:
-                return WebInspector.UIString("All");
-            case WebInspector.RenderingFrameTimelineView.DurationFilter.OverOneMillisecond:
-                return WebInspector.UIString("Over 1 ms");
-            case WebInspector.RenderingFrameTimelineView.DurationFilter.OverFifteenMilliseconds:
-                return WebInspector.UIString("Over 15 ms");
+            case WI.RenderingFrameTimelineView.DurationFilter.All:
+                return WI.UIString("All");
+            case WI.RenderingFrameTimelineView.DurationFilter.OverOneMillisecond:
+                return WI.UIString("Over 1 ms");
+            case WI.RenderingFrameTimelineView.DurationFilter.OverFifteenMilliseconds:
+                return WI.UIString("Over 15 ms");
             default:
                 console.error("Unknown filter type", filter);
         }
@@ -128,7 +128,7 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
 
         this._dataGrid.closed();
@@ -143,12 +143,12 @@
         let pathComponents = [];
 
         while (dataGridNode && !dataGridNode.root) {
-            console.assert(dataGridNode instanceof WebInspector.TimelineDataGridNode);
+            console.assert(dataGridNode instanceof WI.TimelineDataGridNode);
             if (dataGridNode.hidden)
                 return null;
 
-            let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+            let pathComponent = new WI.TimelineDataGridNodePathComponent(dataGridNode);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
             pathComponents.unshift(pathComponent);
             dataGridNode = dataGridNode.parent;
         }
@@ -197,8 +197,8 @@
 
     dataGridNodeForTreeElement(treeElement)
     {
-        if (treeElement instanceof WebInspector.ProfileNodeTreeElement)
-            return new WebInspector.ProfileNodeDataGridNode(treeElement.profileNode, this.zeroTime, this.startTime, this.endTime);
+        if (treeElement instanceof WI.ProfileNodeTreeElement)
+            return new WI.ProfileNodeDataGridNode(treeElement.profileNode, this.zeroTime, this.startTime, this.endTime);
         return null;
     }
 
@@ -207,20 +207,20 @@
         if (!super.matchDataGridNodeAgainstCustomFilters(node))
             return false;
 
-        console.assert(node instanceof WebInspector.TimelineDataGridNode);
+        console.assert(node instanceof WI.TimelineDataGridNode);
         console.assert(this._scopeBar.selectedItems.length === 1);
         let selectedScopeBarItem = this._scopeBar.selectedItems[0];
-        if (!selectedScopeBarItem || selectedScopeBarItem.id === WebInspector.RenderingFrameTimelineView.DurationFilter.All)
+        if (!selectedScopeBarItem || selectedScopeBarItem.id === WI.RenderingFrameTimelineView.DurationFilter.All)
             return true;
 
-        while (node && !(node.record instanceof WebInspector.RenderingFrameTimelineRecord))
+        while (node && !(node.record instanceof WI.RenderingFrameTimelineRecord))
             node = node.parent;
 
         console.assert(node, "Cannot apply duration filter: no RenderingFrameTimelineRecord found.");
         if (!node)
             return false;
 
-        let minimumDuration = selectedScopeBarItem.id === WebInspector.RenderingFrameTimelineView.DurationFilter.OverOneMillisecond ? 0.001 : 0.015;
+        let minimumDuration = selectedScopeBarItem.id === WI.RenderingFrameTimelineView.DurationFilter.OverOneMillisecond ? 0.001 : 0.015;
         return node.record.duration > minimumDuration;
     }
 
@@ -237,9 +237,9 @@
             return;
 
         for (let renderingFrameTimelineRecord of this._pendingRecords) {
-            console.assert(renderingFrameTimelineRecord instanceof WebInspector.RenderingFrameTimelineRecord);
+            console.assert(renderingFrameTimelineRecord instanceof WI.RenderingFrameTimelineRecord);
 
-            let dataGridNode = new WebInspector.RenderingFrameTimelineDataGridNode(renderingFrameTimelineRecord, this.zeroTime);
+            let dataGridNode = new WI.RenderingFrameTimelineDataGridNode(renderingFrameTimelineRecord, this.zeroTime);
             this._dataGrid.addRowInSortOrder(null, dataGridNode);
 
             let stack = [{children: renderingFrameTimelineRecord.children, parentDataGridNode: dataGridNode, index: 0}];
@@ -252,23 +252,23 @@
 
                 let childRecord = entry.children[entry.index];
                 let childDataGridNode = null;
-                if (childRecord.type === WebInspector.TimelineRecord.Type.Layout) {
-                    childDataGridNode = new WebInspector.LayoutTimelineDataGridNode(childRecord, this.zeroTime);
+                if (childRecord.type === WI.TimelineRecord.Type.Layout) {
+                    childDataGridNode = new WI.LayoutTimelineDataGridNode(childRecord, this.zeroTime);
 
                     this._dataGrid.addRowInSortOrder(null, childDataGridNode, entry.parentDataGridNode);
-                } else if (childRecord.type === WebInspector.TimelineRecord.Type.Script) {
+                } else if (childRecord.type === WI.TimelineRecord.Type.Script) {
                     let rootNodes = [];
                     if (childRecord.profile) {
                         // FIXME: Support using the bottom-up tree once it is implemented.
                         rootNodes = childRecord.profile.topDownRootNodes;
                     }
 
-                    childDataGridNode = new WebInspector.ScriptTimelineDataGridNode(childRecord, this.zeroTime);
+                    childDataGridNode = new WI.ScriptTimelineDataGridNode(childRecord, this.zeroTime);
 
                     this._dataGrid.addRowInSortOrder(null, childDataGridNode, entry.parentDataGridNode);
 
                     for (let profileNode of rootNodes) {
-                        let profileNodeDataGridNode = new WebInspector.ProfileNodeDataGridNode(profileNode, this.zeroTime, this.startTime, this.endTime);
+                        let profileNodeDataGridNode = new WI.ProfileNodeDataGridNode(profileNode, this.zeroTime, this.startTime, this.endTime);
                         this._dataGrid.addRowInSortOrder(null, profileNodeDataGridNode, childDataGridNode);
                     }
                 }
@@ -285,7 +285,7 @@
     _renderingFrameTimelineRecordAdded(event)
     {
         var renderingFrameTimelineRecord = event.data.record;
-        console.assert(renderingFrameTimelineRecord instanceof WebInspector.RenderingFrameTimelineRecord);
+        console.assert(renderingFrameTimelineRecord instanceof WI.RenderingFrameTimelineRecord);
         console.assert(renderingFrameTimelineRecord.children.length, "Missing child records for rendering frame.");
 
         this._pendingRecords.push(renderingFrameTimelineRecord);
@@ -299,7 +299,7 @@
     }
 };
 
-WebInspector.RenderingFrameTimelineView.DurationFilter = {
+WI.RenderingFrameTimelineView.DurationFilter = {
     All: "rendering-frame-timeline-view-duration-filter-all",
     OverOneMillisecond: "rendering-frame-timeline-view-duration-filter-over-1-ms",
     OverFifteenMilliseconds: "rendering-frame-timeline-view-duration-filter-over-15-ms"
diff --git a/Source/WebInspectorUI/UserInterface/Views/Resizer.js b/Source/WebInspectorUI/UserInterface/Views/Resizer.js
index 076a7c9..71e2c3a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Resizer.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Resizer.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Resizer = class Resizer extends WebInspector.Object
+WI.Resizer = class Resizer extends WI.Object
 {
     constructor(ruleOrientation, delegate)
     {
@@ -37,9 +37,9 @@
         this._element = document.createElement("div");
         this._element.classList.add("resizer");
 
-        if (this._orientation === WebInspector.Resizer.RuleOrientation.Horizontal)
+        if (this._orientation === WI.Resizer.RuleOrientation.Horizontal)
             this._element.classList.add("horizontal-rule");
-        else if (this._orientation === WebInspector.Resizer.RuleOrientation.Vertical)
+        else if (this._orientation === WI.Resizer.RuleOrientation.Vertical)
             this._element.classList.add("vertical-rule");
 
         this._element.addEventListener("mousedown", this._resizerMouseDown.bind(this), false);
@@ -68,9 +68,9 @@
 
     _currentPosition()
     {
-        if (this._orientation === WebInspector.Resizer.RuleOrientation.Vertical)
+        if (this._orientation === WI.Resizer.RuleOrientation.Vertical)
             return event.pageX;
-        if (this._orientation === WebInspector.Resizer.RuleOrientation.Horizontal)
+        if (this._orientation === WI.Resizer.RuleOrientation.Horizontal)
             return event.pageY;
 
         console.assert(false, "Should not be reached!");
@@ -92,10 +92,10 @@
             return;
         }
 
-        if (this._orientation === WebInspector.Resizer.RuleOrientation.Vertical)
+        if (this._orientation === WI.Resizer.RuleOrientation.Vertical)
             document.body.style.cursor = "col-resize";
         else {
-            console.assert(this._orientation === WebInspector.Resizer.RuleOrientation.Horizontal);
+            console.assert(this._orientation === WI.Resizer.RuleOrientation.Horizontal);
             document.body.style.cursor = "row-resize";
         }
 
@@ -109,13 +109,13 @@
         // Install a global "glass pane" which prevents cursor from changing during the drag interaction.
         // The cursor could change when hovering over links, text, or other elements with cursor cues.
         // FIXME: when Pointer Events support is available this could be implemented by drawing the cursor ourselves.
-        if (WebInspector._elementDraggingGlassPane)
-            WebInspector._elementDraggingGlassPane.remove();
+        if (WI._elementDraggingGlassPane)
+            WI._elementDraggingGlassPane.remove();
 
         var glassPaneElement = document.createElement("div");
         glassPaneElement.className = "glass-pane-for-drag";
         document.body.appendChild(glassPaneElement);
-        WebInspector._elementDraggingGlassPane = glassPaneElement;
+        WI._elementDraggingGlassPane = glassPaneElement;
     }
 
     _resizerMouseMoved(event)
@@ -134,9 +134,9 @@
 
         document.body.style.removeProperty("cursor");
 
-        if (WebInspector._elementDraggingGlassPane) {
-            WebInspector._elementDraggingGlassPane.remove();
-            delete WebInspector._elementDraggingGlassPane;
+        if (WI._elementDraggingGlassPane) {
+            WI._elementDraggingGlassPane.remove();
+            delete WI._elementDraggingGlassPane;
         }
 
         document.removeEventListener("mousemove", this._resizerMouseMovedEventListener, false);
@@ -152,7 +152,7 @@
     }
 };
 
-WebInspector.Resizer.RuleOrientation = {
+WI.Resizer.RuleOrientation = {
     Horizontal: Symbol("resizer-rule-orientation-horizontal"),
     Vertical: Symbol("resizer-rule-orientation-vertical"),
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js
index fed6b55..e76bca1 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js
@@ -23,31 +23,31 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceClusterContentView = class ResourceClusterContentView extends WebInspector.ClusterContentView
+WI.ResourceClusterContentView = class ResourceClusterContentView extends WI.ClusterContentView
 {
     constructor(resource)
     {
         super(resource);
 
         this._resource = resource;
-        this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, this._resourceLoadingDidFinish, this);
+        this._resource.addEventListener(WI.Resource.Event.TypeDidChange, this._resourceTypeDidChange, this);
+        this._resource.addEventListener(WI.Resource.Event.LoadingDidFinish, this._resourceLoadingDidFinish, this);
 
         function createPathComponent(displayName, className, identifier)
         {
-            let pathComponent = new WebInspector.HierarchicalPathComponent(displayName, className, identifier, false, true);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+            let pathComponent = new WI.HierarchicalPathComponent(displayName, className, identifier, false, true);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
             pathComponent.comparisonData = resource;
             return pathComponent;
         }
 
-        this._requestPathComponent = createPathComponent.call(this, WebInspector.UIString("Request"), WebInspector.ResourceClusterContentView.RequestIconStyleClassName, WebInspector.ResourceClusterContentView.RequestIdentifier);
-        this._responsePathComponent = createPathComponent.call(this, WebInspector.UIString("Response"), WebInspector.ResourceClusterContentView.ResponseIconStyleClassName, WebInspector.ResourceClusterContentView.ResponseIdentifier);
+        this._requestPathComponent = createPathComponent.call(this, WI.UIString("Request"), WI.ResourceClusterContentView.RequestIconStyleClassName, WI.ResourceClusterContentView.RequestIdentifier);
+        this._responsePathComponent = createPathComponent.call(this, WI.UIString("Response"), WI.ResourceClusterContentView.ResponseIconStyleClassName, WI.ResourceClusterContentView.ResponseIdentifier);
 
         this._requestPathComponent.nextSibling = this._responsePathComponent;
         this._responsePathComponent.previousSibling = this._requestPathComponent;
 
-        this._currentContentViewSetting = new WebInspector.Setting("resource-current-view-" + this._resource.url.hash, WebInspector.ResourceClusterContentView.ResponseIdentifier);
+        this._currentContentViewSetting = new WI.Setting("resource-current-view-" + this._resource.url.hash, WI.ResourceClusterContentView.ResponseIdentifier);
     }
 
     // Public
@@ -63,36 +63,36 @@
             return this._responseContentView;
 
         switch (this._resource.type) {
-        case WebInspector.Resource.Type.Document:
-        case WebInspector.Resource.Type.Script:
-        case WebInspector.Resource.Type.Stylesheet:
-            this._responseContentView = new WebInspector.TextResourceContentView(this._resource);
+        case WI.Resource.Type.Document:
+        case WI.Resource.Type.Script:
+        case WI.Resource.Type.Stylesheet:
+            this._responseContentView = new WI.TextResourceContentView(this._resource);
             break;
 
-        case WebInspector.Resource.Type.XHR:
-        case WebInspector.Resource.Type.Fetch:
+        case WI.Resource.Type.XHR:
+        case WI.Resource.Type.Fetch:
             // FIXME: <https://webkit.org/b/165495> Web Inspector: XHR / Fetch for non-text content should not show garbled text
             // XHR / Fetch content may not always be text.
-            this._responseContentView = new WebInspector.TextResourceContentView(this._resource);
+            this._responseContentView = new WI.TextResourceContentView(this._resource);
             break;
 
-        case WebInspector.Resource.Type.Image:
+        case WI.Resource.Type.Image:
             if (this._resource.mimeTypeComponents.type === "image/svg+xml")
-                this._responseContentView = new WebInspector.SVGImageResourceClusterContentView(this._resource);
+                this._responseContentView = new WI.SVGImageResourceClusterContentView(this._resource);
             else
-                this._responseContentView = new WebInspector.ImageResourceContentView(this._resource);
+                this._responseContentView = new WI.ImageResourceContentView(this._resource);
             break;
 
-        case WebInspector.Resource.Type.Font:
-            this._responseContentView = new WebInspector.FontResourceContentView(this._resource);
+        case WI.Resource.Type.Font:
+            this._responseContentView = new WI.FontResourceContentView(this._resource);
             break;
 
-        case WebInspector.Resource.Type.WebSocket:
-            this._responseContentView = new WebInspector.WebSocketContentView(this._resource);
+        case WI.Resource.Type.WebSocket:
+            this._responseContentView = new WI.WebSocketContentView(this._resource);
             break;
 
         default:
-            this._responseContentView = new WebInspector.GenericResourceContentView(this._resource);
+            this._responseContentView = new WI.GenericResourceContentView(this._resource);
             break;
         }
 
@@ -107,7 +107,7 @@
         if (this._requestContentView)
             return this._requestContentView;
 
-        this._requestContentView = new WebInspector.TextContentView(this._resource.requestData || "", this._resource.requestDataContentType);
+        this._requestContentView = new WI.TextContentView(this._resource.requestData || "", this._resource.requestDataContentType);
 
         return this._requestContentView;
     }
@@ -145,21 +145,21 @@
 
     saveToCookie(cookie)
     {
-        cookie[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
+        cookie[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
     }
 
     restoreFromCookie(cookie)
     {
-        var contentView = this._showContentViewForIdentifier(cookie[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]);
+        var contentView = this._showContentViewForIdentifier(cookie[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey]);
         if (typeof contentView.revealPosition === "function" && "lineNumber" in cookie && "columnNumber" in cookie)
-            contentView.revealPosition(new WebInspector.SourceCodePosition(cookie.lineNumber, cookie.columnNumber));
+            contentView.revealPosition(new WI.SourceCodePosition(cookie.lineNumber, cookie.columnNumber));
     }
 
     showRequest()
     {
         this._shownInitialContent = true;
 
-        return this._showContentViewForIdentifier(WebInspector.ResourceClusterContentView.RequestIdentifier);
+        return this._showContentViewForIdentifier(WI.ResourceClusterContentView.RequestIdentifier);
     }
 
     showResponse(positionToReveal, textRangeToSelect, forceUnformatted)
@@ -172,7 +172,7 @@
             this._forceUnformatted = forceUnformatted;
         }
 
-        var responseContentView = this._showContentViewForIdentifier(WebInspector.ResourceClusterContentView.ResponseIdentifier);
+        var responseContentView = this._showContentViewForIdentifier(WI.ResourceClusterContentView.ResponseIdentifier);
         if (typeof responseContentView.revealPosition === "function")
             responseContentView.revealPosition(positionToReveal, textRangeToSelect, forceUnformatted);
         return responseContentView;
@@ -212,9 +212,9 @@
         if (!contentView)
             return null;
         if (contentView === this._requestContentView)
-            return WebInspector.ResourceClusterContentView.RequestIdentifier;
+            return WI.ResourceClusterContentView.RequestIdentifier;
         if (contentView === this._responseContentView)
-            return WebInspector.ResourceClusterContentView.ResponseIdentifier;
+            return WI.ResourceClusterContentView.ResponseIdentifier;
         console.error("Unknown contentView.");
         return null;
     }
@@ -224,10 +224,10 @@
         var contentViewToShow = null;
 
         switch (identifier) {
-        case WebInspector.ResourceClusterContentView.RequestIdentifier:
+        case WI.ResourceClusterContentView.RequestIdentifier:
             contentViewToShow = this._canShowRequestContentView() ? this.requestContentView : null;
             break;
-        case WebInspector.ResourceClusterContentView.ResponseIdentifier:
+        case WI.ResourceClusterContentView.ResponseIdentifier:
             contentViewToShow = this.responseContentView;
             break;
         }
@@ -275,9 +275,9 @@
     }
 };
 
-WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey = "resource-cluster-content-view-identifier";
+WI.ResourceClusterContentView.ContentViewIdentifierCookieKey = "resource-cluster-content-view-identifier";
 
-WebInspector.ResourceClusterContentView.RequestIconStyleClassName = "request-icon";
-WebInspector.ResourceClusterContentView.ResponseIconStyleClassName = "response-icon";
-WebInspector.ResourceClusterContentView.RequestIdentifier = "request";
-WebInspector.ResourceClusterContentView.ResponseIdentifier = "response";
+WI.ResourceClusterContentView.RequestIconStyleClassName = "request-icon";
+WI.ResourceClusterContentView.ResponseIconStyleClassName = "response-icon";
+WI.ResourceClusterContentView.RequestIdentifier = "request";
+WI.ResourceClusterContentView.ResponseIdentifier = "response";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
index f61038b..dc1b518 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceContentView = class ResourceContentView extends WebInspector.ContentView
+WI.ResourceContentView = class ResourceContentView extends WI.ContentView
 {
     constructor(resource, styleClassName)
     {
-        console.assert(resource instanceof WebInspector.Resource || resource instanceof WebInspector.CSSStyleSheet, resource);
+        console.assert(resource instanceof WI.Resource || resource instanceof WI.CSSStyleSheet, resource);
         console.assert(typeof styleClassName === "string");
 
         super(resource);
@@ -39,7 +39,7 @@
         this._spinnerTimeout = setTimeout(() => {
             // Append a spinner while waiting for contentAvailable. Subclasses are responsible for
             // removing the spinner before showing the resource content by calling removeLoadingIndicator.
-            let spinner = new WebInspector.IndeterminateProgressSpinner;
+            let spinner = new WI.IndeterminateProgressSpinner;
             this.element.appendChild(spinner.element);
 
             this._spinnerTimeout = undefined;
@@ -51,9 +51,9 @@
         resource.requestContent().then(this._contentAvailable.bind(this)).catch(this.showGenericErrorMessage.bind(this));
 
         if (!this.managesOwnIssues) {
-            WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
+            WI.issueManager.addEventListener(WI.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
 
-            var issues = WebInspector.issueManager.issuesForSourceCode(resource);
+            var issues = WI.issueManager.issuesForSourceCode(resource);
             for (var i = 0; i < issues.length; ++i)
                 this.addIssue(issues[i]);
         }
@@ -83,14 +83,14 @@
 
     showGenericErrorMessage()
     {
-        this._contentError(WebInspector.UIString("An error occurred trying to load the resource."));
+        this._contentError(WI.UIString("An error occurred trying to load the resource."));
     }
 
     addIssue(issue)
     {
         // This generically shows only the last issue, subclasses can override for better handling.
         this.element.removeChildren();
-        this.element.appendChild(WebInspector.createMessageTextView(issue.text, issue.level === WebInspector.IssueMessage.Level.Error));
+        this.element.appendChild(WI.createMessageTextView(issue.text, issue.level === WI.IssueMessage.Level.Error));
     }
 
     closed()
@@ -98,7 +98,7 @@
         super.closed();
 
         if (!this.managesOwnIssues)
-            WebInspector.issueManager.removeEventListener(null, null, this);
+            WI.issueManager.removeEventListener(null, null, this);
     }
 
     // Protected
@@ -135,9 +135,9 @@
 
         this.removeLoadingIndicator();
 
-        this.element.appendChild(WebInspector.createMessageTextView(error, true));
+        this.element.appendChild(WI.createMessageTextView(error, true));
 
-        this.dispatchEventToListeners(WebInspector.ResourceContentView.Event.ContentError);
+        this.dispatchEventToListeners(WI.ResourceContentView.Event.ContentError);
     }
 
     _hasContent()
@@ -150,7 +150,7 @@
         console.assert(!this.managesOwnIssues);
 
         var issue = event.data.issue;
-        if (!WebInspector.IssueManager.issueMatchSourceCode(issue, this.resource))
+        if (!WI.IssueManager.issueMatchSourceCode(issue, this.resource))
             return;
 
         this.addIssue(issue);
@@ -158,10 +158,10 @@
 
     _mouseWasClicked(event)
     {
-        WebInspector.handlePossibleLinkClick(event, this.resource.parentFrame);
+        WI.handlePossibleLinkClick(event, this.resource.parentFrame);
     }
 };
 
-WebInspector.ResourceContentView.Event = {
+WI.ResourceContentView.Event = {
     ContentError: "resource-content-view-content-error",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js
index 290dd6d..c7fdd8a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceDetailsSidebarPanel = class ResourceDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.ResourceDetailsSidebarPanel = class ResourceDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("resource-details", WebInspector.UIString("Resource"));
+        super("resource-details", WI.UIString("Resource"));
 
         this.element.classList.add("resource");
 
@@ -46,21 +46,21 @@
 
         var resourceToInspect = null;
 
-        // Iterate over the objects to find a WebInspector.Resource to inspect.
+        // Iterate over the objects to find a WI.Resource to inspect.
         for (let object of objects) {
-            if (object instanceof WebInspector.Resource) {
+            if (object instanceof WI.Resource) {
                 resourceToInspect = object;
                 break;
             }
 
-            if (object instanceof WebInspector.Frame) {
+            if (object instanceof WI.Frame) {
                 resourceToInspect = object.mainResource;
                 break;
             }
 
             // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
             // If that was the case, then we could just have WorkerTreeElement contain the Resource and not a Script.
-            if (object instanceof WebInspector.Script && object.isMainResource() && object.resource) {
+            if (object instanceof WI.Script && object.isMainResource() && object.resource) {
                 resourceToInspect = object.resource;
                 break;
             }
@@ -82,16 +82,16 @@
             return;
 
         if (this._resource && this._needsToRemoveResourceEventListeners) {
-            this._resource.removeEventListener(WebInspector.Resource.Event.URLDidChange, this._refreshURL, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.MIMETypeDidChange, this._refreshMIMEType, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange, this._refreshResourceType, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFail, this._refreshErrorReason, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.RequestHeadersDidChange, this._refreshRequestHeaders, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.ResponseReceived, this._refreshRequestAndResponse, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.CacheStatusDidChange, this._refreshRequestAndResponse, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.SizeDidChange, this._refreshDecodedSize, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.TransferSizeDidChange, this._refreshTransferSize, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.InitiatedResourcesDidChange, this._refreshRelatedResourcesSection, this);
+            this._resource.removeEventListener(WI.Resource.Event.URLDidChange, this._refreshURL, this);
+            this._resource.removeEventListener(WI.Resource.Event.MIMETypeDidChange, this._refreshMIMEType, this);
+            this._resource.removeEventListener(WI.Resource.Event.TypeDidChange, this._refreshResourceType, this);
+            this._resource.removeEventListener(WI.Resource.Event.LoadingDidFail, this._refreshErrorReason, this);
+            this._resource.removeEventListener(WI.Resource.Event.RequestHeadersDidChange, this._refreshRequestHeaders, this);
+            this._resource.removeEventListener(WI.Resource.Event.ResponseReceived, this._refreshRequestAndResponse, this);
+            this._resource.removeEventListener(WI.Resource.Event.CacheStatusDidChange, this._refreshRequestAndResponse, this);
+            this._resource.removeEventListener(WI.Resource.Event.SizeDidChange, this._refreshDecodedSize, this);
+            this._resource.removeEventListener(WI.Resource.Event.TransferSizeDidChange, this._refreshTransferSize, this);
+            this._resource.removeEventListener(WI.Resource.Event.InitiatedResourcesDidChange, this._refreshRelatedResourcesSection, this);
 
             this._needsToRemoveResourceEventListeners = false;
         }
@@ -114,82 +114,82 @@
     {
         super.initialLayout();
 
-        this._typeMIMETypeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("MIME Type"));
-        this._typeResourceTypeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Resource Type"));
+        this._typeMIMETypeRow = new WI.DetailsSectionSimpleRow(WI.UIString("MIME Type"));
+        this._typeResourceTypeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Resource Type"));
 
-        this._typeSection = new WebInspector.DetailsSection("resource-type", WebInspector.UIString("Type"));
-        this._typeSection.groups = [new WebInspector.DetailsSectionGroup([this._typeMIMETypeRow, this._typeResourceTypeRow])];
+        this._typeSection = new WI.DetailsSection("resource-type", WI.UIString("Type"));
+        this._typeSection.groups = [new WI.DetailsSectionGroup([this._typeMIMETypeRow, this._typeResourceTypeRow])];
 
-        this._locationFullURLRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Full URL"));
-        this._locationSchemeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Scheme"));
-        this._locationHostRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Host"));
-        this._locationPortRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Port"));
-        this._locationPathRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Path"));
-        this._locationQueryStringRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Query String"));
-        this._locationFragmentRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Fragment"));
-        this._locationFilenameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Filename"));
-        this._initiatorRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Initiator"));
-        this._initiatedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Initiated"));
+        this._locationFullURLRow = new WI.DetailsSectionSimpleRow(WI.UIString("Full URL"));
+        this._locationSchemeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Scheme"));
+        this._locationHostRow = new WI.DetailsSectionSimpleRow(WI.UIString("Host"));
+        this._locationPortRow = new WI.DetailsSectionSimpleRow(WI.UIString("Port"));
+        this._locationPathRow = new WI.DetailsSectionSimpleRow(WI.UIString("Path"));
+        this._locationQueryStringRow = new WI.DetailsSectionSimpleRow(WI.UIString("Query String"));
+        this._locationFragmentRow = new WI.DetailsSectionSimpleRow(WI.UIString("Fragment"));
+        this._locationFilenameRow = new WI.DetailsSectionSimpleRow(WI.UIString("Filename"));
+        this._initiatorRow = new WI.DetailsSectionSimpleRow(WI.UIString("Initiator"));
+        this._initiatedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Initiated"));
 
         var firstGroup = [this._locationFullURLRow];
         var secondGroup = [this._locationSchemeRow, this._locationHostRow, this._locationPortRow, this._locationPathRow, this._locationQueryStringRow, this._locationFragmentRow, this._locationFilenameRow];
         var thirdGroup = [this._initiatorRow, this._initiatedRow];
 
-        this._fullURLGroup = new WebInspector.DetailsSectionGroup(firstGroup);
-        this._locationURLComponentsGroup = new WebInspector.DetailsSectionGroup(secondGroup);
-        this._relatedResourcesGroup = new WebInspector.DetailsSectionGroup(thirdGroup);
+        this._fullURLGroup = new WI.DetailsSectionGroup(firstGroup);
+        this._locationURLComponentsGroup = new WI.DetailsSectionGroup(secondGroup);
+        this._relatedResourcesGroup = new WI.DetailsSectionGroup(thirdGroup);
 
-        this._locationSection = new WebInspector.DetailsSection("resource-location", WebInspector.UIString("Location"), [this._fullURLGroup, this._locationURLComponentsGroup, this._relatedResourcesGroup]);
+        this._locationSection = new WI.DetailsSection("resource-location", WI.UIString("Location"), [this._fullURLGroup, this._locationURLComponentsGroup, this._relatedResourcesGroup]);
 
-        this._queryParametersRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Query Parameters"));
-        this._queryParametersSection = new WebInspector.DetailsSection("resource-query-parameters", WebInspector.UIString("Query Parameters"));
-        this._queryParametersSection.groups = [new WebInspector.DetailsSectionGroup([this._queryParametersRow])];
+        this._queryParametersRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Query Parameters"));
+        this._queryParametersSection = new WI.DetailsSection("resource-query-parameters", WI.UIString("Query Parameters"));
+        this._queryParametersSection.groups = [new WI.DetailsSectionGroup([this._queryParametersRow])];
 
-        this._requestDataSection = new WebInspector.DetailsSection("resource-request-data", WebInspector.UIString("Request Data"));
+        this._requestDataSection = new WI.DetailsSection("resource-request-data", WI.UIString("Request Data"));
 
-        this._requestMethodRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Method"));
-        this._protocolRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Protocol"));
-        this._priorityRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Priority"));
-        this._cachedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Cached"));
+        this._requestMethodRow = new WI.DetailsSectionSimpleRow(WI.UIString("Method"));
+        this._protocolRow = new WI.DetailsSectionSimpleRow(WI.UIString("Protocol"));
+        this._priorityRow = new WI.DetailsSectionSimpleRow(WI.UIString("Priority"));
+        this._cachedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Cached"));
 
-        this._statusTextRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Status"));
-        this._statusCodeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Code"));
-        this._errorReasonRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Error"));
+        this._statusTextRow = new WI.DetailsSectionSimpleRow(WI.UIString("Status"));
+        this._statusCodeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Code"));
+        this._errorReasonRow = new WI.DetailsSectionSimpleRow(WI.UIString("Error"));
 
-        this._remoteAddressRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("IP Address"));
-        this._connectionIdentifierRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Connection ID"));
+        this._remoteAddressRow = new WI.DetailsSectionSimpleRow(WI.UIString("IP Address"));
+        this._connectionIdentifierRow = new WI.DetailsSectionSimpleRow(WI.UIString("Connection ID"));
 
-        this._encodedSizeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Encoded"));
-        this._decodedSizeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Decoded"));
-        this._transferSizeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Transferred"));
+        this._encodedSizeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Encoded"));
+        this._decodedSizeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Decoded"));
+        this._transferSizeRow = new WI.DetailsSectionSimpleRow(WI.UIString("Transferred"));
 
-        this._compressedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Compressed"));
-        this._compressionRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Compression"));
+        this._compressedRow = new WI.DetailsSectionSimpleRow(WI.UIString("Compressed"));
+        this._compressionRow = new WI.DetailsSectionSimpleRow(WI.UIString("Compression"));
 
-        let requestGroup = new WebInspector.DetailsSectionGroup([this._requestMethodRow, this._protocolRow, this._priorityRow, this._cachedRow]);
-        let statusGroup = new WebInspector.DetailsSectionGroup([this._statusTextRow, this._statusCodeRow, this._errorReasonRow]);
-        let connectionGroup = new WebInspector.DetailsSectionGroup([this._remoteAddressRow, this._connectionIdentifierRow]);
-        let sizeGroup = new WebInspector.DetailsSectionGroup([this._encodedSizeRow, this._decodedSizeRow, this._transferSizeRow]);
-        let compressionGroup = new WebInspector.DetailsSectionGroup([this._compressedRow, this._compressionRow]);
+        let requestGroup = new WI.DetailsSectionGroup([this._requestMethodRow, this._protocolRow, this._priorityRow, this._cachedRow]);
+        let statusGroup = new WI.DetailsSectionGroup([this._statusTextRow, this._statusCodeRow, this._errorReasonRow]);
+        let connectionGroup = new WI.DetailsSectionGroup([this._remoteAddressRow, this._connectionIdentifierRow]);
+        let sizeGroup = new WI.DetailsSectionGroup([this._encodedSizeRow, this._decodedSizeRow, this._transferSizeRow]);
+        let compressionGroup = new WI.DetailsSectionGroup([this._compressedRow, this._compressionRow]);
 
-        this._requestAndResponseSection = new WebInspector.DetailsSection("resource-request-response", WebInspector.UIString("Request & Response"));
+        this._requestAndResponseSection = new WI.DetailsSection("resource-request-response", WI.UIString("Request & Response"));
         this._requestAndResponseSection.groups = [requestGroup, statusGroup, connectionGroup, sizeGroup, compressionGroup];
 
-        this._requestHeadersRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Request Headers"));
-        this._requestHeadersSection = new WebInspector.DetailsSection("resource-request-headers", WebInspector.UIString("Request Headers"));
-        this._requestHeadersSection.groups = [new WebInspector.DetailsSectionGroup([this._requestHeadersRow])];
+        this._requestHeadersRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Request Headers"));
+        this._requestHeadersSection = new WI.DetailsSection("resource-request-headers", WI.UIString("Request Headers"));
+        this._requestHeadersSection.groups = [new WI.DetailsSectionGroup([this._requestHeadersRow])];
 
-        this._responseHeadersRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Response Headers"));
-        this._responseHeadersSection = new WebInspector.DetailsSection("resource-response-headers", WebInspector.UIString("Response Headers"));
-        this._responseHeadersSection.groups = [new WebInspector.DetailsSectionGroup([this._responseHeadersRow])];
+        this._responseHeadersRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Response Headers"));
+        this._responseHeadersSection = new WI.DetailsSection("resource-response-headers", WI.UIString("Response Headers"));
+        this._responseHeadersSection.groups = [new WI.DetailsSectionGroup([this._responseHeadersRow])];
 
         // Rows for the "Image Size" section.
-        this._imageWidthRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width"));
-        this._imageHeightRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height"));
+        this._imageWidthRow = new WI.DetailsSectionSimpleRow(WI.UIString("Width"));
+        this._imageHeightRow = new WI.DetailsSectionSimpleRow(WI.UIString("Height"));
 
         // "Image Size" section where we display intrinsic metrics for image resources.
-        this._imageSizeSection = new WebInspector.DetailsSection("resource-type", WebInspector.UIString("Image Size"));
-        this._imageSizeSection.groups = [new WebInspector.DetailsSectionGroup([this._imageWidthRow, this._imageHeightRow])];
+        this._imageSizeSection = new WI.DetailsSection("resource-type", WI.UIString("Image Size"));
+        this._imageSizeSection.groups = [new WI.DetailsSectionGroup([this._imageWidthRow, this._imageHeightRow])];
 
         this.contentView.element.appendChild(this._typeSection.element);
         this.contentView.element.appendChild(this._locationSection.element);
@@ -294,7 +294,7 @@
                 dontFloat: true,
                 ignoreSearchTab: true,
             };
-            this._initiatorRow.value = WebInspector.createSourceCodeLocationLink(initiatorLocation, options);
+            this._initiatorRow.value = WI.createSourceCodeLocationLink(initiatorLocation, options);
         } else
             this._initiatorRow.value = null;
 
@@ -302,7 +302,7 @@
         if (initiatedResources.length) {
             let resourceLinkContainer = document.createElement("div");
             for (let resource of initiatedResources)
-                resourceLinkContainer.appendChild(WebInspector.createResourceLink(resource));
+                resourceLinkContainer.appendChild(WI.createResourceLink(resource));
 
             this._initiatedRow.value = resourceLinkContainer;
         } else
@@ -314,7 +314,7 @@
         if (!this._resource)
             return;
 
-        this._typeResourceTypeRow.value = WebInspector.Resource.displayNameForType(this._resource.type);
+        this._typeResourceTypeRow.value = WI.Resource.displayNameForType(this._resource.type);
     }
 
     _refreshMIMEType()
@@ -338,11 +338,11 @@
         if (this._resource.failureReasonText)
             this._errorReasonRow.value = this._resource.failureReasonText;
         else if (this._resource.statusCode >= 400)
-            this._errorReasonRow.value = WebInspector.UIString("Failure status code");
+            this._errorReasonRow.value = WI.UIString("Failure status code");
         else if (this._resource.canceled)
-            this._errorReasonRow.value = WebInspector.UIString("Load cancelled");
+            this._errorReasonRow.value = WI.UIString("Load cancelled");
         else
-            this._errorReasonRow.value = WebInspector.UIString("Unknown error");
+            this._errorReasonRow.value = WI.UIString("Unknown error");
     }
 
     _refreshRequestAndResponse()
@@ -357,10 +357,10 @@
 
         // COMPATIBILITY(iOS 10.3): Network load metrics were not previously available.
         if (window.NetworkAgent && NetworkAgent.hasEventParameter("loadingFinished", "metrics")) {
-            let protocolDisplayName = WebInspector.Resource.displayNameForProtocol(this._resource.protocol);
+            let protocolDisplayName = WI.Resource.displayNameForProtocol(this._resource.protocol);
             this._protocolRow.value = protocolDisplayName || emDash;
             this._protocolRow.tooltip = protocolDisplayName ? this._resource.protocol : "";
-            this._priorityRow.value = WebInspector.Resource.displayNameForPriority(this._resource.priority) || emDash;
+            this._priorityRow.value = WI.Resource.displayNameForPriority(this._resource.priority) || emDash;
             this._remoteAddressRow.value = this._resource.remoteAddress || emDash;
             this._connectionIdentifierRow.value = this._resource.connectionIdentifier || emDash;
         }
@@ -385,15 +385,15 @@
     _refreshCompressed()
     {
         if (this._resource.compressed) {
-            this._compressedRow.value = WebInspector.UIString("Yes");
+            this._compressedRow.value = WI.UIString("Yes");
             if (!this._resource.size)
                 this._compressionRow.value = emDash;
             else if (!isNaN(this._resource.networkEncodedSize))
-                this._compressionRow.value = this._resource.networkEncodedSize ? WebInspector.UIString("%.2f\u00d7").format(this._resource.size / this._resource.networkEncodedSize) : emDash;
+                this._compressionRow.value = this._resource.networkEncodedSize ? WI.UIString("%.2f\u00d7").format(this._resource.size / this._resource.networkEncodedSize) : emDash;
             else
-                this._compressionRow.value = this._resource.estimatedNetworkEncodedSize ? WebInspector.UIString("%.2f\u00d7").format(this._resource.size / this._resource.estimatedNetworkEncodedSize) : emDash;
+                this._compressionRow.value = this._resource.estimatedNetworkEncodedSize ? WI.UIString("%.2f\u00d7").format(this._resource.size / this._resource.estimatedNetworkEncodedSize) : emDash;
         } else {
-            this._compressedRow.value = WebInspector.UIString("No");
+            this._compressedRow.value = WI.UIString("No");
             this._compressionRow.value = null;
         }
     }
@@ -447,9 +447,9 @@
         if (!data || data instanceof Array ? !data.length : isEmptyObject(data))
             return null;
 
-        var dataGrid = new WebInspector.DataGrid({
-            name: {title: WebInspector.UIString("Name"), width: "30%", sortable: true},
-            value: {title: WebInspector.UIString("Value"), sortable: true}
+        var dataGrid = new WI.DataGrid({
+            name: {title: WI.UIString("Name"), width: "30%", sortable: true},
+            value: {title: WI.UIString("Value"), sortable: true}
         });
         dataGrid.copyTextDelimiter = ": ";
 
@@ -458,7 +458,7 @@
             console.assert(typeof nodeValue.name === "string");
             console.assert(!nodeValue.value || typeof nodeValue.value === "string");
 
-            var node = new WebInspector.DataGridNode({name: nodeValue.name, value: nodeValue.value || ""}, false);
+            var node = new WI.DataGridNode({name: nodeValue.name, value: nodeValue.value || ""}, false);
             dataGrid.appendChild(node);
         }
 
@@ -470,7 +470,7 @@
                 addDataGridNode({name, value: data[name] || ""});
         }
 
-        dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, sortDataGrid, this);
+        dataGrid.addEventListener(WI.DataGrid.Event.SortChanged, sortDataGrid, this);
 
         function sortDataGrid()
         {
@@ -501,7 +501,7 @@
         }
 
         // Hide the section if we're not dealing with an image or if the load failed.
-        if (resource.type !== WebInspector.Resource.Type.Image || resource.failed) {
+        if (resource.type !== WI.Resource.Type.Image || resource.failed) {
             hideImageSection.call(this);
             return;
         }
@@ -512,8 +512,8 @@
         // Get the metrics for this resource and fill in the metrics rows with that information.
         resource.getImageSize((size) => {
             if (size) {
-                this._imageWidthRow.value = WebInspector.UIString("%dpx").format(size.width);
-                this._imageHeightRow.value = WebInspector.UIString("%dpx").format(size.height);
+                this._imageWidthRow.value = WI.UIString("%dpx").format(size.width);
+                this._imageHeightRow.value = WI.UIString("%dpx").format(size.height);
             } else
                 hideImageSection.call(this);
         });
@@ -522,17 +522,17 @@
     _cachedRowValue()
     {
         let responseSource = this._resource.responseSource;
-        if (responseSource === WebInspector.Resource.ResponseSource.MemoryCache || responseSource === WebInspector.Resource.ResponseSource.DiskCache) {
+        if (responseSource === WI.Resource.ResponseSource.MemoryCache || responseSource === WI.Resource.ResponseSource.DiskCache) {
             console.assert(this._resource.cached, "This resource has a cache responseSource it should also be marked as cached", this._resource);
             let span = document.createElement("span");
             let cacheType = document.createElement("span");
             cacheType.classList = "cache-type";
-            cacheType.textContent = responseSource === WebInspector.Resource.ResponseSource.MemoryCache ? WebInspector.UIString("(Memory)") : WebInspector.UIString("(Disk)");
-            span.append(WebInspector.UIString("Yes"), " ", cacheType);
+            cacheType.textContent = responseSource === WI.Resource.ResponseSource.MemoryCache ? WI.UIString("(Memory)") : WI.UIString("(Disk)");
+            span.append(WI.UIString("Yes"), " ", cacheType);
             return span;
         }
 
-        return this._resource.cached ? WebInspector.UIString("Yes") : WebInspector.UIString("No");
+        return this._resource.cached ? WI.UIString("Yes") : WI.UIString("No");
     }
 
     _goToRequestDataClicked()
@@ -540,7 +540,7 @@
         const options = {
             ignoreSearchTab: true,
         };
-        WebInspector.showResourceRequest(this._resource, options);
+        WI.showResourceRequest(this._resource, options);
     }
 
     _refreshRequestDataSection()
@@ -562,10 +562,10 @@
         var requestDataContentType = resource.requestDataContentType || "";
         if (requestDataContentType && requestDataContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)) {
             // Simple form data that should be parsable like a query string.
-            var parametersRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString("No Parameters"));
+            var parametersRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Parameters"));
             parametersRow.dataGrid = this._createNameValueDataGrid(parseQueryString(requestData, true));
 
-            this._requestDataSection.groups = [new WebInspector.DetailsSectionGroup([parametersRow])];
+            this._requestDataSection.groups = [new WI.DetailsSectionGroup([parametersRow])];
             return;
         }
 
@@ -580,18 +580,18 @@
 
         var rows = [];
 
-        var mimeTypeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("MIME Type"));
+        var mimeTypeRow = new WI.DetailsSectionSimpleRow(WI.UIString("MIME Type"));
         mimeTypeRow.value = mimeType;
         rows.push(mimeTypeRow);
 
         if (boundary) {
-            var boundryRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Boundary"));
+            var boundryRow = new WI.DetailsSectionSimpleRow(WI.UIString("Boundary"));
             boundryRow.value = boundary;
             rows.push(boundryRow);
         }
 
         if (encoding) {
-            var encodingRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Encoding"));
+            var encodingRow = new WI.DetailsSectionSimpleRow(WI.UIString("Encoding"));
             encodingRow.value = encoding;
             rows.push(encodingRow);
         }
@@ -602,28 +602,28 @@
 
         dataValue.append(sizeValue);
 
-        var goToButton = dataValue.appendChild(WebInspector.createGoToArrowButton());
+        var goToButton = dataValue.appendChild(WI.createGoToArrowButton());
         goToButton.addEventListener("click", this._goToRequestDataClicked.bind(this));
 
-        var dataRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Data"));
+        var dataRow = new WI.DetailsSectionSimpleRow(WI.UIString("Data"));
         dataRow.value = dataValue;
         rows.push(dataRow);
 
-        this._requestDataSection.groups = [new WebInspector.DetailsSectionGroup(rows)];
+        this._requestDataSection.groups = [new WI.DetailsSectionGroup(rows)];
     }
 
     _applyResourceEventListeners()
     {
-        this._resource.addEventListener(WebInspector.Resource.Event.URLDidChange, this._refreshURL, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.MIMETypeDidChange, this._refreshMIMEType, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._refreshResourceType, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail, this._refreshErrorReason, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.RequestHeadersDidChange, this._refreshRequestHeaders, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.ResponseReceived, this._refreshRequestAndResponse, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.CacheStatusDidChange, this._refreshRequestAndResponse, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._refreshDecodedSize, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.TransferSizeDidChange, this._refreshTransferSize, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.InitiatedResourcesDidChange, this._refreshRelatedResourcesSection, this);
+        this._resource.addEventListener(WI.Resource.Event.URLDidChange, this._refreshURL, this);
+        this._resource.addEventListener(WI.Resource.Event.MIMETypeDidChange, this._refreshMIMEType, this);
+        this._resource.addEventListener(WI.Resource.Event.TypeDidChange, this._refreshResourceType, this);
+        this._resource.addEventListener(WI.Resource.Event.LoadingDidFail, this._refreshErrorReason, this);
+        this._resource.addEventListener(WI.Resource.Event.RequestHeadersDidChange, this._refreshRequestHeaders, this);
+        this._resource.addEventListener(WI.Resource.Event.ResponseReceived, this._refreshRequestAndResponse, this);
+        this._resource.addEventListener(WI.Resource.Event.CacheStatusDidChange, this._refreshRequestAndResponse, this);
+        this._resource.addEventListener(WI.Resource.Event.SizeDidChange, this._refreshDecodedSize, this);
+        this._resource.addEventListener(WI.Resource.Event.TransferSizeDidChange, this._refreshTransferSize, this);
+        this._resource.addEventListener(WI.Resource.Event.InitiatedResourcesDidChange, this._refreshRelatedResourcesSection, this);
 
         this._needsToRemoveResourceEventListeners = true;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
index b34b11b..42875b3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspector.NavigationSidebarPanel
+WI.ResourceSidebarPanel = class ResourceSidebarPanel extends WI.NavigationSidebarPanel
 {
     constructor(contentBrowser)
     {
-        super("resource", WebInspector.UIString("Resources"), true);
+        super("resource", WI.UIString("Resources"), true);
 
         this.contentBrowser = contentBrowser;
 
-        this.filterBar.placeholder = WebInspector.UIString("Filter Resource List");
+        this.filterBar.placeholder = WI.UIString("Filter Resource List");
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this.addSubview(this._navigationBar);
 
         this._targetTreeElementMap = new Map;
@@ -41,46 +41,46 @@
         var scopeItemPrefix = "resource-sidebar-";
         var scopeBarItems = [];
 
-        scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix + "type-all", WebInspector.UIString("All Resources"), true));
+        scopeBarItems.push(new WI.ScopeBarItem(scopeItemPrefix + "type-all", WI.UIString("All Resources"), true));
 
-        for (var key in WebInspector.Resource.Type) {
-            var value = WebInspector.Resource.Type[key];
-            var scopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + value, WebInspector.Resource.displayNameForType(value, true));
-            scopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] = value;
+        for (var key in WI.Resource.Type) {
+            var value = WI.Resource.Type[key];
+            var scopeBarItem = new WI.ScopeBarItem(scopeItemPrefix + value, WI.Resource.displayNameForType(value, true));
+            scopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol] = value;
             scopeBarItems.push(scopeBarItem);
         }
 
-        if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value) {
-            let canvasesScopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + WebInspector.Canvas.ResourceSidebarType, WebInspector.UIString("Canvases"));
-            canvasesScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] = WebInspector.Canvas.ResourceSidebarType;
+        if (window.CanvasAgent && WI.settings.experimentalShowCanvasContextsInResources.value) {
+            let canvasesScopeBarItem = new WI.ScopeBarItem(scopeItemPrefix + WI.Canvas.ResourceSidebarType, WI.UIString("Canvases"));
+            canvasesScopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol] = WI.Canvas.ResourceSidebarType;
             scopeBarItems.insertAtIndex(canvasesScopeBarItem, scopeBarItems.length - 1);
         }
 
-        this._scopeBar = new WebInspector.ScopeBar("resource-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
-        this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+        this._scopeBar = new WI.ScopeBar("resource-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
+        this._scopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
 
         this._navigationBar.addNavigationItem(this._scopeBar);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
-        WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
+        WI.frameResourceManager.addEventListener(WI.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptWasAdded, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptRemoved, this._scriptWasRemoved, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, this._scriptWasAdded, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptRemoved, this._scriptWasRemoved, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
 
-        WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
+        WI.cssStyleManager.addEventListener(WI.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
 
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
+        WI.notifications.addEventListener(WI.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
 
-        this.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this.contentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
         this.contentTreeOutline.includeSourceMapResourceChildren = true;
 
-        if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript) {
+        if (WI.debuggableType === WI.DebuggableType.JavaScript) {
             this.contentTreeOutline.disclosureButtons = false;
-            WebInspector.SourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, () => { this.contentTreeOutline.disclosureButtons = true; }, this);
+            WI.SourceCode.addEventListener(WI.SourceCode.Event.SourceMapAdded, () => { this.contentTreeOutline.disclosureButtons = true; }, this);
         }
     }
 
@@ -95,16 +95,16 @@
     {
         super.closed();
 
-        WebInspector.Frame.removeEventListener(null, null, this);
-        WebInspector.frameResourceManager.removeEventListener(null, null, this);
-        WebInspector.debuggerManager.removeEventListener(null, null, this);
-        WebInspector.notifications.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
+        WI.frameResourceManager.removeEventListener(null, null, this);
+        WI.debuggerManager.removeEventListener(null, null, this);
+        WI.notifications.removeEventListener(null, null, this);
     }
 
     showDefaultContentView()
     {
-        if (WebInspector.frameResourceManager.mainFrame) {
-            this.contentBrowser.showContentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);
+        if (WI.frameResourceManager.mainFrame) {
+            this.contentBrowser.showContentViewForRepresentedObject(WI.frameResourceManager.mainFrame);
             return;
         }
 
@@ -117,19 +117,19 @@
     {
         // A custom implementation is needed for this since the frames are populated lazily.
 
-        if (!this._mainFrameTreeElement && (representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Frame || representedObject instanceof WebInspector.Collection)) {
+        if (!this._mainFrameTreeElement && (representedObject instanceof WI.Resource || representedObject instanceof WI.Frame || representedObject instanceof WI.Collection)) {
             // All resources are under the main frame, so we need to return early if we don't have the main frame yet.
             return null;
         }
 
         // The Frame is used as the representedObject instead of the main resource in our tree.
-        if (representedObject instanceof WebInspector.Resource && representedObject.parentFrame && representedObject.parentFrame.mainResource === representedObject)
+        if (representedObject instanceof WI.Resource && representedObject.parentFrame && representedObject.parentFrame.mainResource === representedObject)
             representedObject = representedObject.parentFrame;
 
         function isAncestor(ancestor, resourceOrFrame)
         {
             // SourceMapResources are descendants of another SourceCode object.
-            if (resourceOrFrame instanceof WebInspector.SourceMapResource) {
+            if (resourceOrFrame instanceof WI.SourceMapResource) {
                 if (resourceOrFrame.sourceMap.originalSourceCode === ancestor)
                     return true;
 
@@ -150,7 +150,7 @@
         function getParent(resourceOrFrame)
         {
             // SourceMapResources are descendants of another SourceCode object.
-            if (resourceOrFrame instanceof WebInspector.SourceMapResource)
+            if (resourceOrFrame instanceof WI.SourceMapResource)
                 return resourceOrFrame.sourceMap.originalSourceCode;
             return resourceOrFrame.parentFrame;
         }
@@ -160,7 +160,7 @@
             return treeElement;
 
         // Only special case Script objects.
-        if (!(representedObject instanceof WebInspector.Script)) {
+        if (!(representedObject instanceof WI.Script)) {
             console.error("Didn't find a TreeElement for representedObject", representedObject);
             return null;
         }
@@ -176,8 +176,8 @@
         // we have a ScriptContentView asking for the tree element we will make a ScriptTreeElement on demand and add it.
 
         if (!this._anonymousScriptsFolderTreeElement) {
-            let collection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);
-            this._anonymousScriptsFolderTreeElement = new WebInspector.FolderTreeElement(WebInspector.UIString("Anonymous Scripts"), collection);
+            let collection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+            this._anonymousScriptsFolderTreeElement = new WI.FolderTreeElement(WI.UIString("Anonymous Scripts"), collection);
         }
 
         if (!this._anonymousScriptsFolderTreeElement.parent) {
@@ -187,7 +187,7 @@
 
         this._anonymousScriptsFolderTreeElement.representedObject.add(representedObject);
 
-        var scriptTreeElement = new WebInspector.ScriptTreeElement(representedObject);
+        var scriptTreeElement = new WI.ScriptTreeElement(representedObject);
         this._anonymousScriptsFolderTreeElement.appendChild(scriptTreeElement);
 
         return scriptTreeElement;
@@ -199,8 +199,8 @@
     {
         super.initialLayout();
 
-        if (WebInspector.frameResourceManager.mainFrame)
-            this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);
+        if (WI.frameResourceManager.mainFrame)
+            this._mainFrameMainResourceDidChange(WI.frameResourceManager.mainFrame);
     }
 
     hasCustomFilters()
@@ -220,28 +220,28 @@
             return true;
 
         // Folders are hidden on the first pass, but visible childen under the folder will force the folder visible again.
-        if (treeElement instanceof WebInspector.FolderTreeElement)
+        if (treeElement instanceof WI.FolderTreeElement)
             return false;
 
         function match()
         {
-            if (treeElement instanceof WebInspector.FrameTreeElement)
-                return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] === WebInspector.Resource.Type.Document;
+            if (treeElement instanceof WI.FrameTreeElement)
+                return selectedScopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol] === WI.Resource.Type.Document;
 
-            if (treeElement instanceof WebInspector.ScriptTreeElement)
-                return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] === WebInspector.Resource.Type.Script;
+            if (treeElement instanceof WI.ScriptTreeElement)
+                return selectedScopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol] === WI.Resource.Type.Script;
 
-            if (treeElement instanceof WebInspector.CanvasTreeElement)
-                return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] === WebInspector.Canvas.ResourceSidebarType;
+            if (treeElement instanceof WI.CanvasTreeElement)
+                return selectedScopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol] === WI.Canvas.ResourceSidebarType;
 
-            if (treeElement instanceof WebInspector.CSSStyleSheetTreeElement)
-                return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol] === WebInspector.Resource.Type.Stylesheet;
+            if (treeElement instanceof WI.CSSStyleSheetTreeElement)
+                return selectedScopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol] === WI.Resource.Type.Stylesheet;
 
-            console.assert(treeElement instanceof WebInspector.ResourceTreeElement, "Unknown treeElement", treeElement);
-            if (!(treeElement instanceof WebInspector.ResourceTreeElement))
+            console.assert(treeElement instanceof WI.ResourceTreeElement, "Unknown treeElement", treeElement);
+            if (!(treeElement instanceof WI.ResourceTreeElement))
                 return false;
 
-            return treeElement.resource.type === selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol];
+            return treeElement.resource.type === selectedScopeBarItem[WI.ResourceSidebarPanel.ResourceTypeSymbol];
         }
 
         var matched = match();
@@ -262,7 +262,7 @@
 
     _mainFrameDidChange(event)
     {
-        this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);
+        this._mainFrameMainResourceDidChange(WI.frameResourceManager.mainFrame);
     }
 
     _mainFrameMainResourceDidChange(mainFrame)
@@ -277,7 +277,7 @@
         if (!mainFrame)
             return;
 
-        this._mainFrameTreeElement = new WebInspector.FrameTreeElement(mainFrame);
+        this._mainFrameTreeElement = new WI.FrameTreeElement(mainFrame);
         this.contentTreeOutline.insertChild(this._mainFrameTreeElement, 0);
 
         function delayedWork()
@@ -306,7 +306,7 @@
             return;
 
         // Worker script.
-        if (script.target !== WebInspector.mainTarget) {
+        if (script.target !== WI.mainTarget) {
             if (script.isMainResource())
                 this._addTargetWithMainResource(script.target);
             return;
@@ -321,18 +321,18 @@
 
         if (script.injected) {
             if (!this._extensionScriptsFolderTreeElement) {
-                let collection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);
-                this._extensionScriptsFolderTreeElement = new WebInspector.FolderTreeElement(WebInspector.UIString("Extension Scripts"), collection);
+                let collection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+                this._extensionScriptsFolderTreeElement = new WI.FolderTreeElement(WI.UIString("Extension Scripts"), collection);
             }
 
             parentFolderTreeElement = this._extensionScriptsFolderTreeElement;
         } else {
-            if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript && !WebInspector.hasExtraDomains)
+            if (WI.debuggableType === WI.DebuggableType.JavaScript && !WI.hasExtraDomains)
                 insertIntoTopLevel = true;
             else {
                 if (!this._extraScriptsFolderTreeElement) {
-                    let collection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);
-                    this._extraScriptsFolderTreeElement = new WebInspector.FolderTreeElement(WebInspector.UIString("Extra Scripts"), collection);
+                    let collection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+                    this._extraScriptsFolderTreeElement = new WI.FolderTreeElement(WI.UIString("Extra Scripts"), collection);
                 }
 
                 parentFolderTreeElement = this._extraScriptsFolderTreeElement;
@@ -342,7 +342,7 @@
         if (parentFolderTreeElement)
             parentFolderTreeElement.representedObject.add(script);
 
-        var scriptTreeElement = new WebInspector.ScriptTreeElement(script);
+        var scriptTreeElement = new WI.ScriptTreeElement(script);
 
         if (insertIntoTopLevel) {
             var index = insertionIndexForObjectInListSortedByFunction(scriptTreeElement, this.contentTreeOutline.children, this._compareTreeElements);
@@ -367,7 +367,7 @@
         let parentTreeElement = scriptTreeElement.parent;
         parentTreeElement.removeChild(scriptTreeElement);
 
-        if (parentTreeElement instanceof WebInspector.FolderTreeElement) {
+        if (parentTreeElement instanceof WI.FolderTreeElement) {
             parentTreeElement.representedObject.remove(script);
 
             if (!parentTreeElement.children.length)
@@ -426,9 +426,9 @@
 
     _addTargetWithMainResource(target)
     {
-        console.assert(target.type === WebInspector.Target.Type.Worker);
+        console.assert(target.type === WI.Target.Type.Worker);
 
-        let targetTreeElement = new WebInspector.WorkerTreeElement(target);
+        let targetTreeElement = new WI.WorkerTreeElement(target);
         this._targetTreeElementMap.set(target, targetTreeElement);
 
         let index = insertionIndexForObjectInListSortedByFunction(targetTreeElement, this.contentTreeOutline.children, this._compareTreeElements);
@@ -453,18 +453,18 @@
         if (!treeElement)
             return;
 
-        if (treeElement instanceof WebInspector.FolderTreeElement
-            || treeElement instanceof WebInspector.ResourceTreeElement
-            || treeElement instanceof WebInspector.ScriptTreeElement
-            || treeElement instanceof WebInspector.CSSStyleSheetTreeElement
-            || treeElement instanceof WebInspector.ContentFlowTreeElement
-            || treeElement instanceof WebInspector.CanvasTreeElement) {
+        if (treeElement instanceof WI.FolderTreeElement
+            || treeElement instanceof WI.ResourceTreeElement
+            || treeElement instanceof WI.ScriptTreeElement
+            || treeElement instanceof WI.CSSStyleSheetTreeElement
+            || treeElement instanceof WI.ContentFlowTreeElement
+            || treeElement instanceof WI.CanvasTreeElement) {
             const cookie = null;
             const options = {
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             };
-            WebInspector.showRepresentedObject(treeElement.representedObject, cookie, options);
+            WI.showRepresentedObject(treeElement.representedObject, cookie, options);
             return;
         }
 
@@ -474,9 +474,9 @@
     _compareTreeElements(a, b)
     {
         // Always sort the main frame element first.
-        if (a instanceof WebInspector.FrameTreeElement)
+        if (a instanceof WI.FrameTreeElement)
             return -1;
-        if (b instanceof WebInspector.FrameTreeElement)
+        if (b instanceof WI.FrameTreeElement)
             return 1;
 
         console.assert(a.mainTitle);
@@ -487,7 +487,7 @@
 
     _extraDomainsActivated()
     {
-        if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript)
+        if (WI.debuggableType === WI.DebuggableType.JavaScript)
             this.contentTreeOutline.disclosureButtons = true;
     }
 
@@ -497,4 +497,4 @@
     }
 };
 
-WebInspector.ResourceSidebarPanel.ResourceTypeSymbol = Symbol("resource-type");
+WI.ResourceSidebarPanel.ResourceTypeSymbol = Symbol("resource-type");
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
index e1db19f..cfb8818 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceTimelineDataGridNode = class ResourceTimelineDataGridNode extends WebInspector.TimelineDataGridNode
+WI.ResourceTimelineDataGridNode = class ResourceTimelineDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(resourceTimelineRecord, includesGraph, graphDataSource, shouldShowPopover)
     {
@@ -33,16 +33,16 @@
         this._record = resourceTimelineRecord;
         this._shouldShowPopover = shouldShowPopover;
 
-        this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, this._needsRefresh, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail, this._needsRefresh, this);
-        this._resource.addEventListener(WebInspector.Resource.Event.URLDidChange, this._needsRefresh, this);
+        this._resource.addEventListener(WI.Resource.Event.LoadingDidFinish, this._needsRefresh, this);
+        this._resource.addEventListener(WI.Resource.Event.LoadingDidFail, this._needsRefresh, this);
+        this._resource.addEventListener(WI.Resource.Event.URLDidChange, this._needsRefresh, this);
 
         if (includesGraph)
-            this._record.addEventListener(WebInspector.TimelineRecord.Event.Updated, this._timelineRecordUpdated, this);
+            this._record.addEventListener(WI.TimelineRecord.Event.Updated, this._timelineRecordUpdated, this);
         else {
-            this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._needsRefresh, this);
-            this._resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._needsRefresh, this);
-            this._resource.addEventListener(WebInspector.Resource.Event.TransferSizeDidChange, this._needsRefresh, this);
+            this._resource.addEventListener(WI.Resource.Event.TypeDidChange, this._needsRefresh, this);
+            this._resource.addEventListener(WI.Resource.Event.SizeDidChange, this._needsRefresh, this);
+            this._resource.addEventListener(WI.Resource.Event.TransferSizeDidChange, this._needsRefresh, this);
         }
     }
 
@@ -69,7 +69,7 @@
         if (!this._includesGraph) {
             var zeroTime = this.graphDataSource ? this.graphDataSource.zeroTime : 0;
 
-            data.domain = WebInspector.displayNameForHost(resource.urlComponents.host);
+            data.domain = WI.displayNameForHost(resource.urlComponents.host);
             data.scheme = resource.urlComponents.scheme ? resource.urlComponents.scheme.toUpperCase() : "";
             data.method = resource.requestMethod;
             data.type = resource.type;
@@ -109,7 +109,7 @@
             return this._createNameCellDocumentFragment();
 
         case "type":
-            var text = WebInspector.Resource.displayNameForType(value);
+            var text = WI.Resource.displayNameForType(value);
             cell.title = text;
             return text;
 
@@ -152,7 +152,7 @@
             return value || emDash;
 
         case "priority":
-            var title = WebInspector.Resource.displayNameForPriority(value);
+            var title = WI.Resource.displayNameForPriority(value);
             if (title)
                 cell.title = title;
             return title || emDash;
@@ -175,12 +175,12 @@
 
     iconClassNames()
     {
-        return [WebInspector.ResourceTreeElement.ResourceIconStyleClassName, this.resource.type];
+        return [WI.ResourceTreeElement.ResourceIconStyleClassName, this.resource.type];
     }
 
     appendContextMenuItems(contextMenu)
     {
-        WebInspector.appendContextMenuItemsForSourceCode(contextMenu, this._resource);
+        WI.appendContextMenuItemsForSourceCode(contextMenu, this._resource);
     }
 
     // Protected
@@ -190,7 +190,7 @@
         if (!this._shouldShowPopover)
             return;
 
-        if (!recordBar.records.length || recordBar.records[0].type !== WebInspector.TimelineRecord.Type.Network)
+        if (!recordBar.records.length || recordBar.records[0].type !== WI.TimelineRecord.Type.Network)
             return;
 
         console.assert(!this._mouseEnterRecordBarListener);
@@ -203,7 +203,7 @@
         if (!this._shouldShowPopover)
             return;
 
-        if (!recordBar.records.length || recordBar.records[0].type !== WebInspector.TimelineRecord.Type.Network)
+        if (!recordBar.records.length || recordBar.records[0].type !== WI.TimelineRecord.Type.Network)
             return;
 
         recordBar.element.removeEventListener("mouseenter", this._mouseEnterRecordBarListener);
@@ -238,7 +238,7 @@
         }
 
         if (parentResourceHost !== this._resource.urlComponents.host || frame.isMainFrame() && isMainResource) {
-            let subtitle = WebInspector.displayNameForHost(this._resource.urlComponents.host);
+            let subtitle = WI.displayNameForHost(this._resource.urlComponents.host);
             if (mainTitle !== subtitle) {
                 let subtitleElement = document.createElement("span");
                 subtitleElement.classList.add("subtitle");
@@ -256,24 +256,24 @@
             return emDash;
 
         let responseSource = this._resource.responseSource;
-        if (responseSource === WebInspector.Resource.ResponseSource.MemoryCache || responseSource === WebInspector.Resource.ResponseSource.DiskCache) {
+        if (responseSource === WI.Resource.ResponseSource.MemoryCache || responseSource === WI.Resource.ResponseSource.DiskCache) {
             console.assert(this._resource.cached, "This resource has a cache responseSource it should also be marked as cached", this._resource);
             let span = document.createElement("span");
             let cacheType = document.createElement("span");
             cacheType.classList = "cache-type";
-            cacheType.textContent = responseSource === WebInspector.Resource.ResponseSource.MemoryCache ? WebInspector.UIString("(Memory)") : WebInspector.UIString("(Disk)");
-            span.append(WebInspector.UIString("Yes"), " ", cacheType);
+            cacheType.textContent = responseSource === WI.Resource.ResponseSource.MemoryCache ? WI.UIString("(Memory)") : WI.UIString("(Disk)");
+            span.append(WI.UIString("Yes"), " ", cacheType);
             return span;
         }
 
         let fragment = document.createDocumentFragment();
-        fragment.append(this._resource.cached ? WebInspector.UIString("Yes") : WebInspector.UIString("No"));
+        fragment.append(this._resource.cached ? WI.UIString("Yes") : WI.UIString("No"));
         return fragment;
     }
 
     _needsRefresh()
     {
-        if (this.dataGrid instanceof WebInspector.TimelineDataGrid) {
+        if (this.dataGrid instanceof WI.TimelineDataGrid) {
             this.dataGrid.dataGridNodeNeedsRefresh(this);
             return;
         }
@@ -296,7 +296,7 @@
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         };
-        WebInspector.showSourceCode(this._resource, options);
+        WI.showSourceCode(this._resource, options);
     }
 
     _updateStatus(cell)
@@ -317,7 +317,7 @@
             return;
 
         if (!this._spinner)
-            this._spinner = new WebInspector.IndeterminateProgressSpinner;
+            this._spinner = new WI.IndeterminateProgressSpinner;
 
         let contentElement = cell.firstChild;
         contentElement.appendChild(this._spinner.element);
@@ -325,14 +325,14 @@
 
     _mouseoverRecordBar(event)
     {
-        let recordBar = WebInspector.TimelineRecordBar.fromElement(event.target);
+        let recordBar = WI.TimelineRecordBar.fromElement(event.target);
         console.assert(recordBar);
         if (!recordBar)
             return;
 
         let calculateTargetFrame = () => {
-            let columnRect = WebInspector.Rect.rectFromClientRect(this.elementWithColumnIdentifier("graph").getBoundingClientRect());
-            let barRect = WebInspector.Rect.rectFromClientRect(event.target.getBoundingClientRect());
+            let columnRect = WI.Rect.rectFromClientRect(this.elementWithColumnIdentifier("graph").getBoundingClientRect());
+            let barRect = WI.Rect.rectFromClientRect(event.target.getBoundingClientRect());
             return columnRect.intersectionWithRect(barRect);
         };
 
@@ -360,11 +360,11 @@
             let descriptionElement = document.createElement("span");
             descriptionElement.classList.add("description");
             if (resource.failed)
-                descriptionElement.textContent = WebInspector.UIString("Resource failed to load.");
+                descriptionElement.textContent = WI.UIString("Resource failed to load.");
             else if (resource.urlComponents.scheme === "data")
-                descriptionElement.textContent = WebInspector.UIString("Resource was loaded with the “data“ scheme.");
+                descriptionElement.textContent = WI.UIString("Resource was loaded with the “data“ scheme.");
             else
-                descriptionElement.textContent = WebInspector.UIString("Resource was served from the cache.");
+                descriptionElement.textContent = WI.UIString("Resource was served from the cache.");
             popoverContentElement.appendChild(descriptionElement);
         } else {
             let columns = {
@@ -372,7 +372,7 @@
                     width: "80px"
                 },
                 graph: {
-                    width: `${WebInspector.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels}px`
+                    width: `${WI.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels}px`
                 },
                 duration: {
                     width: "70px",
@@ -380,50 +380,50 @@
                 }
             };
 
-            let popoverDataGrid = new WebInspector.DataGrid(columns);
+            let popoverDataGrid = new WI.DataGrid(columns);
             popoverDataGrid.inline = true;
             popoverDataGrid.headerVisible = false;
             popoverContentElement.appendChild(popoverDataGrid.element);
 
             let graphDataSource = {
-                get secondsPerPixel() { return resource.duration / WebInspector.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels; },
+                get secondsPerPixel() { return resource.duration / WI.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels; },
                 get zeroTime() { return resource.firstTimestamp; },
                 get startTime() { return resource.firstTimestamp; },
                 get currentTime() { return this.endTime; },
 
                 get endTime()
                 {
-                    let endTimePadding = this.secondsPerPixel * WebInspector.TimelineRecordBar.MinimumWidthPixels;
+                    let endTimePadding = this.secondsPerPixel * WI.TimelineRecordBar.MinimumWidthPixels;
                     return resource.lastTimestamp + endTimePadding;
                 }
             };
 
             let secondTimestamp = resource.timingData.domainLookupStart || resource.timingData.connectStart || resource.timingData.requestStart;
             if (secondTimestamp - resource.timingData.startTime)
-                popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Stalled"), resource.timingData.startTime, secondTimestamp, graphDataSource));
+                popoverDataGrid.appendChild(new WI.ResourceTimingPopoverDataGridNode(WI.UIString("Stalled"), resource.timingData.startTime, secondTimestamp, graphDataSource));
             if (resource.timingData.domainLookupStart)
-                popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("DNS"), resource.timingData.domainLookupStart, resource.timingData.domainLookupEnd, graphDataSource));
+                popoverDataGrid.appendChild(new WI.ResourceTimingPopoverDataGridNode(WI.UIString("DNS"), resource.timingData.domainLookupStart, resource.timingData.domainLookupEnd, graphDataSource));
             if (resource.timingData.connectStart)
-                popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Connection"), resource.timingData.connectStart, resource.timingData.connectEnd, graphDataSource));
+                popoverDataGrid.appendChild(new WI.ResourceTimingPopoverDataGridNode(WI.UIString("Connection"), resource.timingData.connectStart, resource.timingData.connectEnd, graphDataSource));
             if (resource.timingData.secureConnectionStart)
-                popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Secure"), resource.timingData.secureConnectionStart, resource.timingData.connectEnd, graphDataSource));
-            popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Request"), resource.timingData.requestStart, resource.timingData.responseStart, graphDataSource));
-            popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Response"), resource.timingData.responseStart, resource.timingData.responseEnd, graphDataSource));
+                popoverDataGrid.appendChild(new WI.ResourceTimingPopoverDataGridNode(WI.UIString("Secure"), resource.timingData.secureConnectionStart, resource.timingData.connectEnd, graphDataSource));
+            popoverDataGrid.appendChild(new WI.ResourceTimingPopoverDataGridNode(WI.UIString("Request"), resource.timingData.requestStart, resource.timingData.responseStart, graphDataSource));
+            popoverDataGrid.appendChild(new WI.ResourceTimingPopoverDataGridNode(WI.UIString("Response"), resource.timingData.responseStart, resource.timingData.responseEnd, graphDataSource));
 
             const higherResolution = true;
             let totalData = {
-                description: WebInspector.UIString("Total time"),
+                description: WI.UIString("Total time"),
                 duration: Number.secondsToMillisecondsString(resource.timingData.responseEnd - resource.timingData.startTime, higherResolution)
             };
-            popoverDataGrid.appendChild(new WebInspector.DataGridNode(totalData));
+            popoverDataGrid.appendChild(new WI.DataGridNode(totalData));
 
             popoverDataGrid.updateLayout();
         }
 
         if (!this.dataGrid._popover)
-            this.dataGrid._popover = new WebInspector.Popover;
+            this.dataGrid._popover = new WI.Popover;
 
-        let preferredEdges = [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MIN_X];
+        let preferredEdges = [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MIN_X];
         this.dataGrid._popover.windowResizeHandler = () => {
             let bounds = calculateTargetFrame();
             this.dataGrid._popover.present(bounds.pad(2), preferredEdges);
@@ -436,12 +436,12 @@
             this.dataGrid._dismissPopoverTimeout = setTimeout(() => {
                 if (this.dataGrid)
                     this.dataGrid._popover.dismiss();
-            }, WebInspector.ResourceTimelineDataGridNode.DelayedPopoverDismissalTimeout);
+            }, WI.ResourceTimelineDataGridNode.DelayedPopoverDismissalTimeout);
         }, {once: true});
 
         this.dataGrid._popover.presentNewContentWithFrame(popoverContentElement, targetFrame.pad(2), preferredEdges);
     }
 };
 
-WebInspector.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels = 110;
-WebInspector.ResourceTimelineDataGridNode.DelayedPopoverDismissalTimeout = 500;
+WI.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels = 110;
+WI.ResourceTimelineDataGridNode.DelayedPopoverDismissalTimeout = 500;
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceTimingPopoverDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/ResourceTimingPopoverDataGridNode.js
index 79a1eab..3bf03e4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceTimingPopoverDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceTimingPopoverDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceTimingPopoverDataGridNode = class ResourceTimingPopoverDataGridNode extends WebInspector.TimelineDataGridNode
+WI.ResourceTimingPopoverDataGridNode = class ResourceTimingPopoverDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(description, startTime, endTime, graphDataSource)
     {
@@ -33,7 +33,7 @@
         let duration = Number.secondsToMillisecondsString(endTime - startTime, higherResolution);
 
         this._data = {description, duration};
-        this._record = new WebInspector.TimelineRecord(WebInspector.TimelineRecord.Type.Network, startTime, endTime);
+        this._record = new WI.TimelineRecord(WI.TimelineRecord.Type.Network, startTime, endTime);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js
index 40e0f04..3bbc149 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourceTreeElement = class ResourceTreeElement extends WebInspector.SourceCodeTreeElement
+WI.ResourceTreeElement = class ResourceTreeElement extends WI.SourceCodeTreeElement
 {
     constructor(resource, representedObject)
     {
-        console.assert(resource instanceof WebInspector.Resource);
+        console.assert(resource instanceof WI.Resource);
 
         const title = null;
         const subtitle = null;
-        super(resource, ["resource", WebInspector.ResourceTreeElement.ResourceIconStyleClassName, resource.type], title, subtitle, representedObject || resource);
+        super(resource, ["resource", WI.ResourceTreeElement.ResourceIconStyleClassName, resource.type], title, subtitle, representedObject || resource);
 
         this._updateResource(resource);
     }
@@ -46,9 +46,9 @@
             return comparisonResult;
 
         // Compare async resource types by their first timestamp so they are in chronological order.
-        if (a.resource.type === WebInspector.Resource.Type.XHR
-            || a.resource.type === WebInspector.Resource.Type.Fetch
-            || a.resource.type === WebInspector.Resource.Type.WebSocket)
+        if (a.resource.type === WI.Resource.Type.XHR
+            || a.resource.type === WI.Resource.Type.Fetch
+            || a.resource.type === WI.Resource.Type.WebSocket)
             return a.resource.firstTimestamp - b.resource.firstTimestamp || 0;
 
         // Compare by subtitle when the types are the same. The subtitle is used to show the
@@ -65,8 +65,8 @@
 
     static compareFolderAndResourceTreeElements(a, b)
     {
-        var aIsFolder = a instanceof WebInspector.FolderTreeElement;
-        var bIsFolder = b instanceof WebInspector.FolderTreeElement;
+        var aIsFolder = a instanceof WI.FolderTreeElement;
+        var bIsFolder = b instanceof WI.FolderTreeElement;
 
         if (aIsFolder && !bIsFolder)
             return -1;
@@ -75,7 +75,7 @@
         if (aIsFolder && bIsFolder)
             return a.mainTitle.extendedLocaleCompare(b.mainTitle);
 
-        return WebInspector.ResourceTreeElement.compareResourceTreeElements(a, b);
+        return WI.ResourceTreeElement.compareResourceTreeElements(a, b);
     }
 
     // Public
@@ -93,7 +93,7 @@
 
     ondblclick()
     {
-        if (this._resource.type === WebInspector.Resource.Type.WebSocket)
+        if (this._resource.type === WI.Resource.Type.WebSocket)
             return;
 
         InspectorFrontendHost.openInNewTab(this._resource.url);
@@ -103,28 +103,28 @@
 
     _updateResource(resource)
     {
-        console.assert(resource instanceof WebInspector.Resource);
+        console.assert(resource instanceof WI.Resource);
 
         // This method is for subclasses like FrameTreeElement who don't use a resource as the representedObject.
         // This method should only be called once if the representedObject is a resource, since changing the resource
         // without changing the representedObject is bad. If you need to change the resource, make a new ResourceTreeElement.
-        console.assert(!this._resource || !(this.representedObject instanceof WebInspector.Resource));
+        console.assert(!this._resource || !(this.representedObject instanceof WI.Resource));
 
         if (this._resource) {
-            this._resource.removeEventListener(WebInspector.Resource.Event.URLDidChange, this._urlDidChange, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange, this._typeDidChange, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFinish, this._updateStatus, this);
-            this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFail, this._updateStatus, this);
+            this._resource.removeEventListener(WI.Resource.Event.URLDidChange, this._urlDidChange, this);
+            this._resource.removeEventListener(WI.Resource.Event.TypeDidChange, this._typeDidChange, this);
+            this._resource.removeEventListener(WI.Resource.Event.LoadingDidFinish, this._updateStatus, this);
+            this._resource.removeEventListener(WI.Resource.Event.LoadingDidFail, this._updateStatus, this);
         }
 
         this._updateSourceCode(resource);
 
         this._resource = resource;
 
-        resource.addEventListener(WebInspector.Resource.Event.URLDidChange, this._urlDidChange, this);
-        resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._typeDidChange, this);
-        resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, this._updateStatus, this);
-        resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail, this._updateStatus, this);
+        resource.addEventListener(WI.Resource.Event.URLDidChange, this._urlDidChange, this);
+        resource.addEventListener(WI.Resource.Event.TypeDidChange, this._typeDidChange, this);
+        resource.addEventListener(WI.Resource.Event.LoadingDidFinish, this._updateStatus, this);
+        resource.addEventListener(WI.Resource.Event.LoadingDidFail, this._updateStatus, this);
 
         this._updateTitles();
         this._updateStatus();
@@ -151,10 +151,10 @@
         var urlComponents = this._resource.urlComponents;
 
         var oldMainTitle = this.mainTitle;
-        this.mainTitle = WebInspector.displayNameForURL(this._resource.url, urlComponents);
+        this.mainTitle = WI.displayNameForURL(this._resource.url, urlComponents);
 
         // Show the host as the subtitle if it is different from the main resource or if this is the main frame's main resource.
-        var subtitle = parentResourceHost !== urlComponents.host || frame && frame.isMainFrame() && isMainResource ? WebInspector.displayNameForHost(urlComponents.host) : null;
+        var subtitle = parentResourceHost !== urlComponents.host || frame && frame.isMainFrame() && isMainResource ? WI.displayNameForHost(urlComponents.host) : null;
         this.subtitle = this.mainTitle !== subtitle ? subtitle : null;
 
         if (oldMainTitle !== this.mainTitle)
@@ -163,7 +163,7 @@
 
     populateContextMenu(contextMenu, event)
     {
-        WebInspector.appendContextMenuItemsForSourceCode(contextMenu, this._resource);
+        WI.appendContextMenuItemsForSourceCode(contextMenu, this._resource);
 
         super.populateContextMenu(contextMenu, event);
     }
@@ -173,18 +173,18 @@
     _updateStatus()
     {
         if (this._resource.hadLoadingError())
-            this.addClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);
+            this.addClassName(WI.ResourceTreeElement.FailedStyleClassName);
         else
-            this.removeClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);
+            this.removeClassName(WI.ResourceTreeElement.FailedStyleClassName);
 
         if (this._resource.finished || this._resource.failed) {
             // Remove the spinner.
-            if (this.status && this.status[WebInspector.ResourceTreeElement.SpinnerSymbol])
+            if (this.status && this.status[WI.ResourceTreeElement.SpinnerSymbol])
                 this.status = "";
         } else {
-            let spinner = new WebInspector.IndeterminateProgressSpinner;
+            let spinner = new WI.IndeterminateProgressSpinner;
             this.status = spinner.element;
-            this.status[WebInspector.ResourceTreeElement.SpinnerSymbol] = true;
+            this.status[WI.ResourceTreeElement.SpinnerSymbol] = true;
         }
     }
 
@@ -208,7 +208,7 @@
     }
 };
 
-WebInspector.ResourceTreeElement.ResourceIconStyleClassName = "resource-icon";
-WebInspector.ResourceTreeElement.FailedStyleClassName = "failed";
+WI.ResourceTreeElement.ResourceIconStyleClassName = "resource-icon";
+WI.ResourceTreeElement.FailedStyleClassName = "failed";
 
-WebInspector.ResourceTreeElement.SpinnerSymbol = Symbol("spinner");
+WI.ResourceTreeElement.SpinnerSymbol = Symbol("spinner");
diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js
index 05b5da7..e24b711 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js
@@ -23,30 +23,30 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ResourcesTabContentView = class ResourcesTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.ResourcesTabContentView = class ResourcesTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.ResourcesTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.ResourceDetailsSidebarPanel, WebInspector.ProbeDetailsSidebarPanel];
+        let {image, title} = WI.ResourcesTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel];
 
-        if (window.CanvasAgent && WebInspector.settings.experimentalShowCanvasContextsInResources.value)
-            detailsSidebarPanelConstructors.push(WebInspector.CanvasDetailsSidebarPanel);
+        if (window.CanvasAgent && WI.settings.experimentalShowCanvasContextsInResources.value)
+            detailsSidebarPanelConstructors.push(WI.CanvasDetailsSidebarPanel);
 
         // FIXME: Until ContentFlows are moved to the Elements tab, these details sidebar panels need to be included.
-        detailsSidebarPanelConstructors = detailsSidebarPanelConstructors.concat([WebInspector.DOMNodeDetailsSidebarPanel, WebInspector.CSSStyleDetailsSidebarPanel]);
+        detailsSidebarPanelConstructors = detailsSidebarPanelConstructors.concat([WI.DOMNodeDetailsSidebarPanel, WI.CSSStyleDetailsSidebarPanel]);
         if (window.LayerTreeAgent)
-            detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);
+            detailsSidebarPanelConstructors.push(WI.LayerTreeDetailsSidebarPanel);
 
-        super(identifier || "resources", "resources", tabBarItem, WebInspector.ResourceSidebarPanel, detailsSidebarPanelConstructors);
+        super(identifier || "resources", "resources", tabBarItem, WI.ResourceSidebarPanel, detailsSidebarPanelConstructors);
     }
 
     static tabInfo()
     {
         return {
             image: "Images/Resources.svg",
-            title: WebInspector.UIString("Resources"),
+            title: WI.UIString("Resources"),
         };
     }
 
@@ -54,7 +54,7 @@
 
     get type()
     {
-        return WebInspector.ResourcesTabContentView.Type;
+        return WI.ResourcesTabContentView.Type;
     }
 
     get supportsSplitContentBrowser()
@@ -64,14 +64,14 @@
 
     canShowRepresentedObject(representedObject)
     {
-        return representedObject instanceof WebInspector.Frame
-            || representedObject instanceof WebInspector.Resource
-            || representedObject instanceof WebInspector.Script
-            || representedObject instanceof WebInspector.CSSStyleSheet
-            || representedObject instanceof WebInspector.ContentFlow
-            || representedObject instanceof WebInspector.Canvas
-            || representedObject instanceof WebInspector.Collection;
+        return representedObject instanceof WI.Frame
+            || representedObject instanceof WI.Resource
+            || representedObject instanceof WI.Script
+            || representedObject instanceof WI.CSSStyleSheet
+            || representedObject instanceof WI.ContentFlow
+            || representedObject instanceof WI.Canvas
+            || representedObject instanceof WI.Collection;
     }
 };
 
-WebInspector.ResourcesTabContentView.Type = "resources";
+WI.ResourcesTabContentView.Type = "resources";
diff --git a/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js b/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js
index 38d1fa8..066e25a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RulesStyleDetailsPanel = class RulesStyleDetailsPanel extends WebInspector.StyleDetailsPanel
+WI.RulesStyleDetailsPanel = class RulesStyleDetailsPanel extends WI.StyleDetailsPanel
 {
     constructor(delegate)
     {
-        super(delegate, "rules", "rules", WebInspector.UIString("Styles \u2014 Rules"));
+        super(delegate, "rules", "rules", WI.UIString("Styles \u2014 Rules"));
 
         this._sections = [];
         this._inspectorSection = null;
@@ -40,7 +40,7 @@
 
         this._emptyFilterResultsMessage = document.createElement("div");
         this._emptyFilterResultsMessage.classList.add("no-filter-results-message");
-        this._emptyFilterResultsMessage.textContent = WebInspector.UIString("No Results Found");
+        this._emptyFilterResultsMessage.textContent = WI.UIString("No Results Found");
         this._emptyFilterResultsElement.appendChild(this._emptyFilterResultsMessage);
 
         this._boundRemoveSectionWithActiveEditor = this._removeSectionWithActiveEditor.bind(this);
@@ -68,7 +68,7 @@
             }
 
             if (this._sectionWithActiveEditor) {
-                this._sectionWithActiveEditor.addEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
+                this._sectionWithActiveEditor.addEventListener(WI.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
                 return;
             }
         }
@@ -147,7 +147,7 @@
             var section = style.__rulesSection;
 
             if (!section) {
-                section = new WebInspector.CSSStyleDeclarationSection(this, style);
+                section = new WI.CSSStyleDeclarationSection(this, style);
                 style.__rulesSection = section;
             } else
                 section.refresh();
@@ -166,7 +166,7 @@
 
         function insertMediaOrInheritanceLabel(style)
         {
-            if (previousSection && previousSection.style.type === WebInspector.CSSStyleDeclaration.Type.Inline)
+            if (previousSection && previousSection.style.type === WI.CSSStyleDeclaration.Type.Inline)
                 previousSection.lastInGroup = true;
 
             var hasMediaOrInherited = [];
@@ -175,14 +175,14 @@
                 previousSection.lastInGroup = true;
 
                 var prefixElement = document.createElement("strong");
-                prefixElement.textContent = WebInspector.UIString("Inherited From: ");
+                prefixElement.textContent = WI.UIString("Inherited From: ");
 
                 let inheritedLabel = newDOMFragment.appendChild(document.createElement("div"));
                 inheritedLabel.className = "label";
 
                 inheritedLabel.appendChild(prefixElement);
 
-                inheritedLabel.appendChild(WebInspector.linkifyNodeReference(style.node, {
+                inheritedLabel.appendChild(WI.linkifyNodeReference(style.node, {
                     maxLength: 100,
                     excludeRevealElement: true,
                 }));
@@ -202,7 +202,7 @@
 
                 for (var media of currentMediaList) {
                     var prefixElement = document.createElement("strong");
-                    prefixElement.textContent = WebInspector.UIString("Media: ");
+                    prefixElement.textContent = WI.UIString("Media: ");
 
                     var mediaLabel = document.createElement("div");
                     mediaLabel.className = "label";
@@ -214,7 +214,7 @@
                             ignoreNetworkTab: true,
                             ignoreSearchTab: true,
                         };
-                        mediaLabel.append(" \u2014 ", WebInspector.createSourceCodeLocationLink(media.sourceCodeLocation, options));
+                        mediaLabel.append(" \u2014 ", WI.createSourceCodeLocationLink(media.sourceCodeLocation, options));
                     }
 
                     newDOMFragment.appendChild(mediaLabel);
@@ -223,12 +223,12 @@
                 }
             }
 
-            if (!hasMediaOrInherited.length && style.type !== WebInspector.CSSStyleDeclaration.Type.Inline) {
+            if (!hasMediaOrInherited.length && style.type !== WI.CSSStyleDeclaration.Type.Inline) {
                 if (previousSection && !previousSection.lastInGroup)
                     hasMediaOrInherited = this._ruleMediaAndInherticanceList.lastValue;
                 else {
                     var prefixElement = document.createElement("strong");
-                    prefixElement.textContent = WebInspector.UIString("Media: ");
+                    prefixElement.textContent = WI.UIString("Media: ");
 
                     var mediaLabel = document.createElement("div");
                     mediaLabel.className = "label";
@@ -278,7 +278,7 @@
         this._ruleMediaAndInherticanceList = [];
         var orderedStyles = uniqueOrderedStyles(this.nodeStyles.orderedStyles);
         for (var style of orderedStyles) {
-            var isUserAgentStyle = style.ownerRule && style.ownerRule.type === WebInspector.CSSStyleSheet.Type.UserAgent;
+            var isUserAgentStyle = style.ownerRule && style.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent;
             insertAllMatchingPseudoStyles.call(this, isUserAgentStyle || style.inherited);
 
             insertMediaOrInheritanceLabel.call(this, style);
@@ -361,7 +361,7 @@
     {
         for (var labels of this._ruleMediaAndInherticanceList) {
             for (var i = 0; i < labels.length; ++i) {
-                labels[i].classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName, filterBar.hasActiveFilters());
+                labels[i].classList.toggle(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName, filterBar.hasActiveFilters());
 
                 if (i === labels.length - 1)
                     labels[i].classList.toggle("filter-matching-label", filterBar.hasActiveFilters());
@@ -375,9 +375,9 @@
             if (section.findMatchingPropertiesAndSelectors(filterBar.filters.text) && filterBar.hasActiveFilters()) {
                 if (this._ruleMediaAndInherticanceList[i].length) {
                     for (var label of this._ruleMediaAndInherticanceList[i])
-                        label.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);
+                        label.classList.remove(WI.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);
                 } else
-                    section.element.classList.add(WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);
+                    section.element.classList.add(WI.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);
 
                 matchFound = true;
             }
@@ -406,18 +406,18 @@
         if (this.nodeStyles.node.isInUserAgentShadowTree())
             return;
 
-        let styleSheets = WebInspector.cssStyleManager.styleSheets.filter(styleSheet => styleSheet.hasInfo() && !styleSheet.isInlineStyleTag() && !styleSheet.isInlineStyleAttributeStyleSheet());
+        let styleSheets = WI.cssStyleManager.styleSheets.filter(styleSheet => styleSheet.hasInfo() && !styleSheet.isInlineStyleTag() && !styleSheet.isInlineStyleAttributeStyleSheet());
         if (!styleSheets.length)
             return;
 
         const justSelector = true;
         let selector = this.nodeStyles.node.appropriateSelectorFor(justSelector);
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         const handler = null;
         const disabled = true;
-        contextMenu.appendItem(WebInspector.UIString("Available Style Sheets"), handler, disabled);
+        contextMenu.appendItem(WI.UIString("Available Style Sheets"), handler, disabled);
 
         for (let styleSheet of styleSheets) {
             contextMenu.appendItem(styleSheet.displayName, () => {
@@ -511,7 +511,7 @@
 
     _removeSectionWithActiveEditor(event)
     {
-        this._sectionWithActiveEditor.removeEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
+        this._sectionWithActiveEditor.removeEventListener(WI.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
         this.refresh(true);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js b/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js
index d5fdb8f..1ba99af 100644
--- a/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js
@@ -23,18 +23,18 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RulesStyleSpreadsheetDetailsPanel = class RulesStyleSpreadsheetDetailsPanel extends WebInspector.StyleDetailsPanel
+WI.RulesStyleSpreadsheetDetailsPanel = class RulesStyleSpreadsheetDetailsPanel extends WI.StyleDetailsPanel
 {
     constructor(delegate)
     {
-        super(delegate, "rules", "rules", WebInspector.UIString("Styles \u2014 Rules"));
+        super(delegate, "rules", "rules", WI.UIString("Styles \u2014 Rules"));
     }
 
     // Public
 
     filterDidChange()
     {
-        // Called by WebInspector.CSSStyleDetailsSidebarPanel.prototype._filterDidChange.
+        // Called by WI.CSSStyleDetailsSidebarPanel.prototype._filterDidChange.
         // Unimplemented.
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js b/Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js
index b0ffb2d..e591c4b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SVGImageResourceClusterContentView = class SVGImageResourceClusterContentView extends WebInspector.ClusterContentView
+WI.SVGImageResourceClusterContentView = class SVGImageResourceClusterContentView extends WI.ClusterContentView
 {
     constructor(resource)
     {
@@ -34,19 +34,19 @@
         let createPathComponent = (displayName, className, identifier) => {
             const textOnly = false;
             const showSelectorArrows = true;
-            let pathComponent = new WebInspector.HierarchicalPathComponent(displayName, className, identifier, textOnly, showSelectorArrows);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+            let pathComponent = new WI.HierarchicalPathComponent(displayName, className, identifier, textOnly, showSelectorArrows);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
             pathComponent.comparisonData = resource;
             return pathComponent;
         };
 
-        this._imagePathComponent = createPathComponent(WebInspector.UIString("Image"), "image-icon", WebInspector.SVGImageResourceClusterContentView.Identifier.Image);
-        this._sourcePathComponent = createPathComponent(WebInspector.UIString("Source"), "source-icon", WebInspector.SVGImageResourceClusterContentView.Identifier.Source);
+        this._imagePathComponent = createPathComponent(WI.UIString("Image"), "image-icon", WI.SVGImageResourceClusterContentView.Identifier.Image);
+        this._sourcePathComponent = createPathComponent(WI.UIString("Source"), "source-icon", WI.SVGImageResourceClusterContentView.Identifier.Source);
 
         this._imagePathComponent.nextSibling = this._sourcePathComponent;
         this._sourcePathComponent.previousSibling = this._imagePathComponent;
 
-        this._currentContentViewSetting = new WebInspector.Setting("svg-image-resource-cluster-current-view-" + this._resource.url.hash, WebInspector.SVGImageResourceClusterContentView.Identifier.Image);
+        this._currentContentViewSetting = new WI.Setting("svg-image-resource-cluster-current-view-" + this._resource.url.hash, WI.SVGImageResourceClusterContentView.Identifier.Image);
     }
 
     // Public
@@ -85,14 +85,14 @@
 
     saveToCookie(cookie)
     {
-        cookie[WebInspector.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
+        cookie[WI.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
     }
 
     restoreFromCookie(cookie)
     {
-        let contentView = this._showContentViewForIdentifier(cookie[WebInspector.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey]);
+        let contentView = this._showContentViewForIdentifier(cookie[WI.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey]);
         if (typeof contentView.revealPosition === "function" && "lineNumber" in cookie && "columnNumber" in cookie)
-            contentView.revealPosition(new WebInspector.SourceCodePosition(cookie.lineNumber, cookie.columnNumber));
+            contentView.revealPosition(new WI.SourceCodePosition(cookie.lineNumber, cookie.columnNumber));
     }
 
     // Private
@@ -102,9 +102,9 @@
         console.assert(contentView);
         if (!contentView)
             return null;
-        if (contentView instanceof WebInspector.ImageResourceContentView)
+        if (contentView instanceof WI.ImageResourceContentView)
             return this._imagePathComponent;
-        if (contentView instanceof WebInspector.TextContentView)
+        if (contentView instanceof WI.TextContentView)
             return this._sourcePathComponent;
         console.error("Unknown contentView.");
         return null;
@@ -115,10 +115,10 @@
         console.assert(contentView);
         if (!contentView)
             return null;
-        if (contentView instanceof WebInspector.ImageResourceContentView)
-            return WebInspector.SVGImageResourceClusterContentView.Identifier.Image;
-        if (contentView instanceof WebInspector.TextContentView)
-            return WebInspector.SVGImageResourceClusterContentView.Identifier.Source;
+        if (contentView instanceof WI.ImageResourceContentView)
+            return WI.SVGImageResourceClusterContentView.Identifier.Image;
+        if (contentView instanceof WI.TextContentView)
+            return WI.SVGImageResourceClusterContentView.Identifier.Source;
         console.error("Unknown contentView.");
         return null;
     }
@@ -128,12 +128,12 @@
         let contentViewToShow = null;
 
         switch (identifier) {
-        case WebInspector.SVGImageResourceClusterContentView.Identifier.Image:
-            contentViewToShow = new WebInspector.ImageResourceContentView(this._resource);
+        case WI.SVGImageResourceClusterContentView.Identifier.Image:
+            contentViewToShow = new WI.ImageResourceContentView(this._resource);
             break;
 
-        case WebInspector.SVGImageResourceClusterContentView.Identifier.Source:
-            contentViewToShow = new WebInspector.TextContentView("", this._resource.mimeType);
+        case WI.SVGImageResourceClusterContentView.Identifier.Source:
+            contentViewToShow = new WI.TextContentView("", this._resource.mimeType);
 
             this._resource.requestContent().then((result) => {
                 let fileReader = new FileReader;
@@ -146,7 +146,7 @@
 
         default:
             // Default to showing the image.
-            contentViewToShow = new WebInspector.ImageResourceContentView(this._resource);
+            contentViewToShow = new WI.ImageResourceContentView(this._resource);
             break;
         }
 
@@ -161,9 +161,9 @@
     }
 };
 
-WebInspector.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey = "svg-image-resource-cluster-content-view-identifier";
+WI.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey = "svg-image-resource-cluster-content-view-identifier";
 
-WebInspector.SVGImageResourceClusterContentView.Identifier = {
+WI.SVGImageResourceClusterContentView.Identifier = {
     Image: "image",
     Source: "source",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js b/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js
index 9f36720..fe5b975 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScopeBar = class ScopeBar extends WebInspector.NavigationItem
+WI.ScopeBar = class ScopeBar extends WI.NavigationItem
 {
     constructor(identifier, items, defaultItem, shouldGroupNonExclusiveItems)
     {
@@ -106,17 +106,17 @@
                 else
                     nonExclusiveItems.push(item);
 
-                item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
+                item.addEventListener(WI.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
             }
 
-            this._multipleItem = new WebInspector.MultipleScopeBarItem(nonExclusiveItems);
+            this._multipleItem = new WI.MultipleScopeBarItem(nonExclusiveItems);
             this._element.appendChild(this._multipleItem.element);
         } else {
             for (var item of this._items) {
                 this._itemsById.set(item.id, item);
                 this._element.appendChild(item.element);
 
-                item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
+                item.addEventListener(WI.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
             }
         }
 
@@ -154,10 +154,10 @@
             this._defaultItem.selected = true;
 
         this._element.classList.toggle("default-item-selected", this._defaultItem.selected);
-        this.dispatchEventToListeners(WebInspector.ScopeBar.Event.SelectionChanged);
+        this.dispatchEventToListeners(WI.ScopeBar.Event.SelectionChanged);
     }
 };
 
-WebInspector.ScopeBar.Event = {
+WI.ScopeBar.Event = {
     SelectionChanged: "scopebar-selection-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js b/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js
index f402475..1658cee3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScopeBarItem = class ScopeBarItem extends WebInspector.Object
+WI.ScopeBarItem = class ScopeBarItem extends WI.Object
 {
     constructor(id, label, exclusive, className)
     {
@@ -40,7 +40,7 @@
         this._label = label;
         this._exclusive = exclusive;
 
-        this._selectedSetting = new WebInspector.Setting("scopebaritem-" + id, false);
+        this._selectedSetting = new WI.Setting("scopebaritem-" + id, false);
 
         this._element.classList.toggle("selected", this._selectedSetting.value);
     }
@@ -85,7 +85,7 @@
         this._element.classList.toggle("selected", selected);
         this._selectedSetting.value = selected;
 
-        this.dispatchEventToListeners(WebInspector.ScopeBarItem.Event.SelectionChanged, {withModifier});
+        this.dispatchEventToListeners(WI.ScopeBarItem.Event.SelectionChanged, {withModifier});
     }
 
     // Private
@@ -100,6 +100,6 @@
     }
 };
 
-WebInspector.ScopeBarItem.Event = {
+WI.ScopeBarItem.Event = {
     SelectionChanged: "scope-bar-item-selection-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js
index 54f1f14..fee33f5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js
@@ -23,37 +23,37 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScopeChainDetailsSidebarPanel = class ScopeChainDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
+WI.ScopeChainDetailsSidebarPanel = class ScopeChainDetailsSidebarPanel extends WI.DetailsSidebarPanel
 {
     constructor()
     {
-        super("scope-chain", WebInspector.UIString("Scope Chain"));
+        super("scope-chain", WI.UIString("Scope Chain"));
 
         this._callFrame = null;
 
-        this._watchExpressionsSetting = new WebInspector.Setting("watch-expressions", []);
-        this._watchExpressionsSetting.addEventListener(WebInspector.Setting.Event.Changed, this._updateWatchExpressionsNavigationBar, this);
+        this._watchExpressionsSetting = new WI.Setting("watch-expressions", []);
+        this._watchExpressionsSetting.addEventListener(WI.Setting.Event.Changed, this._updateWatchExpressionsNavigationBar, this);
 
         this._watchExpressionOptionsElement = document.createElement("div");
         this._watchExpressionOptionsElement.classList.add("options");
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this._watchExpressionOptionsElement.appendChild(this._navigationBar.element);
 
-        let addWatchExpressionButton = new WebInspector.ButtonNavigationItem("add-watch-expression", WebInspector.UIString("Add watch expression"), "Images/Plus13.svg", 13, 13);
-        addWatchExpressionButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._addWatchExpressionButtonClicked, this);
+        let addWatchExpressionButton = new WI.ButtonNavigationItem("add-watch-expression", WI.UIString("Add watch expression"), "Images/Plus13.svg", 13, 13);
+        addWatchExpressionButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._addWatchExpressionButtonClicked, this);
         this._navigationBar.addNavigationItem(addWatchExpressionButton);
 
-        this._clearAllWatchExpressionButton = new WebInspector.ButtonNavigationItem("clear-watch-expressions", WebInspector.UIString("Clear watch expressions"), "Images/NavigationItemTrash.svg", 14, 14);
-        this._clearAllWatchExpressionButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearAllWatchExpressionsButtonClicked, this);
+        this._clearAllWatchExpressionButton = new WI.ButtonNavigationItem("clear-watch-expressions", WI.UIString("Clear watch expressions"), "Images/NavigationItemTrash.svg", 14, 14);
+        this._clearAllWatchExpressionButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._clearAllWatchExpressionsButtonClicked, this);
         this._navigationBar.addNavigationItem(this._clearAllWatchExpressionButton);
 
-        this._refreshAllWatchExpressionButton = new WebInspector.ButtonNavigationItem("refresh-watch-expressions", WebInspector.UIString("Refresh watch expressions"), "Images/ReloadFull.svg", 13, 13);
-        this._refreshAllWatchExpressionButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._refreshAllWatchExpressionsButtonClicked, this);
+        this._refreshAllWatchExpressionButton = new WI.ButtonNavigationItem("refresh-watch-expressions", WI.UIString("Refresh watch expressions"), "Images/ReloadFull.svg", 13, 13);
+        this._refreshAllWatchExpressionButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._refreshAllWatchExpressionsButtonClicked, this);
         this._navigationBar.addNavigationItem(this._refreshAllWatchExpressionButton);
 
-        this._watchExpressionsSectionGroup = new WebInspector.DetailsSectionGroup;
-        this._watchExpressionsSection = new WebInspector.DetailsSection("watch-expressions", WebInspector.UIString("Watch Expressions"), [this._watchExpressionsSectionGroup], this._watchExpressionOptionsElement);
+        this._watchExpressionsSectionGroup = new WI.DetailsSectionGroup;
+        this._watchExpressionsSection = new WI.DetailsSection("watch-expressions", WI.UIString("Watch Expressions"), [this._watchExpressionsSectionGroup], this._watchExpressionOptionsElement);
         this.contentView.element.appendChild(this._watchExpressionsSection.element);
 
         this._updateWatchExpressionsNavigationBar();
@@ -61,16 +61,16 @@
         this.needsLayout();
 
         // Update on console prompt eval as objects in the scope chain may have changed.
-        WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.DidEvaluate, this._didEvaluateExpression, this);
+        WI.runtimeManager.addEventListener(WI.RuntimeManager.Event.DidEvaluate, this._didEvaluateExpression, this);
 
         // Update watch expressions when console execution context changes.
-        WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.ActiveExecutionContextChanged, this._activeExecutionContextChanged, this);
+        WI.runtimeManager.addEventListener(WI.RuntimeManager.Event.ActiveExecutionContextChanged, this._activeExecutionContextChanged, this);
 
         // Update watch expressions on navigations.
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
         // Update watch expressions on active call frame changes.
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
     }
 
     // Public
@@ -83,9 +83,9 @@
 
         var callFrameToInspect = null;
 
-        // Iterate over the objects to find a WebInspector.CallFrame to inspect.
+        // Iterate over the objects to find a WI.CallFrame to inspect.
         for (var i = 0; i < objects.length; ++i) {
-            if (!(objects[i] instanceof WebInspector.CallFrame))
+            if (!(objects[i] instanceof WI.CallFrame))
                 continue;
             callFrameToInspect = objects[i];
             break;
@@ -128,7 +128,7 @@
                 if (watchExpressionsSection)
                     this._watchExpressionsSectionGroup.rows = [watchExpressionsSection];
                 else {
-                    let emptyRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Watch Expressions"));
+                    let emptyRow = new WI.DetailsSectionRow(WI.UIString("No Watch Expressions"));
                     this._watchExpressionsSectionGroup.rows = [emptyRow];
                     emptyRow.showEmptyMessage();
                 }
@@ -150,7 +150,7 @@
             // We need a timeout in place in case there are long running, pending backend dispatches. This can happen
             // if the debugger is paused in code that was executed from the console. The console will be waiting for
             // the result of the execution and without a timeout we would never update the scope variables.
-            let delay = WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.size === 0 ? 50 : 250;
+            let delay = WI.ScopeChainDetailsSidebarPanel._autoExpandProperties.size === 0 ? 50 : 250;
             let timeout = setTimeout(delayedWork.bind(this), delay);
 
             // Since ObjectTreeView populates asynchronously, we want to wait to replace the existing content
@@ -169,13 +169,13 @@
         let foundLocalScope = false;
 
         let sectionCountByType = new Map;
-        for (let type in WebInspector.ScopeChainNode.Type)
-            sectionCountByType.set(WebInspector.ScopeChainNode.Type[type], 0);
+        for (let type in WI.ScopeChainNode.Type)
+            sectionCountByType.set(WI.ScopeChainNode.Type[type], 0);
 
         let scopeChain = callFrame.mergedScopeChain();
         for (let scope of scopeChain) {
             // Don't show sections for empty scopes unless it is the local scope, since it has "this".
-            if (scope.empty && scope.type !== WebInspector.ScopeChainNode.Type.Local)
+            if (scope.empty && scope.type !== WI.ScopeChainNode.Type.Local)
                 continue;
 
             let title = null;
@@ -186,63 +186,63 @@
             sectionCountByType.set(scope.type, ++count);
 
             switch (scope.type) {
-            case WebInspector.ScopeChainNode.Type.Local:
+            case WI.ScopeChainNode.Type.Local:
                 foundLocalScope = true;
                 collapsedByDefault = false;
-                title = WebInspector.UIString("Local Variables");
+                title = WI.UIString("Local Variables");
                 if (callFrame.thisObject)
-                    extraPropertyDescriptor = new WebInspector.PropertyDescriptor({name: "this", value: callFrame.thisObject});
+                    extraPropertyDescriptor = new WI.PropertyDescriptor({name: "this", value: callFrame.thisObject});
                 break;
 
-            case WebInspector.ScopeChainNode.Type.Closure:
+            case WI.ScopeChainNode.Type.Closure:
                 if (scope.__baseClosureScope && scope.name)
-                    title = WebInspector.UIString("Closure Variables (%s)").format(scope.name);
+                    title = WI.UIString("Closure Variables (%s)").format(scope.name);
                 else
-                    title = WebInspector.UIString("Closure Variables");
+                    title = WI.UIString("Closure Variables");
                 collapsedByDefault = false;
                 break;
 
-            case WebInspector.ScopeChainNode.Type.Block:
-                title = WebInspector.UIString("Block Variables");
+            case WI.ScopeChainNode.Type.Block:
+                title = WI.UIString("Block Variables");
                 collapsedByDefault = false;
                 break;
 
-            case WebInspector.ScopeChainNode.Type.Catch:
-                title = WebInspector.UIString("Catch Variables");
+            case WI.ScopeChainNode.Type.Catch:
+                title = WI.UIString("Catch Variables");
                 collapsedByDefault = false;
                 break;
 
-            case WebInspector.ScopeChainNode.Type.FunctionName:
-                title = WebInspector.UIString("Function Name Variable");
+            case WI.ScopeChainNode.Type.FunctionName:
+                title = WI.UIString("Function Name Variable");
                 collapsedByDefault = true;
                 break;
 
-            case WebInspector.ScopeChainNode.Type.With:
-                title = WebInspector.UIString("With Object Properties");
+            case WI.ScopeChainNode.Type.With:
+                title = WI.UIString("With Object Properties");
                 collapsedByDefault = foundLocalScope;
                 break;
 
-            case WebInspector.ScopeChainNode.Type.Global:
-                title = WebInspector.UIString("Global Variables");
+            case WI.ScopeChainNode.Type.Global:
+                title = WI.UIString("Global Variables");
                 collapsedByDefault = true;
                 break;
 
-            case WebInspector.ScopeChainNode.Type.GlobalLexicalEnvironment:
-                title = WebInspector.UIString("Global Lexical Environment");
+            case WI.ScopeChainNode.Type.GlobalLexicalEnvironment:
+                title = WI.UIString("Global Lexical Environment");
                 collapsedByDefault = true;
                 break;
             }
 
             let detailsSectionIdentifier = scope.type + "-" + sectionCountByType.get(scope.type);
-            let detailsSection = new WebInspector.DetailsSection(detailsSectionIdentifier, title, null, null, collapsedByDefault);
+            let detailsSection = new WI.DetailsSection(detailsSectionIdentifier, title, null, null, collapsedByDefault);
 
             // FIXME: This just puts two ObjectTreeViews next to each other, but that means
             // that properties are not nicely sorted between the two separate lists.
 
             let rows = [];
             for (let object of scope.objects) {
-                let scopePropertyPath = WebInspector.PropertyPath.emptyPropertyPathForScope(object);
-                let objectTree = new WebInspector.ObjectTreeView(object, WebInspector.ObjectTreeView.Mode.Properties, scopePropertyPath);
+                let scopePropertyPath = WI.PropertyPath.emptyPropertyPathForScope(object);
+                let objectTree = new WI.ObjectTreeView(object, WI.ObjectTreeView.Mode.Properties, scopePropertyPath);
 
                 objectTree.showOnlyProperties();
 
@@ -252,10 +252,10 @@
                 }
 
                 let treeOutline = objectTree.treeOutline;
-                treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._treeElementAdded.bind(this, detailsSectionIdentifier), this);
-                treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange.bind(this, detailsSectionIdentifier), this);
+                treeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._treeElementAdded.bind(this, detailsSectionIdentifier), this);
+                treeOutline.addEventListener(WI.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange.bind(this, detailsSectionIdentifier), this);
 
-                rows.push(new WebInspector.ObjectPropertiesDetailSectionRow(objectTree, detailsSection));
+                rows.push(new WI.ObjectPropertiesDetailSectionRow(objectTree, detailsSection));
             }
 
             detailsSection.groups[0].rows = rows;
@@ -271,35 +271,35 @@
         if (!watchExpressions.length) {
             if (this._usedWatchExpressionsObjectGroup) {
                 this._usedWatchExpressionsObjectGroup = false;
-                for (let target of WebInspector.targets)
-                    target.RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
+                for (let target of WI.targets)
+                    target.RuntimeAgent.releaseObjectGroup(WI.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
             }
             return Promise.resolve(null);
         }
 
-        for (let target of WebInspector.targets)
-            target.RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
+        for (let target of WI.targets)
+            target.RuntimeAgent.releaseObjectGroup(WI.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
         this._usedWatchExpressionsObjectGroup = true;
 
-        let watchExpressionsRemoteObject = WebInspector.RemoteObject.createFakeRemoteObject();
-        let fakePropertyPath = WebInspector.PropertyPath.emptyPropertyPathForScope(watchExpressionsRemoteObject);
-        let objectTree = new WebInspector.ObjectTreeView(watchExpressionsRemoteObject, WebInspector.ObjectTreeView.Mode.Properties, fakePropertyPath);
+        let watchExpressionsRemoteObject = WI.RemoteObject.createFakeRemoteObject();
+        let fakePropertyPath = WI.PropertyPath.emptyPropertyPathForScope(watchExpressionsRemoteObject);
+        let objectTree = new WI.ObjectTreeView(watchExpressionsRemoteObject, WI.ObjectTreeView.Mode.Properties, fakePropertyPath);
         objectTree.showOnlyProperties();
 
         let treeOutline = objectTree.treeOutline;
         const watchExpressionSectionIdentifier = "watch-expressions";
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._treeElementAdded.bind(this, watchExpressionSectionIdentifier), this);
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange.bind(this, watchExpressionSectionIdentifier), this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._treeElementAdded.bind(this, watchExpressionSectionIdentifier), this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange.bind(this, watchExpressionSectionIdentifier), this);
         treeOutline.objectTreeElementAddContextMenuItems = this._objectTreeElementAddContextMenuItems.bind(this);
 
         let promises = [];
         for (let expression of watchExpressions) {
             promises.push(new Promise(function(resolve, reject) {
-                let options = {objectGroup: WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName, includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: true, saveResult: false};
-                WebInspector.runtimeManager.evaluateInInspectedWindow(expression, options, function(object, wasThrown) {
+                let options = {objectGroup: WI.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName, includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: true, saveResult: false};
+                WI.runtimeManager.evaluateInInspectedWindow(expression, options, function(object, wasThrown) {
                     if (!object)
                         return;
-                    let propertyDescriptor = new WebInspector.PropertyDescriptor({name: expression, value: object}, undefined, undefined, wasThrown);
+                    let propertyDescriptor = new WI.PropertyDescriptor({name: expression, value: object}, undefined, undefined, wasThrown);
                     objectTree.appendExtraPropertyDescriptor(propertyDescriptor);
                     resolve(propertyDescriptor);
                 });
@@ -307,7 +307,7 @@
         }
 
         return Promise.all(promises).then(function() {
-            return Promise.resolve(new WebInspector.ObjectPropertiesDetailSectionRow(objectTree));
+            return Promise.resolve(new WI.ObjectPropertiesDetailSectionRow(objectTree));
         });
     }
 
@@ -340,19 +340,19 @@
     {
         function presentPopoverOverTargetElement()
         {
-            let target = WebInspector.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());
-            popover.present(target, [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+            let target = WI.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());
+            popover.present(target, [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]);
         }
 
-        let popover = new WebInspector.Popover(this);
+        let popover = new WI.Popover(this);
         let content = document.createElement("div");
         content.classList.add("watch-expression");
-        content.appendChild(document.createElement("div")).textContent = WebInspector.UIString("Add New Watch Expression");
+        content.appendChild(document.createElement("div")).textContent = WI.UIString("Add New Watch Expression");
 
         let editorElement = content.appendChild(document.createElement("div"));
-        editorElement.classList.add("watch-expression-editor", WebInspector.SyntaxHighlightedStyleClassName);
+        editorElement.classList.add("watch-expression-editor", WI.SyntaxHighlightedStyleClassName);
 
-        this._codeMirror = WebInspector.CodeMirrorEditor.create(editorElement, {
+        this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
             lineWrapping: true,
             mode: "text/javascript",
             indentWithTabs: true,
@@ -367,8 +367,8 @@
             "Enter": () => { this._popoverCommitted = true; popover.dismiss(); },
         });
 
-        let completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror);
-        completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
+        let completionController = new WI.CodeMirrorCompletionController(this._codeMirror);
+        completionController.addExtendedCompletionProvider("javascript", WI.javaScriptRuntimeCompletionProvider);
 
         // Resize the popover as best we can when the CodeMirror editor changes size.
         let previousHeight = 0;
@@ -416,7 +416,7 @@
 
     _didEvaluateExpression(event)
     {
-        if (event.data.objectGroup === WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName)
+        if (event.data.objectGroup === WI.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName)
             return;
 
         this.needsLayout();
@@ -446,7 +446,7 @@
         if (objectTreeElement.parent !== objectTreeElement.treeOutline)
             return;
 
-        contextMenu.appendItem(WebInspector.UIString("Remove Watch Expression"), () => {
+        contextMenu.appendItem(WI.UIString("Remove Watch Expression"), () => {
             let expression = objectTreeElement.property.name;
             this._removeWatchExpression(expression);
         });
@@ -471,7 +471,7 @@
         if (!propertyPathIdentifier)
             return;
 
-        if (WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.has(propertyPathIdentifier))
+        if (WI.ScopeChainDetailsSidebarPanel._autoExpandProperties.has(propertyPathIdentifier))
             treeElement.expand();
     }
 
@@ -483,9 +483,9 @@
             return;
 
         if (treeElement.expanded)
-            WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.add(propertyPathIdentifier);
+            WI.ScopeChainDetailsSidebarPanel._autoExpandProperties.add(propertyPathIdentifier);
         else
-            WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.delete(propertyPathIdentifier);
+            WI.ScopeChainDetailsSidebarPanel._autoExpandProperties.delete(propertyPathIdentifier);
     }
 
     _updateWatchExpressionsNavigationBar()
@@ -496,5 +496,5 @@
     }
 };
 
-WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties = new Set;
-WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName = "watch-expressions";
+WI.ScopeChainDetailsSidebarPanel._autoExpandProperties = new Set;
+WI.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName = "watch-expressions";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.js
index f0c30a0..a54d5d4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScopeRadioButtonNavigationItem = class ScopeRadioButtonNavigationItem extends WebInspector.RadioButtonNavigationItem
+WI.ScopeRadioButtonNavigationItem = class ScopeRadioButtonNavigationItem extends WI.RadioButtonNavigationItem
 {
     constructor(identifier, toolTip, scopeItems, defaultScopeItem)
     {
@@ -85,10 +85,10 @@
         }
 
         this._element.title = selectedItemIdentifier.label;
-        this.dispatchEventToListeners(WebInspector.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged);
+        this.dispatchEventToListeners(WI.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged);
     }
 };
 
-WebInspector.ScopeRadioButtonNavigationItem.Event = {
+WI.ScopeRadioButtonNavigationItem.Event = {
     SelectedItemChanged: "scope-radio-button-navigation-item-selected-item-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js
index 95c666c..ffa3341 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js
@@ -23,27 +23,27 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptClusterTimelineView = class ScriptClusterTimelineView extends WebInspector.ClusterContentView
+WI.ScriptClusterTimelineView = class ScriptClusterTimelineView extends WI.ClusterContentView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline);
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.Script);
+        console.assert(timeline.type === WI.TimelineRecord.Type.Script);
 
-        this._currentContentViewSetting = new WebInspector.Setting("script-cluster-timeline-view-current-view", WebInspector.ScriptClusterTimelineView.EventsIdentifier);
+        this._currentContentViewSetting = new WI.Setting("script-cluster-timeline-view-current-view", WI.ScriptClusterTimelineView.EventsIdentifier);
 
         let showSelectorArrows = this._canShowProfileView();
         function createPathComponent(displayName, className, identifier)
         {
-            let pathComponent = new WebInspector.HierarchicalPathComponent(displayName, className, identifier, false, showSelectorArrows);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+            let pathComponent = new WI.HierarchicalPathComponent(displayName, className, identifier, false, showSelectorArrows);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
             pathComponent.comparisonData = timeline;
             return pathComponent;
         }
 
-        this._eventsPathComponent = createPathComponent.call(this, WebInspector.UIString("Events"), "events-icon", WebInspector.ScriptClusterTimelineView.EventsIdentifier);
-        this._profilePathComponent = createPathComponent.call(this, WebInspector.UIString("Call Trees"), "call-trees-icon", WebInspector.ScriptClusterTimelineView.ProfileIdentifier);
+        this._eventsPathComponent = createPathComponent.call(this, WI.UIString("Events"), "events-icon", WI.ScriptClusterTimelineView.EventsIdentifier);
+        this._profilePathComponent = createPathComponent.call(this, WI.UIString("Call Trees"), "call-trees-icon", WI.ScriptClusterTimelineView.ProfileIdentifier);
 
         if (this._canShowProfileView()) {
             this._eventsPathComponent.nextSibling = this._profilePathComponent;
@@ -51,12 +51,12 @@
         }
 
         // FIXME: We should be able to create these lazily.
-        this._eventsContentView = new WebInspector.ScriptDetailsTimelineView(this.representedObject, extraArguments);
-        this._profileContentView = this._canShowProfileView() ? new WebInspector.ScriptProfileTimelineView(this.representedObject, extraArguments) : null;
+        this._eventsContentView = new WI.ScriptDetailsTimelineView(this.representedObject, extraArguments);
+        this._profileContentView = this._canShowProfileView() ? new WI.ScriptProfileTimelineView(this.representedObject, extraArguments) : null;
 
         this._showContentViewForIdentifier(this._currentContentViewSetting.value);
 
-        this.contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._scriptClusterViewCurrentContentViewDidChange, this);
+        this.contentViewContainer.addEventListener(WI.ContentViewContainer.Event.CurrentContentViewDidChange, this._scriptClusterViewCurrentContentViewDidChange, this);
     }
 
     // TimelineView
@@ -112,17 +112,17 @@
 
     saveToCookie(cookie)
     {
-        cookie[WebInspector.ScriptClusterTimelineView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
+        cookie[WI.ScriptClusterTimelineView.ContentViewIdentifierCookieKey] = this._currentContentViewSetting.value;
     }
 
     restoreFromCookie(cookie)
     {
-        this._showContentViewForIdentifier(cookie[WebInspector.ScriptClusterTimelineView.ContentViewIdentifierCookieKey]);
+        this._showContentViewForIdentifier(cookie[WI.ScriptClusterTimelineView.ContentViewIdentifierCookieKey]);
     }
 
     showEvents()
     {
-        return this._showContentViewForIdentifier(WebInspector.ScriptClusterTimelineView.EventsIdentifier);
+        return this._showContentViewForIdentifier(WI.ScriptClusterTimelineView.EventsIdentifier);
     }
 
     showProfile()
@@ -130,7 +130,7 @@
         if (!this._canShowProfileView())
             return this.showEvents();
 
-        return this._showContentViewForIdentifier(WebInspector.ScriptClusterTimelineView.ProfileIdentifier);
+        return this._showContentViewForIdentifier(WI.ScriptClusterTimelineView.ProfileIdentifier);
     }
 
     // Private
@@ -160,9 +160,9 @@
         if (!contentView)
             return null;
         if (contentView === this._eventsContentView)
-            return WebInspector.ScriptClusterTimelineView.EventsIdentifier;
+            return WI.ScriptClusterTimelineView.EventsIdentifier;
         if (contentView === this._profileContentView)
-            return WebInspector.ScriptClusterTimelineView.ProfileIdentifier;
+            return WI.ScriptClusterTimelineView.ProfileIdentifier;
         console.error("Unknown contentView.");
         return null;
     }
@@ -172,10 +172,10 @@
         let contentViewToShow = null;
 
         switch (identifier) {
-        case WebInspector.ScriptClusterTimelineView.EventsIdentifier:
+        case WI.ScriptClusterTimelineView.EventsIdentifier:
             contentViewToShow = this.eventsContentView;
             break;
-        case WebInspector.ScriptClusterTimelineView.ProfileIdentifier:
+        case WI.ScriptClusterTimelineView.ProfileIdentifier:
             contentViewToShow = this.profileContentView;
             break;
         }
@@ -210,7 +210,7 @@
     }
 };
 
-WebInspector.ScriptClusterTimelineView.ContentViewIdentifierCookieKey = "script-cluster-timeline-view-identifier";
+WI.ScriptClusterTimelineView.ContentViewIdentifierCookieKey = "script-cluster-timeline-view-identifier";
 
-WebInspector.ScriptClusterTimelineView.EventsIdentifier = "events";
-WebInspector.ScriptClusterTimelineView.ProfileIdentifier = "profile";
+WI.ScriptClusterTimelineView.EventsIdentifier = "events";
+WI.ScriptClusterTimelineView.ProfileIdentifier = "profile";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js b/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js
index 82c43ab..633f648 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js
@@ -23,18 +23,18 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptContentView = class ScriptContentView extends WebInspector.ContentView
+WI.ScriptContentView = class ScriptContentView extends WI.ContentView
 {
     constructor(script)
     {
-        console.assert(script instanceof WebInspector.Script, script);
+        console.assert(script instanceof WI.Script, script);
 
         super(script);
 
         this.element.classList.add("script");
 
         // Append a spinner while waiting for _contentWillPopulate.
-        var spinner = new WebInspector.IndeterminateProgressSpinner;
+        var spinner = new WI.IndeterminateProgressSpinner;
         this.element.appendChild(spinner.element);
 
         this._script = script;
@@ -45,32 +45,32 @@
         console.assert(script.range.startLine === 0);
         console.assert(script.range.startColumn === 0);
 
-        this._textEditor = new WebInspector.SourceCodeTextEditor(script);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange, this._executionLineNumberDidChange, this);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
-        this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate, this._contentWillPopulate, this);
-        this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentDidPopulate, this._contentDidPopulate, this);
+        this._textEditor = new WI.SourceCodeTextEditor(script);
+        this._textEditor.addEventListener(WI.TextEditor.Event.ExecutionLineNumberDidChange, this._executionLineNumberDidChange, this);
+        this._textEditor.addEventListener(WI.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
+        this._textEditor.addEventListener(WI.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
+        this._textEditor.addEventListener(WI.SourceCodeTextEditor.Event.ContentWillPopulate, this._contentWillPopulate, this);
+        this._textEditor.addEventListener(WI.SourceCodeTextEditor.Event.ContentDidPopulate, this._contentDidPopulate, this);
 
-        var toolTip = WebInspector.UIString("Pretty print");
-        var activatedToolTip = WebInspector.UIString("Original formatting");
-        this._prettyPrintButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("pretty-print", toolTip, activatedToolTip, "Images/NavigationItemCurleyBraces.svg", 13, 13);
-        this._prettyPrintButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._togglePrettyPrint, this);
+        var toolTip = WI.UIString("Pretty print");
+        var activatedToolTip = WI.UIString("Original formatting");
+        this._prettyPrintButtonNavigationItem = new WI.ActivateButtonNavigationItem("pretty-print", toolTip, activatedToolTip, "Images/NavigationItemCurleyBraces.svg", 13, 13);
+        this._prettyPrintButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePrettyPrint, this);
         this._prettyPrintButtonNavigationItem.enabled = false; // Enabled when the text editor is populated with content.
 
-        var toolTipTypes = WebInspector.UIString("Show type information");
-        var activatedToolTipTypes = WebInspector.UIString("Hide type information");
-        this._showTypesButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-types", toolTipTypes, activatedToolTipTypes, "Images/NavigationItemTypes.svg", 13, 14);
-        this._showTypesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleTypeAnnotations, this);
+        var toolTipTypes = WI.UIString("Show type information");
+        var activatedToolTipTypes = WI.UIString("Hide type information");
+        this._showTypesButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-types", toolTipTypes, activatedToolTipTypes, "Images/NavigationItemTypes.svg", 13, 14);
+        this._showTypesButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleTypeAnnotations, this);
         this._showTypesButtonNavigationItem.enabled = false;
-        WebInspector.showJavaScriptTypeInformationSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
+        WI.showJavaScriptTypeInformationSetting.addEventListener(WI.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
 
-        let toolTipCodeCoverage = WebInspector.UIString("Fade unexecuted code");
-        let activatedToolTipCodeCoverage = WebInspector.UIString("Do not fade unexecuted code");
-        this._codeCoverageButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("code-coverage", toolTipCodeCoverage, activatedToolTipCodeCoverage, "Images/NavigationItemCodeCoverage.svg", 13, 14);
-        this._codeCoverageButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleUnexecutedCodeHighlights, this);
+        let toolTipCodeCoverage = WI.UIString("Fade unexecuted code");
+        let activatedToolTipCodeCoverage = WI.UIString("Do not fade unexecuted code");
+        this._codeCoverageButtonNavigationItem = new WI.ActivateButtonNavigationItem("code-coverage", toolTipCodeCoverage, activatedToolTipCodeCoverage, "Images/NavigationItemCodeCoverage.svg", 13, 14);
+        this._codeCoverageButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleUnexecutedCodeHighlights, this);
         this._codeCoverageButtonNavigationItem.enabled = false;
-        WebInspector.enableControlFlowProfilerSetting.addEventListener(WebInspector.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
+        WI.enableControlFlowProfilerSetting.addEventListener(WI.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
     }
 
     // Public
@@ -97,7 +97,7 @@
 
         // If the SourceCodeTextEditor has an executionLineNumber, we can assume
         // it is always the active call frame.
-        return [WebInspector.debuggerManager.activeCallFrame];
+        return [WI.debuggerManager.activeCallFrame];
     }
 
     revealPosition(position, textRangeToSelect, forceUnformatted)
@@ -123,22 +123,22 @@
     {
         super.closed();
 
-        WebInspector.showJavaScriptTypeInformationSetting.removeEventListener(null, null, this);
-        WebInspector.enableControlFlowProfilerSetting.removeEventListener(null, null, this);
+        WI.showJavaScriptTypeInformationSetting.removeEventListener(null, null, this);
+        WI.enableControlFlowProfilerSetting.removeEventListener(null, null, this);
 
         this._textEditor.close();
     }
 
     saveToCookie(cookie)
     {
-        cookie.type = WebInspector.ContentViewCookieType.Resource;
+        cookie.type = WI.ContentViewCookieType.Resource;
         cookie.url = this.representedObject.url;
     }
 
     restoreFromCookie(cookie)
     {
         if ("lineNumber" in cookie && "columnNumber" in cookie)
-            this.revealPosition(new WebInspector.SourceCodePosition(cookie.lineNumber, cookie.columnNumber));
+            this.revealPosition(new WI.SourceCodePosition(cookie.lineNumber, cookie.columnNumber));
     }
 
     get supportsSave()
@@ -217,10 +217,10 @@
         this._prettyPrintButtonNavigationItem.enabled = this._textEditor.canBeFormatted();
 
         this._showTypesButtonNavigationItem.enabled = this._textEditor.canShowTypeAnnotations();
-        this._showTypesButtonNavigationItem.activated = WebInspector.showJavaScriptTypeInformationSetting.value;
+        this._showTypesButtonNavigationItem.activated = WI.showJavaScriptTypeInformationSetting.value;
 
         this._codeCoverageButtonNavigationItem.enabled = this._textEditor.canShowCoverageHints();
-        this._codeCoverageButtonNavigationItem.activated = WebInspector.enableControlFlowProfilerSetting.value;
+        this._codeCoverageButtonNavigationItem.activated = WI.enableControlFlowProfilerSetting.value;
     }
 
     _togglePrettyPrint(event)
@@ -247,12 +247,12 @@
 
     _showJavaScriptTypeInformationSettingChanged(event)
     {
-        this._showTypesButtonNavigationItem.activated = WebInspector.showJavaScriptTypeInformationSetting.value;
+        this._showTypesButtonNavigationItem.activated = WI.showJavaScriptTypeInformationSetting.value;
     }
 
     _enableControlFlowProfilerSettingChanged(event)
     {
-        this._codeCoverageButtonNavigationItem.activated = WebInspector.enableControlFlowProfilerSetting.value;
+        this._codeCoverageButtonNavigationItem.activated = WI.enableControlFlowProfilerSetting.value;
     }
 
     _textEditorFormattingDidChange(event)
@@ -262,11 +262,11 @@
 
     _executionLineNumberDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange);
     }
 
     _numberOfSearchResultsDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js
index 6cd8733..daafe10 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js
@@ -23,59 +23,59 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptDetailsTimelineView = class ScriptDetailsTimelineView extends WebInspector.TimelineView
+WI.ScriptDetailsTimelineView = class ScriptDetailsTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline, extraArguments);
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.Script);
+        console.assert(timeline.type === WI.TimelineRecord.Type.Script);
 
         let columns = {name: {}, location: {}, callCount: {}, startTime: {}, totalTime: {}, selfTime: {}, averageTime: {}};
 
-        columns.name.title = WebInspector.UIString("Name");
+        columns.name.title = WI.UIString("Name");
         columns.name.width = "10%";
         columns.name.icon = true;
         columns.name.disclosure = true;
         columns.name.locked = true;
 
-        columns.location.title = WebInspector.UIString("Location");
+        columns.location.title = WI.UIString("Location");
         columns.location.icon = true;
         columns.location.width = "15%";
 
         let isSamplingProfiler = !!window.ScriptProfilerAgent;
         if (isSamplingProfiler)
-            columns.callCount.title = WebInspector.UIString("Samples");
+            columns.callCount.title = WI.UIString("Samples");
         else {
             // COMPATIBILITY(iOS 9): ScriptProfilerAgent did not exist yet, we had call counts, not samples.
-            columns.callCount.title = WebInspector.UIString("Calls");
+            columns.callCount.title = WI.UIString("Calls");
         }
         columns.callCount.width = "5%";
         columns.callCount.aligned = "right";
 
-        columns.startTime.title = WebInspector.UIString("Start Time");
+        columns.startTime.title = WI.UIString("Start Time");
         columns.startTime.width = "10%";
         columns.startTime.aligned = "right";
 
-        columns.totalTime.title = WebInspector.UIString("Total Time");
+        columns.totalTime.title = WI.UIString("Total Time");
         columns.totalTime.width = "10%";
         columns.totalTime.aligned = "right";
 
-        columns.selfTime.title = WebInspector.UIString("Self Time");
+        columns.selfTime.title = WI.UIString("Self Time");
         columns.selfTime.width = "10%";
         columns.selfTime.aligned = "right";
 
-        columns.averageTime.title = WebInspector.UIString("Average Time");
+        columns.averageTime.title = WI.UIString("Average Time");
         columns.averageTime.width = "10%";
         columns.averageTime.aligned = "right";
 
         for (var column in columns)
             columns[column].sortable = true;
 
-        this._dataGrid = new WebInspector.ScriptTimelineDataGrid(columns);
+        this._dataGrid = new WI.ScriptTimelineDataGrid(columns);
         this._dataGrid.sortDelegate = this;
         this._dataGrid.sortColumnIdentifier = "startTime";
-        this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+        this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("script-timeline-view");
 
         this.setupDataGrid(this._dataGrid);
@@ -83,8 +83,8 @@
         this.element.classList.add("script");
         this.addSubview(this._dataGrid);
 
-        timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._scriptTimelineRecordAdded, this);
-        timeline.addEventListener(WebInspector.Timeline.Event.Refreshed, this._scriptTimelineRecordRefreshed, this);
+        timeline.addEventListener(WI.Timeline.Event.RecordAdded, this._scriptTimelineRecordAdded, this);
+        timeline.addEventListener(WI.Timeline.Event.Refreshed, this._scriptTimelineRecordRefreshed, this);
 
         this._pendingRecords = [];
     }
@@ -109,7 +109,7 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
 
         this._dataGrid.closed();
@@ -124,12 +124,12 @@
         var pathComponents = [];
 
         while (dataGridNode && !dataGridNode.root) {
-            console.assert(dataGridNode instanceof WebInspector.TimelineDataGridNode);
+            console.assert(dataGridNode instanceof WI.TimelineDataGridNode);
             if (dataGridNode.hidden)
                 return null;
 
-            let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);
-            pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+            let pathComponent = new WI.TimelineDataGridNodePathComponent(dataGridNode);
+            pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
             pathComponents.unshift(pathComponent);
             dataGridNode = dataGridNode.parent;
         }
@@ -193,7 +193,7 @@
 
     _processPendingRecords()
     {
-        if (WebInspector.timelineManager.scriptProfilerIsTracking())
+        if (WI.timelineManager.scriptProfilerIsTracking())
             return;
 
         if (!this._pendingRecords.length)
@@ -210,11 +210,11 @@
                 rootNodes = scriptTimelineRecord.profile.topDownRootNodes;
             }
 
-            let dataGridNode = new WebInspector.ScriptTimelineDataGridNode(scriptTimelineRecord, zeroTime);
+            let dataGridNode = new WI.ScriptTimelineDataGridNode(scriptTimelineRecord, zeroTime);
             this._dataGrid.addRowInSortOrder(null, dataGridNode);
 
             for (let profileNode of rootNodes) {
-                let profileNodeDataGridNode = new WebInspector.ProfileNodeDataGridNode(profileNode, zeroTime, startTime, endTime);
+                let profileNodeDataGridNode = new WI.ProfileNodeDataGridNode(profileNode, zeroTime, startTime, endTime);
                 this._dataGrid.addRowInSortOrder(null, profileNodeDataGridNode, dataGridNode);
             }
         }
@@ -225,7 +225,7 @@
     _scriptTimelineRecordAdded(event)
     {
         var scriptTimelineRecord = event.data.record;
-        console.assert(scriptTimelineRecord instanceof WebInspector.ScriptTimelineRecord);
+        console.assert(scriptTimelineRecord instanceof WI.ScriptTimelineRecord);
 
         this._pendingRecords.push(scriptTimelineRecord);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js
index 2c7bba2..ecb6c80 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptProfileTimelineView = class ScriptProfileTimelineView extends WebInspector.TimelineView
+WI.ScriptProfileTimelineView = class ScriptProfileTimelineView extends WI.TimelineView
 {
     constructor(timeline, extraArguments)
     {
         super(timeline, extraArguments);
 
-        console.assert(timeline.type === WebInspector.TimelineRecord.Type.Script);
+        console.assert(timeline.type === WI.TimelineRecord.Type.Script);
 
         this.element.classList.add("script");
 
@@ -43,33 +43,33 @@
             selectedNodeHash: null,
         };
 
-        if (!WebInspector.ScriptProfileTimelineView.profileOrientationSetting)
-            WebInspector.ScriptProfileTimelineView.profileOrientationSetting = new WebInspector.Setting("script-profile-timeline-view-profile-orientation-setting", WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown);
-        if (!WebInspector.ScriptProfileTimelineView.profileTypeSetting)
-            WebInspector.ScriptProfileTimelineView.profileTypeSetting = new WebInspector.Setting("script-profile-timeline-view-profile-type-setting", WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy);
+        if (!WI.ScriptProfileTimelineView.profileOrientationSetting)
+            WI.ScriptProfileTimelineView.profileOrientationSetting = new WI.Setting("script-profile-timeline-view-profile-orientation-setting", WI.ScriptProfileTimelineView.ProfileOrientation.TopDown);
+        if (!WI.ScriptProfileTimelineView.profileTypeSetting)
+            WI.ScriptProfileTimelineView.profileTypeSetting = new WI.Setting("script-profile-timeline-view-profile-type-setting", WI.ScriptProfileTimelineView.ProfileViewType.Hierarchy);
 
-        this._showProfileViewForOrientation(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value, WebInspector.ScriptProfileTimelineView.profileTypeSetting.value);
+        this._showProfileViewForOrientation(WI.ScriptProfileTimelineView.profileOrientationSetting.value, WI.ScriptProfileTimelineView.profileTypeSetting.value);
 
-        let clearTooltip = WebInspector.UIString("Clear focus");
-        this._clearFocusNodesButtonItem = new WebInspector.ButtonNavigationItem("clear-profile-focus", clearTooltip, "Images/Close.svg", 16, 16);
-        this._clearFocusNodesButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearFocusNodes, this);
+        let clearTooltip = WI.UIString("Clear focus");
+        this._clearFocusNodesButtonItem = new WI.ButtonNavigationItem("clear-profile-focus", clearTooltip, "Images/Close.svg", 16, 16);
+        this._clearFocusNodesButtonItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._clearFocusNodes, this);
         this._updateClearFocusNodesButtonItem();
 
-        this._profileOrientationButton = new WebInspector.TextToggleButtonNavigationItem("profile-orientation", WebInspector.UIString("Inverted"));
-        this._profileOrientationButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._profileOrientationButtonClicked, this);
-        if (WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value === WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown)
+        this._profileOrientationButton = new WI.TextToggleButtonNavigationItem("profile-orientation", WI.UIString("Inverted"));
+        this._profileOrientationButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._profileOrientationButtonClicked, this);
+        if (WI.ScriptProfileTimelineView.profileOrientationSetting.value === WI.ScriptProfileTimelineView.ProfileOrientation.TopDown)
             this._profileOrientationButton.activated = false;
         else
             this._profileOrientationButton.activated = true;
 
-        this._topFunctionsButton = new WebInspector.TextToggleButtonNavigationItem("top-functions", WebInspector.UIString("Top Functions"));
-        this._topFunctionsButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._topFunctionsButtonClicked, this);
-        if (WebInspector.ScriptProfileTimelineView.profileTypeSetting.value === WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy)
+        this._topFunctionsButton = new WI.TextToggleButtonNavigationItem("top-functions", WI.UIString("Top Functions"));
+        this._topFunctionsButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._topFunctionsButtonClicked, this);
+        if (WI.ScriptProfileTimelineView.profileTypeSetting.value === WI.ScriptProfileTimelineView.ProfileViewType.Hierarchy)
             this._topFunctionsButton.activated = false;
         else
             this._topFunctionsButton.activated = true;
 
-        timeline.addEventListener(WebInspector.Timeline.Event.Refreshed, this._scriptTimelineRecordRefreshed, this);
+        timeline.addEventListener(WI.Timeline.Event.Refreshed, this._scriptTimelineRecordRefreshed, this);
     }
 
     // Public
@@ -82,7 +82,7 @@
 
     closed()
     {
-        console.assert(this.representedObject instanceof WebInspector.Timeline);
+        console.assert(this.representedObject instanceof WI.Timeline);
         this.representedObject.removeEventListener(null, null, this);
     }
 
@@ -113,10 +113,10 @@
     _callingContextTreeForOrientation(profileOrientation, profileViewType)
     {
         switch (profileOrientation) {
-        case WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown:
-            return profileViewType === WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy ? this._recording.topDownCallingContextTree : this._recording.topFunctionsTopDownCallingContextTree;
-        case WebInspector.ScriptProfileTimelineView.ProfileOrientation.BottomUp:
-            return profileViewType === WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy ? this._recording.bottomUpCallingContextTree : this._recording.topFunctionsBottomUpCallingContextTree;
+        case WI.ScriptProfileTimelineView.ProfileOrientation.TopDown:
+            return profileViewType === WI.ScriptProfileTimelineView.ProfileViewType.Hierarchy ? this._recording.topDownCallingContextTree : this._recording.topFunctionsTopDownCallingContextTree;
+        case WI.ScriptProfileTimelineView.ProfileOrientation.BottomUp:
+            return profileViewType === WI.ScriptProfileTimelineView.ProfileViewType.Hierarchy ? this._recording.bottomUpCallingContextTree : this._recording.topFunctionsBottomUpCallingContextTree;
         }
 
         console.assert(false, "Should not be reached.");
@@ -126,7 +126,7 @@
     _profileViewSelectionPathComponentsDidChange(event)
     {
         this._updateClearFocusNodesButtonItem();
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _scriptTimelineRecordRefreshed(event)
@@ -141,14 +141,14 @@
         let isInverted = this._profileOrientationButton.activated;
         let newOrientation;
         if (isInverted)
-            newOrientation = WebInspector.ScriptProfileTimelineView.ProfileOrientation.BottomUp;
+            newOrientation = WI.ScriptProfileTimelineView.ProfileOrientation.BottomUp;
         else
-            newOrientation = WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown;
+            newOrientation = WI.ScriptProfileTimelineView.ProfileOrientation.TopDown;
 
-        WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value = newOrientation;
-        this._showProfileViewForOrientation(newOrientation, WebInspector.ScriptProfileTimelineView.profileTypeSetting.value);
+        WI.ScriptProfileTimelineView.profileOrientationSetting.value = newOrientation;
+        this._showProfileViewForOrientation(newOrientation, WI.ScriptProfileTimelineView.profileTypeSetting.value);
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
 
         this._forceNextLayout = true;
         this.needsLayout();
@@ -160,14 +160,14 @@
         let isTopFunctionsEnabled = this._topFunctionsButton.activated;
         let newOrientation;
         if (isTopFunctionsEnabled)
-            newOrientation = WebInspector.ScriptProfileTimelineView.ProfileViewType.TopFunctions;
+            newOrientation = WI.ScriptProfileTimelineView.ProfileViewType.TopFunctions;
         else
-            newOrientation = WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy;
+            newOrientation = WI.ScriptProfileTimelineView.ProfileViewType.Hierarchy;
 
-        WebInspector.ScriptProfileTimelineView.profileTypeSetting.value = newOrientation;
-        this._showProfileViewForOrientation(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value, newOrientation);
+        WI.ScriptProfileTimelineView.profileTypeSetting.value = newOrientation;
+        this._showProfileViewForOrientation(WI.ScriptProfileTimelineView.profileOrientationSetting.value, newOrientation);
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
 
         this._forceNextLayout = true;
         this.needsLayout();
@@ -177,14 +177,14 @@
     {
         let filterText;
         if (this._profileView) {
-            this._profileView.removeEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
+            this._profileView.removeEventListener(WI.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
             this.removeSubview(this._profileView);
             filterText = this._profileView.dataGrid.filterText;
         }
 
         let callingContextTree = this._callingContextTreeForOrientation(profileOrientation, profileViewType);
-        this._profileView = new WebInspector.ProfileView(callingContextTree, this._sharedProfileViewData);
-        this._profileView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
+        this._profileView = new WI.ProfileView(callingContextTree, this._sharedProfileViewData);
+        this._profileView.addEventListener(WI.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
 
         this.addSubview(this._profileView);
         this.setupDataGrid(this._profileView.dataGrid);
@@ -204,12 +204,12 @@
     }
 };
 
-WebInspector.ScriptProfileTimelineView.ProfileOrientation = {
+WI.ScriptProfileTimelineView.ProfileOrientation = {
     BottomUp: "bottom-up",
     TopDown: "top-down",
 };
 
-WebInspector.ScriptProfileTimelineView.ProfileViewType = {
+WI.ScriptProfileTimelineView.ProfileViewType = {
     Hierarchy: "hierarchy",
     TopFunctions: "top-functions",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGrid.js b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGrid.js
index eecff7c..3597ad4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGrid.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptTimelineDataGrid = class ScriptTimelineDataGrid extends WebInspector.TimelineDataGrid
+WI.ScriptTimelineDataGrid = class ScriptTimelineDataGrid extends WI.TimelineDataGrid
 {
     // Protected
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js
index 679a9a0..05d9ad1 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptTimelineDataGridNode = class ScriptTimelineDataGridNode extends WebInspector.TimelineDataGridNode
+WI.ScriptTimelineDataGridNode = class ScriptTimelineDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(scriptTimelineRecord, baseStartTime, rangeStartTime, rangeEndTime)
     {
@@ -94,12 +94,12 @@
 
         this._subtitle = "";
 
-        if (this._record.eventType === WebInspector.ScriptTimelineRecord.EventType.TimerInstalled) {
+        if (this._record.eventType === WI.ScriptTimelineRecord.EventType.TimerInstalled) {
             let timeoutString = Number.secondsToString(this._record.details.timeout / 1000);
             if (this._record.details.repeating)
-                this._subtitle = WebInspector.UIString("%s interval").format(timeoutString);
+                this._subtitle = WI.UIString("%s interval").format(timeoutString);
             else
-                this._subtitle = WebInspector.UIString("%s delay").format(timeoutString);
+                this._subtitle = WI.UIString("%s delay").format(timeoutString);
         }
 
         return this._subtitle;
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js
index c106735..7d3b578 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptTimelineOverviewGraph = class ScriptTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
+WI.ScriptTimelineOverviewGraph = class ScriptTimelineOverviewGraph extends WI.TimelineOverviewGraph
 {
     constructor(timeline, timelineOverview)
     {
@@ -32,7 +32,7 @@
         this.element.classList.add("script");
 
         this._scriptTimeline = timeline;
-        this._scriptTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._scriptTimelineRecordAdded, this);
+        this._scriptTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._scriptTimelineRecordAdded, this);
 
         this._timelineRecordBars = [];
 
@@ -62,7 +62,7 @@
         {
             let timelineRecordBar = this._timelineRecordBars[recordBarIndex];
             if (!timelineRecordBar)
-                timelineRecordBar = this._timelineRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
+                timelineRecordBar = this._timelineRecordBars[recordBarIndex] = new WI.TimelineRecordBar(records, renderMode);
             else {
                 timelineRecordBar.renderMode = renderMode;
                 timelineRecordBar.records = records;
@@ -76,8 +76,8 @@
         // Create bars for non-GC records and GC records.
         let [gcRecords, nonGCRecords] = this._scriptTimeline.records.partition((x) => x.isGarbageCollection());
         let boundCreateBar = createBar.bind(this);
-        WebInspector.TimelineRecordBar.createCombinedBars(nonGCRecords, secondsPerPixel, this, boundCreateBar);
-        WebInspector.TimelineRecordBar.createCombinedBars(gcRecords, secondsPerPixel, this, boundCreateBar);
+        WI.TimelineRecordBar.createCombinedBars(nonGCRecords, secondsPerPixel, this, boundCreateBar);
+        WI.TimelineRecordBar.createCombinedBars(gcRecords, secondsPerPixel, this, boundCreateBar);
 
         // Remove the remaining unused TimelineRecordBars.
         for (; recordBarIndex < this._timelineRecordBars.length; ++recordBarIndex) {
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js
index ac467cc..19bd9ab 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptTreeElement = class ScriptTreeElement extends WebInspector.SourceCodeTreeElement
+WI.ScriptTreeElement = class ScriptTreeElement extends WI.SourceCodeTreeElement
 {
     constructor(script)
     {
-        console.assert(script instanceof WebInspector.Script);
+        console.assert(script instanceof WI.Script);
 
         const title = null;
         const subtitle = null;
@@ -37,18 +37,18 @@
 
         if (script.url && !script.dynamicallyAddedScriptElement) {
             // Show the host as the subtitle if it is different from the main title.
-            let host = WebInspector.displayNameForHost(script.urlComponents.host);
+            let host = WI.displayNameForHost(script.urlComponents.host);
             this.subtitle = this.mainTitle !== host ? host : null;
 
             this.tooltip = script.url;
 
-            this.addClassName(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
-            this.addClassName(WebInspector.Resource.Type.Script);
+            this.addClassName(WI.ResourceTreeElement.ResourceIconStyleClassName);
+            this.addClassName(WI.Resource.Type.Script);
         } else
-            this.addClassName(WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName);
+            this.addClassName(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
 
         if (script.isMainResource()) {
-            console.assert(script.target.type === WebInspector.Target.Type.Worker);
+            console.assert(script.target.type === WI.Target.Type.Worker);
             this.addClassName("worker-icon");
         }
 
@@ -63,4 +63,4 @@
     }
 };
 
-WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName = "anonymous-script-icon";
+WI.ScriptTreeElement.AnonymousScriptIconStyleClassName = "anonymous-script-icon";
diff --git a/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js
index efd643a..a6a1d99 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScrubberNavigationItem = class ScrubberNavigationItem extends WebInspector.FlexibleSpaceNavigationItem
+WI.ScrubberNavigationItem = class ScrubberNavigationItem extends WI.FlexibleSpaceNavigationItem
 {
     constructor(identifier)
     {
@@ -66,10 +66,10 @@
 
     _sliderChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.ScrubberNavigationItem.Event.ValueChanged);
+        this.dispatchEventToListeners(WI.ScrubberNavigationItem.Event.ValueChanged);
     }
 };
 
-WebInspector.ScrubberNavigationItem.Event = {
+WI.ScrubberNavigationItem.Event = {
     ValueChanged: "slider-navigation-item-value-changed",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/SearchBar.js b/Source/WebInspectorUI/UserInterface/Views/SearchBar.js
index 71c1aa9..4ae7120 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SearchBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SearchBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SearchBar = class SearchBar extends WebInspector.NavigationItem
+WI.SearchBar = class SearchBar extends WI.NavigationItem
 {
     constructor(identifier, placeholder, delegate, suppressIncremental)
     {
@@ -33,8 +33,8 @@
 
         this._element.classList.add("search-bar");
 
-        this._keyboardShortcutEsc = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape);
-        this._keyboardShortcutEnter = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Enter);
+        this._keyboardShortcutEsc = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape);
+        this._keyboardShortcutEnter = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Enter);
 
         this._searchInput = this._element.appendChild(document.createElement("input"));
         this._searchInput.type = "search";
@@ -72,7 +72,7 @@
 
     _handleSearchEvent(event)
     {
-        this.dispatchEventToListeners(WebInspector.SearchBar.Event.TextChanged);
+        this.dispatchEventToListeners(WI.SearchBar.Event.TextChanged);
     }
 
     _handleKeydownEvent(event)
@@ -93,6 +93,6 @@
     }
 };
 
-WebInspector.SearchBar.Event = {
+WI.SearchBar.Event = {
     TextChanged: "searchbar-text-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js
index d42134d..841b26f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SearchResultTreeElement = class SearchResultTreeElement extends WebInspector.GeneralTreeElement
+WI.SearchResultTreeElement = class SearchResultTreeElement extends WI.GeneralTreeElement
 {
     constructor(representedObject)
     {
-        console.assert(representedObject instanceof WebInspector.DOMSearchMatchObject || representedObject instanceof WebInspector.SourceCodeSearchMatchObject);
+        console.assert(representedObject instanceof WI.DOMSearchMatchObject || representedObject instanceof WI.SourceCodeSearchMatchObject);
 
-        var title = WebInspector.SearchResultTreeElement.truncateAndHighlightTitle(representedObject.title, representedObject.searchTerm, representedObject.sourceCodeTextRange);
+        var title = WI.SearchResultTreeElement.truncateAndHighlightTitle(representedObject.title, representedObject.searchTerm, representedObject.sourceCodeTextRange);
         const subtitle = null;
         super(representedObject.className, title, subtitle, representedObject);
     }
@@ -38,7 +38,7 @@
 
     static truncateAndHighlightTitle(title, searchTerm, sourceCodeTextRange)
     {
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
         const charactersToShowBeforeSearchMatch = isRTL ? 20 : 15;
         const charactersToShowAfterSearchMatch = isRTL ? 15 : 50;
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js
index 5b1544d..e059b84 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SearchSidebarPanel = class SearchSidebarPanel extends WebInspector.NavigationSidebarPanel
+WI.SearchSidebarPanel = class SearchSidebarPanel extends WI.NavigationSidebarPanel
 {
     constructor(contentBrowser)
     {
-        super("search", WebInspector.UIString("Search"), true, true);
+        super("search", WI.UIString("Search"), true, true);
 
         this.contentBrowser = contentBrowser;
 
@@ -42,17 +42,17 @@
         this._inputElement.addEventListener("input", this._searchFieldInput.bind(this));
         this._inputElement.setAttribute("results", 5);
         this._inputElement.setAttribute("autosave", "inspector-search-autosave");
-        this._inputElement.setAttribute("placeholder", WebInspector.UIString("Search Resource Content"));
+        this._inputElement.setAttribute("placeholder", WI.UIString("Search Resource Content"));
         searchElement.appendChild(this._inputElement);
 
-        this.filterBar.placeholder = WebInspector.UIString("Filter Search Results");
+        this.filterBar.placeholder = WI.UIString("Filter Search Results");
 
-        this._searchQuerySetting = new WebInspector.Setting("search-sidebar-query", "");
+        this._searchQuerySetting = new WI.Setting("search-sidebar-query", "");
         this._inputElement.value = this._searchQuerySetting.value;
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
-        this.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this.contentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
     }
 
     // Public
@@ -61,7 +61,7 @@
     {
         super.closed();
 
-        WebInspector.Frame.removeEventListener(null, null, this);
+        WI.Frame.removeEventListener(null, null, this);
     }
 
     focusSearchField(performSearch)
@@ -101,8 +101,8 @@
 
         function createTreeElementForMatchObject(matchObject, parentTreeElement)
         {
-            let matchTreeElement = new WebInspector.SearchResultTreeElement(matchObject);
-            matchTreeElement.addEventListener(WebInspector.TreeElement.Event.DoubleClick, this._treeElementDoubleClick, this);
+            let matchTreeElement = new WI.SearchResultTreeElement(matchObject);
+            matchTreeElement.addEventListener(WI.TreeElement.Event.DoubleClick, this._treeElementDoubleClick, this);
 
             parentTreeElement.appendChild(matchTreeElement);
 
@@ -124,7 +124,7 @@
                 updateEmptyContentPlaceholderTimeout = null;
             }
 
-            this.updateEmptyContentPlaceholder(WebInspector.UIString("No Search Results"));
+            this.updateEmptyContentPlaceholder(WI.UIString("No Search Results"));
         }
 
         function forEachMatch(searchQuery, lineContent, callback)
@@ -149,7 +149,7 @@
                 if (error || !resourceMatches || !resourceMatches.length)
                     return;
 
-                var frame = WebInspector.frameResourceManager.frameForIdentifier(frameId);
+                var frame = WI.frameResourceManager.frameForIdentifier(frameId);
                 if (!frame)
                     return;
 
@@ -162,7 +162,7 @@
                 for (var i = 0; i < resourceMatches.length; ++i) {
                     var match = resourceMatches[i];
                     forEachMatch(searchQuery, match.lineContent, (lineMatch, lastIndex) => {
-                        var matchObject = new WebInspector.SourceCodeSearchMatchObject(resource, match.lineContent, searchQuery, new WebInspector.TextRange(match.lineNumber, lineMatch.index, match.lineNumber, lastIndex));
+                        var matchObject = new WI.SourceCodeSearchMatchObject(resource, match.lineContent, searchQuery, new WI.TextRange(match.lineNumber, lineMatch.index, match.lineNumber, lastIndex));
                         createTreeElementForMatchObject.call(this, matchObject, resourceTreeElement);
                     });
                 }
@@ -180,8 +180,8 @@
             }
 
             let promises = [
-                WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
-                WebInspector.Target.awaitEvent(WebInspector.Target.Event.ResourceAdded)
+                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                WI.Target.awaitEvent(WI.Target.Event.ResourceAdded)
             ];
             Promise.race(promises).then(this._contentChanged.bind(this));
         }
@@ -205,7 +205,7 @@
                 for (var i = 0; i < scriptMatches.length; ++i) {
                     var match = scriptMatches[i];
                     forEachMatch(searchQuery, match.lineContent, (lineMatch, lastIndex) => {
-                        var matchObject = new WebInspector.SourceCodeSearchMatchObject(script, match.lineContent, searchQuery, new WebInspector.TextRange(match.lineNumber, lineMatch.index, match.lineNumber, lastIndex));
+                        var matchObject = new WI.SourceCodeSearchMatchObject(script, match.lineContent, searchQuery, new WI.TextRange(match.lineNumber, lineMatch.index, match.lineNumber, lastIndex));
                         createTreeElementForMatchObject.call(this, matchObject, scriptTreeElement);
                     });
                 }
@@ -240,7 +240,7 @@
                     if (this._domSearchIdentifier !== searchId)
                         return;
 
-                    var domNode = WebInspector.domTreeManager.nodeForId(nodeIds[i]);
+                    var domNode = WI.domTreeManager.nodeForId(nodeIds[i]);
                     if (!domNode || !domNode.ownerDocument)
                         continue;
 
@@ -249,24 +249,24 @@
                         continue;
 
                     // FIXME: This should use a frame to do resourceForURL, but DOMAgent does not provide a frameId.
-                    var resource = WebInspector.frameResourceManager.resourceForURL(domNode.ownerDocument.documentURL);
+                    var resource = WI.frameResourceManager.resourceForURL(domNode.ownerDocument.documentURL);
                     if (!resource)
                         continue;
 
                     var resourceTreeElement = this._searchTreeElementForResource(resource);
-                    var domNodeTitle = WebInspector.DOMSearchMatchObject.titleForDOMNode(domNode);
+                    var domNodeTitle = WI.DOMSearchMatchObject.titleForDOMNode(domNode);
 
                     // Textual matches.
                     var didFindTextualMatch = false;
                     forEachMatch(searchQuery, domNodeTitle, (lineMatch, lastIndex) => {
-                        var matchObject = new WebInspector.DOMSearchMatchObject(resource, domNode, domNodeTitle, searchQuery, new WebInspector.TextRange(0, lineMatch.index, 0, lastIndex));
+                        var matchObject = new WI.DOMSearchMatchObject(resource, domNode, domNodeTitle, searchQuery, new WI.TextRange(0, lineMatch.index, 0, lastIndex));
                         createTreeElementForMatchObject.call(this, matchObject, resourceTreeElement);
                         didFindTextualMatch = true;
                     });
 
                     // Non-textual matches are CSS Selector or XPath matches. In such cases, display the node entirely highlighted.
                     if (!didFindTextualMatch) {
-                        var matchObject = new WebInspector.DOMSearchMatchObject(resource, domNode, domNodeTitle, domNodeTitle, new WebInspector.TextRange(0, 0, 0, domNodeTitle.length));
+                        var matchObject = new WI.DOMSearchMatchObject(resource, domNode, domNodeTitle, domNodeTitle, new WI.TextRange(0, 0, 0, domNodeTitle.length));
                         createTreeElementForMatchObject.call(this, matchObject, resourceTreeElement);
                     }
 
@@ -278,12 +278,12 @@
         }
 
         if (window.DOMAgent)
-            WebInspector.domTreeManager.ensureDocument();
+            WI.domTreeManager.ensureDocument();
 
         if (window.PageAgent)
             PageAgent.searchInResources(searchQuery, isCaseSensitive, isRegex, resourcesCallback.bind(this));
 
-        setTimeout(searchScripts.bind(this, WebInspector.debuggerManager.searchableScripts), 0);
+        setTimeout(searchScripts.bind(this, WI.debuggerManager.searchableScripts), 0);
 
         if (window.DOMAgent) {
             if (this._domSearchIdentifier) {
@@ -318,7 +318,7 @@
     {
         var resourceTreeElement = this.contentTreeOutline.getCachedTreeElement(resource);
         if (!resourceTreeElement) {
-            resourceTreeElement = new WebInspector.ResourceTreeElement(resource);
+            resourceTreeElement = new WI.ResourceTreeElement(resource);
             resourceTreeElement.hasChildren = true;
             resourceTreeElement.expand();
 
@@ -332,7 +332,7 @@
     {
         var scriptTreeElement = this.contentTreeOutline.getCachedTreeElement(script);
         if (!scriptTreeElement) {
-            scriptTreeElement = new WebInspector.ScriptTreeElement(script);
+            scriptTreeElement = new WI.ScriptTreeElement(script);
             scriptTreeElement.hasChildren = true;
             scriptTreeElement.expand();
 
@@ -367,27 +367,27 @@
             return;
 
         let treeElement = event.data.selectedElement;
-        if (!treeElement || treeElement instanceof WebInspector.FolderTreeElement)
+        if (!treeElement || treeElement instanceof WI.FolderTreeElement)
             return;
 
         const options = {
             ignoreNetworkTab: true,
         };
 
-        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
+        if (treeElement instanceof WI.ResourceTreeElement || treeElement instanceof WI.ScriptTreeElement) {
             const cookie = null;
-            WebInspector.showRepresentedObject(treeElement.representedObject, cookie, options);
+            WI.showRepresentedObject(treeElement.representedObject, cookie, options);
             return;
         }
 
-        console.assert(treeElement instanceof WebInspector.SearchResultTreeElement);
-        if (!(treeElement instanceof WebInspector.SearchResultTreeElement))
+        console.assert(treeElement instanceof WI.SearchResultTreeElement);
+        if (!(treeElement instanceof WI.SearchResultTreeElement))
             return;
 
-        if (treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject)
-            WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode);
-        else if (treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
-            WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, options);
+        if (treeElement.representedObject instanceof WI.DOMSearchMatchObject)
+            WI.showMainFrameDOMTree(treeElement.representedObject.domNode);
+        else if (treeElement.representedObject instanceof WI.SourceCodeSearchMatchObject)
+            WI.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, options);
     }
 
     _treeElementDoubleClick(event)
@@ -396,12 +396,12 @@
         if (!treeElement)
             return;
 
-        if (treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject) {
-            WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode, {
+        if (treeElement.representedObject instanceof WI.DOMSearchMatchObject) {
+            WI.showMainFrameDOMTree(treeElement.representedObject.domNode, {
                 ignoreSearchTab: true,
             });
-        } else if (treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject) {
-            WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, {
+        } else if (treeElement.representedObject instanceof WI.SourceCodeSearchMatchObject) {
+            WI.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, {
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             });
@@ -415,10 +415,10 @@
         if (!this._changedBanner) {
             this._changedBanner = document.createElement("div");
             this._changedBanner.classList.add("banner");
-            this._changedBanner.append(WebInspector.UIString("The page's content has changed"), document.createElement("br"));
+            this._changedBanner.append(WI.UIString("The page's content has changed"), document.createElement("br"));
 
             let performSearchLink = this._changedBanner.appendChild(document.createElement("a"));
-            performSearchLink.textContent = WebInspector.UIString("Search Again");
+            performSearchLink.textContent = WI.UIString("Search Again");
             performSearchLink.addEventListener("click", () => {
                 const performSearch = true;
                 this.focusSearchField(performSearch);
diff --git a/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js
index 3e99cf6..17fffa3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js
@@ -23,19 +23,19 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SearchTabContentView = class SearchTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.SearchTabContentView = class SearchTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.SearchTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.ResourceDetailsSidebarPanel, WebInspector.ProbeDetailsSidebarPanel,
-            WebInspector.DOMNodeDetailsSidebarPanel, WebInspector.CSSStyleDetailsSidebarPanel];
+        let {image, title} = WI.SearchTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel,
+            WI.DOMNodeDetailsSidebarPanel, WI.CSSStyleDetailsSidebarPanel];
 
         if (window.LayerTreeAgent)
-            detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);
+            detailsSidebarPanelConstructors.push(WI.LayerTreeDetailsSidebarPanel);
 
-        super(identifier || "search", "search", tabBarItem, WebInspector.SearchSidebarPanel, detailsSidebarPanelConstructors);
+        super(identifier || "search", "search", tabBarItem, WI.SearchSidebarPanel, detailsSidebarPanelConstructors);
 
         this._forcePerformSearch = false;
     }
@@ -44,7 +44,7 @@
     {
         return {
             image: "Images/SearchResults.svg",
-            title: WebInspector.UIString("Search"),
+            title: WI.UIString("Search"),
         };
     }
 
@@ -57,7 +57,7 @@
 
     get type()
     {
-        return WebInspector.SearchTabContentView.Type;
+        return WI.SearchTabContentView.Type;
     }
 
     shown()
@@ -70,7 +70,7 @@
 
     canShowRepresentedObject(representedObject)
     {
-        if (!(representedObject instanceof WebInspector.Resource) && !(representedObject instanceof WebInspector.Script) && !(representedObject instanceof WebInspector.DOMTree))
+        if (!(representedObject instanceof WI.Resource) && !(representedObject instanceof WI.Script) && !(representedObject instanceof WI.DOMTree))
             return false;
 
         return !!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
@@ -111,4 +111,4 @@
     }
 };
 
-WebInspector.SearchTabContentView.Type = "search";
+WI.SearchTabContentView.Type = "search";
diff --git a/Source/WebInspectorUI/UserInterface/Views/SettingEditor.js b/Source/WebInspectorUI/UserInterface/Views/SettingEditor.js
index 844cfa7..e85698e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SettingEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SettingEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SettingEditor = class SettingEditor extends WebInspector.Object
+WI.SettingEditor = class SettingEditor extends WI.Object
 {
     constructor(type, label, options)
     {
@@ -41,7 +41,7 @@
         this._element.append(this._editorElement);
 
         if (this._label) {
-            this._editorElement.id = "setting-editor-" + WebInspector.SettingEditor._nextEditorIdentifier++;
+            this._editorElement.id = "setting-editor-" + WI.SettingEditor._nextEditorIdentifier++;
             let labelElement = document.createElement("label");
             labelElement.setAttribute("for", this._editorElement.id);
             labelElement.textContent = label;
@@ -54,17 +54,17 @@
     {
         let type;
         if (typeof setting.value === "boolean")
-            type = WebInspector.SettingEditor.Type.Checkbox;
+            type = WI.SettingEditor.Type.Checkbox;
         else if (typeof setting.value === "number")
-            type = WebInspector.SettingEditor.Type.Numeric;
+            type = WI.SettingEditor.Type.Numeric;
 
         console.assert(type, "Cannot deduce editor type from setting value type.", setting);
         if (!type)
             return null;
 
-        let editor = new WebInspector.SettingEditor(type, label, options);
+        let editor = new WI.SettingEditor(type, label, options);
         editor.value = setting.value;
-        editor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange, () => { setting.value = editor.value; });
+        editor.addEventListener(WI.SettingEditor.Event.ValueDidChange, () => { setting.value = editor.value; });
 
         return editor;
     }
@@ -88,12 +88,12 @@
         let oldValue = this._value;
         this._value = value;
 
-        if (this._type == WebInspector.SettingEditor.Type.Checkbox)
+        if (this._type == WI.SettingEditor.Type.Checkbox)
             this._editorElement.checked = !!this._value;
         else
             this._editorElement.value = this._value;
 
-        this.dispatchEventToListeners(WebInspector.SettingEditor.Event.ValueDidChange, {oldValue});
+        this.dispatchEventToListeners(WI.SettingEditor.Event.ValueDidChange, {oldValue});
     }
 
     // Private
@@ -103,13 +103,13 @@
         let editorElement;
 
         switch (this._type) {
-        case WebInspector.SettingEditor.Type.Checkbox:
+        case WI.SettingEditor.Type.Checkbox:
             editorElement = document.createElement("input");
             editorElement.type = "checkbox";
             editorElement.addEventListener("change", (event) => { this.value = event.target.checked; });
             break;
 
-        case WebInspector.SettingEditor.Type.Numeric:
+        case WI.SettingEditor.Type.Numeric:
             editorElement = document.createElement("input");
             editorElement.type = "number";
 
@@ -125,7 +125,7 @@
             });
             break;
 
-        case WebInspector.SettingEditor.Type.Select:
+        case WI.SettingEditor.Type.Select:
             editorElement = document.createElement("select");
             var keyValuePairs = [];
 
@@ -153,14 +153,14 @@
     }
 };
 
-WebInspector.SettingEditor._nextEditorIdentifier = 1;
+WI.SettingEditor._nextEditorIdentifier = 1;
 
-WebInspector.SettingEditor.Type = {
+WI.SettingEditor.Type = {
     Checkbox: "setting-editor-type-checkbox",
     Numeric: "setting-editor-type-numeric",
     Select: "setting-editor-type-select",
 };
 
-WebInspector.SettingEditor.Event = {
+WI.SettingEditor.Event = {
     ValueDidChange: "value-did-change",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js b/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js
index 926a91d..e851dbb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SettingsGroup = class SettingsGroup extends WebInspector.Object
+WI.SettingsGroup = class SettingsGroup extends WI.Object
 {
     constructor(title)
     {
@@ -46,7 +46,7 @@
 
     addSetting(setting, label, options)
     {
-        let editor = WebInspector.SettingEditor.createForSetting(setting, label, options);
+        let editor = WI.SettingEditor.createForSetting(setting, label, options);
         console.assert(editor, "Could not create default editor for setting. Use addCustomSetting instead.", setting);
         if (!editor)
             return null;
@@ -57,7 +57,7 @@
 
     addCustomSetting(editorType, options)
     {
-        let editor = new WebInspector.SettingEditor(editorType, options.label, options);
+        let editor = new WI.SettingEditor(editorType, options.label, options);
         if (!editor)
             return null;
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
index 68a34a5..8b7562e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
@@ -24,11 +24,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SettingsTabContentView = class SettingsTabContentView extends WebInspector.TabContentView
+WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentView
 {
     constructor(identifier)
     {
-        let tabBarItem = new WebInspector.PinnedTabBarItem("Images/Gear.svg", WebInspector.UIString("Open Settings"));
+        let tabBarItem = new WI.PinnedTabBarItem("Images/Gear.svg", WI.UIString("Open Settings"));
 
         super(identifier || "settings", "settings", tabBarItem);
 
@@ -43,7 +43,7 @@
     {
         return {
             image: "Images/Gear.svg",
-            title: WebInspector.UIString("Settings"),
+            title: WI.UIString("Settings"),
         };
     }
 
@@ -59,7 +59,7 @@
 
     // Public
 
-    get type() { return WebInspector.SettingsTabContentView.Type; }
+    get type() { return WI.SettingsTabContentView.Type; }
 
     get selectedSettingsView()
     {
@@ -95,7 +95,7 @@
         }
 
         this._settingsViews.push(settingsView);
-        this._navigationBar.addNavigationItem(new WebInspector.RadioButtonNavigationItem(settingsView.identifier, settingsView.displayName));
+        this._navigationBar.addNavigationItem(new WI.RadioButtonNavigationItem(settingsView.identifier, settingsView.displayName));
 
         this._updateNavigationBarVisibility();
     }
@@ -156,14 +156,14 @@
 
     initialLayout()
     {
-        this._navigationBar = new WebInspector.NavigationBar;
-        this._navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected, this._navigationItemSelected, this);
+        this._navigationBar = new WI.NavigationBar;
+        this._navigationBar.addEventListener(WI.NavigationBar.Event.NavigationItemSelected, this._navigationItemSelected, this);
         this.addSubview(this._navigationBar);
 
         this._createGeneralSettingsView();
         this._createExperimentalSettingsView();
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.DebugUIEnabledDidChange, this._updateDebugSettingsViewVisibility, this);
+        WI.notifications.addEventListener(WI.Notification.DebugUIEnabledDidChange, this._updateDebugSettingsViewVisibility, this);
         this._updateDebugSettingsViewVisibility();
 
         this.selectedSettingsView = this._settingsViews[0];
@@ -173,92 +173,92 @@
 
     _createGeneralSettingsView()
     {
-        let generalSettingsView = new WebInspector.SettingsView("general", WebInspector.UIString("General"));
+        let generalSettingsView = new WI.SettingsView("general", WI.UIString("General"));
 
-        const indentValues = [WebInspector.UIString("Tabs"), WebInspector.UIString("Spaces")];
+        const indentValues = [WI.UIString("Tabs"), WI.UIString("Spaces")];
 
-        let indentEditor = generalSettingsView.addGroupWithCustomSetting(WebInspector.UIString("Prefer indent using:"), WebInspector.SettingEditor.Type.Select, {values: indentValues});
-        indentEditor.value = indentValues[WebInspector.settings.indentWithTabs.value ? 0 : 1];
-        indentEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange, () => {
-            WebInspector.settings.indentWithTabs.value = indentEditor.value === indentValues[0];
+        let indentEditor = generalSettingsView.addGroupWithCustomSetting(WI.UIString("Prefer indent using:"), WI.SettingEditor.Type.Select, {values: indentValues});
+        indentEditor.value = indentValues[WI.settings.indentWithTabs.value ? 0 : 1];
+        indentEditor.addEventListener(WI.SettingEditor.Event.ValueDidChange, () => {
+            WI.settings.indentWithTabs.value = indentEditor.value === indentValues[0];
         });
 
-        const widthLabel = WebInspector.UIString("spaces");
+        const widthLabel = WI.UIString("spaces");
         const widthOptions = {min: 1};
 
-        generalSettingsView.addSetting(WebInspector.UIString("Tab width:"), WebInspector.settings.tabSize, widthLabel, widthOptions);
-        generalSettingsView.addSetting(WebInspector.UIString("Indent width:"), WebInspector.settings.indentUnit, widthLabel, widthOptions);
+        generalSettingsView.addSetting(WI.UIString("Tab width:"), WI.settings.tabSize, widthLabel, widthOptions);
+        generalSettingsView.addSetting(WI.UIString("Indent width:"), WI.settings.indentUnit, widthLabel, widthOptions);
 
-        generalSettingsView.addSetting(WebInspector.UIString("Line wrapping:"), WebInspector.settings.enableLineWrapping, WebInspector.UIString("Wrap lines to editor width"));
+        generalSettingsView.addSetting(WI.UIString("Line wrapping:"), WI.settings.enableLineWrapping, WI.UIString("Wrap lines to editor width"));
 
-        let showGroup = generalSettingsView.addGroup(WebInspector.UIString("Show:"));
-        showGroup.addSetting(WebInspector.settings.showWhitespaceCharacters, WebInspector.UIString("Whitespace characters"));
-        showGroup.addSetting(WebInspector.settings.showInvalidCharacters, WebInspector.UIString("Invalid characters"));
+        let showGroup = generalSettingsView.addGroup(WI.UIString("Show:"));
+        showGroup.addSetting(WI.settings.showWhitespaceCharacters, WI.UIString("Whitespace characters"));
+        showGroup.addSetting(WI.settings.showInvalidCharacters, WI.UIString("Invalid characters"));
 
         generalSettingsView.addSeparator();
 
-        let stylesEditingGroup = generalSettingsView.addGroup(WebInspector.UIString("Styles Editing:"));
-        stylesEditingGroup.addSetting(WebInspector.settings.stylesShowInlineWarnings, WebInspector.UIString("Show inline warnings"));
-        stylesEditingGroup.addSetting(WebInspector.settings.stylesInsertNewline, WebInspector.UIString("Automatically insert newline"));
-        stylesEditingGroup.addSetting(WebInspector.settings.stylesSelectOnFirstClick, WebInspector.UIString("Select text on first click"));
+        let stylesEditingGroup = generalSettingsView.addGroup(WI.UIString("Styles Editing:"));
+        stylesEditingGroup.addSetting(WI.settings.stylesShowInlineWarnings, WI.UIString("Show inline warnings"));
+        stylesEditingGroup.addSetting(WI.settings.stylesInsertNewline, WI.UIString("Automatically insert newline"));
+        stylesEditingGroup.addSetting(WI.settings.stylesSelectOnFirstClick, WI.UIString("Select text on first click"));
 
         generalSettingsView.addSeparator();
 
-        generalSettingsView.addSetting(WebInspector.UIString("Network:"), WebInspector.settings.clearNetworkOnNavigate, WebInspector.UIString("Clear when page loads"));
+        generalSettingsView.addSetting(WI.UIString("Network:"), WI.settings.clearNetworkOnNavigate, WI.UIString("Clear when page loads"));
 
         generalSettingsView.addSeparator();
 
-        generalSettingsView.addSetting(WebInspector.UIString("Console:"), WebInspector.settings.clearLogOnNavigate, WebInspector.UIString("Clear when page loads"));
+        generalSettingsView.addSetting(WI.UIString("Console:"), WI.settings.clearLogOnNavigate, WI.UIString("Clear when page loads"));
 
         generalSettingsView.addSeparator();
 
-        generalSettingsView.addSetting(WebInspector.UIString("Debugger:"), WebInspector.settings.showScopeChainOnPause, WebInspector.UIString("Show Scope Chain on pause"));
+        generalSettingsView.addSetting(WI.UIString("Debugger:"), WI.settings.showScopeChainOnPause, WI.UIString("Show Scope Chain on pause"));
 
         generalSettingsView.addSeparator();
 
         const zoomLevels = [0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4];
         const zoomValues = zoomLevels.map((level) => [level, Number.percentageString(level, 0)]);
 
-        let zoomEditor = generalSettingsView.addGroupWithCustomSetting(WebInspector.UIString("Zoom:"), WebInspector.SettingEditor.Type.Select, {values: zoomValues});
-        zoomEditor.value = WebInspector.getZoomFactor();
-        zoomEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange, () => { WebInspector.setZoomFactor(zoomEditor.value); });
-        WebInspector.settings.zoomFactor.addEventListener(WebInspector.Setting.Event.Changed, () => { zoomEditor.value = WebInspector.getZoomFactor().maxDecimals(2); });
+        let zoomEditor = generalSettingsView.addGroupWithCustomSetting(WI.UIString("Zoom:"), WI.SettingEditor.Type.Select, {values: zoomValues});
+        zoomEditor.value = WI.getZoomFactor();
+        zoomEditor.addEventListener(WI.SettingEditor.Event.ValueDidChange, () => { WI.setZoomFactor(zoomEditor.value); });
+        WI.settings.zoomFactor.addEventListener(WI.Setting.Event.Changed, () => { zoomEditor.value = WI.getZoomFactor().maxDecimals(2); });
 
         this.addSettingsView(generalSettingsView);
     }
 
     _createExperimentalSettingsView()
     {
-        let experimentalSettingsView = new WebInspector.SettingsView("experimental", WebInspector.UIString("Experimental"));
+        let experimentalSettingsView = new WI.SettingsView("experimental", WI.UIString("Experimental"));
 
         if (window.CanvasAgent) {
-            experimentalSettingsView.addSetting(WebInspector.UIString("Canvas:"), WebInspector.settings.experimentalShowCanvasContextsInResources, WebInspector.UIString("Show Contexts in Resources Tab"));
+            experimentalSettingsView.addSetting(WI.UIString("Canvas:"), WI.settings.experimentalShowCanvasContextsInResources, WI.UIString("Show Contexts in Resources Tab"));
 
             experimentalSettingsView.addSeparator();
         }
 
-        experimentalSettingsView.addSetting(WebInspector.UIString("Styles Panel:"), WebInspector.settings.experimentalSpreadsheetStyleEditor, WebInspector.UIString("Spreadsheet Style Editor"));
+        experimentalSettingsView.addSetting(WI.UIString("Styles Panel:"), WI.settings.experimentalSpreadsheetStyleEditor, WI.UIString("Spreadsheet Style Editor"));
 
         experimentalSettingsView.addSeparator();
 
         let reloadInspectorButton = document.createElement("button");
-        reloadInspectorButton.textContent = WebInspector.UIString("Reload Web Inspector");
+        reloadInspectorButton.textContent = WI.UIString("Reload Web Inspector");
         reloadInspectorButton.addEventListener("click", () => { window.location.reload(); });
 
-        let reloadInspectorContainerElement = experimentalSettingsView.addCenteredContainer(reloadInspectorButton, WebInspector.UIString("for changes to take effect"));
+        let reloadInspectorContainerElement = experimentalSettingsView.addCenteredContainer(reloadInspectorButton, WI.UIString("for changes to take effect"));
         reloadInspectorContainerElement.classList.add("hidden");
 
         function listenForChange(setting) {
             let initialValue = setting.value;
-            setting.addEventListener(WebInspector.Setting.Event.Changed, () => {
+            setting.addEventListener(WI.Setting.Event.Changed, () => {
                 reloadInspectorContainerElement.classList.toggle("hidden", initialValue === setting.value);
             });
         }
 
         if (window.CanvasAgent)
-            listenForChange(WebInspector.settings.experimentalShowCanvasContextsInResources);
+            listenForChange(WI.settings.experimentalShowCanvasContextsInResources);
 
-        listenForChange(WebInspector.settings.experimentalSpreadsheetStyleEditor);
+        listenForChange(WI.settings.experimentalSpreadsheetStyleEditor);
 
         this.addSettingsView(experimentalSettingsView);
     }
@@ -270,32 +270,32 @@
 
         // These settings are only ever shown in engineering builds, so the strings are unlocalized.
 
-        this._debugSettingsView = new WebInspector.SettingsView("debug", WebInspector.unlocalizedString("Debug"));
+        this._debugSettingsView = new WI.SettingsView("debug", WI.unlocalizedString("Debug"));
 
-        let protocolMessagesGroup = this._debugSettingsView.addGroup(WebInspector.unlocalizedString("Protocol Logging:"));
+        let protocolMessagesGroup = this._debugSettingsView.addGroup(WI.unlocalizedString("Protocol Logging:"));
 
-        let autoLogProtocolMessagesEditor = protocolMessagesGroup.addSetting(WebInspector.settings.autoLogProtocolMessages, WebInspector.unlocalizedString("Messages"));
-        WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed, () => {
+        let autoLogProtocolMessagesEditor = protocolMessagesGroup.addSetting(WI.settings.autoLogProtocolMessages, WI.unlocalizedString("Messages"));
+        WI.settings.autoLogProtocolMessages.addEventListener(WI.Setting.Event.Changed, () => {
             autoLogProtocolMessagesEditor.value = InspectorBackend.dumpInspectorProtocolMessages;
         });
 
-        protocolMessagesGroup.addSetting(WebInspector.settings.autoLogTimeStats, WebInspector.unlocalizedString("Time Stats"));
+        protocolMessagesGroup.addSetting(WI.settings.autoLogTimeStats, WI.unlocalizedString("Time Stats"));
 
         this._debugSettingsView.addSeparator();
 
-        this._debugSettingsView.addSetting(WebInspector.unlocalizedString("Uncaught Exception Reporter:"), WebInspector.settings.enableUncaughtExceptionReporter, WebInspector.unlocalizedString("Enabled"));
+        this._debugSettingsView.addSetting(WI.unlocalizedString("Uncaught Exception Reporter:"), WI.settings.enableUncaughtExceptionReporter, WI.unlocalizedString("Enabled"));
 
         this._debugSettingsView.addSeparator();
 
         const layoutDirectionValues = [
-            [WebInspector.LayoutDirection.System, WebInspector.unlocalizedString("System Default")],
-            [WebInspector.LayoutDirection.LTR, WebInspector.unlocalizedString("Left to Right (LTR)")],
-            [WebInspector.LayoutDirection.RTL, WebInspector.unlocalizedString("Right to Left (RTL)")],
+            [WI.LayoutDirection.System, WI.unlocalizedString("System Default")],
+            [WI.LayoutDirection.LTR, WI.unlocalizedString("Left to Right (LTR)")],
+            [WI.LayoutDirection.RTL, WI.unlocalizedString("Right to Left (RTL)")],
         ];
 
-        let layoutDirectionEditor = this._debugSettingsView.addGroupWithCustomSetting(WebInspector.unlocalizedString("Layout Direction:"), WebInspector.SettingEditor.Type.Select, {values: layoutDirectionValues});
-        layoutDirectionEditor.value = WebInspector.settings.layoutDirection.value;
-        layoutDirectionEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange, () => { WebInspector.setLayoutDirection(layoutDirectionEditor.value); });
+        let layoutDirectionEditor = this._debugSettingsView.addGroupWithCustomSetting(WI.unlocalizedString("Layout Direction:"), WI.SettingEditor.Type.Select, {values: layoutDirectionValues});
+        layoutDirectionEditor.value = WI.settings.layoutDirection.value;
+        layoutDirectionEditor.addEventListener(WI.SettingEditor.Event.ValueDidChange, () => { WI.setLayoutDirection(layoutDirectionEditor.value); });
 
         this.addSettingsView(this._debugSettingsView);
     }
@@ -330,16 +330,16 @@
     _updateDebugSettingsViewVisibility()
     {
         // Only create the Debug view if the debug UI is enabled.
-        if (WebInspector.isDebugUIEnabled())
+        if (WI.isDebugUIEnabled())
             this._createDebugSettingsView();
 
         if (!this._debugSettingsView)
             return;
 
-        this.setSettingsViewVisible(this._debugSettingsView, WebInspector.isDebugUIEnabled());
+        this.setSettingsViewVisible(this._debugSettingsView, WI.isDebugUIEnabled());
 
         this.needsLayout();
     }
 };
 
-WebInspector.SettingsTabContentView.Type = "settings";
+WI.SettingsTabContentView.Type = "settings";
diff --git a/Source/WebInspectorUI/UserInterface/Views/SettingsView.js b/Source/WebInspectorUI/UserInterface/Views/SettingsView.js
index 787feae..02e8859 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SettingsView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SettingsView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SettingsView = class SettingsView extends WebInspector.View
+WI.SettingsView = class SettingsView extends WI.View
 {
     constructor(identifier, displayName)
     {
@@ -54,7 +54,7 @@
 
     addGroup(title)
     {
-        let settingsGroup = new WebInspector.SettingsGroup(title);
+        let settingsGroup = new WI.SettingsGroup(title);
         this.element.append(settingsGroup.element);
 
         return settingsGroup;
@@ -80,7 +80,7 @@
     }
 };
 
-WebInspector.SettingsView.EditorType = {
+WI.SettingsView.EditorType = {
     Checkbox: "settings-view-editor-type-checkbox",
     Numeric: "settings-view-editor-type-numeric",
     Select: "settings-view-editor-type-select",
diff --git a/Source/WebInspectorUI/UserInterface/Views/Sidebar.js b/Source/WebInspectorUI/UserInterface/Views/Sidebar.js
index d922d80..14be652 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Sidebar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Sidebar.js
@@ -23,17 +23,17 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Sidebar = class Sidebar extends WebInspector.View
+WI.Sidebar = class Sidebar extends WI.View
 {
     constructor(element, side, sidebarPanels, role, label, hasNavigationBar)
     {
         super(element);
 
-        console.assert(!side || side === WebInspector.Sidebar.Sides.Left || side === WebInspector.Sidebar.Sides.Right);
-        this._side = side || WebInspector.Sidebar.Sides.Left;
+        console.assert(!side || side === WI.Sidebar.Sides.Left || side === WI.Sidebar.Sides.Right);
+        this._side = side || WI.Sidebar.Sides.Left;
         this._collapsed = true;
 
-        this.element.classList.add("sidebar", this._side, WebInspector.Sidebar.CollapsedStyleClassName);
+        this.element.classList.add("sidebar", this._side, WI.Sidebar.CollapsedStyleClassName);
 
         this.element.setAttribute("role", role || "group");
         if (label)
@@ -42,12 +42,12 @@
         if (hasNavigationBar) {
             this.element.classList.add("has-navigation-bar");
 
-            this._navigationBar = new WebInspector.NavigationBar(null, null, "tablist");
-            this._navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected, this._navigationItemSelected, this);
+            this._navigationBar = new WI.NavigationBar(null, null, "tablist");
+            this._navigationBar.addEventListener(WI.NavigationBar.Event.NavigationItemSelected, this._navigationItemSelected, this);
             this.addSubview(this._navigationBar);
         }
 
-        this._resizer = new WebInspector.Resizer(WebInspector.Resizer.RuleOrientation.Vertical, this);
+        this._resizer = new WI.Resizer(WI.Resizer.RuleOrientation.Vertical, this);
         this.element.insertBefore(this._resizer.element, this.element.firstChild);
 
         this._sidebarPanels = [];
@@ -67,8 +67,8 @@
 
     insertSidebarPanel(sidebarPanel, index)
     {
-        console.assert(sidebarPanel instanceof WebInspector.SidebarPanel);
-        if (!(sidebarPanel instanceof WebInspector.SidebarPanel))
+        console.assert(sidebarPanel instanceof WI.SidebarPanel);
+        if (!(sidebarPanel instanceof WI.SidebarPanel))
             return;
 
         console.assert(!sidebarPanel.parentSidebar);
@@ -154,16 +154,16 @@
             }
         }
 
-        this.dispatchEventToListeners(WebInspector.Sidebar.Event.SidebarPanelSelected);
+        this.dispatchEventToListeners(WI.Sidebar.Event.SidebarPanelSelected);
     }
 
     get minimumWidth()
     {
         if (this._navigationBar)
-            return Math.max(WebInspector.Sidebar.AbsoluteMinimumWidth, this._navigationBar.minimumWidth);
+            return Math.max(WI.Sidebar.AbsoluteMinimumWidth, this._navigationBar.minimumWidth);
         if (this._selectedSidebarPanel)
-            return Math.max(WebInspector.Sidebar.AbsoluteMinimumWidth, this._selectedSidebarPanel.minimumWidth);
-        return WebInspector.Sidebar.AbsoluteMinimumWidth;
+            return Math.max(WI.Sidebar.AbsoluteMinimumWidth, this._selectedSidebarPanel.minimumWidth);
+        return WI.Sidebar.AbsoluteMinimumWidth;
     }
 
     get maximumWidth()
@@ -197,7 +197,7 @@
             return;
 
         this._collapsed = flag || false;
-        this.element.classList.toggle(WebInspector.Sidebar.CollapsedStyleClassName);
+        this.element.classList.toggle(WI.Sidebar.CollapsedStyleClassName);
 
         if (!this._collapsed && this._navigationBar)
             this._navigationBar.needsLayout();
@@ -211,8 +211,8 @@
             this._selectedSidebarPanel.visibilityDidChange();
         }
 
-        this.dispatchEventToListeners(WebInspector.Sidebar.Event.CollapsedStateDidChange);
-        this.dispatchEventToListeners(WebInspector.Sidebar.Event.WidthDidChange);
+        this.dispatchEventToListeners(WI.Sidebar.Event.CollapsedStateDidChange);
+        this.dispatchEventToListeners(WI.Sidebar.Event.WidthDidChange);
     }
 
     get sidebarPanels()
@@ -229,7 +229,7 @@
     {
         var sidebarPanel = null;
 
-        if (sidebarPanelOrIdentifierOrIndex instanceof WebInspector.SidebarPanel) {
+        if (sidebarPanelOrIdentifierOrIndex instanceof WI.SidebarPanel) {
             if (this._sidebarPanels.includes(sidebarPanelOrIdentifierOrIndex))
                 sidebarPanel = sidebarPanelOrIdentifierOrIndex;
         } else if (typeof sidebarPanelOrIdentifierOrIndex === "number") {
@@ -255,10 +255,10 @@
 
     resizerDragging(resizer, positionDelta)
     {
-        if (this._side === WebInspector.Sidebar.Sides.Left)
+        if (this._side === WI.Sidebar.Sides.Left)
             positionDelta *= -1;
 
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             positionDelta *= -1;
 
         var newWidth = positionDelta + this._widthBeforeResize;
@@ -290,12 +290,12 @@
             return;
 
         if (this._navigationBar)
-            this._navigationBar.updateLayoutIfNeeded(WebInspector.View.LayoutReason.Resize);
+            this._navigationBar.updateLayoutIfNeeded(WI.View.LayoutReason.Resize);
 
         if (this._selectedSidebarPanel)
-            this._selectedSidebarPanel.updateLayoutIfNeeded(WebInspector.View.LayoutReason.Resize);
+            this._selectedSidebarPanel.updateLayoutIfNeeded(WI.View.LayoutReason.Resize);
 
-        this.dispatchEventToListeners(WebInspector.Sidebar.Event.WidthDidChange, {newWidth});
+        this.dispatchEventToListeners(WI.Sidebar.Event.WidthDidChange, {newWidth});
     }
 
     _navigationItemSelected(event)
@@ -304,15 +304,15 @@
     }
 };
 
-WebInspector.Sidebar.CollapsedStyleClassName = "collapsed";
-WebInspector.Sidebar.AbsoluteMinimumWidth = 200;
+WI.Sidebar.CollapsedStyleClassName = "collapsed";
+WI.Sidebar.AbsoluteMinimumWidth = 200;
 
-WebInspector.Sidebar.Sides = {
+WI.Sidebar.Sides = {
     Right: "right",
     Left: "left"
 };
 
-WebInspector.Sidebar.Event = {
+WI.Sidebar.Event = {
     SidebarPanelSelected: "sidebar-panel-selected",
     CollapsedStateDidChange: "sidebar-collapsed-state-did-change",
     WidthDidChange: "sidebar-width-did-change",
diff --git a/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js
index f96bf66..821f632 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SidebarPanel = class SidebarPanel extends WebInspector.View
+WI.SidebarPanel = class SidebarPanel extends WI.View
 {
     constructor(identifier, displayName)
     {
@@ -40,7 +40,7 @@
         this.element.setAttribute("role", "group");
         this.element.setAttribute("aria-label", displayName);
 
-        this._contentView = new WebInspector.View;
+        this._contentView = new WI.View;
         this._contentView.element.classList.add("content");
         this.addSubview(this._contentView);
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/Slider.js b/Source/WebInspectorUI/UserInterface/Views/Slider.js
index 1b6c471..de8a0d2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Slider.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Slider.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Slider = class Slider extends WebInspector.Object
+WI.Slider = class Slider extends WI.Object
 {
     constructor()
     {
@@ -76,7 +76,7 @@
     get maxX()
     {
         if (this._maxX <= 0 && document.body.contains(this._element))
-            this._maxX = Math.max(this._element.offsetWidth - Math.ceil(WebInspector.Slider.KnobWidth / 2), 0);
+            this._maxX = Math.max(this._element.offsetWidth - Math.ceil(WI.Slider.KnobWidth / 2), 0);
 
         return this._maxX;
     }
@@ -144,4 +144,4 @@
     }
 };
 
-WebInspector.Slider.KnobWidth = 13;
+WI.Slider.KnobWidth = 13;
diff --git a/Source/WebInspectorUI/UserInterface/Views/SoftContextMenu.js b/Source/WebInspectorUI/UserInterface/Views/SoftContextMenu.js
index 07fbdb3..b83f09e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SoftContextMenu.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SoftContextMenu.js
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SoftContextMenu = class SoftContextMenu
+WI.SoftContextMenu = class SoftContextMenu
 {
     constructor(items, parentMenu)
     {
@@ -174,7 +174,7 @@
         if (this._subMenu)
             return;
 
-        this._subMenu = new WebInspector.SoftContextMenu(menuItemElement._subItems, this);
+        this._subMenu = new WI.SoftContextMenu(menuItemElement._subItems, this);
         this._subMenu.show({
             pageX: this._contextMenuElement.offsetLeft + menuItemElement.offsetWidth,
             pageY: this._contextMenuElement.offsetTop + menuItemElement.offsetTop - 4
@@ -276,7 +276,7 @@
         if (!menuItemElement._subItems) {
             this._discardMenu(true, event);
             if (typeof menuItemElement._actionId === "number") {
-                WebInspector.ContextMenu.contextMenuItemSelected(menuItemElement._actionId);
+                WI.ContextMenu.contextMenuItemSelected(menuItemElement._actionId);
                 menuItemElement._actionId = null;
             }
             return;
diff --git a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
index bc0943a..039fe37 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspector.TextEditor
+WI.SourceCodeTextEditor = class SourceCodeTextEditor extends WI.TextEditor
 {
     constructor(sourceCode)
     {
-        console.assert(sourceCode instanceof WebInspector.SourceCode);
+        console.assert(sourceCode instanceof WI.SourceCode);
 
         super();
 
@@ -66,40 +66,40 @@
         this.element.classList.add("source-code");
 
         if (this._supportsDebugging) {
-            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
-            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
-            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
-            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
+            WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
+            WI.Breakpoint.addEventListener(WI.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
+            WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
+            WI.Breakpoint.addEventListener(WI.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
 
-            WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded, this._targetAdded, this);
-            WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+            WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, this._targetAdded, this);
+            WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
 
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, this._callFramesDidChange, this);
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, this._callFramesDidChange, this);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
 
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
-            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
-            if (WebInspector.debuggerManager.activeCallFrame)
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
+            WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
+            if (WI.debuggerManager.activeCallFrame)
                 this._debuggerDidPause();
 
             this._activeCallFrameDidChange();
         }
 
-        WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
+        WI.issueManager.addEventListener(WI.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
 
-        if (this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
-            WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
+        if (this._sourceCode instanceof WI.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
+            WI.notifications.addEventListener(WI.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
         else
-            this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+            this._sourceCode.addEventListener(WI.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
 
         sourceCode.requestContent().then(this._contentAvailable.bind(this));
 
-        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "G", this.showGoToLineDialog.bind(this), this.element);
+        new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, "G", this.showGoToLineDialog.bind(this), this.element);
 
-        WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._logCleared, this);
+        WI.logManager.addEventListener(WI.LogManager.Event.Cleared, this._logCleared, this);
     }
 
     // Public
@@ -111,22 +111,22 @@
 
     get target()
     {
-        if (this._sourceCode instanceof WebInspector.SourceMapResource) {
-            if (this._sourceCode.sourceMap.originalSourceCode instanceof WebInspector.Script)
+        if (this._sourceCode instanceof WI.SourceMapResource) {
+            if (this._sourceCode.sourceMap.originalSourceCode instanceof WI.Script)
                 return this._sourceCode.sourceMap.originalSourceCode.target;
         }
 
-        if (this._sourceCode instanceof WebInspector.Script)
+        if (this._sourceCode instanceof WI.Script)
             return this._sourceCode.target;
 
-        return WebInspector.mainTarget;
+        return WI.mainTarget;
     }
 
     shown()
     {
         super.shown();
 
-        if (WebInspector.showJavaScriptTypeInformationSetting.value) {
+        if (WI.showJavaScriptTypeInformationSetting.value) {
             if (this._typeTokenAnnotator)
                 this._typeTokenAnnotator.resume();
             if (!this._typeTokenScrollHandler && this._typeTokenAnnotator)
@@ -136,7 +136,7 @@
                 this._setTypeTokenAnnotatorEnabledState(false);
         }
 
-        if (WebInspector.enableControlFlowProfilerSetting.value) {
+        if (WI.enableControlFlowProfilerSetting.value) {
             if (this._basicBlockAnnotator)
                 this._basicBlockAnnotator.resume();
 
@@ -168,22 +168,22 @@
         super.close();
 
         if (this._supportsDebugging) {
-            WebInspector.Breakpoint.removeEventListener(null, null, this);
-            WebInspector.debuggerManager.removeEventListener(null, null, this);
-            WebInspector.targetManager.removeEventListener(null, null, this);
+            WI.Breakpoint.removeEventListener(null, null, this);
+            WI.debuggerManager.removeEventListener(null, null, this);
+            WI.targetManager.removeEventListener(null, null, this);
 
             if (this._activeCallFrameSourceCodeLocation) {
-                this._activeCallFrameSourceCodeLocation.removeEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
+                this._activeCallFrameSourceCodeLocation.removeEventListener(WI.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
                 this._activeCallFrameSourceCodeLocation = null;
             }
         }
 
-        WebInspector.issueManager.removeEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
+        WI.issueManager.removeEventListener(WI.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
 
-        if (this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
-            WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
+        if (this._sourceCode instanceof WI.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
+            WI.notifications.removeEventListener(WI.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
         else
-            this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+            this._sourceCode.removeEventListener(WI.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
     }
 
     canBeFormatted()
@@ -192,7 +192,7 @@
         // We could allow source map resources to be formatted, we would then need to make
         // SourceCodeLocation watch listen for mappedResource's formatting changes, and keep
         // a formatted location alongside the regular mapped location.
-        if (this._sourceCode instanceof WebInspector.SourceMapResource)
+        if (this._sourceCode instanceof WI.SourceMapResource)
             return false;
 
         return super.canBeFormatted();
@@ -220,7 +220,7 @@
 
             if (error || !matches || !matches.length) {
                 // Report zero matches.
-                this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);
+                this.dispatchEventToListeners(WI.TextEditor.Event.NumberOfSearchResultsDidChange);
                 return;
             }
 
@@ -239,25 +239,25 @@
                 // Search the line and mark the ranges.
                 var lineMatch = null;
                 while (queryRegex.lastIndex + query.length <= line.length && (lineMatch = queryRegex.exec(line))) {
-                    var resultTextRange = new WebInspector.TextRange(matchLineNumber, lineMatch.index, matchLineNumber, queryRegex.lastIndex);
+                    var resultTextRange = new WI.TextRange(matchLineNumber, lineMatch.index, matchLineNumber, queryRegex.lastIndex);
                     searchResults.push(resultTextRange);
                 }
             }
 
             this.addSearchResults(searchResults);
 
-            this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);
+            this.dispatchEventToListeners(WI.TextEditor.Event.NumberOfSearchResultsDidChange);
         }
 
         if (this.hasEdits())
             return false;
 
-        if (this._sourceCode instanceof WebInspector.SourceMapResource)
+        if (this._sourceCode instanceof WI.SourceMapResource)
             return false;
 
-        if (this._sourceCode instanceof WebInspector.Resource)
+        if (this._sourceCode instanceof WI.Resource)
             PageAgent.searchInResource(this._sourceCode.parentFrame.id, this._sourceCode.url, query, false, false, searchResultCallback.bind(this));
-        else if (this._sourceCode instanceof WebInspector.Script)
+        else if (this._sourceCode instanceof WI.Script)
             this._sourceCode.target.DebuggerAgent.searchInContent(this._sourceCode.id, query, false, false, searchResultCallback.bind(this));
         return true;
     }
@@ -265,7 +265,7 @@
     showGoToLineDialog()
     {
         if (!this._goToLineDialog)
-            this._goToLineDialog = new WebInspector.GoToLineDialog(this);
+            this._goToLineDialog = new WI.GoToLineDialog(this);
 
         this._goToLineDialog.present(this.element);
     }
@@ -278,8 +278,8 @@
     dialogWasDismissed(goToLineDialog)
     {
         let lineNumber = goToLineDialog.representedObject;
-        let position = new WebInspector.SourceCodePosition(lineNumber - 1, 0);
-        let range = new WebInspector.TextRange(lineNumber - 1, 0, lineNumber, 0);
+        let position = new WI.SourceCodePosition(lineNumber - 1, 0);
+        let range = new WI.TextRange(lineNumber - 1, 0, lineNumber, 0);
 
         this.revealPosition(position, range, false, true);
         this.focus();
@@ -351,7 +351,7 @@
         var bodyElement = content.appendChild(document.createElement("div"));
         bodyElement.className = "body";
 
-        var typeTreeView = new WebInspector.TypeTreeView(typeDescription);
+        var typeTreeView = new WI.TypeTreeView(typeDescription);
         bodyElement.appendChild(typeTreeView.element);
 
         this._showPopover(content, bounds);
@@ -408,7 +408,7 @@
 
     _editorLineInfoForSourceCodeLocation(sourceCodeLocation)
     {
-        if (this._sourceCode instanceof WebInspector.SourceMapResource)
+        if (this._sourceCode instanceof WI.SourceMapResource)
             return {lineNumber: sourceCodeLocation.displayLineNumber, columnNumber: sourceCodeLocation.displayColumnNumber};
         return {lineNumber: sourceCodeLocation.formattedLineNumber, columnNumber: sourceCodeLocation.formattedColumnNumber};
     }
@@ -462,16 +462,16 @@
 
     _proceedPopulateWithContent(content)
     {
-        this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate);
+        this.dispatchEventToListeners(WI.SourceCodeTextEditor.Event.ContentWillPopulate);
 
         this.string = content;
 
         this._createBasicBlockAnnotator();
-        if (WebInspector.enableControlFlowProfilerSetting.value && this._basicBlockAnnotator)
+        if (WI.enableControlFlowProfilerSetting.value && this._basicBlockAnnotator)
             this._basicBlockAnnotatorEnabled = true;
 
         this._createTypeTokenAnnotator();
-        if (WebInspector.showJavaScriptTypeInformationSetting.value)
+        if (WI.showJavaScriptTypeInformationSetting.value)
             this._setTypeTokenAnnotatorEnabledState(true);
 
         this._contentDidPopulate();
@@ -481,7 +481,7 @@
     {
         this._contentPopulated = true;
 
-        this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentDidPopulate);
+        this.dispatchEventToListeners(WI.SourceCodeTextEditor.Event.ContentDidPopulate);
 
         // We add the issues each time content is populated. This is needed because lines might not exist
         // if we tried added them before when the full content wasn't available. (When populating with
@@ -502,7 +502,7 @@
         if (this._supportsDebugging) {
             this._breakpointMap = {};
 
-            var breakpoints = WebInspector.debuggerManager.breakpointsForSourceCode(this._sourceCode);
+            var breakpoints = WI.debuggerManager.breakpointsForSourceCode(this._sourceCode);
             for (var i = 0; i < breakpoints.length; ++i) {
                 var breakpoint = breakpoints[i];
                 console.assert(this._matchesBreakpoint(breakpoint));
@@ -512,11 +512,11 @@
             }
         }
 
-        if (this._sourceCode instanceof WebInspector.Resource)
+        if (this._sourceCode instanceof WI.Resource)
             this.mimeType = this._sourceCode.syntheticMIMEType;
-        else if (this._sourceCode instanceof WebInspector.Script)
+        else if (this._sourceCode instanceof WI.Script)
             this.mimeType = "text/javascript";
-        else if (this._sourceCode instanceof WebInspector.CSSStyleSheet)
+        else if (this._sourceCode instanceof WI.CSSStyleSheet)
             this.mimeType = "text/css";
 
         // Decide to automatically format the content if it looks minified and it can be formatted.
@@ -559,7 +559,7 @@
     {
         console.assert(this._supportsDebugging);
 
-        var breakpoints = WebInspector.debuggerManager.breakpointsForSourceCode(this._sourceCode);
+        var breakpoints = WI.debuggerManager.breakpointsForSourceCode(this._sourceCode);
         for (var breakpoint of breakpoints)
             this._updateBreakpointStatus(breakpoint);
     }
@@ -597,7 +597,7 @@
 
         var sourceCodeLocation = breakpoint.sourceCodeLocation;
 
-        if (this._sourceCode instanceof WebInspector.SourceMapResource) {
+        if (this._sourceCode instanceof WI.SourceMapResource) {
             // Update our breakpoint location if the display location changed.
             if (sourceCodeLocation.displaySourceCode !== this._sourceCode)
                 return;
@@ -664,13 +664,13 @@
 
     _targetAdded(event)
     {
-        if (WebInspector.targets.size === 2)
+        if (WI.targets.size === 2)
             this._reinsertAllThreadIndicators();
     }
 
     _targetRemoved(event)
     {
-        if (WebInspector.targets.size === 1) {
+        if (WI.targets.size === 1) {
             // Back to one thread, remove thread indicators.
             this._reinsertAllThreadIndicators();
             return;
@@ -682,7 +682,7 @@
 
     _callFramesDidChange(event)
     {
-        if (WebInspector.targets.size === 1)
+        if (WI.targets.size === 1)
             return;
 
         let target = event.data.target;
@@ -692,7 +692,7 @@
 
     _addThreadIndicatorForTarget(target)
     {
-        let targetData = WebInspector.debuggerManager.dataForTarget(target);
+        let targetData = WI.debuggerManager.dataForTarget(target);
         let topCallFrame = targetData.callFrames[0];
         if (!topCallFrame)
             return;
@@ -768,12 +768,12 @@
         if (!widget)
             return;
 
-        console.assert(WebInspector.targets.size > 1);
+        console.assert(WI.targets.size > 1);
 
         let widgetElement = widget.widgetElement;
         widgetElement.removeChildren();
 
-        widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol] = threads.length > 1;
+        widget[WI.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol] = threads.length > 1;
 
         if (widgetElement.classList.contains("inline") || threads.length === 1) {
             let arrowElement = widgetElement.appendChild(document.createElement("span"));
@@ -781,7 +781,7 @@
 
             let textElement = widgetElement.appendChild(document.createElement("span"));
             textElement.className = "text";
-            textElement.textContent = threads.length === 1 ? threads[0].displayName : WebInspector.UIString("%d Threads").format(threads.length);
+            textElement.textContent = threads.length === 1 ? threads[0].displayName : WI.UIString("%d Threads").format(threads.length);
         } else {
             for (let target of threads) {
                 let textElement = widgetElement.appendChild(document.createElement("span"));
@@ -811,11 +811,11 @@
         console.assert(this._supportsDebugging);
 
         if (this._activeCallFrameSourceCodeLocation) {
-            this._activeCallFrameSourceCodeLocation.removeEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
+            this._activeCallFrameSourceCodeLocation.removeEventListener(WI.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
             this._activeCallFrameSourceCodeLocation = null;
         }
 
-        let activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+        let activeCallFrame = WI.debuggerManager.activeCallFrame;
         if (!activeCallFrame || !this._matchesSourceCodeLocation(activeCallFrame.sourceCodeLocation)) {
             this.setExecutionLineAndColumn(NaN, NaN);
             return;
@@ -824,7 +824,7 @@
         this._dismissPopover();
 
         this._activeCallFrameSourceCodeLocation = activeCallFrame.sourceCodeLocation;
-        this._activeCallFrameSourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
+        this._activeCallFrameSourceCodeLocation.addEventListener(WI.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
 
         // Don't return early if the line number didn't change. The execution state still
         // could have changed (e.g. continuing in a loop with a breakpoint inside).
@@ -834,14 +834,14 @@
 
         // If we have full content or this source code isn't a Resource we can return early.
         // Script source code populates from the request started in the constructor.
-        if (this._fullContentPopulated || !(this._sourceCode instanceof WebInspector.Resource) || this._requestingScriptContent)
+        if (this._fullContentPopulated || !(this._sourceCode instanceof WI.Resource) || this._requestingScriptContent)
             return;
 
         // Since we are paused in the debugger we need to show some content, and since the Resource
         // content hasn't populated yet we need to populate with content from the Scripts by URL.
         // Document resources will attempt to populate the scripts as inline (in <script> tags.)
         // Other resources are assumed to be full scripts (JavaScript resources).
-        if (this._sourceCode.type === WebInspector.Resource.Type.Document)
+        if (this._sourceCode.type === WI.Resource.Type.Document)
             this._populateWithInlineScriptContent();
         else
             this._populateWithScriptContent();
@@ -853,8 +853,8 @@
         if (isNaN(this.executionLineNumber))
             return;
 
-        console.assert(WebInspector.debuggerManager.activeCallFrame);
-        console.assert(this._activeCallFrameSourceCodeLocation === WebInspector.debuggerManager.activeCallFrame.sourceCodeLocation);
+        console.assert(WI.debuggerManager.activeCallFrame);
+        console.assert(this._activeCallFrameSourceCodeLocation === WI.debuggerManager.activeCallFrame.sourceCodeLocation);
 
         var lineInfo = this._editorLineInfoForSourceCodeLocation(this._activeCallFrameSourceCodeLocation);
         this.setExecutionLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber);
@@ -862,7 +862,7 @@
 
     _populateWithInlineScriptContent()
     {
-        console.assert(this._sourceCode instanceof WebInspector.Resource);
+        console.assert(this._sourceCode instanceof WI.Resource);
         console.assert(!this._fullContentPopulated);
         console.assert(!this._requestingScriptContent);
 
@@ -934,7 +934,7 @@
 
     _populateWithScriptContent()
     {
-        console.assert(this._sourceCode instanceof WebInspector.Resource);
+        console.assert(this._sourceCode instanceof WI.Resource);
         console.assert(!this._fullContentPopulated);
         console.assert(!this._requestingScriptContent);
 
@@ -969,20 +969,20 @@
 
     _looselyMatchesSourceCodeLocation(sourceCodeLocation)
     {
-        if (this._sourceCode instanceof WebInspector.SourceMapResource)
+        if (this._sourceCode instanceof WI.SourceMapResource)
             return sourceCodeLocation.displaySourceCode === this._sourceCode;
-        if (this._sourceCode instanceof WebInspector.Resource || this._sourceCode instanceof WebInspector.Script || this._sourceCode instanceof WebInspector.CSSStyleSheet)
+        if (this._sourceCode instanceof WI.Resource || this._sourceCode instanceof WI.Script || this._sourceCode instanceof WI.CSSStyleSheet)
             return sourceCodeLocation.sourceCode.url === this._sourceCode.url;
         return false;
     }
 
     _matchesSourceCodeLocation(sourceCodeLocation)
     {
-        if (this._sourceCode instanceof WebInspector.SourceMapResource)
+        if (this._sourceCode instanceof WI.SourceMapResource)
             return sourceCodeLocation.displaySourceCode === this._sourceCode;
-        if (this._sourceCode instanceof WebInspector.Resource || this._sourceCode instanceof WebInspector.CSSStyleSheet)
+        if (this._sourceCode instanceof WI.Resource || this._sourceCode instanceof WI.CSSStyleSheet)
             return sourceCodeLocation.sourceCode.url === this._sourceCode.url;
-        if (this._sourceCode instanceof WebInspector.Script)
+        if (this._sourceCode instanceof WI.Script)
             return sourceCodeLocation.sourceCode === this._sourceCode;
         return false;
     }
@@ -990,11 +990,11 @@
     _matchesBreakpoint(breakpoint)
     {
         console.assert(this._supportsDebugging);
-        if (this._sourceCode instanceof WebInspector.SourceMapResource)
+        if (this._sourceCode instanceof WI.SourceMapResource)
             return breakpoint.sourceCodeLocation.displaySourceCode === this._sourceCode;
-        if (this._sourceCode instanceof WebInspector.Resource)
+        if (this._sourceCode instanceof WI.Resource)
             return breakpoint.contentIdentifier === this._sourceCode.contentIdentifier;
-        if (this._sourceCode instanceof WebInspector.Script)
+        if (this._sourceCode instanceof WI.Script)
             return breakpoint.contentIdentifier === this._sourceCode.contentIdentifier || breakpoint.scriptIdentifier === this._sourceCode.id;
         return false;
     }
@@ -1002,7 +1002,7 @@
     _issueWasAdded(event)
     {
         var issue = event.data.issue;
-        if (!WebInspector.IssueManager.issueMatchSourceCode(issue, this._sourceCode))
+        if (!WI.IssueManager.issueMatchSourceCode(issue, this._sourceCode))
             return;
 
         this._addIssue(issue);
@@ -1031,19 +1031,19 @@
 
         lineNumberIssues.push(issue);
 
-        if (issue.level === WebInspector.IssueMessage.Level.Error)
-            this.addStyleClassToLine(lineNumber, WebInspector.SourceCodeTextEditor.LineErrorStyleClassName);
-        else if (issue.level === WebInspector.IssueMessage.Level.Warning)
-            this.addStyleClassToLine(lineNumber, WebInspector.SourceCodeTextEditor.LineWarningStyleClassName);
+        if (issue.level === WI.IssueMessage.Level.Error)
+            this.addStyleClassToLine(lineNumber, WI.SourceCodeTextEditor.LineErrorStyleClassName);
+        else if (issue.level === WI.IssueMessage.Level.Warning)
+            this.addStyleClassToLine(lineNumber, WI.SourceCodeTextEditor.LineWarningStyleClassName);
         else
             console.error("Unknown issue level");
 
         var widget = this._issueWidgetForLine(lineNumber);
         if (widget) {
-            if (issue.level === WebInspector.IssueMessage.Level.Error)
-                widget.widgetElement.classList.add(WebInspector.SourceCodeTextEditor.LineErrorStyleClassName);
-            else if (issue.level === WebInspector.IssueMessage.Level.Warning)
-                widget.widgetElement.classList.add(WebInspector.SourceCodeTextEditor.LineWarningStyleClassName);
+            if (issue.level === WI.IssueMessage.Level.Error)
+                widget.widgetElement.classList.add(WI.SourceCodeTextEditor.LineErrorStyleClassName);
+            else if (issue.level === WI.IssueMessage.Level.Warning)
+                widget.widgetElement.classList.add(WI.SourceCodeTextEditor.LineWarningStyleClassName);
 
             this._updateIssueWidgetForIssues(widget, lineNumberIssues);
         }
@@ -1070,10 +1070,10 @@
 
     _iconClassNameForIssueLevel(level)
     {
-        if (level === WebInspector.IssueMessage.Level.Warning)
+        if (level === WI.IssueMessage.Level.Warning)
             return "icon-warning";
 
-        console.assert(level === WebInspector.IssueMessage.Level.Error);
+        console.assert(level === WI.IssueMessage.Level.Error);
         return "icon-error";
     }
 
@@ -1099,24 +1099,24 @@
                 var errorsCount = 0;
                 var warningsCount = 0;
                 for (var issue of issues) {
-                    if (issue.level === WebInspector.IssueMessage.Level.Error)
+                    if (issue.level === WI.IssueMessage.Level.Error)
                         ++errorsCount;
-                    else if (issue.level === WebInspector.IssueMessage.Level.Warning)
+                    else if (issue.level === WI.IssueMessage.Level.Warning)
                         ++warningsCount;
                 }
 
                 if (warningsCount && errorsCount) {
                     iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));
-                    textElement.textContent = WebInspector.UIString("%d Errors, %d Warnings").format(errorsCount, warningsCount);
+                    textElement.textContent = WI.UIString("%d Errors, %d Warnings").format(errorsCount, warningsCount);
                 } else if (errorsCount) {
                     iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));
-                    textElement.textContent = WebInspector.UIString("%d Errors").format(errorsCount);
+                    textElement.textContent = WI.UIString("%d Errors").format(errorsCount);
                 } else if (warningsCount) {
                     iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));
-                    textElement.textContent = WebInspector.UIString("%d Warnings").format(warningsCount);
+                    textElement.textContent = WI.UIString("%d Warnings").format(warningsCount);
                 }
 
-                widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol] = true;
+                widget[WI.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol] = true;
             }
         } else {
             for (var issue of issues) {
@@ -1137,10 +1137,10 @@
 
     _isWidgetToggleable(widget)
     {
-        if (widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol])
+        if (widget[WI.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol])
             return true;
 
-        if (widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol])
+        if (widget[WI.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol])
             return true;
 
         if (!widget.widgetElement.classList.contains("inline"))
@@ -1171,9 +1171,9 @@
 
     get _supportsDebugging()
     {
-        if (this._sourceCode instanceof WebInspector.Resource)
-            return this._sourceCode.type === WebInspector.Resource.Type.Document || this._sourceCode.type === WebInspector.Resource.Type.Script;
-        if (this._sourceCode instanceof WebInspector.Script)
+        if (this._sourceCode instanceof WI.Resource)
+            return this._sourceCode.type === WI.Resource.Type.Document || this._sourceCode.type === WI.Resource.Type.Script;
+        if (this._sourceCode instanceof WI.Script)
             return true;
         return false;
     }
@@ -1188,7 +1188,7 @@
     textEditorScriptSourceType(textEditor)
     {
         let script = this._getAssociatedScript();
-        return script ? script.sourceType : WebInspector.Script.SourceType.Program;
+        return script ? script.sourceType : WI.Script.SourceType.Program;
     }
 
     textEditorShouldHideLineNumber(textEditor, lineNumber)
@@ -1208,23 +1208,23 @@
             this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
         };
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         // Paused. Add Continue to Here option only if we have a script identifier for the location.
-        if (WebInspector.debuggerManager.paused) {
+        if (WI.debuggerManager.paused) {
             let editorLineInfo = {lineNumber, columnNumber};
             let unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(editorLineInfo);
             let sourceCodeLocation = this._sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
 
             let script;
-            if (sourceCodeLocation.sourceCode instanceof WebInspector.Script)
+            if (sourceCodeLocation.sourceCode instanceof WI.Script)
                 script = sourceCodeLocation.sourceCode;
-            else if (sourceCodeLocation.sourceCode instanceof WebInspector.Resource)
+            else if (sourceCodeLocation.sourceCode instanceof WI.Resource)
                 script = sourceCodeLocation.sourceCode.scriptForLocation(sourceCodeLocation);
 
             if (script) {
-                contextMenu.appendItem(WebInspector.UIString("Continue to Here"), () => {
-                    WebInspector.debuggerManager.continueToLocation(script, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
+                contextMenu.appendItem(WI.UIString("Continue to Here"), () => {
+                    WI.debuggerManager.continueToLocation(script, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
                 });
                 contextMenu.appendSeparator();
             }
@@ -1240,18 +1240,18 @@
 
         // No breakpoints.
         if (!breakpoints.length) {
-            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), addBreakpoint.bind(this));
+            contextMenu.appendItem(WI.UIString("Add Breakpoint"), addBreakpoint.bind(this));
             return;
         }
 
         // Single breakpoint.
         if (breakpoints.length === 1) {
-            WebInspector.breakpointPopoverController.appendContextMenuItems(contextMenu, breakpoints[0], event.target);
+            WI.breakpointPopoverController.appendContextMenuItems(contextMenu, breakpoints[0], event.target);
 
-            if (!WebInspector.isShowingDebuggerTab()) {
+            if (!WI.isShowingDebuggerTab()) {
                 contextMenu.appendSeparator();
-                contextMenu.appendItem(WebInspector.UIString("Reveal in Debugger Tab"), () => {
-                    WebInspector.showDebuggerTab({breakpointToSelect: breakpoints[0]});
+                contextMenu.appendItem(WI.UIString("Reveal in Debugger Tab"), () => {
+                    WI.showDebuggerTab({breakpointToSelect: breakpoints[0]});
                 });
             }
 
@@ -1261,8 +1261,8 @@
         // Multiple breakpoints.
         let removeBreakpoints = () => {
             for (let breakpoint of breakpoints) {
-                if (WebInspector.debuggerManager.isBreakpointRemovable(breakpoint))
-                    WebInspector.debuggerManager.removeBreakpoint(breakpoint);
+                if (WI.debuggerManager.isBreakpointRemovable(breakpoint))
+                    WI.debuggerManager.removeBreakpoint(breakpoint);
             }
         };
 
@@ -1273,10 +1273,10 @@
         };
 
         if (shouldDisable)
-            contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"), toggleBreakpoints);
+            contextMenu.appendItem(WI.UIString("Disable Breakpoints"), toggleBreakpoints);
         else
-            contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"), toggleBreakpoints);
-        contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), removeBreakpoints);
+            contextMenu.appendItem(WI.UIString("Enable Breakpoints"), toggleBreakpoints);
+        contextMenu.appendItem(WI.UIString("Delete Breakpoints"), removeBreakpoints);
     }
 
     textEditorBreakpointAdded(textEditor, lineNumber, columnNumber)
@@ -1287,14 +1287,14 @@
         var editorLineInfo = {lineNumber, columnNumber};
         var unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(editorLineInfo);
         var sourceCodeLocation = this._sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
-        var breakpoint = new WebInspector.Breakpoint(sourceCodeLocation);
+        var breakpoint = new WI.Breakpoint(sourceCodeLocation);
 
         var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
         this._addBreakpointWithEditorLineInfo(breakpoint, lineInfo);
 
         this._ignoreBreakpointAddedBreakpoint = breakpoint;
         const shouldSpeculativelyResolveBreakpoint = true;
-        WebInspector.debuggerManager.addBreakpoint(breakpoint, shouldSpeculativelyResolveBreakpoint);
+        WI.debuggerManager.addBreakpoint(breakpoint, shouldSpeculativelyResolveBreakpoint);
         this._ignoreBreakpointAddedBreakpoint = null;
 
         // Return the more accurate location and breakpoint info.
@@ -1320,7 +1320,7 @@
         this._removeBreakpointWithEditorLineInfo(breakpoint, lineInfo);
 
         this._ignoreBreakpointRemovedBreakpoint = breakpoint;
-        WebInspector.debuggerManager.removeBreakpoint(breakpoint);
+        WI.debuggerManager.removeBreakpoint(breakpoint);
         this._ignoreBreakpointRemovedBreakpoint = null;
     }
 
@@ -1375,11 +1375,11 @@
         // if this SourceCode is a Resource, then there might also be a Script. In the debugger,
         // the backend identifies call frames with Script line and column information, and the
         // Script needs the formatter source map to produce the proper display line and column.
-        if (this._sourceCode instanceof WebInspector.Resource && !(this._sourceCode instanceof WebInspector.SourceMapResource)) {
+        if (this._sourceCode instanceof WI.Resource && !(this._sourceCode instanceof WI.SourceMapResource)) {
             var scripts = this._sourceCode.scripts;
             for (var i = 0; i < scripts.length; ++i)
                 scripts[i].formatterSourceMap = this.formatterSourceMap;
-        } else if (this._sourceCode instanceof WebInspector.Script) {
+        } else if (this._sourceCode instanceof WI.Script) {
             if (this._sourceCode.resource)
                 this._sourceCode.resource.formatterSourceMap = this.formatterSourceMap;
         }
@@ -1433,11 +1433,11 @@
             // Special case the assignment expression inside of a for..of and for..in to highlight a larger range.
             for (let node of nodes) {
                 let startOffset = node.range[0];
-                if (startOffset === offset && node.type !== WebInspector.ScriptSyntaxTree.NodeType.Program) {
+                if (startOffset === offset && node.type !== WI.ScriptSyntaxTree.NodeType.Program) {
                     callback(convertRangeOffsetsToSourceCodeOffsets(node.range));
                     return;
                 }
-                if (node.type === WebInspector.ScriptSyntaxTree.NodeType.ForInStatement || node.type === WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement) {
+                if (node.type === WI.ScriptSyntaxTree.NodeType.ForInStatement || node.type === WI.ScriptSyntaxTree.NodeType.ForOfStatement) {
                     if (node.left.range[0] === offset) {
                         callback(convertRangeOffsetsToSourceCodeOffsets([node.left.range[0], node.right.range[1]]));
                         return;
@@ -1454,7 +1454,7 @@
                 let startOffset = node.range[0];
                 let endOffset = node.range[1];
                 if (endOffset === offset) {
-                    if (node.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement) {
+                    if (node.type === WI.ScriptSyntaxTree.NodeType.BlockStatement) {
                         // Closing brace of a block, only highlight the closing brace character.
                         callback(convertRangeOffsetsToSourceCodeOffsets([offset - 1, offset]));
                         return;
@@ -1478,9 +1478,9 @@
                 let node = nodes[i];
 
                 // In a function call.
-                if (node.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression
-                    || node.type === WebInspector.ScriptSyntaxTree.NodeType.NewExpression
-                    || node.type === WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement) {
+                if (node.type === WI.ScriptSyntaxTree.NodeType.CallExpression
+                    || node.type === WI.ScriptSyntaxTree.NodeType.NewExpression
+                    || node.type === WI.ScriptSyntaxTree.NodeType.ThrowStatement) {
                     callback(convertRangeOffsetsToSourceCodeOffsets(node.range));
                     return;
                 }
@@ -1499,12 +1499,12 @@
                 //     foo*["x"]["y"]["z"] => inside x looking at parent call frame => |foo["x"]|["y"]["z"]
                 //     foo["x"]*["y"]["z"] => inside y looking at parent call frame => |foo["x"]["y"]|["z"]
                 //
-                if (node.type === WebInspector.ScriptSyntaxTree.NodeType.ThisExpression
-                    || (characterAtOffsetIsDotOrBracket && (node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier || node.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression))) {
+                if (node.type === WI.ScriptSyntaxTree.NodeType.ThisExpression
+                    || (characterAtOffsetIsDotOrBracket && (node.type === WI.ScriptSyntaxTree.NodeType.Identifier || node.type === WI.ScriptSyntaxTree.NodeType.MemberExpression))) {
                     let memberExpressionNode = null;
                     for (let j = i + 1; j < nodes.length; ++j) {
                         let nextNode = nodes[j];
-                        if (nextNode.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression) {
+                        if (nextNode.type === WI.ScriptSyntaxTree.NodeType.MemberExpression) {
                             memberExpressionNode = nextNode;
                             if (offset === memberExpressionNode.range[1])
                                 continue;
@@ -1540,7 +1540,7 @@
         this._issuesLineNumberMap.clear();
         this._clearIssueWidgets();
 
-        let issues = WebInspector.issueManager.issuesForSourceCode(this._sourceCode);
+        let issues = WI.issueManager.issuesForSourceCode(this._sourceCode);
         for (let issue of issues)
             this._addIssue(issue);
     }
@@ -1560,8 +1560,8 @@
         // Clear other maps.
         this._threadTargetMap.clear();
 
-        if (WebInspector.targets.size > 1) {
-            for (let target of WebInspector.targets)
+        if (WI.targets.size > 1) {
+            for (let target of WI.targets)
                 this._addThreadIndicatorForTarget(target);
         }
     }
@@ -1587,45 +1587,45 @@
 
     _sourceCodeSourceMapAdded(event)
     {
-        WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
-        this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+        WI.notifications.addEventListener(WI.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
+        this._sourceCode.removeEventListener(WI.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
 
         this._updateTokenTrackingControllerState();
     }
 
     _updateTokenTrackingControllerState()
     {
-        var mode = WebInspector.CodeMirrorTokenTrackingController.Mode.None;
-        if (WebInspector.debuggerManager.paused)
-            mode = WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression;
+        var mode = WI.CodeMirrorTokenTrackingController.Mode.None;
+        if (WI.debuggerManager.paused)
+            mode = WI.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression;
         else if (this._typeTokenAnnotator && this._typeTokenAnnotator.isActive())
-            mode = WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation;
+            mode = WI.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation;
         else if (this._hasColorMarkers())
-            mode = WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens;
-        else if ((this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length !== 0) && WebInspector.modifierKeys.metaKey && !WebInspector.modifierKeys.altKey && !WebInspector.modifierKeys.shiftKey)
-            mode = WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;
+            mode = WI.CodeMirrorTokenTrackingController.Mode.MarkedTokens;
+        else if ((this._sourceCode instanceof WI.SourceMapResource || this._sourceCode.sourceMaps.length !== 0) && WI.modifierKeys.metaKey && !WI.modifierKeys.altKey && !WI.modifierKeys.shiftKey)
+            mode = WI.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;
 
-        this.tokenTrackingController.enabled = mode !== WebInspector.CodeMirrorTokenTrackingController.Mode.None;
+        this.tokenTrackingController.enabled = mode !== WI.CodeMirrorTokenTrackingController.Mode.None;
 
         if (mode === this.tokenTrackingController.mode)
             return;
 
         switch (mode) {
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens:
+        case WI.CodeMirrorTokenTrackingController.Mode.MarkedTokens:
             this.tokenTrackingController.mouseOverDelayDuration = 0;
             this.tokenTrackingController.mouseOutReleaseDelayDuration = 0;
             break;
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:
+        case WI.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:
             this.tokenTrackingController.mouseOverDelayDuration = 0;
             this.tokenTrackingController.mouseOutReleaseDelayDuration = 0;
-            this.tokenTrackingController.classNameForHighlightedRange = WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;
+            this.tokenTrackingController.classNameForHighlightedRange = WI.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;
             this._dismissPopover();
             break;
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:
-        case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:
-            this.tokenTrackingController.mouseOverDelayDuration = WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken;
-            this.tokenTrackingController.mouseOutReleaseDelayDuration = WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease;
-            this.tokenTrackingController.classNameForHighlightedRange = WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName;
+        case WI.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:
+        case WI.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:
+            this.tokenTrackingController.mouseOverDelayDuration = WI.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken;
+            this.tokenTrackingController.mouseOutReleaseDelayDuration = WI.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease;
+            this.tokenTrackingController.classNameForHighlightedRange = WI.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName;
             break;
         }
 
@@ -1635,7 +1635,7 @@
     _hasColorMarkers()
     {
         for (var marker of this.markers) {
-            if (marker.type === WebInspector.TextMarker.Type.Color)
+            if (marker.type === WI.TextMarker.Type.Color)
                 return true;
         }
         return false;
@@ -1662,7 +1662,7 @@
 
     tokenTrackingControllerHighlightedRangeWasClicked(tokenTrackingController)
     {
-        if (this.tokenTrackingController.mode !== WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens)
+        if (this.tokenTrackingController.mode !== WI.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens)
             return;
 
         // Links are handled by TextEditor.
@@ -1675,30 +1675,30 @@
         };
 
         var sourceCodeLocation = this._sourceCodeLocationForEditorPosition(this.tokenTrackingController.candidate.hoveredTokenRange.start);
-        if (this.sourceCode instanceof WebInspector.SourceMapResource)
-            WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation, options);
+        if (this.sourceCode instanceof WI.SourceMapResource)
+            WI.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation, options);
         else
-            WebInspector.showSourceCodeLocation(sourceCodeLocation, options);
+            WI.showSourceCodeLocation(sourceCodeLocation, options);
     }
 
     tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
     {
-        if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens) {
+        if (this.tokenTrackingController.mode === WI.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens) {
             this.tokenTrackingController.highlightRange(candidate.hoveredTokenRange);
             return;
         }
 
-        if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression) {
+        if (this.tokenTrackingController.mode === WI.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression) {
             this._tokenTrackingControllerHighlightedJavaScriptExpression(candidate);
             return;
         }
 
-        if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation) {
+        if (this.tokenTrackingController.mode === WI.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation) {
             this._tokenTrackingControllerHighlightedJavaScriptTypeInformation(candidate);
             return;
         }
 
-        if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens) {
+        if (this.tokenTrackingController.mode === WI.CodeMirrorTokenTrackingController.Mode.MarkedTokens) {
             var markers = this.markersAtPosition(candidate.hoveredTokenRange.start);
             if (markers.length > 0)
                 this._tokenTrackingControllerHighlightedMarkedExpression(candidate, markers);
@@ -1724,7 +1724,7 @@
             if (candidate !== this.tokenTrackingController.candidate)
                 return;
 
-            let data = WebInspector.RemoteObject.fromPayload(result, this.target);
+            let data = WI.RemoteObject.fromPayload(result, this.target);
             switch (data.type) {
             case "function":
                 this._showPopoverForFunction(data);
@@ -1745,11 +1745,11 @@
             }
         }
 
-        let target = WebInspector.debuggerManager.activeCallFrame ? WebInspector.debuggerManager.activeCallFrame.target : this.target;
+        let target = WI.debuggerManager.activeCallFrame ? WI.debuggerManager.activeCallFrame.target : this.target;
         let expression = appendWebInspectorSourceURL(candidate.expression);
 
-        if (WebInspector.debuggerManager.activeCallFrame) {
-            target.DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId: WebInspector.debuggerManager.activeCallFrame.id, expression, objectGroup: "popover", doNotPauseOnExceptionsAndMuteConsole: true}, populate.bind(this), target.DebuggerAgent);
+        if (WI.debuggerManager.activeCallFrame) {
+            target.DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId: WI.debuggerManager.activeCallFrame.id, expression, objectGroup: "popover", doNotPauseOnExceptionsAndMuteConsole: true}, populate.bind(this), target.DebuggerAgent);
             return;
         }
 
@@ -1762,12 +1762,12 @@
         console.assert(candidate.expression);
 
         var sourceCode = this._sourceCode;
-        var sourceID = sourceCode instanceof WebInspector.Script ? sourceCode.id : sourceCode.scripts[0].id;
+        var sourceID = sourceCode instanceof WI.Script ? sourceCode.id : sourceCode.scripts[0].id;
         var range = candidate.hoveredTokenRange;
         var offset = this.currentPositionToOriginalOffset(range.start);
 
         var allRequests = [{
-            typeInformationDescriptor: WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,
+            typeInformationDescriptor: WI.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,
             sourceID,
             divot: offset
         }];
@@ -1783,9 +1783,9 @@
             if (!allTypes.length)
                 return;
 
-            var typeDescription = WebInspector.TypeDescription.fromPayload(allTypes[0]);
+            var typeDescription = WI.TypeDescription.fromPayload(allTypes[0]);
             if (typeDescription.valid) {
-                var popoverTitle = WebInspector.TypeTokenView.titleForPopover(WebInspector.TypeTokenView.TitleType.Variable, candidate.expression);
+                var popoverTitle = WI.TypeTokenView.titleForPopover(WI.TypeTokenView.TitleType.Variable, candidate.expression);
                 this.showPopoverForTypes(typeDescription, null, popoverTitle);
             }
         }
@@ -1806,15 +1806,15 @@
                 return;
 
             var rects = this.rectsForRange(candidate.hoveredTokenRange);
-            bounds = WebInspector.Rect.unionOfRects(rects);
+            bounds = WI.Rect.unionOfRects(rects);
 
             shouldHighlightRange = true;
         }
 
-        content.classList.add(WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName);
+        content.classList.add(WI.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName);
 
-        this._popover = this._popover || new WebInspector.Popover(this);
-        this._popover.presentNewContentWithFrame(content, bounds.pad(5), [WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MAX_X]);
+        this._popover = this._popover || new WI.Popover(this);
+        this._popover.presentNewContentWithFrame(content, bounds.pad(5), [WI.RectEdge.MIN_Y, WI.RectEdge.MAX_Y, WI.RectEdge.MAX_X]);
         if (shouldHighlightRange)
             this.tokenTrackingController.highlightRange(candidate.expressionRange);
 
@@ -1843,20 +1843,20 @@
 
             let title = document.createElement("div");
             title.classList.add("title");
-            title.textContent = response.name || response.displayName || WebInspector.UIString("(anonymous function)");
+            title.textContent = response.name || response.displayName || WI.UIString("(anonymous function)");
             content.appendChild(title);
 
             let location = response.location;
-            let sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId, this.target);
+            let sourceCode = WI.debuggerManager.scriptForIdentifier(location.scriptId, this.target);
             let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber);
-            let functionSourceCodeLink = WebInspector.createSourceCodeLocationLink(sourceCodeLocation);
+            let functionSourceCodeLink = WI.createSourceCodeLocationLink(sourceCodeLocation);
             title.appendChild(functionSourceCodeLink);
 
             let wrapper = document.createElement("div");
             wrapper.classList.add("body");
             content.appendChild(wrapper);
 
-            let codeMirror = WebInspector.CodeMirrorEditor.create(wrapper, {
+            let codeMirror = WI.CodeMirrorEditor.create(wrapper, {
                 mode: "text/javascript",
                 readOnly: "nocursor",
             });
@@ -1865,9 +1865,9 @@
             });
 
             const isModule = false;
-            const indentString = WebInspector.indentString();
+            const indentString = WI.indentString();
             const includeSourceMapData = false;
-            let workerProxy = WebInspector.FormatterWorkerProxy.singleton();
+            let workerProxy = WI.FormatterWorkerProxy.singleton();
             workerProxy.formatJavaScript(data.description, isModule, indentString, includeSourceMapData, ({formattedText}) => {
                 codeMirror.setValue(formattedText || data.description);
             });
@@ -1893,19 +1893,19 @@
                 if (!nodeId)
                     return;
 
-                var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+                var domNode = WI.domTreeManager.nodeForId(nodeId);
                 if (!domNode.ownerDocument)
                     return;
 
-                var goToButton = titleElement.appendChild(WebInspector.createGoToArrowButton());
+                var goToButton = titleElement.appendChild(WI.createGoToArrowButton());
                 goToButton.addEventListener("click", function() {
-                    WebInspector.domTreeManager.inspectElement(nodeId);
+                    WI.domTreeManager.inspectElement(nodeId);
                 });
             });
         }
 
         // FIXME: If this is a variable, it would be nice to put the variable name in the PropertyPath.
-        var objectTree = new WebInspector.ObjectTreeView(data);
+        var objectTree = new WI.ObjectTreeView(data);
         objectTree.showOnlyProperties();
         objectTree.expand();
 
@@ -1915,7 +1915,7 @@
 
         // Show the popover once we have the first set of properties for the object.
         var candidate = this.tokenTrackingController.candidate;
-        objectTree.addEventListener(WebInspector.ObjectTreeView.Event.Updated, function() {
+        objectTree.addEventListener(WI.ObjectTreeView.Event.Updated, function() {
             if (candidate === this.tokenTrackingController.candidate)
                 this._showPopover(content);
             objectTree.removeEventListener(null, null, this);
@@ -1924,7 +1924,7 @@
 
     _showPopoverWithFormattedValue(remoteObject)
     {
-        var content = WebInspector.FormattedValue.createElementForRemoteObject(remoteObject);
+        var content = WI.FormattedValue.createElementForRemoteObject(remoteObject);
         this._showPopover(content);
     }
 
@@ -1951,7 +1951,7 @@
     _trackPopoverEvents()
     {
         if (!this._popoverEventListeners)
-            this._popoverEventListeners = new WebInspector.EventListenerSet(this, "Popover listeners");
+            this._popoverEventListeners = new WI.EventListenerSet(this, "Popover listeners");
         if (!this._popoverEventListenersAreRegistered) {
             this._popoverEventListenersAreRegistered = true;
             this._popoverEventListeners.register(this._popover.element, "mouseover", this._popoverMouseover);
@@ -1996,7 +1996,7 @@
         // Look for the outermost editable marker.
         var editableMarker;
         for (var marker of markers) {
-            if (!marker.range || !Object.values(WebInspector.TextMarker.Type).includes(marker.type))
+            if (!marker.range || !Object.values(WI.TextMarker.Type).includes(marker.type))
                 continue;
 
             if (!editableMarker || (marker.range.startLine < editableMarker.range.startLine || (marker.range.startLine === editableMarker.range.startLine && marker.range.startColumn < editableMarker.range.startColumn)))
@@ -2017,7 +2017,7 @@
 
         this._editingController = this.editingControllerForMarker(editableMarker);
 
-        if (marker.type === WebInspector.TextMarker.Type.Color) {
+        if (marker.type === WI.TextMarker.Type.Color) {
             var color = this._editingController.value;
             if (!color || !color.valid) {
                 editableMarker.clear();
@@ -2083,7 +2083,7 @@
                 this._disableScrollEventsForTypeTokenAnnotator();
         }
 
-        WebInspector.showJavaScriptTypeInformationSetting.value = shouldActivate;
+        WI.showJavaScriptTypeInformationSetting.value = shouldActivate;
 
         this._updateTokenTrackingControllerState();
     }
@@ -2108,19 +2108,19 @@
                 this._disableScrollEventsForControlFlowAnnotator();
         }
 
-        WebInspector.enableControlFlowProfilerSetting.value = shouldActivate;
+        WI.enableControlFlowProfilerSetting.value = shouldActivate;
     }
 
     _getAssociatedScript(position)
     {
         let script = null;
 
-        if (this._sourceCode instanceof WebInspector.Script)
+        if (this._sourceCode instanceof WI.Script)
             script = this._sourceCode;
-        else if (this._sourceCode instanceof WebInspector.Resource && this._sourceCode.scripts.length) {
-            if (this._sourceCode.type === WebInspector.Resource.Type.Script)
+        else if (this._sourceCode instanceof WI.Resource && this._sourceCode.scripts.length) {
+            if (this._sourceCode.type === WI.Resource.Type.Script)
                 script = this._sourceCode.scripts[0];
-            else if (this._sourceCode.type === WebInspector.Resource.Type.Document && position) {
+            else if (this._sourceCode.type === WI.Resource.Type.Document && position) {
                 for (let inlineScript of this._sourceCode.scripts) {
                     if (inlineScript.range.contains(position.lineNumber, position.columnNumber)) {
                         if (isNaN(inlineScript.range.startOffset))
@@ -2145,7 +2145,7 @@
         if (!script)
             return;
 
-        this._typeTokenAnnotator = new WebInspector.TypeTokenAnnotator(this, script);
+        this._typeTokenAnnotator = new WI.TypeTokenAnnotator(this, script);
     }
 
     _createBasicBlockAnnotator()
@@ -2158,7 +2158,7 @@
         if (!script)
             return;
 
-        this._basicBlockAnnotator = new WebInspector.BasicBlockAnnotator(this, script);
+        this._basicBlockAnnotator = new WI.BasicBlockAnnotator(this, script);
     }
 
     _enableScrollEventsForTypeTokenAnnotator()
@@ -2205,7 +2205,7 @@
                 timeoutIdentifier = null;
                 if (this._typeTokenAnnotator)
                     this._typeTokenAnnotator.resume();
-            }, WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling);
+            }, WI.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling);
         };
 
         return scrollHandler;
@@ -2224,7 +2224,7 @@
                 timeoutIdentifier = null;
                 if (this._basicBlockAnnotator)
                     this._basicBlockAnnotator.resume();
-            }, WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling);
+            }, WI.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling);
         };
 
         return scrollHandler;
@@ -2233,8 +2233,8 @@
     _logCleared(event)
     {
         for (let lineNumber of this._issuesLineNumberMap.keys()) {
-            this.removeStyleClassFromLine(lineNumber, WebInspector.SourceCodeTextEditor.LineErrorStyleClassName);
-            this.removeStyleClassFromLine(lineNumber, WebInspector.SourceCodeTextEditor.LineWarningStyleClassName);
+            this.removeStyleClassFromLine(lineNumber, WI.SourceCodeTextEditor.LineErrorStyleClassName);
+            this.removeStyleClassFromLine(lineNumber, WI.SourceCodeTextEditor.LineWarningStyleClassName);
         }
 
         this._issuesLineNumberMap.clear();
@@ -2242,17 +2242,17 @@
     }
 };
 
-WebInspector.SourceCodeTextEditor.LineErrorStyleClassName = "error";
-WebInspector.SourceCodeTextEditor.LineWarningStyleClassName = "warning";
-WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName = "debugger-popover-content";
-WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName = "hovered-expression-highlight";
-WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken = 500;
-WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease = 1000;
-WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling = 100;
-WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol = Symbol("source-code-widget-contains-multiple-issues");
-WebInspector.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol = Symbol("source-code-widget-contains-multiple-threads");
+WI.SourceCodeTextEditor.LineErrorStyleClassName = "error";
+WI.SourceCodeTextEditor.LineWarningStyleClassName = "warning";
+WI.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName = "debugger-popover-content";
+WI.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName = "hovered-expression-highlight";
+WI.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken = 500;
+WI.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease = 1000;
+WI.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling = 100;
+WI.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol = Symbol("source-code-widget-contains-multiple-issues");
+WI.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol = Symbol("source-code-widget-contains-multiple-threads");
 
-WebInspector.SourceCodeTextEditor.Event = {
+WI.SourceCodeTextEditor.Event = {
     ContentWillPopulate: "source-code-text-editor-content-will-populate",
     ContentDidPopulate: "source-code-text-editor-content-did-populate"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js
index 6909401..ef6011e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTimelineTimelineDataGridNode = class SourceCodeTimelineTimelineDataGridNode extends WebInspector.TimelineDataGridNode
+WI.SourceCodeTimelineTimelineDataGridNode = class SourceCodeTimelineTimelineDataGridNode extends WI.TimelineDataGridNode
 {
     constructor(sourceCodeTimeline, graphDataSource)
     {
         super(true, graphDataSource);
 
         this._sourceCodeTimeline = sourceCodeTimeline;
-        this._sourceCodeTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._timelineRecordAdded, this);
+        this._sourceCodeTimeline.addEventListener(WI.Timeline.Event.RecordAdded, this._timelineRecordAdded, this);
     }
 
     // Public
@@ -85,14 +85,14 @@
         if (sourceCodeLocation) {
             let subtitleElement = document.createElement("span");
             subtitleElement.classList.add("subtitle");
-            sourceCodeLocation.populateLiveDisplayLocationString(subtitleElement, "textContent", null, WebInspector.SourceCodeLocation.NameStyle.None, WebInspector.UIString("line "));
+            sourceCodeLocation.populateLiveDisplayLocationString(subtitleElement, "textContent", null, WI.SourceCodeLocation.NameStyle.None, WI.UIString("line "));
 
             const options = {
                 useGoToArrowButton: true,
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             };
-            let goToArrowButtonLink = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, options);
+            let goToArrowButtonLink = WI.createSourceCodeLocationLink(sourceCodeLocation, options);
             fragment.append(goToArrowButtonLink, subtitleElement);
 
             // Give the whole cell a tooltip and keep it up to date.
diff --git a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTreeElement.js
index 162b57b..f7bb5fb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTimelineTreeElement = class SourceCodeTimelineTreeElement extends WebInspector.TimelineRecordTreeElement
+WI.SourceCodeTimelineTreeElement = class SourceCodeTimelineTreeElement extends WI.TimelineRecordTreeElement
 {
     constructor(sourceCodeTimeline, subtitleNameStyle, includeDetailsInMainTitle)
     {
         console.assert(sourceCodeTimeline);
 
-        subtitleNameStyle = subtitleNameStyle || WebInspector.SourceCodeLocation.NameStyle.None;
+        subtitleNameStyle = subtitleNameStyle || WI.SourceCodeLocation.NameStyle.None;
 
         super(sourceCodeTimeline.records[0], subtitleNameStyle, includeDetailsInMainTitle, sourceCodeTimeline.sourceCodeLocation, sourceCodeTimeline);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
index 8774925..31c3c9c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTreeElement = class SourceCodeTreeElement extends WebInspector.FolderizedTreeElement
+WI.SourceCodeTreeElement = class SourceCodeTreeElement extends WI.FolderizedTreeElement
 {
     constructor(sourceCode, classNames, title, subtitle, representedObject)
     {
-        console.assert(sourceCode instanceof WebInspector.SourceCode);
+        console.assert(sourceCode instanceof WI.SourceCode);
 
         super(classNames, title, subtitle, representedObject || sourceCode);
 
@@ -80,7 +80,7 @@
             components.push(topFolder.mainTitle);
 
             var folderName = components.reverse().join("/");
-            var newFolder = new WebInspector.FolderTreeElement(folderName);
+            var newFolder = new WI.FolderTreeElement(folderName);
 
             var folderIndex = topFolder.parent.children.indexOf(topFolder);
             topFolder.parent.insertChild(newFolder, folderIndex);
@@ -94,7 +94,7 @@
 
         function findAndCombineFolderChains(treeElement, previousSingleTreeElement)
         {
-            if (!(treeElement instanceof WebInspector.FolderTreeElement)) {
+            if (!(treeElement instanceof WI.FolderTreeElement)) {
                 if (previousSingleTreeElement && previousSingleTreeElement !== treeElement.parent)
                     combineFolderChain(previousSingleTreeElement, treeElement.parent);
                 return;
@@ -119,8 +119,8 @@
                 var sourceMapResource = sourceMap.resources[j];
                 var relativeSubpath = sourceMapResource.sourceMapDisplaySubpath;
                 var folderTreeElement = this.createFoldersAsNeededForSubpath(relativeSubpath);
-                var sourceMapTreeElement = new WebInspector.SourceMapResourceTreeElement(sourceMapResource);
-                folderTreeElement.insertChild(sourceMapTreeElement, insertionIndexForObjectInListSortedByFunction(sourceMapTreeElement, folderTreeElement.children, WebInspector.ResourceTreeElement.compareFolderAndResourceTreeElements));
+                var sourceMapTreeElement = new WI.SourceMapResourceTreeElement(sourceMapResource);
+                folderTreeElement.insertChild(sourceMapTreeElement, insertionIndexForObjectInListSortedByFunction(sourceMapTreeElement, folderTreeElement.children, WI.ResourceTreeElement.compareFolderAndResourceTreeElements));
             }
         }
 
@@ -155,11 +155,11 @@
                 continue;
             }
 
-            var newFolder = new WebInspector.FolderTreeElement(componentName);
+            var newFolder = new WI.FolderTreeElement(componentName);
             newFolder.__path = currentPath;
             this._subpathFolderTreeElementMap[currentPath] = newFolder;
 
-            var index = insertionIndexForObjectInListSortedByFunction(newFolder, currentFolderTreeElement.children, WebInspector.ResourceTreeElement.compareFolderAndResourceTreeElements);
+            var index = insertionIndexForObjectInListSortedByFunction(newFolder, currentFolderTreeElement.children, WI.ResourceTreeElement.compareFolderAndResourceTreeElements);
             currentFolderTreeElement.insertChild(newFolder, index);
             currentFolderTreeElement = newFolder;
         }
@@ -179,7 +179,7 @@
         let wasSelected = childTreeElement.selected;
 
         parentTreeElement.removeChild(childTreeElement, true, true);
-        parentTreeElement.insertChild(childTreeElement, insertionIndexForObjectInListSortedByFunction(childTreeElement, parentTreeElement.children, WebInspector.ResourceTreeElement.compareFolderAndResourceTreeElements));
+        parentTreeElement.insertChild(childTreeElement, insertionIndexForObjectInListSortedByFunction(childTreeElement, parentTreeElement.children, WI.ResourceTreeElement.compareFolderAndResourceTreeElements));
 
         if (wasParentExpanded)
             parentTreeElement.expand();
@@ -191,16 +191,16 @@
 
     _updateSourceCode(sourceCode)
     {
-        console.assert(sourceCode instanceof WebInspector.SourceCode);
+        console.assert(sourceCode instanceof WI.SourceCode);
 
         if (this._sourceCode === sourceCode)
             return;
 
         if (this._sourceCode)
-            this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this.updateSourceMapResources, this);
+            this._sourceCode.removeEventListener(WI.SourceCode.Event.SourceMapAdded, this.updateSourceMapResources, this);
 
         this._sourceCode = sourceCode;
-        this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this.updateSourceMapResources, this);
+        this._sourceCode.addEventListener(WI.SourceCode.Event.SourceMapAdded, this.updateSourceMapResources, this);
 
         this.updateSourceMapResources();
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/SourceMapResourceTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/SourceMapResourceTreeElement.js
index 9005818a..62b29c5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SourceMapResourceTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SourceMapResourceTreeElement.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceMapResourceTreeElement = class SourceMapResourceTreeElement extends WebInspector.ResourceTreeElement
+WI.SourceMapResourceTreeElement = class SourceMapResourceTreeElement extends WI.ResourceTreeElement
 {
     constructor(sourceMapResource)
     {
-        console.assert(sourceMapResource instanceof WebInspector.SourceMapResource);
+        console.assert(sourceMapResource instanceof WI.SourceMapResource);
 
         super(sourceMapResource);
 
@@ -46,7 +46,7 @@
         // Show the host as the subtitle if it is different from the originalSourceCode's host.
         var sourceMapHost = this.resource.urlComponents.host;
         var originalHost = this.resource.sourceMap.originalSourceCode.urlComponents.host;
-        var subtitle = sourceMapHost !== originalHost ? WebInspector.displayNameForHost(sourceMapHost) : null;
+        var subtitle = sourceMapHost !== originalHost ? WI.displayNameForHost(sourceMapHost) : null;
         this.subtitle = this.mainTitle !== subtitle ? subtitle : null;
 
         if (oldMainTitle !== this.mainTitle)
diff --git a/Source/WebInspectorUI/UserInterface/Views/SpanningDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/SpanningDataGridNode.js
index c281a36..75aae70 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SpanningDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SpanningDataGridNode.js
@@ -23,18 +23,18 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SpanningDataGridNode = class SpanningDataGridNode extends WebInspector.DataGridNode
+WI.SpanningDataGridNode = class SpanningDataGridNode extends WI.DataGridNode
 {
     constructor(text)
     {
-        super({[WebInspector.SpanningDataGridNode.ColumnIdentifier]: text});
+        super({[WI.SpanningDataGridNode.ColumnIdentifier]: text});
     }
 
     // Public
 
     createCells()
     {
-        let cellElement = this.createCell(WebInspector.SpanningDataGridNode.ColumnIdentifier);
+        let cellElement = this.createCell(WI.SpanningDataGridNode.ColumnIdentifier);
         cellElement.classList.add("spanning");
         cellElement.setAttribute("colspan", this.dataGrid.columns.size);
 
@@ -42,4 +42,4 @@
     }
 };
 
-WebInspector.SpanningDataGridNode.ColumnIdentifier = "spanning-text";
+WI.SpanningDataGridNode.ColumnIdentifier = "spanning-text";
diff --git a/Source/WebInspectorUI/UserInterface/Views/SpringEditor.js b/Source/WebInspectorUI/UserInterface/Views/SpringEditor.js
index 13023b2..5b1114f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SpringEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SpringEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SpringEditor = class SpringEditor extends WebInspector.Object
+WI.SpringEditor = class SpringEditor extends WI.Object
 {
     constructor()
     {
@@ -33,7 +33,7 @@
         this._element.classList.add("spring-editor");
 
         this._previewContainer = this._element.createChild("div", "spring-preview");
-        this._previewContainer.title = WebInspector.UIString("Restart animation");
+        this._previewContainer.title = WI.UIString("Restart animation");
         this._previewContainer.addEventListener("mousedown", this._resetPreviewAnimation.bind(this));
 
         this._previewElement = this._previewContainer.createChild("div");
@@ -65,18 +65,18 @@
             this[inputKey].addEventListener("keydown", this._handleNumberInputKeydown.bind(this));
         }
 
-        createInputsForParameter.call(this, "mass", WebInspector.UIString("Mass"));
+        createInputsForParameter.call(this, "mass", WI.UIString("Mass"));
         this._massInput.min = this._massSlider.min = 1;
 
-        createInputsForParameter.call(this, "stiffness", WebInspector.UIString("Stiffness"));
+        createInputsForParameter.call(this, "stiffness", WI.UIString("Stiffness"));
         this._stiffnessInput.min = this._stiffnessSlider.min = 1;
 
-        createInputsForParameter.call(this, "damping", WebInspector.UIString("Damping"));
+        createInputsForParameter.call(this, "damping", WI.UIString("Damping"));
         this._dampingInput.min = this._dampingSlider.min = 0;
 
-        createInputsForParameter.call(this, "initialVelocity", WebInspector.UIString("Initial Velocity"));
+        createInputsForParameter.call(this, "initialVelocity", WI.UIString("Initial Velocity"));
 
-        this._spring = new WebInspector.Spring(1, 100, 10, 0);
+        this._spring = new WI.Spring(1, 100, 10, 0);
     }
 
     // Public
@@ -96,7 +96,7 @@
         if (!spring)
             return;
 
-        let isSpring = spring instanceof WebInspector.Spring;
+        let isSpring = spring instanceof WI.Spring;
         console.assert(isSpring);
         if (!isSpring)
             return;
@@ -191,11 +191,11 @@
             this._initialVelocityInput.value = this._initialVelocitySlider.value = this._spring.initialVelocity.maxDecimals(3);
             break;
         default:
-            WebInspector.reportInternalError("Input event fired for unrecognized element");
+            WI.reportInternalError("Input event fired for unrecognized element");
             return;
         }
 
-        this.dispatchEventToListeners(WebInspector.SpringEditor.Event.SpringChanged, {spring: this._spring});
+        this.dispatchEventToListeners(WI.SpringEditor.Event.SpringChanged, {spring: this._spring});
 
         this._resetPreviewAnimation();
     }
@@ -223,7 +223,7 @@
 
         this._timingContainer.classList.add("animate");
 
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL) {
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL) {
             this._previewElement.style.transform = "translateX(-85px)";
             this._timingElement.style.transform = "translateX(-170px)";
         } else {
@@ -243,6 +243,6 @@
     }
 };
 
-WebInspector.SpringEditor.Event = {
+WI.SpringEditor.Event = {
     SpringChanged: "spring-editor-spring-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/StackTraceView.js b/Source/WebInspectorUI/UserInterface/Views/StackTraceView.js
index 49a70fd..58f1be2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/StackTraceView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/StackTraceView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StackTraceView = class StackTraceView extends WebInspector.Object
+WI.StackTraceView = class StackTraceView extends WI.Object
 {
     constructor(stackTrace)
     {
@@ -35,10 +35,10 @@
         for (var callFrame of stackTrace.callFrames) {
             if (!callFrame.sourceCodeLocation && callFrame.functionName === null)
                 continue;
-            if (callFrame.isConsoleEvaluation && !WebInspector.isDebugUIEnabled())
+            if (callFrame.isConsoleEvaluation && !WI.isDebugUIEnabled())
                 continue;
 
-            var callFrameElement = new WebInspector.CallFrameView(callFrame, true);
+            var callFrameElement = new WI.CallFrameView(callFrame, true);
             element.appendChild(callFrameElement);
         }
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js b/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js
index 35defef..6454b59 100644
--- a/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js
+++ b/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js
@@ -44,7 +44,7 @@
 //      </svg>
 //  </div>
 
-WebInspector.StackedLineChart = class StackedLineChart
+WI.StackedLineChart = class StackedLineChart
 {
     constructor(size)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js
index aed389f..054e191 100644
--- a/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js
@@ -23,43 +23,43 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StorageSidebarPanel = class StorageSidebarPanel extends WebInspector.NavigationSidebarPanel
+WI.StorageSidebarPanel = class StorageSidebarPanel extends WI.NavigationSidebarPanel
 {
     constructor(contentBrowser)
     {
-        super("storage", WebInspector.UIString("Storage"));
+        super("storage", WI.UIString("Storage"));
 
         this.contentBrowser = contentBrowser;
 
-        this.filterBar.placeholder = WebInspector.UIString("Filter Storage List");
+        this.filterBar.placeholder = WI.UIString("Filter Storage List");
 
-        this._navigationBar = new WebInspector.NavigationBar;
+        this._navigationBar = new WI.NavigationBar;
         this.addSubview(this._navigationBar);
 
         var scopeItemPrefix = "storage-sidebar-";
         var scopeBarItems = [];
 
-        scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix + "type-all", WebInspector.UIString("All Storage"), true));
+        scopeBarItems.push(new WI.ScopeBarItem(scopeItemPrefix + "type-all", WI.UIString("All Storage"), true));
 
         var storageTypes = [
-            {identifier: "application-cache", title: WebInspector.UIString("Application Cache"), classes: [WebInspector.ApplicationCacheFrameTreeElement, WebInspector.ApplicationCacheManifestTreeElement]},
-            {identifier: "cookies", title: WebInspector.UIString("Cookies"), classes: [WebInspector.CookieStorageTreeElement]},
-            {identifier: "database", title: WebInspector.UIString("Databases"), classes: [WebInspector.DatabaseHostTreeElement, WebInspector.DatabaseTableTreeElement, WebInspector.DatabaseTreeElement]},
-            {identifier: "indexed-database", title: WebInspector.UIString("Indexed Databases"), classes: [WebInspector.IndexedDatabaseHostTreeElement, WebInspector.IndexedDatabaseObjectStoreTreeElement, WebInspector.IndexedDatabaseTreeElement]},
-            {identifier: "local-storage", title: WebInspector.UIString("Local Storage"), classes: [WebInspector.DOMStorageTreeElement], localStorage: true},
-            {identifier: "session-storage", title: WebInspector.UIString("Session Storage"), classes: [WebInspector.DOMStorageTreeElement], localStorage: false}
+            {identifier: "application-cache", title: WI.UIString("Application Cache"), classes: [WI.ApplicationCacheFrameTreeElement, WI.ApplicationCacheManifestTreeElement]},
+            {identifier: "cookies", title: WI.UIString("Cookies"), classes: [WI.CookieStorageTreeElement]},
+            {identifier: "database", title: WI.UIString("Databases"), classes: [WI.DatabaseHostTreeElement, WI.DatabaseTableTreeElement, WI.DatabaseTreeElement]},
+            {identifier: "indexed-database", title: WI.UIString("Indexed Databases"), classes: [WI.IndexedDatabaseHostTreeElement, WI.IndexedDatabaseObjectStoreTreeElement, WI.IndexedDatabaseTreeElement]},
+            {identifier: "local-storage", title: WI.UIString("Local Storage"), classes: [WI.DOMStorageTreeElement], localStorage: true},
+            {identifier: "session-storage", title: WI.UIString("Session Storage"), classes: [WI.DOMStorageTreeElement], localStorage: false}
         ];
 
         storageTypes.sort(function(a, b) { return a.title.extendedLocaleCompare(b.title); });
 
         for (var info of storageTypes) {
-            var scopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + info.identifier, info.title);
+            var scopeBarItem = new WI.ScopeBarItem(scopeItemPrefix + info.identifier, info.title);
             scopeBarItem.__storageTypeInfo = info;
             scopeBarItems.push(scopeBarItem);
         }
 
-        this._scopeBar = new WebInspector.ScopeBar("storage-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
-        this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+        this._scopeBar = new WI.ScopeBar("storage-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
+        this._scopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
 
         this._navigationBar.addNavigationItem(this._scopeBar);
 
@@ -77,32 +77,32 @@
         this._applicationCacheRootTreeElement = null;
         this._applicationCacheURLTreeElementMap = new Map;
 
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded, this._cookieStorageObjectWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasAdded, this._domStorageObjectWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected, this._domStorageObjectWasInspected, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasAdded, this._databaseWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasInspected, this._databaseWasInspected, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.IndexedDatabaseWasAdded, this._indexedDatabaseWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.Cleared, this._storageCleared, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.CookieStorageObjectWasAdded, this._cookieStorageObjectWasAdded, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.DOMStorageObjectWasAdded, this._domStorageObjectWasAdded, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.DOMStorageObjectWasInspected, this._domStorageObjectWasInspected, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.DatabaseWasAdded, this._databaseWasAdded, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.DatabaseWasInspected, this._databaseWasInspected, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.IndexedDatabaseWasAdded, this._indexedDatabaseWasAdded, this);
+        WI.storageManager.addEventListener(WI.StorageManager.Event.Cleared, this._storageCleared, this);
 
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestAdded, this._frameManifestAdded, this);
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved, this._frameManifestRemoved, this);
+        WI.applicationCacheManager.addEventListener(WI.ApplicationCacheManager.Event.FrameManifestAdded, this._frameManifestAdded, this);
+        WI.applicationCacheManager.addEventListener(WI.ApplicationCacheManager.Event.FrameManifestRemoved, this._frameManifestRemoved, this);
 
-        this.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this.contentTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
 
-        for (var domStorageObject of WebInspector.storageManager.domStorageObjects)
+        for (var domStorageObject of WI.storageManager.domStorageObjects)
             this._addDOMStorageObject(domStorageObject);
 
-        for (var cookieStorageObject of WebInspector.storageManager.cookieStorageObjects)
+        for (var cookieStorageObject of WI.storageManager.cookieStorageObjects)
             this._addCookieStorageObject(cookieStorageObject);
 
-        for (var database of WebInspector.storageManager.databases)
+        for (var database of WI.storageManager.databases)
             this._addDatabase(database);
 
-        for (var indexedDatabase of WebInspector.storageManager.indexedDatabases)
+        for (var indexedDatabase of WI.storageManager.indexedDatabases)
             this._addIndexedDatabase(indexedDatabase);
 
-        for (var applicationCacheObject of WebInspector.applicationCacheManager.applicationCacheObjects)
+        for (var applicationCacheObject of WI.applicationCacheManager.applicationCacheObjects)
             this._addFrameManifest(applicationCacheObject);
     }
 
@@ -122,8 +122,8 @@
     {
         super.closed();
 
-        WebInspector.storageManager.removeEventListener(null, null, this);
-        WebInspector.applicationCacheManager.removeEventListener(null, null, this);
+        WI.storageManager.removeEventListener(null, null, this);
+        WI.applicationCacheManager.removeEventListener(null, null, this);
     }
 
     // Protected
@@ -145,13 +145,13 @@
             return true;
 
         // Folders are hidden on the first pass, but visible childen under the folder will force the folder visible again.
-        if (treeElement instanceof WebInspector.FolderTreeElement)
+        if (treeElement instanceof WI.FolderTreeElement)
             return false;
 
         function match()
         {
             for (var constructor of selectedScopeBarItem.__storageTypeInfo.classes) {
-                if (constructor === WebInspector.DOMStorageTreeElement && treeElement instanceof constructor)
+                if (constructor === WI.DOMStorageTreeElement && treeElement instanceof constructor)
                     return treeElement.representedObject.isLocalStorage() === selectedScopeBarItem.__storageTypeInfo.localStorage;
                 if (treeElement instanceof constructor)
                     return true;
@@ -177,14 +177,14 @@
         if (!treeElement)
             return;
 
-        if (treeElement instanceof WebInspector.FolderTreeElement || treeElement instanceof WebInspector.DatabaseHostTreeElement ||
-            treeElement instanceof WebInspector.IndexedDatabaseHostTreeElement || treeElement instanceof WebInspector.ApplicationCacheManifestTreeElement)
+        if (treeElement instanceof WI.FolderTreeElement || treeElement instanceof WI.DatabaseHostTreeElement ||
+            treeElement instanceof WI.IndexedDatabaseHostTreeElement || treeElement instanceof WI.ApplicationCacheManifestTreeElement)
             return;
 
-        if (treeElement instanceof WebInspector.StorageTreeElement || treeElement instanceof WebInspector.DatabaseTableTreeElement ||
-            treeElement instanceof WebInspector.DatabaseTreeElement || treeElement instanceof WebInspector.ApplicationCacheFrameTreeElement ||
-            treeElement instanceof WebInspector.IndexedDatabaseTreeElement || treeElement instanceof WebInspector.IndexedDatabaseObjectStoreTreeElement || treeElement instanceof WebInspector.IndexedDatabaseObjectStoreIndexTreeElement) {
-            WebInspector.showRepresentedObject(treeElement.representedObject);
+        if (treeElement instanceof WI.StorageTreeElement || treeElement instanceof WI.DatabaseTableTreeElement ||
+            treeElement instanceof WI.DatabaseTreeElement || treeElement instanceof WI.ApplicationCacheFrameTreeElement ||
+            treeElement instanceof WI.IndexedDatabaseTreeElement || treeElement instanceof WI.IndexedDatabaseObjectStoreTreeElement || treeElement instanceof WI.IndexedDatabaseObjectStoreIndexTreeElement) {
+            WI.showRepresentedObject(treeElement.representedObject);
             return;
         }
 
@@ -198,12 +198,12 @@
 
     _addDOMStorageObject(domStorage)
     {
-        var storageElement = new WebInspector.DOMStorageTreeElement(domStorage);
+        var storageElement = new WI.DOMStorageTreeElement(domStorage);
 
         if (domStorage.isLocalStorage())
-            this._localStorageRootTreeElement = this._addStorageChild(storageElement, this._localStorageRootTreeElement, WebInspector.UIString("Local Storage"));
+            this._localStorageRootTreeElement = this._addStorageChild(storageElement, this._localStorageRootTreeElement, WI.UIString("Local Storage"));
         else
-            this._sessionStorageRootTreeElement = this._addStorageChild(storageElement, this._sessionStorageRootTreeElement, WebInspector.UIString("Session Storage"));
+            this._sessionStorageRootTreeElement = this._addStorageChild(storageElement, this._sessionStorageRootTreeElement, WI.UIString("Session Storage"));
     }
 
     _domStorageObjectWasInspected(event)
@@ -220,16 +220,16 @@
 
     _addDatabase(database)
     {
-        console.assert(database instanceof WebInspector.DatabaseObject);
+        console.assert(database instanceof WI.DatabaseObject);
 
         let databaseHostElement = this._databaseHostTreeElementMap.get(database.host);
         if (!databaseHostElement) {
-            databaseHostElement = new WebInspector.DatabaseHostTreeElement(database.host);
+            databaseHostElement = new WI.DatabaseHostTreeElement(database.host);
             this._databaseHostTreeElementMap.set(database.host, databaseHostElement);
-            this._databaseRootTreeElement = this._addStorageChild(databaseHostElement, this._databaseRootTreeElement, WebInspector.UIString("Databases"));
+            this._databaseRootTreeElement = this._addStorageChild(databaseHostElement, this._databaseRootTreeElement, WI.UIString("Databases"));
         }
 
-        let databaseElement = new WebInspector.DatabaseTreeElement(database);
+        let databaseElement = new WI.DatabaseTreeElement(database);
         databaseHostElement.appendChild(databaseElement);
     }
 
@@ -247,16 +247,16 @@
 
     _addIndexedDatabase(indexedDatabase)
     {
-        console.assert(indexedDatabase instanceof WebInspector.IndexedDatabase);
+        console.assert(indexedDatabase instanceof WI.IndexedDatabase);
 
         let indexedDatabaseHostElement = this._indexedDatabaseHostTreeElementMap.get(indexedDatabase.host);
         if (!indexedDatabaseHostElement) {
-            indexedDatabaseHostElement = new WebInspector.IndexedDatabaseHostTreeElement(indexedDatabase.host);
+            indexedDatabaseHostElement = new WI.IndexedDatabaseHostTreeElement(indexedDatabase.host);
             this._indexedDatabaseHostTreeElementMap.set(indexedDatabase.host, indexedDatabaseHostElement);
-            this._indexedDatabaseRootTreeElement = this._addStorageChild(indexedDatabaseHostElement, this._indexedDatabaseRootTreeElement, WebInspector.UIString("Indexed Databases"));
+            this._indexedDatabaseRootTreeElement = this._addStorageChild(indexedDatabaseHostElement, this._indexedDatabaseRootTreeElement, WI.UIString("Indexed Databases"));
         }
 
-        let indexedDatabaseElement = new WebInspector.IndexedDatabaseTreeElement(indexedDatabase);
+        let indexedDatabaseElement = new WI.IndexedDatabaseTreeElement(indexedDatabase);
         indexedDatabaseHostElement.appendChild(indexedDatabaseElement);
     }
 
@@ -267,10 +267,10 @@
 
     _addCookieStorageObject(cookieStorage)
     {
-        console.assert(cookieStorage instanceof WebInspector.CookieStorageObject);
+        console.assert(cookieStorage instanceof WI.CookieStorageObject);
 
-        var cookieElement = new WebInspector.CookieStorageTreeElement(cookieStorage);
-        this._cookieStorageRootTreeElement = this._addStorageChild(cookieElement, this._cookieStorageRootTreeElement, WebInspector.UIString("Cookies"));
+        var cookieElement = new WI.CookieStorageTreeElement(cookieStorage);
+        this._cookieStorageRootTreeElement = this._addStorageChild(cookieElement, this._cookieStorageRootTreeElement, WI.UIString("Cookies"));
     }
 
     _frameManifestAdded(event)
@@ -280,18 +280,18 @@
 
     _addFrameManifest(frameManifest)
     {
-        console.assert(frameManifest instanceof WebInspector.ApplicationCacheFrame);
+        console.assert(frameManifest instanceof WI.ApplicationCacheFrame);
 
         let manifest = frameManifest.manifest;
         let manifestURL = manifest.manifestURL;
         let applicationCacheManifestElement = this._applicationCacheURLTreeElementMap.get(manifestURL);
         if (!applicationCacheManifestElement) {
-            applicationCacheManifestElement = new WebInspector.ApplicationCacheManifestTreeElement(manifest);
+            applicationCacheManifestElement = new WI.ApplicationCacheManifestTreeElement(manifest);
             this._applicationCacheURLTreeElementMap.set(manifestURL, applicationCacheManifestElement);
-            this._applicationCacheRootTreeElement = this._addStorageChild(applicationCacheManifestElement, this._applicationCacheRootTreeElement, WebInspector.UIString("Application Cache"));
+            this._applicationCacheRootTreeElement = this._addStorageChild(applicationCacheManifestElement, this._applicationCacheRootTreeElement, WI.UIString("Application Cache"));
         }
 
-        let frameCacheElement = new WebInspector.ApplicationCacheFrameTreeElement(frameManifest);
+        let frameCacheElement = new WI.ApplicationCacheFrameTreeElement(frameManifest);
         applicationCacheManifestElement.appendChild(frameCacheElement);
     }
 
@@ -318,14 +318,14 @@
             return childElement;
         }
 
-        if (parentElement instanceof WebInspector.StorageTreeElement) {
+        if (parentElement instanceof WI.StorageTreeElement) {
             console.assert(parentElement.flattened);
 
             var previousOnlyChild = parentElement;
             previousOnlyChild.flattened = false;
             this.contentTreeOutline.removeChild(previousOnlyChild);
 
-            var folderElement = new WebInspector.FolderTreeElement(folderName);
+            var folderElement = new WI.FolderTreeElement(folderName);
             this.contentTreeOutline.insertChild(folderElement, insertionIndexForObjectInListSortedByFunction(folderElement, this.contentTreeOutline.children, this._compareTreeElements));
 
             folderElement.appendChild(previousOnlyChild);
@@ -334,7 +334,7 @@
             return folderElement;
         }
 
-        console.assert(parentElement instanceof WebInspector.FolderTreeElement);
+        console.assert(parentElement instanceof WI.FolderTreeElement);
         parentElement.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, parentElement.children, this._compareTreeElements));
 
         return parentElement;
diff --git a/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js
index de84e34..ccc13ce 100644
--- a/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js
@@ -23,22 +23,22 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StorageTabContentView = class StorageTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.StorageTabContentView = class StorageTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.StorageTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.ApplicationCacheDetailsSidebarPanel, WebInspector.IndexedDatabaseDetailsSidebarPanel];
+        let {image, title} = WI.StorageTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.ApplicationCacheDetailsSidebarPanel, WI.IndexedDatabaseDetailsSidebarPanel];
 
-        super(identifier || "storage", "storage", tabBarItem, WebInspector.StorageSidebarPanel, detailsSidebarPanelConstructors);
+        super(identifier || "storage", "storage", tabBarItem, WI.StorageSidebarPanel, detailsSidebarPanelConstructors);
     }
 
     static tabInfo()
     {
         return {
             image: "Images/Storage.svg",
-            title: WebInspector.UIString("Storage"),
+            title: WI.UIString("Storage"),
         };
     }
 
@@ -51,7 +51,7 @@
 
     get type()
     {
-        return WebInspector.StorageTabContentView.Type;
+        return WI.StorageTabContentView.Type;
     }
 
     get supportsSplitContentBrowser()
@@ -61,11 +61,11 @@
 
     canShowRepresentedObject(representedObject)
     {
-        return representedObject instanceof WebInspector.DOMStorageObject || representedObject instanceof WebInspector.CookieStorageObject ||
-            representedObject instanceof WebInspector.DatabaseTableObject || representedObject instanceof WebInspector.DatabaseObject ||
-            representedObject instanceof WebInspector.ApplicationCacheFrame || representedObject instanceof WebInspector.IndexedDatabaseObjectStore ||
-            representedObject instanceof WebInspector.IndexedDatabase || representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex;
+        return representedObject instanceof WI.DOMStorageObject || representedObject instanceof WI.CookieStorageObject ||
+            representedObject instanceof WI.DatabaseTableObject || representedObject instanceof WI.DatabaseObject ||
+            representedObject instanceof WI.ApplicationCacheFrame || representedObject instanceof WI.IndexedDatabaseObjectStore ||
+            representedObject instanceof WI.IndexedDatabase || representedObject instanceof WI.IndexedDatabaseObjectStoreIndex;
     }
 };
 
-WebInspector.StorageTabContentView.Type = "storage";
+WI.StorageTabContentView.Type = "storage";
diff --git a/Source/WebInspectorUI/UserInterface/Views/StorageTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/StorageTreeElement.js
index f02aea9..ab3c92e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/StorageTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/StorageTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StorageTreeElement = class StorageTreeElement extends WebInspector.GeneralTreeElement
+WI.StorageTreeElement = class StorageTreeElement extends WI.GeneralTreeElement
 {
     constructor(classNames, title, representedObject)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js b/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js
index 6ae8e32..98fd60b 100644
--- a/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.StyleDetailsPanel = class StyleDetailsPanel extends WebInspector.View
+WI.StyleDetailsPanel = class StyleDetailsPanel extends WI.View
 {
     constructor(delegate, className, identifier, label)
     {
@@ -80,18 +80,18 @@
 
         if (!this._nodeStyles || this._nodeStyles.node !== domNode) {
             if (this._nodeStyles) {
-                this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, this.nodeStylesRefreshed, this);
-                this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
+                this._nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, this.nodeStylesRefreshed, this);
+                this._nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
             }
 
-            this._nodeStyles = WebInspector.cssStyleManager.stylesForNode(domNode);
+            this._nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
 
             console.assert(this._nodeStyles);
             if (!this._nodeStyles)
                 return;
 
-            this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, this.nodeStylesRefreshed, this);
-            this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
+            this._nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, this.nodeStylesRefreshed, this);
+            this._nodeStyles.addEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
 
             this._forceSignificantChange = true;
         }
@@ -103,7 +103,7 @@
     refresh(significantChange)
     {
         // Implemented by subclasses.
-        this.dispatchEventToListeners(WebInspector.StyleDetailsPanel.Event.Refreshed);
+        this.dispatchEventToListeners(WI.StyleDetailsPanel.Event.Refreshed);
     }
 
     // Protected
@@ -118,9 +118,9 @@
 
     get _initialScrollOffset()
     {
-        if (!WebInspector.cssStyleManager.canForcePseudoClasses())
+        if (!WI.cssStyleManager.canForcePseudoClasses())
             return 0;
-        return this.nodeStyles.node.enabledPseudoClasses.length ? 0 : WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;
+        return this.nodeStyles.node.enabledPseudoClasses.length ? 0 : WI.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;
     }
 
     _refreshNodeStyles()
@@ -157,6 +157,6 @@
     }
 };
 
-WebInspector.StyleDetailsPanel.Event = {
+WI.StyleDetailsPanel.Event = {
     Refreshed: "style-details-panel-refreshed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingSupport.js b/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingSupport.js
index 5181887..51fb29c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingSupport.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingSupport.js
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SyntaxHighlightedStyleClassName = "syntax-highlighted";
+WI.SyntaxHighlightedStyleClassName = "syntax-highlighted";
 
-WebInspector.syntaxHighlightStringAsDocumentFragment = function(string, mimeType, baseURL)
+WI.syntaxHighlightStringAsDocumentFragment = function(string, mimeType, baseURL)
 {
     var resultFragment = document.createDocumentFragment();
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/TabBar.js b/Source/WebInspectorUI/UserInterface/Views/TabBar.js
index 7091331..88443a4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TabBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TabBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TabBar = class TabBar extends WebInspector.View
+WI.TabBar = class TabBar extends WI.View
 {
     constructor(element, tabBarItems)
     {
@@ -44,9 +44,9 @@
                 this.addTabBarItem(tabBarItem);
         }
 
-        this.addTabBarItem(WebInspector.settingsTabContentView.tabBarItem, {suppressAnimations: true});
+        this.addTabBarItem(WI.settingsTabContentView.tabBarItem, {suppressAnimations: true});
 
-        this._newTabTabBarItem = new WebInspector.PinnedTabBarItem("Images/NewTabPlus.svg", WebInspector.UIString("Create a new tab"));
+        this._newTabTabBarItem = new WI.PinnedTabBarItem("Images/NewTabPlus.svg", WI.UIString("Create a new tab"));
         this._newTabTabBarItem.element.addEventListener("mouseenter", this._handleNewTabMouseEnter.bind(this));
         this._newTabTabBarItem.element.addEventListener("click", this._handleNewTabClick.bind(this));
         this.addTabBarItem(this._newTabTabBarItem, {suppressAnimations: true});
@@ -58,7 +58,7 @@
 
     updateNewTabTabBarItemState()
     {
-        let newTabExists = !WebInspector.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type);
+        let newTabExists = !WI.isNewTabWithTypeAllowed(WI.NewTabContentView.Type);
         this._newTabTabBarItem.disabled = newTabExists;
     }
 
@@ -69,8 +69,8 @@
 
     insertTabBarItem(tabBarItem, index, options = {})
     {
-        console.assert(tabBarItem instanceof WebInspector.TabBarItem);
-        if (!(tabBarItem instanceof WebInspector.TabBarItem))
+        console.assert(tabBarItem instanceof WI.TabBarItem);
+        if (!(tabBarItem instanceof WI.TabBarItem))
             return null;
 
         if (tabBarItem.parentTabBar === this)
@@ -163,10 +163,10 @@
         } else
             this.needsLayout();
 
-        if (!(tabBarItem instanceof WebInspector.PinnedTabBarItem))
+        if (!(tabBarItem instanceof WI.PinnedTabBarItem))
             this.updateNewTabTabBarItemState();
 
-        this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemAdded, {tabBarItem});
+        this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemAdded, {tabBarItem});
 
         return tabBarItem;
     }
@@ -174,7 +174,7 @@
     removeTabBarItem(tabBarItemOrIndex, options = {})
     {
         let tabBarItem = this._findTabBarItem(tabBarItemOrIndex);
-        if (!tabBarItem || tabBarItem instanceof WebInspector.PinnedTabBarItem)
+        if (!tabBarItem || tabBarItem instanceof WI.PinnedTabBarItem)
             return null;
 
         tabBarItem.parentTabBar = null;
@@ -182,7 +182,7 @@
         if (this._selectedTabBarItem === tabBarItem) {
             var index = this._tabBarItems.indexOf(tabBarItem);
             var nextTabBarItem = this._tabBarItems[index + 1];
-            if (!nextTabBarItem || nextTabBarItem instanceof WebInspector.PinnedTabBarItem)
+            if (!nextTabBarItem || nextTabBarItem instanceof WI.PinnedTabBarItem)
                 nextTabBarItem = this._tabBarItems[index - 1];
 
             this.selectedTabBarItem = nextTabBarItem;
@@ -219,7 +219,7 @@
 
             this.updateNewTabTabBarItemState();
 
-            this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemRemoved, {tabBarItem});
+            this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemRemoved, {tabBarItem});
 
             if (shouldOpenDefaultTab)
                 this._openDefaultTab();
@@ -238,7 +238,7 @@
             // From left to right there is pinned tabs, extra space, then normal tabs. Compute
             // how much extra space we need to additionally add for normal tab items.
             let extraSpaceBetweenNormalAndPinnedTabs = 0;
-            if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL) {
+            if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL) {
                 extraSpaceBetweenNormalAndPinnedTabs = this.element.getBoundingClientRect().width;
                 for (let currentTabBarItem of this._tabBarItemsFromLeftToRight())
                     extraSpaceBetweenNormalAndPinnedTabs -= currentTabBarItem.element.getBoundingClientRect().width;
@@ -248,7 +248,7 @@
             for (let currentTabBarItem of this._tabBarItemsFromLeftToRight()) {
                 let sizeAndPosition = beforeTabSizesAndPositions.get(currentTabBarItem);
 
-                if (!(currentTabBarItem instanceof WebInspector.PinnedTabBarItem)) {
+                if (!(currentTabBarItem instanceof WI.PinnedTabBarItem)) {
                     currentTabBarItem.element.style.left = extraSpaceBetweenNormalAndPinnedTabs + left + "px";
                     left += sizeAndPosition.width;
                     lastNormalTabBarItem = currentTabBarItem;
@@ -295,7 +295,7 @@
 
         this.updateNewTabTabBarItemState();
 
-        this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemRemoved, {tabBarItem});
+        this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemRemoved, {tabBarItem});
 
         if (shouldOpenDefaultTab)
             this._openDefaultTab();
@@ -316,7 +316,7 @@
             else
                 newIndex--;
 
-            if (!(this._tabBarItems[newIndex] instanceof WebInspector.PinnedTabBarItem))
+            if (!(this._tabBarItems[newIndex] instanceof WI.PinnedTabBarItem))
                 break;
         } while (newIndex !== startIndex);
 
@@ -339,7 +339,7 @@
             else
                 newIndex++;
 
-            if (!(this._tabBarItems[newIndex] instanceof WebInspector.PinnedTabBarItem))
+            if (!(this._tabBarItems[newIndex] instanceof WI.PinnedTabBarItem))
                 break;
         } while (newIndex !== startIndex);
 
@@ -373,7 +373,7 @@
         if (this._selectedTabBarItem)
             this._selectedTabBarItem.selected = true;
 
-        this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemSelected);
+        this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemSelected);
     }
 
     get tabBarItems()
@@ -383,7 +383,7 @@
 
     get normalTabCount()
     {
-        return this._tabBarItems.filter((item) => !(item instanceof WebInspector.PinnedTabBarItem)).length;
+        return this._tabBarItems.filter((item) => !(item instanceof WI.PinnedTabBarItem)).length;
     }
 
     // Protected
@@ -398,7 +398,7 @@
 
         let firstNormalTabItem = null;
         for (let tabItem of this._tabBarItems) {
-            if (tabItem instanceof WebInspector.PinnedTabBarItem)
+            if (tabItem instanceof WI.PinnedTabBarItem)
                 continue;
 
             firstNormalTabItem = tabItem;
@@ -423,7 +423,7 @@
 
     _tabBarItemsFromLeftToRight()
     {
-        return WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.LTR ? this._tabBarItems : this._tabBarItems.slice().reverse();
+        return WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR ? this._tabBarItems : this._tabBarItems.slice().reverse();
     }
 
     _findTabBarItem(tabBarItemOrIndex)
@@ -431,7 +431,7 @@
         if (typeof tabBarItemOrIndex === "number")
             return this._tabBarItems[tabBarItemOrIndex] || null;
 
-        if (tabBarItemOrIndex instanceof WebInspector.TabBarItem) {
+        if (tabBarItemOrIndex instanceof WI.TabBarItem) {
             if (this._tabBarItems.includes(tabBarItemOrIndex))
                 return tabBarItemOrIndex;
         }
@@ -443,7 +443,7 @@
     {
         let normalTabCount = 0;
         for (let tabBarItem of this._tabBarItems) {
-            if (tabBarItem instanceof WebInspector.PinnedTabBarItem)
+            if (tabBarItem instanceof WI.PinnedTabBarItem)
                 continue;
 
             ++normalTabCount;
@@ -456,7 +456,7 @@
 
     _openDefaultTab()
     {
-        this.dispatchEventToListeners(WebInspector.TabBar.Event.OpenDefaultTab);
+        this.dispatchEventToListeners(WI.TabBar.Event.OpenDefaultTab);
     }
 
     _recordTabBarItemSizesAndPositions()
@@ -548,11 +548,11 @@
         if (event.button !== 0 || event.ctrlKey)
             return;
 
-        let itemElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.StyleClassName);
+        let itemElement = event.target.enclosingNodeOrSelfWithClass(WI.TabBarItem.StyleClassName);
         if (!itemElement)
             return;
 
-        let tabBarItem = itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];
+        let tabBarItem = itemElement[WI.TabBarItem.ElementReferenceSymbol];
         if (!tabBarItem)
             return;
 
@@ -562,18 +562,18 @@
         if (tabBarItem === this._newTabTabBarItem)
             return;
 
-        let closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);
+        let closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WI.TabBarItem.CloseButtonStyleClassName);
         if (closeButtonElement)
             return;
 
         this.selectedTabBarItem = tabBarItem;
 
-        if (tabBarItem instanceof WebInspector.PinnedTabBarItem || !this._hasMoreThanOneNormalTab())
+        if (tabBarItem instanceof WI.PinnedTabBarItem || !this._hasMoreThanOneNormalTab())
             return;
 
         this._firstNormalTabItemIndex = 0;
         for (let i = 0; i < this._tabBarItems.length; ++i) {
-            if (this._tabBarItems[i] instanceof WebInspector.PinnedTabBarItem)
+            if (this._tabBarItems[i] instanceof WI.PinnedTabBarItem)
                 continue;
 
             this._firstNormalTabItemIndex = i;
@@ -595,11 +595,11 @@
 
     _handleClick(event)
     {
-        var itemElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.StyleClassName);
+        var itemElement = event.target.enclosingNodeOrSelfWithClass(WI.TabBarItem.StyleClassName);
         if (!itemElement)
             return;
 
-        var tabBarItem = itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];
+        var tabBarItem = itemElement[WI.TabBarItem.ElementReferenceSymbol];
         if (!tabBarItem)
             return;
 
@@ -608,7 +608,7 @@
 
         const clickedMiddleButton = event.button === 1;
 
-        var closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);
+        var closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WI.TabBarItem.CloseButtonStyleClassName);
         if (closeButtonElement || clickedMiddleButton) {
             // Disallow closing the default tab if it is the only tab.
             if (tabBarItem.isDefaultTab && this.element.classList.contains("single-tab"))
@@ -621,7 +621,7 @@
 
             for (let i = this._tabBarItems.length - 1; i >= 0; --i) {
                 let item = this._tabBarItems[i];
-                if (item === tabBarItem || item instanceof WebInspector.PinnedTabBarItem)
+                if (item === tabBarItem || item instanceof WI.PinnedTabBarItem)
                     continue;
                 this.removeTabBarItem(item);
             }
@@ -731,7 +731,7 @@
         event.preventDefault();
         event.stopPropagation();
 
-        this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemsReordered);
+        this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemsReordered);
     }
 
     _handleMouseLeave(event)
@@ -752,7 +752,7 @@
 
     _handleNewTabClick(event)
     {
-        WebInspector.showNewTabTab();
+        WI.showNewTabTab();
     }
 
     _handleNewTabMouseEnter(event)
@@ -764,7 +764,7 @@
     }
 };
 
-WebInspector.TabBar.Event = {
+WI.TabBar.Event = {
     TabBarItemSelected: "tab-bar-tab-bar-item-selected",
     TabBarItemAdded: "tab-bar-tab-bar-item-added",
     TabBarItemRemoved: "tab-bar-tab-bar-item-removed",
diff --git a/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js b/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js
index 3182b95..e83b3d2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TabBarItem = class TabBarItem extends WebInspector.Object
+WI.TabBarItem = class TabBarItem extends WI.Object
 {
     constructor(image, title, representedObject)
     {
@@ -33,10 +33,10 @@
         this._parentTabBar = null;
 
         this._element = document.createElement("div");
-        this._element.classList.add(WebInspector.TabBarItem.StyleClassName);
+        this._element.classList.add(WI.TabBarItem.StyleClassName);
         this._element.setAttribute("role", "tab");
         this._element.tabIndex = 0;
-        this._element[WebInspector.TabBarItem.ElementReferenceSymbol] = this;
+        this._element[WI.TabBarItem.ElementReferenceSymbol] = this;
 
         this._element.createChild("div", "flex-space");
 
@@ -103,6 +103,6 @@
     set title(title) { this._element.title = title || ""; }
 };
 
-WebInspector.TabBarItem.StyleClassName = "item";
-WebInspector.TabBarItem.CloseButtonStyleClassName = "close";
-WebInspector.TabBarItem.ElementReferenceSymbol = Symbol("tab-bar-item");
+WI.TabBarItem.StyleClassName = "item";
+WI.TabBarItem.CloseButtonStyleClassName = "close";
+WI.TabBarItem.ElementReferenceSymbol = Symbol("tab-bar-item");
diff --git a/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js b/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js
index 257cc5f..9d1c176 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TabBrowser = class TabBrowser extends WebInspector.View
+WI.TabBrowser = class TabBrowser extends WI.View
 {
     constructor(element, tabBar, navigationSidebar, detailsSidebar)
     {
@@ -38,47 +38,47 @@
         this._detailsSidebar = detailsSidebar || null;
 
         if (this._navigationSidebar) {
-            this._navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange, this._sidebarCollapsedStateDidChange, this);
-            this._navigationSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
+            this._navigationSidebar.addEventListener(WI.Sidebar.Event.CollapsedStateDidChange, this._sidebarCollapsedStateDidChange, this);
+            this._navigationSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
         }
 
         if (this._detailsSidebar) {
-            this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange, this._sidebarCollapsedStateDidChange, this);
-            this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.SidebarPanelSelected, this._sidebarPanelSelected, this);
-            this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
+            this._detailsSidebar.addEventListener(WI.Sidebar.Event.CollapsedStateDidChange, this._sidebarCollapsedStateDidChange, this);
+            this._detailsSidebar.addEventListener(WI.Sidebar.Event.SidebarPanelSelected, this._sidebarPanelSelected, this);
+            this._detailsSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
         }
 
-        this._contentViewContainer = new WebInspector.ContentViewContainer;
+        this._contentViewContainer = new WI.ContentViewContainer;
         this.addSubview(this._contentViewContainer);
 
         let showNextTab = () => { this._showNextTab(); };
         let showPreviousTab = () => { this._showPreviousTab(); };
 
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
 
-        let nextKey1 = isRTL ? WebInspector.KeyboardShortcut.Key.LeftCurlyBrace : WebInspector.KeyboardShortcut.Key.RightCurlyBrace;
-        let previousKey1 = isRTL ? WebInspector.KeyboardShortcut.Key.RightCurlyBrace : WebInspector.KeyboardShortcut.Key.LeftCurlyBrace;
+        let nextKey1 = isRTL ? WI.KeyboardShortcut.Key.LeftCurlyBrace : WI.KeyboardShortcut.Key.RightCurlyBrace;
+        let previousKey1 = isRTL ? WI.KeyboardShortcut.Key.RightCurlyBrace : WI.KeyboardShortcut.Key.LeftCurlyBrace;
 
-        this._showNextTabKeyboardShortcut1 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, nextKey1, showNextTab);
-        this._showPreviousTabKeyboardShortcut1 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, previousKey1, showPreviousTab);
+        this._showNextTabKeyboardShortcut1 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, nextKey1, showNextTab);
+        this._showPreviousTabKeyboardShortcut1 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, previousKey1, showPreviousTab);
 
-        let nextModifier2 = isRTL ? WebInspector.KeyboardShortcut.Modifier.Shift : 0;
-        let previousModifier2 = isRTL ? 0 : WebInspector.KeyboardShortcut.Modifier.Shift;
+        let nextModifier2 = isRTL ? WI.KeyboardShortcut.Modifier.Shift : 0;
+        let previousModifier2 = isRTL ? 0 : WI.KeyboardShortcut.Modifier.Shift;
 
-        this._showNextTabKeyboardShortcut2 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control | nextModifier2, WebInspector.KeyboardShortcut.Key.Tab, showNextTab);
-        this._showPreviousTabKeyboardShortcut2 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control | previousModifier2, WebInspector.KeyboardShortcut.Key.Tab, showPreviousTab);
+        this._showNextTabKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control | nextModifier2, WI.KeyboardShortcut.Key.Tab, showNextTab);
+        this._showPreviousTabKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control | previousModifier2, WI.KeyboardShortcut.Key.Tab, showPreviousTab);
 
-        let previousTabKey = isRTL ? WebInspector.KeyboardShortcut.Key.Right : WebInspector.KeyboardShortcut.Key.Left;
-        let nextTabKey = isRTL ? WebInspector.KeyboardShortcut.Key.Left : WebInspector.KeyboardShortcut.Key.Right;
-        this._previousTabKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, previousTabKey, this._showPreviousTabCheckingForEditableField.bind(this));
+        let previousTabKey = isRTL ? WI.KeyboardShortcut.Key.Right : WI.KeyboardShortcut.Key.Left;
+        let nextTabKey = isRTL ? WI.KeyboardShortcut.Key.Left : WI.KeyboardShortcut.Key.Right;
+        this._previousTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, previousTabKey, this._showPreviousTabCheckingForEditableField.bind(this));
         this._previousTabKeyboardShortcut.implicitlyPreventsDefault = false;
-        this._nextTabKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, nextTabKey, this._showNextTabCheckingForEditableField.bind(this));
+        this._nextTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, nextTabKey, this._showNextTabCheckingForEditableField.bind(this));
         this._nextTabKeyboardShortcut.implicitlyPreventsDefault = false;
 
-        this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemSelected, this._tabBarItemSelected, this);
-        this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._tabBarItemAdded, this);
-        this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved, this._tabBarItemRemoved, this);
-        this._tabBar.newTabTabBarItem.addEventListener(WebInspector.PinnedTabBarItem.Event.ContextMenu, this._handleNewTabContextMenu, this);
+        this._tabBar.addEventListener(WI.TabBar.Event.TabBarItemSelected, this._tabBarItemSelected, this);
+        this._tabBar.addEventListener(WI.TabBar.Event.TabBarItemAdded, this._tabBarItemAdded, this);
+        this._tabBar.addEventListener(WI.TabBar.Event.TabBarItemRemoved, this._tabBarItemRemoved, this);
+        this._tabBar.newTabTabBarItem.addEventListener(WI.PinnedTabBarItem.Event.ContextMenu, this._handleNewTabContextMenu, this);
 
         this._recentTabContentViews = [];
         this._closedTabClasses = new Set;
@@ -123,10 +123,10 @@
         console.assert(!this.selectedTabContentView || this.selectedTabContentView === this._recentTabContentViews[0]);
 
         for (var tabContentView of this._recentTabContentViews) {
-            if (options.ignoreSearchTab && tabContentView instanceof WebInspector.SearchTabContentView)
+            if (options.ignoreSearchTab && tabContentView instanceof WI.SearchTabContentView)
                 continue;
 
-            if (options.ignoreNetworkTab && tabContentView instanceof WebInspector.NetworkTabContentView)
+            if (options.ignoreNetworkTab && tabContentView instanceof WI.NetworkTabContentView)
                 continue;
 
             if (tabContentView.canShowRepresentedObject(representedObject))
@@ -138,14 +138,14 @@
 
     addTabForContentView(tabContentView, options = {})
     {
-        console.assert(tabContentView instanceof WebInspector.TabContentView);
-        if (!(tabContentView instanceof WebInspector.TabContentView))
+        console.assert(tabContentView instanceof WI.TabContentView);
+        if (!(tabContentView instanceof WI.TabContentView))
             return false;
 
         let tabBarItem = tabContentView.tabBarItem;
 
-        console.assert(tabBarItem instanceof WebInspector.TabBarItem);
-        if (!(tabBarItem instanceof WebInspector.TabBarItem))
+        console.assert(tabBarItem instanceof WI.TabBarItem);
+        if (!(tabBarItem instanceof WI.TabBarItem))
             return false;
 
         if (tabBarItem.representedObject !== tabContentView)
@@ -194,12 +194,12 @@
 
     closeTabForContentView(tabContentView, options = {})
     {
-        console.assert(tabContentView instanceof WebInspector.TabContentView);
-        if (!(tabContentView instanceof WebInspector.TabContentView))
+        console.assert(tabContentView instanceof WI.TabContentView);
+        if (!(tabContentView instanceof WI.TabContentView))
             return false;
 
-        console.assert(tabContentView.tabBarItem instanceof WebInspector.TabBarItem);
-        if (!(tabContentView.tabBarItem instanceof WebInspector.TabBarItem))
+        console.assert(tabContentView.tabBarItem instanceof WI.TabBarItem);
+        if (!(tabContentView.tabBarItem instanceof WI.TabBarItem))
             return false;
 
         if (tabContentView.tabBarItem.parentTabBar !== this._tabBar)
@@ -217,11 +217,11 @@
 
     layout()
     {
-        if (this.layoutReason !== WebInspector.View.LayoutReason.Resize)
+        if (this.layoutReason !== WI.View.LayoutReason.Resize)
             return;
 
         for (let tabContentView of this._recentTabContentViews)
-            tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol] = tabContentView !== this.selectedTabContentView;
+            tabContentView[WI.TabBrowser.NeedsResizeLayoutSymbol] = tabContentView !== this.selectedTabContentView;
     }
 
     // Private
@@ -231,7 +231,7 @@
         let tabContentView = this._tabBar.selectedTabBarItem ? this._tabBar.selectedTabBarItem.representedObject : null;
 
         if (tabContentView) {
-            let isSettingsTab = tabContentView instanceof WebInspector.SettingsTabContentView;
+            let isSettingsTab = tabContentView instanceof WI.SettingsTabContentView;
             if (!isSettingsTab) {
                 this._recentTabContentViews.remove(tabContentView);
                 this._recentTabContentViews.unshift(tabContentView);
@@ -252,12 +252,12 @@
         this._showDetailsSidebarPanelsForTabContentView(tabContentView);
 
         // If the tab browser was resized prior to showing the tab, the new tab needs to perform a resize layout.
-        if (tabContentView && tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]) {
-            tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol] = false;
-            tabContentView.updateLayout(WebInspector.View.LayoutReason.Resize);
+        if (tabContentView && tabContentView[WI.TabBrowser.NeedsResizeLayoutSymbol]) {
+            tabContentView[WI.TabBrowser.NeedsResizeLayoutSymbol] = false;
+            tabContentView.updateLayout(WI.View.LayoutReason.Resize);
         }
 
-        this.dispatchEventToListeners(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange);
+        this.dispatchEventToListeners(WI.TabBrowser.Event.SelectedTabContentViewDidChange);
     }
 
     _tabBarItemAdded(event)
@@ -297,7 +297,7 @@
         // The array must be reversed because Sets insert into the end, and we want to display the
         // most recently closed item first (which is the last item added to the set).
         let closedTabClasses = Array.from(this._closedTabClasses).reverse();
-        let allTabClasses = Array.from(WebInspector.knownTabClasses());
+        let allTabClasses = Array.from(WI.knownTabClasses());
         let tabClassesToDisplay = closedTabClasses.concat(allTabClasses.filter((tabClass) => {
             if (closedTabClasses.includes(tabClass))
                 return false;
@@ -305,18 +305,18 @@
             if (tabClass.isEphemeral())
                 return false;
 
-            return WebInspector.isNewTabWithTypeAllowed(tabClass.Type);
+            return WI.isNewTabWithTypeAllowed(tabClass.Type);
         }));
         if (!tabClassesToDisplay.length)
             return;
 
         let contextMenu = event.data.contextMenu;
 
-        contextMenu.appendItem(WebInspector.UIString("Recently Closed Tabs"), null, true);
+        contextMenu.appendItem(WI.UIString("Recently Closed Tabs"), null, true);
 
         for (let tabClass of tabClassesToDisplay) {
             contextMenu.appendItem(tabClass.tabInfo().title, () => {
-                WebInspector.createNewTabWithType(tabClass.Type, {shouldShowNewTab: true});
+                WI.createNewTabWithType(tabClass.Type, {shouldShowNewTab: true});
             });
         }
     }
@@ -463,7 +463,7 @@
 
     _showNextTabCheckingForEditableField(event)
     {
-        if (WebInspector.isEventTargetAnEditableField(event))
+        if (WI.isEventTargetAnEditableField(event))
             return;
 
         this._showNextTab(event);
@@ -473,7 +473,7 @@
 
     _showPreviousTabCheckingForEditableField(event)
     {
-        if (WebInspector.isEventTargetAnEditableField(event))
+        if (WI.isEventTargetAnEditableField(event))
             return;
 
         this._showPreviousTab(event);
@@ -482,8 +482,8 @@
     }
 };
 
-WebInspector.TabBrowser.NeedsResizeLayoutSymbol = Symbol("needs-resize-layout");
+WI.TabBrowser.NeedsResizeLayoutSymbol = Symbol("needs-resize-layout");
 
-WebInspector.TabBrowser.Event = {
+WI.TabBrowser.Event = {
     SelectedTabContentViewDidChange: "tab-browser-selected-tab-content-view-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TabContentView.js b/Source/WebInspectorUI/UserInterface/Views/TabContentView.js
index 82aa506..66d78f63 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TabContentView.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TabContentView = class TabContentView extends WebInspector.ContentView
+WI.TabContentView = class TabContentView extends WI.ContentView
 {
     constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors)
     {
         console.assert(typeof identifier === "string");
         console.assert(typeof styleClassNames === "string" || styleClassNames.every((className) => typeof className === "string"));
-        console.assert(tabBarItem instanceof WebInspector.TabBarItem);
+        console.assert(tabBarItem instanceof WI.TabBarItem);
         console.assert(!navigationSidebarPanelConstructor || typeof navigationSidebarPanelConstructor === "function");
         console.assert(!detailsSidebarPanelConstructors || detailsSidebarPanelConstructors.every((detailsSidebarPanelConstructor) => typeof detailsSidebarPanelConstructor === "function"));
 
@@ -49,14 +49,14 @@
 
         const defaultSidebarWidth = 300;
 
-        this._navigationSidebarCollapsedSetting = new WebInspector.Setting(identifier + "-navigation-sidebar-collapsed", false);
-        this._navigationSidebarWidthSetting = new WebInspector.Setting(identifier + "-navigation-sidebar-width", defaultSidebarWidth);
+        this._navigationSidebarCollapsedSetting = new WI.Setting(identifier + "-navigation-sidebar-collapsed", false);
+        this._navigationSidebarWidthSetting = new WI.Setting(identifier + "-navigation-sidebar-width", defaultSidebarWidth);
 
-        this._detailsSidebarCollapsedSetting = new WebInspector.Setting(identifier + "-details-sidebar-collapsed", true);
-        this._detailsSidebarSelectedPanelSetting = new WebInspector.Setting(identifier + "-details-sidebar-selected-panel", null);
-        this._detailsSidebarWidthSetting = new WebInspector.Setting(identifier + "-details-sidebar-width", defaultSidebarWidth);
+        this._detailsSidebarCollapsedSetting = new WI.Setting(identifier + "-details-sidebar-collapsed", true);
+        this._detailsSidebarSelectedPanelSetting = new WI.Setting(identifier + "-details-sidebar-selected-panel", null);
+        this._detailsSidebarWidthSetting = new WI.Setting(identifier + "-details-sidebar-width", defaultSidebarWidth);
 
-        this._cookieSetting = new WebInspector.Setting(identifier + "-tab-cookie", {});
+        this._cookieSetting = new WI.Setting(identifier + "-tab-cookie", {});
     }
 
     static isTabAllowed()
@@ -132,7 +132,7 @@
         super.shown();
 
         if (this._shouldRestoreStateWhenShown)
-            this.restoreStateFromCookie(WebInspector.StateRestorationType.Delayed);
+            this.restoreStateFromCookie(WI.StateRestorationType.Delayed);
     }
 
     restoreStateFromCookie(restorationType)
@@ -145,9 +145,9 @@
         this._shouldRestoreStateWhenShown = false;
 
         var relaxMatchDelay = 0;
-        if (restorationType === WebInspector.StateRestorationType.Load)
+        if (restorationType === WI.StateRestorationType.Load)
             relaxMatchDelay = 1000;
-        else if (restorationType === WebInspector.StateRestorationType.Navigation)
+        else if (restorationType === WI.StateRestorationType.Navigation)
             relaxMatchDelay = 2000;
 
         let cookie = this._cookieSetting.value || {};
@@ -178,7 +178,7 @@
         if (!this._navigationSidebarPanelConstructor)
             return null;
         if (!this._navigationSidebarPanel)
-            this._navigationSidebarPanel = WebInspector.instanceForClass(this._navigationSidebarPanelConstructor);
+            this._navigationSidebarPanel = WI.instanceForClass(this._navigationSidebarPanelConstructor);
         return this._navigationSidebarPanel;
     }
 
@@ -188,7 +188,7 @@
     get detailsSidebarPanels()
     {
         if (!this._detailsSidebarPanels)
-            this._detailsSidebarPanels = this._detailsSidebarPanelConstructors.map(constructor => WebInspector.instanceForClass(constructor));
+            this._detailsSidebarPanels = this._detailsSidebarPanelConstructors.map(constructor => WI.instanceForClass(constructor));
 
         return this._detailsSidebarPanels;
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/TextContentView.js b/Source/WebInspectorUI/UserInterface/Views/TextContentView.js
index ab15444..9cff075 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TextContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TextContentView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextContentView = class TextContentView extends WebInspector.ContentView
+WI.TextContentView = class TextContentView extends WI.ContentView
 {
     constructor(string, mimeType)
     {
@@ -31,9 +31,9 @@
 
         this.element.classList.add("text");
 
-        this._textEditor = new WebInspector.TextEditor;
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
+        this._textEditor = new WI.TextEditor;
+        this._textEditor.addEventListener(WI.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
+        this._textEditor.addEventListener(WI.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
 
         this.addSubview(this._textEditor);
 
@@ -41,20 +41,20 @@
         this._textEditor.mimeType = mimeType;
         this._textEditor.string = string;
 
-        var toolTip = WebInspector.UIString("Pretty print");
-        var activatedToolTip = WebInspector.UIString("Original formatting");
-        this._prettyPrintButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("pretty-print", toolTip, activatedToolTip, "Images/NavigationItemCurleyBraces.svg", 13, 13);
-        this._prettyPrintButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._togglePrettyPrint, this);
+        var toolTip = WI.UIString("Pretty print");
+        var activatedToolTip = WI.UIString("Original formatting");
+        this._prettyPrintButtonNavigationItem = new WI.ActivateButtonNavigationItem("pretty-print", toolTip, activatedToolTip, "Images/NavigationItemCurleyBraces.svg", 13, 13);
+        this._prettyPrintButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePrettyPrint, this);
         this._prettyPrintButtonNavigationItem.enabled = this._textEditor.canBeFormatted();
 
-        var toolTipTypes = WebInspector.UIString("Show type information");
-        var activatedToolTipTypes = WebInspector.UIString("Hide type information");
-        this._showTypesButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-types", toolTipTypes, activatedToolTipTypes, "Images/NavigationItemTypes.svg", 13, 14);
+        var toolTipTypes = WI.UIString("Show type information");
+        var activatedToolTipTypes = WI.UIString("Hide type information");
+        this._showTypesButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-types", toolTipTypes, activatedToolTipTypes, "Images/NavigationItemTypes.svg", 13, 14);
         this._showTypesButtonNavigationItem.enabled = false;
 
-        let toolTipCodeCoverage = WebInspector.UIString("Fade unexecuted code");
-        let activatedToolTipCodeCoverage = WebInspector.UIString("Do not fade unexecuted code");
-        this._codeCoverageButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("code-coverage", toolTipCodeCoverage, activatedToolTipCodeCoverage, "Images/NavigationItemCodeCoverage.svg", 13, 14);
+        let toolTipCodeCoverage = WI.UIString("Fade unexecuted code");
+        let activatedToolTipCodeCoverage = WI.UIString("Do not fade unexecuted code");
+        this._codeCoverageButtonNavigationItem = new WI.ActivateButtonNavigationItem("code-coverage", toolTipCodeCoverage, activatedToolTipCodeCoverage, "Images/NavigationItemCodeCoverage.svg", 13, 14);
         this._codeCoverageButtonNavigationItem.enabled = false;
     }
 
@@ -103,7 +103,7 @@
 
     get saveData()
     {
-        var url = "web-inspector:///" + encodeURI(WebInspector.UIString("Untitled")) + ".txt";
+        var url = "web-inspector:///" + encodeURI(WI.UIString("Untitled")) + ".txt";
         return {url, content: this._textEditor.string, forceSaveAs: true};
     }
 
@@ -167,6 +167,6 @@
 
     _numberOfSearchResultsDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TextEditor.js b/Source/WebInspectorUI/UserInterface/Views/TextEditor.js
index 642e97a..5d1da6ad 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TextEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TextEditor.js
@@ -23,45 +23,45 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextEditor = class TextEditor extends WebInspector.View
+WI.TextEditor = class TextEditor extends WI.View
 {
     constructor(element, mimeType, delegate)
     {
         super(element);
 
-        this.element.classList.add("text-editor", WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add("text-editor", WI.SyntaxHighlightedStyleClassName);
 
-        this._codeMirror = WebInspector.CodeMirrorEditor.create(this.element, {
+        this._codeMirror = WI.CodeMirrorEditor.create(this.element, {
             readOnly: true,
-            indentWithTabs: WebInspector.settings.indentWithTabs.value,
-            indentUnit: WebInspector.settings.indentUnit.value,
-            tabSize: WebInspector.settings.tabSize.value,
+            indentWithTabs: WI.settings.indentWithTabs.value,
+            indentUnit: WI.settings.indentUnit.value,
+            tabSize: WI.settings.tabSize.value,
             lineNumbers: true,
-            lineWrapping: WebInspector.settings.enableLineWrapping.value,
+            lineWrapping: WI.settings.enableLineWrapping.value,
             matchBrackets: true,
             autoCloseBrackets: true,
-            showWhitespaceCharacters: WebInspector.settings.showWhitespaceCharacters.value,
+            showWhitespaceCharacters: WI.settings.showWhitespaceCharacters.value,
             styleSelectedText: true,
         });
 
-        WebInspector.settings.indentWithTabs.addEventListener(WebInspector.Setting.Event.Changed, (event) => {
-            this._codeMirror.setOption("indentWithTabs", WebInspector.settings.indentWithTabs.value);
+        WI.settings.indentWithTabs.addEventListener(WI.Setting.Event.Changed, (event) => {
+            this._codeMirror.setOption("indentWithTabs", WI.settings.indentWithTabs.value);
         });
 
-        WebInspector.settings.indentUnit.addEventListener(WebInspector.Setting.Event.Changed, (event) => {
-            this._codeMirror.setOption("indentUnit", WebInspector.settings.indentUnit.value);
+        WI.settings.indentUnit.addEventListener(WI.Setting.Event.Changed, (event) => {
+            this._codeMirror.setOption("indentUnit", WI.settings.indentUnit.value);
         });
 
-        WebInspector.settings.tabSize.addEventListener(WebInspector.Setting.Event.Changed, (event) => {
-            this._codeMirror.setOption("tabSize", WebInspector.settings.tabSize.value);
+        WI.settings.tabSize.addEventListener(WI.Setting.Event.Changed, (event) => {
+            this._codeMirror.setOption("tabSize", WI.settings.tabSize.value);
         });
 
-        WebInspector.settings.enableLineWrapping.addEventListener(WebInspector.Setting.Event.Changed, (event) => {
-            this._codeMirror.setOption("lineWrapping", WebInspector.settings.enableLineWrapping.value);
+        WI.settings.enableLineWrapping.addEventListener(WI.Setting.Event.Changed, (event) => {
+            this._codeMirror.setOption("lineWrapping", WI.settings.enableLineWrapping.value);
         });
 
-        WebInspector.settings.showWhitespaceCharacters.addEventListener(WebInspector.Setting.Event.Changed, (event) => {
-            this._codeMirror.setOption("showWhitespaceCharacters", WebInspector.settings.showWhitespaceCharacters.value);
+        WI.settings.showWhitespaceCharacters.addEventListener(WI.Setting.Event.Changed, (event) => {
+            this._codeMirror.setOption("showWhitespaceCharacters", WI.settings.showWhitespaceCharacters.value);
         });
 
         this._codeMirror.on("change", this._contentChanged.bind(this));
@@ -69,8 +69,8 @@
         this._codeMirror.on("gutterContextMenu", this._gutterContextMenu.bind(this));
         this._codeMirror.getScrollerElement().addEventListener("click", this._openClickedLinks.bind(this), true);
 
-        this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
-        this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
+        this._completionController = new WI.CodeMirrorCompletionController(this._codeMirror, this);
+        this._tokenTrackingController = new WI.CodeMirrorTokenTrackingController(this._codeMirror, this);
 
         this._initialStringNotSet = true;
 
@@ -313,7 +313,7 @@
                 numberOfSearchResultsDidChangeTimeout = null;
             }
 
-            this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);
+            this.dispatchEventToListeners(WI.TextEditor.Event.NumberOfSearchResultsDidChange);
         }
 
         function batchSearch()
@@ -324,7 +324,7 @@
 
             var newSearchResults = [];
             var foundResult = false;
-            for (var i = 0; i < WebInspector.TextEditor.NumberOfFindsPerSearchBatch && (foundResult = searchCursor.findNext()); ++i) {
+            for (var i = 0; i < WI.TextEditor.NumberOfFindsPerSearchBatch && (foundResult = searchCursor.findNext()); ++i) {
                 var textRange = this._textRangeFromCodeMirrorPosition(searchCursor.from(), searchCursor.to());
                 newSearchResults.push(textRange);
             }
@@ -364,7 +364,7 @@
 
         // Still dispatch the event even if the number didn't change. The execution state still
         // could have changed (e.g. continuing in a loop with a breakpoint inside).
-        this.dispatchEventToListeners(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange);
+        this.dispatchEventToListeners(WI.TextEditor.Event.ExecutionLineNumberDidChange);
     }
 
     addSearchResults(textRanges)
@@ -377,7 +377,7 @@
         {
             for (var i = 0; i < textRanges.length; ++i) {
                 var position = this._codeMirrorPositionFromTextRange(textRanges[i]);
-                var mark = this._codeMirror.markText(position.start, position.end, {className: WebInspector.TextEditor.SearchResultStyleClassName});
+                var mark = this._codeMirror.markText(position.start, position.end, {className: WI.TextEditor.SearchResultStyleClassName});
                 this._searchResults.push(mark);
             }
 
@@ -467,8 +467,8 @@
 
     revealPosition(position, textRangeToSelect, forceUnformatted, noHighlight)
     {
-        console.assert(position === undefined || position instanceof WebInspector.SourceCodePosition, "revealPosition called without a SourceCodePosition");
-        if (!(position instanceof WebInspector.SourceCodePosition))
+        console.assert(position === undefined || position instanceof WI.SourceCodePosition, "revealPosition called without a SourceCodePosition");
+        if (!(position instanceof WI.SourceCodePosition))
             return;
 
         if (!this._visible || this._initialStringNotSet || this._deferReveal) {
@@ -498,12 +498,12 @@
 
         if (!textRangeToSelect) {
             let column = Number.constrain(position.columnNumber, 0, this._codeMirror.getLine(line).length - 1);
-            textRangeToSelect = new WebInspector.TextRange(line, column, line, column);
+            textRangeToSelect = new WI.TextRange(line, column, line, column);
         }
 
         function removeStyleClass()
         {
-            this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.HighlightedStyleClassName);
+            this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.HighlightedStyleClassName);
         }
 
         function revealAndHighlightLine()
@@ -519,15 +519,15 @@
                 return;
 
             // Avoid highlighting the execution line while debugging.
-            if (WebInspector.debuggerManager.paused && line === this._executionLineNumber)
+            if (WI.debuggerManager.paused && line === this._executionLineNumber)
                 return;
 
-            this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.HighlightedStyleClassName);
+            this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.HighlightedStyleClassName);
 
             // Use a timeout instead of a animationEnd event listener because the line element might
             // be removed if the user scrolls during the animation. In that case animationEnd isn't
             // fired, and the line would highlight again the next time it scrolls into view.
-            setTimeout(removeStyleClass.bind(this), WebInspector.TextEditor.HighlightAnimationDuration);
+            setTimeout(removeStyleClass.bind(this), WI.TextEditor.HighlightAnimationDuration);
         }
 
         this._codeMirror.operation(revealAndHighlightLine.bind(this));
@@ -553,11 +553,11 @@
 
     close()
     {
-        WebInspector.settings.indentWithTabs.removeEventListener(null, null, this);
-        WebInspector.settings.indentUnit.removeEventListener(null, null, this);
-        WebInspector.settings.tabSize.removeEventListener(null, null, this);
-        WebInspector.settings.enableLineWrapping.removeEventListener(null, null, this);
-        WebInspector.settings.showWhitespaceCharacters.removeEventListener(null, null, this);
+        WI.settings.indentWithTabs.removeEventListener(null, null, this);
+        WI.settings.indentUnit.removeEventListener(null, null, this);
+        WI.settings.tabSize.removeEventListener(null, null, this);
+        WI.settings.enableLineWrapping.removeEventListener(null, null, this);
+        WI.settings.showWhitespaceCharacters.removeEventListener(null, null, this);
     }
 
     setBreakpointInfoForLineAndColumn(lineNumber, columnNumber, breakpointInfo)
@@ -623,7 +623,7 @@
 
         var widgetElement = document.createElement("div");
         var lineWidget = this._codeMirror.addLineWidget(lineHandle, widgetElement, {coverGutter: false, noHScroll: true});
-        return new WebInspector.LineWidget(lineWidget, widgetElement);
+        return new WI.LineWidget(lineWidget, widgetElement);
     }
 
     get lineCount()
@@ -648,12 +648,12 @@
 
     get markers()
     {
-        return this._codeMirror.getAllMarks().map(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker);
+        return this._codeMirror.getAllMarks().map(WI.TextMarker.textMarkerForCodeMirrorTextMarker);
     }
 
     markersAtPosition(position)
     {
-        return this._codeMirror.findMarksAt(position).map(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker);
+        return this._codeMirror.findMarksAt(position).map(WI.TextMarker.textMarkerForCodeMirrorTextMarker);
     }
 
     createColorMarkers(range)
@@ -679,16 +679,16 @@
     editingControllerForMarker(editableMarker)
     {
         switch (editableMarker.type) {
-        case WebInspector.TextMarker.Type.Color:
-            return new WebInspector.CodeMirrorColorEditingController(this._codeMirror, editableMarker);
-        case WebInspector.TextMarker.Type.Gradient:
-            return new WebInspector.CodeMirrorGradientEditingController(this._codeMirror, editableMarker);
-        case WebInspector.TextMarker.Type.CubicBezier:
-            return new WebInspector.CodeMirrorBezierEditingController(this._codeMirror, editableMarker);
-        case WebInspector.TextMarker.Type.Spring:
-            return new WebInspector.CodeMirrorSpringEditingController(this._codeMirror, editableMarker);
+        case WI.TextMarker.Type.Color:
+            return new WI.CodeMirrorColorEditingController(this._codeMirror, editableMarker);
+        case WI.TextMarker.Type.Gradient:
+            return new WI.CodeMirrorGradientEditingController(this._codeMirror, editableMarker);
+        case WI.TextMarker.Type.CubicBezier:
+            return new WI.CodeMirrorBezierEditingController(this._codeMirror, editableMarker);
+        case WI.TextMarker.Type.Spring:
+            return new WI.CodeMirrorSpringEditingController(this._codeMirror, editableMarker);
         default:
-            return new WebInspector.CodeMirrorEditingController(this._codeMirror, editableMarker);
+            return new WI.CodeMirrorEditingController(this._codeMirror, editableMarker);
         }
     }
 
@@ -803,7 +803,7 @@
             this._formatted = !!this._formatterSourceMap;
 
             if (this._formatted !== originalFormatted)
-                this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
+                this.dispatchEventToListeners(WI.TextEditor.Event.FormattingDidChange);
 
             return this._formatted;
         });
@@ -836,13 +836,13 @@
     _startWorkerPrettyPrint(beforePrettyPrintState, callback)
     {
         let sourceText = this._codeMirror.getValue();
-        let indentString = WebInspector.indentString();
+        let indentString = WI.indentString();
         const includeSourceMapData = true;
 
-        let sourceType = this._delegate ? this._delegate.textEditorScriptSourceType(this) : WebInspector.Script.SourceType.Program;
-        const isModule = sourceType === WebInspector.Script.SourceType.Module;
+        let sourceType = this._delegate ? this._delegate.textEditorScriptSourceType(this) : WI.Script.SourceType.Program;
+        const isModule = sourceType === WI.Script.SourceType.Module;
 
-        let workerProxy = WebInspector.FormatterWorkerProxy.singleton();
+        let workerProxy = WI.FormatterWorkerProxy.singleton();
         workerProxy.formatJavaScript(sourceText, isModule, indentString, includeSourceMapData, ({formattedText, sourceMapData}) => {
             // Handle if formatting failed, which is possible for invalid programs.
             if (formattedText === null) {
@@ -855,11 +855,11 @@
 
     _startCodeMirrorPrettyPrint(beforePrettyPrintState, callback)
     {
-        let indentString = WebInspector.indentString();
+        let indentString = WI.indentString();
         let start = {line: 0, ch: 0};
         let end = {line: this._codeMirror.lineCount() - 1};
         let builder = new FormatterContentBuilder(indentString);
-        let formatter = new WebInspector.Formatter(this._codeMirror, builder);
+        let formatter = new WI.Formatter(this._codeMirror, builder);
         formatter.format(start, end);
 
         let formattedText = builder.formattedContent;
@@ -870,7 +870,7 @@
     _finishPrettyPrint(beforePrettyPrintState, formattedText, sourceMapData, callback)
     {
         this._codeMirror.operation(() => {
-            this._formatterSourceMap = WebInspector.FormatterSourceMap.fromSourceMapData(sourceMapData);
+            this._formatterSourceMap = WI.FormatterSourceMap.fromSourceMapData(sourceMapData);
             this._codeMirror.setValue(formattedText);
             this._updateAfterFormatting(true, beforePrettyPrintState);
         });
@@ -898,13 +898,13 @@
         if (pretty) {
             if (this._positionToReveal) {
                 let newRevealPosition = this._formatterSourceMap.originalToFormatted(this._positionToReveal.lineNumber, this._positionToReveal.columnNumber);
-                this._positionToReveal = new WebInspector.SourceCodePosition(newRevealPosition.lineNumber, newRevealPosition.columnNumber);
+                this._positionToReveal = new WI.SourceCodePosition(newRevealPosition.lineNumber, newRevealPosition.columnNumber);
             }
 
             if (this._textRangeToSelect) {
                 let mappedRevealSelectionStart = this._formatterSourceMap.originalToFormatted(this._textRangeToSelect.startLine, this._textRangeToSelect.startColumn);
                 let mappedRevealSelectionEnd = this._formatterSourceMap.originalToFormatted(this._textRangeToSelect.endLine, this._textRangeToSelect.endColumn);
-                this._textRangeToSelect = new WebInspector.TextRange(mappedRevealSelectionStart.lineNumber, mappedRevealSelectionStart.columnNumber, mappedRevealSelectionEnd.lineNumber, mappedRevealSelectionEnd.columnNumber);
+                this._textRangeToSelect = new WI.TextRange(mappedRevealSelectionStart.lineNumber, mappedRevealSelectionStart.columnNumber, mappedRevealSelectionEnd.lineNumber, mappedRevealSelectionEnd.columnNumber);
             }
 
             if (!isNaN(this._executionLineNumber)) {
@@ -919,13 +919,13 @@
         } else {
             if (this._positionToReveal) {
                 let newRevealPosition = this._formatterSourceMap.formattedToOriginal(this._positionToReveal.lineNumber, this._positionToReveal.columnNumber);
-                this._positionToReveal = new WebInspector.SourceCodePosition(newRevealPosition.lineNumber, newRevealPosition.columnNumber);
+                this._positionToReveal = new WI.SourceCodePosition(newRevealPosition.lineNumber, newRevealPosition.columnNumber);
             }
 
             if (this._textRangeToSelect) {
                 let mappedRevealSelectionStart = this._formatterSourceMap.formattedToOriginal(this._textRangeToSelect.startLine, this._textRangeToSelect.startColumn);
                 let mappedRevealSelectionEnd = this._formatterSourceMap.formattedToOriginal(this._textRangeToSelect.endLine, this._textRangeToSelect.endColumn);
-                this._textRangeToSelect = new WebInspector.TextRange(mappedRevealSelectionStart.lineNumber, mappedRevealSelectionStart.columnNumber, mappedRevealSelectionEnd.lineNumber, mappedRevealSelectionEnd.columnNumber);
+                this._textRangeToSelect = new WI.TextRange(mappedRevealSelectionStart.lineNumber, mappedRevealSelectionStart.columnNumber, mappedRevealSelectionEnd.lineNumber, mappedRevealSelectionEnd.columnNumber);
             }
 
             if (!isNaN(this._executionLineNumber)) {
@@ -978,13 +978,13 @@
         var replacedRanges = [];
         var newRanges = [];
         while (change) {
-            replacedRanges.push(new WebInspector.TextRange(
+            replacedRanges.push(new WI.TextRange(
                 change.from.line,
                 change.from.ch,
                 change.to.line,
                 change.to.ch
             ));
-            newRanges.push(new WebInspector.TextRange(
+            newRanges.push(new WI.TextRange(
                 change.from.line,
                 change.from.ch,
                 change.from.line + change.text.length - 1,
@@ -1001,10 +1001,10 @@
             if (this._delegate && typeof this._delegate.textEditorUpdatedFormatting === "function")
                 this._delegate.textEditorUpdatedFormatting(this);
 
-            this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
+            this.dispatchEventToListeners(WI.TextEditor.Event.FormattingDidChange);
         }
 
-        this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);
+        this.dispatchEventToListeners(WI.TextEditor.Event.ContentDidChange);
     }
 
     _textRangeFromCodeMirrorPosition(start, end)
@@ -1012,7 +1012,7 @@
         console.assert(start);
         console.assert(end);
 
-        return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch);
+        return new WI.TextRange(start.line, start.ch, end.line, end.ch);
     }
 
     _codeMirrorPositionFromTextRange(textRange)
@@ -1069,7 +1069,7 @@
 
         // Create the bouncy highlight.
         this._bouncyHighlightElement = document.createElement("div");
-        this._bouncyHighlightElement.className = WebInspector.TextEditor.BouncyHighlightStyleClassName;
+        this._bouncyHighlightElement.className = WI.TextEditor.BouncyHighlightStyleClassName;
 
         // Collect info for the bouncy highlight.
         var textContent = this._codeMirror.getSelection();
@@ -1149,7 +1149,7 @@
             var searchResultMarker = searchResult.find();
             if (!searchResultMarker)
                 return null;
-            return WebInspector.compareCodeMirrorPositions(current, searchResultMarker.from);
+            return WI.compareCodeMirrorPositions(current, searchResultMarker.from);
         });
 
         if (index === null) {
@@ -1176,7 +1176,7 @@
             var searchResultMarker = searchResult.find();
             if (!searchResultMarker)
                 return null;
-            return WebInspector.compareCodeMirrorPositions(current, searchResultMarker.from);
+            return WI.compareCodeMirrorPositions(current, searchResultMarker.from);
         });
 
         if (index === null) {
@@ -1205,7 +1205,7 @@
         var currentCursorPosition = this._codeMirror.getCursor("start");
         var lastRevealedSearchResultPosition = lastRevealedSearchResultMarker.from;
 
-        return WebInspector.compareCodeMirrorPositions(currentCursorPosition, lastRevealedSearchResultPosition) !== 0;
+        return WI.compareCodeMirrorPositions(currentCursorPosition, lastRevealedSearchResultPosition) !== 0;
     }
 
     _revalidateSearchResults(direction)
@@ -1223,7 +1223,7 @@
         console.assert(updatedSearchResults.length !== this._searchResults.length);
 
         this._searchResults = updatedSearchResults;
-        this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.TextEditor.Event.NumberOfSearchResultsDidChange);
 
         if (this._searchResults.length) {
             if (direction > 0)
@@ -1237,7 +1237,7 @@
     {
         if (this._executionMultilineHandles.length) {
             for (let lineHandle of this._executionMultilineHandles)
-                this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.ExecutionLineStyleClassName);
+                this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.ExecutionLineStyleClassName);
             this._executionMultilineHandles = [];
         }
     }
@@ -1246,7 +1246,7 @@
     {
         this._codeMirror.operation(() => {
             if (this._executionLineHandle) {
-                this._codeMirror.removeLineClass(this._executionLineHandle, "wrap", WebInspector.TextEditor.ExecutionLineStyleClassName);
+                this._codeMirror.removeLineClass(this._executionLineHandle, "wrap", WI.TextEditor.ExecutionLineStyleClassName);
                 this._codeMirror.removeLineClass(this._executionLineHandle, "wrap", "primary");
             }
 
@@ -1255,9 +1255,9 @@
             this._executionLineHandle = !isNaN(this._executionLineNumber) ? this._codeMirror.getLineHandle(this._executionLineNumber) : null;
 
             if (this._executionLineHandle) {
-                this._codeMirror.addLineClass(this._executionLineHandle, "wrap", WebInspector.TextEditor.ExecutionLineStyleClassName);
+                this._codeMirror.addLineClass(this._executionLineHandle, "wrap", WI.TextEditor.ExecutionLineStyleClassName);
                 this._codeMirror.addLineClass(this._executionLineHandle, "wrap", "primary");
-                this._codeMirror.removeLineClass(this._executionLineHandle, "wrap", WebInspector.TextEditor.HighlightedStyleClassName);
+                this._codeMirror.removeLineClass(this._executionLineHandle, "wrap", WI.TextEditor.HighlightedStyleClassName);
             }
         });
     }
@@ -1275,7 +1275,7 @@
         let currentPosition = {line: this._executionLineNumber, ch: this._executionColumnNumber};
         let originalOffset = this.currentPositionToOriginalOffset(currentPosition);
         let originalCodeMirrorPosition = this.currentPositionToOriginalPosition(currentPosition);
-        let originalPosition = new WebInspector.SourceCodePosition(originalCodeMirrorPosition.line, originalCodeMirrorPosition.ch);
+        let originalPosition = new WI.SourceCodePosition(originalCodeMirrorPosition.line, originalCodeMirrorPosition.ch);
         let characterAtOffset = this._codeMirror.getRange(currentPosition, {line: this._executionLineNumber, ch: this._executionColumnNumber + 1});
 
         this._delegate.textEditorExecutionHighlightRange(originalOffset, originalPosition, characterAtOffset, (range) => {
@@ -1307,7 +1307,7 @@
             if (start.line !== end.line) {
                 for (let line = start.line; line < end.line; ++line) {
                     let lineHandle = this._codeMirror.getLineHandle(line);
-                    this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.ExecutionLineStyleClassName);
+                    this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.ExecutionLineStyleClassName);
                     this._executionMultilineHandles.push(lineHandle);
                 }
             }
@@ -1337,7 +1337,7 @@
                 allAutoContinue = false;
         }
 
-        allResolved = allResolved && WebInspector.debuggerManager.breakpointsEnabled;
+        allResolved = allResolved && WI.debuggerManager.breakpointsEnabled;
 
         function updateStyles()
         {
@@ -1347,27 +1347,27 @@
             if (!lineHandle)
                 return;
 
-            this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.HasBreakpointStyleClassName);
+            this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.HasBreakpointStyleClassName);
 
             if (allResolved)
-                this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointResolvedStyleClassName);
+                this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointResolvedStyleClassName);
             else
-                this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointResolvedStyleClassName);
+                this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointResolvedStyleClassName);
 
             if (allDisabled)
-                this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointDisabledStyleClassName);
+                this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointDisabledStyleClassName);
             else
-                this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointDisabledStyleClassName);
+                this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointDisabledStyleClassName);
 
             if (allAutoContinue)
-                this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);
+                this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointAutoContinueStyleClassName);
             else
-                this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);
+                this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointAutoContinueStyleClassName);
 
             if (multiple)
-                this._codeMirror.addLineClass(lineHandle, "wrap", WebInspector.TextEditor.MultipleBreakpointsStyleClassName);
+                this._codeMirror.addLineClass(lineHandle, "wrap", WI.TextEditor.MultipleBreakpointsStyleClassName);
             else
-                this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.MultipleBreakpointsStyleClassName);
+                this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.MultipleBreakpointsStyleClassName);
         }
 
         this._codeMirror.operation(updateStyles.bind(this));
@@ -1401,11 +1401,11 @@
             if (!lineHandle)
                 return;
 
-            this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.HasBreakpointStyleClassName);
-            this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointResolvedStyleClassName);
-            this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointDisabledStyleClassName);
-            this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);
-            this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.MultipleBreakpointsStyleClassName);
+            this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.HasBreakpointStyleClassName);
+            this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointResolvedStyleClassName);
+            this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointDisabledStyleClassName);
+            this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.BreakpointAutoContinueStyleClassName);
+            this._codeMirror.removeLineClass(lineHandle, "wrap", WI.TextEditor.MultipleBreakpointsStyleClassName);
         }
 
         this._codeMirror.operation(updateStyles.bind(this));
@@ -1428,7 +1428,7 @@
         if (event.button !== 0 || event.ctrlKey)
             return;
 
-        if (!this._codeMirror.hasLineClass(lineNumber, "wrap", WebInspector.TextEditor.HasBreakpointStyleClassName)) {
+        if (!this._codeMirror.hasLineClass(lineNumber, "wrap", WI.TextEditor.HasBreakpointStyleClassName)) {
             console.assert(!(lineNumber in this._breakpoints));
 
             // No breakpoint, add a new one.
@@ -1446,7 +1446,7 @@
 
         console.assert(lineNumber in this._breakpoints);
 
-        if (this._codeMirror.hasLineClass(lineNumber, "wrap", WebInspector.TextEditor.MultipleBreakpointsStyleClassName)) {
+        if (this._codeMirror.hasLineClass(lineNumber, "wrap", WI.TextEditor.MultipleBreakpointsStyleClassName)) {
             console.assert(!isEmptyObject(this._breakpoints[lineNumber]));
             return;
         }
@@ -1617,7 +1617,7 @@
             baseURL = this._delegate.textEditorBaseURL(this);
 
         // Open the link after resolving the absolute URL from the base URL.
-        WebInspector.openURL(absoluteURL(url, baseURL));
+        WI.openURL(absoluteURL(url, baseURL));
 
         // Stop processing the event.
         event.preventDefault();
@@ -1643,19 +1643,19 @@
     }
 };
 
-WebInspector.TextEditor.HighlightedStyleClassName = "highlighted";
-WebInspector.TextEditor.SearchResultStyleClassName = "search-result";
-WebInspector.TextEditor.HasBreakpointStyleClassName = "has-breakpoint";
-WebInspector.TextEditor.BreakpointResolvedStyleClassName = "breakpoint-resolved";
-WebInspector.TextEditor.BreakpointAutoContinueStyleClassName = "breakpoint-auto-continue";
-WebInspector.TextEditor.BreakpointDisabledStyleClassName = "breakpoint-disabled";
-WebInspector.TextEditor.MultipleBreakpointsStyleClassName = "multiple-breakpoints";
-WebInspector.TextEditor.ExecutionLineStyleClassName = "execution-line";
-WebInspector.TextEditor.BouncyHighlightStyleClassName = "bouncy-highlight";
-WebInspector.TextEditor.NumberOfFindsPerSearchBatch = 10;
-WebInspector.TextEditor.HighlightAnimationDuration = 2000;
+WI.TextEditor.HighlightedStyleClassName = "highlighted";
+WI.TextEditor.SearchResultStyleClassName = "search-result";
+WI.TextEditor.HasBreakpointStyleClassName = "has-breakpoint";
+WI.TextEditor.BreakpointResolvedStyleClassName = "breakpoint-resolved";
+WI.TextEditor.BreakpointAutoContinueStyleClassName = "breakpoint-auto-continue";
+WI.TextEditor.BreakpointDisabledStyleClassName = "breakpoint-disabled";
+WI.TextEditor.MultipleBreakpointsStyleClassName = "multiple-breakpoints";
+WI.TextEditor.ExecutionLineStyleClassName = "execution-line";
+WI.TextEditor.BouncyHighlightStyleClassName = "bouncy-highlight";
+WI.TextEditor.NumberOfFindsPerSearchBatch = 10;
+WI.TextEditor.HighlightAnimationDuration = 2000;
 
-WebInspector.TextEditor.Event = {
+WI.TextEditor.Event = {
     ExecutionLineNumberDidChange: "text-editor-execution-line-number-did-change",
     NumberOfSearchResultsDidChange: "text-editor-number-of-search-results-did-change",
     ContentDidChange: "text-editor-content-did-change",
diff --git a/Source/WebInspectorUI/UserInterface/Views/TextNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/TextNavigationItem.js
index 1ab2e55..40f17b8 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TextNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TextNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextNavigationItem = class TextNavigationItem extends WebInspector.NavigationItem
+WI.TextNavigationItem = class TextNavigationItem extends WI.NavigationItem
 {
     constructor(identifier, label)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js b/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js
index 6ce9e56..a6d3768 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js
@@ -23,45 +23,45 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextResourceContentView = class TextResourceContentView extends WebInspector.ResourceContentView
+WI.TextResourceContentView = class TextResourceContentView extends WI.ResourceContentView
 {
     constructor(resource)
     {
         super(resource, "text");
 
-        resource.addEventListener(WebInspector.SourceCode.Event.ContentDidChange, this._sourceCodeContentDidChange, this);
+        resource.addEventListener(WI.SourceCode.Event.ContentDidChange, this._sourceCodeContentDidChange, this);
 
-        this._textEditor = new WebInspector.SourceCodeTextEditor(resource);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange, this._executionLineNumberDidChange, this);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.ContentDidChange, this._textEditorContentDidChange, this);
-        this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
-        this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate, this._contentWillPopulate, this);
-        this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentDidPopulate, this._contentDidPopulate, this);
+        this._textEditor = new WI.SourceCodeTextEditor(resource);
+        this._textEditor.addEventListener(WI.TextEditor.Event.ExecutionLineNumberDidChange, this._executionLineNumberDidChange, this);
+        this._textEditor.addEventListener(WI.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this);
+        this._textEditor.addEventListener(WI.TextEditor.Event.ContentDidChange, this._textEditorContentDidChange, this);
+        this._textEditor.addEventListener(WI.TextEditor.Event.FormattingDidChange, this._textEditorFormattingDidChange, this);
+        this._textEditor.addEventListener(WI.SourceCodeTextEditor.Event.ContentWillPopulate, this._contentWillPopulate, this);
+        this._textEditor.addEventListener(WI.SourceCodeTextEditor.Event.ContentDidPopulate, this._contentDidPopulate, this);
         this._textEditor.readOnly = !this._shouldBeEditable();
 
-        WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetAdded, this._probeSetsChanged, this);
-        WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetRemoved, this._probeSetsChanged, this);
+        WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetAdded, this._probeSetsChanged, this);
+        WI.probeManager.addEventListener(WI.ProbeManager.Event.ProbeSetRemoved, this._probeSetsChanged, this);
 
-        var toolTip = WebInspector.UIString("Pretty print");
-        var activatedToolTip = WebInspector.UIString("Original formatting");
-        this._prettyPrintButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("pretty-print", toolTip, activatedToolTip, "Images/NavigationItemCurleyBraces.svg", 13, 13);
-        this._prettyPrintButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._togglePrettyPrint, this);
+        var toolTip = WI.UIString("Pretty print");
+        var activatedToolTip = WI.UIString("Original formatting");
+        this._prettyPrintButtonNavigationItem = new WI.ActivateButtonNavigationItem("pretty-print", toolTip, activatedToolTip, "Images/NavigationItemCurleyBraces.svg", 13, 13);
+        this._prettyPrintButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePrettyPrint, this);
         this._prettyPrintButtonNavigationItem.enabled = false; // Enabled when the text editor is populated with content.
 
-        var toolTipTypes = WebInspector.UIString("Show type information");
-        var activatedToolTipTypes = WebInspector.UIString("Hide type information");
-        this._showTypesButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-types", toolTipTypes, activatedToolTipTypes, "Images/NavigationItemTypes.svg", 13, 14);
-        this._showTypesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleTypeAnnotations, this);
+        var toolTipTypes = WI.UIString("Show type information");
+        var activatedToolTipTypes = WI.UIString("Hide type information");
+        this._showTypesButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-types", toolTipTypes, activatedToolTipTypes, "Images/NavigationItemTypes.svg", 13, 14);
+        this._showTypesButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleTypeAnnotations, this);
         this._showTypesButtonNavigationItem.enabled = false;
-        WebInspector.showJavaScriptTypeInformationSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
+        WI.showJavaScriptTypeInformationSetting.addEventListener(WI.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
 
-        let toolTipCodeCoverage = WebInspector.UIString("Fade unexecuted code");
-        let activatedToolTipCodeCoverage = WebInspector.UIString("Do not fade unexecuted code");
-        this._codeCoverageButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("code-coverage", toolTipCodeCoverage, activatedToolTipCodeCoverage, "Images/NavigationItemCodeCoverage.svg", 13, 14);
-        this._codeCoverageButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleUnexecutedCodeHighlights, this);
+        let toolTipCodeCoverage = WI.UIString("Fade unexecuted code");
+        let activatedToolTipCodeCoverage = WI.UIString("Do not fade unexecuted code");
+        this._codeCoverageButtonNavigationItem = new WI.ActivateButtonNavigationItem("code-coverage", toolTipCodeCoverage, activatedToolTipCodeCoverage, "Images/NavigationItemCodeCoverage.svg", 13, 14);
+        this._codeCoverageButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleUnexecutedCodeHighlights, this);
         this._codeCoverageButtonNavigationItem.enabled = false;
-        WebInspector.enableControlFlowProfilerSetting.addEventListener(WebInspector.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
+        WI.enableControlFlowProfilerSetting.addEventListener(WI.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
     }
 
     // Public
@@ -84,14 +84,14 @@
 
     get supplementalRepresentedObjects()
     {
-        var objects = WebInspector.probeManager.probeSets.filter(function(probeSet) {
+        var objects = WI.probeManager.probeSets.filter(function(probeSet) {
             return this._resource.contentIdentifier === probeSet.breakpoint.contentIdentifier;
         }, this);
 
         // If the SourceCodeTextEditor has an executionLineNumber, we can assume
         // it is always the active call frame.
         if (!isNaN(this._textEditor.executionLineNumber))
-            objects.push(WebInspector.debuggerManager.activeCallFrame);
+            objects.push(WI.debuggerManager.activeCallFrame);
 
         return objects;
     }
@@ -120,21 +120,21 @@
         super.closed();
 
         this.resource.removeEventListener(null, null, this);
-        WebInspector.probeManager.removeEventListener(null, null, this);
-        WebInspector.showJavaScriptTypeInformationSetting.removeEventListener(null, null, this);
-        WebInspector.enableControlFlowProfilerSetting.removeEventListener(null, null, this);
+        WI.probeManager.removeEventListener(null, null, this);
+        WI.showJavaScriptTypeInformationSetting.removeEventListener(null, null, this);
+        WI.enableControlFlowProfilerSetting.removeEventListener(null, null, this);
 
         this._textEditor.close();
     }
 
     get supportsSave()
     {
-        return super.supportsSave || this.resource instanceof WebInspector.CSSStyleSheet;
+        return super.supportsSave || this.resource instanceof WI.CSSStyleSheet;
     }
 
     get saveData()
     {
-        if (this.resource instanceof WebInspector.CSSStyleSheet)
+        if (this.resource instanceof WI.CSSStyleSheet)
             return {url: "web-inspector:///InspectorStyleSheet.css", content: this._textEditor.string, forceSaveAs: true};
         return {url: this.resource.url, content: this._textEditor.string};
     }
@@ -201,10 +201,10 @@
         this._prettyPrintButtonNavigationItem.enabled = this._textEditor.canBeFormatted();
 
         this._showTypesButtonNavigationItem.enabled = this._textEditor.canShowTypeAnnotations();
-        this._showTypesButtonNavigationItem.activated = WebInspector.showJavaScriptTypeInformationSetting.value;
+        this._showTypesButtonNavigationItem.activated = WI.showJavaScriptTypeInformationSetting.value;
 
         this._codeCoverageButtonNavigationItem.enabled = this._textEditor.canShowCoverageHints();
-        this._codeCoverageButtonNavigationItem.activated = WebInspector.enableControlFlowProfilerSetting.value;
+        this._codeCoverageButtonNavigationItem.activated = WI.enableControlFlowProfilerSetting.value;
     }
 
     _togglePrettyPrint(event)
@@ -231,12 +231,12 @@
 
     _showJavaScriptTypeInformationSettingChanged(event)
     {
-        this._showTypesButtonNavigationItem.activated = WebInspector.showJavaScriptTypeInformationSetting.value;
+        this._showTypesButtonNavigationItem.activated = WI.showJavaScriptTypeInformationSetting.value;
     }
 
     _enableControlFlowProfilerSettingChanged(event)
     {
-        this._codeCoverageButtonNavigationItem.activated = WebInspector.enableControlFlowProfilerSetting.value;
+        this._codeCoverageButtonNavigationItem.activated = WI.enableControlFlowProfilerSetting.value;
     }
 
     _textEditorFormattingDidChange(event)
@@ -255,34 +255,34 @@
     _textEditorContentDidChange(event)
     {
         this._ignoreSourceCodeContentDidChangeEvent = true;
-        WebInspector.branchManager.currentBranch.revisionForRepresentedObject(this.resource).content = this._textEditor.string;
+        WI.branchManager.currentBranch.revisionForRepresentedObject(this.resource).content = this._textEditor.string;
         delete this._ignoreSourceCodeContentDidChangeEvent;
     }
 
     _executionLineNumberDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange);
     }
 
     _numberOfSearchResultsDidChange(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange);
     }
 
     _probeSetsChanged(event)
     {
         var breakpoint = event.data.probeSet.breakpoint;
         if (breakpoint.sourceCodeLocation.sourceCode === this.resource)
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);
+            this.dispatchEventToListeners(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange);
     }
 
     _shouldBeEditable()
     {
-        if (this.resource instanceof WebInspector.CSSStyleSheet)
+        if (this.resource instanceof WI.CSSStyleSheet)
             return true;
 
         // Check the MIME-type for CSS since Resource.Type.Stylesheet also includes XSL, which we can't edit yet.
-        if (this.resource.type === WebInspector.Resource.Type.Stylesheet && this.resource.syntheticMIMEType === "text/css")
+        if (this.resource.type === WI.Resource.Type.Stylesheet && this.resource.syntheticMIMEType === "text/css")
             return true;
 
         // Allow editing any local file since edits can be saved and reloaded right from the Inspector.
diff --git a/Source/WebInspectorUI/UserInterface/Views/TextToggleButtonNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/TextToggleButtonNavigationItem.js
index 9db5f6b..340952e 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TextToggleButtonNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TextToggleButtonNavigationItem.js
@@ -26,7 +26,7 @@
 {
     const selectedStyleClassName = "selected";
 
-    WebInspector.TextToggleButtonNavigationItem = class TextToggleButtonNavigationItem extends WebInspector.ButtonNavigationItem
+    WI.TextToggleButtonNavigationItem = class TextToggleButtonNavigationItem extends WI.ButtonNavigationItem
     {
         constructor(identifier, title)
         {
diff --git a/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js
index 0ff45d1..81201b5 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ThreadTreeElement = class ThreadTreeElement extends WebInspector.GeneralTreeElement
+WI.ThreadTreeElement = class ThreadTreeElement extends WI.GeneralTreeElement
 {
     constructor(target)
     {
@@ -31,7 +31,7 @@
 
         this._target = target;
 
-        this._idleTreeElement = new WebInspector.IdleTreeElement;
+        this._idleTreeElement = new WI.IdleTreeElement;
     }
 
     // Public
@@ -44,7 +44,7 @@
 
         this._updateStatus();
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(this._target);
+        let targetData = WI.debuggerManager.dataForTarget(this._target);
         let callFrames = targetData.callFrames;
 
         if (targetData.pausing || !callFrames.length) {
@@ -53,11 +53,11 @@
             return;
         }
 
-        let activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+        let activeCallFrame = WI.debuggerManager.activeCallFrame;
         let activeCallFrameTreeElement = null;
 
         for (let callFrame of callFrames) {
-            let callFrameTreeElement = new WebInspector.CallFrameTreeElement(callFrame);
+            let callFrameTreeElement = new WI.CallFrameTreeElement(callFrame);
             if (callFrame === activeCallFrame)
                 activeCallFrameTreeElement = callFrameTreeElement;
             this.appendChild(callFrameTreeElement);
@@ -80,20 +80,20 @@
                 console.assert(boundaryCallFrame.nativeCode && !boundaryCallFrame.sourceCodeLocation);
             } else {
                 // Create a generic native CallFrame for the asynchronous boundary.
-                const functionName = WebInspector.UIString("(async)");
+                const functionName = WI.UIString("(async)");
                 const nativeCode = true;
-                boundaryCallFrame = new WebInspector.CallFrame(null, null, null, functionName, null, null, nativeCode);
+                boundaryCallFrame = new WI.CallFrame(null, null, null, functionName, null, null, nativeCode);
             }
 
             const isAsyncBoundaryCallFrame = true;
-            this.appendChild(new WebInspector.CallFrameTreeElement(boundaryCallFrame, isAsyncBoundaryCallFrame));
+            this.appendChild(new WI.CallFrameTreeElement(boundaryCallFrame, isAsyncBoundaryCallFrame));
 
             let startIndex = currentStackTrace.topCallFrameIsBoundary ? 1 : 0;
             for (let i = startIndex; i < currentStackTrace.callFrames.length; ++i)
-                this.appendChild(new WebInspector.CallFrameTreeElement(currentStackTrace.callFrames[i]));
+                this.appendChild(new WI.CallFrameTreeElement(currentStackTrace.callFrames[i]));
 
             if (currentStackTrace.truncated) {
-                let truncatedTreeElement = new WebInspector.GeneralTreeElement("truncated-call-frames", WebInspector.UIString("Call Frames Truncated"));
+                let truncatedTreeElement = new WI.GeneralTreeElement("truncated-call-frames", WI.UIString("Call Frames Truncated"));
                 truncatedTreeElement.selectable = false;
                 this.appendChild(truncatedTreeElement);
             }
@@ -116,10 +116,10 @@
 
     populateContextMenu(contextMenu, event)
     {
-        let targetData = WebInspector.debuggerManager.dataForTarget(this._target);
+        let targetData = WI.debuggerManager.dataForTarget(this._target);
 
-        contextMenu.appendItem(WebInspector.UIString("Resume Thread"), () => {
-            WebInspector.debuggerManager.continueUntilNextRunLoop(this._target);
+        contextMenu.appendItem(WI.UIString("Resume Thread"), () => {
+            WI.debuggerManager.continueUntilNextRunLoop(this._target);
         }, !targetData.paused);
 
         super.populateContextMenu(contextMenu, event);
@@ -134,14 +134,14 @@
         if (!this.element)
             return;
 
-        let targetData = WebInspector.debuggerManager.dataForTarget(this._target);
+        let targetData = WI.debuggerManager.dataForTarget(this._target);
         if (!targetData.paused)
             return;
 
         if (!this._statusButton) {
-            let tooltip = WebInspector.UIString("Resume Thread");
-            this._statusButton = new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/Resume.svg", "resume", tooltip));
-            this._statusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, () => { WebInspector.debuggerManager.continueUntilNextRunLoop(this._target); });
+            let tooltip = WI.UIString("Resume Thread");
+            this._statusButton = new WI.TreeElementStatusButton(useSVGSymbol("Images/Resume.svg", "resume", tooltip));
+            this._statusButton.addEventListener(WI.TreeElementStatusButton.Event.Clicked, () => { WI.debuggerManager.continueUntilNextRunLoop(this._target); });
             this._statusButton.element.addEventListener("mousedown", (event) => {
                 // Prevent tree element from being selected.
                 event.stopPropagation();
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js b/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js
index 284a3c0..d632652 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineDataGrid = class TimelineDataGrid extends WebInspector.DataGrid
+WI.TimelineDataGrid = class TimelineDataGrid extends WI.DataGrid
 {
     constructor(columns, treeOutline, synchronizerDelegate, editCallback, deleteCallback)
     {
         super(columns, editCallback, deleteCallback);
 
         if (treeOutline)
-            this._treeOutlineDataGridSynchronizer = new WebInspector.TreeOutlineDataGridSynchronizer(treeOutline, this, synchronizerDelegate);
+            this._treeOutlineDataGridSynchronizer = new WI.TreeOutlineDataGridSynchronizer(treeOutline, this, synchronizerDelegate);
 
         this.element.classList.add("timeline");
 
@@ -46,7 +46,7 @@
 
             this._scopeBarColumns.push(identifier);
             scopeBar.columnIdentifier = identifier;
-            scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectedItemsDidChange, this);
+            scopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._scopeBarSelectedItemsDidChange, this);
         }
 
         if (this._scopeBarColumns.length > 1) {
@@ -54,8 +54,8 @@
             return;
         }
 
-        this.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridSelectedNodeChanged, this);
-        this.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sort, this);
+        this.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridSelectedNodeChanged, this);
+        this.addEventListener(WI.DataGrid.Event.SortChanged, this._sort, this);
 
         this.columnChooserEnabled = true;
     }
@@ -67,15 +67,15 @@
         var scopeBarItems = [];
         for (var [key, value] of map) {
             var id = prefix + key;
-            var item = new WebInspector.ScopeBarItem(id, value);
+            var item = new WI.ScopeBarItem(id, value);
             item.value = key;
             scopeBarItems.push(item);
         }
 
-        var allItem = new WebInspector.ScopeBarItem(prefix + "type-all", WebInspector.UIString("All"));
+        var allItem = new WI.ScopeBarItem(prefix + "type-all", WI.UIString("All"));
         scopeBarItems.unshift(allItem);
 
-        return new WebInspector.ScopeBar(prefix + "scope-bar", scopeBarItems, allItem, true);
+        return new WI.ScopeBar(prefix + "scope-bar", scopeBarItems, allItem, true);
     }
 
     // Public
@@ -93,8 +93,8 @@
 
         this._sortDelegate = delegate;
 
-        if (this.sortOrder !== WebInspector.DataGrid.SortOrder.Indeterminate)
-            this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);
+        if (this.sortOrder !== WI.DataGrid.SortOrder.Indeterminate)
+            this.dispatchEventToListeners(WI.DataGrid.Event.SortChanged);
     }
 
     reset()
@@ -156,7 +156,7 @@
 
             this._treeOutlineDataGridSynchronizer.associate(treeElement, dataGridNode);
 
-            console.assert(!parentTreeElementOrDataGridNode || parentTreeElementOrDataGridNode instanceof WebInspector.TreeElement);
+            console.assert(!parentTreeElementOrDataGridNode || parentTreeElementOrDataGridNode instanceof WI.TreeElement);
 
             let parentTreeElement = parentTreeElementOrDataGridNode || this._treeOutlineDataGridSynchronizer.treeOutline;
             parentDataGridNode = parentTreeElement.root ? this : this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(parentTreeElement);
@@ -358,7 +358,7 @@
         if (!sortColumnIdentifier)
             return 0;
 
-        var sortDirection = this.sortOrder === WebInspector.DataGrid.SortOrder.Ascending ? 1 : -1;
+        var sortDirection = this.sortOrder === WI.DataGrid.SortOrder.Ascending ? 1 : -1;
 
         if (this._sortDelegate && typeof this._sortDelegate.dataGridSortComparator === "function") {
             let result = this._sortDelegate.dataGridSortComparator(sortColumnIdentifier, sortDirection, node1, node2);
@@ -382,18 +382,18 @@
         if (typeof value1 === "string" && typeof value2 === "string")
             return value1.extendedLocaleCompare(value2) * sortDirection;
 
-        if (value1 instanceof WebInspector.CallFrame || value2 instanceof WebInspector.CallFrame) {
+        if (value1 instanceof WI.CallFrame || value2 instanceof WI.CallFrame) {
             // Sort by function name if available, then fall back to the source code object.
             value1 = value1 && value1.functionName ? value1.functionName : (value1 && value1.sourceCodeLocation ? value1.sourceCodeLocation.sourceCode : "");
             value2 = value2 && value2.functionName ? value2.functionName : (value2 && value2.sourceCodeLocation ? value2.sourceCodeLocation.sourceCode : "");
         }
 
-        if (value1 instanceof WebInspector.SourceCode || value2 instanceof WebInspector.SourceCode) {
+        if (value1 instanceof WI.SourceCode || value2 instanceof WI.SourceCode) {
             value1 = value1 ? value1.displayName || "" : "";
             value2 = value2 ? value2.displayName || "" : "";
         }
 
-        if (value1 instanceof WebInspector.SourceCodeLocation || value2 instanceof WebInspector.SourceCodeLocation) {
+        if (value1 instanceof WI.SourceCodeLocation || value2 instanceof WI.SourceCodeLocation) {
             value1 = value1 ? value1.displayLocationString() || "" : "";
             value2 = value2 ? value2.displayLocationString() || "" : "";
         }
@@ -430,12 +430,12 @@
 
         this._showPopoverTimeout = setTimeout(() => {
             if (!this._popover) {
-                this._popover = new WebInspector.Popover;
+                this._popover = new WI.Popover;
                 this._popover.windowResizeHandler = () => { this._updatePopoverForSelectedNode(false); };
             }
             this._updatePopoverForSelectedNode(true);
             this._showPopoverTimeout = undefined;
-        }, WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout);
+        }, WI.TimelineDataGrid.DelayedPopoverShowTimeout);
     }
 
     _hidePopover()
@@ -454,7 +454,7 @@
         this._hidePopoverContentClearTimeout = setTimeout(() => {
             if (this._popoverCallStackTreeOutline)
                 this._popoverCallStackTreeOutline.removeChildren();
-        }, WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout);
+        }, WI.TimelineDataGrid.DelayedPopoverHideContentClearTimeout);
     }
 
     _updatePopoverForSelectedNode(updateContent)
@@ -468,7 +468,7 @@
             return;
 
         // The element might be hidden if it does not have a width and height.
-        let rect = WebInspector.Rect.rectFromClientRect(targetPopoverElement.getBoundingClientRect());
+        let rect = WI.Rect.rectFromClientRect(targetPopoverElement.getBoundingClientRect());
         if (!rect.size.width && !rect.size.height)
             return;
 
@@ -478,7 +478,7 @@
         }
 
         let targetFrame = rect.pad(2);
-        let preferredEdges = [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X];
+        let preferredEdges = [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X];
 
         if (updateContent)
             this._popover.presentNewContentWithFrame(this._createPopoverContent(), targetFrame, preferredEdges);
@@ -489,16 +489,16 @@
     _createPopoverContent()
     {
         if (!this._popoverCallStackTreeOutline) {
-            this._popoverCallStackTreeOutline = new WebInspector.TreeOutline;
+            this._popoverCallStackTreeOutline = new WI.TreeOutline;
             this._popoverCallStackTreeOutline.disclosureButtons = false;
             this._popoverCallStackTreeOutline.element.classList.add("timeline-data-grid");
-            this._popoverCallStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._popoverCallStackTreeSelectionDidChange, this);
+            this._popoverCallStackTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._popoverCallStackTreeSelectionDidChange, this);
         } else
             this._popoverCallStackTreeOutline.removeChildren();
 
         var callFrames = this.selectedNode.record.callFrames;
         for (var i = 0; i < callFrames.length; ++i) {
-            var callFrameTreeElement = new WebInspector.CallFrameTreeElement(callFrames[i]);
+            var callFrameTreeElement = new WI.CallFrameTreeElement(callFrames[i]);
             this._popoverCallStackTreeOutline.appendChild(callFrameTreeElement);
         }
 
@@ -516,18 +516,18 @@
 
         this._popover.dismiss();
 
-        console.assert(treeElement instanceof WebInspector.CallFrameTreeElement, "TreeElements in TimelineDataGrid popover should always be CallFrameTreeElements");
+        console.assert(treeElement instanceof WI.CallFrameTreeElement, "TreeElements in TimelineDataGrid popover should always be CallFrameTreeElements");
         var callFrame = treeElement.callFrame;
         if (!callFrame.sourceCodeLocation)
             return;
 
-        WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation, {
+        WI.showSourceCodeLocation(callFrame.sourceCodeLocation, {
             ignoreNetworkTab: true,
             ignoreSearchTab: true,
         });
     }
 };
 
-WebInspector.TimelineDataGrid.HasNonDefaultFilterStyleClassName = "has-non-default-filter";
-WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout = 250;
-WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout = 500;
+WI.TimelineDataGrid.HasNonDefaultFilterStyleClassName = "has-non-default-filter";
+WI.TimelineDataGrid.DelayedPopoverShowTimeout = 250;
+WI.TimelineDataGrid.DelayedPopoverHideContentClearTimeout = 500;
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js
index a3f6f46..0eb1e92 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineDataGridNode = class TimelineDataGridNode extends WebInspector.DataGridNode
+WI.TimelineDataGridNode = class TimelineDataGridNode extends WI.DataGridNode
 {
     constructor(includesGraph, graphDataSource, hasChildren)
     {
@@ -91,7 +91,7 @@
         // Refresh child graphs since they haven't been updating while we were collapsed.
         var childNode = this.children[0];
         while (childNode) {
-            if (childNode instanceof WebInspector.TimelineDataGridNode)
+            if (childNode instanceof WI.TimelineDataGridNode)
                 childNode.refreshGraph();
             childNode = childNode.traverseNextNode(true, this);
         }
@@ -114,16 +114,16 @@
             ignoreSearchTab: true,
         };
 
-        if (value instanceof WebInspector.SourceCodeLocation) {
-            if (value.sourceCode instanceof WebInspector.Resource) {
-                cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
+        if (value instanceof WI.SourceCodeLocation) {
+            if (value.sourceCode instanceof WI.Resource) {
+                cell.classList.add(WI.ResourceTreeElement.ResourceIconStyleClassName);
                 cell.classList.add(value.sourceCode.type);
-            } else if (value.sourceCode instanceof WebInspector.Script) {
+            } else if (value.sourceCode instanceof WI.Script) {
                 if (value.sourceCode.url) {
-                    cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
-                    cell.classList.add(WebInspector.Resource.Type.Script);
+                    cell.classList.add(WI.ResourceTreeElement.ResourceIconStyleClassName);
+                    cell.classList.add(WI.Resource.Type.Script);
                 } else
-                    cell.classList.add(WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName);
+                    cell.classList.add(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
             } else
                 console.error("Unknown SourceCode subclass.");
 
@@ -131,7 +131,7 @@
             value.populateLiveDisplayLocationTooltip(cell);
 
             var fragment = document.createDocumentFragment();
-            fragment.appendChild(WebInspector.createSourceCodeLocationLink(value, options));
+            fragment.appendChild(WI.createSourceCodeLocationLink(value, options));
 
             var titleElement = document.createElement("span");
             value.populateLiveDisplayLocationString(titleElement, "textContent");
@@ -140,17 +140,17 @@
             return fragment;
         }
 
-        if (value instanceof WebInspector.CallFrame) {
+        if (value instanceof WI.CallFrame) {
             var callFrame = value;
 
             var isAnonymousFunction = false;
             var functionName = callFrame.functionName;
             if (!functionName) {
-                functionName = WebInspector.UIString("(anonymous function)");
+                functionName = WI.UIString("(anonymous function)");
                 isAnonymousFunction = true;
             }
 
-            cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName);
+            cell.classList.add(WI.CallFrameView.FunctionIconStyleClassName);
 
             var fragment = document.createDocumentFragment();
 
@@ -158,19 +158,19 @@
                 // Give the whole cell a tooltip and keep it up to date.
                 callFrame.sourceCodeLocation.populateLiveDisplayLocationTooltip(cell);
 
-                fragment.appendChild(WebInspector.createSourceCodeLocationLink(callFrame.sourceCodeLocation, options));
+                fragment.appendChild(WI.createSourceCodeLocationLink(callFrame.sourceCodeLocation, options));
 
                 if (isAnonymousFunction) {
                     // For anonymous functions we show the resource or script icon and name.
-                    if (callFrame.sourceCodeLocation.sourceCode instanceof WebInspector.Resource) {
-                        cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
+                    if (callFrame.sourceCodeLocation.sourceCode instanceof WI.Resource) {
+                        cell.classList.add(WI.ResourceTreeElement.ResourceIconStyleClassName);
                         cell.classList.add(callFrame.sourceCodeLocation.sourceCode.type);
-                    } else if (callFrame.sourceCodeLocation.sourceCode instanceof WebInspector.Script) {
+                    } else if (callFrame.sourceCodeLocation.sourceCode instanceof WI.Script) {
                         if (callFrame.sourceCodeLocation.sourceCode.url) {
-                            cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
-                            cell.classList.add(WebInspector.Resource.Type.Script);
+                            cell.classList.add(WI.ResourceTreeElement.ResourceIconStyleClassName);
+                            cell.classList.add(WI.Resource.Type.Script);
                         } else
-                            cell.classList.add(WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName);
+                            cell.classList.add(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
                     } else
                         console.error("Unknown SourceCode subclass.");
 
@@ -180,7 +180,7 @@
                     fragment.appendChild(titleElement);
                 } else {
                     // Show the function name and icon.
-                    cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName);
+                    cell.classList.add(WI.CallFrameView.FunctionIconStyleClassName);
 
                     fragment.append(functionName);
 
@@ -241,7 +241,7 @@
         {
             var timelineRecordBar = this._timelineRecordBars[recordBarIndex];
             if (!timelineRecordBar)
-                timelineRecordBar = this._timelineRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
+                timelineRecordBar = this._timelineRecordBars[recordBarIndex] = new WI.TimelineRecordBar(records, renderMode);
             else {
                 timelineRecordBar.renderMode = renderMode;
                 timelineRecordBar.records = records;
@@ -271,7 +271,7 @@
 
         if (this.expanded) {
             // When expanded just use the records for this node.
-            WebInspector.TimelineRecordBar.createCombinedBars(this.records, secondsPerPixel, this._graphDataSource, boundCreateBar);
+            WI.TimelineRecordBar.createCombinedBars(this.records, secondsPerPixel, this._graphDataSource, boundCreateBar);
         } else {
             // When collapsed use the records for this node and its descendants.
             // To share bars better, group records by type.
@@ -281,13 +281,13 @@
 
             var childNode = this.children[0];
             while (childNode) {
-                if (childNode instanceof WebInspector.TimelineDataGridNode)
+                if (childNode instanceof WI.TimelineDataGridNode)
                     collectRecordsByType(childNode.records, recordTypeMap);
                 childNode = childNode.traverseNextNode(false, this);
             }
 
             for (var records of recordTypeMap.values())
-                WebInspector.TimelineRecordBar.createCombinedBars(records, secondsPerPixel, this._graphDataSource, boundCreateBar);
+                WI.TimelineRecordBar.createCombinedBars(records, secondsPerPixel, this._graphDataSource, boundCreateBar);
         }
 
         // Remove the remaining unused TimelineRecordBars.
@@ -305,7 +305,7 @@
             // Notify the next visible ancestor that their graph needs to refresh.
             var ancestor = this;
             while (ancestor && !ancestor.root) {
-                if (ancestor.revealed && ancestor instanceof WebInspector.TimelineDataGridNode) {
+                if (ancestor.revealed && ancestor instanceof WI.TimelineDataGridNode) {
                     ancestor.needsGraphRefresh();
                     return;
                 }
@@ -326,13 +326,13 @@
     {
         // Can be overridden by subclasses.
         const includeDetails = true;
-        return WebInspector.TimelineTabContentView.displayNameForRecord(this.record, true);
+        return WI.TimelineTabContentView.displayNameForRecord(this.record, true);
     }
 
     iconClassNames()
     {
         // Can be overridden by subclasses.
-        return [WebInspector.TimelineTabContentView.iconClassNameForRecord(this.record)];
+        return [WI.TimelineTabContentView.iconClassNameForRecord(this.record)];
     }
 
     // Protected
@@ -349,7 +349,7 @@
             callback(this, cellElement.__columnIdentifier);
         }
 
-        let button = WebInspector.createGoToArrowButton();
+        let button = WI.createGoToArrowButton();
         button.addEventListener("click", buttonClicked.bind(this));
 
         let contentElement = cellElement.firstChild;
@@ -378,10 +378,10 @@
     filterableDataForColumn(columnIdentifier)
     {
         let value = this.data[columnIdentifier];
-        if (value instanceof WebInspector.SourceCodeLocation)
+        if (value instanceof WI.SourceCodeLocation)
             return value.displayLocationString();
 
-        if (value instanceof WebInspector.CallFrame)
+        if (value instanceof WI.CallFrame)
             return [value.functionName, value.sourceCodeLocation.displayLocationString()];
 
         return super.filterableDataForColumn(columnIdentifier);
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js b/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js
index 1c319f1..cb3f67f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineDataGridNodePathComponent = class TimelineDataGridNodePathComponent extends WebInspector.HierarchicalPathComponent
+WI.TimelineDataGridNodePathComponent = class TimelineDataGridNodePathComponent extends WI.HierarchicalPathComponent
 {
     constructor(timelineDataGridNode, representedObject)
     {
@@ -48,7 +48,7 @@
         if (!previousSibling)
             return null;
 
-        return new WebInspector.TimelineDataGridNodePathComponent(previousSibling);
+        return new WI.TimelineDataGridNodePathComponent(previousSibling);
     }
 
     get nextSibling()
@@ -60,6 +60,6 @@
         if (!nextSibling)
             return null;
 
-        return new WebInspector.TimelineDataGridNodePathComponent(nextSibling);
+        return new WI.TimelineDataGridNodePathComponent(nextSibling);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js b/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js
index 813b038..4009925 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js
@@ -23,69 +23,69 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineOverview = class TimelineOverview extends WebInspector.View
+WI.TimelineOverview = class TimelineOverview extends WI.View
 {
     constructor(timelineRecording, delegate)
     {
         super();
 
-        console.assert(timelineRecording instanceof WebInspector.TimelineRecording);
+        console.assert(timelineRecording instanceof WI.TimelineRecording);
 
-        this._timelinesViewModeSettings = this._createViewModeSettings(WebInspector.TimelineOverview.ViewMode.Timelines, WebInspector.TimelineOverview.MinimumDurationPerPixel, WebInspector.TimelineOverview.MaximumDurationPerPixel, 0.01, 0, 15);
-        this._instrumentTypes = WebInspector.TimelineManager.availableTimelineTypes();
+        this._timelinesViewModeSettings = this._createViewModeSettings(WI.TimelineOverview.ViewMode.Timelines, WI.TimelineOverview.MinimumDurationPerPixel, WI.TimelineOverview.MaximumDurationPerPixel, 0.01, 0, 15);
+        this._instrumentTypes = WI.TimelineManager.availableTimelineTypes();
 
-        if (WebInspector.FPSInstrument.supported()) {
-            let minimumDurationPerPixel = 1 / WebInspector.TimelineRecordFrame.MaximumWidthPixels;
-            let maximumDurationPerPixel = 1 / WebInspector.TimelineRecordFrame.MinimumWidthPixels;
-            this._renderingFramesViewModeSettings = this._createViewModeSettings(WebInspector.TimelineOverview.ViewMode.RenderingFrames, minimumDurationPerPixel, maximumDurationPerPixel, minimumDurationPerPixel, 0, 100);
+        if (WI.FPSInstrument.supported()) {
+            let minimumDurationPerPixel = 1 / WI.TimelineRecordFrame.MaximumWidthPixels;
+            let maximumDurationPerPixel = 1 / WI.TimelineRecordFrame.MinimumWidthPixels;
+            this._renderingFramesViewModeSettings = this._createViewModeSettings(WI.TimelineOverview.ViewMode.RenderingFrames, minimumDurationPerPixel, maximumDurationPerPixel, minimumDurationPerPixel, 0, 100);
         }
 
         this._recording = timelineRecording;
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentAdded, this._instrumentAdded, this);
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentRemoved, this._instrumentRemoved, this);
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.InstrumentAdded, this._instrumentAdded, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.InstrumentRemoved, this._instrumentRemoved, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.Reset, this._recordingReset, this);
 
         this._delegate = delegate;
 
         this.element.classList.add("timeline-overview");
         this._updateWheelAndGestureHandlers();
 
-        this._graphsContainerView = new WebInspector.View;
+        this._graphsContainerView = new WI.View;
         this._graphsContainerView.element.classList.add("graphs-container");
         this.addSubview(this._graphsContainerView);
 
         this._overviewGraphsByTypeMap = new Map;
 
-        this._editInstrumentsButton = new WebInspector.ActivateButtonNavigationItem("toggle-edit-instruments", WebInspector.UIString("Edit configuration"), WebInspector.UIString("Save configuration"));
-        this._editInstrumentsButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleEditingInstruments, this);
+        this._editInstrumentsButton = new WI.ActivateButtonNavigationItem("toggle-edit-instruments", WI.UIString("Edit configuration"), WI.UIString("Save configuration"));
+        this._editInstrumentsButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleEditingInstruments, this);
         this._editingInstruments = false;
         this._updateEditInstrumentsButton();
 
-        let instrumentsNavigationBar = new WebInspector.NavigationBar;
+        let instrumentsNavigationBar = new WI.NavigationBar;
         instrumentsNavigationBar.element.classList.add("timelines");
-        instrumentsNavigationBar.addNavigationItem(new WebInspector.FlexibleSpaceNavigationItem);
+        instrumentsNavigationBar.addNavigationItem(new WI.FlexibleSpaceNavigationItem);
         instrumentsNavigationBar.addNavigationItem(this._editInstrumentsButton);
         this.addSubview(instrumentsNavigationBar);
 
-        this._timelinesTreeOutline = new WebInspector.TreeOutline;
+        this._timelinesTreeOutline = new WI.TreeOutline;
         this._timelinesTreeOutline.element.classList.add("timelines");
         this._timelinesTreeOutline.disclosureButtons = false;
         this._timelinesTreeOutline.large = true;
-        this._timelinesTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._timelinesTreeSelectionDidChange, this);
+        this._timelinesTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._timelinesTreeSelectionDidChange, this);
         this.element.appendChild(this._timelinesTreeOutline.element);
 
         this._treeElementsByTypeMap = new Map;
 
-        this._timelineRuler = new WebInspector.TimelineRuler;
+        this._timelineRuler = new WI.TimelineRuler;
         this._timelineRuler.allowsClippedLabels = true;
         this._timelineRuler.allowsTimeRangeSelection = true;
         this._timelineRuler.element.addEventListener("mousedown", this._timelineRulerMouseDown.bind(this));
         this._timelineRuler.element.addEventListener("click", this._timelineRulerMouseClicked.bind(this));
-        this._timelineRuler.addEventListener(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
+        this._timelineRuler.addEventListener(WI.TimelineRuler.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
         this.addSubview(this._timelineRuler);
 
-        this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
+        this._currentTimeMarker = new WI.TimelineMarker(0, WI.TimelineMarker.Type.CurrentTime);
         this._timelineRuler.addMarker(this._currentTimeMarker);
 
         this._scrollContainerElement = document.createElement("div");
@@ -105,19 +105,19 @@
         this._mouseWheelDelta = 0;
         this._cachedScrollContainerWidth = NaN;
         this._timelineRulerSelectionChanged = false;
-        this._viewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
+        this._viewMode = WI.TimelineOverview.ViewMode.Timelines;
         this._selectedTimeline = null;
 
         for (let instrument of this._recording.instruments)
             this._instrumentAdded(instrument);
 
-        if (!WebInspector.timelineManager.isCapturingPageReload())
+        if (!WI.timelineManager.isCapturingPageReload())
             this._resetSelection();
 
         this._viewModeDidChange();
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
     }
 
     // Public
@@ -181,7 +181,7 @@
         if (this._startTime === x)
             return;
 
-        if (this._viewMode !== WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
+        if (this._viewMode !== WI.TimelineOverview.ViewMode.RenderingFrames) {
             let selectionOffset = this.selectionStartTime - this._startTime;
             this.selectionStartTime = selectionOffset + x;
         }
@@ -351,7 +351,7 @@
                 overviewGraph.shown();
         }
 
-        this.updateLayout(WebInspector.View.LayoutReason.Resize);
+        this.updateLayout(WI.View.LayoutReason.Resize);
     }
 
     hidden()
@@ -439,8 +439,8 @@
         let startTime = this._startTime;
         let endTime = this._endTime;
         let currentTime = this._currentTime;
-        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
-            let renderingFramesTimeline = this._recording.timelines.get(WebInspector.TimelineRecord.Type.RenderingFrame);
+        if (this._viewMode === WI.TimelineOverview.ViewMode.RenderingFrames) {
+            let renderingFramesTimeline = this._recording.timelines.get(WI.TimelineRecord.Type.RenderingFrame);
             console.assert(renderingFramesTimeline, "Recoring missing rendering frames timeline");
 
             startTime = 0;
@@ -514,7 +514,7 @@
         this._dontUpdateScrollLeft = true;
 
         let scrollOffset = this._scrollContainerElement.scrollLeft;
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             this.scrollStartTime = this._startTime - (scrollOffset * this.secondsPerPixel);
         else
             this.scrollStartTime = this._startTime + (scrollOffset * this.secondsPerPixel);
@@ -550,7 +550,7 @@
         let mouseOffset = event.pageX - this._graphsContainerView.element.totalOffsetLeft;
         let mousePositionTime = this._currentSettings.scrollStartTime + (mouseOffset * this.secondsPerPixel);
         let deviceDirection = event.webkitDirectionInvertedFromDevice ? 1 : -1;
-        let delta = event.deltaY * (this.secondsPerPixel / WebInspector.TimelineOverview.ScrollDeltaDenominator) * deviceDirection;
+        let delta = event.deltaY * (this.secondsPerPixel / WI.TimelineOverview.ScrollDeltaDenominator) * deviceDirection;
 
         // Reset accumulated wheel delta when direction changes.
         if (this._pixelAlignDuration && (delta < 0 && this._mouseWheelDelta >= 0 || delta >= 0 && this._mouseWheelDelta < 0))
@@ -614,20 +614,20 @@
 
     _instrumentAdded(instrumentOrEvent)
     {
-        let instrument = instrumentOrEvent instanceof WebInspector.Instrument ? instrumentOrEvent : instrumentOrEvent.data.instrument;
-        console.assert(instrument instanceof WebInspector.Instrument, instrument);
+        let instrument = instrumentOrEvent instanceof WI.Instrument ? instrumentOrEvent : instrumentOrEvent.data.instrument;
+        console.assert(instrument instanceof WI.Instrument, instrument);
 
         let timeline = this._recording.timelineForInstrument(instrument);
         console.assert(!this._overviewGraphsByTypeMap.has(timeline.type), timeline);
         console.assert(!this._treeElementsByTypeMap.has(timeline.type), timeline);
 
-        let treeElement = new WebInspector.TimelineTreeElement(timeline);
+        let treeElement = new WI.TimelineTreeElement(timeline);
         let insertionIndex = insertionIndexForObjectInListSortedByFunction(treeElement, this._timelinesTreeOutline.children, this._compareTimelineTreeElements.bind(this));
         this._timelinesTreeOutline.insertChild(treeElement, insertionIndex);
         this._treeElementsByTypeMap.set(timeline.type, treeElement);
 
-        let overviewGraph = WebInspector.TimelineOverviewGraph.createForTimeline(timeline, this);
-        overviewGraph.addEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
+        let overviewGraph = WI.TimelineOverviewGraph.createForTimeline(timeline, this);
+        overviewGraph.addEventListener(WI.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
         this._overviewGraphsByTypeMap.set(timeline.type, overviewGraph);
         this._graphsContainerView.insertSubviewBefore(overviewGraph, this._graphsContainerView.subviews[insertionIndex]);
 
@@ -642,7 +642,7 @@
     _instrumentRemoved(event)
     {
         let instrument = event.data.instrument;
-        console.assert(instrument instanceof WebInspector.Instrument, instrument);
+        console.assert(instrument instanceof WI.Instrument, instrument);
 
         let timeline = this._recording.timelineForInstrument(instrument);
         let overviewGraph = this._overviewGraphsByTypeMap.get(timeline.type);
@@ -653,7 +653,7 @@
         let shouldSuppressSelectSibling = true;
         this._timelinesTreeOutline.removeChild(treeElement, shouldSuppressOnDeselect, shouldSuppressSelectSibling);
 
-        overviewGraph.removeEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
+        overviewGraph.removeEventListener(WI.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
         this._graphsContainerView.removeSubview(overviewGraph);
 
         this._overviewGraphsByTypeMap.delete(timeline.type);
@@ -691,11 +691,11 @@
     {
         this._timelineRulerSelectionChanged = true;
 
-        let startTime = this._viewMode === WebInspector.TimelineOverview.ViewMode.Timelines ? this._startTime : 0;
+        let startTime = this._viewMode === WI.TimelineOverview.ViewMode.Timelines ? this._startTime : 0;
         this._currentSettings.selectionStartValueSetting.value = this.selectionStartTime - startTime;
         this._currentSettings.selectionDurationSetting.value = this.selectionDuration;
 
-        this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged);
+        this.dispatchEventToListeners(WI.TimelineOverview.Event.TimeRangeSelectionChanged);
     }
 
     _recordSelected(event)
@@ -706,7 +706,7 @@
 
             let timeline = this._recording.timelines.get(type);
             console.assert(timeline, "Timeline recording missing timeline type", type);
-            this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.RecordSelected, {timeline, record: event.data.record});
+            this.dispatchEventToListeners(WI.TimelineOverview.Event.RecordSelected, {timeline, record: event.data.record});
             return;
         }
     }
@@ -737,9 +737,9 @@
 
     _canShowTimelineType(type)
     {
-        let timelineViewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
-        if (type === WebInspector.TimelineRecord.Type.RenderingFrame)
-            timelineViewMode = WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+        let timelineViewMode = WI.TimelineOverview.ViewMode.Timelines;
+        if (type === WI.TimelineRecord.Type.RenderingFrame)
+            timelineViewMode = WI.TimelineOverview.ViewMode.RenderingFrames;
 
         return timelineViewMode === this._viewMode;
     }
@@ -747,7 +747,7 @@
     _viewModeDidChange()
     {
         let startTime = 0;
-        let isRenderingFramesMode = this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+        let isRenderingFramesMode = this._viewMode === WI.TimelineOverview.ViewMode.RenderingFrames;
         if (isRenderingFramesMode) {
             this._timelineRuler.minimumSelectionDuration = 1;
             this._timelineRuler.snapInterval = 1;
@@ -777,16 +777,16 @@
 
         this.element.classList.toggle("frames", isRenderingFramesMode);
 
-        this.updateLayout(WebInspector.View.LayoutReason.Resize);
+        this.updateLayout(WI.View.LayoutReason.Resize);
     }
 
     _createViewModeSettings(viewMode, minimumDurationPerPixel, maximumDurationPerPixel, durationPerPixel, selectionStartValue, selectionDuration)
     {
         durationPerPixel = Math.min(maximumDurationPerPixel, Math.max(minimumDurationPerPixel, durationPerPixel));
 
-        let durationPerPixelSetting = new WebInspector.Setting(viewMode + "-duration-per-pixel", durationPerPixel);
-        let selectionStartValueSetting = new WebInspector.Setting(viewMode + "-selection-start-value", selectionStartValue);
-        let selectionDurationSetting = new WebInspector.Setting(viewMode + "-selection-duration", selectionDuration);
+        let durationPerPixelSetting = new WI.Setting(viewMode + "-duration-per-pixel", durationPerPixel);
+        let selectionStartValueSetting = new WI.Setting(viewMode + "-selection-start-value", selectionStartValue);
+        let selectionDurationSetting = new WI.Setting(viewMode + "-selection-duration", selectionDuration);
 
         return {
             scrollStartTime: 0,
@@ -800,7 +800,7 @@
 
     get _currentSettings()
     {
-        return this._viewMode === WebInspector.TimelineOverview.ViewMode.Timelines ? this._timelinesViewModeSettings : this._renderingFramesViewModeSettings;
+        return this._viewMode === WI.TimelineOverview.ViewMode.Timelines ? this._timelinesViewModeSettings : this._renderingFramesViewModeSettings;
     }
 
     _timelinesTreeSelectionDidChange(event)
@@ -817,7 +817,7 @@
         let timeline = null;
         if (selectedTreeElement) {
             timeline = selectedTreeElement.representedObject;
-            console.assert(timeline instanceof WebInspector.Timeline, timeline);
+            console.assert(timeline instanceof WI.Timeline, timeline);
             console.assert(this._recording.timelines.get(timeline.type) === timeline, timeline);
 
             updateGraphSelectedState.call(this, timeline, true);
@@ -827,7 +827,7 @@
             updateGraphSelectedState.call(this, deselectedTreeElement.representedObject, false);
 
         this._selectedTimeline = timeline;
-        this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimelineSelected);
+        this.dispatchEventToListeners(WI.TimelineOverview.Event.TimelineSelected);
     }
 
     _toggleEditingInstruments(event)
@@ -840,21 +840,21 @@
 
     _editingInstrumentsDidChange()
     {
-        this.element.classList.toggle(WebInspector.TimelineOverview.EditInstrumentsStyleClassName, this._editingInstruments);
+        this.element.classList.toggle(WI.TimelineOverview.EditInstrumentsStyleClassName, this._editingInstruments);
         this._timelineRuler.enabled = !this._editingInstruments;
 
         this._updateWheelAndGestureHandlers();
         this._updateEditInstrumentsButton();
 
-        this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.EditingInstrumentsDidChange);
+        this.dispatchEventToListeners(WI.TimelineOverview.Event.EditingInstrumentsDidChange);
     }
 
     _updateEditInstrumentsButton()
     {
-        let newLabel = this._editingInstruments ? WebInspector.UIString("Done") : WebInspector.UIString("Edit");
+        let newLabel = this._editingInstruments ? WI.UIString("Done") : WI.UIString("Edit");
         this._editInstrumentsButton.label = newLabel;
         this._editInstrumentsButton.activated = this._editingInstruments;
-        this._editInstrumentsButton.enabled = !WebInspector.timelineManager.isCapturing();
+        this._editInstrumentsButton.enabled = !WI.timelineManager.isCapturing();
     }
 
     _updateWheelAndGestureHandlers()
@@ -882,7 +882,7 @@
 
     _startEditingInstruments()
     {
-        console.assert(this._viewMode === WebInspector.TimelineOverview.ViewMode.Timelines);
+        console.assert(this._viewMode === WI.TimelineOverview.ViewMode.Timelines);
 
         if (this._editingInstruments)
             return;
@@ -896,19 +896,19 @@
                 console.assert(timeline, "Missing timeline for type " + type);
 
                 const placeholder = true;
-                treeElement = new WebInspector.TimelineTreeElement(timeline, placeholder);
+                treeElement = new WI.TimelineTreeElement(timeline, placeholder);
 
                 let insertionIndex = insertionIndexForObjectInListSortedByFunction(treeElement, this._timelinesTreeOutline.children, this._compareTimelineTreeElements.bind(this));
                 this._timelinesTreeOutline.insertChild(treeElement, insertionIndex);
 
-                let placeholderGraph = new WebInspector.View;
+                let placeholderGraph = new WI.View;
                 placeholderGraph.element.classList.add("timeline-overview-graph");
-                treeElement[WebInspector.TimelineOverview.PlaceholderOverviewGraph] = placeholderGraph;
+                treeElement[WI.TimelineOverview.PlaceholderOverviewGraph] = placeholderGraph;
                 this._graphsContainerView.insertSubviewBefore(placeholderGraph, this._graphsContainerView.subviews[insertionIndex]);
             }
 
             treeElement.editing = true;
-            treeElement.addEventListener(WebInspector.TimelineTreeElement.Event.EnabledDidChange, this._timelineTreeElementEnabledDidChange, this);
+            treeElement.addEventListener(WI.TimelineTreeElement.Event.EnabledDidChange, this._timelineTreeElementEnabledDidChange, this);
         }
 
         this._editingInstrumentsDidChange();
@@ -925,7 +925,7 @@
         for (let treeElement of this._treeElementsByTypeMap.values()) {
             if (treeElement.status.checked) {
                 treeElement.editing = false;
-                treeElement.removeEventListener(WebInspector.TimelineTreeElement.Event.EnabledDidChange, this._timelineTreeElementEnabledDidChange, this);
+                treeElement.removeEventListener(WI.TimelineTreeElement.Event.EnabledDidChange, this._timelineTreeElementEnabledDidChange, this);
                 continue;
             }
 
@@ -937,18 +937,18 @@
         for (let treeElement of placeholderTreeElements) {
             this._timelinesTreeOutline.removeChild(treeElement);
 
-            let placeholderGraph = treeElement[WebInspector.TimelineOverview.PlaceholderOverviewGraph];
+            let placeholderGraph = treeElement[WI.TimelineOverview.PlaceholderOverviewGraph];
             console.assert(placeholderGraph);
             this._graphsContainerView.removeSubview(placeholderGraph);
 
             if (treeElement.status.checked) {
-                let instrument = WebInspector.Instrument.createForTimelineType(treeElement.representedObject.type);
+                let instrument = WI.Instrument.createForTimelineType(treeElement.representedObject.type);
                 this._recording.addInstrument(instrument);
             }
         }
 
         let instrumentTypes = instruments.map((instrument) => instrument.timelineRecordType);
-        WebInspector.timelineManager.enabledTimelineTypes = instrumentTypes;
+        WI.timelineManager.enabledTimelineTypes = instrumentTypes;
 
         this._editingInstrumentsDidChange();
     }
@@ -970,9 +970,9 @@
         let bTimelineType = b.representedObject.type;
 
         // Always sort the Rendering Frames timeline last.
-        if (aTimelineType === WebInspector.TimelineRecord.Type.RenderingFrame)
+        if (aTimelineType === WI.TimelineRecord.Type.RenderingFrame)
             return 1;
-        if (bTimelineType === WebInspector.TimelineRecord.Type.RenderingFrame)
+        if (bTimelineType === WI.TimelineRecord.Type.RenderingFrame)
             return -1;
 
         if (a.placeholder !== b.placeholder)
@@ -994,19 +994,19 @@
     }
 };
 
-WebInspector.TimelineOverview.PlaceholderOverviewGraph = Symbol("placeholder-overview-graph");
+WI.TimelineOverview.PlaceholderOverviewGraph = Symbol("placeholder-overview-graph");
 
-WebInspector.TimelineOverview.ScrollDeltaDenominator = 500;
-WebInspector.TimelineOverview.EditInstrumentsStyleClassName = "edit-instruments";
-WebInspector.TimelineOverview.MinimumDurationPerPixel = 0.0001;
-WebInspector.TimelineOverview.MaximumDurationPerPixel = 60;
+WI.TimelineOverview.ScrollDeltaDenominator = 500;
+WI.TimelineOverview.EditInstrumentsStyleClassName = "edit-instruments";
+WI.TimelineOverview.MinimumDurationPerPixel = 0.0001;
+WI.TimelineOverview.MaximumDurationPerPixel = 60;
 
-WebInspector.TimelineOverview.ViewMode = {
+WI.TimelineOverview.ViewMode = {
     Timelines: "timeline-overview-view-mode-timelines",
     RenderingFrames: "timeline-overview-view-mode-rendering-frames"
 };
 
-WebInspector.TimelineOverview.Event = {
+WI.TimelineOverview.Event = {
     EditingInstrumentsDidChange: "editing-instruments-did-change",
     RecordSelected: "timeline-overview-record-selected",
     TimelineSelected: "timeline-overview-timeline-selected",
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js b/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js
index 2f232cd..3afbc4d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineOverviewGraph = class TimelineOverviewGraph extends WebInspector.View
+WI.TimelineOverviewGraph = class TimelineOverviewGraph extends WI.View
 {
     constructor(timelineOverview)
     {
@@ -47,27 +47,27 @@
 
     static createForTimeline(timeline, timelineOverview)
     {
-        console.assert(timeline instanceof WebInspector.Timeline, timeline);
-        console.assert(timelineOverview instanceof WebInspector.TimelineOverview, timelineOverview);
+        console.assert(timeline instanceof WI.Timeline, timeline);
+        console.assert(timelineOverview instanceof WI.TimelineOverview, timelineOverview);
 
         var timelineType = timeline.type;
-        if (timelineType === WebInspector.TimelineRecord.Type.Network)
-            return new WebInspector.NetworkTimelineOverviewGraph(timeline, timelineOverview);
+        if (timelineType === WI.TimelineRecord.Type.Network)
+            return new WI.NetworkTimelineOverviewGraph(timeline, timelineOverview);
 
-        if (timelineType === WebInspector.TimelineRecord.Type.Layout)
-            return new WebInspector.LayoutTimelineOverviewGraph(timeline, timelineOverview);
+        if (timelineType === WI.TimelineRecord.Type.Layout)
+            return new WI.LayoutTimelineOverviewGraph(timeline, timelineOverview);
 
-        if (timelineType === WebInspector.TimelineRecord.Type.Script)
-            return new WebInspector.ScriptTimelineOverviewGraph(timeline, timelineOverview);
+        if (timelineType === WI.TimelineRecord.Type.Script)
+            return new WI.ScriptTimelineOverviewGraph(timeline, timelineOverview);
 
-        if (timelineType === WebInspector.TimelineRecord.Type.RenderingFrame)
-            return new WebInspector.RenderingFrameTimelineOverviewGraph(timeline, timelineOverview);
+        if (timelineType === WI.TimelineRecord.Type.RenderingFrame)
+            return new WI.RenderingFrameTimelineOverviewGraph(timeline, timelineOverview);
 
-        if (timelineType === WebInspector.TimelineRecord.Type.Memory)
-            return new WebInspector.MemoryTimelineOverviewGraph(timeline, timelineOverview);
+        if (timelineType === WI.TimelineRecord.Type.Memory)
+            return new WI.MemoryTimelineOverviewGraph(timeline, timelineOverview);
 
-        if (timelineType === WebInspector.TimelineRecord.Type.HeapAllocations)
-            return new WebInspector.HeapAllocationsTimelineOverviewGraph(timeline, timelineOverview);
+        if (timelineType === WI.TimelineRecord.Type.HeapAllocations)
+            return new WI.HeapAllocationsTimelineOverviewGraph(timeline, timelineOverview);
 
         throw new Error("Can't make a graph for an unknown timeline.");
     }
@@ -248,11 +248,11 @@
             this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
 
             this.updateSelectedRecord();
-            this.dispatchEventToListeners(WebInspector.TimelineOverviewGraph.Event.RecordSelected, {record: this.selectedRecord});
+            this.dispatchEventToListeners(WI.TimelineOverviewGraph.Event.RecordSelected, {record: this.selectedRecord});
         });
     }
 };
 
-WebInspector.TimelineOverviewGraph.Event = {
+WI.TimelineOverviewGraph.Event = {
     RecordSelected: "timeline-overview-graph-record-selected"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js
index 309c561..358f71f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecordBar = class TimelineRecordBar extends WebInspector.Object
+WI.TimelineRecordBar = class TimelineRecordBar extends WI.Object
 {
     constructor(records, renderMode)
     {
@@ -31,7 +31,7 @@
 
         this._element = document.createElement("div");
         this._element.classList.add("timeline-record-bar");
-        this._element[WebInspector.TimelineRecordBar.ElementReferenceSymbol] = this;
+        this._element[WI.TimelineRecordBar.ElementReferenceSymbol] = this;
 
         this.renderMode = renderMode;
         this.records = records;
@@ -84,7 +84,7 @@
             return;
 
         if (visibleRecords.length === 1) {
-            createBarCallback(visibleRecords, WebInspector.TimelineRecordBar.RenderMode.Normal);
+            createBarCallback(visibleRecords, WI.TimelineRecordBar.RenderMode.Normal);
             return;
         }
 
@@ -93,8 +93,8 @@
             return a.activeStartTime - b.activeStartTime;
         }
 
-        var minimumDuration = secondsPerPixel * WebInspector.TimelineRecordBar.MinimumWidthPixels;
-        var minimumMargin = secondsPerPixel * WebInspector.TimelineRecordBar.MinimumMarginPixels;
+        var minimumDuration = secondsPerPixel * WI.TimelineRecordBar.MinimumWidthPixels;
+        var minimumMargin = secondsPerPixel * WI.TimelineRecordBar.MinimumMarginPixels;
 
         if (usesActiveStartTime) {
             var inactiveStartTime = NaN;
@@ -106,7 +106,7 @@
 
                 // Check if the previous record is far enough away to create the inactive bar.
                 if (!isNaN(inactiveStartTime) && inactiveStartTime + Math.max(inactiveEndTime - inactiveStartTime, minimumDuration) + minimumMargin <= record.startTime) {
-                    createBarCallback(inactiveRecords, WebInspector.TimelineRecordBar.RenderMode.InactiveOnly);
+                    createBarCallback(inactiveRecords, WI.TimelineRecordBar.RenderMode.InactiveOnly);
                     inactiveRecords = [];
                     inactiveStartTime = NaN;
                     inactiveEndTime = NaN;
@@ -124,7 +124,7 @@
 
             // Create the inactive bar for the last record if needed.
             if (!isNaN(inactiveStartTime))
-                createBarCallback(inactiveRecords, WebInspector.TimelineRecordBar.RenderMode.InactiveOnly);
+                createBarCallback(inactiveRecords, WI.TimelineRecordBar.RenderMode.InactiveOnly);
 
             visibleRecords.sort(compareByActiveStartTime);
         }
@@ -142,7 +142,7 @@
             // Check if the previous record is far enough away to create the active bar. We also create it now if the current record has no active state time.
             if (!isNaN(activeStartTime) && (activeStartTime + Math.max(activeEndTime - activeStartTime, minimumDuration) + minimumMargin <= startTime
                 || (isNaN(startTime) && !isNaN(activeEndTime)))) {
-                createBarCallback(activeRecords, WebInspector.TimelineRecordBar.RenderMode.ActiveOnly);
+                createBarCallback(activeRecords, WI.TimelineRecordBar.RenderMode.ActiveOnly);
                 activeRecords = [];
                 activeStartTime = NaN;
                 activeEndTime = NaN;
@@ -164,12 +164,12 @@
 
         // Create the active bar for the last record if needed.
         if (!isNaN(activeStartTime))
-            createBarCallback(activeRecords, WebInspector.TimelineRecordBar.RenderMode.ActiveOnly);
+            createBarCallback(activeRecords, WI.TimelineRecordBar.RenderMode.ActiveOnly);
     }
 
     static fromElement(element)
     {
-        return element[WebInspector.TimelineRecordBar.ElementReferenceSymbol] || null;
+        return element[WI.TimelineRecordBar.ElementReferenceSymbol] || null;
     }
 
     // Public
@@ -186,7 +186,7 @@
 
     set renderMode(renderMode)
     {
-        this._renderMode = renderMode || WebInspector.TimelineRecordBar.RenderMode.Normal;
+        this._renderMode = renderMode || WI.TimelineRecordBar.RenderMode.Normal;
     }
 
     get records()
@@ -271,13 +271,13 @@
         var graphDuration = graphEndTime - graphStartTime;
 
         let newBarPosition = (barStartTime - graphStartTime) / graphDuration;
-        let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+        let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
         this._updateElementPosition(this._element, newBarPosition, property);
 
         var newBarWidth = ((barEndTime - graphStartTime) / graphDuration) - newBarPosition;
         this._updateElementPosition(this._element, newBarWidth, "width");
 
-        if (!this._activeBarElement && this._renderMode !== WebInspector.TimelineRecordBar.RenderMode.InactiveOnly) {
+        if (!this._activeBarElement && this._renderMode !== WI.TimelineRecordBar.RenderMode.InactiveOnly) {
             this._activeBarElement = document.createElement("div");
             this._activeBarElement.classList.add("segment");
         }
@@ -288,7 +288,7 @@
             if (this._inactiveBarElement)
                 this._inactiveBarElement.remove();
 
-            if (this._renderMode === WebInspector.TimelineRecordBar.RenderMode.InactiveOnly) {
+            if (this._renderMode === WI.TimelineRecordBar.RenderMode.InactiveOnly) {
                 if (this._activeBarElement)
                     this._activeBarElement.remove();
 
@@ -296,7 +296,7 @@
             }
 
             // If this TimelineRecordBar is reused and had an inactive bar previously, clean it up.
-            this._activeBarElement.style.removeProperty(WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left");
+            this._activeBarElement.style.removeProperty(WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left");
             this._activeBarElement.style.removeProperty("width");
 
             if (!this._activeBarElement.parentNode)
@@ -307,7 +307,7 @@
 
         // Find the earliest active start time for active only rendering, and the latest for the other modes.
         // This matches the values that TimelineRecordBar.createCombinedBars uses when combining.
-        if (this._renderMode === WebInspector.TimelineRecordBar.RenderMode.ActiveOnly)
+        if (this._renderMode === WI.TimelineRecordBar.RenderMode.ActiveOnly)
             var barActiveStartTime = this._records.reduce(function(previousValue, currentValue) { return Math.min(previousValue, currentValue.activeStartTime); }, Infinity);
         else
             var barActiveStartTime = this._records.reduce(function(previousValue, currentValue) { return Math.max(previousValue, currentValue.activeStartTime); }, 0);
@@ -319,9 +319,9 @@
 
         if (inactiveUnfinished)
             barActiveStartTime = graphCurrentTime;
-        else if (this._renderMode === WebInspector.TimelineRecordBar.RenderMode.Normal) {
+        else if (this._renderMode === WI.TimelineRecordBar.RenderMode.Normal) {
             // Hide the inactive segment when its duration is less than the minimum displayable size.
-            let minimumSegmentDuration = graphDataSource.secondsPerPixel * WebInspector.TimelineRecordBar.MinimumWidthPixels;
+            let minimumSegmentDuration = graphDataSource.secondsPerPixel * WI.TimelineRecordBar.MinimumWidthPixels;
             if (barActiveStartTime - barStartTime < minimumSegmentDuration) {
                 barActiveStartTime = barStartTime;
                 if (this._inactiveBarElement)
@@ -333,14 +333,14 @@
         this._element.classList.toggle("has-inactive-segment", showInactiveSegment);
 
         let middlePercentage = (barActiveStartTime - barStartTime) / barDuration;
-        if (showInactiveSegment && this._renderMode !== WebInspector.TimelineRecordBar.RenderMode.ActiveOnly) {
+        if (showInactiveSegment && this._renderMode !== WI.TimelineRecordBar.RenderMode.ActiveOnly) {
             if (!this._inactiveBarElement) {
                 this._inactiveBarElement = document.createElement("div");
                 this._inactiveBarElement.classList.add("segment");
                 this._inactiveBarElement.classList.add("inactive");
             }
 
-            let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "left" : "right";
+            let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "left" : "right";
             this._updateElementPosition(this._inactiveBarElement, 1 - middlePercentage, property);
             this._updateElementPosition(this._inactiveBarElement, middlePercentage, "width");
 
@@ -348,8 +348,8 @@
                 this._element.insertBefore(this._inactiveBarElement, this._element.firstChild);
         }
 
-        if (!inactiveUnfinished && this._renderMode !== WebInspector.TimelineRecordBar.RenderMode.InactiveOnly) {
-            let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+        if (!inactiveUnfinished && this._renderMode !== WI.TimelineRecordBar.RenderMode.InactiveOnly) {
+            let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
             this._updateElementPosition(this._activeBarElement, middlePercentage, property);
             this._updateElementPosition(this._activeBarElement, 1 - middlePercentage, "width");
 
@@ -374,12 +374,12 @@
     }
 };
 
-WebInspector.TimelineRecordBar.ElementReferenceSymbol = Symbol("timeline-record-bar");
+WI.TimelineRecordBar.ElementReferenceSymbol = Symbol("timeline-record-bar");
 
-WebInspector.TimelineRecordBar.MinimumWidthPixels = 4;
-WebInspector.TimelineRecordBar.MinimumMarginPixels = 1;
+WI.TimelineRecordBar.MinimumWidthPixels = 4;
+WI.TimelineRecordBar.MinimumMarginPixels = 1;
 
-WebInspector.TimelineRecordBar.RenderMode = {
+WI.TimelineRecordBar.RenderMode = {
     Normal: "timeline-record-bar-normal-render-mode",
     InactiveOnly: "timeline-record-bar-inactive-only-render-mode",
     ActiveOnly: "timeline-record-bar-active-only-render-mode"
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js
index 59101d9..78a40a3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecordFrame = class TimelineRecordFrame extends WebInspector.Object
+WI.TimelineRecordFrame = class TimelineRecordFrame extends WI.Object
 {
     constructor(graphDataSource, record)
     {
@@ -99,7 +99,7 @@
         var graphDuration = graphDataSource.endTime - graphDataSource.startTime;
         let recordPosition = (frameIndex - graphDataSource.startTime) / graphDuration;
 
-        let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+        let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
         this._updateElementPosition(this._element, recordPosition, property);
 
         this._updateChildElements(graphDataSource);
@@ -111,7 +111,7 @@
 
     _calculateFrameDisplayData(graphDataSource)
     {
-        var secondsPerBlock = (graphDataSource.graphHeightSeconds / graphDataSource.height) * WebInspector.TimelineRecordFrame.MinimumHeightPixels;
+        var secondsPerBlock = (graphDataSource.graphHeightSeconds / graphDataSource.height) * WI.TimelineRecordFrame.MinimumHeightPixels;
         var segments = [];
         var invisibleSegments = [];
         var currentSegment = null;
@@ -142,8 +142,8 @@
         // block high are grouped until the minimum is met, or a task meeting the minimum is found. The group is then
         // added to the list of segment candidates. Large tasks (one block or more) are not grouped with other tasks
         // and are simply added to the candidate list.
-        for (var key in WebInspector.RenderingFrameTimelineRecord.TaskType) {
-            var taskType = WebInspector.RenderingFrameTimelineRecord.TaskType[key];
+        for (var key in WI.RenderingFrameTimelineRecord.TaskType) {
+            var taskType = WI.RenderingFrameTimelineRecord.TaskType[key];
             var duration = this._record.durationForTask(taskType);
             if (duration === 0)
                 continue;
@@ -283,6 +283,6 @@
     }
 };
 
-WebInspector.TimelineRecordFrame.MinimumHeightPixels = 3;
-WebInspector.TimelineRecordFrame.MaximumWidthPixels = 14;
-WebInspector.TimelineRecordFrame.MinimumWidthPixels = 4;
+WI.TimelineRecordFrame.MinimumHeightPixels = 3;
+WI.TimelineRecordFrame.MaximumWidthPixels = 14;
+WI.TimelineRecordFrame.MinimumWidthPixels = 4;
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js
index 92ac0fd..2eea55f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecordTreeElement = class TimelineRecordTreeElement extends WebInspector.GeneralTreeElement
+WI.TimelineRecordTreeElement = class TimelineRecordTreeElement extends WI.GeneralTreeElement
 {
     constructor(timelineRecord, subtitleNameStyle, includeDetailsInMainTitle, sourceCodeLocation, representedObject)
     {
@@ -32,28 +32,28 @@
         sourceCodeLocation = sourceCodeLocation || timelineRecord.sourceCodeLocation || null;
 
         let alternateSubtitle = null;
-        if (includeDetailsInMainTitle && timelineRecord.type === WebInspector.TimelineRecord.Type.Script && timelineRecord.eventType === WebInspector.ScriptTimelineRecord.EventType.TimerInstalled) {
+        if (includeDetailsInMainTitle && timelineRecord.type === WI.TimelineRecord.Type.Script && timelineRecord.eventType === WI.ScriptTimelineRecord.EventType.TimerInstalled) {
             let timeoutString = Number.secondsToString(timelineRecord.details.timeout / 1000);
             alternateSubtitle = document.createElement("span");
             alternateSubtitle.classList.add("alternate-subtitle");
             if (timelineRecord.details.repeating)
-                alternateSubtitle.textContent = WebInspector.UIString("%s interval").format(timeoutString);
+                alternateSubtitle.textContent = WI.UIString("%s interval").format(timeoutString);
             else
-                alternateSubtitle.textContent = WebInspector.UIString("%s delay").format(timeoutString);
+                alternateSubtitle.textContent = WI.UIString("%s delay").format(timeoutString);
         }
 
         let subtitle = null;
         if (sourceCodeLocation) {
             subtitle = document.createElement("span");
 
-            if (subtitleNameStyle !== WebInspector.SourceCodeLocation.NameStyle.None)
+            if (subtitleNameStyle !== WI.SourceCodeLocation.NameStyle.None)
                 sourceCodeLocation.populateLiveDisplayLocationString(subtitle, "textContent", null, subtitleNameStyle);
             else
-                sourceCodeLocation.populateLiveDisplayLocationString(subtitle, "textContent", null, WebInspector.SourceCodeLocation.NameStyle.None, WebInspector.UIString("line "));
+                sourceCodeLocation.populateLiveDisplayLocationString(subtitle, "textContent", null, WI.SourceCodeLocation.NameStyle.None, WI.UIString("line "));
         }
 
-        let iconStyleClass = WebInspector.TimelineTabContentView.iconClassNameForRecord(timelineRecord);
-        let title = WebInspector.TimelineTabContentView.displayNameForRecord(timelineRecord);
+        let iconStyleClass = WI.TimelineTabContentView.iconClassNameForRecord(timelineRecord);
+        let title = WI.TimelineTabContentView.displayNameForRecord(timelineRecord);
 
         super([iconStyleClass], title, subtitle, representedObject || timelineRecord);
 
@@ -101,16 +101,16 @@
     }
 };
 
-WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass = "style-record";
-WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass = "layout-record";
-WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass = "paint-record";
-WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass = "composite-record";
-WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass = "rendering-frame-record";
-WebInspector.TimelineRecordTreeElement.APIRecordIconStyleClass = "api-record";
-WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass = "evaluated-record";
-WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass = "event-record";
-WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass = "timer-record";
-WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass = "animation-record";
-WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass = "probe-record";
-WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass = "console-profile-record";
-WebInspector.TimelineRecordTreeElement.GarbageCollectionIconStyleClass = "garbage-collection-profile-record";
+WI.TimelineRecordTreeElement.StyleRecordIconStyleClass = "style-record";
+WI.TimelineRecordTreeElement.LayoutRecordIconStyleClass = "layout-record";
+WI.TimelineRecordTreeElement.PaintRecordIconStyleClass = "paint-record";
+WI.TimelineRecordTreeElement.CompositeRecordIconStyleClass = "composite-record";
+WI.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass = "rendering-frame-record";
+WI.TimelineRecordTreeElement.APIRecordIconStyleClass = "api-record";
+WI.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass = "evaluated-record";
+WI.TimelineRecordTreeElement.EventRecordIconStyleClass = "event-record";
+WI.TimelineRecordTreeElement.TimerRecordIconStyleClass = "timer-record";
+WI.TimelineRecordTreeElement.AnimationRecordIconStyleClass = "animation-record";
+WI.TimelineRecordTreeElement.ProbeRecordIconStyleClass = "probe-record";
+WI.TimelineRecordTreeElement.ConsoleProfileIconStyleClass = "console-profile-record";
+WI.TimelineRecordTreeElement.GarbageCollectionIconStyleClass = "garbage-collection-profile-record";
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
index 5f5b1fa..ae82588 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
@@ -24,7 +24,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecordingContentView = class TimelineRecordingContentView extends WebInspector.ContentView
+WI.TimelineRecordingContentView = class TimelineRecordingContentView extends WI.ContentView
 {
     constructor(recording)
     {
@@ -34,36 +34,36 @@
 
         this.element.classList.add("timeline-recording");
 
-        this._timelineOverview = new WebInspector.TimelineOverview(this._recording, this);
-        this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
-        this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.RecordSelected, this._recordSelected, this);
-        this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimelineSelected, this._timelineSelected, this);
-        this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.EditingInstrumentsDidChange, this._editingInstrumentsDidChange, this);
+        this._timelineOverview = new WI.TimelineOverview(this._recording, this);
+        this._timelineOverview.addEventListener(WI.TimelineOverview.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
+        this._timelineOverview.addEventListener(WI.TimelineOverview.Event.RecordSelected, this._recordSelected, this);
+        this._timelineOverview.addEventListener(WI.TimelineOverview.Event.TimelineSelected, this._timelineSelected, this);
+        this._timelineOverview.addEventListener(WI.TimelineOverview.Event.EditingInstrumentsDidChange, this._editingInstrumentsDidChange, this);
         this.addSubview(this._timelineOverview);
 
         const disableBackForward = true;
         const disableFindBanner = true;
-        this._timelineContentBrowser = new WebInspector.ContentBrowser(null, this, disableBackForward, disableFindBanner);
-        this._timelineContentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
+        this._timelineContentBrowser = new WI.ContentBrowser(null, this, disableBackForward, disableFindBanner);
+        this._timelineContentBrowser.addEventListener(WI.ContentBrowser.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
 
-        this._entireRecordingPathComponent = this._createTimelineRangePathComponent(WebInspector.UIString("Entire Recording"));
+        this._entireRecordingPathComponent = this._createTimelineRangePathComponent(WI.UIString("Entire Recording"));
         this._timelineSelectionPathComponent = this._createTimelineRangePathComponent();
         this._timelineSelectionPathComponent.previousSibling = this._entireRecordingPathComponent;
         this._selectedTimeRangePathComponent = this._entireRecordingPathComponent;
 
-        this._filterBarNavigationItem = new WebInspector.FilterBarNavigationItem;
-        this._filterBarNavigationItem.filterBar.placeholder = WebInspector.UIString("Filter Records");
-        this._filterBarNavigationItem.filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange, this._filterDidChange, this);
+        this._filterBarNavigationItem = new WI.FilterBarNavigationItem;
+        this._filterBarNavigationItem.filterBar.placeholder = WI.UIString("Filter Records");
+        this._filterBarNavigationItem.filterBar.addEventListener(WI.FilterBar.Event.FilterDidChange, this._filterDidChange, this);
         this._timelineContentBrowser.navigationBar.addNavigationItem(this._filterBarNavigationItem);
         this.addSubview(this._timelineContentBrowser);
 
-        this._clearTimelineNavigationItem = new WebInspector.ButtonNavigationItem("clear-timeline", WebInspector.UIString("Clear Timeline (%s)").format(WebInspector.clearKeyboardShortcut.displayName), "Images/NavigationItemClear.svg", 16, 16);
-        this._clearTimelineNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearTimeline, this);
+        this._clearTimelineNavigationItem = new WI.ButtonNavigationItem("clear-timeline", WI.UIString("Clear Timeline (%s)").format(WI.clearKeyboardShortcut.displayName), "Images/NavigationItemClear.svg", 16, 16);
+        this._clearTimelineNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._clearTimeline, this);
 
-        this._overviewTimelineView = new WebInspector.OverviewTimelineView(recording);
+        this._overviewTimelineView = new WI.OverviewTimelineView(recording);
         this._overviewTimelineView.secondsPerPixel = this._timelineOverview.secondsPerPixel;
 
-        this._progressView = new WebInspector.TimelineRecordingProgressView;
+        this._progressView = new WI.TimelineRecordingProgressView;
         this._timelineContentBrowser.addSubview(this._progressView);
 
         this._timelineViewMap = new Map;
@@ -76,23 +76,23 @@
         this._startTimeNeedsReset = true;
         this._renderingFrameTimeline = null;
 
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentAdded, this._instrumentAdded, this);
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentRemoved, this._instrumentRemoved, this);
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
-        this._recording.addEventListener(WebInspector.TimelineRecording.Event.Unloaded, this._recordingUnloaded, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.InstrumentAdded, this._instrumentAdded, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.InstrumentRemoved, this._instrumentRemoved, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.Reset, this._recordingReset, this);
+        this._recording.addEventListener(WI.TimelineRecording.Event.Unloaded, this._recordingUnloaded, this);
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerPaused, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerResumed, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, this._debuggerPaused, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, this._debuggerResumed, this);
 
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
-        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
+        WI.ContentView.addEventListener(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
 
-        WebInspector.TimelineView.addEventListener(WebInspector.TimelineView.Event.RecordWasFiltered, this._recordWasFiltered, this);
+        WI.TimelineView.addEventListener(WI.TimelineView.Event.RecordWasFiltered, this._recordWasFiltered, this);
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange, this._inspectorVisibilityStateChanged, this);
+        WI.notifications.addEventListener(WI.Notification.VisibilityStateDidChange, this._inspectorVisibilityStateChanged, this);
 
         for (let instrument of this._recording.instruments)
             this._instrumentAdded(instrument);
@@ -109,7 +109,7 @@
 
     showTimelineViewForTimeline(timeline)
     {
-        console.assert(timeline instanceof WebInspector.Timeline, timeline);
+        console.assert(timeline instanceof WI.Timeline, timeline);
         console.assert(this._timelineViewMap.has(timeline), timeline);
         if (!this._timelineViewMap.has(timeline))
             return;
@@ -130,7 +130,7 @@
 
         let pathComponents = [];
         let representedObject = this._timelineContentBrowser.currentContentView.representedObject;
-        if (representedObject instanceof WebInspector.Timeline)
+        if (representedObject instanceof WI.Timeline)
             pathComponents.push(this._pathComponentMap.get(representedObject));
 
         pathComponents.push(this._selectedTimeRangePathComponent);
@@ -182,7 +182,7 @@
 
         this._currentContentViewDidChange();
 
-        if (!this._updating && WebInspector.timelineManager.activeRecording === this._recording && WebInspector.timelineManager.isCapturing())
+        if (!this._updating && WI.timelineManager.activeRecording === this._recording && WI.timelineManager.isCapturing())
             this._startUpdatingCurrentTime(this._currentTime);
     }
 
@@ -205,9 +205,9 @@
 
         this._recording.removeEventListener(null, null, this);
 
-        WebInspector.timelineManager.removeEventListener(null, null, this);
-        WebInspector.debuggerManager.removeEventListener(null, null, this);
-        WebInspector.ContentView.removeEventListener(null, null, this);
+        WI.timelineManager.removeEventListener(null, null, this);
+        WI.debuggerManager.removeEventListener(null, null, this);
+        WI.ContentView.removeEventListener(null, null, this);
     }
 
     canGoBack()
@@ -239,21 +239,21 @@
 
     contentBrowserTreeElementForRepresentedObject(contentBrowser, representedObject)
     {
-        if (!(representedObject instanceof WebInspector.Timeline) && !(representedObject instanceof WebInspector.TimelineRecording))
+        if (!(representedObject instanceof WI.Timeline) && !(representedObject instanceof WI.TimelineRecording))
             return null;
 
         let iconClassName;
         let title;
-        if (representedObject instanceof WebInspector.Timeline) {
-            iconClassName = WebInspector.TimelineTabContentView.iconClassNameForTimelineType(representedObject.type);
-            title = WebInspector.UIString("Details");
+        if (representedObject instanceof WI.Timeline) {
+            iconClassName = WI.TimelineTabContentView.iconClassNameForTimelineType(representedObject.type);
+            title = WI.UIString("Details");
         } else {
-            iconClassName = WebInspector.TimelineTabContentView.StopwatchIconStyleClass;
-            title = WebInspector.UIString("Overview");
+            iconClassName = WI.TimelineTabContentView.StopwatchIconStyleClass;
+            title = WI.UIString("Overview");
         }
 
         const hasChildren = false;
-        return new WebInspector.GeneralTreeElement(iconClassName, title, representedObject, hasChildren);
+        return new WI.GeneralTreeElement(iconClassName, title, representedObject, hasChildren);
     }
 
     // TimelineOverview delegate
@@ -281,10 +281,10 @@
     {
         let newViewMode;
         let timelineView = this.currentTimelineView;
-        if (timelineView && timelineView.representedObject.type === WebInspector.TimelineRecord.Type.RenderingFrame)
-            newViewMode = WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+        if (timelineView && timelineView.representedObject.type === WI.TimelineRecord.Type.RenderingFrame)
+            newViewMode = WI.TimelineOverview.ViewMode.RenderingFrames;
         else
-            newViewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
+            newViewMode = WI.TimelineOverview.ViewMode.Timelines;
 
         this._timelineOverview.viewMode = newViewMode;
         this._updateTimelineOverviewHeight();
@@ -296,14 +296,14 @@
             this._filterDidChange();
 
             let timeline = null;
-            if (timelineView.representedObject instanceof WebInspector.Timeline)
+            if (timelineView.representedObject instanceof WI.Timeline)
                 timeline = timelineView.representedObject;
 
             this._timelineOverview.selectedTimeline = timeline;
         }
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.NavigationItemsDidChange);
     }
 
     _timelinePathComponentSelected(event)
@@ -338,14 +338,14 @@
 
         this._updateFilterBar();
 
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
 
         if (this.currentTimelineView === this._overviewTimelineView)
             return;
 
         let record = null;
         if (this.currentTimelineView.selectionPathComponents) {
-            let recordPathComponent = this.currentTimelineView.selectionPathComponents.find((element) => element.representedObject instanceof WebInspector.TimelineRecord);
+            let recordPathComponent = this.currentTimelineView.selectionPathComponents.find((element) => element.representedObject instanceof WI.TimelineRecord);
             record = recordPathComponent ? recordPathComponent.representedObject : null;
         }
 
@@ -356,26 +356,26 @@
     {
         if (event.target !== this._timelineContentBrowser.currentContentView)
             return;
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SupplementalRepresentedObjectsDidChange);
     }
 
     _inspectorVisibilityStateChanged()
     {
-        if (WebInspector.timelineManager.activeRecording !== this._recording)
+        if (WI.timelineManager.activeRecording !== this._recording)
             return;
 
         // Stop updating since the results won't be rendered anyway.
-        if (!WebInspector.visible && this._updating) {
+        if (!WI.visible && this._updating) {
             this._stopUpdatingCurrentTime();
             return;
         }
 
         // Nothing else to do if the current time was not being updated.
-        if (!WebInspector.visible)
+        if (!WI.visible)
             return;
 
         let {startTime, endTime} = this.representedObject;
-        if (!WebInspector.timelineManager.isCapturing()) {
+        if (!WI.timelineManager.isCapturing()) {
             // Force the overview to render data from the entire recording.
             // This is necessary if the recording was started when the inspector was not
             // visible because the views were never updated with currentTime/endTime.
@@ -389,7 +389,7 @@
     _update(timestamp)
     {
         // FIXME: <https://webkit.org/b/153634> Web Inspector: some background tabs think they are the foreground tab and do unnecessary work
-        if (!(WebInspector.tabBrowser.selectedTabContentView instanceof WebInspector.TimelineTabContentView))
+        if (!(WI.tabBrowser.selectedTabContentView instanceof WI.TimelineTabContentView))
             return;
 
         if (this._waitingToResetCurrentTime) {
@@ -451,7 +451,7 @@
             return;
 
         // Don't update the current time if the Inspector is not visible, as the requestAnimationFrames won't work.
-        if (!WebInspector.visible)
+        if (!WI.visible)
             return;
 
         if (typeof startTime === "number")
@@ -463,7 +463,7 @@
             // ascertained from a new incoming timeline record, so we wait for a Timeline to update.
             console.assert(!this._waitingToResetCurrentTime);
             this._waitingToResetCurrentTime = true;
-            this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
+            this._recording.addEventListener(WI.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
         }
 
         this._updating = true;
@@ -481,7 +481,7 @@
 
         if (this._waitingToResetCurrentTime) {
             // Did not get any event while waiting for the current time, but we should stop waiting.
-            this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
+            this._recording.removeEventListener(WI.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
             this._waitingToResetCurrentTime = false;
         }
     }
@@ -545,14 +545,14 @@
             this._currentTime = Math.max(this._currentTime, lastRecord.startTime);
         }
 
-        this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
+        this._recording.removeEventListener(WI.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
         this._waitingToResetCurrentTime = false;
     }
 
     _clearTimeline(event)
     {
-        if (WebInspector.timelineManager.activeRecording === this._recording && WebInspector.timelineManager.isCapturing())
-            WebInspector.timelineManager.stopCapturing();
+        if (WI.timelineManager.activeRecording === this._recording && WI.timelineManager.isCapturing())
+            WI.timelineManager.stopCapturing();
 
         this._recording.reset();
     }
@@ -572,20 +572,20 @@
 
     _instrumentAdded(instrumentOrEvent)
     {
-        let instrument = instrumentOrEvent instanceof WebInspector.Instrument ? instrumentOrEvent : instrumentOrEvent.data.instrument;
-        console.assert(instrument instanceof WebInspector.Instrument, instrument);
+        let instrument = instrumentOrEvent instanceof WI.Instrument ? instrumentOrEvent : instrumentOrEvent.data.instrument;
+        console.assert(instrument instanceof WI.Instrument, instrument);
 
         let timeline = this._recording.timelineForInstrument(instrument);
         console.assert(!this._timelineViewMap.has(timeline), timeline);
 
-        this._timelineViewMap.set(timeline, WebInspector.ContentView.createFromRepresentedObject(timeline, {recording: this._recording}));
-        if (timeline.type === WebInspector.TimelineRecord.Type.RenderingFrame)
+        this._timelineViewMap.set(timeline, WI.ContentView.createFromRepresentedObject(timeline, {recording: this._recording}));
+        if (timeline.type === WI.TimelineRecord.Type.RenderingFrame)
             this._renderingFrameTimeline = timeline;
 
-        let displayName = WebInspector.TimelineTabContentView.displayNameForTimelineType(timeline.type);
-        let iconClassName = WebInspector.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);
-        let pathComponent = new WebInspector.HierarchicalPathComponent(displayName, iconClassName, timeline);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._timelinePathComponentSelected, this);
+        let displayName = WI.TimelineTabContentView.displayNameForTimelineType(timeline.type);
+        let iconClassName = WI.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);
+        let pathComponent = new WI.HierarchicalPathComponent(displayName, iconClassName, timeline);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._timelinePathComponentSelected, this);
         this._pathComponentMap.set(timeline, pathComponent);
 
         this._timelineCountChanged();
@@ -594,7 +594,7 @@
     _instrumentRemoved(event)
     {
         let instrument = event.data.instrument;
-        console.assert(instrument instanceof WebInspector.Instrument);
+        console.assert(instrument instanceof WI.Instrument);
 
         let timeline = this._recording.timelineForInstrument(instrument);
         console.assert(this._timelineViewMap.has(timeline), timeline);
@@ -602,7 +602,7 @@
         let timelineView = this._timelineViewMap.take(timeline);
         if (this.currentTimelineView === timelineView)
             this.showOverviewTimelineView();
-        if (timeline.type === WebInspector.TimelineRecord.Type.RenderingFrame)
+        if (timeline.type === WI.TimelineRecord.Type.RenderingFrame)
             this._renderingFrameTimeline = null;
 
         this._pathComponentMap.delete(timeline);
@@ -642,7 +642,7 @@
         this._lastUpdateTimestamp = NaN;
         this._startTimeNeedsReset = true;
 
-        this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
+        this._recording.removeEventListener(WI.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
         this._waitingToResetCurrentTime = false;
 
         this._timelineOverview.reset();
@@ -654,8 +654,8 @@
     {
         console.assert(!this._updating);
 
-        WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
-        WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
+        WI.timelineManager.removeEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
+        WI.timelineManager.removeEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
     }
 
     _timeRangeSelectionChanged(event)
@@ -674,7 +674,7 @@
             timelineRange.startValue = this.currentTimelineView.startTime;
             timelineRange.endValue = this.currentTimelineView.endTime;
 
-            if (!(this.currentTimelineView instanceof WebInspector.RenderingFrameTimelineView)) {
+            if (!(this.currentTimelineView instanceof WI.RenderingFrameTimelineView)) {
                 timelineRange.startValue -= this.currentTimelineView.zeroTime;
                 timelineRange.endValue -= this.currentTimelineView.zeroTime;
             }
@@ -685,7 +685,7 @@
 
         if (this._selectedTimeRangePathComponent !== selectedPathComponent) {
             this._selectedTimeRangePathComponent = selectedPathComponent;
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+            this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
         }
     }
 
@@ -722,16 +722,16 @@
         this._entireRecordingPathComponent.nextSibling = this._timelineSelectionPathComponent;
 
         let displayName;
-        if (this._timelineOverview.viewMode === WebInspector.TimelineOverview.ViewMode.Timelines) {
+        if (this._timelineOverview.viewMode === WI.TimelineOverview.ViewMode.Timelines) {
             let selectionStart = Number.secondsToString(startValue, true);
             let selectionEnd = Number.secondsToString(endValue, true);
-            displayName = WebInspector.UIString("%s \u2013 %s").format(selectionStart, selectionEnd);
+            displayName = WI.UIString("%s \u2013 %s").format(selectionStart, selectionEnd);
         } else {
             startValue += 1; // Convert index to frame number.
             if (startValue === endValue)
-                displayName = WebInspector.UIString("Frame %d").format(startValue);
+                displayName = WI.UIString("Frame %d").format(startValue);
             else
-                displayName = WebInspector.UIString("Frames %d \u2013 %d").format(startValue, endValue);
+                displayName = WI.UIString("Frames %d \u2013 %d").format(startValue, endValue);
         }
 
         this._timelineSelectionPathComponent.displayName = displayName;
@@ -740,9 +740,9 @@
 
     _createTimelineRangePathComponent(title)
     {
-        let range = new WebInspector.TimelineRange(NaN, NaN);
-        let pathComponent = new WebInspector.HierarchicalPathComponent(title || enDash, "time-icon", range);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._timeRangePathComponentSelected, this);
+        let range = new WI.TimelineRange(NaN, NaN);
+        let pathComponent = new WI.HierarchicalPathComponent(title || enDash, "time-icon", range);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._timeRangePathComponentSelected, this);
 
         return pathComponent;
     }
@@ -754,7 +754,7 @@
         let endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
 
         if (entireRangeSelected) {
-            if (timelineView instanceof WebInspector.RenderingFrameTimelineView) {
+            if (timelineView instanceof WI.RenderingFrameTimelineView) {
                 endTime = this._renderingFrameTimeline.records.length;
             } else {
                 // Clamp selection to the end of the recording (with padding),
@@ -773,7 +773,7 @@
     _editingInstrumentsDidChange(event)
     {
         let editingInstruments = this._timelineOverview.editingInstruments;
-        this.element.classList.toggle(WebInspector.TimelineOverview.EditInstrumentsStyleClassName, editingInstruments);
+        this.element.classList.toggle(WI.TimelineOverview.EditInstrumentsStyleClassName, editingInstruments);
 
         this._updateTimelineOverviewHeight();
     }
@@ -794,7 +794,7 @@
         console.assert(this.currentTimelineView);
 
         let timeline = this.currentTimelineView.representedObject;
-        if (!(timeline instanceof WebInspector.Timeline))
+        if (!(timeline instanceof WI.Timeline))
             return;
 
         let record = event.data.record;
@@ -804,7 +804,7 @@
 
     _updateProgressView()
     {
-        let isCapturing = WebInspector.timelineManager.isCapturing();
+        let isCapturing = WI.timelineManager.isCapturing();
         this._progressView.visible = isCapturing && this.currentTimelineView && !this.currentTimelineView.showsLiveRecordingData;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingProgressView.js b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingProgressView.js
index ca2890a..68fa7fa 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingProgressView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingProgressView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecordingProgressView = class TimelineRecordingProgressView extends WebInspector.View
+WI.TimelineRecordingProgressView = class TimelineRecordingProgressView extends WI.View
 {
     constructor()
     {
@@ -33,15 +33,15 @@
 
         let statusElement = document.createElement("div");
         statusElement.classList.add("status");
-        statusElement.textContent = WebInspector.UIString("Recording Timeline Data");
+        statusElement.textContent = WI.UIString("Recording Timeline Data");
         this.element.append(statusElement);
 
-        let spinner = new WebInspector.IndeterminateProgressSpinner;
+        let spinner = new WI.IndeterminateProgressSpinner;
         statusElement.append(spinner.element);
 
         this._stopRecordingButtonElement = document.createElement("button");
-        this._stopRecordingButtonElement.textContent = WebInspector.UIString("Stop Recording");
-        this._stopRecordingButtonElement.addEventListener("click", () => WebInspector.timelineManager.stopCapturing());
+        this._stopRecordingButtonElement.textContent = WI.UIString("Stop Recording");
+        this._stopRecordingButtonElement.addEventListener("click", () => WI.timelineManager.stopCapturing());
         this.element.append(this._stopRecordingButtonElement);
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js b/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
index 8438f09..bb4c5c6 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRuler = class TimelineRuler extends WebInspector.View
+WI.TimelineRuler = class TimelineRuler extends WI.View
 {
     constructor()
     {
@@ -71,7 +71,7 @@
             return;
 
         this._enabled = x;
-        this.element.classList.toggle(WebInspector.TreeElementStatusButton.DisabledStyleClassName, !this._enabled);
+        this.element.classList.toggle(WI.TreeElementStatusButton.DisabledStyleClassName, !this._enabled);
     }
 
     get allowsClippedLabels()
@@ -334,29 +334,29 @@
 
     addMarker(marker)
     {
-        console.assert(marker instanceof WebInspector.TimelineMarker);
+        console.assert(marker instanceof WI.TimelineMarker);
 
         if (this._markerElementMap.has(marker))
             return;
 
-        marker.addEventListener(WebInspector.TimelineMarker.Event.TimeChanged, this._timelineMarkerTimeChanged, this);
+        marker.addEventListener(WI.TimelineMarker.Event.TimeChanged, this._timelineMarkerTimeChanged, this);
 
         let markerTime = marker.time - this._startTime;
         let markerElement = document.createElement("div");
         markerElement.classList.add(marker.type, "marker");
 
         switch (marker.type) {
-        case WebInspector.TimelineMarker.Type.LoadEvent:
-            markerElement.title = WebInspector.UIString("Load \u2014 %s").format(Number.secondsToString(markerTime));
+        case WI.TimelineMarker.Type.LoadEvent:
+            markerElement.title = WI.UIString("Load \u2014 %s").format(Number.secondsToString(markerTime));
             break;
-        case WebInspector.TimelineMarker.Type.DOMContentEvent:
-            markerElement.title = WebInspector.UIString("DOM Content Loaded \u2014 %s").format(Number.secondsToString(markerTime));
+        case WI.TimelineMarker.Type.DOMContentEvent:
+            markerElement.title = WI.UIString("DOM Content Loaded \u2014 %s").format(Number.secondsToString(markerTime));
             break;
-        case WebInspector.TimelineMarker.Type.TimeStamp:
+        case WI.TimelineMarker.Type.TimeStamp:
             if (marker.details)
-                markerElement.title = WebInspector.UIString("%s \u2014 %s").format(marker.details, Number.secondsToString(markerTime));
+                markerElement.title = WI.UIString("%s \u2014 %s").format(marker.details, Number.secondsToString(markerTime));
             else
-                markerElement.title = WebInspector.UIString("Timestamp \u2014 %s").format(Number.secondsToString(markerTime));
+                markerElement.title = WI.UIString("Timestamp \u2014 %s").format(Number.secondsToString(markerTime));
             break;
         }
 
@@ -428,7 +428,7 @@
         let pixelsPerSecond = visibleWidth / duration;
 
         // Calculate a divider count based on the maximum allowed divider density.
-        let dividerCount = Math.round(visibleWidth / WebInspector.TimelineRuler.MinimumDividerSpacing);
+        let dividerCount = Math.round(visibleWidth / WI.TimelineRuler.MinimumDividerSpacing);
         let sliceTime;
         if (this._endTimePinned || !this._currentSliceTime) {
             // Calculate the slice time based on the rough divider count and the time span.
@@ -436,9 +436,9 @@
 
             // Snap the slice time to a nearest number (e.g. 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, etc.)
             sliceTime = Math.pow(10, Math.ceil(Math.log(sliceTime) / Math.LN10));
-            if (sliceTime * pixelsPerSecond >= 5 * WebInspector.TimelineRuler.MinimumDividerSpacing)
+            if (sliceTime * pixelsPerSecond >= 5 * WI.TimelineRuler.MinimumDividerSpacing)
                 sliceTime = sliceTime / 5;
-            if (sliceTime * pixelsPerSecond >= 2 * WebInspector.TimelineRuler.MinimumDividerSpacing)
+            if (sliceTime * pixelsPerSecond >= 2 * WI.TimelineRuler.MinimumDividerSpacing)
                 sliceTime = sliceTime / 2;
 
             this._currentSliceTime = sliceTime;
@@ -471,24 +471,24 @@
 
         this._currentDividers = dividerData;
 
-        let markerDividers = this._markersElement.querySelectorAll("." + WebInspector.TimelineRuler.DividerElementStyleClassName);
+        let markerDividers = this._markersElement.querySelectorAll("." + WI.TimelineRuler.DividerElementStyleClassName);
         let dividerElement = this._headerElement.firstChild;
 
         for (var i = 0; i <= dividerCount; ++i) {
             if (!dividerElement) {
                 dividerElement = document.createElement("div");
-                dividerElement.className = WebInspector.TimelineRuler.DividerElementStyleClassName;
+                dividerElement.className = WI.TimelineRuler.DividerElementStyleClassName;
                 this._headerElement.appendChild(dividerElement);
 
                 let labelElement = document.createElement("div");
-                labelElement.className = WebInspector.TimelineRuler.DividerLabelElementStyleClassName;
+                labelElement.className = WI.TimelineRuler.DividerLabelElementStyleClassName;
                 dividerElement.appendChild(labelElement);
             }
 
             let markerDividerElement = markerDividers[i];
             if (!markerDividerElement) {
                 markerDividerElement = document.createElement("div");
-                markerDividerElement.className = WebInspector.TimelineRuler.DividerElementStyleClassName;
+                markerDividerElement.className = WI.TimelineRuler.DividerElementStyleClassName;
                 this._markersElement.appendChild(markerDividerElement);
             }
 
@@ -505,15 +505,15 @@
                     break;
 
                 // Don't allow the left-most divider spacing to be so tight it clips.
-                if ((newPosition * visibleWidth) < WebInspector.TimelineRuler.MinimumLeftDividerSpacing)
+                if ((newPosition * visibleWidth) < WI.TimelineRuler.MinimumLeftDividerSpacing)
                     continue;
             }
 
-            let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+            let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
             this._updatePositionOfElement(dividerElement, newPosition, visibleWidth, property);
             this._updatePositionOfElement(markerDividerElement, newPosition, visibleWidth, property);
 
-            console.assert(dividerElement.firstChild.classList.contains(WebInspector.TimelineRuler.DividerLabelElementStyleClassName));
+            console.assert(dividerElement.firstChild.classList.contains(WI.TimelineRuler.DividerLabelElementStyleClassName));
 
             dividerElement.firstChild.textContent = isNaN(dividerTime) ? "" : this._formatDividerLabelText(dividerTime - this._zeroTime);
             dividerElement = dividerElement.nextSibling;
@@ -622,7 +622,7 @@
 
         for (let [marker, markerElement] of this._markerElementMap) {
             let newPosition = (marker.time - this._startTime) / duration;
-            let property = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+            let property = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
             this._updatePositionOfElement(markerElement, newPosition, visibleWidth, property);
 
             if (!markerElement.parentNode)
@@ -657,7 +657,7 @@
         let formattedStartTimeText = this._formatDividerLabelText(this._selectionStartTime - this._zeroTime);
         let formattedEndTimeText = this._formatDividerLabelText(this._selectionEndTime - this._zeroTime);
 
-        let startProperty = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "right" : "left";
+        let startProperty = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "right" : "left";
         let newStartPosition = Number.constrain((this._selectionStartTime - this._startTime) / duration, 0, 1);
         this._updatePositionOfElement(this._leftShadedAreaElement, newStartPosition, visibleWidth, "width");
         this._updatePositionOfElement(this._leftSelectionHandleElement, newStartPosition, visibleWidth, startProperty);
@@ -667,7 +667,7 @@
         this._leftSelectionHandleElement.classList.toggle("hidden", startTimeClamped && endTimeClamped && this._selectionStartTime < this._startTime);
         this._leftSelectionHandleElement.title = formattedStartTimeText;
 
-        let endProperty = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL ? "left" : "right";
+        let endProperty = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "left" : "right";
         let newEndPosition = 1 - Number.constrain((this._selectionEndTime - this._startTime) / duration, 0, 1);
         this._updatePositionOfElement(this._rightShadedAreaElement, newEndPosition, visibleWidth, "width");
         this._updatePositionOfElement(this._rightSelectionHandleElement, newEndPosition, visibleWidth, endProperty);
@@ -711,7 +711,7 @@
 
         this._timeRangeSelectionChanged = false;
 
-        this.dispatchEventToListeners(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged);
+        this.dispatchEventToListeners(WI.TimelineRuler.Event.TimeRangeSelectionChanged);
     }
 
     _timelineMarkerTimeChanged()
@@ -758,7 +758,7 @@
             this._moveSelectionMaximumLeftOffset = this._rulerBoundingClientRect.left + (event.pageX - selectionDragElementRect.left);
             this._moveSelectionMaximumRightOffset = this._rulerBoundingClientRect.right - (selectionDragElementRect.right - event.pageX);
         } else {
-            if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+            if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
                 this._mouseDownPosition = this._rulerBoundingClientRect.right - event.pageX;
             else
                 this._mouseDownPosition = event.pageX - this._rulerBoundingClientRect.left;
@@ -783,7 +783,7 @@
 
         this._mouseMoved = true;
 
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
 
         let currentMousePosition;
         if (this._selectionIsMove) {
@@ -825,7 +825,7 @@
             this.selectionEndTime = Math.min(this.startTime + (Math.max(currentMousePosition, this._mouseDownPosition) * this.secondsPerPixel), this.endTime);
 
             // Turn on col-resize cursor style once dragging begins, rather than on the initial mouse down.
-            this.element.classList.add(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);
+            this.element.classList.add(WI.TimelineRuler.ResizingSelectionStyleClassName);
         }
 
         this._updateSelection(this._cachedClientWidth, this.duration);
@@ -839,12 +839,12 @@
         console.assert(event.button === 0);
 
         if (!this._selectionIsMove) {
-            this.element.classList.remove(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);
+            this.element.classList.remove(WI.TimelineRuler.ResizingSelectionStyleClassName);
 
             if (this.selectionEndTime - this.selectionStartTime < this.minimumSelectionDuration) {
                 // The section is smaller than allowed, grow in the direction of the drag to meet the minumum.
                 let currentMousePosition = 0;
-                if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+                if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
                     currentMousePosition = this._rulerBoundingClientRect.right - event.pageX;
                 else
                     currentMousePosition = event.pageX - this._rulerBoundingClientRect.left;
@@ -885,7 +885,7 @@
 
         this._dragHandleIsStartTime = event.target === this._leftSelectionHandleElement;
 
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             this._mouseDownPosition = this.element.totalOffsetRight - event.pageX;
         else
             this._mouseDownPosition = event.pageX - this.element.totalOffsetLeft;
@@ -897,7 +897,7 @@
         document.addEventListener("mousemove", this._selectionHandleMouseMoveEventListener);
         document.addEventListener("mouseup", this._selectionHandleMouseUpEventListener);
 
-        this.element.classList.add(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);
+        this.element.classList.add(WI.TimelineRuler.ResizingSelectionStyleClassName);
 
         event.preventDefault();
         event.stopPropagation();
@@ -908,7 +908,7 @@
         console.assert(event.button === 0);
 
         let currentMousePosition = 0;
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             currentMousePosition = this.element.totalOffsetRight - event.pageX;
         else
             currentMousePosition = event.pageX - this.element.totalOffsetLeft;
@@ -946,7 +946,7 @@
     {
         console.assert(event.button === 0);
 
-        this.element.classList.remove(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);
+        this.element.classList.remove(WI.TimelineRuler.ResizingSelectionStyleClassName);
 
         document.removeEventListener("mousemove", this._selectionHandleMouseMoveEventListener);
         document.removeEventListener("mouseup", this._selectionHandleMouseUpEventListener);
@@ -961,13 +961,13 @@
     }
 };
 
-WebInspector.TimelineRuler.MinimumLeftDividerSpacing = 48;
-WebInspector.TimelineRuler.MinimumDividerSpacing = 64;
+WI.TimelineRuler.MinimumLeftDividerSpacing = 48;
+WI.TimelineRuler.MinimumDividerSpacing = 64;
 
-WebInspector.TimelineRuler.ResizingSelectionStyleClassName = "resizing-selection";
-WebInspector.TimelineRuler.DividerElementStyleClassName = "divider";
-WebInspector.TimelineRuler.DividerLabelElementStyleClassName = "label";
+WI.TimelineRuler.ResizingSelectionStyleClassName = "resizing-selection";
+WI.TimelineRuler.DividerElementStyleClassName = "divider";
+WI.TimelineRuler.DividerLabelElementStyleClassName = "label";
 
-WebInspector.TimelineRuler.Event = {
+WI.TimelineRuler.Event = {
     TimeRangeSelectionChanged: "time-ruler-time-range-selection-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js b/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js
index eedecd4..2bbc120 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js
@@ -23,54 +23,54 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineTabContentView = class TimelineTabContentView extends WebInspector.ContentBrowserTabContentView
+WI.TimelineTabContentView = class TimelineTabContentView extends WI.ContentBrowserTabContentView
 {
     constructor(identifier)
     {
-        let {image, title} = WebInspector.TimelineTabContentView.tabInfo();
-        let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanelConstructors = [WebInspector.ResourceDetailsSidebarPanel, WebInspector.ProbeDetailsSidebarPanel];
+        let {image, title} = WI.TimelineTabContentView.tabInfo();
+        let tabBarItem = new WI.GeneralTabBarItem(image, title);
+        let detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel];
 
         super(identifier || "timeline", "timeline", tabBarItem, null, detailsSidebarPanelConstructors);
 
         // Maintain an invisible tree outline containing tree elements for all recordings.
         // The visible recording's tree element is selected when the content view changes.
         this._recordingTreeElementMap = new Map;
-        this._recordingsTreeOutline = new WebInspector.TreeOutline;
-        this._recordingsTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._recordingsTreeSelectionDidChange, this);
+        this._recordingsTreeOutline = new WI.TreeOutline;
+        this._recordingsTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._recordingsTreeSelectionDidChange, this);
 
-        this._toggleRecordingShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Space, this._toggleRecordingOnSpacebar.bind(this));
+        this._toggleRecordingShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Space, this._toggleRecordingOnSpacebar.bind(this));
         this._toggleRecordingShortcut.implicitlyPreventsDefault = false;
         this._toggleRecordingShortcut.disabled = true;
 
-        this._toggleNewRecordingShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift, WebInspector.KeyboardShortcut.Key.Space, this._toggleNewRecordingOnSpacebar.bind(this));
+        this._toggleNewRecordingShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Space, this._toggleNewRecordingOnSpacebar.bind(this));
         this._toggleNewRecordingShortcut.implicitlyPreventsDefault = false;
         this._toggleNewRecordingShortcut.disabled = true;
 
-        let toolTip = WebInspector.UIString("Start recording (%s)\nCreate new recording (%s)").format(this._toggleRecordingShortcut.displayName, this._toggleNewRecordingShortcut.displayName);
-        let altToolTip = WebInspector.UIString("Stop recording (%s)").format(this._toggleRecordingShortcut.displayName);
-        this._recordButton = new WebInspector.ToggleButtonNavigationItem("record-start-stop", toolTip, altToolTip, "Images/Record.svg", "Images/Stop.svg", 13, 13);
-        this._recordButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._recordButtonClicked, this);
+        let toolTip = WI.UIString("Start recording (%s)\nCreate new recording (%s)").format(this._toggleRecordingShortcut.displayName, this._toggleNewRecordingShortcut.displayName);
+        let altToolTip = WI.UIString("Stop recording (%s)").format(this._toggleRecordingShortcut.displayName);
+        this._recordButton = new WI.ToggleButtonNavigationItem("record-start-stop", toolTip, altToolTip, "Images/Record.svg", "Images/Stop.svg", 13, 13);
+        this._recordButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._recordButtonClicked, this);
 
         this.contentBrowser.navigationBar.insertNavigationItem(this._recordButton, 0);
 
-        if (WebInspector.FPSInstrument.supported()) {
-            let timelinesNavigationItem = new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.Timelines, WebInspector.UIString("Events"));
-            let renderingFramesNavigationItem = new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.RenderingFrames, WebInspector.UIString("Frames"));
+        if (WI.FPSInstrument.supported()) {
+            let timelinesNavigationItem = new WI.RadioButtonNavigationItem(WI.TimelineOverview.ViewMode.Timelines, WI.UIString("Events"));
+            let renderingFramesNavigationItem = new WI.RadioButtonNavigationItem(WI.TimelineOverview.ViewMode.RenderingFrames, WI.UIString("Frames"));
 
             this.contentBrowser.navigationBar.insertNavigationItem(timelinesNavigationItem, 1);
             this.contentBrowser.navigationBar.insertNavigationItem(renderingFramesNavigationItem, 2);
 
-            this.contentBrowser.navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected, this._viewModeSelected, this);
+            this.contentBrowser.navigationBar.addEventListener(WI.NavigationBar.Event.NavigationItemSelected, this._viewModeSelected, this);
         }
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingCreated, this._recordingCreated, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingLoaded, this._recordingLoaded, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.RecordingCreated, this._recordingCreated, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.RecordingLoaded, this._recordingLoaded, this);
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStartedOrStopped, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStartedOrStopped, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStartedOrStopped, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStartedOrStopped, this);
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange, this._inspectorVisibilityChanged, this);
+        WI.notifications.addEventListener(WI.Notification.VisibilityStateDidChange, this._inspectorVisibilityChanged, this);
 
         this._displayedRecording = null;
         this._displayedContentView = null;
@@ -78,9 +78,9 @@
         this._previousSelectedTimelineType = null;
 
         const selectedByUser = false;
-        this._changeViewMode(WebInspector.TimelineOverview.ViewMode.Timelines, selectedByUser);
+        this._changeViewMode(WI.TimelineOverview.ViewMode.Timelines, selectedByUser);
 
-        for (let recording of WebInspector.timelineManager.recordings)
+        for (let recording of WI.timelineManager.recordings)
             this._addRecording(recording);
 
         this._recordingCountChanged();
@@ -95,7 +95,7 @@
     {
         return {
             image: "Images/Timeline.svg",
-            title: WebInspector.UIString("Timelines"),
+            title: WI.UIString("Timelines"),
         };
     }
 
@@ -107,18 +107,18 @@
     static displayNameForTimelineType(timelineType)
     {
         switch (timelineType) {
-        case WebInspector.TimelineRecord.Type.Network:
-            return WebInspector.UIString("Network Requests");
-        case WebInspector.TimelineRecord.Type.Layout:
-            return WebInspector.UIString("Layout & Rendering");
-        case WebInspector.TimelineRecord.Type.Script:
-            return WebInspector.UIString("JavaScript & Events");
-        case WebInspector.TimelineRecord.Type.RenderingFrame:
-            return WebInspector.UIString("Rendering Frames");
-        case WebInspector.TimelineRecord.Type.Memory:
-            return WebInspector.UIString("Memory");
-        case WebInspector.TimelineRecord.Type.HeapAllocations:
-            return WebInspector.UIString("JavaScript Allocations");
+        case WI.TimelineRecord.Type.Network:
+            return WI.UIString("Network Requests");
+        case WI.TimelineRecord.Type.Layout:
+            return WI.UIString("Layout & Rendering");
+        case WI.TimelineRecord.Type.Script:
+            return WI.UIString("JavaScript & Events");
+        case WI.TimelineRecord.Type.RenderingFrame:
+            return WI.UIString("Rendering Frames");
+        case WI.TimelineRecord.Type.Memory:
+            return WI.UIString("Memory");
+        case WI.TimelineRecord.Type.HeapAllocations:
+            return WI.UIString("JavaScript Allocations");
         default:
             console.error("Unknown Timeline type:", timelineType);
         }
@@ -129,17 +129,17 @@
     static iconClassNameForTimelineType(timelineType)
     {
         switch (timelineType) {
-        case WebInspector.TimelineRecord.Type.Network:
+        case WI.TimelineRecord.Type.Network:
             return "network-icon";
-        case WebInspector.TimelineRecord.Type.Layout:
+        case WI.TimelineRecord.Type.Layout:
             return "layout-icon";
-        case WebInspector.TimelineRecord.Type.Memory:
+        case WI.TimelineRecord.Type.Memory:
             return "memory-icon";
-        case WebInspector.TimelineRecord.Type.HeapAllocations:
+        case WI.TimelineRecord.Type.HeapAllocations:
             return "heap-allocations-icon";
-        case WebInspector.TimelineRecord.Type.Script:
+        case WI.TimelineRecord.Type.Script:
             return "script-icon";
-        case WebInspector.TimelineRecord.Type.RenderingFrame:
+        case WI.TimelineRecord.Type.RenderingFrame:
             return "rendering-frame-icon";
         default:
             console.error("Unknown Timeline type:", timelineType);
@@ -151,17 +151,17 @@
     static genericClassNameForTimelineType(timelineType)
     {
         switch (timelineType) {
-        case WebInspector.TimelineRecord.Type.Network:
+        case WI.TimelineRecord.Type.Network:
             return "network";
-        case WebInspector.TimelineRecord.Type.Layout:
+        case WI.TimelineRecord.Type.Layout:
             return "colors";
-        case WebInspector.TimelineRecord.Type.Memory:
+        case WI.TimelineRecord.Type.Memory:
             return "memory";
-        case WebInspector.TimelineRecord.Type.HeapAllocations:
+        case WI.TimelineRecord.Type.HeapAllocations:
             return "heap-allocations";
-        case WebInspector.TimelineRecord.Type.Script:
+        case WI.TimelineRecord.Type.Script:
             return "script";
-        case WebInspector.TimelineRecord.Type.RenderingFrame:
+        case WI.TimelineRecord.Type.RenderingFrame:
             return "rendering-frame";
         default:
             console.error("Unknown Timeline type:", timelineType);
@@ -173,62 +173,62 @@
     static iconClassNameForRecord(timelineRecord)
     {
         switch (timelineRecord.type) {
-        case WebInspector.TimelineRecord.Type.Layout:
+        case WI.TimelineRecord.Type.Layout:
             switch (timelineRecord.eventType) {
-            case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:
-            case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:
-                return WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass;
-            case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:
-            case WebInspector.LayoutTimelineRecord.EventType.ForcedLayout:
-            case WebInspector.LayoutTimelineRecord.EventType.Layout:
-                return WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass;
-            case WebInspector.LayoutTimelineRecord.EventType.Paint:
-                return WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass;
-            case WebInspector.LayoutTimelineRecord.EventType.Composite:
-                return WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass;
+            case WI.LayoutTimelineRecord.EventType.InvalidateStyles:
+            case WI.LayoutTimelineRecord.EventType.RecalculateStyles:
+                return WI.TimelineRecordTreeElement.StyleRecordIconStyleClass;
+            case WI.LayoutTimelineRecord.EventType.InvalidateLayout:
+            case WI.LayoutTimelineRecord.EventType.ForcedLayout:
+            case WI.LayoutTimelineRecord.EventType.Layout:
+                return WI.TimelineRecordTreeElement.LayoutRecordIconStyleClass;
+            case WI.LayoutTimelineRecord.EventType.Paint:
+                return WI.TimelineRecordTreeElement.PaintRecordIconStyleClass;
+            case WI.LayoutTimelineRecord.EventType.Composite:
+                return WI.TimelineRecordTreeElement.CompositeRecordIconStyleClass;
             default:
                 console.error("Unknown LayoutTimelineRecord eventType: " + timelineRecord.eventType, timelineRecord);
             }
 
             break;
 
-        case WebInspector.TimelineRecord.Type.Script:
+        case WI.TimelineRecord.Type.Script:
             switch (timelineRecord.eventType) {
-            case WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated:
-                return WebInspector.TimelineRecordTreeElement.APIRecordIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:
-                return WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched:
-            case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:
-                return WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded:
-                return WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:
-                return WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.GarbageCollected:
-                return WebInspector.TimelineRecordTreeElement.GarbageCollectionIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:
-                return WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.TimerFired:
-            case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:
-                return WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;
-            case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:
-            case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:
-            case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
-                return WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.APIScriptEvaluated:
+                return WI.TimelineRecordTreeElement.APIRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.ScriptEvaluated:
+                return WI.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.MicrotaskDispatched:
+            case WI.ScriptTimelineRecord.EventType.EventDispatched:
+                return WI.TimelineRecordTreeElement.EventRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.ProbeSampleRecorded:
+                return WI.TimelineRecordTreeElement.ProbeRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:
+                return WI.TimelineRecordTreeElement.ConsoleProfileIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.GarbageCollected:
+                return WI.TimelineRecordTreeElement.GarbageCollectionIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.TimerInstalled:
+                return WI.TimelineRecordTreeElement.TimerRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.TimerFired:
+            case WI.ScriptTimelineRecord.EventType.TimerRemoved:
+                return WI.TimelineRecordTreeElement.TimerRecordIconStyleClass;
+            case WI.ScriptTimelineRecord.EventType.AnimationFrameFired:
+            case WI.ScriptTimelineRecord.EventType.AnimationFrameRequested:
+            case WI.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
+                return WI.TimelineRecordTreeElement.AnimationRecordIconStyleClass;
             default:
                 console.error("Unknown ScriptTimelineRecord eventType: " + timelineRecord.eventType, timelineRecord);
             }
 
             break;
 
-        case WebInspector.TimelineRecord.Type.RenderingFrame:
-            return WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass;
+        case WI.TimelineRecord.Type.RenderingFrame:
+            return WI.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass;
 
-        case WebInspector.TimelineRecord.Type.HeapAllocations:
+        case WI.TimelineRecord.Type.HeapAllocations:
             return "heap-snapshot-record";
 
-        case WebInspector.TimelineRecord.Type.Memory:
+        case WI.TimelineRecord.Type.Memory:
             // Not used. Fall through to error just in case.
 
         default:
@@ -241,19 +241,19 @@
     static displayNameForRecord(timelineRecord, includeDetailsInMainTitle)
     {
         switch (timelineRecord.type) {
-        case WebInspector.TimelineRecord.Type.Network:
-            return WebInspector.displayNameForURL(timelineRecord.resource.url, timelineRecord.resource.urlComponents);
-        case WebInspector.TimelineRecord.Type.Layout:
-            return WebInspector.LayoutTimelineRecord.displayNameForEventType(timelineRecord.eventType);
-        case WebInspector.TimelineRecord.Type.Script:
-            return WebInspector.ScriptTimelineRecord.EventType.displayName(timelineRecord.eventType, timelineRecord.details, includeDetailsInMainTitle);
-        case WebInspector.TimelineRecord.Type.RenderingFrame:
-            return WebInspector.UIString("Frame %d").format(timelineRecord.frameNumber);
-        case WebInspector.TimelineRecord.Type.HeapAllocations:
+        case WI.TimelineRecord.Type.Network:
+            return WI.displayNameForURL(timelineRecord.resource.url, timelineRecord.resource.urlComponents);
+        case WI.TimelineRecord.Type.Layout:
+            return WI.LayoutTimelineRecord.displayNameForEventType(timelineRecord.eventType);
+        case WI.TimelineRecord.Type.Script:
+            return WI.ScriptTimelineRecord.EventType.displayName(timelineRecord.eventType, timelineRecord.details, includeDetailsInMainTitle);
+        case WI.TimelineRecord.Type.RenderingFrame:
+            return WI.UIString("Frame %d").format(timelineRecord.frameNumber);
+        case WI.TimelineRecord.Type.HeapAllocations:
             if (timelineRecord.heapSnapshot.title)
-                return WebInspector.UIString("Snapshot %d \u2014 %s").format(timelineRecord.heapSnapshot.identifier, timelineRecord.heapSnapshot.title);
-            return WebInspector.UIString("Snapshot %d").format(timelineRecord.heapSnapshot.identifier);
-        case WebInspector.TimelineRecord.Type.Memory:
+                return WI.UIString("Snapshot %d \u2014 %s").format(timelineRecord.heapSnapshot.identifier, timelineRecord.heapSnapshot.title);
+            return WI.UIString("Snapshot %d").format(timelineRecord.heapSnapshot.identifier);
+        case WI.TimelineRecord.Type.Memory:
             // Not used. Fall through to error just in case.
         default:
             console.error("Unknown TimelineRecord type: " + timelineRecord.type, timelineRecord);
@@ -266,7 +266,7 @@
 
     get type()
     {
-        return WebInspector.TimelineTabContentView.Type;
+        return WI.TimelineTabContentView.Type;
     }
 
     shown()
@@ -276,8 +276,8 @@
         this._toggleRecordingShortcut.disabled = false;
         this._toggleNewRecordingShortcut.disabled = false;
 
-        if (WebInspector.visible)
-            WebInspector.timelineManager.autoCaptureOnPageLoad = true;
+        if (WI.visible)
+            WI.timelineManager.autoCaptureOnPageLoad = true;
     }
 
     hidden()
@@ -287,23 +287,23 @@
         this._toggleRecordingShortcut.disabled = true;
         this._toggleNewRecordingShortcut.disabled = true;
 
-        WebInspector.timelineManager.autoCaptureOnPageLoad = false;
+        WI.timelineManager.autoCaptureOnPageLoad = false;
     }
 
     closed()
     {
         super.closed();
 
-        if (WebInspector.FPSInstrument.supported())
+        if (WI.FPSInstrument.supported())
             this.contentBrowser.navigationBar.removeEventListener(null, null, this);
 
-        WebInspector.timelineManager.removeEventListener(null, null, this);
-        WebInspector.notifications.removeEventListener(null, null, this);
+        WI.timelineManager.removeEventListener(null, null, this);
+        WI.notifications.removeEventListener(null, null, this);
     }
 
     canShowRepresentedObject(representedObject)
     {
-        return representedObject instanceof WebInspector.TimelineRecording;
+        return representedObject instanceof WI.TimelineRecording;
     }
 
     // Protected
@@ -312,20 +312,20 @@
     {
         console.assert(cookie);
 
-        this._restoredShowingTimelineRecordingContentView = cookie[WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey];
+        this._restoredShowingTimelineRecordingContentView = cookie[WI.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey];
         if (!this._restoredShowingTimelineRecordingContentView) {
             if (!this.contentBrowser.currentContentView) {
                 // If this is the first time opening the tab, render the currently active recording.
-                if (!this._displayedRecording && WebInspector.timelineManager.activeRecording)
+                if (!this._displayedRecording && WI.timelineManager.activeRecording)
                     this._recordingLoaded();
 
-                this._showTimelineViewForType(WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue);
+                this._showTimelineViewForType(WI.TimelineTabContentView.OverviewTimelineIdentifierCookieValue);
             }
             return;
         }
 
-        let selectedTimelineViewIdentifier = cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey];
-        if (selectedTimelineViewIdentifier === WebInspector.TimelineRecord.Type.RenderingFrame && !WebInspector.FPSInstrument.supported())
+        let selectedTimelineViewIdentifier = cookie[WI.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey];
+        if (selectedTimelineViewIdentifier === WI.TimelineRecord.Type.RenderingFrame && !WI.FPSInstrument.supported())
             selectedTimelineViewIdentifier = null;
 
         this._showTimelineViewForType(selectedTimelineViewIdentifier);
@@ -337,16 +337,16 @@
     {
         console.assert(cookie);
 
-        cookie[WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
+        cookie[WI.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WI.TimelineRecordingContentView;
 
-        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames)
-            cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey] = WebInspector.TimelineRecord.Type.RenderingFrame;
+        if (this._viewMode === WI.TimelineOverview.ViewMode.RenderingFrames)
+            cookie[WI.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey] = WI.TimelineRecord.Type.RenderingFrame;
         else {
             let selectedTimeline = this._getTimelineForCurrentContentView();
             if (selectedTimeline)
-                cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey] = selectedTimeline.type;
+                cookie[WI.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey] = selectedTimeline.type;
             else
-                cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey] = WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue;
+                cookie[WI.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey] = WI.TimelineTabContentView.OverviewTimelineIdentifierCookieValue;
         }
 
         super.saveToCookie(cookie);
@@ -358,7 +358,7 @@
         if (!this._recordingTreeElementMap)
             return null;
 
-        if (representedObject instanceof WebInspector.TimelineRecording)
+        if (representedObject instanceof WI.TimelineRecording)
             return this._recordingTreeElementMap.get(representedObject);
 
         return null;
@@ -368,18 +368,18 @@
 
     _capturingStartedOrStopped(event)
     {
-        let isCapturing = WebInspector.timelineManager.isCapturing();
+        let isCapturing = WI.timelineManager.isCapturing();
         this._recordButton.toggled = isCapturing;
     }
 
     _inspectorVisibilityChanged(event)
     {
-        WebInspector.timelineManager.autoCaptureOnPageLoad = !!this.visible && !!WebInspector.visible;
+        WI.timelineManager.autoCaptureOnPageLoad = !!this.visible && !!WI.visible;
     }
 
     _toggleRecordingOnSpacebar(event)
     {
-        if (WebInspector.isEventTargetAnEditableField(event))
+        if (WI.isEventTargetAnEditableField(event))
             return;
 
         this._toggleRecording();
@@ -389,7 +389,7 @@
 
     _toggleNewRecordingOnSpacebar(event)
     {
-        if (WebInspector.isEventTargetAnEditableField(event))
+        if (WI.isEventTargetAnEditableField(event))
             return;
 
         this._toggleRecording(true);
@@ -399,13 +399,13 @@
 
     _toggleRecording(shouldCreateRecording)
     {
-        let isCapturing = WebInspector.timelineManager.isCapturing();
+        let isCapturing = WI.timelineManager.isCapturing();
         this._recordButton.toggled = isCapturing;
 
         if (isCapturing)
-            WebInspector.timelineManager.stopCapturing();
+            WI.timelineManager.stopCapturing();
         else {
-            WebInspector.timelineManager.startCapturing(shouldCreateRecording);
+            WI.timelineManager.startCapturing(shouldCreateRecording);
             // Show the timeline to which events will be appended.
             this._recordingLoaded();
         }
@@ -414,7 +414,7 @@
     _recordButtonClicked(event)
     {
         let shouldCreateNewRecording = window.event ? window.event.shiftKey : false;
-        this._recordButton.toggled = !WebInspector.timelineManager.isCapturing();
+        this._recordButton.toggled = !WI.timelineManager.isCapturing();
         this._toggleRecording(shouldCreateNewRecording);
     }
 
@@ -424,7 +424,7 @@
         if (!treeElement)
             return;
 
-        console.assert(treeElement.representedObject instanceof WebInspector.TimelineRecording);
+        console.assert(treeElement.representedObject instanceof WI.TimelineRecording);
 
         this._recordingSelected(treeElement.representedObject);
     }
@@ -437,9 +437,9 @@
 
     _addRecording(recording)
     {
-        console.assert(recording instanceof WebInspector.TimelineRecording, recording);
+        console.assert(recording instanceof WI.TimelineRecording, recording);
 
-        let recordingTreeElement = new WebInspector.GeneralTreeElement(WebInspector.TimelineTabContentView.StopwatchIconStyleClass, recording.displayName, null, recording);
+        let recordingTreeElement = new WI.GeneralTreeElement(WI.TimelineTabContentView.StopwatchIconStyleClass, recording.displayName, null, recording);
         this._recordingTreeElementMap.set(recording, recordingTreeElement);
         this._recordingsTreeOutline.appendChild(recordingTreeElement);
     }
@@ -459,7 +459,7 @@
 
     _recordingSelected(recording)
     {
-        console.assert(recording instanceof WebInspector.TimelineRecording, recording);
+        console.assert(recording instanceof WI.TimelineRecording, recording);
 
         this._displayedRecording = recording;
 
@@ -468,17 +468,17 @@
         this.saveToCookie(cookie);
 
         if (this._displayedContentView)
-            this._displayedContentView.removeEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._displayedContentViewNavigationItemsDidChange, this);
+            this._displayedContentView.removeEventListener(WI.ContentView.Event.NavigationItemsDidChange, this._displayedContentViewNavigationItemsDidChange, this);
 
         // Try to get the recording content view if it exists already, if it does we don't want to restore the cookie.
         let onlyExisting = true;
         this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, onlyExisting);
         if (this._displayedContentView) {
-            this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._displayedContentViewNavigationItemsDidChange, this);
+            this._displayedContentView.addEventListener(WI.ContentView.Event.NavigationItemsDidChange, this._displayedContentViewNavigationItemsDidChange, this);
 
             // Show the timeline that was being shown to update the sidebar tree state.
             let currentTimelineView = this._displayedContentView.currentTimelineView;
-            let timelineType = currentTimelineView && currentTimelineView.representedObject instanceof WebInspector.Timeline ? currentTimelineView.representedObject.type : null;
+            let timelineType = currentTimelineView && currentTimelineView.representedObject instanceof WI.Timeline ? currentTimelineView.representedObject.type : null;
             this._showTimelineViewForType(timelineType);
 
             return;
@@ -487,7 +487,7 @@
         onlyExisting = false;
         this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, onlyExisting);
         if (this._displayedContentView)
-            this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._displayedContentViewNavigationItemsDidChange, this);
+            this._displayedContentView.addEventListener(WI.ContentView.Event.NavigationItemsDidChange, this._displayedContentViewNavigationItemsDidChange, this);
 
         // Restore the cookie to carry over the previous recording view state to the new recording.
         this.restoreFromCookie(cookie);
@@ -495,7 +495,7 @@
 
     _recordingLoaded(event)
     {
-        this._recordingSelected(WebInspector.timelineManager.activeRecording);
+        this._recordingSelected(WI.timelineManager.activeRecording);
     }
 
     _viewModeSelected(event)
@@ -527,10 +527,10 @@
             return;
 
         let timelineType = this._previousSelectedTimelineType;
-        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
+        if (this._viewMode === WI.TimelineOverview.ViewMode.RenderingFrames) {
             let timeline = this._getTimelineForCurrentContentView();
             this._previousSelectedTimelineType = timeline ? timeline.type : null;
-            timelineType = WebInspector.TimelineRecord.Type.RenderingFrame;
+            timelineType = WI.TimelineRecord.Type.RenderingFrame;
         }
 
         this._showTimelineViewForType(timelineType);
@@ -554,9 +554,9 @@
     _displayedContentViewNavigationItemsDidChange(event)
     {
         let timeline = this._getTimelineForCurrentContentView();
-        let newViewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
-        if (timeline && timeline.type === WebInspector.TimelineRecord.Type.RenderingFrame)
-            newViewMode = WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+        let newViewMode = WI.TimelineOverview.ViewMode.Timelines;
+        if (timeline && timeline.type === WI.TimelineRecord.Type.RenderingFrame)
+            newViewMode = WI.TimelineOverview.ViewMode.RenderingFrames;
 
         const selectedByUser = false;
         this._changeViewMode(newViewMode, selectedByUser);
@@ -565,17 +565,17 @@
     _getTimelineForCurrentContentView()
     {
         let currentContentView = this.contentBrowser.currentContentView;
-        if (!(currentContentView instanceof WebInspector.TimelineRecordingContentView))
+        if (!(currentContentView instanceof WI.TimelineRecordingContentView))
             return null;
 
         let timelineView = currentContentView.currentTimelineView;
-        return (timelineView && timelineView.representedObject instanceof WebInspector.Timeline) ? timelineView.representedObject : null;
+        return (timelineView && timelineView.representedObject instanceof WI.Timeline) ? timelineView.representedObject : null;
     }
 };
 
-WebInspector.TimelineTabContentView.Type = "timeline";
+WI.TimelineTabContentView.Type = "timeline";
 
-WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey = "timeline-sidebar-panel-showing-timeline-recording-content-view";
-WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey = "timeline-sidebar-panel-selected-timeline-view-identifier";
-WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue = "overview";
-WebInspector.TimelineTabContentView.StopwatchIconStyleClass = "stopwatch-icon";
+WI.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey = "timeline-sidebar-panel-showing-timeline-recording-content-view";
+WI.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey = "timeline-sidebar-panel-selected-timeline-view-identifier";
+WI.TimelineTabContentView.OverviewTimelineIdentifierCookieValue = "overview";
+WI.TimelineTabContentView.StopwatchIconStyleClass = "stopwatch-icon";
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/TimelineTreeElement.js
index c02b77e..b7548ec 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineTreeElement.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineTreeElement = class TimelineTreeElement extends WebInspector.GeneralTreeElement
+WI.TimelineTreeElement = class TimelineTreeElement extends WI.GeneralTreeElement
 {
     constructor(timeline, placeholder)
     {
-        let displayName = WebInspector.TimelineTabContentView.displayNameForTimelineType(timeline.type);
-        let iconClassName = WebInspector.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);
-        let genericClassName = WebInspector.TimelineTabContentView.genericClassNameForTimelineType(timeline.type);
+        let displayName = WI.TimelineTabContentView.displayNameForTimelineType(timeline.type);
+        let iconClassName = WI.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);
+        let genericClassName = WI.TimelineTabContentView.genericClassNameForTimelineType(timeline.type);
 
         super([iconClassName, genericClassName], displayName, "", timeline);
 
@@ -73,9 +73,9 @@
 
     _showCloseButton()
     {
-        let tooltip = WebInspector.UIString("Close %s timeline view").format(this.mainTitle);
-        let button = new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/CloseLarge.svg", "close-button", tooltip));
-        button.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, () => { this.deselect(); });
+        let tooltip = WI.UIString("Close %s timeline view").format(this.mainTitle);
+        let button = new WI.TreeElementStatusButton(useSVGSymbol("Images/CloseLarge.svg", "close-button", tooltip));
+        button.addEventListener(WI.TreeElementStatusButton.Event.Clicked, () => { this.deselect(); });
 
         this.status = button.element;
     }
@@ -86,7 +86,7 @@
         checkboxElement.type = "checkbox";
         checkboxElement.checked = !this._placeholder;
 
-        let button = new WebInspector.TreeElementStatusButton(checkboxElement);
+        let button = new WI.TreeElementStatusButton(checkboxElement);
         checkboxElement.addEventListener("change", () => { this._dispatchEnabledDidChangeEvent(); });
 
         this.status = checkboxElement;
@@ -111,10 +111,10 @@
 
     _dispatchEnabledDidChangeEvent()
     {
-        this.dispatchEventToListeners(WebInspector.TimelineTreeElement.Event.EnabledDidChange);
+        this.dispatchEventToListeners(WI.TimelineTreeElement.Event.EnabledDidChange);
     }
 };
 
-WebInspector.TimelineTreeElement.Event = {
+WI.TimelineTreeElement.Event = {
     EnabledDidChange: "timeline-tree-element-enabled-did-change"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TimelineView.js b/Source/WebInspectorUI/UserInterface/Views/TimelineView.js
index 63035a1..97b888c 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TimelineView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TimelineView.js
@@ -24,14 +24,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineView = class TimelineView extends WebInspector.ContentView
+WI.TimelineView = class TimelineView extends WI.ContentView
 {
     constructor(representedObject)
     {
         super(representedObject);
 
         // This class should not be instantiated directly. Create a concrete subclass instead.
-        console.assert(this.constructor !== WebInspector.TimelineView && this instanceof WebInspector.TimelineView);
+        console.assert(this.constructor !== WI.TimelineView && this instanceof WI.TimelineView);
 
         this.element.classList.add("timeline-view");
 
@@ -169,16 +169,16 @@
     {
         if (this._timelineDataGrid) {
             this._timelineDataGrid.filterDelegate = null;
-            this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._timelineDataGridSelectedNodeChanged, this);
-            this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.NodeWasFiltered, this._timelineDataGridNodeWasFiltered, this);
-            this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.FilterDidChange, this.filterDidChange, this);
+            this._timelineDataGrid.removeEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._timelineDataGridSelectedNodeChanged, this);
+            this._timelineDataGrid.removeEventListener(WI.DataGrid.Event.NodeWasFiltered, this._timelineDataGridNodeWasFiltered, this);
+            this._timelineDataGrid.removeEventListener(WI.DataGrid.Event.FilterDidChange, this.filterDidChange, this);
         }
 
         this._timelineDataGrid = dataGrid;
         this._timelineDataGrid.filterDelegate = this;
-        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._timelineDataGridSelectedNodeChanged, this);
-        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.NodeWasFiltered, this._timelineDataGridNodeWasFiltered, this);
-        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.FilterDidChange, this.filterDidChange, this);
+        this._timelineDataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._timelineDataGridSelectedNodeChanged, this);
+        this._timelineDataGrid.addEventListener(WI.DataGrid.Event.NodeWasFiltered, this._timelineDataGridNodeWasFiltered, this);
+        this._timelineDataGrid.addEventListener(WI.DataGrid.Event.FilterDidChange, this.filterDidChange, this);
     }
 
     selectRecord(record)
@@ -253,12 +253,12 @@
             return startTime <= itemEndTime && itemStartTime <= endTime;
         }
 
-        if (node instanceof WebInspector.ResourceTimelineDataGridNode) {
+        if (node instanceof WI.ResourceTimelineDataGridNode) {
             let resource = node.resource;
             return checkTimeBounds(resource.requestSentTimestamp, resource.finishedOrFailedTimestamp);
         }
 
-        if (node instanceof WebInspector.SourceCodeTimelineTimelineDataGridNode) {
+        if (node instanceof WI.SourceCodeTimelineTimelineDataGridNode) {
             let sourceCodeTimeline = node.sourceCodeTimeline;
 
             // Do a quick check of the timeline bounds before we check each record.
@@ -273,7 +273,7 @@
             return false;
         }
 
-        if (node instanceof WebInspector.ProfileNodeDataGridNode) {
+        if (node instanceof WI.ProfileNodeDataGridNode) {
             let profileNode = node.profileNode;
             if (checkTimeBounds(profileNode.startTime, profileNode.endTime))
                 return true;
@@ -281,12 +281,12 @@
             return false;
         }
 
-        if (node instanceof WebInspector.TimelineDataGridNode) {
+        if (node instanceof WI.TimelineDataGridNode) {
             let record = node.record;
             return checkTimeBounds(record.startTime, record.endTime);
         }
 
-        if (node instanceof WebInspector.ProfileDataGridNode)
+        if (node instanceof WI.ProfileDataGridNode)
             return node.callingContextTreeNode.hasStackTraceInTimeRange(startTime, endTime);
 
         console.error("Unknown DataGridNode, can't filter by time.");
@@ -309,21 +309,21 @@
 
     _timelineDataGridSelectedNodeChanged(event)
     {
-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+        this.dispatchEventToListeners(WI.ContentView.Event.SelectionPathComponentsDidChange);
     }
 
     _timelineDataGridNodeWasFiltered(event)
     {
         let node = event.data.node;
-        if (!(node instanceof WebInspector.TimelineDataGridNode))
+        if (!(node instanceof WI.TimelineDataGridNode))
             return;
 
-        this.dispatchEventToListeners(WebInspector.TimelineView.Event.RecordWasFiltered, {record: node.record, filtered: node.hidden});
+        this.dispatchEventToListeners(WI.TimelineView.Event.RecordWasFiltered, {record: node.record, filtered: node.hidden});
     }
 
     _timesDidChange()
     {
-        if (!WebInspector.timelineManager.isCapturing() || this.showsLiveRecordingData)
+        if (!WI.timelineManager.isCapturing() || this.showsLiveRecordingData)
             this.needsLayout();
     }
 
@@ -339,6 +339,6 @@
     }
 };
 
-WebInspector.TimelineView.Event = {
+WI.TimelineView.Event = {
     RecordWasFiltered: "record-was-filtered"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TitleView.js b/Source/WebInspectorUI/UserInterface/Views/TitleView.js
index d0384fc..56706b7 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TitleView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TitleView.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TitleView = class TitleView extends WebInspector.View
+WI.TitleView = class TitleView extends WI.View
 {
     constructor(title)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js
index 1f609a3..262b7a3 100644
--- a/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ToggleButtonNavigationItem = class ToggleButtonNavigationItem extends WebInspector.ButtonNavigationItem
+WI.ToggleButtonNavigationItem = class ToggleButtonNavigationItem extends WI.ButtonNavigationItem
 {
     constructor(identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/Toolbar.js b/Source/WebInspectorUI/UserInterface/Views/Toolbar.js
index 9c5120e..c1e1a28 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Toolbar.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Toolbar.js
@@ -23,34 +23,34 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Toolbar = class Toolbar extends WebInspector.NavigationBar
+WI.Toolbar = class Toolbar extends WI.NavigationBar
 {
     constructor(element)
     {
         super(element, null, "toolbar");
 
         this._controlSectionElement = document.createElement("div");
-        this._controlSectionElement.className = WebInspector.Toolbar.ControlSectionStyleClassName;
+        this._controlSectionElement.className = WI.Toolbar.ControlSectionStyleClassName;
         this.element.appendChild(this._controlSectionElement);
 
         this._leftSectionElement = document.createElement("div");
-        this._leftSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.LeftItemSectionStyleClassName;
+        this._leftSectionElement.className = WI.Toolbar.ItemSectionStyleClassName + " " + WI.Toolbar.LeftItemSectionStyleClassName;
         this.element.appendChild(this._leftSectionElement);
 
         this._centerLeftSectionElement = document.createElement("div");
-        this._centerLeftSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterLeftItemSectionStyleClassName;
+        this._centerLeftSectionElement.className = WI.Toolbar.ItemSectionStyleClassName + " " + WI.Toolbar.CenterLeftItemSectionStyleClassName;
         this.element.appendChild(this._centerLeftSectionElement);
 
         this._centerSectionElement = document.createElement("div");
-        this._centerSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterItemSectionStyleClassName;
+        this._centerSectionElement.className = WI.Toolbar.ItemSectionStyleClassName + " " + WI.Toolbar.CenterItemSectionStyleClassName;
         this.element.appendChild(this._centerSectionElement);
 
         this._centerRightSectionElement = document.createElement("div");
-        this._centerRightSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterRightItemSectionStyleClassName;
+        this._centerRightSectionElement.className = WI.Toolbar.ItemSectionStyleClassName + " " + WI.Toolbar.CenterRightItemSectionStyleClassName;
         this.element.appendChild(this._centerRightSectionElement);
 
         this._rightSectionElement = document.createElement("div");
-        this._rightSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.RightItemSectionStyleClassName;
+        this._rightSectionElement.className = WI.Toolbar.ItemSectionStyleClassName + " " + WI.Toolbar.RightItemSectionStyleClassName;
         this.element.appendChild(this._rightSectionElement);
     }
 
@@ -61,28 +61,28 @@
         var sectionElement;
 
         switch (sectionIdentifier) {
-        case WebInspector.Toolbar.Section.Control:
+        case WI.Toolbar.Section.Control:
             sectionElement = this._controlSectionElement;
             break;
 
-        case WebInspector.Toolbar.Section.Left:
+        case WI.Toolbar.Section.Left:
             sectionElement = this._leftSectionElement;
             break;
 
-        case WebInspector.Toolbar.Section.CenterLeft:
+        case WI.Toolbar.Section.CenterLeft:
             sectionElement = this._centerLeftSectionElement;
             break;
 
         default:
-        case WebInspector.Toolbar.Section.Center:
+        case WI.Toolbar.Section.Center:
             sectionElement = this._centerSectionElement;
             break;
 
-        case WebInspector.Toolbar.Section.CenterRight:
+        case WI.Toolbar.Section.CenterRight:
             sectionElement = this._centerRightSectionElement;
             break;
 
-        case WebInspector.Toolbar.Section.Right:
+        case WI.Toolbar.Section.Right:
             sectionElement = this._rightSectionElement;
             break;
         }
@@ -101,13 +101,13 @@
             return;
 
         // Force collapsed style for JavaScript debuggables.
-        if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript) {
-            this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);
+        if (WI.debuggableType === WI.DebuggableType.JavaScript) {
+            this.element.classList.add(WI.NavigationBar.CollapsedStyleClassName);
             return;
         }
 
         // Remove the collapsed style class to test if the items can fit at full width.
-        this.element.classList.remove(WebInspector.NavigationBar.CollapsedStyleClassName);
+        this.element.classList.remove(WI.NavigationBar.CollapsedStyleClassName);
 
         function isOverflowingToolbar()
         {
@@ -125,20 +125,20 @@
         if (!isOverflowingToolbar.call(this))
             return;
 
-        this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);
+        this.element.classList.add(WI.NavigationBar.CollapsedStyleClassName);
     }
 };
 
-WebInspector.Toolbar.StyleClassName = "toolbar";
-WebInspector.Toolbar.ControlSectionStyleClassName = "control-section";
-WebInspector.Toolbar.ItemSectionStyleClassName = "item-section";
-WebInspector.Toolbar.LeftItemSectionStyleClassName = "left";
-WebInspector.Toolbar.CenterLeftItemSectionStyleClassName = "center-left";
-WebInspector.Toolbar.CenterItemSectionStyleClassName = "center";
-WebInspector.Toolbar.CenterRightItemSectionStyleClassName = "center-right";
-WebInspector.Toolbar.RightItemSectionStyleClassName = "right";
+WI.Toolbar.StyleClassName = "toolbar";
+WI.Toolbar.ControlSectionStyleClassName = "control-section";
+WI.Toolbar.ItemSectionStyleClassName = "item-section";
+WI.Toolbar.LeftItemSectionStyleClassName = "left";
+WI.Toolbar.CenterLeftItemSectionStyleClassName = "center-left";
+WI.Toolbar.CenterItemSectionStyleClassName = "center";
+WI.Toolbar.CenterRightItemSectionStyleClassName = "center-right";
+WI.Toolbar.RightItemSectionStyleClassName = "right";
 
-WebInspector.Toolbar.Section = {
+WI.Toolbar.Section = {
     Control: "control",
     Left: "left",
     CenterLeft: "center-left",
diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeElement.js b/Source/WebInspectorUI/UserInterface/Views/TreeElement.js
index 75276a7..3269401 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TreeElement.js
@@ -26,7 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TreeElement = class TreeElement extends WebInspector.Object
+WI.TreeElement = class TreeElement extends WI.Object
 {
     constructor(title, representedObject, options = {})
     {
@@ -38,7 +38,7 @@
         if (this.representedObject.__treeElementIdentifier)
             this.identifier = this.representedObject.__treeElementIdentifier;
         else {
-            this.identifier = WebInspector.TreeOutline._knownTreeElementNextIdentifier++;
+            this.identifier = WI.TreeOutline._knownTreeElementNextIdentifier++;
             this.representedObject.__treeElementIdentifier = this.identifier;
         }
 
@@ -57,13 +57,13 @@
 
     // Methods
 
-    appendChild() { return WebInspector.TreeOutline.prototype.appendChild.apply(this, arguments); }
-    insertChild() { return WebInspector.TreeOutline.prototype.insertChild.apply(this, arguments); }
-    removeChild() { return WebInspector.TreeOutline.prototype.removeChild.apply(this, arguments); }
-    removeChildAtIndex() { return WebInspector.TreeOutline.prototype.removeChildAtIndex.apply(this, arguments); }
-    removeChildren() { return WebInspector.TreeOutline.prototype.removeChildren.apply(this, arguments); }
-    removeChildrenRecursive() { return WebInspector.TreeOutline.prototype.removeChildrenRecursive.apply(this, arguments); }
-    selfOrDescendant() { return WebInspector.TreeOutline.prototype.selfOrDescendant.apply(this, arguments); }
+    appendChild() { return WI.TreeOutline.prototype.appendChild.apply(this, arguments); }
+    insertChild() { return WI.TreeOutline.prototype.insertChild.apply(this, arguments); }
+    removeChild() { return WI.TreeOutline.prototype.removeChild.apply(this, arguments); }
+    removeChildAtIndex() { return WI.TreeOutline.prototype.removeChildAtIndex.apply(this, arguments); }
+    removeChildren() { return WI.TreeOutline.prototype.removeChildren.apply(this, arguments); }
+    removeChildrenRecursive() { return WI.TreeOutline.prototype.removeChildrenRecursive.apply(this, arguments); }
+    selfOrDescendant() { return WI.TreeOutline.prototype.selfOrDescendant.apply(this, arguments); }
 
     get arrowToggleWidth()
     {
@@ -166,7 +166,7 @@
             this._childrenListNode.hidden = this._hidden;
 
         if (this.treeOutline)
-            this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementVisibilityDidChange, {element: this});
+            this.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementVisibilityDidChange, {element: this});
     }
 
     get shouldRefreshChildren()
@@ -233,9 +233,9 @@
             if (this.selected)
                 this._listItemNode.classList.add("selected");
 
-            this._listItemNode.addEventListener("mousedown", WebInspector.TreeElement.treeElementMouseDown);
-            this._listItemNode.addEventListener("click", WebInspector.TreeElement.treeElementToggled);
-            this._listItemNode.addEventListener("dblclick", WebInspector.TreeElement.treeElementDoubleClicked);
+            this._listItemNode.addEventListener("mousedown", WI.TreeElement.treeElementMouseDown);
+            this._listItemNode.addEventListener("click", WI.TreeElement.treeElementToggled);
+            this._listItemNode.addEventListener("dblclick", WI.TreeElement.treeElementDoubleClicked);
 
             if (this.onattach)
                 this.onattach(this);
@@ -311,7 +311,7 @@
         if (element.treeElement.isEventWithinDisclosureTriangle(event))
             return;
 
-        if (element.treeElement.dispatchEventToListeners(WebInspector.TreeElement.Event.DoubleClick))
+        if (element.treeElement.dispatchEventToListeners(WI.TreeElement.Event.DoubleClick))
             return;
 
         if (element.treeElement.ondblclick)
@@ -335,7 +335,7 @@
             this.oncollapse(this);
 
         if (this.treeOutline)
-            this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, {element: this});
+            this.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementDisclosureDidChanged, {element: this});
     }
 
     collapseRecursively()
@@ -399,7 +399,7 @@
             this.onexpand(this);
 
         if (this.treeOutline)
-            this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, {element: this});
+            this.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementDisclosureDidChanged, {element: this});
     }
 
     expandRecursively(maxDepth)
@@ -512,12 +512,12 @@
             if (this.onselect)
                 this.onselect(this, selectedByUser);
 
-            treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.SelectionDidChange, {selectedElement: this, deselectedElement, selectedByUser});
+            treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.SelectionDidChange, {selectedElement: this, deselectedElement, selectedByUser});
         }
 
         treeOutline.processingSelectionChange = false;
 
-        let treeOutlineGroup = WebInspector.TreeOutlineGroup.groupForTreeOutline(treeOutline);
+        let treeOutlineGroup = WI.TreeOutlineGroup.groupForTreeOutline(treeOutline);
         if (!treeOutlineGroup)
             return;
 
@@ -545,7 +545,7 @@
             if (this.ondeselect)
                 this.ondeselect(this);
 
-            this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.SelectionDidChange, {deselectedElement: this});
+            this.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.SelectionDidChange, {deselectedElement: this});
         }
 
         return true;
@@ -621,7 +621,7 @@
         // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
         let computedStyle = window.getComputedStyle(this._listItemNode);
         let start = 0;
-        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+        if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
             start += this._listItemNode.totalOffsetRight - computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX) - this.arrowToggleWidth;
         else
             start += this._listItemNode.totalOffsetLeft + computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);
@@ -634,12 +634,12 @@
         if (this.children.some((child) => child.hasChildren) || (this.hasChildren && !this.children.length)) {
             contextMenu.appendSeparator();
 
-            contextMenu.appendItem(WebInspector.UIString("Expand All"), this.expandRecursively.bind(this));
-            contextMenu.appendItem(WebInspector.UIString("Collapse All"), this.collapseRecursively.bind(this));
+            contextMenu.appendItem(WI.UIString("Expand All"), this.expandRecursively.bind(this));
+            contextMenu.appendItem(WI.UIString("Collapse All"), this.collapseRecursively.bind(this));
         }
     }
 };
 
-WebInspector.TreeElement.Event = {
+WI.TreeElement.Event = {
     DoubleClick: "tree-element-double-click",
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.js b/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.js
index 2ee3ac8..fa39f85 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TreeElementStatusButton = class TreeElementStatusButton extends WebInspector.Object
+WI.TreeElementStatusButton = class TreeElementStatusButton extends WI.Object
 {
     constructor(element)
     {
@@ -45,7 +45,7 @@
 
     get hidden()
     {
-        return !this._element.classList.contains(WebInspector.TreeElementStatusButton.DisabledStyleClassName);
+        return !this._element.classList.contains(WI.TreeElementStatusButton.DisabledStyleClassName);
     }
 
     set hidden(flag)
@@ -55,15 +55,15 @@
 
     get enabled()
     {
-        return !this._element.classList.contains(WebInspector.TreeElementStatusButton.DisabledStyleClassName);
+        return !this._element.classList.contains(WI.TreeElementStatusButton.DisabledStyleClassName);
     }
 
     set enabled(flag)
     {
         if (flag)
-            this._element.classList.remove(WebInspector.TreeElementStatusButton.DisabledStyleClassName);
+            this._element.classList.remove(WI.TreeElementStatusButton.DisabledStyleClassName);
         else
-            this._element.classList.add(WebInspector.TreeElementStatusButton.DisabledStyleClassName);
+            this._element.classList.add(WI.TreeElementStatusButton.DisabledStyleClassName);
     }
 
     // Private
@@ -75,12 +75,12 @@
 
         event.stopPropagation();
 
-        this.dispatchEventToListeners(WebInspector.TreeElementStatusButton.Event.Clicked, event);
+        this.dispatchEventToListeners(WI.TreeElementStatusButton.Event.Clicked, event);
     }
 };
 
-WebInspector.TreeElementStatusButton.DisabledStyleClassName = "disabled";
+WI.TreeElementStatusButton.DisabledStyleClassName = "disabled";
 
-WebInspector.TreeElementStatusButton.Event = {
+WI.TreeElementStatusButton.Event = {
     Clicked: "status-button-clicked"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js b/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
index 9e68275..b850340 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
@@ -26,14 +26,14 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TreeOutline = class TreeOutline extends WebInspector.Object
+WI.TreeOutline = class TreeOutline extends WI.Object
 {
     constructor(element)
     {
         super();
 
         this.element = element || document.createElement("ol");
-        this.element.classList.add(WebInspector.TreeOutline.ElementStyleClassName);
+        this.element.classList.add(WI.TreeOutline.ElementStyleClassName);
         this.element.addEventListener("contextmenu", this._handleContextmenu.bind(this));
 
         this.children = [];
@@ -57,7 +57,7 @@
         this._childrenListNode.tabIndex = 0;
         this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
 
-        WebInspector.TreeOutline._generateStyleRulesIfNeeded();
+        WI.TreeOutline._generateStyleRulesIfNeeded();
     }
 
     // Public
@@ -135,7 +135,7 @@
             return;
 
         this._customIndent = x;
-        this.element.classList.toggle(WebInspector.TreeOutline.CustomIndentStyleClassName, this._customIndent);
+        this.element.classList.toggle(WI.TreeOutline.CustomIndentStyleClassName, this._customIndent);
     }
 
     appendChild(child)
@@ -175,7 +175,7 @@
             child._attach();
 
         if (this.treeOutline)
-            this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementAdded, {element: child});
+            this.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementAdded, {element: child});
 
         if (isFirstChild && this.expanded)
             this.expand();
@@ -225,7 +225,7 @@
             child._attach();
 
         if (this.treeOutline)
-            this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementAdded, {element: child});
+            this.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementAdded, {element: child});
 
         if (isFirstChild && this.expanded)
             this.expand();
@@ -268,7 +268,7 @@
         child.previousSibling = null;
 
         if (treeOutline)
-            treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved, {element: child});
+            treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child});
     }
 
     removeChild(child, suppressOnDeselect, suppressSelectSibling)
@@ -309,7 +309,7 @@
             child.previousSibling = null;
 
             if (treeOutline)
-                treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved, {element: child});
+                treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child});
         }
 
         this.children = [];
@@ -340,7 +340,7 @@
             child.previousSibling = null;
 
             if (treeOutline)
-                treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved, {element: child});
+                treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child});
         }
 
         this.children = [];
@@ -485,7 +485,7 @@
         if (treeElement.treeOutline !== this)
             return;
 
-        this.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDidChange, {element: treeElement});
+        this.dispatchEventToListeners(WI.TreeOutline.Event.ElementDidChange, {element: treeElement});
     }
 
     treeElementFromNode(node)
@@ -513,7 +513,7 @@
         if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey)
             return;
 
-        let isRTL = WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL;
+        let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;
 
         var handled = false;
         var nextSelectedElement;
@@ -669,10 +669,10 @@
 
     static _generateStyleRulesIfNeeded()
     {
-        if (WebInspector.TreeOutline._styleElement)
+        if (WI.TreeOutline._styleElement)
            return;
 
-        WebInspector.TreeOutline._styleElement = document.createElement("style");
+        WI.TreeOutline._styleElement = document.createElement("style");
 
         let maximumTreeDepth = 32;
         let baseLeftPadding = 5; // Matches the padding in TreeOutline.css for the item class. Keep in sync.
@@ -683,9 +683,9 @@
         for (let i = 1; i <= maximumTreeDepth; ++i) {
             // Keep all the elements at the same depth once the maximum is reached.
             childrenSubstring += i === maximumTreeDepth ? " .children" : " > .children";
-            styleText += `.${WebInspector.TreeOutline.ElementStyleClassName}:not(.${WebInspector.TreeOutline.CustomIndentStyleClassName})${childrenSubstring} > .item { `;
+            styleText += `.${WI.TreeOutline.ElementStyleClassName}:not(.${WI.TreeOutline.CustomIndentStyleClassName})${childrenSubstring} > .item { `;
 
-            if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+            if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
                 styleText += "padding-right: ";
             else
                 styleText += "padding-left: ";
@@ -693,9 +693,9 @@
             styleText += (baseLeftPadding + (depthPadding * i)) + "px; }\n";
         }
 
-        WebInspector.TreeOutline._styleElement.textContent = styleText;
+        WI.TreeOutline._styleElement.textContent = styleText;
 
-        document.head.appendChild(WebInspector.TreeOutline._styleElement);
+        document.head.appendChild(WI.TreeOutline._styleElement);
     }
 
     _handleContextmenu(event)
@@ -704,17 +704,17 @@
         if (!treeElement)
             return;
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
         this.populateContextMenu(contextMenu, event, treeElement);
     }
 };
 
-WebInspector.TreeOutline._styleElement = null;
+WI.TreeOutline._styleElement = null;
 
-WebInspector.TreeOutline.ElementStyleClassName = "tree-outline";
-WebInspector.TreeOutline.CustomIndentStyleClassName = "custom-indent";
+WI.TreeOutline.ElementStyleClassName = "tree-outline";
+WI.TreeOutline.CustomIndentStyleClassName = "custom-indent";
 
-WebInspector.TreeOutline.Event = {
+WI.TreeOutline.Event = {
     ElementAdded: Symbol("element-added"),
     ElementDidChange: Symbol("element-did-change"),
     ElementRemoved: Symbol("element-removed"),
@@ -723,4 +723,4 @@
     SelectionDidChange: Symbol("selection-did-change")
 };
 
-WebInspector.TreeOutline._knownTreeElementNextIdentifier = 1;
+WI.TreeOutline._knownTreeElementNextIdentifier = 1;
diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeOutlineDataGridSynchronizer.js b/Source/WebInspectorUI/UserInterface/Views/TreeOutlineDataGridSynchronizer.js
index 2cc86b1..5eec285 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TreeOutlineDataGridSynchronizer.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TreeOutlineDataGridSynchronizer.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TreeOutlineDataGridSynchronizer = class TreeOutlineDataGridSynchronizer extends WebInspector.Object
+WI.TreeOutlineDataGridSynchronizer = class TreeOutlineDataGridSynchronizer extends WI.Object
 {
     constructor(treeOutline, dataGrid, delegate)
     {
@@ -39,9 +39,9 @@
 
         this._treeOutline.__dataGridNode = this._dataGrid;
 
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.ExpandedNode, this._dataGridNodeExpanded, this);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.CollapsedNode, this._dataGridNodeCollapsed, this);
-        this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.ExpandedNode, this._dataGridNodeExpanded, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.CollapsedNode, this._dataGridNodeCollapsed, this);
+        this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
 
         this._dataGrid.element.addEventListener("focus", this._dataGridGainedFocus.bind(this));
         this._dataGrid.element.addEventListener("blur", this._dataGridLostFocus.bind(this));
@@ -49,11 +49,11 @@
         this._treeOutline.element.addEventListener("focus", this._treeOutlineGainedFocus.bind(this));
         this._treeOutline.element.addEventListener("blur", this._treeOutlineLostFocus.bind(this));
 
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded, this._treeElementAdded, this);
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementRemoved, this._treeElementRemoved, this);
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange, this);
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementVisibilityDidChange, this._treeElementVisibilityDidChange, this);
-        treeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._treeElementAdded, this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.ElementRemoved, this._treeElementRemoved, this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.ElementDisclosureDidChanged, this._treeElementDisclosureDidChange, this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.ElementVisibilityDidChange, this._treeElementVisibilityDidChange, this);
+        treeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
     }
 
     // Public
diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeOutlineGroup.js b/Source/WebInspectorUI/UserInterface/Views/TreeOutlineGroup.js
index f649b8e..2de0830 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TreeOutlineGroup.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TreeOutlineGroup.js
@@ -23,18 +23,18 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TreeOutlineGroup = class TreeOutlineGroup extends WebInspector.Collection
+WI.TreeOutlineGroup = class TreeOutlineGroup extends WI.Collection
 {
     constructor()
     {
-        super((object) => object instanceof WebInspector.TreeOutline);
+        super((object) => object instanceof WI.TreeOutline);
     }
 
     // Static
 
     static groupForTreeOutline(treeOutline)
     {
-        return treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol] || null;
+        return treeOutline[WI.TreeOutlineGroup.GroupForTreeOutlineSymbol] || null;
     }
 
     // Public
@@ -53,8 +53,8 @@
 
     itemAdded(treeOutline)
     {
-        console.assert(!treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]);
-        treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol] = this;
+        console.assert(!treeOutline[WI.TreeOutlineGroup.GroupForTreeOutlineSymbol]);
+        treeOutline[WI.TreeOutlineGroup.GroupForTreeOutlineSymbol] = this;
 
         if (treeOutline.selectedTreeElement)
             this._removeConflictingTreeSelections(treeOutline.selectedTreeElement);
@@ -62,8 +62,8 @@
 
     itemRemoved(treeOutline)
     {
-        console.assert(treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol] === this);
-        treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol] = null;
+        console.assert(treeOutline[WI.TreeOutlineGroup.GroupForTreeOutlineSymbol] === this);
+        treeOutline[WI.TreeOutlineGroup.GroupForTreeOutlineSymbol] = null;
     }
 
     didSelectTreeElement(treeElement)
@@ -93,4 +93,4 @@
     }
 };
 
-WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol = Symbol("group-for-tree-outline");
+WI.TreeOutlineGroup.GroupForTreeOutlineSymbol = Symbol("group-for-tree-outline");
diff --git a/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js b/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js
index ba3b1b7..b351638 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TypeTokenView = class TypeTokenView extends WebInspector.Object
+WI.TypeTokenView = class TypeTokenView extends WI.Object
 {
     constructor(tokenAnnotator, shouldHaveRightMargin, shouldHaveLeftMargin, titleType, functionOrVariableName)
     {
-        console.assert(titleType === WebInspector.TypeTokenView.TitleType.Variable || titleType === WebInspector.TypeTokenView.TitleType.ReturnStatement);
+        console.assert(titleType === WI.TypeTokenView.TitleType.Variable || titleType === WI.TypeTokenView.TitleType.ReturnStatement);
 
         super();
 
@@ -45,7 +45,7 @@
 
         this._colorClass = null;
 
-        this._popoverTitle = WebInspector.TypeTokenView.titleForPopover(titleType, functionOrVariableName);
+        this._popoverTitle = WI.TypeTokenView.titleForPopover(titleType, functionOrVariableName);
 
         this._setUpMouseoverHandlers();
     }
@@ -54,20 +54,20 @@
 
     static titleForPopover(titleType, functionOrVariableName)
     {
-        if (titleType === WebInspector.TypeTokenView.TitleType.Variable)
-            return WebInspector.UIString("Type information for variable: %s").format(functionOrVariableName);
+        if (titleType === WI.TypeTokenView.TitleType.Variable)
+            return WI.UIString("Type information for variable: %s").format(functionOrVariableName);
 
         if (functionOrVariableName)
-            return WebInspector.UIString("Return type for function: %s").format(functionOrVariableName);
+            return WI.UIString("Return type for function: %s").format(functionOrVariableName);
 
-        return WebInspector.UIString("Return type for anonymous function");
+        return WI.UIString("Return type for anonymous function");
     }
 
     // Public
 
     update(typeDescription)
     {
-        console.assert(typeDescription instanceof WebInspector.TypeDescription);
+        console.assert(typeDescription instanceof WI.TypeDescription);
 
         this._typeDescription = typeDescription;
 
@@ -81,7 +81,7 @@
         if (this._colorClass)
             this.element.classList.remove(this._colorClass);
 
-        this._colorClass = WebInspector.TypeTokenView.ColorClassForType[hashString] || "type-token-default";
+        this._colorClass = WI.TypeTokenView.ColorClassForType[hashString] || "type-token-default";
         this.element.classList.add(this._colorClass);
     }
 
@@ -97,12 +97,12 @@
                 timeoutID = null;
 
                 var domRect = this.element.getBoundingClientRect();
-                var bounds = new WebInspector.Rect(domRect.left, domRect.top, domRect.width, domRect.height);
+                var bounds = new WI.Rect(domRect.left, domRect.top, domRect.width, domRect.height);
                 this._tokenAnnotator.sourceCodeTextEditor.showPopoverForTypes(this._typeDescription, bounds, this._popoverTitle);
             }
 
             if (this._shouldShowPopover())
-                timeoutID = setTimeout(showPopoverAfterDelay.bind(this), WebInspector.TypeTokenView.DelayHoverTime);
+                timeoutID = setTimeout(showPopoverAfterDelay.bind(this), WI.TypeTokenView.DelayHoverTime);
         }.bind(this));
 
         this.element.addEventListener("mouseout", function() {
@@ -133,9 +133,9 @@
         var typeSet = this._typeDescription.typeSet;
 
         if (this._typeDescription.leastCommonAncestor) {
-            if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object))
+            if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Object))
                 return this._typeDescription.leastCommonAncestor;
-            if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+            if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Object | WI.TypeSet.NullOrUndefinedTypeBits))
                 return this._typeDescription.leastCommonAncestor + "?";
         }
 
@@ -144,54 +144,54 @@
         // Therefore, more specific types must be checked first.
 
         // The strings returned here should match those in TypeTokenView.ColorClassForType
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Function))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Function))
             return "Function";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Undefined))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Undefined))
             return "Undefined";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Null))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Null))
             return "Null";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Boolean))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Boolean))
             return "Boolean";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Integer))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Integer))
             return "Integer";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Number | WebInspector.TypeSet.TypeBit.Integer))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Number | WI.TypeSet.TypeBit.Integer))
             return "Number";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.String))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.String))
             return "String";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Symbol))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Symbol))
             return "Symbol";
 
-        if (typeSet.isContainedIn(WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.NullOrUndefinedTypeBits))
             return "(?)";
 
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Function | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Function | WI.TypeSet.NullOrUndefinedTypeBits))
             return "Function?";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Boolean | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Boolean | WI.TypeSet.NullOrUndefinedTypeBits))
             return "Boolean?";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Integer | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Integer | WI.TypeSet.NullOrUndefinedTypeBits))
             return "Integer?";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Number | WebInspector.TypeSet.TypeBit.Integer | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Number | WI.TypeSet.TypeBit.Integer | WI.TypeSet.NullOrUndefinedTypeBits))
             return "Number?";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.String | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.String | WI.TypeSet.NullOrUndefinedTypeBits))
             return "String?";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Symbol | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Symbol | WI.TypeSet.NullOrUndefinedTypeBits))
             return "Symbol?";
 
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.TypeBit.Function | WebInspector.TypeSet.TypeBit.String))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Object | WI.TypeSet.TypeBit.Function | WI.TypeSet.TypeBit.String))
             return "Object";
-        if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.TypeBit.Function | WebInspector.TypeSet.TypeBit.String | WebInspector.TypeSet.NullOrUndefinedTypeBits))
+        if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Object | WI.TypeSet.TypeBit.Function | WI.TypeSet.TypeBit.String | WI.TypeSet.NullOrUndefinedTypeBits))
             return "Object?";
 
-        return WebInspector.UIString("(many)");
+        return WI.UIString("(many)");
     }
 };
 
-WebInspector.TypeTokenView.TitleType = {
+WI.TypeTokenView.TitleType = {
     Variable: Symbol("title-type-variable"),
     ReturnStatement: Symbol("title-type-return-statement")
 };
 
-WebInspector.TypeTokenView.ColorClassForType = {
+WI.TypeTokenView.ColorClassForType = {
     "String": "type-token-string",
     "Symbol": "type-token-symbol",
     "Function": "type-token-function",
@@ -204,4 +204,4 @@
     "(many)": "type-token-many"
 };
 
-WebInspector.TypeTokenView.DelayHoverTime = 350;
+WI.TypeTokenView.DelayHoverTime = 350;
diff --git a/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js
index 02a7674..5bdecc7 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TypeTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TypeTreeElement = class TypeTreeElement extends WebInspector.GeneralTreeElement
+WI.TypeTreeElement = class TypeTreeElement extends WI.GeneralTreeElement
 {
     constructor(name, structureDescription, isPrototype)
     {
@@ -32,7 +32,7 @@
         const subtitle = null;
         super(classNames, title, subtitle, structureDescription || null);
 
-        console.assert(!structureDescription || structureDescription instanceof WebInspector.StructureDescription);
+        console.assert(!structureDescription || structureDescription instanceof WI.StructureDescription);
 
         this._name = name;
         this._structureDescription = structureDescription || null;
@@ -46,7 +46,7 @@
         this.tooltipHandledSeparately = true;
         this.hasChildren = structureDescription;
 
-        var displayName = this._isPrototype ? WebInspector.UIString("%s Prototype").format(name.replace(/Prototype$/, "")) : name;
+        var displayName = this._isPrototype ? WI.UIString("%s Prototype").format(name.replace(/Prototype$/, "")) : name;
         var nameElement = document.createElement("span");
         nameElement.classList.add("type-name");
         nameElement.textContent = displayName;
@@ -85,7 +85,7 @@
                 continue;
             properties.push({name});
         }
-        properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+        properties.sort(WI.ObjectTreeView.comparePropertyDescriptors);
 
         var optionalProperties = [];
         for (var name of this._structureDescription.optionalFields) {
@@ -94,28 +94,28 @@
                 continue;
             optionalProperties.push({name: name + "?"});
         }
-        optionalProperties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+        optionalProperties.sort(WI.ObjectTreeView.comparePropertyDescriptors);
 
         for (var property of properties)
-            this.appendChild(new WebInspector.TypeTreeElement(property.name, null));
+            this.appendChild(new WI.TypeTreeElement(property.name, null));
         for (var property of optionalProperties)
-            this.appendChild(new WebInspector.TypeTreeElement(property.name, null));
+            this.appendChild(new WI.TypeTreeElement(property.name, null));
 
         if (this._structureDescription.imprecise) {
-            var truncatedMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(ellipsis);
-            this.appendChild(new WebInspector.TreeElement(truncatedMessageElement, null, false));
+            var truncatedMessageElement = WI.ObjectTreeView.createEmptyMessageElement(ellipsis);
+            this.appendChild(new WI.TreeElement(truncatedMessageElement, null, false));
         }
 
         if (!this.children.length) {
-            var emptyMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));
-            this.appendChild(new WebInspector.TreeElement(emptyMessageElement, null, false));
+            var emptyMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("No Properties"));
+            this.appendChild(new WI.TreeElement(emptyMessageElement, null, false));
         }
 
         console.assert(this.children.length > 0);
 
         var prototypeStructure = this._structureDescription.prototypeStructure;
         if (prototypeStructure)
-            this.appendChild(new WebInspector.TypeTreeElement(prototypeStructure.constructorName, prototypeStructure, true));
+            this.appendChild(new WI.TypeTreeElement(prototypeStructure.constructorName, prototypeStructure, true));
     }
 
     onexpand()
diff --git a/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js b/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js
index 0b65eea..43d5f73 100644
--- a/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/TypeTreeView.js
@@ -23,20 +23,20 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TypeTreeView = class TypeTreeView extends WebInspector.Object
+WI.TypeTreeView = class TypeTreeView extends WI.Object
 {
     constructor(typeDescription)
     {
         super();
 
-        console.assert(typeDescription instanceof WebInspector.TypeDescription);
+        console.assert(typeDescription instanceof WI.TypeDescription);
 
         this._typeDescription = typeDescription;
 
         this._element = document.createElement("div");
         this._element.className = "type-tree";
 
-        this._outline = new WebInspector.TreeOutline;
+        this._outline = new WI.TreeOutline;
         this._outline.customIndent = true;
         this._outline.element.classList.add("type");
         this._element.appendChild(this._outline.element);
@@ -74,19 +74,19 @@
             types.push({name: structure.constructorName, structure});
         for (var primitiveName of this._typeDescription.typeSet.primitiveTypeNames)
             types.push({name: primitiveName});
-        types.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);
+        types.sort(WI.ObjectTreeView.comparePropertyDescriptors);
 
         for (var type of types)
-            this._outline.appendChild(new WebInspector.TypeTreeElement(type.name, type.structure, false));
+            this._outline.appendChild(new WI.TypeTreeElement(type.name, type.structure, false));
 
         if (this._typeDescription.truncated) {
-            var truncatedMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(ellipsis);
-            this._outline.appendChild(new WebInspector.TreeElement(truncatedMessageElement, null, false));
+            var truncatedMessageElement = WI.ObjectTreeView.createEmptyMessageElement(ellipsis);
+            this._outline.appendChild(new WI.TreeElement(truncatedMessageElement, null, false));
         }
 
         if (!this._outline.children.length) {
-            var errorMessageElement = WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));
-            this._outline.appendChild(new WebInspector.TreeElement(errorMessageElement, null, false));
+            var errorMessageElement = WI.ObjectTreeView.createEmptyMessageElement(WI.UIString("No Properties"));
+            this._outline.appendChild(new WI.TreeElement(errorMessageElement, null, false));
         }
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/View.js b/Source/WebInspectorUI/UserInterface/Views/View.js
index 472f991..a633b08 100644
--- a/Source/WebInspectorUI/UserInterface/Views/View.js
+++ b/Source/WebInspectorUI/UserInterface/Views/View.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.View = class View extends WebInspector.Object
+WI.View = class View extends WI.Object
 {
     constructor(element)
     {
@@ -45,10 +45,10 @@
 
     static rootView()
     {
-        if (!WebInspector.View._rootView)
-            WebInspector.View._rootView = new WebInspector.View(document.body);
+        if (!WI.View._rootView)
+            WI.View._rootView = new WI.View(document.body);
 
-        return WebInspector.View._rootView;
+        return WI.View._rootView;
     }
 
     // Public
@@ -92,9 +92,9 @@
 
     insertSubviewBefore(view, referenceView)
     {
-        console.assert(view instanceof WebInspector.View);
-        console.assert(!referenceView || referenceView instanceof WebInspector.View);
-        console.assert(view !== WebInspector.View._rootView, "Root view cannot be a subview.");
+        console.assert(view instanceof WI.View);
+        console.assert(!referenceView || referenceView instanceof WI.View);
+        console.assert(view !== WI.View._rootView, "Root view cannot be a subview.");
 
         if (this._subviews.includes(view)) {
             console.assert(false, "Cannot add view that is already a subview.", view);
@@ -117,7 +117,7 @@
 
     removeSubview(view)
     {
-        console.assert(view instanceof WebInspector.View);
+        console.assert(view instanceof WI.View);
         console.assert(view.element.parentNode === this._element, "Subview DOM element must be a child of the parent view element.");
 
         if (!this._subviews.includes(view)) {
@@ -162,12 +162,12 @@
         if (this._dirty)
             return;
 
-        WebInspector.View._scheduleLayoutForView(this);
+        WI.View._scheduleLayoutForView(this);
     }
 
     cancelLayout()
     {
-        WebInspector.View._cancelScheduledLayoutForView(this);
+        WI.View._cancelScheduledLayoutForView(this);
     }
 
     // Protected
@@ -180,7 +180,7 @@
         this._isAttachedToRoot = isAttachedToRoot;
 
         if (this._isAttachedToRoot && this._needsLayoutWhenAttachedToRoot) {
-            WebInspector.View._scheduleLayoutForView(this);
+            WI.View._scheduleLayoutForView(this);
             this._needsLayoutWhenAttachedToRoot = false;
         }
 
@@ -192,7 +192,7 @@
     {
         this._parentView = parentView;
 
-        let isAttachedToRoot = this.isDescendantOf(WebInspector.View._rootView);
+        let isAttachedToRoot = this.isDescendantOf(WI.View._rootView);
         this.didMoveToWindow(isAttachedToRoot);
 
         if (!this._parentView)
@@ -245,7 +245,7 @@
             this._didInitialLayout = true;
         }
 
-        if (this._layoutReason === WebInspector.View.LayoutReason.Resize)
+        if (this._layoutReason === WI.View.LayoutReason.Resize)
             this.sizeDidChange();
 
         this.layout();
@@ -260,10 +260,10 @@
 
     _setLayoutReason(layoutReason)
     {
-        if (this._layoutReason === WebInspector.View.LayoutReason.Resize)
+        if (this._layoutReason === WI.View.LayoutReason.Resize)
             return;
 
-        this._layoutReason = layoutReason || WebInspector.View.LayoutReason.Dirty;
+        this._layoutReason = layoutReason || WI.View.LayoutReason.Dirty;
     }
 
     // Layout controller logic
@@ -285,10 +285,10 @@
             return;
         }
 
-        if (WebInspector.View._scheduledLayoutUpdateIdentifier)
+        if (WI.View._scheduledLayoutUpdateIdentifier)
             return;
 
-        WebInspector.View._scheduledLayoutUpdateIdentifier = requestAnimationFrame(WebInspector.View._visitViewTreeForLayout);
+        WI.View._scheduledLayoutUpdateIdentifier = requestAnimationFrame(WI.View._visitViewTreeForLayout);
     }
 
     static _cancelScheduledLayoutForView(view)
@@ -303,25 +303,25 @@
             parentView = parentView.parentView;
         }
 
-        if (!WebInspector.View._scheduledLayoutUpdateIdentifier)
+        if (!WI.View._scheduledLayoutUpdateIdentifier)
             return;
 
-        let rootView = WebInspector.View._rootView;
+        let rootView = WI.View._rootView;
         if (!rootView || rootView._dirtyDescendantsCount)
             return;
 
         // No views need layout, so cancel the pending requestAnimationFrame.
-        cancelAnimationFrame(WebInspector.View._scheduledLayoutUpdateIdentifier);
-        WebInspector.View._scheduledLayoutUpdateIdentifier = undefined;
+        cancelAnimationFrame(WI.View._scheduledLayoutUpdateIdentifier);
+        WI.View._scheduledLayoutUpdateIdentifier = undefined;
     }
 
     static _visitViewTreeForLayout()
     {
-        console.assert(WebInspector.View._rootView, "Cannot layout view tree without a root.");
+        console.assert(WI.View._rootView, "Cannot layout view tree without a root.");
 
-        WebInspector.View._scheduledLayoutUpdateIdentifier = undefined;
+        WI.View._scheduledLayoutUpdateIdentifier = undefined;
 
-        let views = [WebInspector.View._rootView];
+        let views = [WI.View._rootView];
         while (views.length) {
             let view = views.shift();
             if (view.layoutPending)
@@ -334,10 +334,10 @@
     }
 };
 
-WebInspector.View.LayoutReason = {
+WI.View.LayoutReason = {
     Dirty: Symbol("layout-reason-dirty"),
     Resize: Symbol("layout-reason-resize")
 };
 
-WebInspector.View._rootView = null;
-WebInspector.View._scheduledLayoutUpdateIdentifier = undefined;
+WI.View._rootView = null;
+WI.View._scheduledLayoutUpdateIdentifier = undefined;
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleBackgroundPicker.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleBackgroundPicker.js
index 1ea0725..a8659bc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleBackgroundPicker.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleBackgroundPicker.js
@@ -23,51 +23,51 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleBackgroundPicker = class VisualStyleBackgroundPicker extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleBackgroundPicker = class VisualStyleBackgroundPicker extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, possibleValues, layoutReversed)
     {
         super(propertyNames, text, possibleValues, null, "background-picker", layoutReversed);
 
-        this._gradientSwatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Gradient);
-        this._gradientSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._gradientSwatchColorChanged, this);
+        this._gradientSwatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Gradient);
+        this._gradientSwatch.addEventListener(WI.InlineSwatch.Event.ValueChanged, this._gradientSwatchColorChanged, this);
         this.contentElement.appendChild(this._gradientSwatch.element);
 
         this._valueInputElement = document.createElement("input");
         this._valueInputElement.classList.add("value-input");
         this._valueInputElement.type = "url";
-        this._valueInputElement.placeholder = WebInspector.UIString("Enter a URL");
+        this._valueInputElement.placeholder = WI.UIString("Enter a URL");
         this._valueInputElement.addEventListener("input", this.debounce(250)._valueInputValueChanged);
         this.contentElement.appendChild(this._valueInputElement);
 
         this._valueTypePickerElement = document.createElement("select");
         this._valueTypePickerElement.classList.add("value-type-picker-select");
         if (this._possibleValues.advanced)
-            this._valueTypePickerElement.title = WebInspector.UIString("Option-click to show all values");
+            this._valueTypePickerElement.title = WI.UIString("Option-click to show all values");
 
         let imageOption = document.createElement("option");
         imageOption.value = "url";
-        imageOption.text = WebInspector.UIString("Image");
+        imageOption.text = WI.UIString("Image");
         this._valueTypePickerElement.appendChild(imageOption);
 
         let linearGradientOption = document.createElement("option");
         linearGradientOption.value = "linear-gradient";
-        linearGradientOption.text = WebInspector.UIString("Linear Gradient");
+        linearGradientOption.text = WI.UIString("Linear Gradient");
         this._valueTypePickerElement.appendChild(linearGradientOption);
 
         let radialGradientOption = document.createElement("option");
         radialGradientOption.value = "radial-gradient";
-        radialGradientOption.text = WebInspector.UIString("Radial Gradient");
+        radialGradientOption.text = WI.UIString("Radial Gradient");
         this._valueTypePickerElement.appendChild(radialGradientOption);
 
         let repeatingLinearGradientOption = document.createElement("option");
         repeatingLinearGradientOption.value = "repeating-linear-gradient";
-        repeatingLinearGradientOption.text = WebInspector.UIString("Repeating Linear Gradient");
+        repeatingLinearGradientOption.text = WI.UIString("Repeating Linear Gradient");
         this._valueTypePickerElement.appendChild(repeatingLinearGradientOption);
 
         let repeatingRadialGradientOption = document.createElement("option");
         repeatingRadialGradientOption.value = "repeating-radial-gradient";
-        repeatingRadialGradientOption.text = WebInspector.UIString("Repeating Radial Gradient");
+        repeatingRadialGradientOption.text = WI.UIString("Repeating Radial Gradient");
         this._valueTypePickerElement.appendChild(repeatingRadialGradientOption);
 
         this._valueTypePickerElement.appendChild(document.createElement("hr"));
@@ -134,14 +134,14 @@
         this._valueInputElement.disabled = supportedKeyword;
         if (supportedKeyword) {
             this._valueInputElement.value = "";
-            this._valueInputElement.placeholder = WebInspector.UIString("Using Keyword Value");
+            this._valueInputElement.placeholder = WI.UIString("Using Keyword Value");
         } else {
             if (this._currentType === "image") {
                 this._valueInputElement.type = "url";
-                this._valueInputElement.placeholder = WebInspector.UIString("Enter a URL");
+                this._valueInputElement.placeholder = WI.UIString("Enter a URL");
             } else if (gradientValue) {
                 this._valueInputElement.type = "text";
-                this._valueInputElement.placeholder = WebInspector.UIString("Enter a Gradient");
+                this._valueInputElement.placeholder = WI.UIString("Enter a Gradient");
             }
         }
     }
@@ -152,7 +152,7 @@
         if (!value || value === this._currentType)
             return;
 
-        this._gradientSwatch.value = WebInspector.Gradient.fromString(value);
+        this._gradientSwatch.value = WI.Gradient.fromString(value);
     }
 
     _gradientSwatchColorChanged(event)
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js
index ee385be..18ba338 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleBasicInput = class VisualStyleBasicInput extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleBasicInput = class VisualStyleBasicInput extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, placeholder, layoutReversed)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js
index 40bbcc3..8100e11 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleColorPicker = class VisualStyleColorPicker extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleColorPicker = class VisualStyleColorPicker extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, layoutReversed)
     {
         super(propertyNames, text, null, null, "input-color-picker", layoutReversed);
 
-        this._colorSwatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Color);
-        this._colorSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._colorSwatchColorChanged, this);
+        this._colorSwatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Color);
+        this._colorSwatch.addEventListener(WI.InlineSwatch.Event.ValueChanged, this._colorSwatchColorChanged, this);
         this.contentElement.appendChild(this._colorSwatch.element);
 
         this._textInputElement = document.createElement("input");
@@ -40,8 +40,8 @@
         this._textInputElement.addEventListener("blur", this._hideCompletions.bind(this));
         this.contentElement.appendChild(this._textInputElement);
 
-        this._completionController = new WebInspector.VisualStyleCompletionsController(this);
-        this._completionController.addEventListener(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected, this._completionClicked, this);
+        this._completionController = new WI.VisualStyleCompletionsController(this);
+        this._completionController.addEventListener(WI.VisualStyleCompletionsController.Event.CompletionSelected, this._completionClicked, this);
 
         this._formatChanged = false;
         this._updateColorSwatch();
@@ -110,7 +110,7 @@
     _updateColorSwatch()
     {
         let value = this._textInputElement.value;
-        this._colorSwatch.value = WebInspector.Color.fromString(value);
+        this._colorSwatch.value = WI.Color.fromString(value);
     }
 
     _completionClicked(event)
@@ -125,8 +125,8 @@
             return;
 
         let keyCode = event.keyCode;
-        let enterKeyCode = WebInspector.KeyboardShortcut.Key.Enter.keyCode;
-        let tabKeyCode = WebInspector.KeyboardShortcut.Key.Tab.keyCode;
+        let enterKeyCode = WI.KeyboardShortcut.Key.Enter.keyCode;
+        let tabKeyCode = WI.KeyboardShortcut.Key.Tab.keyCode;
         if (keyCode === enterKeyCode || keyCode === tabKeyCode) {
             this.value = this._completionController.currentCompletion;
             this._hideCompletions();
@@ -134,7 +134,7 @@
             return;
         }
 
-        let escapeKeyCode = WebInspector.KeyboardShortcut.Key.Escape.keyCode;
+        let escapeKeyCode = WI.KeyboardShortcut.Key.Escape.keyCode;
         if (keyCode === escapeKeyCode) {
             this._hideCompletions();
             return;
@@ -169,7 +169,7 @@
             return;
 
         if (this._completionController.update(this.value)) {
-            let bounds = WebInspector.Rect.rectFromClientRect(this._textInputElement.getBoundingClientRect());
+            let bounds = WI.Rect.rectFromClientRect(this._textInputElement.getBoundingClientRect());
             if (!bounds)
                 return;
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js
index 02a0334..22b8f1a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleCommaSeparatedKeywordEditor = class VisualStyleCommaSeparatedKeywordEditor extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleCommaSeparatedKeywordEditor = class VisualStyleCommaSeparatedKeywordEditor extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, longhandProperties, insertNewItemsBeforeSelected, layoutReversed)
     {
@@ -37,8 +37,8 @@
         listElement.addEventListener("keydown", this._listElementKeyDown.bind(this));
         this.contentElement.appendChild(listElement);
 
-        this._commaSeparatedKeywords = new WebInspector.TreeOutline(listElement);
-        this._commaSeparatedKeywords.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._commaSeparatedKeywords = new WI.TreeOutline(listElement);
+        this._commaSeparatedKeywords.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
 
         let controlContainer = document.createElement("div");
         controlContainer.classList.add("visual-style-comma-separated-keyword-controls");
@@ -48,7 +48,7 @@
         addGlyphElement.addEventListener("click", this._addEmptyCommaSeparatedKeyword.bind(this));
         controlContainer.appendChild(addGlyphElement);
 
-        let removeGlyphElement = useSVGSymbol("Images/Minus.svg", "visual-style-remove-comma-separated-keyword", WebInspector.UIString("Remove selected item"));
+        let removeGlyphElement = useSVGSymbol("Images/Minus.svg", "visual-style-remove-comma-separated-keyword", WI.UIString("Remove selected item"));
         removeGlyphElement.addEventListener("click", this._removeSelectedCommaSeparatedKeyword.bind(this));
         controlContainer.appendChild(removeGlyphElement);
     }
@@ -96,7 +96,7 @@
 
         this._commaSeparatedKeywords.removeChildren();
         if (!commaSeparatedValue || !commaSeparatedValue.length) {
-            this.dispatchEventToListeners(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems);
+            this.dispatchEventToListeners(WI.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems);
             return;
         }
 
@@ -207,8 +207,8 @@
             return;
 
         let keyCode = event.keyCode;
-        let backspaceKeyCode = WebInspector.KeyboardShortcut.Key.Backspace.keyCode;
-        let deleteKeyCode = WebInspector.KeyboardShortcut.Key.Delete.keyCode;
+        let backspaceKeyCode = WI.KeyboardShortcut.Key.Backspace.keyCode;
+        let deleteKeyCode = WI.KeyboardShortcut.Key.Delete.keyCode;
         if (keyCode === backspaceKeyCode || keyCode === deleteKeyCode)
             this._removeSelectedCommaSeparatedKeyword();
     }
@@ -220,7 +220,7 @@
             return;
 
         this._removeEmptyCommaSeparatedKeywords();
-        this.dispatchEventToListeners(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, {text: treeElement.mainTitle});
+        this.dispatchEventToListeners(WI.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, {text: treeElement.mainTitle});
     }
 
     _treeElementIsEmpty(item)
@@ -231,7 +231,7 @@
     _addEmptyCommaSeparatedKeyword()
     {
         let newTreeElement = this._addCommaSeparatedKeyword(null, this._commaSeparatedKeywords.selectedTreeElementIndex);
-        newTreeElement.subtitle = WebInspector.UIString("(modify the boxes below to add a value)");
+        newTreeElement.subtitle = WI.UIString("(modify the boxes below to add a value)");
         newTreeElement.element.classList.add("no-value");
         newTreeElement.select(true, true);
         return newTreeElement;
@@ -272,20 +272,20 @@
 
         this._commaSeparatedKeywords.removeChild(treeElement);
         if (!this._commaSeparatedKeywords.children.length)
-            this.dispatchEventToListeners(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems);
+            this.dispatchEventToListeners(WI.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems);
 
         this._valueDidChange();
     }
 
     _createNewTreeElement(value)
     {
-        return new WebInspector.GeneralTreeElement(WebInspector.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName, value);
+        return new WI.GeneralTreeElement(WI.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName, value);
     }
 };
 
-WebInspector.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName = "visual-style-comma-separated-keyword-item";
+WI.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName = "visual-style-comma-separated-keyword-item";
 
-WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event = {
+WI.VisualStyleCommaSeparatedKeywordEditor.Event = {
     TreeItemSelected: "visual-style-comma-separated-keyword-editor-tree-item-selected",
     NoRemainingTreeItems: "visual-style-comma-separated-keyword-editor-no-remaining-tree-items"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js
index 09209ba..a40f2c0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleDetailsPanel = class VisualStyleDetailsPanel extends WebInspector.StyleDetailsPanel
+WI.VisualStyleDetailsPanel = class VisualStyleDetailsPanel extends WI.StyleDetailsPanel
 {
     constructor(delegate)
     {
-        super(delegate, "visual", "visual", WebInspector.UIString("Styles \u2014 Visual"));
+        super(delegate, "visual", "visual", WI.UIString("Styles \u2014 Visual"));
 
         this._currentStyle = null;
 
@@ -73,51 +73,51 @@
     initialLayout()
     {
         // Selector Section
-        this._selectorSection = new WebInspector.VisualStyleSelectorSection;
-        this._selectorSection.addEventListener(WebInspector.VisualStyleSelectorSection.Event.SelectorChanged, this._updateSections, this);
+        this._selectorSection = new WI.VisualStyleSelectorSection;
+        this._selectorSection.addEventListener(WI.VisualStyleSelectorSection.Event.SelectorChanged, this._updateSections, this);
         this.element.appendChild(this._selectorSection.element);
 
         // Layout Section
-        this._generateSection("display", WebInspector.UIString("Display"));
-        this._generateSection("position", WebInspector.UIString("Position"));
-        this._generateSection("float", WebInspector.UIString("Float and Clear"));
-        this._generateSection("dimensions", WebInspector.UIString("Dimensions"));
-        this._generateSection("margin", WebInspector.UIString("Margin"));
-        this._generateSection("padding", WebInspector.UIString("Padding"));
-        this._generateSection("flexbox", WebInspector.UIString("Flexbox"));
-        this._generateSection("alignment", WebInspector.UIString("Alignment"));
+        this._generateSection("display", WI.UIString("Display"));
+        this._generateSection("position", WI.UIString("Position"));
+        this._generateSection("float", WI.UIString("Float and Clear"));
+        this._generateSection("dimensions", WI.UIString("Dimensions"));
+        this._generateSection("margin", WI.UIString("Margin"));
+        this._generateSection("padding", WI.UIString("Padding"));
+        this._generateSection("flexbox", WI.UIString("Flexbox"));
+        this._generateSection("alignment", WI.UIString("Alignment"));
 
-        this._sections.layout = new WebInspector.DetailsSection("layout", WebInspector.UIString("Layout"), [this._groups.display.section, this._groups.position.section, this._groups.float.section, this._groups.dimensions.section, this._groups.margin.section, this._groups.padding.section, this._groups.flexbox.section, this._groups.alignment.section]);
+        this._sections.layout = new WI.DetailsSection("layout", WI.UIString("Layout"), [this._groups.display.section, this._groups.position.section, this._groups.float.section, this._groups.dimensions.section, this._groups.margin.section, this._groups.padding.section, this._groups.flexbox.section, this._groups.alignment.section]);
         this.element.appendChild(this._sections.layout.element);
 
         // Text Section
-        this._generateSection("content", WebInspector.UIString("Content"));
-        this._generateSection("text-style", WebInspector.UIString("Style"));
-        this._generateSection("font", WebInspector.UIString("Font"));
-        this._generateSection("font-variants", WebInspector.UIString("Variants"));
-        this._generateSection("text-spacing", WebInspector.UIString("Spacing"));
-        this._generateSection("text-shadow", WebInspector.UIString("Shadow"));
+        this._generateSection("content", WI.UIString("Content"));
+        this._generateSection("text-style", WI.UIString("Style"));
+        this._generateSection("font", WI.UIString("Font"));
+        this._generateSection("font-variants", WI.UIString("Variants"));
+        this._generateSection("text-spacing", WI.UIString("Spacing"));
+        this._generateSection("text-shadow", WI.UIString("Shadow"));
 
-        this._sections.text = new WebInspector.DetailsSection("text", WebInspector.UIString("Text"), [this._groups.content.section, this._groups.textStyle.section, this._groups.font.section, this._groups.fontVariants.section, this._groups.textSpacing.section, this._groups.textShadow.section]);
+        this._sections.text = new WI.DetailsSection("text", WI.UIString("Text"), [this._groups.content.section, this._groups.textStyle.section, this._groups.font.section, this._groups.fontVariants.section, this._groups.textSpacing.section, this._groups.textShadow.section]);
         this.element.appendChild(this._sections.text.element);
 
         // Background Section
-        this._generateSection("fill", WebInspector.UIString("Fill"));
-        this._generateSection("stroke", WebInspector.UIString("Stroke"));
-        this._generateSection("background-style", WebInspector.UIString("Style"));
-        this._generateSection("border", WebInspector.UIString("Border"));
-        this._generateSection("outline", WebInspector.UIString("Outline"));
-        this._generateSection("box-shadow", WebInspector.UIString("Box Shadow"));
-        this._generateSection("list-style", WebInspector.UIString("List Styles"));
+        this._generateSection("fill", WI.UIString("Fill"));
+        this._generateSection("stroke", WI.UIString("Stroke"));
+        this._generateSection("background-style", WI.UIString("Style"));
+        this._generateSection("border", WI.UIString("Border"));
+        this._generateSection("outline", WI.UIString("Outline"));
+        this._generateSection("box-shadow", WI.UIString("Box Shadow"));
+        this._generateSection("list-style", WI.UIString("List Styles"));
 
-        this._sections.background = new WebInspector.DetailsSection("background", WebInspector.UIString("Background"), [this._groups.fill.section, this._groups.stroke.section, this._groups.backgroundStyle.section, this._groups.border.section, this._groups.outline.section, this._groups.boxShadow.section, this._groups.listStyle.section]);
+        this._sections.background = new WI.DetailsSection("background", WI.UIString("Background"), [this._groups.fill.section, this._groups.stroke.section, this._groups.backgroundStyle.section, this._groups.border.section, this._groups.outline.section, this._groups.boxShadow.section, this._groups.listStyle.section]);
         this.element.appendChild(this._sections.background.element);
 
         // Effects Section
-        this._generateSection("transition", WebInspector.UIString("Transition"));
-        this._generateSection("animation", WebInspector.UIString("Animation"));
+        this._generateSection("transition", WI.UIString("Transition"));
+        this._generateSection("animation", WI.UIString("Animation"));
 
-        this._sections.effects = new WebInspector.DetailsSection("effects", WebInspector.UIString("Effects"), [this._groups.transition.section, this._groups.animation.section]);
+        this._sections.effects = new WI.DetailsSection("effects", WI.UIString("Effects"), [this._groups.transition.section, this._groups.animation.section]);
         this.element.appendChild(this._sections.effects.element);
     }
 
@@ -147,13 +147,13 @@
 
         function createOptionsElement() {
             let container = document.createElement("div");
-            container.title = WebInspector.UIString("Clear modified properties");
+            container.title = WI.UIString("Clear modified properties");
             container.addEventListener("click", this._clearModifiedSection.bind(this, camelCaseId));
             return container;
         }
 
         this._groups[camelCaseId] = {
-            section: new WebInspector.DetailsSection(id, displayName, [], createOptionsElement.call(this)),
+            section: new WI.DetailsSection(id, displayName, [], createOptionsElement.call(this)),
             properties: {}
         };
 
@@ -167,7 +167,7 @@
         if (!this._currentStyle)
             return;
 
-        let disabled = this._currentStyle[WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol];
+        let disabled = this._currentStyle[WI.VisualStyleDetailsPanel.StyleDisabledSymbol];
         this.element.classList.toggle("disabled", !!disabled);
         if (disabled)
             return;
@@ -258,7 +258,7 @@
 
         let initialTextList = this._initialTextList;
         if (!initialTextList)
-            this._currentStyle[WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol] = initialTextList = new WeakMap;
+            this._currentStyle[WI.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol] = initialTextList = new WeakMap;
 
         let initialPropertyText = {};
         let initialPropertyTextMissing = !initialTextList.has(group);
@@ -293,7 +293,7 @@
         if (!editor || (editor.hasCompletions && !force))
             return;
 
-        editor.completions = WebInspector.CSSKeywordCompletions.forProperty(editor.propertyReferenceName);
+        editor.completions = WI.CSSKeywordCompletions.forProperty(editor.propertyReferenceName);
     }
 
     _sectionModified(group)
@@ -306,7 +306,7 @@
     {
         let group = this._groups[groupId];
         group.section.element.classList.remove("modified");
-        let initialPropertyTextList = this._currentStyle[WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol].get(group);
+        let initialPropertyTextList = this._currentStyle[WI.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol].get(group);
         if (!initialPropertyTextList)
             return;
 
@@ -324,7 +324,7 @@
 
     get _initialTextList()
     {
-        return this._currentStyle[WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol];
+        return this._currentStyle[WI.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol];
     }
 
     _initialPropertyTextModified(group)
@@ -367,7 +367,7 @@
 
         group.section.groups = groups;
         for (let key in group.properties)
-            group.properties[key].addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, this._sectionModified.bind(this, group));
+            group.properties[key].addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, this._sectionModified.bind(this, group));
     }
 
     _populateDisplaySection()
@@ -375,13 +375,13 @@
         let group = this._groups.display;
         let properties = group.properties;
 
-        let displayRow = new WebInspector.DetailsSectionRow;
+        let displayRow = new WI.DetailsSectionRow;
 
-        properties.display = new WebInspector.VisualStyleKeywordPicker("display", WebInspector.UIString("Type"), {
+        properties.display = new WI.VisualStyleKeywordPicker("display", WI.UIString("Type"), {
             basic: ["None", "Block", "Flex", "Inline", "Inline Block"],
             advanced: ["Compact", "Inline Flex", "Inline Table", "List Item", "Table", "Table Caption", "Table Cell", "Table Column", "Table Column Group", "Table Footer Group", "Table Header Group", "Table Row", "Table Row Group", " WAP Marquee", " WebKit Box", " WebKit Grid", " WebKit Inline Box", " WebKit Inline Grid"]
         });
-        properties.visibility = new WebInspector.VisualStyleKeywordPicker("visibility", WebInspector.UIString("Visibility"), {
+        properties.visibility = new WI.VisualStyleKeywordPicker("visibility", WI.UIString("Visibility"), {
             basic: ["Hidden", "Visible"],
             advanced: ["Collapse"]
         });
@@ -389,10 +389,10 @@
         displayRow.element.appendChild(properties.display.element);
         displayRow.element.appendChild(properties.visibility.element);
 
-        let sizingRow = new WebInspector.DetailsSectionRow;
+        let sizingRow = new WI.DetailsSectionRow;
 
-        properties.boxSizing = new WebInspector.VisualStyleKeywordPicker("box-sizing", WebInspector.UIString("Sizing"), this._keywords.defaults.concat(["Border Box", "Content Box"]));
-        properties.cursor = new WebInspector.VisualStyleKeywordPicker("cursor", WebInspector.UIString("Cursor"), {
+        properties.boxSizing = new WI.VisualStyleKeywordPicker("box-sizing", WI.UIString("Sizing"), this._keywords.defaults.concat(["Border Box", "Content Box"]));
+        properties.cursor = new WI.VisualStyleKeywordPicker("cursor", WI.UIString("Cursor"), {
             basic: ["Auto", "Default", "None", "Pointer", "Crosshair", "Text"],
             advanced: ["Context Menu", "Help", "Progress", "Wait", "Cell", "Vertical Text", "Alias", "Copy", "Move", "No Drop", "Not Allowed", "All Scroll", "Col Resize", "Row Resize", "N Resize", "E Resize", "S Resize", "W Resize", "NS Resize", "EW Resize", "NE Resize", "NW Resize", "SE Resize", "sW Resize", "NESW Resize", "NWSE Resize"]
         });
@@ -400,10 +400,10 @@
         sizingRow.element.appendChild(properties.boxSizing.element);
         sizingRow.element.appendChild(properties.cursor.element);
 
-        let overflowRow = new WebInspector.DetailsSectionRow;
+        let overflowRow = new WI.DetailsSectionRow;
 
-        properties.opacity = new WebInspector.VisualStyleUnitSlider("opacity", WebInspector.UIString("Opacity"));
-        properties.overflow = new WebInspector.VisualStyleKeywordPicker(["overflow-x", "overflow-y"], WebInspector.UIString("Overflow"), {
+        properties.opacity = new WI.VisualStyleUnitSlider("opacity", WI.UIString("Opacity"));
+        properties.overflow = new WI.VisualStyleKeywordPicker(["overflow-x", "overflow-y"], WI.UIString("Overflow"), {
             basic: ["Initial", "Unset", "Revert", "Auto", "Hidden", "Scroll", "Visible"],
             advanced: ["Marquee", "Overlay", " WebKit Paged X", " WebKit Paged Y"]
         });
@@ -413,7 +413,7 @@
 
         group.specifiedWidthProperties = [properties.opacity];
 
-        let displayGroup = new WebInspector.DetailsSectionGroup([displayRow, sizingRow, overflowRow]);
+        let displayGroup = new WI.DetailsSectionGroup([displayRow, sizingRow, overflowRow]);
         this._populateSection(group, [displayGroup]);
     }
 
@@ -424,15 +424,15 @@
                 return;
 
             if (!this._currentStyle.ownerRule) {
-                WebInspector.domTreeManager.highlightDOMNode(this._currentStyle.node.id, mode);
+                WI.domTreeManager.highlightDOMNode(this._currentStyle.node.id, mode);
                 return;
             }
 
-            WebInspector.domTreeManager.highlightSelector(this._currentStyle.ownerRule.selectorText, this._currentStyle.node.ownerDocument.frameIdentifier, mode);
+            WI.domTreeManager.highlightSelector(this._currentStyle.ownerRule.selectorText, this._currentStyle.node.ownerDocument.frameIdentifier, mode);
         }
 
         function editorMouseout() {
-            WebInspector.domTreeManager.hideDOMNodeHighlight();
+            WI.domTreeManager.hideDOMNodeHighlight();
         }
 
         editor.element.addEventListener("mouseover", editorMouseover.bind(this));
@@ -452,28 +452,28 @@
         let left = hasPrefix ? prefix + "Left" : "left";
         let right = hasPrefix ? prefix + "Right" : "right";
 
-        let vertical = new WebInspector.DetailsSectionRow;
+        let vertical = new WI.DetailsSectionRow;
 
-        properties[top] = new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix + "top", WebInspector.UIString("Top"), this._keywords.boxModel, this._units.defaults, allowNegatives);
-        properties[bottom] = new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix + "bottom", WebInspector.UIString("Bottom"), this._keywords.boxModel, this._units.defaults, allowNegatives, true);
-        links["vertical"] = new WebInspector.VisualStylePropertyEditorLink([properties[top], properties[bottom]], "link-vertical");
+        properties[top] = new WI.VisualStyleNumberInputBox(propertyNamePrefix + "top", WI.UIString("Top"), this._keywords.boxModel, this._units.defaults, allowNegatives);
+        properties[bottom] = new WI.VisualStyleNumberInputBox(propertyNamePrefix + "bottom", WI.UIString("Bottom"), this._keywords.boxModel, this._units.defaults, allowNegatives, true);
+        links["vertical"] = new WI.VisualStylePropertyEditorLink([properties[top], properties[bottom]], "link-vertical");
 
         vertical.element.appendChild(properties[top].element);
         vertical.element.appendChild(links["vertical"].element);
         vertical.element.appendChild(properties[bottom].element);
 
-        let horizontal = new WebInspector.DetailsSectionRow;
+        let horizontal = new WI.DetailsSectionRow;
 
-        properties[left] = new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix + "left", WebInspector.UIString("Left"), this._keywords.boxModel, this._units.defaults, allowNegatives);
-        properties[right] = new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix + "right", WebInspector.UIString("Right"), this._keywords.boxModel, this._units.defaults, allowNegatives, true);
-        links["horizontal"] = new WebInspector.VisualStylePropertyEditorLink([properties[left], properties[right]], "link-horizontal");
+        properties[left] = new WI.VisualStyleNumberInputBox(propertyNamePrefix + "left", WI.UIString("Left"), this._keywords.boxModel, this._units.defaults, allowNegatives);
+        properties[right] = new WI.VisualStyleNumberInputBox(propertyNamePrefix + "right", WI.UIString("Right"), this._keywords.boxModel, this._units.defaults, allowNegatives, true);
+        links["horizontal"] = new WI.VisualStylePropertyEditorLink([properties[left], properties[right]], "link-horizontal");
 
         horizontal.element.appendChild(properties[left].element);
         horizontal.element.appendChild(links["horizontal"].element);
         horizontal.element.appendChild(properties[right].element);
 
-        let allLinkRow = new WebInspector.DetailsSectionRow;
-        links["all"] = new WebInspector.VisualStylePropertyEditorLink([properties[top], properties[bottom], properties[left], properties[right]], "link-all", [links["vertical"], links["horizontal"]]);
+        let allLinkRow = new WI.DetailsSectionRow;
+        links["all"] = new WI.VisualStylePropertyEditorLink([properties[top], properties[bottom], properties[left], properties[right]], "link-all", [links["vertical"], links["horizontal"]]);
         allLinkRow.element.appendChild(links["all"].element);
 
         if (highlightOnHover) {
@@ -499,13 +499,13 @@
         let rows = this._generateMetricSectionRows(group, null, true);
         let properties = group.properties;
 
-        let positionType = new WebInspector.DetailsSectionRow;
+        let positionType = new WI.DetailsSectionRow;
 
-        properties.position = new WebInspector.VisualStyleKeywordPicker("position", WebInspector.UIString("Type"), {
+        properties.position = new WI.VisualStyleKeywordPicker("position", WI.UIString("Type"), {
             basic: ["Static", "Relative", "Absolute", "Fixed"],
             advanced: [" WebKit Sticky"]
         });
-        properties.zIndex = new WebInspector.VisualStyleNumberInputBox("z-index", WebInspector.UIString("Z-Index"), this._keywords.boxModel, null, true);
+        properties.zIndex = new WI.VisualStyleNumberInputBox("z-index", WI.UIString("Z-Index"), this._keywords.boxModel, null, true);
 
         positionType.element.appendChild(properties.position.element);
         positionType.element.appendChild(properties.zIndex.element);
@@ -513,41 +513,41 @@
 
         rows.unshift(positionType);
 
-        group.defaultGroup = new WebInspector.DetailsSectionGroup(rows);
+        group.defaultGroup = new WI.DetailsSectionGroup(rows);
 
-        let xyRow = new WebInspector.DetailsSectionRow;
+        let xyRow = new WI.DetailsSectionRow;
 
-        properties.x = new WebInspector.VisualStyleNumberInputBox("x", WebInspector.UIString("X"), this._keywords.boxModel, this._units.defaults, true);
-        properties.y = new WebInspector.VisualStyleNumberInputBox("y", WebInspector.UIString("Y"), this._keywords.boxModel, this._units.defaults, true);
+        properties.x = new WI.VisualStyleNumberInputBox("x", WI.UIString("X"), this._keywords.boxModel, this._units.defaults, true);
+        properties.y = new WI.VisualStyleNumberInputBox("y", WI.UIString("Y"), this._keywords.boxModel, this._units.defaults, true);
 
         xyRow.element.appendChild(properties.x.element);
         xyRow.element.appendChild(properties.y.element);
 
-        let x1y1Row = new WebInspector.DetailsSectionRow;
+        let x1y1Row = new WI.DetailsSectionRow;
 
-        properties.x1 = new WebInspector.VisualStyleNumberInputBox("x1", WebInspector.UIString("X1"), this._keywords.boxModel, this._units.defaults, true);
-        properties.y1 = new WebInspector.VisualStyleNumberInputBox("y1", WebInspector.UIString("Y1"), this._keywords.boxModel, this._units.defaults, true);
+        properties.x1 = new WI.VisualStyleNumberInputBox("x1", WI.UIString("X1"), this._keywords.boxModel, this._units.defaults, true);
+        properties.y1 = new WI.VisualStyleNumberInputBox("y1", WI.UIString("Y1"), this._keywords.boxModel, this._units.defaults, true);
 
         x1y1Row.element.appendChild(properties.x1.element);
         x1y1Row.element.appendChild(properties.y1.element);
 
-        let x2y2Row = new WebInspector.DetailsSectionRow;
+        let x2y2Row = new WI.DetailsSectionRow;
 
-        properties.x2 = new WebInspector.VisualStyleNumberInputBox("x2", WebInspector.UIString("X2"), this._keywords.boxModel, this._units.defaults, true);
-        properties.y2 = new WebInspector.VisualStyleNumberInputBox("y2", WebInspector.UIString("Y2"), this._keywords.boxModel, this._units.defaults, true);
+        properties.x2 = new WI.VisualStyleNumberInputBox("x2", WI.UIString("X2"), this._keywords.boxModel, this._units.defaults, true);
+        properties.y2 = new WI.VisualStyleNumberInputBox("y2", WI.UIString("Y2"), this._keywords.boxModel, this._units.defaults, true);
 
         x2y2Row.element.appendChild(properties.x2.element);
         x2y2Row.element.appendChild(properties.y2.element);
 
-        let cxcyRow = new WebInspector.DetailsSectionRow;
+        let cxcyRow = new WI.DetailsSectionRow;
 
-        properties.cx = new WebInspector.VisualStyleNumberInputBox("cx", WebInspector.UIString("Center X"), this._keywords.boxModel, this._units.defaults, true);
-        properties.cy = new WebInspector.VisualStyleNumberInputBox("cy", WebInspector.UIString("Center Y"), this._keywords.boxModel, this._units.defaults, true);
+        properties.cx = new WI.VisualStyleNumberInputBox("cx", WI.UIString("Center X"), this._keywords.boxModel, this._units.defaults, true);
+        properties.cy = new WI.VisualStyleNumberInputBox("cy", WI.UIString("Center Y"), this._keywords.boxModel, this._units.defaults, true);
 
         cxcyRow.element.appendChild(properties.cx.element);
         cxcyRow.element.appendChild(properties.cy.element);
 
-        group.svgGroup = new WebInspector.DetailsSectionGroup([xyRow, x1y1Row, x2y2Row, cxcyRow]);
+        group.svgGroup = new WI.DetailsSectionGroup([xyRow, x1y1Row, x2y2Row, cxcyRow]);
 
         this._populateSection(group, [group.defaultGroup, group.svgGroup]);
 
@@ -564,17 +564,17 @@
         let group = this._groups.float;
         let properties = group.properties;
 
-        let floatRow = new WebInspector.DetailsSectionRow;
+        let floatRow = new WI.DetailsSectionRow;
 
-        properties.float = new WebInspector.VisualStyleKeywordIconList("float", WebInspector.UIString("Float"), ["Left", "Right", "None"]);
+        properties.float = new WI.VisualStyleKeywordIconList("float", WI.UIString("Float"), ["Left", "Right", "None"]);
         floatRow.element.appendChild(properties.float.element);
 
-        let clearRow = new WebInspector.DetailsSectionRow;
+        let clearRow = new WI.DetailsSectionRow;
 
-        properties.clear = new WebInspector.VisualStyleKeywordIconList("clear", WebInspector.UIString("Clear"), ["Left", "Right", "Both", "None"]);
+        properties.clear = new WI.VisualStyleKeywordIconList("clear", WI.UIString("Clear"), ["Left", "Right", "Both", "None"]);
         clearRow.element.appendChild(properties.clear.element);
 
-        let floatGroup = new WebInspector.DetailsSectionGroup([floatRow, clearRow]);
+        let floatGroup = new WI.DetailsSectionGroup([floatRow, clearRow]);
         this._populateSection(group, [floatGroup]);
     }
 
@@ -583,56 +583,56 @@
         let group = this._groups.dimensions;
         let properties = group.properties;
 
-        let dimensionsWidth = new WebInspector.DetailsSectionRow;
+        let dimensionsWidth = new WI.DetailsSectionRow;
 
-        properties.width = new WebInspector.VisualStyleRelativeNumberSlider("width", WebInspector.UIString("Width"), this._keywords.boxModel, this._units.defaults);
+        properties.width = new WI.VisualStyleRelativeNumberSlider("width", WI.UIString("Width"), this._keywords.boxModel, this._units.defaults);
 
         dimensionsWidth.element.appendChild(properties.width.element);
 
-        let dimensionsHeight = new WebInspector.DetailsSectionRow;
+        let dimensionsHeight = new WI.DetailsSectionRow;
 
-        properties.height = new WebInspector.VisualStyleRelativeNumberSlider("height", WebInspector.UIString("Height"), this._keywords.boxModel, this._units.defaults, true);
+        properties.height = new WI.VisualStyleRelativeNumberSlider("height", WI.UIString("Height"), this._keywords.boxModel, this._units.defaults, true);
 
         dimensionsHeight.element.appendChild(properties.height.element);
 
         let dimensionsProperties = [properties.width, properties.height];
-        let dimensionsRegularGroup = new WebInspector.DetailsSectionGroup([dimensionsWidth, dimensionsHeight]);
+        let dimensionsRegularGroup = new WI.DetailsSectionGroup([dimensionsWidth, dimensionsHeight]);
 
-        let dimensionsMinWidth = new WebInspector.DetailsSectionRow;
+        let dimensionsMinWidth = new WI.DetailsSectionRow;
 
-        properties.minWidth = new WebInspector.VisualStyleRelativeNumberSlider("min-width", WebInspector.UIString("Width"), this._keywords.boxModel, this._units.defaults);
+        properties.minWidth = new WI.VisualStyleRelativeNumberSlider("min-width", WI.UIString("Width"), this._keywords.boxModel, this._units.defaults);
 
         dimensionsMinWidth.element.appendChild(properties.minWidth.element);
 
-        let dimensionsMinHeight = new WebInspector.DetailsSectionRow;
+        let dimensionsMinHeight = new WI.DetailsSectionRow;
 
-        properties.minHeight = new WebInspector.VisualStyleRelativeNumberSlider("min-height", WebInspector.UIString("Height"), this._keywords.boxModel, this._units.defaults);
+        properties.minHeight = new WI.VisualStyleRelativeNumberSlider("min-height", WI.UIString("Height"), this._keywords.boxModel, this._units.defaults);
 
         dimensionsMinHeight.element.appendChild(properties.minHeight.element);
 
         let dimensionsMinProperties = [properties.minWidth, properties.minHeight];
-        let dimensionsMinGroup = new WebInspector.DetailsSectionGroup([dimensionsMinWidth, dimensionsMinHeight]);
+        let dimensionsMinGroup = new WI.DetailsSectionGroup([dimensionsMinWidth, dimensionsMinHeight]);
 
         let dimensionsMaxKeywords = this._keywords.defaults.concat("None");
-        let dimensionsMaxWidth = new WebInspector.DetailsSectionRow;
+        let dimensionsMaxWidth = new WI.DetailsSectionRow;
 
-        properties.maxWidth = new WebInspector.VisualStyleRelativeNumberSlider("max-width", WebInspector.UIString("Width"), dimensionsMaxKeywords, this._units.defaults);
+        properties.maxWidth = new WI.VisualStyleRelativeNumberSlider("max-width", WI.UIString("Width"), dimensionsMaxKeywords, this._units.defaults);
 
         dimensionsMaxWidth.element.appendChild(properties.maxWidth.element);
 
-        let dimensionsMaxHeight = new WebInspector.DetailsSectionRow;
+        let dimensionsMaxHeight = new WI.DetailsSectionRow;
 
-        properties.maxHeight = new WebInspector.VisualStyleRelativeNumberSlider("max-height", WebInspector.UIString("Height"), dimensionsMaxKeywords, this._units.defaults);
+        properties.maxHeight = new WI.VisualStyleRelativeNumberSlider("max-height", WI.UIString("Height"), dimensionsMaxKeywords, this._units.defaults);
 
         dimensionsMaxHeight.element.appendChild(properties.maxHeight.element);
 
         let dimensionsMaxProperties = [properties.maxWidth, properties.maxHeight];
-        let dimensionsMaxGroup = new WebInspector.DetailsSectionGroup([dimensionsMaxWidth, dimensionsMaxHeight]);
+        let dimensionsMaxGroup = new WI.DetailsSectionGroup([dimensionsMaxWidth, dimensionsMaxHeight]);
 
-        let dimensionsTabController = new WebInspector.VisualStyleTabbedPropertiesRow({
-            "default": {title: WebInspector.UIString("Default"), element: dimensionsRegularGroup.element, properties: dimensionsProperties},
-            "min": {title: WebInspector.UIString("Min"), element: dimensionsMinGroup.element, properties: dimensionsMinProperties},
-            "max": {title: WebInspector.UIString("Max"), element: dimensionsMaxGroup.element, properties: dimensionsMaxProperties}
+        let dimensionsTabController = new WI.VisualStyleTabbedPropertiesRow({
+            "default": {title: WI.UIString("Default"), element: dimensionsRegularGroup.element, properties: dimensionsProperties},
+            "min": {title: WI.UIString("Min"), element: dimensionsMinGroup.element, properties: dimensionsMinProperties},
+            "max": {title: WI.UIString("Max"), element: dimensionsMaxGroup.element, properties: dimensionsMaxProperties}
         });
 
         let highlightMode = "content";
@@ -643,27 +643,27 @@
         this._addMetricsMouseListeners(group.properties.maxWidth, highlightMode);
         this._addMetricsMouseListeners(group.properties.maxHeight, highlightMode);
 
-        group.defaultGroup = new WebInspector.DetailsSectionGroup([dimensionsTabController, dimensionsRegularGroup, dimensionsMinGroup, dimensionsMaxGroup]);
+        group.defaultGroup = new WI.DetailsSectionGroup([dimensionsTabController, dimensionsRegularGroup, dimensionsMinGroup, dimensionsMaxGroup]);
 
-        let rRow = new WebInspector.DetailsSectionRow;
+        let rRow = new WI.DetailsSectionRow;
 
-        properties.r = new WebInspector.VisualStyleRelativeNumberSlider("r", WebInspector.UIString("Radius"), this._keywords.boxModel, this._units.defaults);
+        properties.r = new WI.VisualStyleRelativeNumberSlider("r", WI.UIString("Radius"), this._keywords.boxModel, this._units.defaults);
 
         rRow.element.appendChild(properties.r.element);
 
-        let rxRow = new WebInspector.DetailsSectionRow;
+        let rxRow = new WI.DetailsSectionRow;
 
-        properties.rx = new WebInspector.VisualStyleRelativeNumberSlider("rx", WebInspector.UIString("Radius X"), this._keywords.boxModel, this._units.defaults);
+        properties.rx = new WI.VisualStyleRelativeNumberSlider("rx", WI.UIString("Radius X"), this._keywords.boxModel, this._units.defaults);
 
         rxRow.element.appendChild(properties.rx.element);
 
-        let ryRow = new WebInspector.DetailsSectionRow;
+        let ryRow = new WI.DetailsSectionRow;
 
-        properties.ry = new WebInspector.VisualStyleRelativeNumberSlider("ry", WebInspector.UIString("Radius Y"), this._keywords.boxModel, this._units.defaults);
+        properties.ry = new WI.VisualStyleRelativeNumberSlider("ry", WI.UIString("Radius Y"), this._keywords.boxModel, this._units.defaults);
 
         ryRow.element.appendChild(properties.ry.element);
 
-        group.svgGroup = new WebInspector.DetailsSectionGroup([rRow, rxRow, ryRow]);
+        group.svgGroup = new WI.DetailsSectionGroup([rRow, rxRow, ryRow]);
 
         this._populateSection(group, [group.defaultGroup, group.svgGroup]);
     }
@@ -672,7 +672,7 @@
     {
         let group = this._groups.margin;
         let rows = this._generateMetricSectionRows(group, "margin", true, true);
-        let marginGroup = new WebInspector.DetailsSectionGroup(rows);
+        let marginGroup = new WI.DetailsSectionGroup(rows);
         this._populateSection(group, [marginGroup]);
     }
 
@@ -680,7 +680,7 @@
     {
         let group = this._groups.padding;
         let rows = this._generateMetricSectionRows(group, "padding", false, true);
-        let paddingGroup = new WebInspector.DetailsSectionGroup(rows);
+        let paddingGroup = new WI.DetailsSectionGroup(rows);
         this._populateSection(group, [paddingGroup]);
     }
 
@@ -689,31 +689,31 @@
         let group = this._groups.flexbox;
         let properties = group.properties;
 
-        let flexOrderRow = new WebInspector.DetailsSectionRow;
+        let flexOrderRow = new WI.DetailsSectionRow;
 
-        properties.order = new WebInspector.VisualStyleNumberInputBox("order", WebInspector.UIString("Order"), this._keywords.defaults);
-        properties.flexBasis = new WebInspector.VisualStyleNumberInputBox("flex-basis", WebInspector.UIString("Basis"), this._keywords.boxModel, this._units.defaults, true);
+        properties.order = new WI.VisualStyleNumberInputBox("order", WI.UIString("Order"), this._keywords.defaults);
+        properties.flexBasis = new WI.VisualStyleNumberInputBox("flex-basis", WI.UIString("Basis"), this._keywords.boxModel, this._units.defaults, true);
 
         flexOrderRow.element.appendChild(properties.order.element);
         flexOrderRow.element.appendChild(properties.flexBasis.element);
 
-        let flexSizeRow = new WebInspector.DetailsSectionRow;
+        let flexSizeRow = new WI.DetailsSectionRow;
 
-        properties.flexGrow = new WebInspector.VisualStyleNumberInputBox("flex-grow", WebInspector.UIString("Grow"), this._keywords.defaults);
-        properties.flexShrink = new WebInspector.VisualStyleNumberInputBox("flex-shrink", WebInspector.UIString("Shrink"), this._keywords.defaults);
+        properties.flexGrow = new WI.VisualStyleNumberInputBox("flex-grow", WI.UIString("Grow"), this._keywords.defaults);
+        properties.flexShrink = new WI.VisualStyleNumberInputBox("flex-shrink", WI.UIString("Shrink"), this._keywords.defaults);
 
         flexSizeRow.element.appendChild(properties.flexGrow.element);
         flexSizeRow.element.appendChild(properties.flexShrink.element);
 
-        let flexFlowRow = new WebInspector.DetailsSectionRow;
+        let flexFlowRow = new WI.DetailsSectionRow;
 
-        properties.flexDirection = new WebInspector.VisualStyleKeywordPicker("flex-direction", WebInspector.UIString("Direction"), this._keywords.defaults.concat(["Row", "Row Reverse", "Column", "Column Reverse"]));
-        properties.flexWrap = new WebInspector.VisualStyleKeywordPicker("flex-wrap", WebInspector.UIString("Wrap"), this._keywords.defaults.concat(["Wrap", "Wrap Reverse", "Nowrap"]));
+        properties.flexDirection = new WI.VisualStyleKeywordPicker("flex-direction", WI.UIString("Direction"), this._keywords.defaults.concat(["Row", "Row Reverse", "Column", "Column Reverse"]));
+        properties.flexWrap = new WI.VisualStyleKeywordPicker("flex-wrap", WI.UIString("Wrap"), this._keywords.defaults.concat(["Wrap", "Wrap Reverse", "Nowrap"]));
 
         flexFlowRow.element.appendChild(properties.flexDirection.element);
         flexFlowRow.element.appendChild(properties.flexWrap.element);
 
-        let flexboxGroup = new WebInspector.DetailsSectionGroup([flexOrderRow, flexSizeRow, flexFlowRow]);
+        let flexboxGroup = new WI.DetailsSectionGroup([flexOrderRow, flexSizeRow, flexFlowRow]);
         this._populateSection(group, [flexboxGroup]);
 
         let allowedDisplayValues = ["flex", "inline-flex", "-webkit-box", "-webkit-inline-box"];
@@ -732,31 +732,31 @@
         let alignmentKeywords = ["Initial", "Unset", "Revert", "Auto", "Flex Start", "Flex End", "Center", "Stretch"];
         let advancedAlignmentKeywords = ["Start", "End", "Left", "Right", "Baseline", "Last Baseline"];
 
-        let contentRow = new WebInspector.DetailsSectionRow;
+        let contentRow = new WI.DetailsSectionRow;
         let contentKeywords = {
             basic: alignmentKeywords.concat(["Space Between", "Space Around"]),
             advanced: advancedAlignmentKeywords.concat(["Space Evenly"])
         };
 
-        properties.justifyContent = new WebInspector.VisualStyleKeywordPicker("justify-content", WebInspector.UIString("Horizontal"), contentKeywords);
-        properties.alignContent = new WebInspector.VisualStyleKeywordPicker("align-content", WebInspector.UIString("Vertical"), contentKeywords);
+        properties.justifyContent = new WI.VisualStyleKeywordPicker("justify-content", WI.UIString("Horizontal"), contentKeywords);
+        properties.alignContent = new WI.VisualStyleKeywordPicker("align-content", WI.UIString("Vertical"), contentKeywords);
 
         contentRow.element.appendChild(properties.justifyContent.element);
         contentRow.element.appendChild(properties.alignContent.element);
 
-        let itemsRow = new WebInspector.DetailsSectionRow;
+        let itemsRow = new WI.DetailsSectionRow;
         let itemKeywords = {
             basic: alignmentKeywords,
             advanced: ["Self Start", "Self End"].concat(advancedAlignmentKeywords)
         };
 
-        properties.alignItems = new WebInspector.VisualStyleKeywordPicker("align-items", WebInspector.UIString("Children"), itemKeywords);
-        properties.alignSelf = new WebInspector.VisualStyleKeywordPicker("align-self", WebInspector.UIString("Self"), itemKeywords);
+        properties.alignItems = new WI.VisualStyleKeywordPicker("align-items", WI.UIString("Children"), itemKeywords);
+        properties.alignSelf = new WI.VisualStyleKeywordPicker("align-self", WI.UIString("Self"), itemKeywords);
 
         itemsRow.element.appendChild(properties.alignItems.element);
         itemsRow.element.appendChild(properties.alignSelf.element);
 
-        let alignmentGroup = new WebInspector.DetailsSectionGroup([contentRow, itemsRow]);
+        let alignmentGroup = new WI.DetailsSectionGroup([contentRow, itemsRow]);
         this._populateSection(group, [alignmentGroup]);
 
         let allowedDisplayValues = ["flex", "inline-flex", "-webkit-box", "-webkit-inline-box"];
@@ -771,13 +771,13 @@
         let group = this._groups.content;
         let properties = group.properties;
 
-        let contentRow = new WebInspector.DetailsSectionRow;
+        let contentRow = new WI.DetailsSectionRow;
 
-        properties.content = new WebInspector.VisualStyleBasicInput("content", null, WebInspector.UIString("Enter value"));
+        properties.content = new WI.VisualStyleBasicInput("content", null, WI.UIString("Enter value"));
 
         contentRow.element.appendChild(properties.content.element);
 
-        let contentGroup = new WebInspector.DetailsSectionGroup([contentRow]);
+        let contentGroup = new WI.DetailsSectionGroup([contentRow]);
         this._populateSection(group, [contentGroup]);
     }
 
@@ -786,35 +786,35 @@
         let group = this._groups.textStyle;
         let properties = group.properties;
 
-        let textAppearanceRow = new WebInspector.DetailsSectionRow;
+        let textAppearanceRow = new WI.DetailsSectionRow;
 
-        properties.color = new WebInspector.VisualStyleColorPicker("color", WebInspector.UIString("Color"));
-        properties.textDirection = new WebInspector.VisualStyleKeywordPicker("direction", WebInspector.UIString("Direction"), this._keywords.defaults.concat(["LTR", "RTL"]));
+        properties.color = new WI.VisualStyleColorPicker("color", WI.UIString("Color"));
+        properties.textDirection = new WI.VisualStyleKeywordPicker("direction", WI.UIString("Direction"), this._keywords.defaults.concat(["LTR", "RTL"]));
 
         textAppearanceRow.element.appendChild(properties.color.element);
         textAppearanceRow.element.appendChild(properties.textDirection.element);
 
-        let textAlignRow = new WebInspector.DetailsSectionRow;
+        let textAlignRow = new WI.DetailsSectionRow;
 
-        properties.textAlign = new WebInspector.VisualStyleKeywordIconList("text-align", WebInspector.UIString("Align"), ["Left", "Center", "Right", "Justify"]);
+        properties.textAlign = new WI.VisualStyleKeywordIconList("text-align", WI.UIString("Align"), ["Left", "Center", "Right", "Justify"]);
 
         textAlignRow.element.appendChild(properties.textAlign.element);
 
-        let textTransformRow = new WebInspector.DetailsSectionRow;
+        let textTransformRow = new WI.DetailsSectionRow;
 
-        properties.textTransform = new WebInspector.VisualStyleKeywordIconList("text-transform", WebInspector.UIString("Transform"), ["Capitalize", "Uppercase", "Lowercase", "None"]);
+        properties.textTransform = new WI.VisualStyleKeywordIconList("text-transform", WI.UIString("Transform"), ["Capitalize", "Uppercase", "Lowercase", "None"]);
 
         textTransformRow.element.appendChild(properties.textTransform.element);
 
-        let textDecorationRow = new WebInspector.DetailsSectionRow;
+        let textDecorationRow = new WI.DetailsSectionRow;
 
-        properties.textDecoration = new WebInspector.VisualStyleKeywordIconList("text-decoration", WebInspector.UIString("Decoration"), ["Underline", "Line Through", "Overline", "None"]);
+        properties.textDecoration = new WI.VisualStyleKeywordIconList("text-decoration", WI.UIString("Decoration"), ["Underline", "Line Through", "Overline", "None"]);
 
         textDecorationRow.element.appendChild(properties.textDecoration.element);
 
         group.autocompleteCompatibleProperties = [properties.color];
 
-        let textStyleGroup = new WebInspector.DetailsSectionGroup([textAppearanceRow, textAlignRow, textTransformRow, textDecorationRow]);
+        let textStyleGroup = new WI.DetailsSectionGroup([textAppearanceRow, textAlignRow, textTransformRow, textDecorationRow]);
         this._populateSection(group, [textStyleGroup]);
     }
 
@@ -823,17 +823,17 @@
         let group = this._groups.font;
         let properties = group.properties;
 
-        let fontFamilyRow = new WebInspector.DetailsSectionRow;
+        let fontFamilyRow = new WI.DetailsSectionRow;
 
-        properties.fontFamily = new WebInspector.VisualStyleFontFamilyListEditor("font-family", WebInspector.UIString("Family"));
+        properties.fontFamily = new WI.VisualStyleFontFamilyListEditor("font-family", WI.UIString("Family"));
 
         fontFamilyRow.element.appendChild(properties.fontFamily.element);
 
-        let fontSizeRow = new WebInspector.DetailsSectionRow;
+        let fontSizeRow = new WI.DetailsSectionRow;
 
-        properties.fontSize = new WebInspector.VisualStyleNumberInputBox("font-size", WebInspector.UIString("Size"), this._keywords.defaults.concat(["Larger", "XX Large", "X Large", "Large", "Medium", "Small", "X Small", "XX Small", "Smaller"]), this._units.defaults);
+        properties.fontSize = new WI.VisualStyleNumberInputBox("font-size", WI.UIString("Size"), this._keywords.defaults.concat(["Larger", "XX Large", "X Large", "Large", "Medium", "Small", "X Small", "XX Small", "Smaller"]), this._units.defaults);
 
-        properties.fontWeight = new WebInspector.VisualStyleKeywordPicker("font-weight", WebInspector.UIString("Weight"), {
+        properties.fontWeight = new WI.VisualStyleKeywordPicker("font-weight", WI.UIString("Weight"), {
             basic: this._keywords.defaults.concat(["Bolder", "Bold", "Normal", "Lighter"]),
             advanced: ["100", "200", "300", "400", "500", "600", "700", "800", "900"]
         });
@@ -841,10 +841,10 @@
         fontSizeRow.element.appendChild(properties.fontSize.element);
         fontSizeRow.element.appendChild(properties.fontWeight.element);
 
-        let fontStyleRow = new WebInspector.DetailsSectionRow;
+        let fontStyleRow = new WI.DetailsSectionRow;
 
-        properties.fontStyle = new WebInspector.VisualStyleKeywordIconList("font-style", WebInspector.UIString("Style"), ["Italic", "Normal"]);
-        properties.fontFeatureSettings = new WebInspector.VisualStyleBasicInput("font-feature-settings", WebInspector.UIString("Features"), WebInspector.UIString("Enter Tag"));
+        properties.fontStyle = new WI.VisualStyleKeywordIconList("font-style", WI.UIString("Style"), ["Italic", "Normal"]);
+        properties.fontFeatureSettings = new WI.VisualStyleBasicInput("font-feature-settings", WI.UIString("Features"), WI.UIString("Enter Tag"));
 
         fontStyleRow.element.appendChild(properties.fontStyle.element);
         fontStyleRow.element.appendChild(properties.fontFeatureSettings.element);
@@ -852,7 +852,7 @@
         group.autocompleteCompatibleProperties = [properties.fontFamily];
         group.specifiedWidthProperties = [properties.fontFamily];
 
-        let fontGroup = new WebInspector.DetailsSectionGroup([fontFamilyRow, fontSizeRow, fontStyleRow]);
+        let fontGroup = new WI.DetailsSectionGroup([fontFamilyRow, fontSizeRow, fontStyleRow]);
         this._populateSection(group, [fontGroup]);
     }
 
@@ -861,34 +861,34 @@
         let group = this._groups.fontVariants;
         let properties = group.properties;
 
-        let alternatesRow = new WebInspector.DetailsSectionRow;
+        let alternatesRow = new WI.DetailsSectionRow;
 
-        properties.fontVariantAlternates = new WebInspector.VisualStyleBasicInput("font-variant-alternates", WebInspector.UIString("Alternates"), WebInspector.UIString("Enter Value"));
+        properties.fontVariantAlternates = new WI.VisualStyleBasicInput("font-variant-alternates", WI.UIString("Alternates"), WI.UIString("Enter Value"));
 
         alternatesRow.element.appendChild(properties.fontVariantAlternates.element);
 
-        let positionRow = new WebInspector.DetailsSectionRow;
+        let positionRow = new WI.DetailsSectionRow;
 
-        properties.fontVariantPosition = new WebInspector.VisualStyleKeywordPicker("font-variant-position", WebInspector.UIString("Position"), this._keywords.normal.concat(["Sub", "Super"]));
+        properties.fontVariantPosition = new WI.VisualStyleKeywordPicker("font-variant-position", WI.UIString("Position"), this._keywords.normal.concat(["Sub", "Super"]));
 
         positionRow.element.appendChild(properties.fontVariantPosition.element);
 
-        properties.fontVariantCaps = new WebInspector.VisualStyleKeywordPicker("font-variant-caps", WebInspector.UIString("Caps"), this._keywords.normal.concat(["None", "Small Caps", "All Small Caps", "Petite Caps", "All Petite Caps", "Unicase", "Titling Caps"]));
+        properties.fontVariantCaps = new WI.VisualStyleKeywordPicker("font-variant-caps", WI.UIString("Caps"), this._keywords.normal.concat(["None", "Small Caps", "All Small Caps", "Petite Caps", "All Petite Caps", "Unicase", "Titling Caps"]));
 
         positionRow.element.appendChild(properties.fontVariantCaps.element);
 
-        let ligaturesRow = new WebInspector.DetailsSectionRow;
+        let ligaturesRow = new WI.DetailsSectionRow;
 
         // FIXME <http://webkit.org/b/153645> Add token based editor for Visual Sidebar
-        properties.fontVariantLigatures = new WebInspector.VisualStyleKeywordPicker("font-variant-ligatures", WebInspector.UIString("Ligatures"), this._keywords.normal.concat(["None", "Common Ligatures", "No Common Ligatures", "Discretionary Ligatures", "No Discretionary Ligatures", "Historical Ligatures", "No Historical Ligatures", "Contextual", "No Contextual"]));
+        properties.fontVariantLigatures = new WI.VisualStyleKeywordPicker("font-variant-ligatures", WI.UIString("Ligatures"), this._keywords.normal.concat(["None", "Common Ligatures", "No Common Ligatures", "Discretionary Ligatures", "No Discretionary Ligatures", "Historical Ligatures", "No Historical Ligatures", "Contextual", "No Contextual"]));
 
         ligaturesRow.element.appendChild(properties.fontVariantLigatures.element);
 
-        properties.fontVariantNumeric = new WebInspector.VisualStyleKeywordPicker("font-variant-numeric", WebInspector.UIString("Numeric"), this._keywords.normal.concat(["None", "Ordinal", "Slashed Zero", "Lining Nums", "Oldstyle Nums", "Proportional Nums", "Tabular Nums", "Diagonal Fractions", "Stacked Fractions"]));
+        properties.fontVariantNumeric = new WI.VisualStyleKeywordPicker("font-variant-numeric", WI.UIString("Numeric"), this._keywords.normal.concat(["None", "Ordinal", "Slashed Zero", "Lining Nums", "Oldstyle Nums", "Proportional Nums", "Tabular Nums", "Diagonal Fractions", "Stacked Fractions"]));
 
         ligaturesRow.element.appendChild(properties.fontVariantNumeric.element);
 
-        let variantsGroup = new WebInspector.DetailsSectionGroup([alternatesRow, positionRow, ligaturesRow]);
+        let variantsGroup = new WI.DetailsSectionGroup([alternatesRow, positionRow, ligaturesRow]);
         this._populateSection(group, [variantsGroup]);
     }
 
@@ -897,31 +897,31 @@
         let group = this._groups.textSpacing;
         let properties = group.properties;
 
-        let textLayoutRow = new WebInspector.DetailsSectionRow;
+        let textLayoutRow = new WI.DetailsSectionRow;
 
-        properties.lineHeight = new WebInspector.VisualStyleNumberInputBox("line-height", WebInspector.UIString("Height"), this._keywords.normal, this._units.defaults);
-        properties.verticalAlign = new WebInspector.VisualStyleNumberInputBox("vertical-align", WebInspector.UIString("Align"), ["Baseline", "Bottom"].concat(this._keywords.defaults, ["Middle", "Sub", "Super", "Text Bottom", "Text Top", "Top"]), this._units.defaults);
+        properties.lineHeight = new WI.VisualStyleNumberInputBox("line-height", WI.UIString("Height"), this._keywords.normal, this._units.defaults);
+        properties.verticalAlign = new WI.VisualStyleNumberInputBox("vertical-align", WI.UIString("Align"), ["Baseline", "Bottom"].concat(this._keywords.defaults, ["Middle", "Sub", "Super", "Text Bottom", "Text Top", "Top"]), this._units.defaults);
 
         textLayoutRow.element.appendChild(properties.lineHeight.element);
         textLayoutRow.element.appendChild(properties.verticalAlign.element);
 
-        let textSpacingRow = new WebInspector.DetailsSectionRow;
+        let textSpacingRow = new WI.DetailsSectionRow;
 
-        properties.letterSpacing = new WebInspector.VisualStyleNumberInputBox("letter-spacing", WebInspector.UIString("Letter"), this._keywords.normal, this._units.defaults);
-        properties.wordSpacing = new WebInspector.VisualStyleNumberInputBox("word-spacing", WebInspector.UIString("Word"), this._keywords.normal, this._units.defaults);
+        properties.letterSpacing = new WI.VisualStyleNumberInputBox("letter-spacing", WI.UIString("Letter"), this._keywords.normal, this._units.defaults);
+        properties.wordSpacing = new WI.VisualStyleNumberInputBox("word-spacing", WI.UIString("Word"), this._keywords.normal, this._units.defaults);
 
         textSpacingRow.element.appendChild(properties.letterSpacing.element);
         textSpacingRow.element.appendChild(properties.wordSpacing.element);
 
-        let textWhitespaceRow = new WebInspector.DetailsSectionRow;
+        let textWhitespaceRow = new WI.DetailsSectionRow;
 
-        properties.textIndent = new WebInspector.VisualStyleNumberInputBox("text-indent", WebInspector.UIString("Indent"), this._keywords.defaults, this._units.defaults);
-        properties.whiteSpace = new WebInspector.VisualStyleKeywordPicker("white-space", WebInspector.UIString("Whitespace"), this._keywords.defaults.concat(["Normal", "Nowrap", "Pre", "Pre Line", "Pre Wrap"]));
+        properties.textIndent = new WI.VisualStyleNumberInputBox("text-indent", WI.UIString("Indent"), this._keywords.defaults, this._units.defaults);
+        properties.whiteSpace = new WI.VisualStyleKeywordPicker("white-space", WI.UIString("Whitespace"), this._keywords.defaults.concat(["Normal", "Nowrap", "Pre", "Pre Line", "Pre Wrap"]));
 
         textWhitespaceRow.element.appendChild(properties.textIndent.element);
         textWhitespaceRow.element.appendChild(properties.whiteSpace.element);
 
-        let textSpacingGroup = new WebInspector.DetailsSectionGroup([textLayoutRow, textSpacingRow, textWhitespaceRow]);
+        let textSpacingGroup = new WI.DetailsSectionGroup([textLayoutRow, textSpacingRow, textWhitespaceRow]);
         this._populateSection(group, [textSpacingGroup]);
     }
 
@@ -930,28 +930,28 @@
         let group = this._groups.textShadow;
         let properties = group.properties;
 
-        let textShadowSizing = new WebInspector.DetailsSectionRow;
+        let textShadowSizing = new WI.DetailsSectionRow;
 
-        let textShadowH = new WebInspector.VisualStyleNumberInputBox("text-shadow", WebInspector.UIString("Horizontal"), null, this._units.defaultsSansPercent);
-        let textShadowV = new WebInspector.VisualStyleNumberInputBox("text-shadow", WebInspector.UIString("Vertical"), null, this._units.defaultsSansPercent);
+        let textShadowH = new WI.VisualStyleNumberInputBox("text-shadow", WI.UIString("Horizontal"), null, this._units.defaultsSansPercent);
+        let textShadowV = new WI.VisualStyleNumberInputBox("text-shadow", WI.UIString("Vertical"), null, this._units.defaultsSansPercent);
 
         textShadowSizing.element.appendChild(textShadowH.element);
         textShadowSizing.element.appendChild(textShadowV.element);
 
-        let textShadowStyle = new WebInspector.DetailsSectionRow;
+        let textShadowStyle = new WI.DetailsSectionRow;
 
-        let textShadowColor = new WebInspector.VisualStyleColorPicker("text-shadow", WebInspector.UIString("Color"));
-        let textShadowBlur = new WebInspector.VisualStyleNumberInputBox("text-shadow", WebInspector.UIString("Blur"), null, this._units.defaultsSansPercent);
+        let textShadowColor = new WI.VisualStyleColorPicker("text-shadow", WI.UIString("Color"));
+        let textShadowBlur = new WI.VisualStyleNumberInputBox("text-shadow", WI.UIString("Blur"), null, this._units.defaultsSansPercent);
         textShadowBlur.optionalProperty = true;
 
         textShadowStyle.element.appendChild(textShadowColor.element);
         textShadowStyle.element.appendChild(textShadowBlur.element);
 
-        properties.textShadow = new WebInspector.VisualStylePropertyCombiner("text-shadow", [textShadowH, textShadowV, textShadowBlur, textShadowColor]);
+        properties.textShadow = new WI.VisualStylePropertyCombiner("text-shadow", [textShadowH, textShadowV, textShadowBlur, textShadowColor]);
 
         group.autocompleteCompatibleProperties = [textShadowColor];
 
-        let textShadowGroup = new WebInspector.DetailsSectionGroup([textShadowSizing, textShadowStyle]);
+        let textShadowGroup = new WI.DetailsSectionGroup([textShadowSizing, textShadowStyle]);
         this._populateSection(group, [textShadowGroup]);
     }
 
@@ -960,23 +960,23 @@
         let group = this._groups.fill;
         let properties = group.properties;
 
-        let fillRow = new WebInspector.DetailsSectionRow;
+        let fillRow = new WI.DetailsSectionRow;
 
-        properties.fill = new WebInspector.VisualStyleColorPicker("fill", WebInspector.UIString("Color"));
-        properties.fillRule = new WebInspector.VisualStyleKeywordPicker("fill-rule", WebInspector.UIString("Rule"), this._keywords.defaults.concat(["Nonzero", "Evenodd"]));
+        properties.fill = new WI.VisualStyleColorPicker("fill", WI.UIString("Color"));
+        properties.fillRule = new WI.VisualStyleKeywordPicker("fill-rule", WI.UIString("Rule"), this._keywords.defaults.concat(["Nonzero", "Evenodd"]));
 
         fillRow.element.appendChild(properties.fill.element);
         fillRow.element.appendChild(properties.fillRule.element);
 
-        let fillOpacityRow = new WebInspector.DetailsSectionRow;
+        let fillOpacityRow = new WI.DetailsSectionRow;
 
-        properties.fillOpacity = new WebInspector.VisualStyleUnitSlider("fill-opacity", WebInspector.UIString("Opacity"));
+        properties.fillOpacity = new WI.VisualStyleUnitSlider("fill-opacity", WI.UIString("Opacity"));
 
         fillOpacityRow.element.appendChild(properties.fillOpacity.element);
 
         group.specifiedWidthProperties = [properties.fillOpacity];
 
-        let fillGroup = new WebInspector.DetailsSectionGroup([fillRow, fillOpacityRow]);
+        let fillGroup = new WI.DetailsSectionGroup([fillRow, fillOpacityRow]);
         this._populateSection(group, [fillGroup]);
     }
 
@@ -985,45 +985,45 @@
         let group = this._groups.stroke;
         let properties = group.properties;
 
-        let strokeRow = new WebInspector.DetailsSectionRow;
+        let strokeRow = new WI.DetailsSectionRow;
 
-        properties.stroke = new WebInspector.VisualStyleColorPicker("stroke", WebInspector.UIString("Color"));
-        properties.strokeWidth = new WebInspector.VisualStyleNumberInputBox("stroke-width", WebInspector.UIString("Width"), this._keywords.defaults, this._units.defaults);
+        properties.stroke = new WI.VisualStyleColorPicker("stroke", WI.UIString("Color"));
+        properties.strokeWidth = new WI.VisualStyleNumberInputBox("stroke-width", WI.UIString("Width"), this._keywords.defaults, this._units.defaults);
 
         strokeRow.element.appendChild(properties.stroke.element);
         strokeRow.element.appendChild(properties.strokeWidth.element);
 
-        let strokeOpacity = new WebInspector.DetailsSectionRow;
+        let strokeOpacity = new WI.DetailsSectionRow;
 
-        properties.strokeOpacity = new WebInspector.VisualStyleUnitSlider("stroke-opacity", WebInspector.UIString("Opacity"));
+        properties.strokeOpacity = new WI.VisualStyleUnitSlider("stroke-opacity", WI.UIString("Opacity"));
 
         strokeOpacity.element.appendChild(properties.strokeOpacity.element);
 
-        let strokeDasharrayRow = new WebInspector.DetailsSectionRow;
+        let strokeDasharrayRow = new WI.DetailsSectionRow;
 
-        properties.strokeDasharray = new WebInspector.VisualStyleBasicInput("stroke-dasharray", WebInspector.UIString("Dash Array"), WebInspector.UIString("Enter an array value"));
+        properties.strokeDasharray = new WI.VisualStyleBasicInput("stroke-dasharray", WI.UIString("Dash Array"), WI.UIString("Enter an array value"));
 
         strokeDasharrayRow.element.appendChild(properties.strokeDasharray.element);
 
-        let strokeDasharrayOptionsRow = new WebInspector.DetailsSectionRow;
+        let strokeDasharrayOptionsRow = new WI.DetailsSectionRow;
 
-        properties.strokeDashoffset = new WebInspector.VisualStyleNumberInputBox("stroke-dashoffset", WebInspector.UIString("Offset"), this._keywords.defaults, this._units.defaults);
-        properties.strokeMiterlimit = new WebInspector.VisualStyleNumberInputBox("stroke-miterlimit", WebInspector.UIString("Miter"), this._keywords.defaults);
+        properties.strokeDashoffset = new WI.VisualStyleNumberInputBox("stroke-dashoffset", WI.UIString("Offset"), this._keywords.defaults, this._units.defaults);
+        properties.strokeMiterlimit = new WI.VisualStyleNumberInputBox("stroke-miterlimit", WI.UIString("Miter"), this._keywords.defaults);
 
         strokeDasharrayOptionsRow.element.appendChild(properties.strokeDashoffset.element);
         strokeDasharrayOptionsRow.element.appendChild(properties.strokeMiterlimit.element);
 
-        let strokeLineOptionsRow = new WebInspector.DetailsSectionRow;
+        let strokeLineOptionsRow = new WI.DetailsSectionRow;
 
-        properties.strokeLinecap = new WebInspector.VisualStyleKeywordPicker("stroke-linecap", WebInspector.UIString("Cap"), this._keywords.defaults.concat(["Butt", "Round", "Square"]));
-        properties.strokeLinejoin = new WebInspector.VisualStyleKeywordPicker("stroke-linejoin", WebInspector.UIString("Join"), this._keywords.defaults.concat(["Miter", "Round", "Bevel"]));
+        properties.strokeLinecap = new WI.VisualStyleKeywordPicker("stroke-linecap", WI.UIString("Cap"), this._keywords.defaults.concat(["Butt", "Round", "Square"]));
+        properties.strokeLinejoin = new WI.VisualStyleKeywordPicker("stroke-linejoin", WI.UIString("Join"), this._keywords.defaults.concat(["Miter", "Round", "Bevel"]));
 
         strokeLineOptionsRow.element.appendChild(properties.strokeLinecap.element);
         strokeLineOptionsRow.element.appendChild(properties.strokeLinejoin.element);
 
         group.specifiedWidthProperties = [properties.strokeOpacity];
 
-        let strokeGroup = new WebInspector.DetailsSectionGroup([strokeRow, strokeOpacity, strokeDasharrayRow, strokeDasharrayOptionsRow, strokeLineOptionsRow]);
+        let strokeGroup = new WI.DetailsSectionGroup([strokeRow, strokeOpacity, strokeDasharrayRow, strokeDasharrayOptionsRow, strokeLineOptionsRow]);
         this._populateSection(group, [strokeGroup]);
     }
 
@@ -1032,39 +1032,39 @@
         let group = this._groups.backgroundStyle;
         let properties = group.properties;
 
-        let backgroundStyleRow = new WebInspector.DetailsSectionRow;
+        let backgroundStyleRow = new WI.DetailsSectionRow;
 
-        properties.backgroundColor = new WebInspector.VisualStyleColorPicker("background-color", WebInspector.UIString("Color"));
-        properties.backgroundBlendMode = new WebInspector.VisualStyleKeywordPicker("background-blend-mode", WebInspector.UIString("Blend"), ["Normal", "Multiply", "Screen", "Overlay", "Darken", "Lighten", "Color", "Color Dodge", "Saturation", "Luminosity"]);
+        properties.backgroundColor = new WI.VisualStyleColorPicker("background-color", WI.UIString("Color"));
+        properties.backgroundBlendMode = new WI.VisualStyleKeywordPicker("background-blend-mode", WI.UIString("Blend"), ["Normal", "Multiply", "Screen", "Overlay", "Darken", "Lighten", "Color", "Color Dodge", "Saturation", "Luminosity"]);
 
         backgroundStyleRow.element.appendChild(properties.backgroundColor.element);
         backgroundStyleRow.element.appendChild(properties.backgroundBlendMode.element);
 
-        let backgroundClipRow = new WebInspector.DetailsSectionRow;
+        let backgroundClipRow = new WI.DetailsSectionRow;
 
         let backgroundClipKeywords = ["Initial", "Border Box", "Padding Box", "Content Box"];
-        properties.backgroundClip = new WebInspector.VisualStyleKeywordPicker("background-clip", WebInspector.UIString("Clip"), backgroundClipKeywords);
-        properties.backgroundOrigin = new WebInspector.VisualStyleKeywordPicker("background-origin", WebInspector.UIString("Origin"), backgroundClipKeywords);
+        properties.backgroundClip = new WI.VisualStyleKeywordPicker("background-clip", WI.UIString("Clip"), backgroundClipKeywords);
+        properties.backgroundOrigin = new WI.VisualStyleKeywordPicker("background-origin", WI.UIString("Origin"), backgroundClipKeywords);
 
         backgroundClipRow.element.appendChild(properties.backgroundClip.element);
         backgroundClipRow.element.appendChild(properties.backgroundOrigin.element);
 
-        let backgroundSizeRow = new WebInspector.DetailsSectionRow;
+        let backgroundSizeRow = new WI.DetailsSectionRow;
 
         let backgroundSizeKeywords = this._keywords.boxModel.concat(["Contain", "Cover"]);
-        let backgroundSizeX = new WebInspector.VisualStyleNumberInputBox("background-size", WebInspector.UIString("Width"), backgroundSizeKeywords, this._units.defaults);
+        let backgroundSizeX = new WI.VisualStyleNumberInputBox("background-size", WI.UIString("Width"), backgroundSizeKeywords, this._units.defaults);
         backgroundSizeX.masterProperty = true;
-        let backgroundSizeY = new WebInspector.VisualStyleNumberInputBox("background-size", WebInspector.UIString("Height"), backgroundSizeKeywords, this._units.defaults);
+        let backgroundSizeY = new WI.VisualStyleNumberInputBox("background-size", WI.UIString("Height"), backgroundSizeKeywords, this._units.defaults);
         backgroundSizeY.masterProperty = true;
 
-        properties.backgroundSize = new WebInspector.VisualStylePropertyCombiner("background-size", [backgroundSizeX, backgroundSizeY]);
+        properties.backgroundSize = new WI.VisualStylePropertyCombiner("background-size", [backgroundSizeX, backgroundSizeY]);
 
         backgroundSizeRow.element.appendChild(backgroundSizeX.element);
         backgroundSizeRow.element.appendChild(backgroundSizeY.element);
 
-        let backgroundRow = new WebInspector.DetailsSectionRow;
+        let backgroundRow = new WI.DetailsSectionRow;
 
-        properties.background = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("background", null, {
+        properties.background = new WI.VisualStyleCommaSeparatedKeywordEditor("background", null, {
             "background-image": "none",
             "background-position": "0% 0%",
             "background-repeat": "repeat",
@@ -1073,48 +1073,48 @@
 
         backgroundRow.element.appendChild(properties.background.element);
 
-        let backgroundImageRow = new WebInspector.DetailsSectionRow;
+        let backgroundImageRow = new WI.DetailsSectionRow;
 
-        let backgroundImage = new WebInspector.VisualStyleBackgroundPicker("background-image", WebInspector.UIString("Type"), this._keywords.defaults.concat(["None"]));
+        let backgroundImage = new WI.VisualStyleBackgroundPicker("background-image", WI.UIString("Type"), this._keywords.defaults.concat(["None"]));
 
         backgroundImageRow.element.appendChild(backgroundImage.element);
 
-        let backgroundPositionRow = new WebInspector.DetailsSectionRow;
+        let backgroundPositionRow = new WI.DetailsSectionRow;
 
-        let backgroundPositionX = new WebInspector.VisualStyleNumberInputBox("background-position", WebInspector.UIString("Position X"), ["Center", "Left", "Right"], this._units.defaults);
+        let backgroundPositionX = new WI.VisualStyleNumberInputBox("background-position", WI.UIString("Position X"), ["Center", "Left", "Right"], this._units.defaults);
         backgroundPositionX.optionalProperty = true;
-        let backgroundPositionY = new WebInspector.VisualStyleNumberInputBox("background-position", WebInspector.UIString("Position Y"), ["Bottom", "Center", "Top"], this._units.defaults);
+        let backgroundPositionY = new WI.VisualStyleNumberInputBox("background-position", WI.UIString("Position Y"), ["Bottom", "Center", "Top"], this._units.defaults);
         backgroundPositionY.optionalProperty = true;
 
         backgroundPositionRow.element.appendChild(backgroundPositionX.element);
         backgroundPositionRow.element.appendChild(backgroundPositionY.element);
 
-        let backgroundRepeatRow = new WebInspector.DetailsSectionRow;
+        let backgroundRepeatRow = new WI.DetailsSectionRow;
 
-        let backgroundRepeat = new WebInspector.VisualStyleKeywordPicker("background-repeat", WebInspector.UIString("Repeat"), this._keywords.defaults.concat(["No Repeat", "Repeat", "Repeat X", "Repeat Y"]));
+        let backgroundRepeat = new WI.VisualStyleKeywordPicker("background-repeat", WI.UIString("Repeat"), this._keywords.defaults.concat(["No Repeat", "Repeat", "Repeat X", "Repeat Y"]));
         backgroundRepeat.optionalProperty = true;
-        let backgroundAttachment = new WebInspector.VisualStyleKeywordPicker("background-attachment", WebInspector.UIString("Attach"), this._keywords.defaults.concat(["Fixed", "Local", "Scroll"]));
+        let backgroundAttachment = new WI.VisualStyleKeywordPicker("background-attachment", WI.UIString("Attach"), this._keywords.defaults.concat(["Fixed", "Local", "Scroll"]));
         backgroundAttachment.optionalProperty = true;
 
         backgroundRepeatRow.element.appendChild(backgroundRepeat.element);
         backgroundRepeatRow.element.appendChild(backgroundAttachment.element);
 
         let backgroundProperties = [backgroundImage, backgroundPositionX, backgroundPositionY, backgroundRepeat, backgroundAttachment];
-        let backgroundPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("background", backgroundProperties);
+        let backgroundPropertyCombiner = new WI.VisualStylePropertyCombiner("background", backgroundProperties);
 
         let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, backgroundPropertyCombiner, backgroundProperties);
-        properties.background.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
+        properties.background.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
 
         let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.background, backgroundPropertyCombiner);
-        backgroundPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
+        backgroundPropertyCombiner.addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
 
         let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(backgroundPropertyCombiner);
-        properties.background.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
+        properties.background.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
 
         group.autocompleteCompatibleProperties = [properties.backgroundColor];
         group.specifiedWidthProperties = [properties.background];
 
-        let backgroundStyleGroup = new WebInspector.DetailsSectionGroup([backgroundStyleRow, backgroundClipRow, backgroundSizeRow, backgroundRow, backgroundImageRow, backgroundPositionRow, backgroundRepeatRow]);
+        let backgroundStyleGroup = new WI.DetailsSectionGroup([backgroundStyleRow, backgroundClipRow, backgroundSizeRow, backgroundRow, backgroundImageRow, backgroundPositionRow, backgroundRepeatRow]);
         this._populateSection(group, [backgroundStyleGroup]);
     }
 
@@ -1123,111 +1123,111 @@
         let group = this._groups.border;
         let properties = group.properties;
 
-        let borderAllSize = new WebInspector.DetailsSectionRow;
+        let borderAllSize = new WI.DetailsSectionRow;
 
-        properties.borderStyle = new WebInspector.VisualStyleKeywordPicker(["border-top-style", "border-right-style", "border-bottom-style", "border-left-style"], WebInspector.UIString("Style"), this._keywords.borderStyle);
+        properties.borderStyle = new WI.VisualStyleKeywordPicker(["border-top-style", "border-right-style", "border-bottom-style", "border-left-style"], WI.UIString("Style"), this._keywords.borderStyle);
         properties.borderStyle.propertyReferenceName = "border-style";
-        properties.borderWidth = new WebInspector.VisualStyleNumberInputBox(["border-top-width", "border-right-width", "border-bottom-width", "border-left-width"], WebInspector.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
+        properties.borderWidth = new WI.VisualStyleNumberInputBox(["border-top-width", "border-right-width", "border-bottom-width", "border-left-width"], WI.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
         properties.borderWidth.propertyReferenceName = "border-width";
 
         borderAllSize.element.appendChild(properties.borderStyle.element);
         borderAllSize.element.appendChild(properties.borderWidth.element);
 
-        let borderAllStyle = new WebInspector.DetailsSectionRow;
+        let borderAllStyle = new WI.DetailsSectionRow;
 
-        properties.borderColor = new WebInspector.VisualStyleColorPicker(["border-top-color", "border-right-color", "border-bottom-color", "border-left-color"], WebInspector.UIString("Color"));
+        properties.borderColor = new WI.VisualStyleColorPicker(["border-top-color", "border-right-color", "border-bottom-color", "border-left-color"], WI.UIString("Color"));
         properties.borderColor.propertyReferenceName = "border-color";
-        properties.borderRadius = new WebInspector.VisualStyleNumberInputBox(["border-top-left-radius", "border-top-right-radius", "border-bottom-left-radius", "border-bottom-right-radius"], WebInspector.UIString("Radius"), this._keywords.defaults, this._units.defaults);
+        properties.borderRadius = new WI.VisualStyleNumberInputBox(["border-top-left-radius", "border-top-right-radius", "border-bottom-left-radius", "border-bottom-right-radius"], WI.UIString("Radius"), this._keywords.defaults, this._units.defaults);
         properties.borderRadius.propertyReferenceName = "border-radius";
 
         borderAllStyle.element.appendChild(properties.borderColor.element);
         borderAllStyle.element.appendChild(properties.borderRadius.element);
 
         let borderAllProperties = [properties.borderStyle, properties.borderWidth, properties.borderColor, properties.borderRadius];
-        let borderAllGroup = new WebInspector.DetailsSectionGroup([borderAllSize, borderAllStyle]);
+        let borderAllGroup = new WI.DetailsSectionGroup([borderAllSize, borderAllStyle]);
 
-        let borderTopSize = new WebInspector.DetailsSectionRow;
+        let borderTopSize = new WI.DetailsSectionRow;
 
-        properties.borderTopStyle = new WebInspector.VisualStyleKeywordPicker("border-top-style", WebInspector.UIString("Style"), this._keywords.borderStyle);
-        properties.borderTopWidth = new WebInspector.VisualStyleNumberInputBox("border-top-width", WebInspector.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
+        properties.borderTopStyle = new WI.VisualStyleKeywordPicker("border-top-style", WI.UIString("Style"), this._keywords.borderStyle);
+        properties.borderTopWidth = new WI.VisualStyleNumberInputBox("border-top-width", WI.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
 
         borderTopSize.element.appendChild(properties.borderTopStyle.element);
         borderTopSize.element.appendChild(properties.borderTopWidth.element);
 
-        let borderTopStyle = new WebInspector.DetailsSectionRow;
+        let borderTopStyle = new WI.DetailsSectionRow;
 
-        properties.borderTopColor = new WebInspector.VisualStyleColorPicker("border-top-color", WebInspector.UIString("Color"));
-        properties.borderTopRadius = new WebInspector.VisualStyleNumberInputBox(["border-top-left-radius", "border-top-right-radius"], WebInspector.UIString("Radius"), this._keywords.defaults, this._units.defaults);
+        properties.borderTopColor = new WI.VisualStyleColorPicker("border-top-color", WI.UIString("Color"));
+        properties.borderTopRadius = new WI.VisualStyleNumberInputBox(["border-top-left-radius", "border-top-right-radius"], WI.UIString("Radius"), this._keywords.defaults, this._units.defaults);
 
         borderTopStyle.element.appendChild(properties.borderTopColor.element);
         borderTopStyle.element.appendChild(properties.borderTopRadius.element);
 
         let borderTopProperties = [properties.borderTopStyle, properties.borderTopWidth, properties.borderTopColor, properties.borderTopRadius];
-        let borderTopGroup = new WebInspector.DetailsSectionGroup([borderTopSize, borderTopStyle]);
+        let borderTopGroup = new WI.DetailsSectionGroup([borderTopSize, borderTopStyle]);
 
-        let borderRightSize = new WebInspector.DetailsSectionRow;
+        let borderRightSize = new WI.DetailsSectionRow;
 
-        properties.borderRightStyle = new WebInspector.VisualStyleKeywordPicker("border-right-style", WebInspector.UIString("Style"), this._keywords.borderStyle);
-        properties.borderRightWidth = new WebInspector.VisualStyleNumberInputBox("border-right-width", WebInspector.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
+        properties.borderRightStyle = new WI.VisualStyleKeywordPicker("border-right-style", WI.UIString("Style"), this._keywords.borderStyle);
+        properties.borderRightWidth = new WI.VisualStyleNumberInputBox("border-right-width", WI.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
 
         borderRightSize.element.appendChild(properties.borderRightStyle.element);
         borderRightSize.element.appendChild(properties.borderRightWidth.element);
 
-        let borderRightStyle = new WebInspector.DetailsSectionRow;
+        let borderRightStyle = new WI.DetailsSectionRow;
 
-        properties.borderRightColor = new WebInspector.VisualStyleColorPicker("border-right-color", WebInspector.UIString("Color"));
-        properties.borderRightRadius = new WebInspector.VisualStyleNumberInputBox(["border-top-right-radius", "border-bottom-right-radius"], WebInspector.UIString("Radius"), this._keywords.defaults, this._units.defaults);
+        properties.borderRightColor = new WI.VisualStyleColorPicker("border-right-color", WI.UIString("Color"));
+        properties.borderRightRadius = new WI.VisualStyleNumberInputBox(["border-top-right-radius", "border-bottom-right-radius"], WI.UIString("Radius"), this._keywords.defaults, this._units.defaults);
 
         borderRightStyle.element.appendChild(properties.borderRightColor.element);
         borderRightStyle.element.appendChild(properties.borderRightRadius.element);
 
         let borderRightProperties = [properties.borderRightStyle, properties.borderRightWidth, properties.borderRightColor, properties.borderRightRadius];
-        let borderRightGroup = new WebInspector.DetailsSectionGroup([borderRightSize, borderRightStyle]);
+        let borderRightGroup = new WI.DetailsSectionGroup([borderRightSize, borderRightStyle]);
 
-        let borderBottomSize = new WebInspector.DetailsSectionRow;
+        let borderBottomSize = new WI.DetailsSectionRow;
 
-        properties.borderBottomStyle = new WebInspector.VisualStyleKeywordPicker("border-bottom-style", WebInspector.UIString("Style"), this._keywords.borderStyle);
-        properties.borderBottomWidth = new WebInspector.VisualStyleNumberInputBox("border-bottom-width", WebInspector.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
+        properties.borderBottomStyle = new WI.VisualStyleKeywordPicker("border-bottom-style", WI.UIString("Style"), this._keywords.borderStyle);
+        properties.borderBottomWidth = new WI.VisualStyleNumberInputBox("border-bottom-width", WI.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
 
         borderBottomSize.element.appendChild(properties.borderBottomStyle.element);
         borderBottomSize.element.appendChild(properties.borderBottomWidth.element);
 
-        let borderBottomStyle = new WebInspector.DetailsSectionRow;
+        let borderBottomStyle = new WI.DetailsSectionRow;
 
-        properties.borderBottomColor = new WebInspector.VisualStyleColorPicker("border-bottom-color", WebInspector.UIString("Color"));
-        properties.borderBottomRadius = new WebInspector.VisualStyleNumberInputBox(["border-bottom-left-radius", "border-bottom-right-radius"], WebInspector.UIString("Radius"), this._keywords.defaults, this._units.defaults);
+        properties.borderBottomColor = new WI.VisualStyleColorPicker("border-bottom-color", WI.UIString("Color"));
+        properties.borderBottomRadius = new WI.VisualStyleNumberInputBox(["border-bottom-left-radius", "border-bottom-right-radius"], WI.UIString("Radius"), this._keywords.defaults, this._units.defaults);
 
         borderBottomStyle.element.appendChild(properties.borderBottomColor.element);
         borderBottomStyle.element.appendChild(properties.borderBottomRadius.element);
 
         let borderBottomProperties = [properties.borderBottomStyle, properties.borderBottomWidth, properties.borderBottomColor, properties.borderBottomRadius];
-        let borderBottomGroup = new WebInspector.DetailsSectionGroup([borderBottomSize, borderBottomStyle]);
+        let borderBottomGroup = new WI.DetailsSectionGroup([borderBottomSize, borderBottomStyle]);
 
-        let borderLeftSize = new WebInspector.DetailsSectionRow;
+        let borderLeftSize = new WI.DetailsSectionRow;
 
-        properties.borderLeftStyle = new WebInspector.VisualStyleKeywordPicker("border-left-style", WebInspector.UIString("Style"), this._keywords.borderStyle);
-        properties.borderLeftWidth = new WebInspector.VisualStyleNumberInputBox("border-left-width", WebInspector.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
+        properties.borderLeftStyle = new WI.VisualStyleKeywordPicker("border-left-style", WI.UIString("Style"), this._keywords.borderStyle);
+        properties.borderLeftWidth = new WI.VisualStyleNumberInputBox("border-left-width", WI.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
 
         borderLeftSize.element.appendChild(properties.borderLeftStyle.element);
         borderLeftSize.element.appendChild(properties.borderLeftWidth.element);
 
-        let borderLeftStyle = new WebInspector.DetailsSectionRow;
+        let borderLeftStyle = new WI.DetailsSectionRow;
 
-        properties.borderLeftColor = new WebInspector.VisualStyleColorPicker("border-left-color", WebInspector.UIString("Color"));
-        properties.borderLeftRadius = new WebInspector.VisualStyleNumberInputBox(["border-top-left-radius", "border-bottom-left-radius"], WebInspector.UIString("Radius"), this._keywords.defaults, this._units.defaults);
+        properties.borderLeftColor = new WI.VisualStyleColorPicker("border-left-color", WI.UIString("Color"));
+        properties.borderLeftRadius = new WI.VisualStyleNumberInputBox(["border-top-left-radius", "border-bottom-left-radius"], WI.UIString("Radius"), this._keywords.defaults, this._units.defaults);
 
         borderLeftStyle.element.appendChild(properties.borderLeftColor.element);
         borderLeftStyle.element.appendChild(properties.borderLeftRadius.element);
 
         let borderLeftProperties = [properties.borderLeftStyle, properties.borderLeftWidth, properties.borderLeftColor, properties.borderLeftRadius];
-        let borderLeftGroup = new WebInspector.DetailsSectionGroup([borderLeftSize, borderLeftStyle]);
+        let borderLeftGroup = new WI.DetailsSectionGroup([borderLeftSize, borderLeftStyle]);
 
-        let borderTabController = new WebInspector.VisualStyleTabbedPropertiesRow({
-            "all": {title: WebInspector.UIString("All"), element: borderAllGroup.element, properties: borderAllProperties},
-            "top": {title: WebInspector.UIString("Top"), element: borderTopGroup.element, properties: borderTopProperties},
-            "right": {title: WebInspector.UIString("Right"), element: borderRightGroup.element, properties: borderRightProperties},
-            "bottom": {title: WebInspector.UIString("Bottom"), element: borderBottomGroup.element, properties: borderBottomProperties},
-            "left": {title: WebInspector.UIString("Left"), element: borderLeftGroup.element, properties: borderLeftProperties}
+        let borderTabController = new WI.VisualStyleTabbedPropertiesRow({
+            "all": {title: WI.UIString("All"), element: borderAllGroup.element, properties: borderAllProperties},
+            "top": {title: WI.UIString("Top"), element: borderTopGroup.element, properties: borderTopProperties},
+            "right": {title: WI.UIString("Right"), element: borderRightGroup.element, properties: borderRightProperties},
+            "bottom": {title: WI.UIString("Bottom"), element: borderBottomGroup.element, properties: borderBottomProperties},
+            "left": {title: WI.UIString("Left"), element: borderLeftGroup.element, properties: borderLeftProperties}
         });
 
         let highlightMode = "border";
@@ -1237,70 +1237,70 @@
         this._addMetricsMouseListeners(group.properties.borderLeftWidth, highlightMode);
         this._addMetricsMouseListeners(group.properties.borderRightWidth, highlightMode);
 
-        let borderGroup = new WebInspector.DetailsSectionGroup([borderTabController, borderAllGroup, borderTopGroup, borderRightGroup, borderBottomGroup, borderLeftGroup]);
+        let borderGroup = new WI.DetailsSectionGroup([borderTabController, borderAllGroup, borderTopGroup, borderRightGroup, borderBottomGroup, borderLeftGroup]);
 
-        let borderImageSourceRow = new WebInspector.DetailsSectionRow;
+        let borderImageSourceRow = new WI.DetailsSectionRow;
 
-        properties.borderImageSource = new WebInspector.VisualStyleURLInput("border-image-source", WebInspector.UIString("Image"), this._keywords.defaults.concat(["None"]));
+        properties.borderImageSource = new WI.VisualStyleURLInput("border-image-source", WI.UIString("Image"), this._keywords.defaults.concat(["None"]));
 
         borderImageSourceRow.element.appendChild(properties.borderImageSource.element);
 
-        let borderImageRepeatRow = new WebInspector.DetailsSectionRow;
+        let borderImageRepeatRow = new WI.DetailsSectionRow;
 
-        let borderImageSliceFill = new WebInspector.VisualStyleKeywordCheckbox("border-image-slice", WebInspector.UIString("Fill"), "Fill");
+        let borderImageSliceFill = new WI.VisualStyleKeywordCheckbox("border-image-slice", WI.UIString("Fill"), "Fill");
         borderImageSliceFill.optionalProperty = true;
-        properties.borderImageRepeat = new WebInspector.VisualStyleKeywordPicker("border-image-repeat", WebInspector.UIString("Repeat"), this._keywords.defaults.concat(["Stretch", "Repeat", "Round", "Space"]));
+        properties.borderImageRepeat = new WI.VisualStyleKeywordPicker("border-image-repeat", WI.UIString("Repeat"), this._keywords.defaults.concat(["Stretch", "Repeat", "Round", "Space"]));
 
         borderImageRepeatRow.element.appendChild(borderImageSliceFill.element);
         borderImageRepeatRow.element.appendChild(properties.borderImageRepeat.element);
 
         function generateBorderImagePropertyEditors(propertyName, keywords, units) {
-            let vertical = new WebInspector.DetailsSectionRow;
+            let vertical = new WI.DetailsSectionRow;
 
-            let top = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Top"), keywords, units);
+            let top = new WI.VisualStyleNumberInputBox(propertyName, WI.UIString("Top"), keywords, units);
             top.masterProperty = true;
-            let bottom = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Bottom"), keywords, units);
+            let bottom = new WI.VisualStyleNumberInputBox(propertyName, WI.UIString("Bottom"), keywords, units);
             bottom.masterProperty = true;
 
             vertical.element.appendChild(top.element);
             vertical.element.appendChild(bottom.element);
 
-            let horizontal = new WebInspector.DetailsSectionRow;
+            let horizontal = new WI.DetailsSectionRow;
 
-            let left = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Left"), keywords, units);
+            let left = new WI.VisualStyleNumberInputBox(propertyName, WI.UIString("Left"), keywords, units);
             left.masterProperty = true;
-            let right = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Right"), keywords, units);
+            let right = new WI.VisualStyleNumberInputBox(propertyName, WI.UIString("Right"), keywords, units);
             right.masterProperty = true;
 
             horizontal.element.appendChild(left.element);
             horizontal.element.appendChild(right.element);
 
-            return {group: new WebInspector.DetailsSectionGroup([vertical, horizontal]), properties: [top, bottom, left, right]};
+            return {group: new WI.DetailsSectionGroup([vertical, horizontal]), properties: [top, bottom, left, right]};
         }
 
-        let nonKeywordUnits = [WebInspector.UIString("Number")];
+        let nonKeywordUnits = [WI.UIString("Number")];
 
         let borderImageUnits = Object.shallowCopy(this._units.defaults);
         borderImageUnits.basic = nonKeywordUnits.concat(borderImageUnits.basic);
         let borderImageWidth = generateBorderImagePropertyEditors("border-image-width", this._keywords.boxModel, borderImageUnits);
-        properties.borderImageWidth = new WebInspector.VisualStylePropertyCombiner("border-image-width", borderImageWidth.properties, true);
+        properties.borderImageWidth = new WI.VisualStylePropertyCombiner("border-image-width", borderImageWidth.properties, true);
 
         let borderOutsetUnits = Object.shallowCopy(this._units.defaultsSansPercent);
         borderOutsetUnits.basic = nonKeywordUnits.concat(borderOutsetUnits.basic);
         let borderImageOutset = generateBorderImagePropertyEditors("border-image-outset", this._keywords.defaults, borderOutsetUnits);
-        properties.borderImageOutset = new WebInspector.VisualStylePropertyCombiner("border-image-outset", borderImageOutset.properties, true);
+        properties.borderImageOutset = new WI.VisualStylePropertyCombiner("border-image-outset", borderImageOutset.properties, true);
 
         let borderImageSlice = generateBorderImagePropertyEditors("border-image-slice", this._keywords.defaults, ["%"].concat(nonKeywordUnits));
         borderImageSlice.properties.push(borderImageSliceFill);
-        properties.borderImageSlice = new WebInspector.VisualStylePropertyCombiner("border-image-slice", borderImageSlice.properties, true);
+        properties.borderImageSlice = new WI.VisualStylePropertyCombiner("border-image-slice", borderImageSlice.properties, true);
 
-        let borderImagePropertiesTabController = new WebInspector.VisualStyleTabbedPropertiesRow({
-            "width": {title: WebInspector.UIString("Width"), element: borderImageWidth.group.element, properties: [properties.borderImageWidth]},
-            "outset": {title: WebInspector.UIString("Outset"), element: borderImageOutset.group.element, properties: [properties.borderImageOutset]},
-            "slice": {title: WebInspector.UIString("Slice"), element: borderImageSlice.group.element, properties: [properties.borderImageSlice]}
+        let borderImagePropertiesTabController = new WI.VisualStyleTabbedPropertiesRow({
+            "width": {title: WI.UIString("Width"), element: borderImageWidth.group.element, properties: [properties.borderImageWidth]},
+            "outset": {title: WI.UIString("Outset"), element: borderImageOutset.group.element, properties: [properties.borderImageOutset]},
+            "slice": {title: WI.UIString("Slice"), element: borderImageSlice.group.element, properties: [properties.borderImageSlice]}
         });
 
-        let borderImageGroup = new WebInspector.DetailsSectionGroup([borderImageSourceRow, borderImageRepeatRow, borderImagePropertiesTabController, borderImageWidth.group, borderImageOutset.group, borderImageSlice.group]);
+        let borderImageGroup = new WI.DetailsSectionGroup([borderImageSourceRow, borderImageRepeatRow, borderImagePropertiesTabController, borderImageWidth.group, borderImageOutset.group, borderImageSlice.group]);
 
         group.autocompleteCompatibleProperties = [properties.borderColor, properties.borderTopColor, properties.borderBottomColor, properties.borderLeftColor, properties.borderRightColor];
 
@@ -1324,25 +1324,25 @@
         let group = this._groups.outline;
         let properties = group.properties;
 
-        let outlineSizeRow = new WebInspector.DetailsSectionRow;
+        let outlineSizeRow = new WI.DetailsSectionRow;
 
-        properties.outlineStyle = new WebInspector.VisualStyleKeywordPicker("outline-style", WebInspector.UIString("Style"), this._keywords.borderStyle);
-        properties.outlineWidth = new WebInspector.VisualStyleNumberInputBox("outline-width", WebInspector.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
+        properties.outlineStyle = new WI.VisualStyleKeywordPicker("outline-style", WI.UIString("Style"), this._keywords.borderStyle);
+        properties.outlineWidth = new WI.VisualStyleNumberInputBox("outline-width", WI.UIString("Width"), this._keywords.borderWidth, this._units.defaults);
 
         outlineSizeRow.element.appendChild(properties.outlineStyle.element);
         outlineSizeRow.element.appendChild(properties.outlineWidth.element);
 
-        let outlineStyleRow = new WebInspector.DetailsSectionRow;
+        let outlineStyleRow = new WI.DetailsSectionRow;
 
-        properties.outlineColor = new WebInspector.VisualStyleColorPicker("outline-color", WebInspector.UIString("Color"));
-        properties.outlineOffset = new WebInspector.VisualStyleNumberInputBox("outline-offset", WebInspector.UIString("Offset"), this._keywords.defaults, this._units.defaults, true);
+        properties.outlineColor = new WI.VisualStyleColorPicker("outline-color", WI.UIString("Color"));
+        properties.outlineOffset = new WI.VisualStyleNumberInputBox("outline-offset", WI.UIString("Offset"), this._keywords.defaults, this._units.defaults, true);
 
         outlineStyleRow.element.appendChild(properties.outlineColor.element);
         outlineStyleRow.element.appendChild(properties.outlineOffset.element);
 
         group.autocompleteCompatibleProperties = [properties.outlineColor];
 
-        let outlineGroup = new WebInspector.DetailsSectionGroup([outlineSizeRow, outlineStyleRow]);
+        let outlineGroup = new WI.DetailsSectionGroup([outlineSizeRow, outlineStyleRow]);
         this._populateSection(group, [outlineGroup]);
 
         let allowedOutlineValues = ["solid", "dashed", "dotted", "double", "groove", "inset", "outset", "ridge"];
@@ -1355,59 +1355,59 @@
         let group = this._groups.boxShadow;
         let properties = group.properties;
 
-        let boxShadowRow = new WebInspector.DetailsSectionRow;
+        let boxShadowRow = new WI.DetailsSectionRow;
 
-        properties.boxShadow = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("box-shadow");
+        properties.boxShadow = new WI.VisualStyleCommaSeparatedKeywordEditor("box-shadow");
 
         boxShadowRow.element.appendChild(properties.boxShadow.element);
 
-        let boxShadowHRow = new WebInspector.DetailsSectionRow;
+        let boxShadowHRow = new WI.DetailsSectionRow;
 
-        let boxShadowH = new WebInspector.VisualStyleRelativeNumberSlider("box-shadow", WebInspector.UIString("Left"), null, this._units.defaultsSansPercent, true);
+        let boxShadowH = new WI.VisualStyleRelativeNumberSlider("box-shadow", WI.UIString("Left"), null, this._units.defaultsSansPercent, true);
 
         boxShadowHRow.element.appendChild(boxShadowH.element);
 
-        let boxShadowVRow = new WebInspector.DetailsSectionRow;
+        let boxShadowVRow = new WI.DetailsSectionRow;
 
-        let boxShadowV = new WebInspector.VisualStyleRelativeNumberSlider("box-shadow", WebInspector.UIString("Top"), null, this._units.defaultsSansPercent, true);
+        let boxShadowV = new WI.VisualStyleRelativeNumberSlider("box-shadow", WI.UIString("Top"), null, this._units.defaultsSansPercent, true);
 
         boxShadowVRow.element.appendChild(boxShadowV.element);
 
-        let boxShadowBlurRow = new WebInspector.DetailsSectionRow;
+        let boxShadowBlurRow = new WI.DetailsSectionRow;
 
-        let boxShadowBlur = new WebInspector.VisualStyleNumberInputBox("box-shadow", WebInspector.UIString("Blur"), null, this._units.defaultsSansPercent);
+        let boxShadowBlur = new WI.VisualStyleNumberInputBox("box-shadow", WI.UIString("Blur"), null, this._units.defaultsSansPercent);
         boxShadowBlur.optionalProperty = true;
-        let boxShadowSpread = new WebInspector.VisualStyleNumberInputBox("box-shadow", WebInspector.UIString("Spread"), null, this._units.defaultsSansPercent, true);
+        let boxShadowSpread = new WI.VisualStyleNumberInputBox("box-shadow", WI.UIString("Spread"), null, this._units.defaultsSansPercent, true);
         boxShadowSpread.optionalProperty = true;
 
         boxShadowBlurRow.element.appendChild(boxShadowBlur.element);
         boxShadowBlurRow.element.appendChild(boxShadowSpread.element);
 
-        let boxShadowColorRow = new WebInspector.DetailsSectionRow;
+        let boxShadowColorRow = new WI.DetailsSectionRow;
 
-        let boxShadowColor = new WebInspector.VisualStyleColorPicker("box-shadow", WebInspector.UIString("Color"));
-        let boxShadowInset = new WebInspector.VisualStyleKeywordCheckbox("box-shadow", WebInspector.UIString("Inset"), "Inset");
+        let boxShadowColor = new WI.VisualStyleColorPicker("box-shadow", WI.UIString("Color"));
+        let boxShadowInset = new WI.VisualStyleKeywordCheckbox("box-shadow", WI.UIString("Inset"), "Inset");
         boxShadowInset.optionalProperty = true;
 
         boxShadowColorRow.element.appendChild(boxShadowColor.element);
         boxShadowColorRow.element.appendChild(boxShadowInset.element);
 
         let boxShadowProperties = [boxShadowH, boxShadowV, boxShadowBlur, boxShadowSpread, boxShadowColor, boxShadowInset];
-        let boxShadowPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("box-shadow", boxShadowProperties);
+        let boxShadowPropertyCombiner = new WI.VisualStylePropertyCombiner("box-shadow", boxShadowProperties);
 
         let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, boxShadowPropertyCombiner, boxShadowProperties);
-        properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
+        properties.boxShadow.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
 
         let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.boxShadow, boxShadowPropertyCombiner);
-        boxShadowPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
+        boxShadowPropertyCombiner.addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
 
         let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(boxShadowPropertyCombiner);
-        properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
+        properties.boxShadow.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
 
         group.autocompleteCompatibleProperties = [boxShadowColor];
         group.specifiedWidthProperties = [properties.boxShadow];
 
-        let boxShadow = new WebInspector.DetailsSectionGroup([boxShadowRow, boxShadowHRow, boxShadowVRow, boxShadowBlurRow, boxShadowColorRow]);
+        let boxShadow = new WI.DetailsSectionGroup([boxShadowRow, boxShadowHRow, boxShadowVRow, boxShadowBlurRow, boxShadowColorRow]);
         this._populateSection(group, [boxShadow]);
     }
 
@@ -1416,25 +1416,25 @@
         let group = this._groups.listStyle;
         let properties = group.properties;
 
-        let listStyleTypeRow = new WebInspector.DetailsSectionRow;
+        let listStyleTypeRow = new WI.DetailsSectionRow;
 
-        properties.listStyleType = new WebInspector.VisualStyleKeywordPicker("list-style-type", WebInspector.UIString("Type"), {
+        properties.listStyleType = new WI.VisualStyleKeywordPicker("list-style-type", WI.UIString("Type"), {
             basic: this._keywords.defaults.concat(["None", "Circle", "Disc", "Square", "Decimal", "Lower Alpha", "Upper Alpha", "Lower Roman", "Upper Roman"]),
             advanced: ["Decimal Leading Zero", "Asterisks", "Footnotes", "Binary", "Octal", "Lower Hexadecimal", "Upper Hexadecimal", "Lower Latin", "Upper Latin", "Lower Greek", "Upper Greek", "Arabic Indic", "Hebrew", "Hiragana", "Katakana", "Hiragana Iroha", "Katakana Iroha", "CJK Earthly Branch", "CJK Heavenly Stem", "CJK Ideographic", "Bengali", "Cambodian", "Khmer", "Devanagari", "Gujarati", "Gurmukhi", "Kannada", "Lao", "Malayalam", "Mongolian", "Myanmar", "Oriya", "Persian", "Urdu", "Telugu", "Armenian", "Lower Armenian", "Upper Armenian", "Georgian", "Tibetan", "Thai", "Afar", "Hangul Consonant", "Hangul", "Lower Norwegian", "Upper Norwegian", "Ethiopic", "Ethiopic Halehame Gez", "Ethiopic Halehame Aa Et", "Ethiopic Halehame Aa Er", "Oromo", "Ethiopic Halehame Om Et", "Sidama", "Ethiopic Halehame Sid Et", "Somali", "Ethiopic Halehame So Et", "Amharic", "Ethiopic Halehame Am Et", "Tigre", "Ethiopic Halehame Tig", "Tigrinya Er", "Ethiopic Halehame Ti Er", "Tigrinya Et", "Ethiopic Halehame Ti Et", "Ethiopic Abegede", "Ethiopic Abegede Gez", "Amharic Abegede", "Ethiopic Abegede Am Et", "Tigrinya Er Abegede", "Ethiopic Abegede Ti Er", "Tigrinya Et Abegede", "Ethiopic Abegede Ti Et"]
         });
 
-        properties.listStylePosition = new WebInspector.VisualStyleKeywordIconList("list-style-position", WebInspector.UIString("Position"), ["Outside", "Inside", "Initial"]);
+        properties.listStylePosition = new WI.VisualStyleKeywordIconList("list-style-position", WI.UIString("Position"), ["Outside", "Inside", "Initial"]);
 
         listStyleTypeRow.element.appendChild(properties.listStyleType.element);
         listStyleTypeRow.element.appendChild(properties.listStylePosition.element);
 
-        let listStyleImageRow = new WebInspector.DetailsSectionRow;
+        let listStyleImageRow = new WI.DetailsSectionRow;
 
-        properties.listStyleImage = new WebInspector.VisualStyleURLInput("list-style-image", WebInspector.UIString("Image"), this._keywords.defaults.concat(["None"]));
+        properties.listStyleImage = new WI.VisualStyleURLInput("list-style-image", WI.UIString("Image"), this._keywords.defaults.concat(["None"]));
 
         listStyleImageRow.element.appendChild(properties.listStyleImage.element);
 
-        let listStyle = new WebInspector.DetailsSectionGroup([listStyleTypeRow, listStyleImageRow]);
+        let listStyle = new WI.DetailsSectionGroup([listStyleTypeRow, listStyleImageRow]);
         this._populateSection(group, [listStyle]);
     }
 
@@ -1443,9 +1443,9 @@
         let group = this._groups.transition;
         let properties = group.properties;
 
-        let transitionRow = new WebInspector.DetailsSectionRow;
+        let transitionRow = new WI.DetailsSectionRow;
 
-        properties.transition = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("transition", null, {
+        properties.transition = new WI.VisualStyleCommaSeparatedKeywordEditor("transition", null, {
             "transition-property": "all",
             "transition-timing-function": "ease",
             "transition-duration": "0",
@@ -1454,43 +1454,43 @@
 
         transitionRow.element.appendChild(properties.transition.element);
 
-        let transitionPropertyRow = new WebInspector.DetailsSectionRow;
+        let transitionPropertyRow = new WI.DetailsSectionRow;
 
-        let transitionProperty = new WebInspector.VisualStylePropertyNameInput("transition-property", WebInspector.UIString("Property"));
+        let transitionProperty = new WI.VisualStylePropertyNameInput("transition-property", WI.UIString("Property"));
         transitionProperty.masterProperty = true;
-        let transitionTiming = new WebInspector.VisualStyleTimingEditor("transition-timing-function", WebInspector.UIString("Timing"), ["Linear", "Ease", "Ease In", "Ease Out", "Ease In Out"]);
+        let transitionTiming = new WI.VisualStyleTimingEditor("transition-timing-function", WI.UIString("Timing"), ["Linear", "Ease", "Ease In", "Ease Out", "Ease In Out"]);
         transitionTiming.optionalProperty = true;
 
         transitionPropertyRow.element.appendChild(transitionProperty.element);
         transitionPropertyRow.element.appendChild(transitionTiming.element);
 
-        let transitionDurationRow = new WebInspector.DetailsSectionRow;
+        let transitionDurationRow = new WI.DetailsSectionRow;
 
         let transitionTimeKeywords = ["s", "ms"];
-        let transitionDuration = new WebInspector.VisualStyleNumberInputBox("transition-duration", WebInspector.UIString("Duration"), null, transitionTimeKeywords);
+        let transitionDuration = new WI.VisualStyleNumberInputBox("transition-duration", WI.UIString("Duration"), null, transitionTimeKeywords);
         transitionDuration.optionalProperty = true;
-        let transitionDelay = new WebInspector.VisualStyleNumberInputBox("transition-delay", WebInspector.UIString("Delay"), null, transitionTimeKeywords);
+        let transitionDelay = new WI.VisualStyleNumberInputBox("transition-delay", WI.UIString("Delay"), null, transitionTimeKeywords);
         transitionDelay.optionalProperty = true;
 
         transitionDurationRow.element.appendChild(transitionDuration.element);
         transitionDurationRow.element.appendChild(transitionDelay.element);
 
         let transitionProperties = [transitionProperty, transitionDuration, transitionTiming, transitionDelay];
-        let transitionPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("transition", transitionProperties);
+        let transitionPropertyCombiner = new WI.VisualStylePropertyCombiner("transition", transitionProperties);
 
         let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, transitionPropertyCombiner, transitionProperties);
-        properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
+        properties.transition.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
 
         let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.transition, transitionPropertyCombiner);
-        transitionPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
+        transitionPropertyCombiner.addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
 
         let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(transitionPropertyCombiner);
-        properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
+        properties.transition.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
 
         group.autocompleteCompatibleProperties = [transitionProperty];
         group.specifiedWidthProperties = [properties.transition];
 
-        let transitionGroup = new WebInspector.DetailsSectionGroup([transitionRow, transitionPropertyRow, transitionDurationRow]);
+        let transitionGroup = new WI.DetailsSectionGroup([transitionRow, transitionPropertyRow, transitionDurationRow]);
         this._populateSection(group, [transitionGroup]);
     }
 
@@ -1499,9 +1499,9 @@
         let group = this._groups.animation;
         let properties = group.properties;
 
-        let animationRow = new WebInspector.DetailsSectionRow;
+        let animationRow = new WI.DetailsSectionRow;
 
-        properties.animation = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("animation", null, {
+        properties.animation = new WI.VisualStyleCommaSeparatedKeywordEditor("animation", null, {
             "animation-name": "none",
             "animation-timing-function": "ease",
             "animation-iteration-count": "1",
@@ -1514,69 +1514,69 @@
 
         animationRow.element.appendChild(properties.animation.element);
 
-        let animationNameRow = new WebInspector.DetailsSectionRow;
+        let animationNameRow = new WI.DetailsSectionRow;
 
-        let animationName = new WebInspector.VisualStyleBasicInput("animation-name", WebInspector.UIString("Name"), WebInspector.UIString("Enter the name of a Keyframe"));
+        let animationName = new WI.VisualStyleBasicInput("animation-name", WI.UIString("Name"), WI.UIString("Enter the name of a Keyframe"));
         animationName.masterProperty = true;
 
         animationNameRow.element.appendChild(animationName.element);
 
-        let animationTimingRow = new WebInspector.DetailsSectionRow;
+        let animationTimingRow = new WI.DetailsSectionRow;
 
-        let animationTiming = new WebInspector.VisualStyleTimingEditor("animation-timing-function", WebInspector.UIString("Timing"), ["Linear", "Ease", "Ease In", "Ease Out", "Ease In Out"]);
+        let animationTiming = new WI.VisualStyleTimingEditor("animation-timing-function", WI.UIString("Timing"), ["Linear", "Ease", "Ease In", "Ease Out", "Ease In Out"]);
         animationTiming.optionalProperty = true;
-        let animationIterationCount = new WebInspector.VisualStyleNumberInputBox("animation-iteration-count", WebInspector.UIString("Iterations"), this._keywords.defaults.concat(["Infinite"]), null);
+        let animationIterationCount = new WI.VisualStyleNumberInputBox("animation-iteration-count", WI.UIString("Iterations"), this._keywords.defaults.concat(["Infinite"]), null);
         animationIterationCount.optionalProperty = true;
 
         animationTimingRow.element.appendChild(animationTiming.element);
         animationTimingRow.element.appendChild(animationIterationCount.element);
 
-        let animationDurationRow = new WebInspector.DetailsSectionRow;
+        let animationDurationRow = new WI.DetailsSectionRow;
 
         let animationTimeKeywords = ["s", "ms"];
-        let animationDuration = new WebInspector.VisualStyleNumberInputBox("animation-duration", WebInspector.UIString("Duration"), null, animationTimeKeywords);
+        let animationDuration = new WI.VisualStyleNumberInputBox("animation-duration", WI.UIString("Duration"), null, animationTimeKeywords);
         animationDuration.optionalProperty = true;
-        let animationDelay = new WebInspector.VisualStyleNumberInputBox("animation-delay", WebInspector.UIString("Delay"), null, animationTimeKeywords);
+        let animationDelay = new WI.VisualStyleNumberInputBox("animation-delay", WI.UIString("Delay"), null, animationTimeKeywords);
         animationDelay.optionalProperty = true;
 
         animationDurationRow.element.appendChild(animationDuration.element);
         animationDurationRow.element.appendChild(animationDelay.element);
 
-        let animationDirectionRow = new WebInspector.DetailsSectionRow;
+        let animationDirectionRow = new WI.DetailsSectionRow;
 
-        let animationDirection = new WebInspector.VisualStyleKeywordPicker("animation-direction", WebInspector.UIString("Direction"), {
+        let animationDirection = new WI.VisualStyleKeywordPicker("animation-direction", WI.UIString("Direction"), {
             basic: this._keywords.normal.concat(["Reverse"]),
             advanced: ["Alternate", "Alternate Reverse"]
         });
         animationDirection.optionalProperty = true;
-        let animationFillMode = new WebInspector.VisualStyleKeywordPicker("animation-fill-mode", WebInspector.UIString("Fill Mode"), this._keywords.defaults.concat(["None", "Forwards", "Backwards", "Both"]));
+        let animationFillMode = new WI.VisualStyleKeywordPicker("animation-fill-mode", WI.UIString("Fill Mode"), this._keywords.defaults.concat(["None", "Forwards", "Backwards", "Both"]));
         animationFillMode.optionalProperty = true;
 
         animationDirectionRow.element.appendChild(animationDirection.element);
         animationDirectionRow.element.appendChild(animationFillMode.element);
 
-        let animationStateRow = new WebInspector.DetailsSectionRow;
+        let animationStateRow = new WI.DetailsSectionRow;
 
-        let animationPlayState = new WebInspector.VisualStyleKeywordIconList("animation-play-state", WebInspector.UIString("State"), ["Running", "Paused", "Initial"]);
+        let animationPlayState = new WI.VisualStyleKeywordIconList("animation-play-state", WI.UIString("State"), ["Running", "Paused", "Initial"]);
         animationPlayState.optionalProperty = true;
 
         animationStateRow.element.appendChild(animationPlayState.element);
 
         let animationProperties = [animationName, animationDuration, animationTiming, animationDelay, animationIterationCount, animationDirection, animationFillMode, animationPlayState];
-        let animationPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("animation", animationProperties);
+        let animationPropertyCombiner = new WI.VisualStylePropertyCombiner("animation", animationProperties);
 
         let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, animationPropertyCombiner, animationProperties);
-        properties.animation.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
+        properties.animation.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
 
         let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.animation, animationPropertyCombiner);
-        animationPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
+        animationPropertyCombiner.addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
 
         let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(animationPropertyCombiner);
-        properties.animation.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
+        properties.animation.addEventListener(WI.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
 
         group.specifiedWidthProperties = [properties.animation];
 
-        let animationGroup = new WebInspector.DetailsSectionGroup([animationRow, animationNameRow, animationTimingRow, animationDurationRow, animationDirectionRow, animationStateRow]);
+        let animationGroup = new WI.DetailsSectionGroup([animationRow, animationNameRow, animationTimingRow, animationDurationRow, animationDirectionRow, animationStateRow]);
         this._populateSection(group, [animationGroup]);
     }
 
@@ -1602,9 +1602,9 @@
     }
 };
 
-WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol = Symbol("visual-style-style-disabled");
-WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol = Symbol("visual-style-initial-property-section-text");
+WI.VisualStyleDetailsPanel.StyleDisabledSymbol = Symbol("visual-style-style-disabled");
+WI.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol = Symbol("visual-style-initial-property-section-text");
 
 // FIXME: Add information about each property as a form of documentation.  This is currently empty as
 // we do not have permission to use the info on sites like MDN and have not written anything ourselves.
-WebInspector.VisualStyleDetailsPanel.propertyReferenceInfo = {};
+WI.VisualStyleDetailsPanel.propertyReferenceInfo = {};
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js
index 7f73117..ff11c59 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleFontFamilyListEditor = class VisualStyleFontFamilyListEditor extends WebInspector.VisualStyleCommaSeparatedKeywordEditor
+WI.VisualStyleFontFamilyListEditor = class VisualStyleFontFamilyListEditor extends WI.VisualStyleCommaSeparatedKeywordEditor
 {
     constructor(propertyNames, text, longhandProperties, layoutReversed)
     {
@@ -31,8 +31,8 @@
 
         this._commaSeparatedKeywords.element.addEventListener("scroll", this._hideCompletions.bind(this));
 
-        this._completionController = new WebInspector.VisualStyleCompletionsController(this);
-        this._completionController.addEventListener(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected, this._completionClicked, this);
+        this._completionController = new WI.VisualStyleCompletionsController(this);
+        this._completionController.addEventListener(WI.VisualStyleCompletionsController.Event.CompletionSelected, this._completionClicked, this);
 
         this._wrapWithQuotesRegExp = /^[a-zA-Z\-]+$/;
         this._removeWrappedQuotesRegExp = /[\"\']/g;
@@ -71,9 +71,9 @@
             value = value.replace(this._removeWrappedQuotesRegExp, "");
 
         let valueElement = super._addCommaSeparatedKeyword(value, index);
-        valueElement.addEventListener(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, this._treeElementKeyDown, this);
-        valueElement.addEventListener(WebInspector.VisualStyleFontFamilyTreeElement.Event.KeywordChanged, this._treeElementKeywordChanged, this);
-        valueElement.addEventListener(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorBlurred, this._hideCompletions, this);
+        valueElement.addEventListener(WI.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, this._treeElementKeyDown, this);
+        valueElement.addEventListener(WI.VisualStyleFontFamilyTreeElement.Event.KeywordChanged, this._treeElementKeywordChanged, this);
+        valueElement.addEventListener(WI.VisualStyleFontFamilyTreeElement.Event.EditorBlurred, this._hideCompletions, this);
         return valueElement;
     }
 
@@ -153,6 +153,6 @@
 
     _createNewTreeElement(value)
     {
-        return new WebInspector.VisualStyleFontFamilyTreeElement(value);
+        return new WI.VisualStyleFontFamilyTreeElement(value);
     }
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyTreeElement.js
index c438ecc2..9fa7edd 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyTreeElement.js
@@ -23,15 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleFontFamilyTreeElement = class VisualStyleFontFamilyTreeElement extends WebInspector.GeneralTreeElement
+WI.VisualStyleFontFamilyTreeElement = class VisualStyleFontFamilyTreeElement extends WI.GeneralTreeElement
 {
     constructor(text)
     {
-        super([WebInspector.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName, "visual-style-font-family-list-item"], text);
+        super([WI.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName, "visual-style-font-family-list-item"], text);
 
         this._keywordEditor = document.createElement("input");
         this._keywordEditor.classList.add("visual-style-comma-separated-keyword-item-editor");
-        this._keywordEditor.placeholder = WebInspector.UIString("(modify the boxes below to add a value)");
+        this._keywordEditor.placeholder = WI.UIString("(modify the boxes below to add a value)");
         this._keywordEditor.spellcheck = false;
         this._keywordEditor.addEventListener("keydown", this._keywordEditorKeyDown.bind(this));
         this._keywordEditor.addEventListener("keyup", this._keywordEditorKeyUp.bind(this));
@@ -45,21 +45,21 @@
         if (this.keywordEditorHidden)
             return;
 
-        let bounds = WebInspector.Rect.rectFromClientRect(this._keywordEditor.getBoundingClientRect());
+        let bounds = WI.Rect.rectFromClientRect(this._keywordEditor.getBoundingClientRect());
         return bounds.pad(padding || 0);
     }
 
     updateMainTitle(text)
     {
         this.mainTitle = this._keywordEditor.value = text;
-        this._listItemNode.style.fontFamily = text + ", " + WebInspector.VisualStyleFontFamilyTreeElement.FontFamilyFallback;
+        this._listItemNode.style.fontFamily = text + ", " + WI.VisualStyleFontFamilyTreeElement.FontFamilyFallback;
 
         let hasText = text && text.length;
         this._listItemNode.classList.toggle("no-value", !hasText);
         if (!hasText)
             this.subtitle = this._keywordEditor.placeholder;
 
-        this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.KeywordChanged);
+        this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.KeywordChanged);
     }
 
     get currentlyEditing()
@@ -119,24 +119,24 @@
             return;
 
         let keyCode = event.keyCode;
-        let enterKeyCode = WebInspector.KeyboardShortcut.Key.Enter.keyCode;
+        let enterKeyCode = WI.KeyboardShortcut.Key.Enter.keyCode;
         if (keyCode === enterKeyCode) {
             this._listItemNode.classList.add("editor-hidden");
-            this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key: "Enter"});
+            this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key: "Enter"});
             return;
         }
 
-        let escapeKeyCode = WebInspector.KeyboardShortcut.Key.Escape.keyCode;
+        let escapeKeyCode = WI.KeyboardShortcut.Key.Escape.keyCode;
         if (keyCode === escapeKeyCode) {
-            this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key: "Escape"});
+            this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key: "Escape"});
             return;
         }
 
-        let tabKeyCode = WebInspector.KeyboardShortcut.Key.Tab.keyCode;
+        let tabKeyCode = WI.KeyboardShortcut.Key.Tab.keyCode;
         if (keyCode === tabKeyCode) {
             event.preventDefault();
             this._dontFireKeyUp = true;
-            this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key: "Tab"});
+            this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key: "Tab"});
             return;
         }
 
@@ -144,11 +144,11 @@
         if (key === "Up" || key === "Down") {
             event.preventDefault();
             this._dontFireKeyUp = true;
-            this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key});
+            this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown, {key});
             return;
         }
 
-        this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown);
+        this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown);
     }
 
     _keywordEditorKeyUp()
@@ -162,13 +162,13 @@
     _keywordEditorBlurred()
     {
         this.hideKeywordEditor();
-        this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorBlurred);
+        this.dispatchEventToListeners(WI.VisualStyleFontFamilyTreeElement.Event.EditorBlurred);
     }
 };
 
-WebInspector.VisualStyleFontFamilyTreeElement.FontFamilyFallback = "-apple-system, sans-serif";
+WI.VisualStyleFontFamilyTreeElement.FontFamilyFallback = "-apple-system, sans-serif";
 
-WebInspector.VisualStyleFontFamilyTreeElement.Event = {
+WI.VisualStyleFontFamilyTreeElement.Event = {
     KeywordChanged: "visual-style-font-family-tree-element-keyword-changed",
     EditorKeyDown: "visual-style-font-family-tree-element-editor-key-down",
     EditorBlurred: "visual-style-font-family-tree-element-editor-blurred"
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordCheckbox.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordCheckbox.js
index be415cf..c1f6d3d 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordCheckbox.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordCheckbox.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleKeywordCheckbox = class VisualStyleKeywordCheckbox extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleKeywordCheckbox = class VisualStyleKeywordCheckbox extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, value, layoutReversed)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js
index 9bf4e02..f2344d7 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleKeywordIconList = class VisualStyleKeywordIconList extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleKeywordIconList = class VisualStyleKeywordIconList extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, possibleValues, layoutReversed)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js
index 74fff01..798c874 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleKeywordPicker = class VisualStyleKeywordPicker extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleKeywordPicker = class VisualStyleKeywordPicker extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, possibleValues, layoutReversed)
     {
@@ -32,11 +32,11 @@
         this._keywordSelectElement = document.createElement("select");
         this._keywordSelectElement.classList.add("keyword-picker-select");
         if (this._possibleValues.advanced)
-            this._keywordSelectElement.title = WebInspector.UIString("Option-click to show all values");
+            this._keywordSelectElement.title = WI.UIString("Option-click to show all values");
 
         this._unchangedOptionElement = document.createElement("option");
         this._unchangedOptionElement.value = "";
-        this._unchangedOptionElement.text = WebInspector.UIString("Unchanged");
+        this._unchangedOptionElement.text = WI.UIString("Unchanged");
         this._keywordSelectElement.appendChild(this._unchangedOptionElement);
 
         this._keywordSelectElement.appendChild(document.createElement("hr"));
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js
index bd25393..3dee065 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleNumberInputBox = class VisualStyleNumberInputBox extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleNumberInputBox = class VisualStyleNumberInputBox extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, possibleValues, possibleUnits, allowNegativeValues, layoutReversed)
     {
-        let unitlessNumberUnit = WebInspector.UIString("Number");
+        let unitlessNumberUnit = WI.UIString("Number");
 
         super(propertyNames, text, possibleValues, possibleUnits || [unitlessNumberUnit], "number-input-box", layoutReversed);
 
@@ -46,11 +46,11 @@
         this._keywordSelectElement = document.createElement("select");
         this._keywordSelectElement.classList.add("number-input-keyword-select");
         if (this._possibleUnits.advanced)
-            this._keywordSelectElement.title = WebInspector.UIString("Option-click to show all units");
+            this._keywordSelectElement.title = WI.UIString("Option-click to show all units");
 
         this._unchangedOptionElement = document.createElement("option");
         this._unchangedOptionElement.value = "";
-        this._unchangedOptionElement.text = WebInspector.UIString("Unchanged");
+        this._unchangedOptionElement.text = WI.UIString("Unchanged");
         this._keywordSelectElement.appendChild(this._unchangedOptionElement);
 
         this._keywordSelectElement.appendChild(document.createElement("hr"));
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js
index 285868e..23153cc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStylePropertyCombiner = class VisualStylePropertyCombiner extends WebInspector.Object
+WI.VisualStylePropertyCombiner = class VisualStylePropertyCombiner extends WI.Object
 {
     constructor(propertyName, propertyEditors, spreadNumberValues)
     {
@@ -36,7 +36,7 @@
         this._spreadNumberValues = !!spreadNumberValues && this._propertyEditors.length >= 4;
 
         for (let editor of this._propertyEditors) {
-            editor.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, this._handlePropertyEditorValueChanged, this);
+            editor.addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, this._handlePropertyEditorValueChanged, this);
             editor.suppressStyleTextUpdate = true;
         }
 
@@ -81,7 +81,7 @@
         if (this._textContainsNameRegExp.test(text))
             text = text.replace(this._replacementRegExp, value !== null ? "$1$2: " + value + ";" : "$1");
         else if (value !== null)
-            text += WebInspector.VisualStylePropertyEditor.generateFormattedTextForNewProperty(text, this._propertyName, value);
+            text += WI.VisualStylePropertyEditor.generateFormattedTextForNewProperty(text, this._propertyName, value);
 
         return text;
     }
@@ -116,7 +116,7 @@
             return;
 
         for (let editor of this._propertyEditors)
-            editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol] = false;
+            editor[WI.VisualStylePropertyCombiner.EditorUpdatedSymbol] = false;
 
         function updateEditor(editor, value) {
             let updatedValues = editor.getValuesFromText(value || "", propertyMissing);
@@ -124,7 +124,7 @@
                 return;
 
             editor.updateEditorValues(updatedValues);
-            editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol] = true;
+            editor[WI.VisualStylePropertyCombiner.EditorUpdatedSymbol] = true;
         }
 
         if (this._spreadNumberValues) {
@@ -148,7 +148,7 @@
 
         function updateCompatibleEditor(value) {
             for (let editor of this._propertyEditors) {
-                if (value && !editor.valueIsCompatible(value) || editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol])
+                if (value && !editor.valueIsCompatible(value) || editor[WI.VisualStylePropertyCombiner.EditorUpdatedSymbol])
                     continue;
 
                 if (this._currentValueIsKeyword && editor.disabled)
@@ -197,8 +197,8 @@
             this._style.text = this.modifyPropertyText(this._style.text, value);
 
         this._propertyMissing = !value;
-        this.dispatchEventToListeners(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange);
+        this.dispatchEventToListeners(WI.VisualStylePropertyEditor.Event.ValueDidChange);
     }
 };
 
-WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol = Symbol("visual-style-property-combiner-editor-updated");
+WI.VisualStylePropertyCombiner.EditorUpdatedSymbol = Symbol("visual-style-property-combiner-editor-updated");
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js
index 85276dd..af9a835 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStylePropertyEditor = class VisualStylePropertyEditor extends WebInspector.Object
+WI.VisualStylePropertyEditor = class VisualStylePropertyEditor extends WI.Object
 {
     constructor(propertyNames, label, possibleValues, possibleUnits, className, layoutReversed)
     {
@@ -109,7 +109,7 @@
         }
 
         this._propertyReferenceName = propertyNames[0];
-        this._propertyReferenceText = WebInspector.VisualStyleDetailsPanel.propertyReferenceInfo[this._propertyReferenceName];
+        this._propertyReferenceText = WI.VisualStyleDetailsPanel.propertyReferenceInfo[this._propertyReferenceName];
         this._hasPropertyReference = this._propertyReferenceText && !!this._propertyReferenceText.trim().length;
         this._representedProperty = null;
     }
@@ -122,7 +122,7 @@
 
         styleText = styleText || "";
 
-        let linePrefixText = WebInspector.indentString();
+        let linePrefixText = WI.indentString();
         let lineSuffixWhitespace = "\n";
         let trimmedText = styleText.trimRight();
         let textHasNewlines = trimmedText.includes("\n");
@@ -291,7 +291,7 @@
 
             if (!propertyMissing && property && !property.valid) {
                 this._element.classList.add("invalid-value");
-                this._warningElement.title = WebInspector.UIString("The value “%s” is not supported for this property.").format(propertyText);
+                this._warningElement.title = WI.UIString("The value “%s” is not supported for this property.").format(propertyText);
                 this.specialPropertyPlaceholderElementText = propertyText;
                 return;
             }
@@ -305,7 +305,7 @@
 
             if (propertyValuesConflict) {
                 this._updatedValues.conflictingValues = true;
-                this.specialPropertyPlaceholderElementText = WebInspector.UIString("(multiple)");
+                this.specialPropertyPlaceholderElementText = WI.UIString("(multiple)");
                 break;
             }
         }
@@ -348,7 +348,7 @@
             if (property.textContainsNameRegExp.test(text))
                 text = text.replace(property.replacementRegExp, value !== null ? "$1$2: " + value + ";" : "$1");
             else if (value !== null)
-                text += WebInspector.VisualStylePropertyEditor.generateFormattedTextForNewProperty(text, property.name, value);
+                text += WI.VisualStylePropertyEditor.generateFormattedTextForNewProperty(text, property.name, value);
         }
         return text;
     }
@@ -502,7 +502,7 @@
         this._checkDependencies();
         this._element.classList.remove("invalid-value");
 
-        this.dispatchEventToListeners(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange);
+        this.dispatchEventToListeners(WI.VisualStylePropertyEditor.Event.ValueDidChange);
         return true;
     }
 
@@ -548,7 +548,7 @@
         }
 
         this._element.classList.toggle("missing-dependency", !!title.length);
-        this._warningElement.title = title.length ? WebInspector.UIString("Missing Dependencies:%s").format(title) : null;
+        this._warningElement.title = title.length ? WI.UIString("Missing Dependencies:%s").format(title) : null;
     }
 
     _titleElementPrepareForClick(event)
@@ -596,13 +596,13 @@
 
         propertyInfoElement.appendChild(document.createTextNode(this._propertyReferenceText));
 
-        let bounds = WebInspector.Rect.rectFromClientRect(this._titleElement.getBoundingClientRect());
-        let popover = new WebInspector.Popover(this);
+        let bounds = WI.Rect.rectFromClientRect(this._titleElement.getBoundingClientRect());
+        let popover = new WI.Popover(this);
         popover.content = propertyInfoElement;
-        popover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_Y]);
+        popover.present(bounds.pad(2), [WI.RectEdge.MIN_Y]);
         popover.windowResizeHandler = () => {
-            let bounds = WebInspector.Rect.rectFromClientRect(this._titleElement.getBoundingClientRect());
-            popover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_Y]);
+            let bounds = WI.Rect.rectFromClientRect(this._titleElement.getBoundingClientRect());
+            popover.present(bounds.pad(2), [WI.RectEdge.MIN_Y]);
         };
     }
 
@@ -612,6 +612,6 @@
     }
 };
 
-WebInspector.VisualStylePropertyEditor.Event = {
+WI.VisualStylePropertyEditor.Event = {
     ValueDidChange: "visual-style-property-editor-value-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditorLink.js b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditorLink.js
index 00d11fb..6bafc5f 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditorLink.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditorLink.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStylePropertyEditorLink = class VisualStylePropertyEditorLink extends WebInspector.Object
+WI.VisualStylePropertyEditorLink = class VisualStylePropertyEditorLink extends WI.Object
 {
     constructor(linkedProperties, className, linksToHideWhenLinked)
     {
@@ -34,7 +34,7 @@
         this._lastPropertyEdited = null;
 
         for (let property of this._linkedProperties)
-            property.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, this._linkedPropertyValueChanged, this);
+            property.addEventListener(WI.VisualStylePropertyEditor.Event.ValueDidChange, this._linkedPropertyValueChanged, this);
 
         this._element = document.createElement("div");
         this._element.classList.add("visual-style-property-editor-link", className || "");
@@ -45,7 +45,7 @@
 
         this._iconElement = document.createElement("div");
         this._iconElement.classList.add("visual-style-property-editor-link-icon");
-        this._iconElement.title = WebInspector.UIString("Click to link property values");
+        this._iconElement.title = WI.UIString("Click to link property values");
         this._iconElement.addEventListener("mouseover", this._iconMouseover.bind(this));
         this._iconElement.addEventListener("mouseout", this._iconMouseout.bind(this));
         this._iconElement.addEventListener("click", this._iconClicked.bind(this));
@@ -85,7 +85,7 @@
         if (this._unlinkedIcon)
             this._unlinkedIcon.hidden = this._linked;
 
-        this._iconElement.title = this._linked ? WebInspector.UIString("Remove link") : WebInspector.UIString("Link property values");
+        this._iconElement.title = this._linked ? WI.UIString("Remove link") : WI.UIString("Link property values");
 
         for (let linkToHide of this._linksToHideWhenLinked)
             linkToHide.disabled = this._linked;
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyNameInput.js b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyNameInput.js
index ea3697e..e88d3cb 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyNameInput.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyNameInput.js
@@ -23,21 +23,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStylePropertyNameInput = class VisualStylePropertyNameInput extends WebInspector.VisualStylePropertyEditor
+WI.VisualStylePropertyNameInput = class VisualStylePropertyNameInput extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, layoutReversed)
     {
         super(propertyNames, text, null, null, "property-name-input", layoutReversed);
 
         this._propertyNameInputElement = document.createElement("input");
-        this._propertyNameInputElement.placeholder = WebInspector.UIString("Enter property name");
+        this._propertyNameInputElement.placeholder = WI.UIString("Enter property name");
         this._propertyNameInputElement.addEventListener("keydown", this._inputKeyDown.bind(this));
         this._propertyNameInputElement.addEventListener("keyup", this.debounce(250)._inputKeyUp);
         this._propertyNameInputElement.addEventListener("blur", this._hideCompletions.bind(this));
         this.contentElement.appendChild(this._propertyNameInputElement);
 
-        this._completionController = new WebInspector.VisualStyleCompletionsController(this);
-        this._completionController.addEventListener(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected, this._completionClicked, this);
+        this._completionController = new WI.VisualStyleCompletionsController(this);
+        this._completionController.addEventListener(WI.VisualStyleCompletionsController.Event.CompletionSelected, this._completionClicked, this);
     }
 
     // Public
@@ -84,8 +84,8 @@
             return;
 
         let keyCode = event.keyCode;
-        let enterKeyCode = WebInspector.KeyboardShortcut.Key.Enter.keyCode;
-        let tabKeyCode = WebInspector.KeyboardShortcut.Key.Tab.keyCode;
+        let enterKeyCode = WI.KeyboardShortcut.Key.Enter.keyCode;
+        let tabKeyCode = WI.KeyboardShortcut.Key.Tab.keyCode;
         if (keyCode === enterKeyCode || keyCode === tabKeyCode) {
             this.value = this._completionController.currentCompletion;
             this._hideCompletions();
@@ -93,7 +93,7 @@
             return;
         }
 
-        let escapeKeyCode = WebInspector.KeyboardShortcut.Key.Escape.keyCode;
+        let escapeKeyCode = WI.KeyboardShortcut.Key.Escape.keyCode;
         if (keyCode === escapeKeyCode) {
             this._hideCompletions();
             return;
@@ -121,7 +121,7 @@
             return;
 
         if (this._completionController.update(this.value)) {
-            let bounds = WebInspector.Rect.rectFromClientRect(this._propertyNameInputElement.getBoundingClientRect());
+            let bounds = WI.Rect.rectFromClientRect(this._propertyNameInputElement.getBoundingClientRect());
             if (!bounds)
                 return;
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleRelativeNumberSlider.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleRelativeNumberSlider.js
index f155825..e43c855 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleRelativeNumberSlider.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleRelativeNumberSlider.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleRelativeNumberSlider = class VisualStyleRelativeNumberSlider extends WebInspector.VisualStyleNumberInputBox
+WI.VisualStyleRelativeNumberSlider = class VisualStyleRelativeNumberSlider extends WI.VisualStyleNumberInputBox
 {
     constructor(propertyNames, text, possibleValues, possibleUnits, allowNegativeValues, layoutReversed)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js
index 2bba415..322b316 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleSelectorSection = class VisualStyleSelectorSection extends WebInspector.DetailsSection
+WI.VisualStyleSelectorSection = class VisualStyleSelectorSection extends WI.DetailsSection
 {
     constructor()
     {
@@ -33,7 +33,7 @@
         let controlElement = document.createElement("div");
         controlElement.classList.add("controls");
 
-        super("visual-style-selector-section", WebInspector.UIString("Style Rules"), [selectorSection], controlElement);
+        super("visual-style-selector-section", WI.UIString("Style Rules"), [selectorSection], controlElement);
 
         this._nodeStyles = null;
 
@@ -53,13 +53,13 @@
         selectorListElement.classList.add("selector-list");
         selectorSection.element.appendChild(selectorListElement);
 
-        this._selectors = new WebInspector.TreeOutline(selectorListElement);
+        this._selectors = new WI.TreeOutline(selectorListElement);
         this._selectors.disclosureButtons = false;
-        this._selectors.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._selectorChanged, this);
+        this._selectors.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._selectorChanged, this);
 
         this._newInspectorRuleSelector = null;
 
-        let addGlyphElement = useSVGSymbol("Images/Plus13.svg", "visual-style-selector-section-add-rule", WebInspector.UIString("Add new rule"));
+        let addGlyphElement = useSVGSymbol("Images/Plus13.svg", "visual-style-selector-section-add-rule", WI.UIString("Add new rule"));
         addGlyphElement.addEventListener("click", this._addNewRuleClick.bind(this));
         addGlyphElement.addEventListener("contextmenu", this._addNewRuleContextMenu.bind(this));
         controlElement.appendChild(addGlyphElement);
@@ -74,7 +74,7 @@
     {
         let style = this.currentStyle();
         if (style)
-            this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol] = style;
+            this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol] = style;
 
         if (nodeStyles)
             this._nodeStyles = nodeStyles;
@@ -97,19 +97,19 @@
             orderedPseudoRules.reverse();
 
         function createSelectorItem(style, title, subtitle) {
-            let selector = new WebInspector.VisualStyleSelectorTreeItem(this, style, title, subtitle);
-            selector.addEventListener(WebInspector.VisualStyleSelectorTreeItem.Event.CheckboxChanged, this._treeElementCheckboxToggled, this);
+            let selector = new WI.VisualStyleSelectorTreeItem(this, style, title, subtitle);
+            selector.addEventListener(WI.VisualStyleSelectorTreeItem.Event.CheckboxChanged, this._treeElementCheckboxToggled, this);
             this._selectors.appendChild(selector);
 
             if (style.isInspectorRule() && this._newInspectorRuleSelector === style.selectorText && !style.hasProperties()) {
                 selector.select(true);
                 selector.element.scrollIntoView();
-                this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol] = style;
+                this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol] = style;
                 this._newInspectorRuleSelector = null;
                 return;
             }
 
-            if (this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol] === style) {
+            if (this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol] === style) {
                 selector.select(true);
                 selector.element.scrollIntoView();
             }
@@ -156,17 +156,17 @@
         }
 
         if (this._nodeStyles.inlineStyle) {
-            if (!this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol])
-                this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol] = this._nodeStyles.inlineStyle;
+            if (!this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol])
+                this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol] = this._nodeStyles.inlineStyle;
 
             // Inline Style
-            createSelectorItem.call(this, this._nodeStyles.inlineStyle, WebInspector.UIString("This Element"));
-        } else if (!this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol])
-            this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol] = this._nodeStyles.matchedRules[0].style;
+            createSelectorItem.call(this, this._nodeStyles.inlineStyle, WI.UIString("This Element"));
+        } else if (!this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol])
+            this._nodeStyles[WI.VisualStyleSelectorSection.LastSelectedRuleSymbol] = this._nodeStyles.matchedRules[0].style;
 
         // Matched Rules
         for (let rule of uniqueOrderedRules(this._nodeStyles.matchedRules)) {
-            if (rule.type === WebInspector.CSSStyleSheet.Type.UserAgent) {
+            if (rule.type === WI.CSSStyleSheet.Type.UserAgent) {
                 insertAllMatchingPseudoRules.call(this, true);
                 continue;
             }
@@ -187,12 +187,12 @@
             let divider = null;
 
             for (let rule of uniqueOrderedRules(inherited.matchedRules)) {
-                if (rule.type === WebInspector.CSSStyleSheet.Type.UserAgent)
+                if (rule.type === WI.CSSStyleSheet.Type.UserAgent)
                     continue;
 
                 if (!divider) {
-                    let dividerText = WebInspector.UIString("Inherited from %s").format(inherited.node.displayName);
-                    divider = new WebInspector.GeneralTreeElement("section-divider", dividerText);
+                    let dividerText = WI.UIString("Inherited from %s").format(inherited.node.displayName);
+                    divider = new WI.GeneralTreeElement("section-divider", dividerText);
                     divider.selectable = false;
                     this._selectors.appendChild(divider);
                 }
@@ -254,7 +254,7 @@
 
         this._currentSelectorText.textContent = selectorText;
 
-        this.dispatchEventToListeners(WebInspector.VisualStyleSelectorSection.Event.SelectorChanged);
+        this.dispatchEventToListeners(WI.VisualStyleSelectorSection.Event.SelectorChanged);
     }
 
     _addNewRuleClick(event)
@@ -278,15 +278,15 @@
         if (!this._nodeStyles || this._nodeStyles.node.isInUserAgentShadowTree())
             return;
 
-        let styleSheets = WebInspector.cssStyleManager.styleSheets.filter(styleSheet => styleSheet.hasInfo() && !styleSheet.isInlineStyleTag() && !styleSheet.isInlineStyleAttributeStyleSheet());
+        let styleSheets = WI.cssStyleManager.styleSheets.filter(styleSheet => styleSheet.hasInfo() && !styleSheet.isInlineStyleTag() && !styleSheet.isInlineStyleAttributeStyleSheet());
         if (!styleSheets.length)
             return;
 
-        let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
+        let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         const handler = null;
         const disabled = true;
-        contextMenu.appendItem(WebInspector.UIString("Available Style Sheets"), handler, disabled);
+        contextMenu.appendItem(WI.UIString("Available Style Sheets"), handler, disabled);
 
         for (let styleSheet of styleSheets) {
             contextMenu.appendItem(styleSheet.displayName, () => {
@@ -315,8 +315,8 @@
             newStyleText = "/* " + styleText.replace(/(\s*;(?!$)\s*)/g, "$1 *//* ") + " */";
 
         style.text = newStyleText;
-        style[WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol] = !styleEnabled;
-        this.dispatchEventToListeners(WebInspector.VisualStyleSelectorSection.Event.SelectorChanged);
+        style[WI.VisualStyleDetailsPanel.StyleDisabledSymbol] = !styleEnabled;
+        this.dispatchEventToListeners(WI.VisualStyleSelectorSection.Event.SelectorChanged);
 
     }
 
@@ -330,11 +330,11 @@
             return;
 
         if (!style.ownerRule) {
-            WebInspector.domTreeManager.highlightDOMNode(style.node.id);
+            WI.domTreeManager.highlightDOMNode(style.node.id);
             return;
         }
 
-        WebInspector.domTreeManager.highlightSelector(style.ownerRule.selectorText, style.node.ownerDocument.frameIdentifier);
+        WI.domTreeManager.highlightSelector(style.ownerRule.selectorText, style.node.ownerDocument.frameIdentifier);
     }
 
     _handleMouseOut()
@@ -342,12 +342,12 @@
         if (!this.collapsed)
             return;
 
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
     }
 };
 
-WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol = Symbol("visual-style-selector-section-last-selected-rule");
+WI.VisualStyleSelectorSection.LastSelectedRuleSymbol = Symbol("visual-style-selector-section-last-selected-rule");
 
-WebInspector.VisualStyleSelectorSection.Event = {
+WI.VisualStyleSelectorSection.Event = {
     SelectorChanged: "visual-style-selector-section-selector-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js
index c044d2f..d9bec5a 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js
@@ -23,39 +23,39 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleSelectorTreeItem = class VisualStyleSelectorTreeItem extends WebInspector.GeneralTreeElement
+WI.VisualStyleSelectorTreeItem = class VisualStyleSelectorTreeItem extends WI.GeneralTreeElement
 {
     constructor(delegate, style, title, subtitle)
     {
         let iconClassName;
         switch (style.type) {
-        case WebInspector.CSSStyleDeclaration.Type.Rule:
-            console.assert(style.ownerRule instanceof WebInspector.CSSRule, style.ownerRule);
+        case WI.CSSStyleDeclaration.Type.Rule:
+            console.assert(style.ownerRule instanceof WI.CSSRule, style.ownerRule);
 
             if (style.inherited)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.Author)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.User)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.UserAgent)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;
-            else if (style.ownerRule.type === WebInspector.CSSStyleSheet.Type.Inspector)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;
+                iconClassName = WI.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.Author)
+                iconClassName = WI.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.User)
+                iconClassName = WI.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent)
+                iconClassName = WI.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WI.CSSStyleSheet.Type.Inspector)
+                iconClassName = WI.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;
             break;
 
-        case WebInspector.CSSStyleDeclaration.Type.Inline:
-        case WebInspector.CSSStyleDeclaration.Type.Attribute:
+        case WI.CSSStyleDeclaration.Type.Inline:
+        case WI.CSSStyleDeclaration.Type.Attribute:
             if (style.inherited)
-                iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;
+                iconClassName = WI.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;
             else
-                iconClassName = WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
+                iconClassName = WI.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
             break;
         }
 
         let iconClasses = [iconClassName];
         if (style.ownerRule && style.ownerRule.hasMatchedPseudoElementSelector())
-            iconClasses.push(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName);
+            iconClasses.push(WI.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName);
 
         title = title.trim();
 
@@ -96,7 +96,7 @@
 
         this._checkboxElement = document.createElement("input");
         this._checkboxElement.type = "checkbox";
-        this._checkboxElement.checked = !this.representedObject[WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol];
+        this._checkboxElement.checked = !this.representedObject[WI.VisualStyleDetailsPanel.StyleDisabledSymbol];
         this._updateCheckboxTitle();
         this._checkboxElement.addEventListener("change", this._handleCheckboxChanged.bind(this));
         this._listItemNode.insertBefore(this._checkboxElement, this._iconElement);
@@ -109,9 +109,9 @@
         this._mainTitleElement.addEventListener("keyup", this._highlightNodesWithSelector.bind(this));
         this._mainTitleElement.addEventListener("blur", this._commitSelector.bind(this));
 
-        this.representedObject.addEventListener(WebInspector.CSSStyleDeclaration.Event.InitialTextModified, this._styleTextModified, this);
+        this.representedObject.addEventListener(WI.CSSStyleDeclaration.Event.InitialTextModified, this._styleTextModified, this);
         if (this.representedObject.ownerRule)
-            this.representedObject.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._updateSelectorIcon, this);
+            this.representedObject.ownerRule.addEventListener(WI.CSSRule.Event.SelectorChanged, this._updateSelectorIcon, this);
 
         this._styleTextModified();
     }
@@ -124,12 +124,12 @@
 
     populateContextMenu(contextMenu, event)
     {
-        contextMenu.appendItem(WebInspector.UIString("Copy Rule"), () => {
+        contextMenu.appendItem(WI.UIString("Copy Rule"), () => {
             InspectorFrontendHost.copyText(this.representedObject.generateCSSRuleString());
         });
 
         if (this.representedObject.modified) {
-            contextMenu.appendItem(WebInspector.UIString("Reset"), () => {
+            contextMenu.appendItem(WI.UIString("Reset"), () => {
                 this.representedObject.resetText();
             });
         }
@@ -137,32 +137,32 @@
         if (!this.representedObject.ownerRule)
             return;
 
-        contextMenu.appendItem(WebInspector.UIString("Show Source"), () => {
+        contextMenu.appendItem(WI.UIString("Show Source"), () => {
             const options = {
                 ignoreNetworkTab: true,
                 ignoreSearchTab: true,
             };
 
             if (event.metaKey)
-                WebInspector.showOriginalUnformattedSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation, options);
+                WI.showOriginalUnformattedSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation, options);
             else
-                WebInspector.showSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation, options);
+                WI.showSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation, options);
         });
 
         // Only used one colon temporarily since single-colon pseudo elements are valid CSS.
-        if (WebInspector.CSSStyleManager.PseudoElementNames.some((className) => this.representedObject.selectorText.includes(":" + className)))
+        if (WI.CSSStyleManager.PseudoElementNames.some((className) => this.representedObject.selectorText.includes(":" + className)))
             return;
 
-        if (WebInspector.CSSStyleManager.ForceablePseudoClasses.every((className) => !this.representedObject.selectorText.includes(":" + className))) {
+        if (WI.CSSStyleManager.ForceablePseudoClasses.every((className) => !this.representedObject.selectorText.includes(":" + className))) {
             contextMenu.appendSeparator();
 
-            for (let pseudoClass of WebInspector.CSSStyleManager.ForceablePseudoClasses) {
+            for (let pseudoClass of WI.CSSStyleManager.ForceablePseudoClasses) {
                 if (pseudoClass === "visited" && this.representedObject.node.nodeName() !== "A")
                     continue;
 
                 let pseudoClassSelector = ":" + pseudoClass;
 
-                contextMenu.appendItem(WebInspector.UIString("Add %s Rule").format(pseudoClassSelector), () => {
+                contextMenu.appendItem(WI.UIString("Add %s Rule").format(pseudoClassSelector), () => {
                     this.representedObject.node.setPseudoClassEnabled(pseudoClass, true);
                     let pseudoSelectors = this.representedObject.ownerRule.selectors.map((selector) => selector.text + pseudoClassSelector);
                     this.representedObject.nodeStyles.addRule(pseudoSelectors.join(", "));
@@ -172,7 +172,7 @@
 
         contextMenu.appendSeparator();
 
-        for (let pseudoElement of WebInspector.CSSStyleManager.PseudoElementNames) {
+        for (let pseudoElement of WI.CSSStyleManager.PseudoElementNames) {
             let pseudoElementSelector = "::" + pseudoElement;
             const styleText = "content: \"\";";
 
@@ -188,7 +188,7 @@
                 }
             }
 
-            let title = existingTreeItem ? WebInspector.UIString("Select %s Rule") : WebInspector.UIString("Create %s Rule");
+            let title = existingTreeItem ? WI.UIString("Select %s Rule") : WI.UIString("Create %s Rule");
             contextMenu.appendItem(title.format(pseudoElementSelector), () => {
                 if (existingTreeItem) {
                     existingTreeItem.select(true, true);
@@ -208,30 +208,30 @@
     _highlightNodesWithSelector()
     {
         if (!this.representedObject.ownerRule) {
-            WebInspector.domTreeManager.highlightDOMNode(this.representedObject.node.id);
+            WI.domTreeManager.highlightDOMNode(this.representedObject.node.id);
             return;
         }
 
-        WebInspector.domTreeManager.highlightSelector(this.selectorText, this.representedObject.node.ownerDocument.frameIdentifier);
+        WI.domTreeManager.highlightSelector(this.selectorText, this.representedObject.node.ownerDocument.frameIdentifier);
     }
 
     _hideDOMNodeHighlight()
     {
-        WebInspector.domTreeManager.hideDOMNodeHighlight();
+        WI.domTreeManager.hideDOMNodeHighlight();
     }
 
     _handleCheckboxChanged(event)
     {
         this._updateCheckboxTitle();
-        this.dispatchEventToListeners(WebInspector.VisualStyleSelectorTreeItem.Event.CheckboxChanged, {enabled: this._checkboxElement.checked});
+        this.dispatchEventToListeners(WI.VisualStyleSelectorTreeItem.Event.CheckboxChanged, {enabled: this._checkboxElement.checked});
     }
 
     _updateCheckboxTitle()
     {
         if (this._checkboxElement.checked)
-            this._checkboxElement.title = WebInspector.UIString("Comment out rule");
+            this._checkboxElement.title = WI.UIString("Comment out rule");
         else
-            this._checkboxElement.title = WebInspector.UIString("Uncomment rule");
+            this._checkboxElement.title = WI.UIString("Uncomment rule");
     }
 
     _handleMainTitleMouseDown(event)
@@ -247,7 +247,7 @@
     {
         this._highlightNodesWithSelector();
 
-        let enterKeyCode = WebInspector.KeyboardShortcut.Key.Enter.keyCode;
+        let enterKeyCode = WI.KeyboardShortcut.Key.Enter.keyCode;
         if (event.keyCode === enterKeyCode)
             this._mainTitleElement.blur();
     }
@@ -276,8 +276,8 @@
         this._hasInvalidSelector = event && event.data && !event.data.valid;
         this._listItemNode.classList.toggle("selector-invalid", !!this._hasInvalidSelector);
         if (this._hasInvalidSelector) {
-            this._iconElement.title = WebInspector.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this.selectorText);
-            this.mainTitleElement.title = WebInspector.UIString("Using previous selector “%s”").format(this.representedObject.ownerRule.selectorText);
+            this._iconElement.title = WI.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this.selectorText);
+            this.mainTitleElement.title = WI.UIString("Using previous selector “%s”").format(this.representedObject.ownerRule.selectorText);
             return;
         }
 
@@ -285,7 +285,7 @@
         this.mainTitleElement.title = null;
 
         let hasMatchedPseudoElementSelector = this.representedObject.ownerRule && this.representedObject.ownerRule.hasMatchedPseudoElementSelector();
-        this._iconClasses.toggleIncludes(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName, hasMatchedPseudoElementSelector);
+        this._iconClasses.toggleIncludes(WI.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName, hasMatchedPseudoElementSelector);
     }
 
     _handleIconElementClicked(event)
@@ -298,6 +298,6 @@
     }
 };
 
-WebInspector.VisualStyleSelectorTreeItem.Event = {
+WI.VisualStyleSelectorTreeItem.Event = {
     CheckboxChanged: "visual-style-selector-item-checkbox-changed"
 };
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleTabbedPropertiesRow.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleTabbedPropertiesRow.js
index 63bdbb2..77e5594 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleTabbedPropertiesRow.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleTabbedPropertiesRow.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleTabbedPropertiesRow = class VisualStyleTabbedPropertiesRow extends WebInspector.DetailsSectionRow
+WI.VisualStyleTabbedPropertiesRow = class VisualStyleTabbedPropertiesRow extends WI.DetailsSectionRow
 {
     constructor(tabMap)
     {
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleTimingEditor.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleTimingEditor.js
index f9d0ecb..3841c85 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleTimingEditor.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleTimingEditor.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleTimingEditor = class VisualStyleTimingEditor extends WebInspector.VisualStyleKeywordPicker
+WI.VisualStyleTimingEditor = class VisualStyleTimingEditor extends WI.VisualStyleKeywordPicker
 {
     constructor(propertyNames, text, possibleValues, layoutReversed)
     {
@@ -35,18 +35,18 @@
 
         this._customBezierOptionElement = this._keywordSelectElement.createChild("option");
         this._customBezierOptionElement.value = "bezier";
-        this._customBezierOptionElement.text = WebInspector.UIString("Bezier");
+        this._customBezierOptionElement.text = WI.UIString("Bezier");
 
         this._customSpringOptionElement = this._keywordSelectElement.createChild("option");
         this._customSpringOptionElement.value = "spring";
-        this._customSpringOptionElement.text = WebInspector.UIString("Spring");
+        this._customSpringOptionElement.text = WI.UIString("Spring");
 
-        this._bezierSwatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Bezier);
-        this._bezierSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._bezierSwatchValueChanged, this);
+        this._bezierSwatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Bezier);
+        this._bezierSwatch.addEventListener(WI.InlineSwatch.Event.ValueChanged, this._bezierSwatchValueChanged, this);
         this.contentElement.appendChild(this._bezierSwatch.element);
 
-        this._springSwatch = new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Spring);
-        this._springSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._springSwatchValueChanged, this);
+        this._springSwatch = new WI.InlineSwatch(WI.InlineSwatch.Type.Spring);
+        this._springSwatch.addEventListener(WI.InlineSwatch.Event.ValueChanged, this._springSwatchValueChanged, this);
         this.contentElement.appendChild(this._springSwatch.element);
     }
 
@@ -115,7 +115,7 @@
 
     set _bezierValue(text)
     {
-        this._bezierSwatch.value = WebInspector.CubicBezier.fromString(text);
+        this._bezierSwatch.value = WI.CubicBezier.fromString(text);
     }
 
     get _springValue()
@@ -129,7 +129,7 @@
 
     set _springValue(text)
     {
-        this._springSwatch.value = WebInspector.Spring.fromString(text);
+        this._springSwatch.value = WI.Spring.fromString(text);
     }
 
     _handleKeywordChanged()
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js
index f6ec6d7..2d56262 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleURLInput = class VisualStyleURLInput extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleURLInput = class VisualStyleURLInput extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, text, possibleValues, layoutReversed)
     {
@@ -31,7 +31,7 @@
 
         this._urlInputElement = document.createElement("input");
         this._urlInputElement.type = "url";
-        this._urlInputElement.placeholder = WebInspector.UIString("Enter a URL");
+        this._urlInputElement.placeholder = WI.UIString("Enter a URL");
         this._urlInputElement.addEventListener("keyup", this.debounce(250)._valueDidChange);
         this.contentElement.appendChild(this._urlInputElement);
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js b/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js
index f6fabaa..09237a2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js
+++ b/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js
@@ -23,13 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.VisualStyleUnitSlider = class VisualStyleUnitSlider extends WebInspector.VisualStylePropertyEditor
+WI.VisualStyleUnitSlider = class VisualStyleUnitSlider extends WI.VisualStylePropertyEditor
 {
     constructor(propertyNames, label, layoutReversed)
     {
         super(propertyNames, label, null, null, "unit-slider", layoutReversed);
 
-        this._slider = new WebInspector.Slider;
+        this._slider = new WI.Slider;
         this._slider.delegate = this;
         this.contentElement.appendChild(this._slider.element);
     }
diff --git a/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js
index c86154b..0a8ea64 100644
--- a/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WebSocketContentView = class WebSocketContentView extends WebInspector.ContentView
+WI.WebSocketContentView = class WebSocketContentView extends WI.ContentView
 {
     constructor(resource)
     {
-        console.assert(resource instanceof WebInspector.WebSocketResource, resource);
+        console.assert(resource instanceof WI.WebSocketResource, resource);
 
         super(resource);
 
@@ -41,18 +41,18 @@
         this.element.classList.add("web-socket", "resource");
 
         let columns = {data: {}};
-        columns.data.title = WebInspector.UIString("Data");
+        columns.data.title = WI.UIString("Data");
         columns.data.sortable = false;
         columns.data.width = "85%";
 
         if (this._showTimeColumn)
-            columns.time = {title: WebInspector.UIString("Time"), sortable: true};
+            columns.time = {title: WI.UIString("Time"), sortable: true};
 
-        this._dataGrid = new WebInspector.DataGrid(columns);
+        this._dataGrid = new WI.DataGrid(columns);
         this._dataGrid.variableHeightRows = true;
         this.addSubview(this._dataGrid);
 
-        this._addRow(WebInspector.UIString("WebSocket Connection Established"), this._resource.walltime);
+        this._addRow(WI.UIString("WebSocket Connection Established"), this._resource.walltime);
 
         this._dataGrid.updateLayout();
     }
@@ -62,18 +62,18 @@
     static textForOpcode(opcode)
     {
         switch (opcode) {
-        case WebInspector.WebSocketResource.OpCodes.ContinuationFrame:
-            return WebInspector.UIString("Continuation Frame");
-        case WebInspector.WebSocketResource.OpCodes.TextFrame:
-            return WebInspector.UIString("Text Frame");
-        case WebInspector.WebSocketResource.OpCodes.BinaryFrame:
-            return WebInspector.UIString("Binary Frame");
-        case WebInspector.WebSocketResource.OpCodes.ConnectionCloseFrame:
-            return WebInspector.UIString("Connection Close Frame");
-        case WebInspector.WebSocketResource.OpCodes.PingFrame:
-            return WebInspector.UIString("Ping Frame");
-        case WebInspector.WebSocketResource.OpCodes.PongFrame:
-            return WebInspector.UIString("Pong Frame");
+        case WI.WebSocketResource.OpCodes.ContinuationFrame:
+            return WI.UIString("Continuation Frame");
+        case WI.WebSocketResource.OpCodes.TextFrame:
+            return WI.UIString("Text Frame");
+        case WI.WebSocketResource.OpCodes.BinaryFrame:
+            return WI.UIString("Binary Frame");
+        case WI.WebSocketResource.OpCodes.ConnectionCloseFrame:
+            return WI.UIString("Connection Close Frame");
+        case WI.WebSocketResource.OpCodes.PingFrame:
+            return WI.UIString("Ping Frame");
+        case WI.WebSocketResource.OpCodes.PongFrame:
+            return WI.UIString("Pong Frame");
         }
     }
 
@@ -82,14 +82,14 @@
     shown()
     {
         this._updateFrames();
-        this._resource.addEventListener(WebInspector.WebSocketResource.Event.FrameAdded, this._updateFramesSoon, this);
-        this._resource.addEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged, this._updateFramesSoon, this);
+        this._resource.addEventListener(WI.WebSocketResource.Event.FrameAdded, this._updateFramesSoon, this);
+        this._resource.addEventListener(WI.WebSocketResource.Event.ReadyStateChanged, this._updateFramesSoon, this);
     }
 
     hidden()
     {
-        this._resource.removeEventListener(WebInspector.WebSocketResource.Event.FrameAdded, this._updateFramesSoon, this);
-        this._resource.removeEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged, this._updateFramesSoon, this);
+        this._resource.removeEventListener(WI.WebSocketResource.Event.FrameAdded, this._updateFramesSoon, this);
+        this._resource.removeEventListener(WI.WebSocketResource.Event.ReadyStateChanged, this._updateFramesSoon, this);
     }
 
     // Private
@@ -113,8 +113,8 @@
         this._framesRendered = framesLength;
 
         if (this._lastRenderedReadyState !== this._resource.readyState) {
-            if (this._resource.readyState === WebInspector.WebSocketResource.ReadyState.Closed)
-                this._dataGrid.appendChild(new WebInspector.SpanningDataGridNode(WebInspector.UIString("Connection Closed")));
+            if (this._resource.readyState === WI.WebSocketResource.ReadyState.Closed)
+                this._dataGrid.appendChild(new WI.SpanningDataGridNode(WI.UIString("Connection Closed")));
 
             this._lastRenderedReadyState = this._resource.readyState;
         }
@@ -126,11 +126,11 @@
     _addFrame(data, isOutgoing, opcode, time)
     {
         let nodeText;
-        let isText = opcode === WebInspector.WebSocketResource.OpCodes.TextFrame;
+        let isText = opcode === WI.WebSocketResource.OpCodes.TextFrame;
         if (isText)
             nodeText = data;
         else
-            nodeText = WebInspector.WebSocketContentView.textForOpcode(opcode);
+            nodeText = WI.WebSocketContentView.textForOpcode(opcode);
 
         this._addRow(nodeText, time, {isOutgoing, isText});
     }
@@ -139,9 +139,9 @@
     {
         let node;
         if (this._showTimeColumn)
-            node = new WebInspector.WebSocketDataGridNode(Object.shallowMerge({data, time}, attributes));
+            node = new WI.WebSocketDataGridNode(Object.shallowMerge({data, time}, attributes));
         else
-            node = new WebInspector.WebSocketDataGridNode(Object.shallowMerge({data}, attributes));
+            node = new WI.WebSocketDataGridNode(Object.shallowMerge({data}, attributes));
 
         this._dataGrid.appendChild(node);
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/WebSocketDataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/WebSocketDataGridNode.js
index 780b781..d4a00d0 100644
--- a/Source/WebInspectorUI/UserInterface/Views/WebSocketDataGridNode.js
+++ b/Source/WebInspectorUI/UserInterface/Views/WebSocketDataGridNode.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WebSocketDataGridNode = class WebSocketDataGridNode extends WebInspector.DataGridNode
+WI.WebSocketDataGridNode = class WebSocketDataGridNode extends WI.DataGridNode
 {
     // Public
 
@@ -32,7 +32,7 @@
         if (columnIdentifier === "data") {
             let fragment = document.createDocumentFragment();
             if (this._data.isOutgoing) {
-                let iconElement = useSVGSymbol("Images/ArrowUp.svg", "icon", WebInspector.UIString("Outgoing message"));
+                let iconElement = useSVGSymbol("Images/ArrowUp.svg", "icon", WI.UIString("Outgoing message"));
                 fragment.appendChild(iconElement);
             }
             fragment.appendChild(document.createTextNode(this._data.data));
@@ -52,16 +52,16 @@
         let logResult = (result, wasThrown, savedResultIndex) => {
             console.assert(!wasThrown);
 
-            const title = WebInspector.UIString("Selected Frame");
+            const title = WI.UIString("Selected Frame");
             const addSpecialUserLogClass = true;
             const shouldRevealConsole = true;
-            WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(title, result, addSpecialUserLogClass, shouldRevealConsole);
+            WI.consoleLogViewController.appendImmediateExecutionWithResult(title, result, addSpecialUserLogClass, shouldRevealConsole);
         };
 
         if (this._data.isText) {
-            let remoteObject = WebInspector.RemoteObject.fromPrimitiveValue(this._data.data);
-            contextMenu.appendItem(WebInspector.UIString("Log Frame Text"), () => {
-                WebInspector.runtimeManager.saveResult(remoteObject, (savedResultIndex) => {
+            let remoteObject = WI.RemoteObject.fromPrimitiveValue(this._data.data);
+            contextMenu.appendItem(WI.UIString("Log Frame Text"), () => {
+                WI.runtimeManager.saveResult(remoteObject, (savedResultIndex) => {
                     logResult(remoteObject, false, savedResultIndex);
                 });
             });
@@ -71,16 +71,16 @@
                 // We still need to execute this, however, in order to try-catch if it fails.
                 JSON.parse(this._data.data);
 
-                contextMenu.appendItem(WebInspector.UIString("Log Frame Value"), () => {
+                contextMenu.appendItem(WI.UIString("Log Frame Value"), () => {
                     const options = {
-                        objectGroup: WebInspector.RuntimeManager.ConsoleObjectGroup,
+                        objectGroup: WI.RuntimeManager.ConsoleObjectGroup,
                         generatePreview: true,
                         saveResult: true,
                         doNotPauseOnExceptionsAndMuteConsole: true,
                     };
 
                     let expression = "(" + this._data.data + ")";
-                    WebInspector.runtimeManager.evaluateInInspectedWindow(expression, options, logResult);
+                    WI.runtimeManager.evaluateInInspectedWindow(expression, options, logResult);
                 });
             } catch (error) { }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js
index 0f5aa05..1c0ce88 100644
--- a/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.WebSocketResourceTreeElement = class WebSocketResourceTreeElement extends WebInspector.ResourceTreeElement
+WI.WebSocketResourceTreeElement = class WebSocketResourceTreeElement extends WI.ResourceTreeElement
 {
     // Overrides from TreeElement
 
@@ -33,26 +33,26 @@
 
         this._updateConnectionStatus();
 
-        this.resource.addEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged, this._updateConnectionStatus, this);
+        this.resource.addEventListener(WI.WebSocketResource.Event.ReadyStateChanged, this._updateConnectionStatus, this);
     }
 
     ondetach()
     {
         super.ondetach();
 
-        this.resource.removeEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged, this._updateConnectionStatus, this);
+        this.resource.removeEventListener(WI.WebSocketResource.Event.ReadyStateChanged, this._updateConnectionStatus, this);
     }
 
     populateContextMenu(contextMenu, event)
     {
-        contextMenu.appendItem(WebInspector.UIString("Log WebSocket"), () => {
-            WebInspector.RemoteObject.resolveWebSocket(this._resource, WebInspector.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
+        contextMenu.appendItem(WI.UIString("Log WebSocket"), () => {
+            WI.RemoteObject.resolveWebSocket(this._resource, WI.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
                 if (!remoteObject)
                     return;
 
-                const text = WebInspector.UIString("Selected WebSocket");
+                const text = WI.UIString("Selected WebSocket");
                 const addSpecialUserLogClass = true;
-                WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
+                WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
             });
         });
 
@@ -66,22 +66,22 @@
     _updateConnectionStatus()
     {
         switch (this.resource.readyState) {
-        case WebInspector.WebSocketResource.ReadyState.Closed:
+        case WI.WebSocketResource.ReadyState.Closed:
             this.status = "";
             break;
 
-        case WebInspector.WebSocketResource.ReadyState.Connecting:
+        case WI.WebSocketResource.ReadyState.Connecting:
             var connectionIndicatorElement = document.createElement("div");
             connectionIndicatorElement.classList.add("ready-state", "connecting");
-            connectionIndicatorElement.title = WebInspector.UIString("Connecting");
+            connectionIndicatorElement.title = WI.UIString("Connecting");
 
             this.status = connectionIndicatorElement;
             break;
 
-        case WebInspector.WebSocketResource.ReadyState.Open:
+        case WI.WebSocketResource.ReadyState.Open:
             var connectionIndicatorElement = document.createElement("div");
             connectionIndicatorElement.classList.add("ready-state", "open");
-            connectionIndicatorElement.title = WebInspector.UIString("Open");
+            connectionIndicatorElement.title = WI.UIString("Open");
 
             this.status = connectionIndicatorElement;
             break;
diff --git a/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js
index d2d3de6..1088ba4 100644
--- a/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js
@@ -26,32 +26,32 @@
 // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
 // When we are guaranteed a Resource and not a Script we can extend ResourceTreeElement.
 
-WebInspector.WorkerTreeElement = class WorkerTreeElement extends WebInspector.ScriptTreeElement
+WI.WorkerTreeElement = class WorkerTreeElement extends WI.ScriptTreeElement
 {
     constructor(target)
     {
         super(target.mainResource);
 
-        console.assert(target instanceof WebInspector.Target);
-        console.assert(target.type === WebInspector.Target.Type.Worker);
-        console.assert(target.mainResource instanceof WebInspector.Script);
+        console.assert(target instanceof WI.Target);
+        console.assert(target.type === WI.Target.Type.Worker);
+        console.assert(target.mainResource instanceof WI.Script);
 
         this._target = target;
-        this._target.addEventListener(WebInspector.Target.Event.ResourceAdded, this._resourceAdded, this);
-        this._target.addEventListener(WebInspector.Target.Event.ScriptAdded, this._scriptAdded, this);
+        this._target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceAdded, this);
+        this._target.addEventListener(WI.Target.Event.ScriptAdded, this._scriptAdded, this);
 
-        this._expandedSetting = new WebInspector.Setting("worker-expanded-" + this._target.name.hash, true);
+        this._expandedSetting = new WI.Setting("worker-expanded-" + this._target.name.hash, true);
 
         // Scripts are top level.
-        this.registerFolderizeSettings("scripts", null, this._target.resourceCollection.resourceCollectionForType(WebInspector.Resource.Type.Script), WebInspector.ResourceTreeElement);
-        this.registerFolderizeSettings("extra-scripts", null, this._target.extraScriptCollection, WebInspector.ScriptTreeElement);
+        this.registerFolderizeSettings("scripts", null, this._target.resourceCollection.resourceCollectionForType(WI.Resource.Type.Script), WI.ResourceTreeElement);
+        this.registerFolderizeSettings("extra-scripts", null, this._target.extraScriptCollection, WI.ScriptTreeElement);
 
         // All other resources may be folderized.
-        for (let [key, value] of Object.entries(WebInspector.Resource.Type)) {
-            if (value === WebInspector.Resource.Type.Script)
+        for (let [key, value] of Object.entries(WI.Resource.Type)) {
+            if (value === WI.Resource.Type.Script)
                 continue;
-            let folderName = WebInspector.Resource.displayNameForType(value, true);
-            this.registerFolderizeSettings(key, folderName, this._target.resourceCollection.resourceCollectionForType(value), WebInspector.ResourceTreeElement);
+            let folderName = WI.Resource.displayNameForType(value, true);
+            this.registerFolderizeSettings(key, folderName, this._target.resourceCollection.resourceCollectionForType(value), WI.ResourceTreeElement);
         }
 
         this.updateParentStatus();
@@ -103,7 +103,7 @@
     populateContextMenu(contextMenu, event)
     {
         // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
-        WebInspector.appendContextMenuItemsForSourceCode(contextMenu, this.script.resource ? this.script.resource : this.script);
+        WI.appendContextMenuItemsForSourceCode(contextMenu, this.script.resource ? this.script.resource : this.script);
 
         super.populateContextMenu(contextMenu, event);
     }
@@ -129,18 +129,18 @@
     {
         // Handle our own SourceMapResources. Skip immediate superclasses.
 
-        WebInspector.GeneralTreeElement.prototype.onattach.call(this);
+        WI.GeneralTreeElement.prototype.onattach.call(this);
     }
 
     // Overrides from FolderizedTreeElement
 
     compareChildTreeElements(a, b)
     {
-        let aIsResource = a instanceof WebInspector.ResourceTreeElement;
-        let bIsResource = b instanceof WebInspector.ResourceTreeElement;
+        let aIsResource = a instanceof WI.ResourceTreeElement;
+        let bIsResource = b instanceof WI.ResourceTreeElement;
 
         if (aIsResource && bIsResource)
-            return WebInspector.ResourceTreeElement.compareResourceTreeElements(a, b);
+            return WI.ResourceTreeElement.compareResourceTreeElements(a, b);
 
         if (!aIsResource && !bIsResource)
             return super.compareChildTreeElements(a, b);
diff --git a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js
index 556eaeb..06f4f82 100644
--- a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js
+++ b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js
@@ -23,14 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.XHRBreakpointPopover = class XHRBreakpointPopover extends WebInspector.Popover
+WI.XHRBreakpointPopover = class XHRBreakpointPopover extends WI.Popover
 {
     constructor(delegate)
     {
         super(delegate);
 
-        this._result = WebInspector.InputPopover.Result.None;
-        this._type = WebInspector.XHRBreakpoint.Type.Text;
+        this._result = WI.InputPopover.Result.None;
+        this._type = WI.XHRBreakpoint.Type.Text;
         this._value = null;
 
         this._codeMirror = null;
@@ -56,7 +56,7 @@
 
         let label = document.createElement("div");
         label.classList.add("label");
-        label.textContent = WebInspector.UIString("Break on request with URL:");
+        label.textContent = WI.UIString("Break on request with URL:");
 
         let editorWrapper = document.createElement("div");
         editorWrapper.classList.add("editor-wrapper");
@@ -71,8 +71,8 @@
             selectElement.append(optionElement);
         }
 
-        addOption(WebInspector.UIString("Containing"), WebInspector.XHRBreakpoint.Type.Text);
-        addOption(WebInspector.UIString("Matching"), WebInspector.XHRBreakpoint.Type.RegularExpression);
+        addOption(WI.UIString("Containing"), WI.XHRBreakpoint.Type.Text);
+        addOption(WI.UIString("Matching"), WI.XHRBreakpoint.Type.RegularExpression);
 
         selectElement.value = this._type;
         selectElement.addEventListener("change", (event) => {
@@ -96,7 +96,7 @@
         let editorElement = document.createElement("div");
         editorElement.classList.add("editor");
 
-        this._codeMirror = WebInspector.CodeMirrorEditor.create(editorElement, {
+        this._codeMirror = WI.CodeMirrorEditor.create(editorElement, {
             lineWrapping: false,
             matchBrackets: false,
             scrollbarStyle: null,
@@ -105,7 +105,7 @@
 
         this._codeMirror.addKeyMap({
             "Enter": () => {
-                this._result = WebInspector.InputPopover.Result.Committed;
+                this._result = WI.InputPopover.Result.Committed;
                 this._value = this._codeMirror.getValue().trim();
                 this.dismiss();
             },
@@ -120,11 +120,11 @@
     {
         let placeholder;
         let mimeType;
-        if (this._type === WebInspector.XHRBreakpoint.Type.Text) {
-            placeholder = WebInspector.UIString("Text");
+        if (this._type === WI.XHRBreakpoint.Type.Text) {
+            placeholder = WI.UIString("Text");
             mimeType = "text/plain";
         } else {
-            placeholder = WebInspector.UIString("Regular Expression");
+            placeholder = WI.UIString("Regular Expression");
             mimeType = "text/x-regex";
         }
 
@@ -137,7 +137,7 @@
         if (!this._targetElement)
             return;
 
-        let targetFrame = WebInspector.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());
+        let targetFrame = WI.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());
         this.present(targetFrame, this._preferredEdges);
 
         // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
diff --git a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js
index 1dce1f3..44d71d2 100644
--- a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js
@@ -23,19 +23,19 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.XHRBreakpointTreeElement = class XHRBreakpointTreeElement extends WebInspector.GeneralTreeElement
+WI.XHRBreakpointTreeElement = class XHRBreakpointTreeElement extends WI.GeneralTreeElement
 {
     constructor(breakpoint, className, title)
     {
-        console.assert(breakpoint instanceof WebInspector.XHRBreakpoint);
+        console.assert(breakpoint instanceof WI.XHRBreakpoint);
 
         if (!className)
-            className = WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;
+            className = WI.BreakpointTreeElement.GenericLineIconStyleClassName;
 
         let subtitle;
         if (!title) {
-            title = WebInspector.UIString("URL");
-            if (breakpoint.type === WebInspector.XHRBreakpoint.Type.Text)
+            title = WI.UIString("URL");
+            if (breakpoint.type === WI.XHRBreakpoint.Type.Text)
                 subtitle = doubleQuotedString(breakpoint.url);
             else
                 subtitle = "/" + breakpoint.url + "/";
@@ -47,7 +47,7 @@
         this._statusImageElement.classList.add("status-image", "resolved");
         this.status = this._statusImageElement;
 
-        breakpoint.addEventListener(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this);
+        breakpoint.addEventListener(WI.XHRBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this);
 
         this._updateStatus();
     }
@@ -82,7 +82,7 @@
 
     ondelete()
     {
-        WebInspector.domDebuggerManager.removeXHRBreakpoint(this.representedObject);
+        WI.domDebuggerManager.removeXHRBreakpoint(this.representedObject);
         return true;
     }
 
@@ -101,13 +101,13 @@
     populateContextMenu(contextMenu, event)
     {
         let breakpoint = this.representedObject;
-        let label = breakpoint.disabled ? WebInspector.UIString("Enable Breakpoint") : WebInspector.UIString("Disable Breakpoint");
+        let label = breakpoint.disabled ? WI.UIString("Enable Breakpoint") : WI.UIString("Disable Breakpoint");
         contextMenu.appendItem(label, this._toggleBreakpoint.bind(this));
 
-        if (WebInspector.domDebuggerManager.isBreakpointRemovable(breakpoint)) {
+        if (WI.domDebuggerManager.isBreakpointRemovable(breakpoint)) {
             contextMenu.appendSeparator();
-            contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"), function() {
-                WebInspector.domDebuggerManager.removeXHRBreakpoint(breakpoint);
+            contextMenu.appendItem(WI.UIString("Delete Breakpoint"), function() {
+                WI.domDebuggerManager.removeXHRBreakpoint(breakpoint);
             });
         }
     }
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 2e741dd..762c0e8 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,14 @@
+2017-08-01  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: simplify WebInspector with WI
+        https://bugs.webkit.org/show_bug.cgi?id=175058
+
+        Reviewed by Joseph Pecoraro.
+
+        * Scripts/check-inspector-strings:
+        (extract_ui_strings):
+        * Scripts/extract-localizable-js-strings:
+
 2017-08-01  Youenn Fablet  <youenn@apple.com>
 
         Layout tests with 'https' suffix should be run over HTTPS
diff --git a/Tools/Scripts/check-inspector-strings b/Tools/Scripts/check-inspector-strings
index 2408031..19fe63d 100755
--- a/Tools/Scripts/check-inspector-strings
+++ b/Tools/Scripts/check-inspector-strings
@@ -90,10 +90,10 @@
     line_unrecognized = False
     idx = 0
     while idx < len(str):
-        idx = str.find("WebInspector.UIString(", idx)
+        idx = str.find("WI.UIString(", idx)
         if idx == -1:
             break
-        idx = idx + len("WebInspector.UIString(")
+        idx = idx + len("WI.UIString(")
         balance = 1
         item_recognized = False
         while idx < len(str):
@@ -139,7 +139,7 @@
     _log.debug("WebKit checkout found with root: %s" % checkout_root)
     change_directory(filesystem, checkout_root=checkout_root, paths=None)
 
-    strings_extractor = StringsExtractor([r"(WebInspector\.UIString\(.*)", r"\"((?:[^\"\\]|\\.)*?)\""])
+    strings_extractor = StringsExtractor([r"(WI\.UIString\(.*)", r"\"((?:[^\"\\]|\\.)*?)\""])
     file_reader = TextFileReader(filesystem, strings_extractor)
     file_reader.process_paths([_inspector_directory])
     localized_strings_extractor = LocalizedStringsExtractor()
diff --git a/Tools/Scripts/extract-localizable-js-strings b/Tools/Scripts/extract-localizable-js-strings
index 571c07d..68c5839 100755
--- a/Tools/Scripts/extract-localizable-js-strings
+++ b/Tools/Scripts/extract-localizable-js-strings
@@ -72,9 +72,9 @@
     while (<SOURCE>) {
         chomp;
 
-        # Handle WebInspector strings. Prints a warning if a non-string literal is passed to WebInspector.UIString().
-        HandleUIString($1, $1, "", $file, $.) while s/WebInspector\.UIString\("([^"]+)"\)//;
-        print "$file:$.:WARNING: $&\n" while s/WebInspector\.UIString\(.*?\)//;
+        # Handle WebInspector strings. Prints a warning if a non-string literal is passed to WI.UIString().
+        HandleUIString($1, $1, "", $file, $.) while s/WI\.UIString\("([^"]+)"\)//;
+        print "$file:$.:WARNING: $&\n" while s/WI\.UIString\(.*?\)//;
 
         # Handle strings for other projects that also use this script.
         HandleUIString($2, $2, "", $file, $.) while s/(\bclass="[^"]*l12n-tooltip[^"]*"[^>]*)title="([^"]+)"/$1/;
