import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,46 @@
const React = require("react");
const InlineSVG = require("svg-inline-react");
const { DOM: dom } = React;
const DomainIcon = props => {
return dom.span(
props,
React.createElement(InlineSVG, {
src: require("./domain.svg")
})
);
};
const FileIcon = props => {
return dom.span(
props,
React.createElement(InlineSVG, {
src: require("./file.svg")
})
);
};
const FolderIcon = props => {
return dom.span(
props,
React.createElement(InlineSVG, {
src: require("./folder.svg")
})
);
};
const WorkerIcon = props => {
return dom.span(
props,
React.createElement(InlineSVG, {
src: require("./worker.svg")
})
);
};
module.exports = {
DomainIcon,
FileIcon,
FolderIcon,
WorkerIcon
};

View file

@ -0,0 +1,43 @@
const React = require("react");
const InlineSVG = require("svg-inline-react");
const svg = {
"angle-brackets": require("./angle-brackets.svg"),
"arrow": require("./arrow.svg"),
"blackBox": require("./blackBox.svg"),
"breakpoint": require("./breakpoint.svg"),
"close": require("./close.svg"),
"domain": require("./domain.svg"),
"file": require("./file.svg"),
"folder": require("./folder.svg"),
"globe": require("./globe.svg"),
"magnifying-glass": require("./magnifying-glass.svg"),
"pause": require("./pause.svg"),
"pause-exceptions": require("./pause-exceptions.svg"),
"plus": require("./plus.svg"),
"prettyPrint": require("./prettyPrint.svg"),
"resume": require("./resume.svg"),
"settings": require("./settings.svg"),
"stepIn": require("./stepIn.svg"),
"stepOut": require("./stepOut.svg"),
"stepOver": require("./stepOver.svg"),
"subSettings": require("./subSettings.svg"),
"toggleBreakpoints": require("./toggle-breakpoints.svg"),
"worker": require("./worker.svg"),
"sad-face": require("./sad-face.svg")
};
module.exports = function(name, props) { // eslint-disable-line
if (!svg[name]) {
throw new Error("Unknown SVG: " + name);
}
let className = name;
if (props && props.className) {
className = `${name} ${props.className}`;
}
if (name === "subSettings") {
className = "";
}
props = Object.assign({}, props, { className, src: svg[name] });
return React.createElement(InlineSVG, props);
};

View file

@ -0,0 +1,9 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16px" height="11px" viewBox="-1 73 16 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Shape-Copy-3-+-Shape-Copy-4" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(0.000000, 74.000000)">
<path d="M0.749321284,4.16081709 L4.43130681,0.242526751 C4.66815444,-0.00952143591 5.06030999,-0.0211407611 5.30721074,0.216574262 C5.55411149,0.454289284 5.56226116,0.851320812 5.32541353,1.103369 L1.95384971,4.69131519 L5.48809879,8.09407556 C5.73499955,8.33179058 5.74314922,8.72882211 5.50630159,8.9808703 C5.26945396,9.23291849 4.87729841,9.24453781 4.63039766,9.00682279 L0.827097345,5.34502101 C0.749816996,5.31670099 0.677016974,5.27216098 0.613753508,5.21125118 C0.427367989,5.03179997 0.377040713,4.7615583 0.465458792,4.53143559 C0.492371834,4.43667624 0.541703274,4.34676528 0.613628034,4.27022448 C0.654709457,4.22650651 0.70046335,4.19002189 0.749321284,4.16081709 Z" id="Shape-Copy-3" stroke="#FFFFFF" stroke-width="0.05" fill="#DDE1E4"></path>
<path d="M13.7119065,5.44453032 L9.77062746,9.09174784 C9.51677479,9.3266604 9.12476399,9.31089603 8.89504684,9.05653714 C8.66532968,8.80217826 8.68489539,8.40554539 8.93874806,8.17063283 L12.5546008,4.82456128 L9.26827469,1.18571135 C9.03855754,0.931352463 9.05812324,0.534719593 9.31197591,0.299807038 C9.56582858,0.0648944831 9.95783938,0.0806588502 10.1875565,0.335017737 L13.72891,4.25625178 C13.8013755,4.28980469 13.8684335,4.3382578 13.9254821,4.40142604 C14.0883019,4.58171146 14.1258883,4.83347168 14.0435812,5.04846202 C14.0126705,5.15680232 13.9526426,5.2583679 13.8641331,5.34027361 C13.8174417,5.38348136 13.7660763,5.41820853 13.7119065,5.44453032 Z" id="Shape-Copy-4" stroke="#FFFFFF" stroke-width="0.05" fill="#DDE1E4"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16">
<path d="M8 13.4c-.5 0-.9-.2-1.2-.6L.4 5.2C0 4.7-.1 4.3.2 3.7S1 3 1.6 3h12.8c.6 0 1.2.1 1.4.7.3.6.2 1.1-.2 1.6l-6.4 7.6c-.3.4-.7.5-1.2.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 465 B

View file

@ -0,0 +1,9 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<circle cx="8" cy="8.5" r="1.5"/>
<path d="M15.498 8.28l-.001-.03v-.002-.004l-.002-.018-.004-.031c0-.002 0-.002 0 0l-.004-.035.006.082c-.037-.296-.133-.501-.28-.661-.4-.522-.915-1.042-1.562-1.604-1.36-1.182-2.74-1.975-4.178-2.309a6.544 6.544 0 0 0-2.755-.042c-.78.153-1.565.462-2.369.91C3.252 5.147 2.207 6 1.252 7.035c-.216.233-.36.398-.499.577-.338.437-.338 1 0 1.437.428.552.941 1.072 1.59 1.635 1.359 1.181 2.739 1.975 4.177 2.308.907.21 1.829.223 2.756.043.78-.153 1.564-.462 2.369-.91 1.097-.612 2.141-1.464 3.097-2.499.217-.235.36-.398.498-.578.12-.128.216-.334.248-.554 0 .01 0 .01-.008.04l.013-.079-.001.011.003-.031.001-.017v.005l.001-.02v.008l.002-.03.001-.05-.001-.044v-.004-.004zm-.954.045v.007l.001.004V8.33v.012l-.001.01v-.005-.005l.002-.015-.001.008c-.002.014-.002.014 0 0l-.007.084c.003-.057-.004-.041-.014-.031-.143.182-.27.327-.468.543-.89.963-1.856 1.752-2.86 2.311-.724.404-1.419.677-2.095.81a5.63 5.63 0 0 1-2.374-.036c-1.273-.295-2.523-1.014-3.774-2.101-.604-.525-1.075-1.001-1.457-1.496-.054-.07-.054-.107 0-.177.117-.152.244-.298.442-.512.89-.963 1.856-1.752 2.86-2.311.724-.404 1.419-.678 2.095-.81a5.631 5.631 0 0 1 2.374.036c1.272.295 2.523 1.014 3.774 2.101.603.524 1.074 1 1.457 1.496.035.041.043.057.046.076 0 .01 0 .01.008.043l-.009-.047.003.02-.002-.013v-.008.016c0-.004 0-.004 0 0v-.004z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 60 12">
<path id="base-path" d="M53.9,0H1C0.4,0,0,0.4,0,1v10c0,0.6,0.4,1,1,1h52.9c0.6,0,1.2-0.3,1.5-0.7L60,6l-4.4-5.3C55,0.3,54.5,0,53.9,0z"/>
</svg>

After

Width:  |  Height:  |  Size: 460 B

View file

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16px" height="16px" viewBox="0 0 6 6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M1.35191454,5.27895256 L5.31214367,1.35518468 C5.50830675,1.16082764 5.50977084,0.844248536 5.3154138,0.648085456 C5.12105677,0.451922377 4.80447766,0.450458288 4.60831458,0.644815324 L0.648085456,4.56858321 C0.451922377,4.76294025 0.450458288,5.07951935 0.644815324,5.27568243 C0.83917236,5.47184551 1.15575146,5.4733096 1.35191454,5.27895256 L1.35191454,5.27895256 Z" id="Line" stroke="none" fill="#696969" fill-rule="evenodd"></path>
<path d="M5.31214367,4.56858321 L1.35191454,0.644815324 C1.15575146,0.450458288 0.83917236,0.451922377 0.644815324,0.648085456 C0.450458288,0.844248536 0.451922377,1.16082764 0.648085456,1.35518468 L4.60831458,5.27895256 C4.80447766,5.4733096 5.12105677,5.47184551 5.3154138,5.27568243 C5.50977084,5.07951935 5.50830675,4.76294025 5.31214367,4.56858321 L5.31214367,4.56858321 Z" id="Line-Copy-2" stroke="none" fill="#696969" fill-rule="evenodd"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="##4A464C">
<g fill-rule="evenodd">
<path d="M3.233 11.25l-.417 1H1.712C.763 12.25 0 11.574 0 10.747V6.503C0 5.675.755 5 1.712 5h4.127l-.417 1H1.597C1.257 6 1 6.225 1 6.503v4.244c0 .277.267.503.597.503h1.636zM7.405 11.27L7 12.306c.865.01 2.212-.024 2.315-.04.112-.016.112-.016.185-.035.075-.02.156-.046.251-.082.152-.056.349-.138.592-.244.415-.182.962-.435 1.612-.744l.138-.066a179.35 179.35 0 0 0 2.255-1.094c1.191-.546 1.191-2.074-.025-2.632l-.737-.34a3547.554 3547.554 0 0 0-3.854-1.78c-.029.11-.065.222-.11.336l-.232.596c.894.408 4.56 2.107 4.56 2.107.458.21.458.596 0 .806L9.197 11.27H7.405zM4.462 14.692l5-12a.5.5 0 1 0-.924-.384l-5 12a.5.5 0 1 0 .924.384z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 986 B

View file

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M9.05 4.634l-2.144.003-.116.116v1.445l.92.965.492.034.116-.116v-.617L9.13 5.7l.035-.95M12.482 10.38l-1.505-1.462H9.362l-.564.516-.034 1.108.72.768 1.323.034-.117-.116v1.2l.972 1.02.315.034.116-.116v-1.154l.422-.374.034-.927-.117.117h.26l.408-.36V10.5l-.125-.124-.575-.033"/>
<path d="M8.47 15.073c-3.088 0-5.6-2.513-5.6-5.602V9.4v-.003c0-.018 0-.018.002-.034l.182-.088.724.587.49.033.497.543-.034.9.317.383h.47l.114.096-.032 1.9.524.553h.105l.025-.338 1.004-.95.054-.474.53-.462v-.888l-.588-.038-1.118-1.155H4.48l-.154-.09V9.01l.155-.1h1.164v-.273l.12-.115.7.033.494-.443.034-.746-.624-.655h-.724v.28l-.11.07H4.64l-.114-.09.025-.64.48-.43v-.244h-.382c-.102 0-.152-.128-.08-.2 1.04-1.01 2.428-1.59 3.903-1.59 1.374 0 2.672.5 3.688 1.39.08.068.03.198-.075.198l-1.144-.034-.81.803.52.523v.16l-.382.388h-.158l-.176-.177v-.16l.076-.074-.252-.252-.37.362.53.53c.072.072.005.194-.096.194l-.752-.005v.844h.783L9.885 8l.16-.143h.16l.62.61v.267l.58.027.003.002V8.76l.18-.03 1.234 1.24.753-.708h.382l.116.108c0 .02.003.016.003.036v.065c0 3.09-2.515 5.603-5.605 5.603M8.47 3C4.904 3 2 5.903 2 9.47c0 3.57 2.903 6.472 6.47 6.472 3.57 0 6.472-2.903 6.472-6.47C14.942 5.9 12.04 3 8.472 3"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M4 2v12h9V4.775L9.888 2H4zm0-1h5.888c.246 0 .483.09.666.254l3.112 2.774c.212.19.334.462.334.747V14c0 .552-.448 1-1 1H4c-.552 0-1-.448-1-1V2c0-.552.448-1 1-1z"/>
<path d="M9 1.5v4c0 .325.306.564.62.485l4-1c.27-.067.432-.338.365-.606-.067-.27-.338-.432-.606-.365l-4 1L10 5.5v-4c0-.276-.224-.5-.5-.5s-.5.224-.5.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 630 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M2 5.193v7.652c0 .003-.002 0 .007 0H14v-7.69c0-.003.002 0-.007 0h-7.53v-2.15c0-.002-.004-.005-.01-.005H2.01C2 3 2 3 2 3.005V5.193zm-1 0V3.005C1 2.45 1.444 2 2.01 2h4.442c.558 0 1.01.45 1.01 1.005v1.15h6.53c.557 0 1.008.44 1.008 1v7.69c0 .553-.45 1-1.007 1H2.007c-.556 0-1.007-.44-1.007-1V5.193zM6.08 4.15H2v1h4.46v-1h-.38z" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 660 B

View file

@ -0,0 +1,10 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="13px" height="12px" viewBox="14 6 13 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="world" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(14.000000, 6.000000)" stroke-linecap="round" stroke-linejoin="round">
<path d="M6.35076107,0.354 C3.25095418,0.354 0.729,2.87582735 0.729,5.9758879 C0.729,9.07544113 3.25082735,11.5972685 6.35076107,11.5972685 C9.45044113,11.5972685 11.9723953,9.07544113 11.9723953,5.97576107 C11.9723953,2.87582735 9.45044113,0.354 6.35076107,0.354 L6.35076107,0.354 Z M6.35076107,10.8289121 C3.67445071,10.8289121 1.49722956,8.65181776 1.49722956,5.97576107 C1.49722956,5.9443064 1.49900522,5.91335907 1.49976622,5.88215806 L2.20090094,6.4213266 L2.56313696,6.4213266 L2.97268183,6.8306178 L2.97268183,7.68217686 L3.32324919,8.03287105 L3.73926255,8.03287105 L3.73926255,9.79940584 L4.27386509,10.3361645 L4.4591686,10.3361645 L4.4591686,10.000183 L5.37655417,9.08343163 L5.37655417,8.73400577 L5.85585737,8.25203907 L5.85585737,7.37206934 L5.32518666,7.37206934 L4.28439226,6.33140176 L2.82225748,6.33140176 L2.82225748,5.56938704 L3.96286973,5.56938704 L3.96286973,5.23949352 L4.65068695,5.23949352 L5.11477015,4.77667865 L5.11477015,4.03001076 L4.49087694,3.40662489 L3.75359472,3.40662489 L3.75359472,3.78725175 L2.96228149,3.78725175 L2.96228149,3.28385021 L3.42217919,2.82319151 L3.42217919,2.49786399 L2.97001833,2.49786399 C3.84466106,1.64744643 5.03714814,1.12222956 6.35063424,1.12222956 C7.57292716,1.12222956 8.69020207,1.57730759 9.54442463,2.32587797 L8.46164839,2.32587797 L7.680355,3.10666403 L8.21508437,3.64088607 L7.87238068,3.98257509 L7.7165025,3.82669692 L7.85297518,3.68946324 L7.78930484,3.62566607 L7.78943167,3.62566607 L7.56011699,3.39559038 L7.55986332,3.39571722 L7.49758815,3.33318838 L7.01904595,3.78585658 L7.55910232,4.32654712 L6.8069806,4.32198112 L6.8069806,5.25864535 L7.66716433,5.25864535 L7.6723645,4.72112565 L7.81289584,4.57996014 L8.31819988,5.08653251 L8.31819988,5.41921636 L9.00703176,5.41921636 L9.03366676,5.39321553 L9.03430093,5.39194719 L10.195587,6.55259911 L10.8637451,5.88520206 L11.2018828,5.88520206 C11.2023901,5.9153884 11.2041658,5.94532107 11.2041658,5.97563424 C11.2040389,8.65181776 9.0269446,10.8289121 6.35076107,10.8289121 L6.35076107,10.8289121 Z" id="Shape" stroke="#DDE1E5" stroke-width="0.25" fill="#DDE1E5"></path>
<polygon id="Shape" stroke="#DDE1E5" stroke-width="0.25" fill="#DDE1E5" points="6.50676608 1.61523076 4.52892694 1.61789426 4.52892694 2.95192735 5.34560683 3.76733891 5.72496536 3.76733891 5.72496536 3.1967157 6.50676608 2.41592965"></polygon>
<polygon id="Shape" stroke="#DDE1E5" stroke-width="0.25" fill="#DDE1E5" points="9.59959714 6.88718547 8.28623788 5.57268471 8.28623788 5.57002121 6.79607294 5.57002121 6.35101474 6.01469891 6.35101474 6.96201714 6.98429362 7.59466185 8.12909136 7.59466185 8.12909136 8.70343893 8.99434843 9.56882283 9.20971144 9.56882283 9.20971144 8.50329592 9.63029081 8.08271655 9.63029081 7.3026915 9.87025949 7.3026915 10.1711082 7.00082814 10.0558167 6.88718547"></polygon>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path class="st0" d="M9 9.3l3.6 3.6"/>
<ellipse fill="transparent" cx="5.9" cy="6.2" rx="4.5" ry="4.5"/>
</svg>

After

Width:  |  Height:  |  Size: 200 B

View file

@ -0,0 +1,10 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16px" height="15px" viewBox="975 569 11 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Pause-circle" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(976.000000, 570.000000)">
<path d="M4.5,0.538639227 C2.3152037,0.538639227 0.538639227,2.31614868 0.538639227,4.5 C0.538639227,6.6847963 2.3152037,8.46136077 4.5,8.46136077 C6.6847963,8.46136077 8.46136077,6.6847963 8.46136077,4.5 C8.46136077,2.31614868 6.6847963,0.538639227 4.5,0.538639227 M4.5,9 C2.01847963,9 0,6.98152037 0,4.5 C0,2.01847963 2.01847963,0 4.5,0 C6.98152037,0 9,2.01847963 9,4.5 C9,6.98152037 6.98152037,9 4.5,9" id="Fill-1-Copy" stroke="#4990E2" stroke-width="0.5" fill="#4990E2"></path>
<path d="M3,3 L3,6.5" id="Line" stroke="#4990E2" stroke-width="1.15" stroke-linecap="round"></path>
<path d="M6,3 L6,6.5" id="Line" stroke="#4990E2" stroke-width="1.15" stroke-linecap="round"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M10.483 13.995H5.517l-3.512-3.512V5.516l3.512-3.512h4.966l3.512 3.512v4.967l-3.512 3.512zm4.37-9.042l-3.807-3.805A.503.503 0 0 0 10.691 1H5.309a.503.503 0 0 0-.356.148L1.147 4.953A.502.502 0 0 0 1 5.308v5.383c0 .134.053.262.147.356l3.806 3.806a.503.503 0 0 0 .356.147h5.382a.503.503 0 0 0 .355-.147l3.806-3.806A.502.502 0 0 0 15 10.69V5.308a.502.502 0 0 0-.147-.355z"/>
<path d="M10 10.5a.5.5 0 1 0 1 0v-5a.5.5 0 1 0-1 0v5zM5 10.5a.5.5 0 1 0 1 0v-5a.5.5 0 0 0-1 0v5z"/>
</svg>

After

Width:  |  Height:  |  Size: 786 B

View file

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<path d="M6.5 12.003l.052-9a.5.5 0 1 0-1-.006l-.052 9a.5.5 0 1 0 1 .006zM13 11.997l-.05-9a.488.488 0 0 0-.477-.497.488.488 0 0 0-.473.503l.05 9a.488.488 0 0 0 .477.497.488.488 0 0 0 .473-.503z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 536 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#696969">
<path d="M4 13l7.778-5L4 3v10zm-1 0V3a1 1 0 0 1 1.54-.841l7.779 5a1 1 0 0 1 0 1.682l-7.778 5A1 1 0 0 1 3 13z" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 452 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M8.5 8.5V14a.5.5 0 1 1-1 0V8.5H2a.5.5 0 0 1 0-1h5.5V2a.5.5 0 0 1 1 0v5.5H14a.5.5 0 1 1 0 1H8.5z" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 433 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M4.525 13.21h-.472c-.574 0-.987-.154-1.24-.463-.253-.31-.38-.882-.38-1.719v-.573c0-.746-.097-1.265-.292-1.557-.196-.293-.51-.44-.945-.44v-.974c.435 0 .75-.146.945-.44.195-.292.293-.811.293-1.556v-.58c0-.833.126-1.404.379-1.712.253-.31.666-.464 1.24-.464h.472v.783h-.179c-.37 0-.628.08-.774.24-.145.159-.218.54-.218 1.141v.383c0 .824-.096 1.432-.287 1.823-.191.39-.516.679-.974.866.458.191.783.482.974.873.191.39.287.998.287 1.823v.382c0 .602.073.982.218 1.142.146.16.404.239.774.239h.18v.783zm9.502-4.752c-.43 0-.744.147-.942.44-.197.292-.296.811-.296 1.557v.573c0 .837-.125 1.41-.376 1.719-.251.309-.664.463-1.237.463h-.478v-.783h.185c.37 0 .628-.08.774-.24.145-.159.218-.539.218-1.14v-.383c0-.825.096-1.433.287-1.823.191-.39.516-.682.974-.873-.458-.187-.783-.476-.974-.866-.191-.391-.287-.999-.287-1.823v-.383c0-.602-.073-.982-.218-1.142-.146-.159-.404-.239-.774-.239h-.185v-.783h.478c.573 0 .986.155 1.237.464.25.308.376.88.376 1.712v.58c0 .673.088 1.174.263 1.503.176.329.5.493.975.493v.974z" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M6.925 12.5l7.4-5-7.4-5v10zM6 12.5v-10c0-.785.8-1.264 1.415-.848l7.4 5c.58.392.58 1.304 0 1.696l-7.4 5C6.8 13.764 6 13.285 6 12.5z" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 468 B

View file

@ -0,0 +1,9 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="#D92215">
<path d="M8 14.5c-3.6 0-6.5-2.9-6.5-6.5S4.4 1.5 8 1.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zm0-12C5 2.5 2.5 5 2.5 8S5 13.5 8 13.5 13.5 11 13.5 8 11 2.5 8 2.5z"/>
<circle cx="5" cy="6" r="1" transform="translate(1 1)"/>
<circle cx="9" cy="6" r="1" transform="translate(1 1)"/>
<path d="M5.5 11c-.1 0-.2 0-.3-.1-.2-.1-.3-.4-.1-.7C6 9 7 8.5 8.1 8.5c1.7.1 2.8 1.7 2.8 1.8.2.2.1.5-.1.7-.2.1-.6 0-.7-.2 0 0-.9-1.3-2-1.3-.7 0-1.4.4-2.1 1.3-.2.2-.4.2-.5.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 772 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="33" height="12" viewBox="0 0 33 12">
<path id="base-path" d="M27.1,0H1C0.4,0,0,0.4,0,1v10c0,0.6,0.4,1,1,1h26.1 c0.6,0,1.2-0.3,1.5-0.7L33,6l-4.4-5.3C28.2,0.3,27.7,0,27.1,0z"/>
</svg>

After

Width:  |  Height:  |  Size: 486 B

View file

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<path d="M1.5 14.042h4.095a.5.5 0 0 0 0-1H1.5a.5.5 0 1 0 0 1zM7.983 2a.5.5 0 0 1 .517.5v7.483l3.136-3.326a.5.5 0 1 1 .728.686l-4 4.243a.499.499 0 0 1-.73-.004L3.635 7.343a.5.5 0 0 1 .728-.686L7.5 9.983V3H1.536C1.24 3 1 2.776 1 2.5s.24-.5.536-.5h6.447zM10.5 14.042h4.095a.5.5 0 0 0 0-1H10.5a.5.5 0 1 0 0 1z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 649 B

View file

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<path d="M5 13.5H1a.5.5 0 1 0 0 1h4a.5.5 0 1 0 0-1zM12 13.5H8a.5.5 0 1 0 0 1h4a.5.5 0 1 0 0-1zM6.11 5.012A.427.427 0 0 1 6.21 5h7.083L9.646 1.354a.5.5 0 1 1 .708-.708l4.5 4.5a.498.498 0 0 1 0 .708l-4.5 4.5a.5.5 0 0 1-.708-.708L13.293 6H6.5v5.5a.5.5 0 1 1-1 0v-6a.5.5 0 0 1 .61-.488z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 626 B

View file

@ -0,0 +1,9 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<path d="M13.297 6.912C12.595 4.39 10.167 2.5 7.398 2.5A5.898 5.898 0 0 0 1.5 8.398a.5.5 0 0 0 1 0A4.898 4.898 0 0 1 7.398 3.5c2.75 0 5.102 2.236 5.102 4.898v.004L8.669 7.029a.5.5 0 0 0-.338.942l4.462 1.598a.5.5 0 0 0 .651-.34.506.506 0 0 0 .02-.043l2-5a.5.5 0 1 0-.928-.372l-1.24 3.098z"/>
<circle cx="7" cy="12" r="1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 666 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M12.219 7c.345 0 .635.117.869.352.234.234.351.524.351.869 0 .351-.118.652-.356.903-.238.25-.526.376-.864.376-.332 0-.615-.125-.85-.376a1.276 1.276 0 0 1-.351-.903A1.185 1.185 0 0 1 12.218 7zM8.234 7c.345 0 .635.117.87.352.234.234.351.524.351.869 0 .351-.119.652-.356.903-.238.25-.526.376-.865.376-.332 0-.613-.125-.844-.376a1.286 1.286 0 0 1-.347-.903c0-.352.114-.643.342-.874.228-.231.51-.347.85-.347zM4.201 7c.339 0 .627.117.864.352.238.234.357.524.357.869 0 .351-.119.652-.357.903-.237.25-.525.376-.864.376-.338 0-.623-.125-.854-.376A1.286 1.286 0 0 1 3 8.221 1.185 1.185 0 0 1 4.201 7z" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 927 B

View file

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<path d="M3.233 11.25l-.417 1H1.712C.763 12.25 0 11.574 0 10.747V6.503C0 5.675.755 5 1.712 5h4.127l-.417 1H1.597C1.257 6 1 6.225 1 6.503v4.244c0 .277.267.503.597.503h1.636zM7.405 11.27L7 12.306c.865.01 2.212-.024 2.315-.04.112-.016.112-.016.185-.035.075-.02.156-.046.251-.082.152-.056.349-.138.592-.244.415-.182.962-.435 1.612-.744l.138-.066a179.35 179.35 0 0 0 2.255-1.094c1.191-.546 1.191-2.074-.025-2.632l-.737-.34a3547.554 3547.554 0 0 0-3.854-1.78c-.029.11-.065.222-.11.336l-.232.596c.894.408 4.56 2.107 4.56 2.107.458.21.458.596 0 .806L9.197 11.27H7.405zM4.462 14.692l5-12a.5.5 0 1 0-.924-.384l-5 12a.5.5 0 1 0 .924.384z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 970 B

View file

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M8.5 8.793L5.854 6.146l-.04-.035L7.5 4.426c.2-.2.3-.4.3-.6 0-.2-.1-.4-.2-.6l-1-1c-.4-.3-.9-.3-1.2 0l-4.1 4.1c-.2.2-.3.4-.3.6 0 .2.1.4.2.6l1 1c.3.3.9.3 1.2 0l1.71-1.71.036.04L7.793 9.5l-3.647 3.646c-.195.196-.195.512 0 .708.196.195.512.195.708 0L8.5 10.207l3.646 3.647c.196.195.512.195.708 0 .195-.196.195-.512 0-.708L9.207 9.5l2.565-2.565L13.3 8.5c.1.1 2.3 1.1 2.7.7.4-.4-.3-2.7-.5-2.9l-1.1-1.1c.1-.1.2-.4.2-.6 0-.2-.1-.4-.2-.6l-.4-.4c-.3-.3-.8-.3-1.1 0l-1.5-1.4c-.2-.2-.3-.2-.5-.2s-.3.1-.5.2L9.2 3.4c-.2.1-.2.2-.2.4s.1.4.2.5l1.874 1.92L8.5 8.792z"/>
</svg>

After

Width:  |  Height:  |  Size: 885 B

View file

@ -0,0 +1,31 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html dir="">
<head>
<link rel="stylesheet"
type="text/css"
href="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css" />
<link rel="stylesheet"
type="text/css"
href="chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.css" />
<link rel="stylesheet"
type="text/css"
href="chrome://devtools/content/sourceeditor/codemirror/mozilla.css" />
<link rel="stylesheet" type="text/css" href="resource://devtools/client/debugger/new/styles.css" />
</head>
<body>
<div id="mount"></div>
<script type="application/javascript;version=1.8"
src="chrome://devtools/content/shared/theme-switching.js"></script>
<script type="text/javascript">
const { BrowserLoader } = Components.utils.import("resource://devtools/client/shared/browser-loader.js", {});
const { require: devtoolsRequire } = BrowserLoader({
baseURI: "resource://devtools/client/debugger/new/",
window,
});
</script>
<script type="text/javascript" src="resource://devtools/client/debugger/new/bundle.js"></script>
</body>
</html>

View file

@ -0,0 +1,12 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'bundle.js',
'panel.js',
'pretty-print-worker.js',
'source-map-worker.js',
'styles.css'
)

View file

@ -0,0 +1,77 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { Task } = require("devtools/shared/task");
var {LocalizationHelper} = require("devtools/shared/l10n");
const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
var L10N = new LocalizationHelper(DBG_STRINGS_URI);
function DebuggerPanel(iframeWindow, toolbox) {
this.panelWin = iframeWindow;
this.panelWin.L10N = L10N;
this.toolbox = toolbox;
}
DebuggerPanel.prototype = {
open: Task.async(function* () {
if (!this.toolbox.target.isRemote) {
yield this.toolbox.target.makeRemote();
}
yield this.panelWin.Debugger.bootstrap({
threadClient: this.toolbox.threadClient,
tabTarget: this.toolbox.target
});
this.isReady = true;
return this;
}),
_store: function () {
return this.panelWin.Debugger.store;
},
_getState: function () {
return this._store().getState();
},
_actions: function () {
return this.panelWin.Debugger.actions;
},
_selectors: function () {
return this.panelWin.Debugger.selectors;
},
getFrames: function () {
let frames = this._selectors().getFrames(this._getState());
// Frames is null when the debugger is not paused.
if (!frames) {
return {
frames: [],
selected: -1
};
}
frames = frames.toJS();
const selectedFrame = this._selectors().getSelectedFrame(this._getState());
const selected = frames.findIndex(frame => frame.id == selectedFrame.id);
frames.forEach(frame => {
frame.actor = frame.id;
});
return { frames, selected };
},
destroy: function () {
this.panelWin.Debugger.destroy();
this.emit("destroyed");
}
};
exports.DebuggerPanel = DebuggerPanel;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
{
"globals": {
"add_task": false,
"Assert": false,
"BrowserTestUtils": false,
"content": false,
"ContentTask": false,
"ContentTaskUtils": false,
"EventUtils": false,
"executeSoon": false,
"expectUncaughtException": false,
"export_assertions": false,
"extractJarToTmp": false,
"finish": false,
"getJar": false,
"getRootDirectory": false,
"getTestFilePath": false,
"gBrowser": false,
"gTestPath": false,
"info": false,
"is": false,
"isnot": false,
"ok": false,
"registerCleanupFunction": false,
"requestLongerTimeout": false,
"SimpleTest": false,
"SpecialPowers": false,
"TestUtils": false,
"thisTestLeaksUncaughtRejectionsAndShouldBeFixed": false,
"todo": false,
"todo_is": false,
"todo_isnot": false,
"waitForClipboard": false,
"waitForExplicitFinish": false,
"waitForFocus": false,
// Globals introduced in debugger-specific head.js
"promise": false,
"BrowserToolboxProcess": false,
"OS": false,
"waitForNextDispatch": false,
"waitForDispatch": false,
"waitForThreadEvents": false,
"waitForState": false,
"waitForElement": false,
"waitForPaused": false,
"waitForSources": false,
"isPaused": false,
"assertPausedLocation": false,
"assertHighlightLocation": false,
"createDebuggerContext": false,
"initDebugger": false,
"invokeInTab": false,
"findSource": false,
"findElement": false,
"findElementWithSelector": false,
"findAllElements": false,
"openNewTabAndToolbox": false,
"selectSource": false,
"stepOver": false,
"stepIn": false,
"stepOut": false,
"resume": false,
"reload": false,
"navigate": false,
"removeBreakpoint": false,
"addBreakpoint": false,
"toggleCallStack": false,
"toggleScopes": false,
"isVisibleWithin": false,
"clickElement": false,
"rightClickElement": false,
"selectMenuItem": false,
"togglePauseOnExceptions": false,
"type": false,
"pressKey": false,
"EXAMPLE_URL": false,
"waitUntil": false
}
}

View file

@ -0,0 +1,60 @@
[DEFAULT]
tags = devtools
subsuite = devtools
skip-if = (os == 'linux' && debug && bits == 32)
support-files =
head.js
!/devtools/client/commandline/test/helpers.js
!/devtools/client/framework/test/shared-head.js
examples/bundle.js
examples/bundle.js.map
examples/doc-scripts.html
examples/doc-script-switching.html
examples/doc-exceptions.html
examples/doc-iframes.html
examples/doc-frames.html
examples/doc-debugger-statements.html
examples/doc-minified.html
examples/doc-sourcemaps.html
examples/doc-sourcemap-bogus.html
examples/doc-sources.html
examples/bogus-map.js
examples/entry.js
examples/exceptions.js
examples/long.js
examples/math.min.js
examples/nested/nested-source.js
examples/opts.js
examples/output.js
examples/simple1.js
examples/simple2.js
examples/frames.js
examples/script-switching-02.js
examples/script-switching-01.js
examples/times2.js
[browser_dbg-breaking.js]
[browser_dbg-breaking-from-console.js]
[browser_dbg-breakpoints.js]
[browser_dbg-breakpoints-cond.js]
[browser_dbg-call-stack.js]
[browser_dbg-scopes.js]
[browser_dbg-chrome-create.js]
[browser_dbg-chrome-debugging.js]
[browser_dbg-console.js]
[browser_dbg-debugger-buttons.js]
[browser_dbg-editor-gutter.js]
[browser_dbg-editor-mode.js]
[browser_dbg-editor-select.js]
[browser_dbg-editor-highlight.js]
[browser_dbg-iframes.js]
[browser_dbg_keyboard-shortcuts.js]
[browser_dbg-pause-exceptions.js]
[browser_dbg-navigation.js]
[browser_dbg-pretty-print.js]
[browser_dbg-pretty-print-paused.js]
[browser_dbg-searching.js]
skip-if = true
[browser_dbg-sourcemaps.js]
[browser_dbg-sourcemaps-bogus.js]
[browser_dbg-sources.js]

View file

@ -0,0 +1,31 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that `debugger` statements are hit before the debugger even
// initializes and it properly highlights the right location in the
// debugger.
add_task(function* () {
const url = EXAMPLE_URL + "doc-script-switching.html";
const toolbox = yield openNewTabAndToolbox(url, "webconsole");
// Type "debugger" into console
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
jsterm.execute("debugger");
// Wait for the debugger to be selected and make sure it's paused
yield new Promise((resolve) => {
toolbox.on("jsdebugger-selected", resolve);
});
is(toolbox.threadClient.state, "paused");
// Create a dbg context
const dbg = createDebuggerContext(toolbox);
const { selectors: { getSelectedSource }, getState } = dbg;
// Make sure the thread is paused in the right source and location
yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
is(dbg.win.cm.getValue(), "debugger");
const source = getSelectedSource(getState()).toJS();
assertPausedLocation(dbg, source, 1);
});

View file

@ -0,0 +1,32 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests the breakpoints are hit in various situations.
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
const { selectors: { getSelectedSource }, getState } = dbg;
// Make sure we can set a top-level breakpoint and it will be hit on
// reload.
yield addBreakpoint(dbg, "scripts.html", 18);
reload(dbg);
yield waitForPaused(dbg);
assertPausedLocation(dbg, "scripts.html", 18);
yield resume(dbg);
const paused = waitForPaused(dbg);
// Create an eval script that pauses itself.
invokeInTab("doEval");
yield paused;
yield resume(dbg);
const source = getSelectedSource(getState()).toJS();
ok(!source.url, "It is an eval source");
yield addBreakpoint(dbg, source, 5);
invokeInTab("evaledFunc");
yield waitForPaused(dbg);
assertPausedLocation(dbg, source, 5);
});

View file

@ -0,0 +1,50 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function findBreakpoint(dbg, url, line) {
const { selectors: { getBreakpoint }, getState } = dbg;
const source = findSource(dbg, url);
return getBreakpoint(getState(), { sourceId: source.id, line });
}
function setConditionalBreakpoint(dbg, index, condition) {
return Task.spawn(function* () {
rightClickElement(dbg, "gutter", index);
selectMenuItem(dbg, 2);
yield waitForElement(dbg, ".conditional-breakpoint-panel input");
findElementWithSelector(dbg, ".conditional-breakpoint-panel input").focus();
type(dbg, condition);
pressKey(dbg, "Enter");
});
}
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
yield selectSource(dbg, "simple2");
// Adding a conditional Breakpoint
yield setConditionalBreakpoint(dbg, 5, "1");
yield waitForDispatch(dbg, "ADD_BREAKPOINT");
let bp = findBreakpoint(dbg, "simple2", 5);
is(bp.condition, "1", "breakpoint is created with the condition");
// Editing a conditional Breakpoint
yield setConditionalBreakpoint(dbg, 5, "2");
yield waitForDispatch(dbg, "SET_BREAKPOINT_CONDITION");
bp = findBreakpoint(dbg, "simple2", 5);
is(bp.condition, "21", "breakpoint is created with the condition");
// Removing a conditional breakpoint
clickElement(dbg, "gutter", 5);
yield waitForDispatch(dbg, "REMOVE_BREAKPOINT");
bp = findBreakpoint(dbg, "simple2", 5);
is(bp, null, "breakpoint was removed");
// Adding a condition to a breakpoint
clickElement(dbg, "gutter", 5);
yield waitForDispatch(dbg, "ADD_BREAKPOINT");
yield setConditionalBreakpoint(dbg, 5, "1");
bp = findBreakpoint(dbg, "simple2", 5);
is(bp.condition, "1", "breakpoint is created with the condition");
});

View file

@ -0,0 +1,101 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function toggleBreakpoint(dbg, index) {
const bp = findElement(dbg, "breakpointItem", index);
const input = bp.querySelector("input");
input.click();
}
function removeBreakpoint(dbg, index) {
return Task.spawn(function* () {
const bp = findElement(dbg, "breakpointItem", index);
bp.querySelector(".close-btn").click();
yield waitForDispatch(dbg, "REMOVE_BREAKPOINT");
});
}
function disableBreakpoint(dbg, index) {
return Task.spawn(function* () {
toggleBreakpoint(dbg, index);
yield waitForDispatch(dbg, "REMOVE_BREAKPOINT");
});
}
function enableBreakpoint(dbg, index) {
return Task.spawn(function* () {
toggleBreakpoint(dbg, index);
yield waitForDispatch(dbg, "ADD_BREAKPOINT");
});
}
function toggleBreakpoints(dbg) {
return Task.spawn(function* () {
const btn = findElement(dbg, "toggleBreakpoints");
btn.click();
yield waitForDispatch(dbg, "TOGGLE_BREAKPOINTS");
});
}
function findBreakpoint(dbg, url, line) {
const { selectors: { getBreakpoint }, getState } = dbg;
const source = findSource(dbg, url);
return getBreakpoint(getState(), { sourceId: source.id, line });
}
function findBreakpoints(dbg) {
const { selectors: { getBreakpoints }, getState } = dbg;
return getBreakpoints(getState());
}
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
// Create two breakpoints
yield selectSource(dbg, "simple2");
yield addBreakpoint(dbg, "simple2", 3);
yield addBreakpoint(dbg, "simple2", 5);
// Disable the first one
yield disableBreakpoint(dbg, 1);
let bp1 = findBreakpoint(dbg, "simple2", 3);
let bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp1.disabled, true, "first breakpoint is disabled");
is(bp2.disabled, false, "second breakpoint is enabled");
// Disable and Re-Enable the second one
yield disableBreakpoint(dbg, 2);
yield enableBreakpoint(dbg, 2);
bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp2.disabled, false, "second breakpoint is enabled");
});
// toggle all
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
// Create two breakpoints
yield selectSource(dbg, "simple2");
yield addBreakpoint(dbg, "simple2", 3);
yield addBreakpoint(dbg, "simple2", 5);
// Disable all of the breakpoints
yield toggleBreakpoints(dbg);
let bp1 = findBreakpoint(dbg, "simple2", 3);
let bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp1.disabled, true, "first breakpoint is disabled");
is(bp2.disabled, true, "second breakpoint is disabled");
// Enable all of the breakpoints
yield toggleBreakpoints(dbg);
bp1 = findBreakpoint(dbg, "simple2", 3);
bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp1.disabled, false, "first breakpoint is enabled");
is(bp2.disabled, false, "second breakpoint is enabled");
// Remove the breakpoints
yield removeBreakpoint(dbg, 1);
yield removeBreakpoint(dbg, 1);
const bps = findBreakpoints(dbg);
is(bps.size, 0, "breakpoints are removed");
});

View file

@ -0,0 +1,62 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// checks to see if the frame is selected and the title is correct
function isFrameSelected(dbg, index, title) {
const $frame = findElement(dbg, "frame", index);
const frame = dbg.selectors.getSelectedFrame(dbg.getState());
const elSelected = $frame.classList.contains("selected");
const titleSelected = frame.displayName == title;
return elSelected && titleSelected;
}
function toggleButton(dbg) {
const callStackBody = findElement(dbg, "callStackBody");
return callStackBody.querySelector(".show-more");
}
add_task(function* () {
const dbg = yield initDebugger("doc-script-switching.html");
toggleCallStack(dbg);
const notPaused = findElement(dbg, "callStackBody").innerText;
is(notPaused, "Not Paused", "Not paused message is shown");
invokeInTab("firstCall");
yield waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "secondCall"), "the first frame is selected");
clickElement(dbg, "frame", 2);
ok(isFrameSelected(dbg, 2, "firstCall"), "the second frame is selected");
let button = toggleButton(dbg);
ok(!button, "toggle button shouldn't be there");
});
add_task(function* () {
const dbg = yield initDebugger("doc-frames.html");
toggleCallStack(dbg);
invokeInTab("startRecursion");
yield waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "recurseA"), "the first frame is selected");
// check to make sure that the toggle button isn't there
let button = toggleButton(dbg);
let frames = findAllElements(dbg, "frames");
is(button.innerText, "Expand Rows", "toggle button should be expand");
is(frames.length, 7, "There should be at most seven frames");
button.click();
button = toggleButton(dbg);
frames = findAllElements(dbg, "frames");
is(button.innerText, "Collapse Rows", "toggle button should be collapse");
is(frames.length, 22, "All of the frames should be shown");
});

View file

@ -0,0 +1,72 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that a chrome debugger can be created in a new process.
*/
const { BrowserToolboxProcess } = Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
let gProcess = undefined;
function initChromeDebugger() {
info("Initializing a chrome debugger process.");
return new Promise(resolve => {
BrowserToolboxProcess.init(onClose, (event, _process) => {
info("Browser toolbox process started successfully.");
resolve(_process);
});
});
}
function onClose() {
ok(!gProcess._dbgProcess.isRunning,
"The remote debugger process isn't closed as it should be!");
is(gProcess._dbgProcess.exitValue, (Services.appinfo.OS == "WINNT" ? 0 : 256),
"The remote debugger process didn't die cleanly.");
info("process exit value: " + gProcess._dbgProcess.exitValue);
info("profile path: " + gProcess._dbgProfilePath);
finish();
}
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.remote-enabled");
gProcess = null;
});
add_task(function* () {
// Windows XP and 8.1 test slaves are terribly slow at this test.
requestLongerTimeout(5);
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
gProcess = yield initChromeDebugger();
ok(gProcess._dbgProcess,
"The remote debugger process wasn't created properly!");
ok(gProcess._dbgProcess.isRunning,
"The remote debugger process isn't running!");
is(typeof gProcess._dbgProcess.pid, "number",
"The remote debugger process doesn't have a pid (?!)");
info("process location: " + gProcess._dbgProcess.location);
info("process pid: " + gProcess._dbgProcess.pid);
info("process name: " + gProcess._dbgProcess.processName);
info("process sig: " + gProcess._dbgProcess.processSignature);
ok(gProcess._dbgProfilePath,
"The remote debugger profile wasn't created properly!");
is(
gProcess._dbgProfilePath,
OS.Path.join(OS.Constants.Path.profileDir, "chrome_debugger_profile"),
"The remote debugger profile isn't where we expect it!"
);
info("profile path: " + gProcess._dbgProfilePath);
gProcess.close();
});

View file

@ -0,0 +1,88 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that chrome debugging works.
*/
var gClient, gThreadClient;
var gNewGlobal = promise.defer();
var gNewChromeSource = promise.defer();
var { DevToolsLoader } = Cu.import("resource://devtools/shared/Loader.jsm", {});
var customLoader = new DevToolsLoader();
customLoader.invisibleToDebugger = true;
var { DebuggerServer } = customLoader.require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/main");
function initDebuggerClient() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
DebuggerServer.allowChromeProcess = true;
let transport = DebuggerServer.connectPipe();
return new DebuggerClient(transport);
}
function attachThread(client, actor) {
return new Promise(resolve => {
client.attachTab(actor, (response, tabClient) => {
tabClient.attachThread(null, (r, threadClient) => {
resolve(threadClient);
});
});
});
}
function onNewGlobal() {
ok(true, "Received a new chrome global.");
gClient.removeListener("newGlobal", onNewGlobal);
gNewGlobal.resolve();
}
function onNewSource(event, packet) {
if (packet.source.url.startsWith("chrome:")) {
ok(true, "Received a new chrome source: " + packet.source.url);
gThreadClient.removeListener("newSource", onNewSource);
gNewChromeSource.resolve();
}
}
function resumeAndCloseConnection() {
return new Promise(resolve => {
gThreadClient.resume(() => resolve(gClient.close()));
});
}
registerCleanupFunction(function() {
gClient = null;
gThreadClient = null;
gNewGlobal = null;
gNewChromeSource = null;
customLoader = null;
DebuggerServer = null;
});
add_task(function* () {
gClient = initDebuggerClient();
const [type] = yield gClient.connect();
is(type, "browser", "Root actor should identify itself as a browser.");
const response = yield gClient.getProcess();
let actor = response.form.actor;
gThreadClient = yield attachThread(gClient, actor);
gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
// listen for a new source and global
gThreadClient.addListener("newSource", onNewSource);
gClient.addListener("newGlobal", onNewGlobal);
yield promise.all([ gNewGlobal.promise, gNewChromeSource.promise ]);
yield resumeAndCloseConnection();
});

View file

@ -0,0 +1,34 @@
// Return a promise with a reference to jsterm, opening the split
// console if necessary. This cleans up the split console pref so
// it won't pollute other tests.
function getSplitConsole(dbg) {
const { toolbox, win } = dbg;
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled");
});
if (!win) {
win = toolbox.win;
}
if (!toolbox.splitConsole) {
EventUtils.synthesizeKey("VK_ESCAPE", {}, win);
}
return new Promise(resolve => {
toolbox.getPanelWhenReady("webconsole").then(() => {
ok(toolbox.splitConsole, "Split console is shown.");
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
resolve(jsterm);
});
});
}
add_task(function* () {
Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
const dbg = yield initDebugger("doc-script-switching.html");
yield getSplitConsole(dbg);
ok(dbg.toolbox.splitConsole, "Split console is shown.");
});

View file

@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function clickStepOver(dbg) {
clickElement(dbg, "stepOver");
return waitForPaused(dbg);
}
function clickStepIn(dbg) {
clickElement(dbg, "stepIn");
return waitForPaused(dbg);
}
function clickStepOut(dbg) {
clickElement(dbg, "stepOut");
return waitForPaused(dbg);
}
/**
* Test debugger buttons
* 1. resume
* 2. stepOver
* 3. stepIn
* 4. stepOver to the end of a function
* 5. stepUp at the end of a function
*/
add_task(function* () {
const dbg = yield initDebugger("doc-debugger-statements.html");
yield reload(dbg);
yield waitForPaused(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 8);
// resume
clickElement(dbg, "resume");
yield waitForPaused(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 12);
// step over
yield clickStepOver(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 13);
// step into
yield clickStepIn(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 18);
// step over
yield clickStepOver(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 20);
// step out
yield clickStepOut(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 20);
});

View file

@ -0,0 +1,64 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests the breakpoint gutter and making sure breakpoint icons exist
// correctly
// Utilities for interacting with the editor
function clickGutter(dbg, line) {
clickElement(dbg, "gutter", line);
}
function getLineEl(dbg, line) {
const lines = dbg.win.document.querySelectorAll(".CodeMirror-code > div");
return lines[line - 1];
}
function assertEditorBreakpoint(dbg, line, shouldExist) {
const exists = !!getLineEl(dbg, line).querySelector(".new-breakpoint");
ok(exists === shouldExist,
"Breakpoint " + (shouldExist ? "exists" : "does not exist") +
" on line " + line);
}
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
const { selectors: { getBreakpoints, getBreakpoint }, getState } = dbg;
const source = findSource(dbg, "simple1.js");
yield selectSource(dbg, source.url);
// Make sure that clicking the gutter creates a breakpoint icon.
clickGutter(dbg, 4);
yield waitForDispatch(dbg, "ADD_BREAKPOINT");
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
assertEditorBreakpoint(dbg, 4, true);
// Make sure clicking at the same place removes the icon.
clickGutter(dbg, 4);
yield waitForDispatch(dbg, "REMOVE_BREAKPOINT");
is(getBreakpoints(getState()).size, 0, "No breakpoints exist");
assertEditorBreakpoint(dbg, 4, false);
// Test that a breakpoint icon slides down to the correct line.
clickGutter(dbg, 2);
yield waitForDispatch(dbg, "ADD_BREAKPOINT");
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
ok(getBreakpoint(getState(), { sourceId: source.id, line: 4 }),
"Breakpoint has correct line");
assertEditorBreakpoint(dbg, 2, false);
assertEditorBreakpoint(dbg, 4, true);
// Do the same sliding and make sure it works if there's already a
// breakpoint.
clickGutter(dbg, 2);
yield waitForDispatch(dbg, "ADD_BREAKPOINT");
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
assertEditorBreakpoint(dbg, 2, false);
assertEditorBreakpoint(dbg, 4, true);
clickGutter(dbg, 4);
yield waitForDispatch(dbg, "REMOVE_BREAKPOINT");
is(getBreakpoints(getState()).size, 0, "No breakpoints exist");
assertEditorBreakpoint(dbg, 4, false);
});

View file

@ -0,0 +1,46 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the editor will always highight the right line, no
// matter if the source text doesn't exist yet or even if the source
// doesn't exist.
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
const { selectors: { getSourceText }, getState } = dbg;
const sourceUrl = EXAMPLE_URL + "long.js";
// The source itself doesn't even exist yet, and using
// `selectSourceURL` will set a pending request to load this source
// and highlight a specific line.
dbg.actions.selectSourceURL(sourceUrl, { line: 66 });
// Wait for the source text to load and make sure we're in the right
// place.
yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
assertHighlightLocation(dbg, "long.js", 66);
// Jump to line 16 and make sure the editor scrolled.
yield selectSource(dbg, "long.js", 16);
assertHighlightLocation(dbg, "long.js", 16);
// Make sure only one line is ever highlighted and the flash
// animation is cancelled on old lines.
yield selectSource(dbg, "long.js", 17);
yield selectSource(dbg, "long.js", 18);
assertHighlightLocation(dbg, "long.js", 18);
is(findAllElements(dbg, "highlightLine").length, 1,
"Only 1 line is highlighted");
// Test jumping to a line in a source that exists but hasn't been
// loaded yet.
selectSource(dbg, "simple1.js", 6);
// Make sure the source is in the loading state, wait for it to be
// fully loaded, and check the highlighted line.
const simple1 = findSource(dbg, "simple1.js");
ok(getSourceText(getState(), simple1.id).get("loading"));
yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
ok(getSourceText(getState(), simple1.id).get("text"));
assertHighlightLocation(dbg, "simple1.js", 6);
});

View file

@ -0,0 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the editor sets the correct mode for different file
// types
add_task(function* () {
const dbg = yield initDebugger("doc-scripts.html");
yield selectSource(dbg, "simple1.js");
is(dbg.win.cm.getOption("mode").name, "javascript", "Mode is correct");
yield selectSource(dbg, "doc-scripts.html");
is(dbg.win.cm.getOption("mode").name, "htmlmixed", "Mode is correct");
});

View file

@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the editor highlights the correct location when the
// debugger pauses
// checks to see if the first breakpoint is visible
function isElementVisible(dbg, elementName) {
const bpLine = findElement(dbg, elementName);
const cm = findElement(dbg, "codeMirror");
return bpLine && isVisibleWithin(cm, bpLine);
}
add_task(function* () {
// This test runs too slowly on linux debug. I'd like to figure out
// which is the slowest part of this and make it run faster, but to
// fix a frequent failure allow a longer timeout.
requestLongerTimeout(2);
const dbg = yield initDebugger("doc-scripts.html");
const { selectors: { getSelectedSource }, getState } = dbg;
const simple1 = findSource(dbg, "simple1.js");
const simple2 = findSource(dbg, "simple2.js");
// Set the initial breakpoint.
yield addBreakpoint(dbg, simple1, 4);
ok(!getSelectedSource(getState()), "No selected source");
// Call the function that we set a breakpoint in.
invokeInTab("main");
yield waitForPaused(dbg);
assertPausedLocation(dbg, simple1, 4);
// Step through to another file and make sure it's paused in the
// right place.
yield stepIn(dbg);
assertPausedLocation(dbg, simple2, 2);
// Step back out to the initial file.
yield stepOut(dbg);
yield stepOut(dbg);
assertPausedLocation(dbg, simple1, 5);
yield resume(dbg);
// Make sure that we can set a breakpoint on a line out of the
// viewport, and that pausing there scrolls the editor to it.
let longSrc = findSource(dbg, "long.js");
yield addBreakpoint(dbg, longSrc, 66);
invokeInTab("testModel");
yield waitForPaused(dbg);
assertPausedLocation(dbg, longSrc, 66);
ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible");
});

View file

@ -0,0 +1,26 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test debugging a page with iframes
* 1. pause in the main thread
* 2. pause in the iframe
*/
add_task(function* () {
const dbg = yield initDebugger("doc-iframes.html");
// test pausing in the main thread
yield reload(dbg);
yield waitForPaused(dbg);
assertPausedLocation(dbg, "iframes.html", 8);
// test pausing in the iframe
yield resume(dbg);
yield waitForPaused(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 8);
// test pausing in the iframe
yield resume(dbg);
yield waitForPaused(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 12);
});

View file

@ -0,0 +1,47 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function countSources(dbg) {
const sources = dbg.selectors.getSources(dbg.getState());
return sources.size;
}
/**
* Test navigating
* navigating while paused will reset the pause state and sources
*/
add_task(function* () {
const dbg = yield initDebugger("doc-script-switching.html");
const { selectors: { getSelectedSource, getPause }, getState } = dbg;
invokeInTab("firstCall");
yield waitForPaused(dbg);
yield navigate(dbg, "doc-scripts.html", "simple1.js");
yield addBreakpoint(dbg, "simple1.js", 4);
invokeInTab("main");
yield waitForPaused(dbg);
assertPausedLocation(dbg, "simple1.js", 4);
is(countSources(dbg), 4, "4 sources are loaded.");
yield navigate(dbg, "about:blank");
yield waitForDispatch(dbg, "NAVIGATE");
is(countSources(dbg), 0, "0 sources are loaded.");
ok(!getPause(getState()), "No pause state exists");
yield navigate(dbg,
"doc-scripts.html",
"simple1.js",
"simple2.js",
"long.js",
"scripts.html"
);
is(countSources(dbg), 4, "4 sources are loaded.");
// Test that the current select source persists across reloads
yield selectSource(dbg, "long.js");
yield reload(dbg, "long.js");
ok(getSelectedSource(getState()).get("url").includes("long.js"),
"Selected source is long.js");
});

View file

@ -0,0 +1,46 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function uncaughtException() {
return invokeInTab("uncaughtException").catch(() => {});
}
function caughtException() {
return invokeInTab("caughtException");
}
/*
Tests Pausing on exception
1. skip an uncaught exception
2. pause on an uncaught exception
3. pause on a caught error
4. skip a caught error
*/
add_task(function* () {
const dbg = yield initDebugger("doc-exceptions.html");
// test skipping an uncaught exception
yield togglePauseOnExceptions(dbg, false, false);
yield uncaughtException();
ok(!isPaused(dbg));
// Test pausing on an uncaught exception
yield togglePauseOnExceptions(dbg, true, false);
uncaughtException();
yield waitForPaused(dbg);
assertPausedLocation(dbg, "exceptions.js", 2);
yield resume(dbg);
// Test pausing on a caught Error
caughtException();
yield waitForPaused(dbg);
assertPausedLocation(dbg, "exceptions.js", 15);
yield resume(dbg);
// Test skipping a caught error
yield togglePauseOnExceptions(dbg, true, true);
caughtException();
yield waitForPaused(dbg);
assertPausedLocation(dbg, "exceptions.js", 17);
yield resume(dbg);
});

View file

@ -0,0 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests pretty-printing a source that is currently paused.
add_task(function* () {
const dbg = yield initDebugger("doc-minified.html");
yield selectSource(dbg, "math.min.js");
yield addBreakpoint(dbg, "math.min.js", 2);
invokeInTab("arithmetic");
yield waitForPaused(dbg);
assertPausedLocation(dbg, "math.min.js", 2);
clickElement(dbg, "prettyPrintButton");
yield waitForDispatch(dbg, "TOGGLE_PRETTY_PRINT");
assertPausedLocation(dbg, "math.min.js:formatted", 18);
yield resume(dbg);
});

View file

@ -0,0 +1,31 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests basic pretty-printing functionality.
add_task(function* () {
const dbg = yield initDebugger("doc-minified.html");
yield selectSource(dbg, "math.min.js");
clickElement(dbg, "prettyPrintButton");
yield waitForDispatch(dbg, "TOGGLE_PRETTY_PRINT");
const ppSrc = findSource(dbg, "math.min.js:formatted");
ok(ppSrc, "Pretty-printed source exists");
yield addBreakpoint(dbg, ppSrc, 18);
invokeInTab("arithmetic");
yield waitForPaused(dbg);
assertPausedLocation(dbg, ppSrc, 18);
yield stepOver(dbg);
assertPausedLocation(dbg, ppSrc, 27);
yield resume(dbg);
// The pretty-print button should go away in the pretty-printed
// source.
ok(!findElement(dbg, "sourceFooter"), "Footer is hidden");
yield selectSource(dbg, "math.min.js");
ok(findElement(dbg, "sourceFooter"), "Footer is hidden");
});

View file

@ -0,0 +1,27 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function toggleNode(dbg, index) {
clickElement(dbg, "scopeNode", index);
}
function getLabel(dbg, index) {
return findElement(dbg, "scopeNode", index).innerText;
}
add_task(function* () {
const dbg = yield initDebugger("doc-script-switching.html");
toggleScopes(dbg);
invokeInTab("firstCall");
yield waitForPaused(dbg);
toggleNode(dbg, 1);
toggleNode(dbg, 2);
yield waitForDispatch(dbg, "LOAD_OBJECT_PROPERTIES");
is(getLabel(dbg, 1), "secondCall");
is(getLabel(dbg, 2), "<this>");
});

View file

@ -0,0 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Testing source search
add_task(function* () {
const dbg = yield initDebugger("doc-script-switching.html");
pressKey(dbg, "sourceSearch");
yield waitForElement(dbg, "input");
findElementWithSelector(dbg, "input").focus();
type(dbg, "sw");
pressKey(dbg, "Enter");
yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
let source = dbg.selectors.getSelectedSource(dbg.getState());
ok(source.get("url").match(/switching-01/), "first source is selected");
// 2. arrow keys and check to see if source is selected
pressKey(dbg, "sourceSearch");
findElementWithSelector(dbg, "input").focus();
type(dbg, "sw");
pressKey(dbg, "Down");
pressKey(dbg, "Enter");
yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
source = dbg.selectors.getSelectedSource(dbg.getState());
ok(source.get("url").match(/switching-02/), "second source is selected");
});

View file

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that an error while loading a sourcemap does not break
// debugging.
add_task(function* () {
const dbg = yield initDebugger("doc-sourcemap-bogus.html");
const { selectors: { getSources }, getState } = dbg;
yield selectSource(dbg, "bogus-map.js");
// We should still be able to set breakpoints and pause in the
// generated source.
yield addBreakpoint(dbg, "bogus-map.js", 4);
invokeInTab("runCode");
yield waitForPaused(dbg);
assertPausedLocation(dbg, "bogus-map.js", 4);
// Make sure that only the single generated source exists. The
// sourcemap failed to download.
is(getSources(getState()).size, 1, "Only 1 source exists");
});

View file

@ -0,0 +1,44 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests loading sourcemapped sources, setting breakpoints, and
// stepping in them.
add_task(function* () {
const dbg = yield initDebugger("doc-sourcemaps.html");
const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
yield waitForSources(dbg, "entry.js", "output.js", "times2.js", "opts.js");
ok(true, "Original sources exist");
const entrySrc = findSource(dbg, "entry.js");
yield selectSource(dbg, entrySrc);
ok(dbg.win.cm.getValue().includes("window.keepMeAlive"),
"Original source text loaded correctly");
// Test that breakpoint sliding is not attempted. The breakpoint
// should not move anywhere.
yield addBreakpoint(dbg, entrySrc, 13);
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
ok(getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),
"Breakpoint has correct line");
// Test breaking on a breakpoint
yield addBreakpoint(dbg, "entry.js", 15);
is(getBreakpoints(getState()).size, 2, "Two breakpoints exist");
ok(getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15 }),
"Breakpoint has correct line");
invokeInTab("keepMeAlive");
yield waitForPaused(dbg);
assertPausedLocation(dbg, entrySrc, 15);
yield stepIn(dbg);
assertPausedLocation(dbg, "times2.js", 2);
yield stepOver(dbg);
assertPausedLocation(dbg, "times2.js", 3);
yield stepOut(dbg);
yield stepOut(dbg);
assertPausedLocation(dbg, "entry.js", 16);
});

View file

@ -0,0 +1,58 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the source tree works.
function* waitForSourceCount(dbg, i) {
// We are forced to wait until the DOM nodes appear because the
// source tree batches its rendering.
yield waitUntil(() => {
return findAllElements(dbg, "sourceNodes").length === i;
});
}
add_task(function* () {
const dbg = yield initDebugger("doc-sources.html");
const { selectors: { getSelectedSource }, getState } = dbg;
// Expand nodes and make sure more sources appear.
is(findAllElements(dbg, "sourceNodes").length, 2);
clickElement(dbg, "sourceArrow", 2);
is(findAllElements(dbg, "sourceNodes").length, 7);
clickElement(dbg, "sourceArrow", 3);
is(findAllElements(dbg, "sourceNodes").length, 8);
// Select a source.
ok(!findElementWithSelector(dbg, ".sources-list .focused"),
"Source is not focused");
const selected = waitForDispatch(dbg, "SELECT_SOURCE");
clickElement(dbg, "sourceNode", 4);
yield selected;
ok(findElementWithSelector(dbg, ".sources-list .focused"),
"Source is focused");
ok(getSelectedSource(getState()).get("url").includes("nested-source.js"),
"The right source is selected");
// Make sure new sources appear in the list.
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
const script = content.document.createElement("script");
script.src = "math.min.js";
content.document.body.appendChild(script);
});
yield waitForSourceCount(dbg, 9);
is(findElement(dbg, "sourceNode", 7).querySelector("span").innerText,
"math.min.js",
"The dynamic script exists");
// Make sure named eval sources appear in the list.
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.eval("window.evaledFunc = function() {} //# sourceURL=evaled.js");
});
yield waitForSourceCount(dbg, 11);
is(findElement(dbg, "sourceNode", 2).querySelector("span").innerText,
"evaled.js",
"The eval script exists");
});

View file

@ -0,0 +1,46 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test keyboard shortcuts.
*/
function pressResume(dbg) {
pressKey(dbg, "resumeKey");
return waitForPaused(dbg);
}
function pressStepOver(dbg) {
pressKey(dbg, "stepOverKey");
return waitForPaused(dbg);
}
function pressStepIn(dbg) {
pressKey(dbg, "stepInKey");
return waitForPaused(dbg);
}
function pressStepOut(dbg) {
pressKey(dbg, "stepOutKey");
return waitForPaused(dbg);
}
add_task(function*() {
const dbg = yield initDebugger("doc-debugger-statements.html");
yield reload(dbg);
yield waitForPaused(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 8);
yield pressResume(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 12);
yield pressStepIn(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 13);
yield pressStepOut(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 14);
yield pressStepOver(dbg);
assertPausedLocation(dbg, "debugger-statements.html", 9);
});

View file

@ -0,0 +1,7 @@
### Test Examples
##### Pages
* **doc_script-switching-01** - includes two scripts that reference each other. The second function has a debugger.
* **doc-scripts** - includes three sources, a long source and two sources that reference each other.
* **doc-iframes** - includes an iframe with the debugger statements source.
* **debugger-statements** - inline script with functions for testing stepping.

View file

@ -0,0 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function runCode(){
var a=1;
a=a*2;
return a;
}
//# sourceMappingURL=bogus.map

View file

@ -0,0 +1,96 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
const times2 = __webpack_require__(1);
const { output } = __webpack_require__(2);
const opts = __webpack_require__(3);
output(times2(1));
output(times2(2));
if(opts.extra) {
output(times2(3));
}
window.keepMeAlive = function() {
// This function exists to make sure this script is never garbage
// collected. It is also callable from tests.
return times2(4);
}
/***/ },
/* 1 */
/***/ function(module, exports) {
module.exports = function(x) {
return x * 2;
}
/***/ },
/* 2 */
/***/ function(module, exports) {
function output(str) {
console.log(str);
}
module.exports = { output };
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = {
extra: true
};
/***/ }
/******/ ]);
//# sourceMappingURL=bundle.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 4ef8c7ec7c1df790781e","webpack:///./entry.js","webpack:///./times2.js","webpack:///./output.js","webpack:///./opts.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;AACA,QAAO,SAAS;AAChB;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;ACfA;AACA;AACA;;;;;;;ACFA;AACA;AACA;;AAEA,mBAAkB;;;;;;;ACJlB;AACA;AACA","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 4ef8c7ec7c1df790781e","const times2 = require(\"./times2\");\nconst { output } = require(\"./output\");\nconst opts = require(\"./opts\");\n\noutput(times2(1));\noutput(times2(2));\n\nif(opts.extra) {\n output(times2(3));\n}\n\nwindow.keepMeAlive = function() {\n // This function exists to make sure this script is never garbage\n // collected. It is also callable from tests.\n return times2(4);\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./entry.js\n// module id = 0\n// module chunks = 0","module.exports = function(x) {\n return x * 2;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./times2.js\n// module id = 1\n// module chunks = 0","function output(str) {\n console.log(str);\n}\n\nmodule.exports = { output };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./output.js\n// module id = 2\n// module chunks = 0","module.exports = {\n extra: true\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./opts.js\n// module id = 3\n// module chunks = 0"],"sourceRoot":""}

View file

@ -0,0 +1,27 @@
<html>
<head>
<title>Debugger Statements</title>
</head>
<body>
<script>
debugger;
test();
function test() {
debugger;
stepIntoMe();
}
function stepIntoMe() {
// step in
stepOverMe();
// step out
}
function stepOverMe() {
}
</script>
</body>
</html>

View file

@ -0,0 +1,7 @@
<html>
<head>
<title>Debugger test page</title>
<script type="text/javascript" src="exceptions.js"></script>
</head>
<body></body>
</html>

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>Frames</title>
</head>
<body>
<script>
debugger;
// This inline script allows this HTML page to show up as a
// source. It also needs to introduce a new global variable so
// it's not immediately garbage collected.
function inline_script() { var x = 5; }
</script>
<script type="text/javascript" src="frames.js"></script>
</body>
</html>

View file

@ -0,0 +1,17 @@
<html>
<head>
<title>Iframe</title>
</head>
<body>
<script>
debugger;
// This inline script allows this HTML page to show up as a
// source. It also needs to introduce a new global variable so
// it's not immediately garbage collected.
function inline_script() { var x = 5; }
</script>
<iframe src="doc-debugger-statements.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<script src="math.min.js"></script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<button onclick="firstCall()">Click me!</button>
<script type="text/javascript" src="script-switching-01.js"></script>
<script type="text/javascript" src="script-switching-02.js"></script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<script src="simple1.js"></script>
<script src="simple2.js"></script>
<script src="long.js"></script>
<script>
// This inline script allows this HTML page to show up as a
// source. It also needs to introduce a new global variable so
// it's not immediately garbage collected.
function inline_script() { var x = 5; }
</script>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<script src="bogus-map.js"></script>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<script src="simple1.js"></script>
<script src="simple2.js"></script>
<script src="long.js"></script>
<script>
// This inline script allows this HTML page to show up as a
// source. It also needs to introduce a new global variable so
// it's not immediately garbage collected.
function inline_script() { var x = 5; }
</script>
<script src="nested/nested-source.js"></script>
<script src="nested/deeper/deeper-source.js"></script>
</body>
</html>

View file

@ -0,0 +1,16 @@
const times2 = require("./times2");
const { output } = require("./output");
const opts = require("./opts");
output(times2(1));
output(times2(2));
if(opts.extra) {
output(times2(3));
}
window.keepMeAlive = function() {
// This function exists to make sure this script is never garbage
// collected. It is also callable from tests.
return times2(4);
}

View file

@ -0,0 +1,19 @@
function uncaughtException() {
throw "unreachable"
}
function caughtError() {
try {
throw new Error("error");
} catch (e) {
debugger;
}
}
function caughtException() {
try {
throw "reachable";
} catch (e) {
debugger;
}
}

View file

@ -0,0 +1,24 @@
function recurseA(i) {
if (i == 20) {
debugger;
return;
}
// down into the rabbit hole we go
return (i % 2) ? recurseA(++i) : recurseB(++i);
}
function recurseB(i) {
if (i == 20) {
debugger;
return;
}
// down into the rabbit hole we go
return (i % 2) ? recurseA(++i) : recurseB(++i);
}
window.startRecursion = function() {
return recurseA(0);
}

View file

@ -0,0 +1,76 @@
var app = {};
// Generic "model" object. You can use whatever
// framework you want. For this application it
// may not even be worth separating this logic
// out, but we do this to demonstrate one way to
// separate out parts of your application.
app.TodoModel = function (key) {
this.key = key;
this.todos = [];
this.onChanges = [];
};
app.TodoModel.prototype.addTodo = function (title) {
this.todos = this.todos.concat([{
id: Utils.uuid(),
title: title,
completed: false
}]);
};
app.TodoModel.prototype.inform = function() {
// Something changed, but we do nothing
return null;
};
app.TodoModel.prototype.toggleAll = function (checked) {
// Note: it's usually better to use immutable data structures since they're
// easier to reason about and React works very well with them. That's why
// we use map() and filter() everywhere instead of mutating the array or
// todo items themselves.
this.todos = this.todos.map(function (todo) {
return Object.assign({}, todo, {completed: checked});
});
this.inform();
};
app.TodoModel.prototype.toggle = function (todoToToggle) {
this.todos = this.todos.map(function (todo) {
return todo !== todoToToggle ?
todo :
Object.assign({}, todo, {completed: !todo.completed});
});
this.inform();
};
app.TodoModel.prototype.destroy = function (todo) {
this.todos = this.todos.filter(function (candidate) {
return candidate !== todo;
});
this.inform();
};
app.TodoModel.prototype.save = function (todoToSave, text) {
this.todos = this.todos.map(function (todo) {
return todo !== todoToSave ? todo : Object.assign({}, todo, {title: text});
});
this.inform();
};
app.TodoModel.prototype.clearCompleted = function () {
this.todos = this.todos.filter(function (todo) {
return !todo.completed;
});
this.inform();
};
function testModel() {
const model = new app.TodoModel();
model.clearCompleted();
}

View file

@ -0,0 +1,3 @@
function add(a,b,k){var result=a+b;return k(result)}function sub(a,b,k){var result=a-b;return k(result)}function mul(a,b,k){var result=a*b;return k(result)}function div(a,b,k){var result=a/b;return k(result)}function arithmetic(){
add(4,4,function(a){
sub(a,2,function(b){mul(b,3,function(c){div(c,2,function(d){console.log(d)})})})})};

View file

@ -0,0 +1,3 @@
function computeSomething() {
return 1;
}

View file

@ -0,0 +1,3 @@
module.exports = {
extra: true
};

View file

@ -0,0 +1,5 @@
function output(str) {
console.log(str);
}
module.exports = { output };

View file

@ -0,0 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function firstCall() {
secondCall();
}

View file

@ -0,0 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function secondCall() {
// This comment is useful: ☺
debugger;
function foo() {}
if (x) {
foo();
}
}
var x = true;

View file

@ -0,0 +1,31 @@
function main() {
// A comment so we can test that breakpoint sliding works across
// multiple lines
const func = foo(1, 2);
const result = func();
return result;
}
function doEval() {
eval("(" + function() {
debugger;
window.evaledFunc = function() {
var foo = 1;
var bar = 2;
return foo + bar;
};
}.toString() + ")()");
}
function doNamedEval() {
eval("(" + function() {
debugger;
window.evaledFunc = function() {
var foo = 1;
var bar = 2;
return foo + bar;
};
}.toString() + ")();\n //# sourceURL=evaled.js");
}

View file

@ -0,0 +1,6 @@
function foo(x, y) {
function bar() {
return x + y;
}
return bar;
}

View file

@ -0,0 +1,3 @@
module.exports = function(x) {
return x * 2;
}

View file

@ -0,0 +1,8 @@
module.exports = {
entry: "./entry.js",
output: {
filename: "bundle.js"
},
devtool: "sourcemap"
}

View file

@ -0,0 +1,684 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* The Mochitest API documentation
* @module mochitest
*/
/**
* The mochitest API to wait for certain events.
* @module mochitest/waits
* @parent mochitest
*/
/**
* The mochitest API predefined asserts.
* @module mochitest/asserts
* @parent mochitest
*/
/**
* The mochitest API for interacting with the debugger.
* @module mochitest/actions
* @parent mochitest
*/
/**
* Helper methods for the mochitest API.
* @module mochitest/helpers
* @parent mochitest
*/
// shared-head.js handles imports, constants, and utility functions
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js", this);
var { Toolbox } = require("devtools/client/framework/toolbox");
const EXAMPLE_URL = "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/";
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
delete window.resumeTest;
});
// Wait until an action of `type` is dispatched. This is different
// then `_afterDispatchDone` because it doesn't wait for async actions
// to be done/errored. Use this if you want to listen for the "start"
// action of an async operation (somewhat rare).
function waitForNextDispatch(store, type) {
return new Promise(resolve => {
store.dispatch({
// Normally we would use `services.WAIT_UNTIL`, but use the
// internal name here so tests aren't forced to always pass it
// in
type: "@@service/waitUntil",
predicate: action => action.type === type,
run: (dispatch, getState, action) => {
resolve(action);
}
});
});
}
// Wait until an action of `type` is dispatched. If it's part of an
// async operation, wait until the `status` field is "done" or "error"
function _afterDispatchDone(store, type) {
return new Promise(resolve => {
store.dispatch({
// Normally we would use `services.WAIT_UNTIL`, but use the
// internal name here so tests aren't forced to always pass it
// in
type: "@@service/waitUntil",
predicate: action => {
if (action.type === type) {
return action.status ?
(action.status === "done" || action.status === "error") :
true;
}
},
run: (dispatch, getState, action) => {
resolve(action);
}
});
});
}
/**
* Wait for a specific action type to be dispatch.
* If an async action, will wait for it to be done.
*
* @memberof mochitest/waits
* @param {Object} dbg
* @param {String} type
* @param {Number} eventRepeat
* @return {Promise}
* @static
*/
function waitForDispatch(dbg, type, eventRepeat = 1) {
let count = 0;
return Task.spawn(function* () {
info("Waiting for " + type + " to dispatch " + eventRepeat + " time(s)");
while (count < eventRepeat) {
yield _afterDispatchDone(dbg.store, type);
count++;
info(type + " dispatched " + count + " time(s)");
}
});
}
/**
* Waits for specific thread events.
*
* @memberof mochitest/waits
* @param {Object} dbg
* @param {String} eventName
* @return {Promise}
* @static
*/
function waitForThreadEvents(dbg, eventName) {
info("Waiting for thread event '" + eventName + "' to fire.");
const thread = dbg.toolbox.threadClient;
return new Promise(function(resolve, reject) {
thread.addListener(eventName, function onEvent(eventName, ...args) {
info("Thread event '" + eventName + "' fired.");
thread.removeListener(eventName, onEvent);
resolve.apply(resolve, args);
});
});
}
/**
* Waits for `predicate(state)` to be true. `state` is the redux app state.
*
* @memberof mochitest/waits
* @param {Object} dbg
* @param {Function} predicate
* @return {Promise}
* @static
*/
function waitForState(dbg, predicate) {
return new Promise(resolve => {
const unsubscribe = dbg.store.subscribe(() => {
if (predicate(dbg.store.getState())) {
unsubscribe();
resolve();
}
});
});
}
/**
* Waits for sources to be loaded.
*
* @memberof mochitest/waits
* @param {Object} dbg
* @param {Array} sources
* @return {Promise}
* @static
*/
function waitForSources(dbg, ...sources) {
if (sources.length === 0) {
return Promise.resolve();
}
info("Waiting on sources: " + sources.join(", "));
const { selectors: { getSources }, store } = dbg;
return Promise.all(sources.map(url => {
function sourceExists(state) {
return getSources(state).some(s => {
return s.get("url").includes(url);
});
}
if (!sourceExists(store.getState())) {
return waitForState(dbg, sourceExists);
}
}));
}
function waitForElement(dbg, selector) {
return waitUntil(() => findElementWithSelector(dbg, selector))
}
/**
* Assert that the debugger is paused at the correct location.
*
* @memberof mochitest/asserts
* @param {Object} dbg
* @param {String} source
* @param {Number} line
* @static
*/
function assertPausedLocation(dbg, source, line) {
const { selectors: { getSelectedSource, getPause }, getState } = dbg;
source = findSource(dbg, source);
// Check the selected source
is(getSelectedSource(getState()).get("id"), source.id);
// Check the pause location
const location = getPause(getState()).getIn(["frame", "location"]);
is(location.get("sourceId"), source.id);
is(location.get("line"), line);
// Check the debug line
ok(dbg.win.cm.lineInfo(line - 1).wrapClass.includes("debug-line"),
"Line is highlighted as paused");
}
/**
* Assert that the debugger is highlighting the correct location.
*
* @memberof mochitest/asserts
* @param {Object} dbg
* @param {String} source
* @param {Number} line
* @static
*/
function assertHighlightLocation(dbg, source, line) {
const { selectors: { getSelectedSource, getPause }, getState } = dbg;
source = findSource(dbg, source);
// Check the selected source
is(getSelectedSource(getState()).get("url"), source.url);
// Check the highlight line
const lineEl = findElement(dbg, "highlightLine");
ok(lineEl, "Line is highlighted");
ok(isVisibleWithin(findElement(dbg, "codeMirror"), lineEl),
"Highlighted line is visible");
ok(dbg.win.cm.lineInfo(line - 1).wrapClass.includes("highlight-line"),
"Line is highlighted");
}
/**
* Returns boolean for whether the debugger is paused.
*
* @memberof mochitest/asserts
* @param {Object} dbg
* @static
*/
function isPaused(dbg) {
const { selectors: { getPause }, getState } = dbg;
return !!getPause(getState());
}
/**
* Waits for the debugger to be fully paused.
*
* @memberof mochitest/waits
* @param {Object} dbg
* @static
*/
function waitForPaused(dbg) {
return Task.spawn(function* () {
// We want to make sure that we get both a real paused event and
// that the state is fully populated. The client may do some more
// work (call other client methods) before populating the state.
yield waitForThreadEvents(dbg, "paused"),
yield waitForState(dbg, state => {
const pause = dbg.selectors.getPause(state);
// Make sure we have the paused state.
if (!pause) {
return false;
}
// Make sure the source text is completely loaded for the
// source we are paused in.
const sourceId = pause.getIn(["frame", "location", "sourceId"]);
const sourceText = dbg.selectors.getSourceText(dbg.getState(), sourceId);
return sourceText && !sourceText.get("loading");
});
});
}
function createDebuggerContext(toolbox) {
const win = toolbox.getPanel("jsdebugger").panelWin;
const store = win.Debugger.store;
return {
actions: win.Debugger.actions,
selectors: win.Debugger.selectors,
getState: store.getState,
store: store,
client: win.Debugger.client,
toolbox: toolbox,
win: win
};
}
/**
* Intilializes the debugger.
*
* @memberof mochitest
* @param {String} url
* @param {Array} sources
* @return {Promise} dbg
* @static
*/
function initDebugger(url, ...sources) {
return Task.spawn(function* () {
const toolbox = yield openNewTabAndToolbox(EXAMPLE_URL + url, "jsdebugger");
return createDebuggerContext(toolbox);
});
}
window.resumeTest = undefined;
/**
* Pause the test and let you interact with the debugger.
* The test can be resumed by invoking `resumeTest` in the console.
*
* @memberof mochitest
* @static
*/
function pauseTest() {
info("Test paused. Invoke resumeTest to continue.");
return new Promise(resolve => resumeTest = resolve);
}
// Actions
/**
* Returns a source that matches the URL.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {String} url
* @return {Object} source
* @static
*/
function findSource(dbg, url) {
if (typeof url !== "string") {
// Support passing in a source object itelf all APIs that use this
// function support both styles
const source = url;
return source;
}
const sources = dbg.selectors.getSources(dbg.getState());
const source = sources.find(s => s.get("url").includes(url));
if (!source) {
throw new Error("Unable to find source: " + url);
}
return source.toJS();
}
/**
* Selects the source.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {String} url
* @param {Number} line
* @return {Promise}
* @static
*/
function selectSource(dbg, url, line) {
info("Selecting source: " + url);
const source = findSource(dbg, url);
const hasText = !!dbg.selectors.getSourceText(dbg.getState(), source.id);
dbg.actions.selectSource(source.id, { line });
if (!hasText) {
return waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
}
}
/**
* Steps over.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @return {Promise}
* @static
*/
function stepOver(dbg) {
info("Stepping over");
dbg.actions.stepOver();
return waitForPaused(dbg);
}
/**
* Steps in.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @return {Promise}
* @static
*/
function stepIn(dbg) {
info("Stepping in");
dbg.actions.stepIn();
return waitForPaused(dbg);
}
/**
* Steps out.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @return {Promise}
* @static
*/
function stepOut(dbg) {
info("Stepping out");
dbg.actions.stepOut();
return waitForPaused(dbg);
}
/**
* Resumes.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @return {Promise}
* @static
*/
function resume(dbg) {
info("Resuming");
dbg.actions.resume();
return waitForThreadEvents(dbg, "resumed");
}
/**
* Reloads the debuggee.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {Array} sources
* @return {Promise}
* @static
*/
function reload(dbg, ...sources) {
return dbg.client.reload().then(() => waitForSources(...sources));
}
/**
* Navigates the debuggee to another url.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {String} url
* @param {Array} sources
* @return {Promise}
* @static
*/
function navigate(dbg, url, ...sources) {
dbg.client.navigate(url);
return waitForSources(dbg, ...sources);
}
/**
* Adds a breakpoint to a source at line/col.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {String} source
* @param {Number} line
* @param {Number} col
* @return {Promise}
* @static
*/
function addBreakpoint(dbg, source, line, col) {
source = findSource(dbg, source);
const sourceId = source.id;
dbg.actions.addBreakpoint({ sourceId, line, col });
return waitForDispatch(dbg, "ADD_BREAKPOINT");
}
/**
* Removes a breakpoint from a source at line/col.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {String} source
* @param {Number} line
* @param {Number} col
* @return {Promise}
* @static
*/
function removeBreakpoint(dbg, sourceId, line, col) {
return dbg.actions.removeBreakpoint({ sourceId, line, col });
}
/**
* Toggles the Pause on exceptions feature in the debugger.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @param {Boolean} pauseOnExceptions
* @param {Boolean} ignoreCaughtExceptions
* @return {Promise}
* @static
*/
function togglePauseOnExceptions(dbg,
pauseOnExceptions, ignoreCaughtExceptions) {
const command = dbg.actions.pauseOnExceptions(
pauseOnExceptions,
ignoreCaughtExceptions
);
if (!isPaused(dbg)) {
return waitForThreadEvents(dbg, "resumed");
}
return command;
}
// Helpers
/**
* Invokes a global function in the debuggee tab.
*
* @memberof mochitest/helpers
* @param {String} fnc
* @return {Promise}
* @static
*/
function invokeInTab(fnc) {
info(`Invoking function ${fnc} in tab`);
return ContentTask.spawn(gBrowser.selectedBrowser, fnc, function* (fnc) {
content.wrappedJSObject[fnc](); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
});
}
const isLinux = Services.appinfo.OS === "Linux";
const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true };
const keyMappings = {
sourceSearch: { code: "p", modifiers: cmdOrCtrl},
fileSearch: { code: "f", modifiers: cmdOrCtrl},
"Enter": { code: "VK_RETURN" },
"Up": { code: "VK_UP" },
"Down": { code: "VK_DOWN" },
pauseKey: { code: "VK_F8" },
resumeKey: { code: "VK_F8" },
stepOverKey: { code: "VK_F10" },
stepInKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux }},
stepOutKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux, shiftKey: true }}
};
/**
* Simulates a key press in the debugger window.
*
* @memberof mochitest/helpers
* @param {Object} dbg
* @param {String} keyName
* @return {Promise}
* @static
*/
function pressKey(dbg, keyName) {
let keyEvent = keyMappings[keyName];
const { code, modifiers } = keyEvent;
return EventUtils.synthesizeKey(
code,
modifiers || {},
dbg.win
);
}
function type(dbg, string) {
string.split("").forEach(char => {
EventUtils.synthesizeKey(char, {}, dbg.win);
});
}
function isVisibleWithin(outerEl, innerEl) {
const innerRect = innerEl.getBoundingClientRect();
const outerRect = outerEl.getBoundingClientRect();
return innerRect.top > outerRect.top &&
innerRect.bottom < outerRect.bottom;
}
const selectors = {
callStackHeader: ".call-stack-pane ._header",
callStackBody: ".call-stack-pane .pane",
scopesHeader: ".scopes-pane ._header",
breakpointItem: i => `.breakpoints-list .breakpoint:nth-child(${i})`,
scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`,
frame: i => `.frames ul li:nth-child(${i})`,
frames: ".frames ul li",
gutter: i => `.CodeMirror-code *:nth-child(${i}) .CodeMirror-linenumber`,
menuitem: i => `menupopup menuitem:nth-child(${i})`,
pauseOnExceptions: ".pause-exceptions",
breakpoint: ".CodeMirror-code > .new-breakpoint",
highlightLine: ".CodeMirror-code > .highlight-line",
codeMirror: ".CodeMirror",
resume: ".resume.active",
stepOver: ".stepOver.active",
stepOut: ".stepOut.active",
stepIn: ".stepIn.active",
toggleBreakpoints: ".toggleBreakpoints",
prettyPrintButton: ".prettyPrint",
sourceFooter: ".source-footer",
sourceNode: i => `.sources-list .tree-node:nth-child(${i})`,
sourceNodes: ".sources-list .tree-node",
sourceArrow: i => `.sources-list .tree-node:nth-child(${i}) .arrow`,
};
function getSelector(elementName, ...args) {
let selector = selectors[elementName];
if (!selector) {
throw new Error(`The selector ${elementName} is not defined`);
}
if (typeof selector == "function") {
selector = selector(...args);
}
return selector;
}
function findElement(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args);
return findElementWithSelector(dbg, selector);
}
function findElementWithSelector(dbg, selector) {
return dbg.win.document.querySelector(selector);
}
function findAllElements(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args);
return dbg.win.document.querySelectorAll(selector);
}
/**
* Simulates a mouse click in the debugger DOM.
*
* @memberof mochitest/helpers
* @param {Object} dbg
* @param {String} elementName
* @param {Array} args
* @return {Promise}
* @static
*/
function clickElement(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args);
return EventUtils.synthesizeMouseAtCenter(
findElementWithSelector(dbg, selector),
{},
dbg.win
);
}
function rightClickElement(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args);
const doc = dbg.win.document;
return EventUtils.synthesizeMouseAtCenter(
doc.querySelector(selector),
{type: "contextmenu"},
dbg.win
);
}
function selectMenuItem(dbg, index) {
// the context menu is in the toolbox window
const doc = dbg.toolbox.win.document;
// there are several context menus, we want the one with the menu-api
const popup = doc.querySelector("menupopup[menu-api=\"true\"]");
const item = popup.querySelector(`menuitem:nth-child(${index})`);
return EventUtils.synthesizeMouseAtCenter(item, {}, dbg.toolbox.win );
}
/**
* Toggles the debugger call stack accordian.
*
* @memberof mochitest/actions
* @param {Object} dbg
* @return {Promise}
* @static
*/
function toggleCallStack(dbg) {
return findElement(dbg, "callStackHeader").click();
}
function toggleScopes(dbg) {
return findElement(dbg, "scopesHeader").click();
}