removed windows sdk

This commit is contained in:
Andrew Zambazos
2026-06-11 14:02:39 +12:00
parent c0395a49bd
commit ffdc88608e
2155 changed files with 0 additions and 451005 deletions
-58
View File
@@ -1,58 +0,0 @@
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
body.focus-debug [tabindex="0"] {
outline: 1px solid hsla(300, 100%, 50%, 0.4) !important;
outline-offset: -2px !important;
}
body.focus-debug *:focus {
outline: 2px solid hsl(300, 100%, 50%) !important;
outline-offset: -1px !important;
}
.tab-bar > .navigation-bar .inspect-inspector {
width: 1em !important;
}
/* These rules are adapted from TabBar.css and are expected to match. */
body.window-inactive .tab-bar > .navigation-bar .item.button.text-only {
color: hsla(0, 0%, var(--foreground-lightness), 0.4);
}
.tab-bar > .navigation-bar .item.button.text-only {
color: hsla(0, 0%, var(--foreground-lightness), 0.6);
}
.tab-bar > .navigation-bar .item.button.text-only:not(.selected):hover {
color: hsla(0, 0%, var(--foreground-lightness), 0.7);
}
.tab-bar > .navigation-bar .item.button.text-only:not(.disabled).selected {
color: hsla(0, 0%, var(--foreground-lightness), 0.8);
}
body.window-inactive .tab-bar > .navigation-bar .item.button.text-only:not(.disabled).selected > {
color: hsla(0, 0%, var(--foreground-lightness), 0.5);
}
-181
View File
@@ -1,181 +0,0 @@
/*
* Copyright (C) 2015 University of Washington.
* Copyright (C) 2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WI.isEngineeringBuild = true;
// Disable Pause in Internal Scripts if Show Internal Scripts is dibbled.
WI.settings.engineeringShowInternalScripts.addEventListener(WI.Setting.Event.Changed, function(event) {
if (!WI.settings.engineeringShowInternalScripts.value)
WI.settings.engineeringPauseForInternalScripts.value = false;
}, WI.settings.engineeringPauseForInternalScripts);
// Enable Show Internal Scripts if Pause in Internal Scripts is enabled.
WI.settings.engineeringPauseForInternalScripts.addEventListener(WI.Setting.Event.Changed, function(event) {
if (WI.settings.engineeringPauseForInternalScripts.value)
WI.settings.engineeringShowInternalScripts.value = true;
}, WI.settings.engineeringShowInternalScripts);
WI.showDebugUISetting = new WI.Setting("show-debug-ui", false);
// This function is invoked after the inspector has loaded and has a backend target.
WI.runBootstrapOperations = function() {
// Toggle Debug UI setting.
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 WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "R", () => {
InspectorFrontendHost.reopen();
});
// Toggle Inspector Messages Filtering.
let ignoreChangesToState = false;
const DumpMessagesState = {Off: "off", Filtering: "filtering", Everything: "everything"};
const dumpMessagesToolTip = WI.unlocalizedString("Enable dump inspector messages to console.\nShift-click to dump all inspector messages with no filtering.");
const dumpMessagesActivatedToolTip = WI.unlocalizedString("Disable dump inspector messages to console");
let dumpMessagesTabBarNavigationItem = new WI.ActivateButtonNavigationItem("dump-messages", dumpMessagesToolTip, dumpMessagesActivatedToolTip, "Images/Console.svg");
function dumpMessagesCurrentState() {
if (!InspectorBackend.dumpInspectorProtocolMessages)
return DumpMessagesState.Off;
if (InspectorBackend.filterMultiplexingBackendInspectorProtocolMessages)
return DumpMessagesState.Filtering;
return DumpMessagesState.Everything;
}
function applyDumpMessagesState(state) {
ignoreChangesToState = true;
switch (state) {
case DumpMessagesState.Off:
InspectorBackend.dumpInspectorProtocolMessages = false;
InspectorBackend.filterMultiplexingBackendInspectorProtocolMessages = false;
dumpMessagesTabBarNavigationItem.activated = false;
dumpMessagesTabBarNavigationItem.element.style.removeProperty("color");
break;
case DumpMessagesState.Filtering:
InspectorBackend.dumpInspectorProtocolMessages = true;
InspectorBackend.filterMultiplexingBackendInspectorProtocolMessages = true;
dumpMessagesTabBarNavigationItem.activated = true;
dumpMessagesTabBarNavigationItem.element.style.removeProperty("color");
break;
case DumpMessagesState.Everything:
InspectorBackend.dumpInspectorProtocolMessages = true;
InspectorBackend.filterMultiplexingBackendInspectorProtocolMessages = false;
dumpMessagesTabBarNavigationItem.activated = true;
dumpMessagesTabBarNavigationItem.element.style.color = "rgb(164, 41, 154)";
break;
}
ignoreChangesToState = false;
}
dumpMessagesTabBarNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, function(event) {
let nextState;
switch (dumpMessagesCurrentState()) {
case DumpMessagesState.Off:
nextState = WI.modifierKeys.shiftKey ? DumpMessagesState.Everything : DumpMessagesState.Filtering;
break;
case DumpMessagesState.Filtering:
nextState = WI.modifierKeys.shiftKey ? DumpMessagesState.Everything : DumpMessagesState.Off;
break;
case DumpMessagesState.Everything:
nextState = DumpMessagesState.Off;
break;
}
applyDumpMessagesState(nextState);
}, dumpMessagesTabBarNavigationItem);
WI.settings.protocolAutoLogMessages.addEventListener(WI.Setting.Event.Changed, function(event) {
if (ignoreChangesToState)
return;
applyDumpMessagesState(dumpMessagesCurrentState());
}, dumpMessagesTabBarNavigationItem);
applyDumpMessagesState(dumpMessagesCurrentState());
// Next Level Inspector.
let inspectionLevel = InspectorFrontendHost.inspectionLevel;
const inspectInspectorToolTip = WI.unlocalizedString("Open Web Inspector [%d]").format(inspectionLevel + 1);
let inspectInspectorTabBarNavigationItem = new WI.ButtonNavigationItem("inspect-inspector", inspectInspectorToolTip);
inspectInspectorTabBarNavigationItem.element.textContent = inspectionLevel + 1;
inspectInspectorTabBarNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, function(event) {
InspectorFrontendHost.inspectInspector();
}, inspectInspectorTabBarNavigationItem);
let groupNavigationItem = new WI.GroupNavigationItem([
dumpMessagesTabBarNavigationItem,
inspectInspectorTabBarNavigationItem,
]);
WI.tabBar.addNavigationItemAfter(groupNavigationItem);
function setFocusDebugOutline() {
document.body.classList.toggle("focus-debug", WI.settings.debugOutlineFocusedElement.value);
}
WI.settings.debugOutlineFocusedElement.addEventListener(WI.Setting.Event.Changed, setFocusDebugOutline, WI.settings.debugOutlineFocusedElement);
setFocusDebugOutline();
function updateDebugUI() {
groupNavigationItem.hidden = !WI.showDebugUISetting.value;
WI.tabBar.needsLayout();
}
function updateMockWebExtensionTab() {
let mockData = {
extensionID: "1234567890ABCDEF",
extensionBundleIdentifier: "org.webkit.WebInspector.MockExtension",
displayName: WI.unlocalizedString("Mock Extension"),
tabName: WI.unlocalizedString("Mock"),
tabIconURL: "Images/Info.svg",
sourceURL: "Debug/MockWebExtensionTab.html",
};
// Simulates the steps taken by WebInspectorUIExtensionController to create an extension tab in WebInspectorUI.
if (!WI.settings.debugShowMockWebExtensionTab.value) {
if (WI.sharedApp.extensionController.registeredExtensionIDs.has(mockData.extensionID))
InspectorFrontendAPI.unregisterExtension(mockData.extensionID);
return;
}
let error = InspectorFrontendAPI.registerExtension(mockData.extensionID, mockData.extensionBundleIdentifier, mockData.displayName);
if (error) {
WI.reportInternalError("Problem creating mock web extension: " + error);
return;
}
let result = InspectorFrontendAPI.createTabForExtension(mockData.extensionID, mockData.tabName, mockData.tabIconURL, mockData.sourceURL);
if (!result?.extensionTabID) {
WI.reportInternalError("Problem creating mock web extension tab: " + result);
return;
}
}
WI.settings.debugShowMockWebExtensionTab.addEventListener(WI.Setting.Event.Changed, updateMockWebExtensionTab, WI.settings.debugShowMockWebExtensionTab);
updateMockWebExtensionTab();
WI.showDebugUISetting.addEventListener(WI.Setting.Event.Changed, function(event) {
updateDebugUI();
}, groupNavigationItem);
updateDebugUI();
};
@@ -1,84 +0,0 @@
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WI.CapturingProtocolTracer = class CapturingProtocolTracer extends WI.ProtocolTracer
{
constructor()
{
super();
this._trace = new WI.ProtocolTrace;
}
// Public
get trace()
{
return this._trace;
}
logFrontendException(connection, message, exception)
{
this._processEntry({type: "exception", message: this._stringifyMessage(message), exception});
}
logFrontendRequest(connection, message)
{
this._processEntry({type: "request", message: this._stringifyMessage(message)});
}
logDidHandleResponse(connection, message, timings = null)
{
let entry = {type: "response", message: this._stringifyMessage(message)};
if (timings)
entry.timings = Object.shallowCopy(timings);
this._processEntry(entry);
}
logDidHandleEvent(connection, message, timings = null)
{
let entry = {type: "event", message: this._stringifyMessage(message)};
if (timings)
entry.timings = Object.shallowCopy(timings);
this._processEntry(entry);
}
_stringifyMessage(message)
{
try {
return JSON.stringify(message);
} catch (e) {
console.error("couldn't stringify object:", message, e);
return {};
}
}
_processEntry(entry)
{
this._trace.addEntry(entry);
}
};
-57
View File
@@ -1,57 +0,0 @@
/*
* Copyright (C) 2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
Object.defineProperty(WI.DOMManager.prototype, "boundNodesDebugDescription", {
get() {
let debugDescription = "";
function appendLine(line) {
debugDescription += line + "\n";
}
const singleLevelSpacePrefix = " ";
function appendChildren(parent, level) {
let spacePrefix = singleLevelSpacePrefix.repeat(level + 1);
for (let child of parent.children) {
appendLine(`${spacePrefix}id(${child.id}) displayName(${child.displayName})`);
for (let pseudoElement of child.pseudoElements().values())
appendLine(`${spacePrefix}${singleLevelSpacePrefix}id(${pseudoElement.id}) displayName(${pseudoElement.displayName})`);
if (child.children)
appendChildren(child, level + 1);
}
}
let rootNodes = Object.values(this._idToDOMNode).filter((value) => !value.parentNode);
for (let rootNode of rootNodes) {
appendLine(`<${rootNode === this._document ? "Document" : "Detached"} Root> id(${rootNode.id}) displayName(${rootNode.displayName})`);
if (rootNode.children)
appendChildren(rootNode, 0);
}
return debugDescription;
}
});
-35
View File
@@ -1,35 +0,0 @@
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
.content-view.debug {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
padding: 15px;
font-size: 64px;
color: var(--text-color-gray-medium);
}
-57
View File
@@ -1,57 +0,0 @@
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WI.DebugContentView = class DebugContentView extends WI.ContentView
{
constructor(string)
{
super(new String(string));
this._string = string;
this.element.classList.add("debug");
this.element.textContent = string;
}
// Protected
attached()
{
super.attached();
console.debug(`attached: ${this._string}`);
}
detached()
{
console.debug(`detached: ${this._string}`);
super.detached();
}
closed()
{
console.debug(`closed: ${this._string}`);
super.closed();
}
};
-24
View File
@@ -1,24 +0,0 @@
<html>
<head>
<script>
window._secretValue = {answer:42};
window.getUniqueValue = function() {
if (!window._cachedUniqueValue)
window._cachedUniqueValue = Math.floor(Math.random() * 10e9);
return window._cachedUniqueValue;
}
function initialize() {
document.getElementById("uniqueValueField").innerText = window.getUniqueValue();
};
</script>
<body onload="initialize()">
<h1>This is a test extension.</h1>
<p>In a normal extension, this area would show the extension's user interface.</p>
<p>The unique value for this iframe's execution context is:
<span id="uniqueValueField">TBD</span>
</p>
</body>
</html>
-63
View File
@@ -1,63 +0,0 @@
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WI.ProtocolTrace = class ProtocolTrace
{
constructor()
{
this._entries = [];
}
// Public
addEntry(entry)
{
this._entries.push(entry);
}
get saveMode()
{
return WI.FileUtilities.SaveMode.SingleFile;
}
get saveData()
{
let now = new Date();
let YYYY = now.getFullYear();
let MM = now.getMonth() + 1;
let DD = now.getDate();
let hh = now.getHours();
let mm = now.getMinutes();
let ss = now.getSeconds();
// 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.
return {
content: JSON.stringify(this._entries),
suggestedName: WI.unlocalizedString(`Protocol Trace at ${YYYY}-${MM}-${DD} ${hh}.${mm}.${ss}.json`),
};
}
};
@@ -1,128 +0,0 @@
/*
* Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
.sheet-container {
position: absolute;
inset: 0;
z-index: var(--z-index-uncaught-exception-sheet);
background-color: hsl(0, 0%, 96%);
overflow: auto;
}
.uncaught-exception-sheet {
min-width: 400px;
margin-inline: 65px 55px;
padding: 50px 0;
font-family: -webkit-system-font, sans-serif;
font-size: 11pt;
color: hsl(0, 0%, 40%);
}
.uncaught-exception-sheet a {
text-decoration: underline;
color: hsl(240, 55%, 30%);
cursor: pointer;
font-weight: 500;
font-size: 97%;
}
.uncaught-exception-sheet a:hover,
.uncaught-exception-sheet a:active {
color: hsl(240, 55%, 25%);
}
.uncaught-exception-sheet h1,
.uncaught-exception-sheet h2 {
font-size: 24px;
line-height: 28px;
margin-bottom: 0px;
margin-top: 10px;
font-weight: normal;
}
.uncaught-exception-sheet h2 {
margin-top: 40px;
}
.uncaught-exception-sheet h1 > img {
position: relative;
height: 35px;
margin-top: -5px;
margin-inline-start: -50px;
}
body[dir=ltr] .uncaught-exception-sheet h1 > img {
float: left;
}
body[dir=rtl] .uncaught-exception-sheet h1 > img {
float: right;
}
.uncaught-exception-sheet h2 > img {
position: relative;
height: 25px;
margin-top: 0;
margin-inline-start: -45px;
}
body[dir=ltr] .uncaught-exception-sheet h2 > img {
float: left;
}
body[dir=rtl] .uncaught-exception-sheet h2 > img {
float: right;
}
.uncaught-exception-sheet dl {
max-width: 600px;
}
.uncaught-exception-sheet dt {
font-style: italic;
font-size: 17px;
}
.uncaught-exception-sheet dd {
margin: 10px 0 20px;
margin-inline-start: 10px;
font-size: 13px;
line-height: 18px;
}
.uncaught-exception-sheet ul {
margin: 0;
margin-inline-start: 2px;
padding: 0;
font-family: Menlo, monospace;
font-size: 12px;
line-height: 18px;
}
.uncaught-exception-sheet li {
margin-bottom: 20px;
word-break: break-word;
-webkit-user-select: text;
white-space: pre;
}
@@ -1,310 +0,0 @@
/*
* Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
(function() {
const windowEvents = ["beforecopy", "copy", "click", "dragover", "focus"];
const documentEvents = ["focus", "blur", "resize", "keydown", "keyup", "mousemove", "pagehide", "contextmenu"];
function stopEventPropagation(event) {
if (event.target.classList && event.target.classList.contains("bypass-event-blocking"))
return;
event.stopPropagation();
}
function blockEventHandlers() {
// FIXME (151959): text selection on the sheet doesn't work for some reason.
for (let name of windowEvents)
window.addEventListener(name, stopEventPropagation, true);
for (let name of documentEvents)
document.addEventListener(name, stopEventPropagation, true);
}
function unblockEventHandlers() {
for (let name of windowEvents)
window.removeEventListener(name, stopEventPropagation, true);
for (let name of documentEvents)
document.removeEventListener(name, stopEventPropagation, true);
}
function urlLastPathComponent(url) {
if (!url)
return "";
let slashIndex = url.lastIndexOf("/");
if (slashIndex === -1)
return url;
return url.slice(slashIndex + 1);
}
function handleError(error) {
handleUncaughtExceptionRecord({
message: error.message,
url: urlLastPathComponent(error.sourceURL),
lineNumber: error.line,
columnNumber: error.column,
stack: error.stack,
details: error.details,
});
}
function handleUncaughtException(event) {
handleUncaughtExceptionRecord({
message: event.message,
url: urlLastPathComponent(event.filename),
lineNumber: event.lineno,
columnNumber: event.colno,
stack: typeof event.error === "object" && event.error !== null ? event.error.stack : null,
});
}
function handleUnhandledPromiseRejection(event) {
handleUncaughtExceptionRecord({
message: event.reason.message,
url: urlLastPathComponent(event.reason.sourceURL),
lineNumber: event.reason.line,
columnNumber: event.reason.column,
stack: event.reason.stack,
});
}
function handleUncaughtExceptionRecord(exceptionRecord) {
try {
if (!WI.settings.debugEnableUncaughtExceptionReporter.value)
return;
} catch { }
if (!window.__uncaughtExceptions)
window.__uncaughtExceptions = [];
const loadCompleted = window.__frontendCompletedLoad;
const isFirstException = !window.__uncaughtExceptions.length;
// If an uncaught exception happens after loading is done, only show
// the first such exception. Many others may follow if internal
// state has been corrupted, but these are unhelpful to report.
if (!loadCompleted || isFirstException)
window.__uncaughtExceptions.push(exceptionRecord);
// 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)
blockEventHandlers();
if (isFirstException && !loadCompleted) {
// Signal that loading is done even though we can't guarantee that
// evaluating code on the inspector page will do anything useful.
// Without this, the frontend host may never show the window.
if (window.InspectorFrontendHost)
InspectorFrontendHost.loaded();
// Don't tell InspectorFrontendAPI that loading is done, since it can
// clear some of the error boilerplate page by accident.
}
createErrorSheet();
}
function dismissErrorSheet() {
unblockEventHandlers();
window.__sheetElement.remove();
window.__sheetElement = null;
window.__uncaughtExceptions = [];
// Do this last in case WebInspector's internal state is corrupted.
try {
WI.updateWindowTitle();
} catch { }
// FIXME (151959): tell the frontend host to hide a draggable title bar.
}
function createErrorSheet() {
// Early errors like parse errors may happen in the <head>, so attach
// a body if none exists yet. Code below expects document.body to exist.
if (!document.body)
document.write("<body></body></html>");
// FIXME (151959): tell the frontend host to show a draggable title bar.
if (window.InspectorFrontendHost)
InspectorFrontendHost.inspectedURLChanged("Internal Error");
// Only allow one sheet element at a time.
if (window.__sheetElement) {
window.__sheetElement.remove();
window.__sheetElement = null;
}
const loadCompleted = window.__frontendCompletedLoad;
let firstException = window.__uncaughtExceptions[0];
// Inlined from Utilities.js, because that file may not have loaded.
function insertWordBreakCharacters(text) {
return text.replace(/([\/;:\)\]\}&?])/g, "$1\u200b");
}
// This trampoline is necessary since none of our functions will be
// in scope of an href="javascript:"-style evaluation.
function handleLinkClick(event) {
if (event.target.tagName !== "A")
return;
if (event.target.id === "dismiss-error-sheet")
dismissErrorSheet();
}
function formattedEntry(entry) {
const indent = " ";
let lines = [`${entry.message} (at ${entry.url}:${entry.lineNumber}:${entry.columnNumber})`];
if (entry.stack) {
let stackLines = entry.stack.split(/\n/g);
for (let stackLine of stackLines) {
let atIndex = stackLine.indexOf("@");
let slashIndex = Math.max(stackLine.lastIndexOf("/"), atIndex);
let functionName = stackLine.substring(0, atIndex) || "?";
let location = stackLine.substring(slashIndex + 1, stackLine.length);
lines.push(`${indent}${functionName} @ ${location}`);
}
}
if (entry.details) {
lines.push("");
lines.push("Additional Details:");
for (let key in entry.details) {
let value = entry.details[key];
lines.push(`${indent}${key} --> ${value}`);
}
}
return lines.join("\n");
}
let inspectedPageURL = null;
try {
inspectedPageURL = WI.networkManager.mainFrame.url;
} catch { }
let topLevelItems = [
`Inspected URL: ${inspectedPageURL || "(unknown)"}`,
`Loading completed: ${!!loadCompleted}`,
`Frontend User Agent: ${window.navigator.userAgent}`,
];
function stringifyAndTruncateObject(object) {
let string = JSON.stringify(object);
return string.length > 500 ? string.substr(0, 500) + ellipsis : string;
}
if (window.InspectorBackend && InspectorBackend.currentDispatchState) {
let state = InspectorBackend.currentDispatchState;
if (state.event) {
topLevelItems.push("Dispatch Source: Protocol Event");
topLevelItems.push("");
topLevelItems.push("Protocol Event:");
topLevelItems.push(stringifyAndTruncateObject(state.event));
}
if (state.response) {
topLevelItems.push("Dispatch Source: Protocol Command Response");
topLevelItems.push("");
topLevelItems.push("Protocol Command Response:");
topLevelItems.push(stringifyAndTruncateObject(state.response));
}
if (state.request) {
topLevelItems.push("");
topLevelItems.push("Protocol Command Request:");
topLevelItems.push(stringifyAndTruncateObject(state.request));
}
}
let formattedErrorDetails = window.__uncaughtExceptions.map((entry) => formattedEntry(entry));
let detailsForBugReport = formattedErrorDetails.map((line) => ` - ${line}`).join("\n");
let encodedBugDescription = encodeURIComponent(`Uncaught Exception in Web Inspector.
Steps to Reproduce:
1. What were you doing? Include setup or other preparations to reproduce the exception.
2. Include explicit, accurate, and minimal steps taken. Do not include extraneous or irrelevant steps.
3. What did you expect to have happen? What actually happened?
Uncaught Exceptions:
-----------------------
${detailsForBugReport}
-----------------------
Notes:
${topLevelItems.join("\n")}
`);
let encodedBugTitle = encodeURIComponent(`Uncaught Exception: ${firstException.message}`);
let encodedInspectedURL = encodeURIComponent(inspectedPageURL || "http://");
let prefilledBugReportLink = `https://bugs.webkit.org/enter_bug.cgi?alias=&assigned_to=webkit-unassigned%40lists.webkit.org&attach_text=&blocked=&bug_file_loc=${encodedInspectedURL}&bug_severity=Normal&bug_status=NEW&comment=${encodedBugDescription}&component=Web%20Inspector&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&data=&dependson=&description=&flag_type-1=X&flag_type-3=X&form_name=enter_bug&keywords=&op_sys=All&priority=P2&product=WebKit&rep_platform=All&short_desc=${encodedBugTitle}`;
let detailsForHTML = formattedErrorDetails.map((line) => `<li>${insertWordBreakCharacters(line)}</li>`).join("\n");
let dismissOptionHTML = !loadCompleted ? "" : `<dt>A frivolous exception will not stop me!</dt>
<dd><a class="bypass-event-blocking" id="dismiss-error-sheet">Click to close this view</a> and return
to the Web Inspector without reloading. However, some things might not work without reloading if the error corrupted the Inspector's internal state.</dd>`;
let sheetElement = window.__sheetElement = document.createElement("div");
sheetElement.classList.add("sheet-container");
sheetElement.innerHTML = `<div class="uncaught-exception-sheet">
<h1>
<img src="Images/Errors.svg">
Web Inspector encountered an internal error.
</h1>
<dl>
<dd>Usually, this is caused by a syntax error while modifying the Web Inspector
UI, or running an updated frontend with out-of-date WebKit build.</dt>
<dt>I didn't do anything...?</dt>
<dd><a href="${prefilledBugReportLink}" id="uncaught-exception-bug-report-link" class="bypass-event-blocking">Click to file a bug</a> as this is likely a Web Inspector bug.</dd>
<dt>Oops, can I try again?</dt>
<dd><a href="javascript:InspectorFrontendHost.reopen()" class="bypass-event-blocking">Click to reload the Inspector</a>
again after making local changes.</dd>
${dismissOptionHTML}
</dl>
<h2>
<img src="Images/Console.svg">
These uncaught exceptions caused the problem:
</h2>
<p><ul>${detailsForHTML}</ul></p>
</div>`;
sheetElement.addEventListener("click", handleLinkClick, true);
document.body.appendChild(sheetElement);
document.getElementById("uncaught-exception-bug-report-link").addEventListener("click", (event) => {
InspectorFrontendHost.openURLExternally(prefilledBugReportLink);
event.stopImmediatePropagation();
event.preventDefault();
});
}
window.addEventListener("error", handleUncaughtException);
window.addEventListener("unhandledrejection", handleUnhandledPromiseRejection);
window.handleInternalException = handleError;
})();