merge mozilla-inbound to mozilla-central a=merge
@ -603,6 +603,7 @@
|
||||
@RESPATH@/chrome/devtools.manifest
|
||||
#ifdef MOZ_GRAPHENE
|
||||
@RESPATH@/@PREF_DIR@/devtools.js
|
||||
@RESPATH@/@PREF_DIR@/debugger.js
|
||||
#endif
|
||||
|
||||
; shell icons
|
||||
|
@ -19,7 +19,7 @@ skip-if = os == 'linux' # Bug 1145199
|
||||
skip-if = os == 'linux' # Bug 1145199
|
||||
[browser_referrer_simple_click.js]
|
||||
[browser_referrer_open_link_in_container_tab.js]
|
||||
skip-if = os == 'linux' # Bug 1144816
|
||||
skip-if = os == 'linux' || e10s # Bug 1144816, Bug 1315042
|
||||
[browser_referrer_open_link_in_container_tab2.js]
|
||||
skip-if = os == 'linux' # Bug 1144816
|
||||
[browser_referrer_open_link_in_container_tab3.js]
|
||||
|
@ -617,6 +617,7 @@
|
||||
@RESPATH@/browser/chrome/devtools@JAREXT@
|
||||
@RESPATH@/browser/chrome/devtools.manifest
|
||||
@RESPATH@/browser/@PREF_DIR@/devtools.js
|
||||
@RESPATH@/browser/@PREF_DIR@/debugger.js
|
||||
|
||||
; shell icons
|
||||
#ifdef XP_UNIX
|
||||
|
@ -206,40 +206,6 @@ body {
|
||||
font-size: 14px;
|
||||
color: var(--theme-comment);
|
||||
}
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
|
||||
/* 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/. */
|
||||
|
||||
:root.theme-light,
|
||||
:root .theme-light {
|
||||
--theme-search-overlays-semitransparent: rgba(221, 225, 228, 0.66);
|
||||
--theme-faded-tab-color: #7e7e7e;
|
||||
}
|
||||
|
||||
:root.theme-dark,
|
||||
:root .theme-dark {
|
||||
--theme-faded-tab-color: #6e7d8c;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#mount {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.debugger {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
@ -894,6 +860,7 @@ html .arrow.expanded svg {
|
||||
.tree .node {
|
||||
padding: 2px 5px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tree .node.focused {
|
||||
@ -960,48 +927,653 @@ html[dir="rtl"] .tree .node > div {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* BASICS */
|
||||
|
||||
.tree {
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: monospace;
|
||||
height: 300px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 4px 0; /* Vertical padding around content */
|
||||
}
|
||||
.CodeMirror pre {
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
/* GUTTER */
|
||||
|
||||
.CodeMirror-gutters {
|
||||
border-right: 1px solid #ddd;
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.CodeMirror-guttermarker { color: black; }
|
||||
.CodeMirror-guttermarker-subtle { color: #999; }
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
.CodeMirror-cursor {
|
||||
border-left: 1px solid black;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
/* Shown when moving in bi-directional text */
|
||||
.CodeMirror div.CodeMirror-secondarycursor {
|
||||
border-left: 1px solid silver;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0 !important;
|
||||
background: #7e7;
|
||||
}
|
||||
.cm-fat-cursor div.CodeMirror-cursors {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.cm-animate-fat-cursor {
|
||||
width: auto;
|
||||
border: 0;
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
background-color: #7e7;
|
||||
}
|
||||
@-moz-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@-webkit-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {}
|
||||
|
||||
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: -50px; bottom: -20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0; bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
.cm-s-default .cm-def {color: #00f;}
|
||||
.cm-s-default .cm-variable,
|
||||
.cm-s-default .cm-punctuation,
|
||||
.cm-s-default .cm-property,
|
||||
.cm-s-default .cm-operator {}
|
||||
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||
.cm-s-default .cm-variable-3 {color: #085;}
|
||||
.cm-s-default .cm-comment {color: #a50;}
|
||||
.cm-s-default .cm-string {color: #a11;}
|
||||
.cm-s-default .cm-string-2 {color: #f50;}
|
||||
.cm-s-default .cm-meta {color: #555;}
|
||||
.cm-s-default .cm-qualifier {color: #555;}
|
||||
.cm-s-default .cm-builtin {color: #30a;}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
.CodeMirror-composing { border-bottom: 2px solid; }
|
||||
|
||||
/* Default styles for common addons */
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||
|
||||
/* STOP */
|
||||
|
||||
/* The rest of this file contains styles related to the mechanics of
|
||||
the editor. You probably shouldn't touch them. */
|
||||
|
||||
.CodeMirror {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
overflow: scroll !important; /* Things will break if this is overridden */
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -30px; margin-right: -30px;
|
||||
padding-bottom: 30px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
}
|
||||
.CodeMirror-sizer {
|
||||
position: relative;
|
||||
border-right: 30px solid transparent;
|
||||
}
|
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actual scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0; left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0; bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0; bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-bottom: -30px;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
.CodeMirror-gutter-background {
|
||||
position: absolute;
|
||||
top: 0; bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-o-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
min-height: 1px; /* prevents collapsing before first draw */
|
||||
}
|
||||
.CodeMirror pre {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-variant-ligatures: contextual;
|
||||
font-variant-ligatures: contextual;
|
||||
}
|
||||
.CodeMirror-wrap pre {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-linewidget {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.tree button {
|
||||
display: block;
|
||||
.CodeMirror-widget {}
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.tree .node {
|
||||
padding: 2px 5px;
|
||||
/* Force content-box sizing for the elements where we expect it */
|
||||
.CodeMirror-scroll,
|
||||
.CodeMirror-sizer,
|
||||
.CodeMirror-gutter,
|
||||
.CodeMirror-gutters,
|
||||
.CodeMirror-linenumber {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.CodeMirror-measure {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
div.CodeMirror-dragcursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-focused div.CodeMirror-cursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||
.CodeMirror-crosshair { cursor: crosshair; }
|
||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
||||
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
||||
|
||||
.cm-searching {
|
||||
background: #ffa;
|
||||
background: rgba(255, 255, 0, .4);
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border { padding-right: .1px; }
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/* See issue #2901 */
|
||||
.cm-tab-wrap-hack:after { content: ''; }
|
||||
|
||||
/* Help users use markselection to safely style text background */
|
||||
span.CodeMirror-selectedtext { background: none; }
|
||||
/* 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/. */
|
||||
|
||||
:root {
|
||||
/* --breakpoint-background: url("chrome://devtools/skin/images/breakpoint.svg#light"); */
|
||||
/* --breakpoint-hover-background: url("chrome://devtools/skin/images/breakpoint.svg#light-hover"); */
|
||||
--breakpoint-active-color: rgba(44,187,15,.2);
|
||||
--breakpoint-active-color-hover: rgba(44,187,15,.5);
|
||||
/* --breakpoint-conditional-background: url("chrome://devtools/skin/images/breakpoint.svg#light-conditional"); */
|
||||
}
|
||||
|
||||
.theme-dark:root {
|
||||
/* --breakpoint-background: url("chrome://devtools/skin/images/breakpoint.svg#dark"); */
|
||||
/* --breakpoint-hover-background: url("chrome://devtools/skin/images/breakpoint.svg#dark-hover"); */
|
||||
--breakpoint-active-color: rgba(0,255,175,.4);
|
||||
--breakpoint-active-color-hover: rgba(0,255,175,.7);
|
||||
/* --breakpoint-conditional-background: url("chrome://devtools/skin/images/breakpoint.svg#dark-conditional"); */
|
||||
}
|
||||
|
||||
.CodeMirror .errors {
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.CodeMirror .error {
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
/* background-image: url("chrome://devtools/skin/images/editor-error.png"); */
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.CodeMirror .hit-counts {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.CodeMirror .hit-count {
|
||||
display: inline-block;
|
||||
height: 12px;
|
||||
border: solid rgba(0,0,0,0.2);
|
||||
border-width: 1px 1px 1px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
padding: 0 3px;
|
||||
font-size: 10px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.CodeMirror-linenumber:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: calc(100% - 3px);
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 0;
|
||||
height: 12px;
|
||||
z-index: -1;
|
||||
background-size: calc(100% - 2px) 12px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: right center;
|
||||
padding-inline-end: 9px;
|
||||
}
|
||||
|
||||
.breakpoint .CodeMirror-linenumber {
|
||||
color: var(--theme-body-background);
|
||||
}
|
||||
|
||||
.breakpoint .CodeMirror-linenumber:before {
|
||||
background-image: var(--breakpoint-background) !important;
|
||||
}
|
||||
|
||||
.conditional .CodeMirror-linenumber:before {
|
||||
background-image: var(--breakpoint-conditional-background) !important;
|
||||
}
|
||||
|
||||
.debug-line .CodeMirror-linenumber {
|
||||
background-color: var(--breakpoint-active-color);
|
||||
}
|
||||
|
||||
.theme-dark .debug-line .CodeMirror-linenumber {
|
||||
color: #c0c0c0;
|
||||
}
|
||||
|
||||
.debug-line .CodeMirror-line {
|
||||
background-color: var(--breakpoint-active-color) !important;
|
||||
}
|
||||
|
||||
/* Don't display the highlight color since the debug line
|
||||
is already highlighted */
|
||||
.debug-line .CodeMirror-activeline-background {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
cursor: text;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* This is to avoid the fake horizontal scrollbar div of codemirror to go 0
|
||||
height when floating scrollbars are active. Make sure that this value is equal
|
||||
to the maximum of `min-height` specific to the `scrollbar[orient="horizontal"]`
|
||||
selector in floating-scrollbar-light.css across all platforms. */
|
||||
.CodeMirror-hscrollbar {
|
||||
min-height: 10px;
|
||||
}
|
||||
|
||||
/* This is to avoid the fake vertical scrollbar div of codemirror to go 0
|
||||
width when floating scrollbars are active. Make sure that this value is equal
|
||||
to the maximum of `min-width` specific to the `scrollbar[orient="vertical"]`
|
||||
selector in floating-scrollbar-light.css across all platforms. */
|
||||
.CodeMirror-vscrollbar {
|
||||
min-width: 10px;
|
||||
}
|
||||
|
||||
.cm-trailingspace {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==");
|
||||
opacity: 0.75;
|
||||
background-position: left bottom;
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
.cm-highlight {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cm-highlight:before {
|
||||
position: absolute;
|
||||
border-top-style: solid;
|
||||
border-bottom-style: solid;
|
||||
border-top-color: var(--theme-comment-alt);
|
||||
border-bottom-color: var(--theme-comment-alt);
|
||||
border-top-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
top: -1px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
content: "";
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
|
||||
.cm-highlight-full:before {
|
||||
border: 1px solid var(--theme-comment-alt);
|
||||
}
|
||||
|
||||
.cm-highlight-start:before {
|
||||
border-left-width: 1px;
|
||||
border-left-style: solid;
|
||||
border-left-color: var(--theme-comment-alt);
|
||||
margin: 0 0 -1px -1px;
|
||||
border-top-left-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
}
|
||||
|
||||
.cm-highlight-end:before {
|
||||
border-right-width: 1px;
|
||||
border-right-style: solid;
|
||||
border-right-color: var(--theme-comment-alt);
|
||||
margin: 0 -1px -1px 0;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
/* CodeMirror dialogs styling */
|
||||
|
||||
.CodeMirror-dialog {
|
||||
padding: 4px 3px;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog,
|
||||
.CodeMirror-dialog input {
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
/* Fold addon */
|
||||
|
||||
.CodeMirror-foldmarker {
|
||||
color: blue;
|
||||
text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
|
||||
font-family: sans-serif;
|
||||
line-height: .3;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tree-node:hover {
|
||||
background: var(--theme-tab-toolbar-background);
|
||||
.CodeMirror-foldgutter {
|
||||
width: 16px; /* Same as breakpoints gutter above */
|
||||
}
|
||||
|
||||
.tree .node.focused {
|
||||
color: white;
|
||||
background-color: var(--theme-selection-background);
|
||||
.CodeMirror-foldgutter-open,
|
||||
.CodeMirror-foldgutter-folded {
|
||||
color: #555;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tree .node > div {
|
||||
margin-left: 10px;
|
||||
.CodeMirror-foldgutter-open:after {
|
||||
font-size: 120%;
|
||||
content: "\25BE";
|
||||
}
|
||||
|
||||
.tree .node.focused svg {
|
||||
fill: white;
|
||||
.CodeMirror-foldgutter-folded:after {
|
||||
font-size: 120%;
|
||||
content: "\25B8";
|
||||
}
|
||||
|
||||
.sources-list .tree-node button {
|
||||
position: fixed;
|
||||
.CodeMirror-hints {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
overflow: hidden;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
border-radius: 3px;
|
||||
font-size: 90%;
|
||||
max-height: 20em;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.CodeMirror-hint {
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
border-radius: 2px;
|
||||
max-width: 19em;
|
||||
overflow: hidden;
|
||||
white-space: pre;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion {
|
||||
padding-inline-start: 22px;
|
||||
position: relative;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion:before {
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
border-radius: 50%;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-unknown:before {
|
||||
content: "?";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-object:before {
|
||||
content: "O";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-fn:before {
|
||||
content: "F";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-array:before {
|
||||
content: "A";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-number:before {
|
||||
content: "N";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-string:before {
|
||||
content: "S";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-bool:before {
|
||||
content: "B";
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-completion-guess {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-tooltip {
|
||||
border-radius: 3px;
|
||||
padding: 2px 5px;
|
||||
white-space: pre-wrap;
|
||||
max-width: 40em;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-hint-doc {
|
||||
max-width: 25em;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-farg-current {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.CodeMirror-Tern-fhint-guess {
|
||||
opacity: .7;
|
||||
}
|
||||
.toggle-button-start,
|
||||
.toggle-button-end {
|
||||
@ -1010,6 +1582,7 @@ html[dir="rtl"] .tree .node > div {
|
||||
height: 16px;
|
||||
transition: transform 0.25s ease-in-out;
|
||||
margin: 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toggle-button-start svg,
|
||||
@ -1017,26 +1590,23 @@ html[dir="rtl"] .tree .node > div {
|
||||
fill: var(--theme-comment);
|
||||
}
|
||||
|
||||
.toggle-button-end svg {
|
||||
html:not([dir="rtl"]) .toggle-button-end svg,
|
||||
html[dir="rtl"] .toggle-button-start svg {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.toggle-button-start.vertical svg {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.toggle-button-end.vertical svg {
|
||||
transform: rotate(90deg);
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.toggle-button-start {
|
||||
top: 7px;
|
||||
left: 0;
|
||||
offset-inline-start: 0;
|
||||
}
|
||||
|
||||
.toggle-button-end {
|
||||
top: 7px;
|
||||
right: 0;
|
||||
offset-inline-end: 0;
|
||||
}
|
||||
|
||||
.toggle-button-start.collapsed,
|
||||
@ -1325,7 +1895,6 @@ html[dir="rtl"] .editor-mount {
|
||||
white-space: normal;
|
||||
opacity: 0.9;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@ -1411,7 +1980,10 @@ html .breakpoints-list .breakpoint.paused {
|
||||
}
|
||||
|
||||
.breakpoint-snippet {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding-inline-start: 18px;
|
||||
padding-inline-end: 18px;
|
||||
}
|
||||
|
||||
.breakpoint .close-btn {
|
||||
@ -1502,7 +2074,7 @@ html .breakpoints-list .breakpoint.paused {
|
||||
color: var(--theme-highlight-red);
|
||||
}
|
||||
|
||||
.object-node.not-enumerable {
|
||||
.object-node.default-property {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
@ -1805,6 +2377,61 @@ html .breakpoints-list .breakpoint.paused {
|
||||
position: absolute;
|
||||
top: auto;
|
||||
}
|
||||
.dropdown {
|
||||
background: var(--theme-body-background);
|
||||
border: 1px solid var(--theme-splitter-color);
|
||||
box-shadow: 0 4px 4px 0 var(--theme-search-overlays-semitransparent);
|
||||
max-height: 300px;
|
||||
position: absolute;
|
||||
offset-inline-end: 8px;
|
||||
top: 35px;
|
||||
width: 150px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.dropdown-button {
|
||||
position: absolute;
|
||||
offset-inline-end: 18px;
|
||||
top: 4px;
|
||||
font-size: 18px;
|
||||
color: var(--theme-comment);
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0 5px;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.dropdown li {
|
||||
transition: all 0.25s ease;
|
||||
padding: 2px 10px 10px 5px;
|
||||
overflow: hidden;
|
||||
height: 30px;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.dropdown li:hover {
|
||||
background-color: var(--theme-search-overlays-semitransparent);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown ul {
|
||||
list-style: none;
|
||||
line-height: 2em;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dropdown-mask {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
z-index: 999;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
.source-header {
|
||||
border-bottom: 1px solid var(--theme-splitter-color);
|
||||
height: 30px;
|
||||
@ -1831,7 +2458,7 @@ html .breakpoints-list .breakpoint.paused {
|
||||
height: 14px;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
top: 4px;
|
||||
margin: 4px;
|
||||
margin-inline-start: 8px;
|
||||
line-height: 0;
|
||||
@ -1926,91 +2553,4 @@ html .breakpoints-list .breakpoint.paused {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.toggle-button-start,
|
||||
.toggle-button-end {
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toggle-button-start svg,
|
||||
.toggle-button-end svg {
|
||||
fill: var(--theme-comment);
|
||||
}
|
||||
|
||||
.toggle-button-end svg {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.toggle-button-start {
|
||||
top: 8px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.toggle-button-end {
|
||||
top: 8px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.toggle-button-start.collapsed,
|
||||
.toggle-button-end.collapsed {
|
||||
transform: rotate(180deg);
|
||||
flex: 1;
|
||||
}
|
||||
.dropdown {
|
||||
background: var(--theme-body-background);
|
||||
border: 1px solid var(--theme-splitter-color);
|
||||
box-shadow: 0 4px 4px 0 var(--theme-search-overlays-semitransparent);
|
||||
max-height: 300px;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 35px;
|
||||
width: 150px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.dropdown-button {
|
||||
position: absolute;
|
||||
right: 18px;
|
||||
top: 4px;
|
||||
font-size: 18px;
|
||||
color: var(--theme-body-color);
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.dropdown li {
|
||||
transition: all 0.25s ease;
|
||||
padding: 2px 10px 10px 5px;
|
||||
overflow: hidden;
|
||||
height: 30px;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.dropdown li:hover {
|
||||
background-color: var(--theme-search-overlays-semitransparent);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown ul {
|
||||
list-style: none;
|
||||
line-height: 2em;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dropdown-mask {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
z-index: 999;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=debugger.css.map*/
|
@ -1,46 +0,0 @@
|
||||
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
|
||||
};
|
@ -1,43 +0,0 @@
|
||||
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);
|
||||
};
|
@ -1,9 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 2.0 KiB |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 465 B |
@ -1,9 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 1.6 KiB |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 460 B |
@ -1,7 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1,8 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 986 B |
@ -1,7 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,7 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 630 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 660 B |
@ -1,10 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 3.3 KiB |
@ -1,4 +0,0 @@
|
||||
<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>
|
Before Width: | Height: | Size: 200 B |
@ -1,10 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1,7 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 786 B |
@ -1,8 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 536 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 452 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 433 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 468 B |
@ -1,9 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 772 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 486 B |
@ -1,8 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 649 B |
@ -1,8 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 626 B |
@ -1,9 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 666 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 927 B |
@ -1,8 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 970 B |
@ -1,6 +0,0 @@
|
||||
<!-- 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>
|
Before Width: | Height: | Size: 885 B |
@ -70,12 +70,12 @@ var Debugger =
|
||||
/***/ 0:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(543);
|
||||
module.exports = __webpack_require__(679);
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 235:
|
||||
/***/ 252:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
function assert(condition, message) {
|
||||
@ -88,11 +88,11 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 543:
|
||||
/***/ 679:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var prettyFast = __webpack_require__(544);
|
||||
var assert = __webpack_require__(235);
|
||||
var prettyFast = __webpack_require__(680);
|
||||
var assert = __webpack_require__(252);
|
||||
|
||||
function prettyPrint(_ref) {
|
||||
var url = _ref.url,
|
||||
@ -156,7 +156,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 544:
|
||||
/***/ 680:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* -*- indent-tabs-mode: nil; js-indent-level: 2; fill-column: 80 -*- */
|
||||
@ -178,8 +178,8 @@ var Debugger =
|
||||
}(this, function () {
|
||||
"use strict";
|
||||
|
||||
var acorn = this.acorn || __webpack_require__(545);
|
||||
var sourceMap = this.sourceMap || __webpack_require__(546);
|
||||
var acorn = this.acorn || __webpack_require__(681);
|
||||
var sourceMap = this.sourceMap || __webpack_require__(682);
|
||||
var SourceNode = sourceMap.SourceNode;
|
||||
|
||||
// If any of these tokens are seen before a "[" token, we know that "[" token
|
||||
@ -1038,7 +1038,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 545:
|
||||
/***/ 681:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
||||
@ -3698,7 +3698,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 546:
|
||||
/***/ 682:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/*
|
||||
@ -3706,14 +3706,14 @@ var Debugger =
|
||||
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
exports.SourceMapGenerator = __webpack_require__(547).SourceMapGenerator;
|
||||
exports.SourceMapConsumer = __webpack_require__(553).SourceMapConsumer;
|
||||
exports.SourceNode = __webpack_require__(555).SourceNode;
|
||||
exports.SourceMapGenerator = __webpack_require__(683).SourceMapGenerator;
|
||||
exports.SourceMapConsumer = __webpack_require__(689).SourceMapConsumer;
|
||||
exports.SourceNode = __webpack_require__(691).SourceNode;
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 547:
|
||||
/***/ 683:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3727,10 +3727,10 @@ var Debugger =
|
||||
}
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
|
||||
|
||||
var base64VLQ = __webpack_require__(548);
|
||||
var util = __webpack_require__(550);
|
||||
var ArraySet = __webpack_require__(551).ArraySet;
|
||||
var MappingList = __webpack_require__(552).MappingList;
|
||||
var base64VLQ = __webpack_require__(684);
|
||||
var util = __webpack_require__(686);
|
||||
var ArraySet = __webpack_require__(687).ArraySet;
|
||||
var MappingList = __webpack_require__(688).MappingList;
|
||||
|
||||
/**
|
||||
* An instance of the SourceMapGenerator represents a source map which is
|
||||
@ -4120,7 +4120,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 548:
|
||||
/***/ 684:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -4164,7 +4164,7 @@ var Debugger =
|
||||
}
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
|
||||
|
||||
var base64 = __webpack_require__(549);
|
||||
var base64 = __webpack_require__(685);
|
||||
|
||||
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
||||
// length quantities we use in the source map spec, the first bit is the sign,
|
||||
@ -4269,7 +4269,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 549:
|
||||
/***/ 685:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -4318,7 +4318,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 550:
|
||||
/***/ 686:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -4644,7 +4644,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 551:
|
||||
/***/ 687:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -4658,7 +4658,7 @@ var Debugger =
|
||||
}
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
|
||||
|
||||
var util = __webpack_require__(550);
|
||||
var util = __webpack_require__(686);
|
||||
|
||||
/**
|
||||
* A data structure which is a combination of an array and a set. Adding a new
|
||||
@ -4748,7 +4748,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 552:
|
||||
/***/ 688:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -4762,7 +4762,7 @@ var Debugger =
|
||||
}
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
|
||||
|
||||
var util = __webpack_require__(550);
|
||||
var util = __webpack_require__(686);
|
||||
|
||||
/**
|
||||
* Determine whether mappingB is after mappingA with respect to generated
|
||||
@ -4841,7 +4841,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 553:
|
||||
/***/ 689:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -4855,10 +4855,10 @@ var Debugger =
|
||||
}
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
|
||||
|
||||
var util = __webpack_require__(550);
|
||||
var binarySearch = __webpack_require__(554);
|
||||
var ArraySet = __webpack_require__(551).ArraySet;
|
||||
var base64VLQ = __webpack_require__(548);
|
||||
var util = __webpack_require__(686);
|
||||
var binarySearch = __webpack_require__(690);
|
||||
var ArraySet = __webpack_require__(687).ArraySet;
|
||||
var base64VLQ = __webpack_require__(684);
|
||||
|
||||
/**
|
||||
* A SourceMapConsumer instance represents a parsed source map which we can
|
||||
@ -5423,7 +5423,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 554:
|
||||
/***/ 690:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -5510,7 +5510,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 555:
|
||||
/***/ 691:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -5524,8 +5524,8 @@ var Debugger =
|
||||
}
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
|
||||
|
||||
var SourceMapGenerator = __webpack_require__(547).SourceMapGenerator;
|
||||
var util = __webpack_require__(550);
|
||||
var SourceMapGenerator = __webpack_require__(683).SourceMapGenerator;
|
||||
var util = __webpack_require__(686);
|
||||
|
||||
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
|
||||
// operating systems these days (capturing the result).
|
||||
|
@ -70,7 +70,7 @@ var Debugger =
|
||||
/***/ 0:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(556);
|
||||
module.exports = __webpack_require__(692);
|
||||
|
||||
|
||||
/***/ },
|
||||
@ -92,7 +92,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 118:
|
||||
/***/ 125:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
@ -128,7 +128,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 233:
|
||||
/***/ 250:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
||||
@ -373,7 +373,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 235:
|
||||
/***/ 252:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
function assert(condition, message) {
|
||||
@ -386,7 +386,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 244:
|
||||
/***/ 295:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
|
||||
@ -396,10 +396,10 @@ var Debugger =
|
||||
* @module utils/source
|
||||
*/
|
||||
|
||||
var _require = __webpack_require__(233),
|
||||
var _require = __webpack_require__(250),
|
||||
endTruncateStr = _require.endTruncateStr;
|
||||
|
||||
var _require2 = __webpack_require__(245),
|
||||
var _require2 = __webpack_require__(296),
|
||||
basename = _require2.basename;
|
||||
|
||||
/**
|
||||
@ -479,17 +479,97 @@ var Debugger =
|
||||
return endTruncateStr(name, 50);
|
||||
}
|
||||
|
||||
var contentTypeModeMap = {
|
||||
"text/javascript": { name: "javascript" },
|
||||
"text/typescript": { name: "javascript", typescript: true },
|
||||
"text/coffeescript": "coffeescript",
|
||||
"text/typescript-jsx": {
|
||||
name: "jsx",
|
||||
base: { name: "javascript", typescript: true }
|
||||
},
|
||||
"text/jsx": "jsx",
|
||||
"text/x-elm": "elm",
|
||||
"text/wasm": { name: "text" },
|
||||
"html": { name: "htmlmixed" }
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns Code Mirror mode for source content type
|
||||
* @param contentType
|
||||
* @return String
|
||||
* @memberof utils/source
|
||||
* @static
|
||||
*/
|
||||
|
||||
function getMode(sourceText) {
|
||||
var contentType = sourceText.contentType,
|
||||
text = sourceText.text;
|
||||
|
||||
// // or /* */
|
||||
|
||||
if (text.match(/^\s*(\/\/ @flow|\/\* @flow \*\/)/)) {
|
||||
return contentTypeModeMap["text/typescript"];
|
||||
}
|
||||
|
||||
if (/script|elm|jsx|wasm/.test(contentType)) {
|
||||
if (contentType in contentTypeModeMap) {
|
||||
return contentTypeModeMap[contentType];
|
||||
}
|
||||
|
||||
return contentTypeModeMap["text/javascript"];
|
||||
}
|
||||
|
||||
// Use HTML mode for files in which the first non whitespace
|
||||
// character is `<` regardless of extension.
|
||||
if (text.match(/^\s*</)) {
|
||||
return { name: "htmlmixed" };
|
||||
}
|
||||
|
||||
return { name: "text" };
|
||||
}
|
||||
|
||||
function getContentType(url) {
|
||||
if (isJavaScript(url)) {
|
||||
return "text/javascript";
|
||||
}
|
||||
|
||||
if (url.match(/ts$/)) {
|
||||
return "text/typescript";
|
||||
}
|
||||
|
||||
if (url.match(/tsx$/)) {
|
||||
return "text/typescript-jsx";
|
||||
}
|
||||
|
||||
if (url.match(/jsx$/)) {
|
||||
return "text/jsx";
|
||||
}
|
||||
|
||||
if (url.match(/coffee$/)) {
|
||||
return "text/coffeescript";
|
||||
}
|
||||
|
||||
if (url.match(/elm$/)) {
|
||||
return "text/elm";
|
||||
}
|
||||
|
||||
return "text/plain";
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isJavaScript,
|
||||
isPretty,
|
||||
getPrettySourceURL,
|
||||
getRawSourceURL,
|
||||
getFilename
|
||||
getFilename,
|
||||
getMode,
|
||||
getContentType
|
||||
};
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 245:
|
||||
/***/ 296:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
function basename(path) {
|
||||
@ -519,10 +599,10 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 258:
|
||||
/***/ 317:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var md5 = __webpack_require__(259);
|
||||
var md5 = __webpack_require__(318);
|
||||
|
||||
function originalToGeneratedId(originalId) {
|
||||
var match = originalId.match(/(.*)\/originalSource/);
|
||||
@ -547,14 +627,14 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 259:
|
||||
/***/ 318:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
(function(){
|
||||
var crypt = __webpack_require__(260),
|
||||
utf8 = __webpack_require__(261).utf8,
|
||||
isBuffer = __webpack_require__(262),
|
||||
bin = __webpack_require__(261).bin,
|
||||
var crypt = __webpack_require__(319),
|
||||
utf8 = __webpack_require__(320).utf8,
|
||||
isBuffer = __webpack_require__(321),
|
||||
bin = __webpack_require__(320).bin,
|
||||
|
||||
// The core
|
||||
md5 = function (message, options) {
|
||||
@ -714,7 +794,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 260:
|
||||
/***/ 319:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
(function() {
|
||||
@ -817,7 +897,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 261:
|
||||
/***/ 320:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
var charenc = {
|
||||
@ -857,7 +937,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 262:
|
||||
/***/ 321:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/*!
|
||||
@ -885,7 +965,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 283:
|
||||
/***/ 398:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
@ -911,8 +991,8 @@ var Debugger =
|
||||
|
||||
'use strict';
|
||||
|
||||
var punycode = __webpack_require__(284);
|
||||
var util = __webpack_require__(285);
|
||||
var punycode = __webpack_require__(399);
|
||||
var util = __webpack_require__(400);
|
||||
|
||||
exports.parse = urlParse;
|
||||
exports.resolve = urlResolve;
|
||||
@ -987,7 +1067,7 @@ var Debugger =
|
||||
'gopher:': true,
|
||||
'file:': true
|
||||
},
|
||||
querystring = __webpack_require__(286);
|
||||
querystring = __webpack_require__(401);
|
||||
|
||||
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
||||
if (url && util.isObject(url) && url instanceof Url) return url;
|
||||
@ -1624,7 +1704,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 284:
|
||||
/***/ 399:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */
|
||||
@ -2160,7 +2240,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 285:
|
||||
/***/ 400:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
'use strict';
|
||||
@ -2183,18 +2263,18 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 286:
|
||||
/***/ 401:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
exports.decode = exports.parse = __webpack_require__(287);
|
||||
exports.encode = exports.stringify = __webpack_require__(288);
|
||||
exports.decode = exports.parse = __webpack_require__(402);
|
||||
exports.encode = exports.stringify = __webpack_require__(403);
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 287:
|
||||
/***/ 402:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
@ -2281,7 +2361,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 288:
|
||||
/***/ 403:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
@ -2352,7 +2432,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 556:
|
||||
/***/ 692:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var _resolveAndFetch = (() => {
|
||||
@ -2470,7 +2550,7 @@ var Debugger =
|
||||
|
||||
return {
|
||||
text,
|
||||
contentType: isJavaScript(originalSource.url || "") ? "text/javascript" : "text/plain"
|
||||
contentType: getContentType(originalSource.url || "")
|
||||
};
|
||||
});
|
||||
|
||||
@ -2486,23 +2566,23 @@ var Debugger =
|
||||
* @module utils/source-map-worker
|
||||
*/
|
||||
|
||||
var networkRequest = __webpack_require__(118);
|
||||
var networkRequest = __webpack_require__(125);
|
||||
|
||||
var _require = __webpack_require__(283),
|
||||
var _require = __webpack_require__(398),
|
||||
parse = _require.parse;
|
||||
|
||||
var path = __webpack_require__(245);
|
||||
var path = __webpack_require__(296);
|
||||
|
||||
var _require2 = __webpack_require__(557),
|
||||
var _require2 = __webpack_require__(693),
|
||||
SourceMapConsumer = _require2.SourceMapConsumer,
|
||||
SourceMapGenerator = _require2.SourceMapGenerator;
|
||||
|
||||
var _require3 = __webpack_require__(244),
|
||||
isJavaScript = _require3.isJavaScript;
|
||||
var _require3 = __webpack_require__(295),
|
||||
getContentType = _require3.getContentType;
|
||||
|
||||
var assert = __webpack_require__(235);
|
||||
var assert = __webpack_require__(252);
|
||||
|
||||
var _require4 = __webpack_require__(258),
|
||||
var _require4 = __webpack_require__(317),
|
||||
originalToGeneratedId = _require4.originalToGeneratedId,
|
||||
generatedToOriginalId = _require4.generatedToOriginalId,
|
||||
isGeneratedId = _require4.isGeneratedId,
|
||||
@ -2630,7 +2710,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 557:
|
||||
/***/ 693:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/*
|
||||
@ -2638,14 +2718,14 @@ var Debugger =
|
||||
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
exports.SourceMapGenerator = __webpack_require__(558).SourceMapGenerator;
|
||||
exports.SourceMapConsumer = __webpack_require__(564).SourceMapConsumer;
|
||||
exports.SourceNode = __webpack_require__(567).SourceNode;
|
||||
exports.SourceMapGenerator = __webpack_require__(694).SourceMapGenerator;
|
||||
exports.SourceMapConsumer = __webpack_require__(700).SourceMapConsumer;
|
||||
exports.SourceNode = __webpack_require__(703).SourceNode;
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 558:
|
||||
/***/ 694:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -2655,10 +2735,10 @@ var Debugger =
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var base64VLQ = __webpack_require__(559);
|
||||
var util = __webpack_require__(561);
|
||||
var ArraySet = __webpack_require__(562).ArraySet;
|
||||
var MappingList = __webpack_require__(563).MappingList;
|
||||
var base64VLQ = __webpack_require__(695);
|
||||
var util = __webpack_require__(697);
|
||||
var ArraySet = __webpack_require__(698).ArraySet;
|
||||
var MappingList = __webpack_require__(699).MappingList;
|
||||
|
||||
/**
|
||||
* An instance of the SourceMapGenerator represents a source map which is
|
||||
@ -3056,7 +3136,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 559:
|
||||
/***/ 695:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3096,7 +3176,7 @@ var Debugger =
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var base64 = __webpack_require__(560);
|
||||
var base64 = __webpack_require__(696);
|
||||
|
||||
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
||||
// length quantities we use in the source map spec, the first bit is the sign,
|
||||
@ -3203,7 +3283,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 560:
|
||||
/***/ 696:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3277,7 +3357,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 561:
|
||||
/***/ 697:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3701,7 +3781,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 562:
|
||||
/***/ 698:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3711,7 +3791,7 @@ var Debugger =
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var util = __webpack_require__(561);
|
||||
var util = __webpack_require__(697);
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
@ -3812,7 +3892,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 563:
|
||||
/***/ 699:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3822,7 +3902,7 @@ var Debugger =
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var util = __webpack_require__(561);
|
||||
var util = __webpack_require__(697);
|
||||
|
||||
/**
|
||||
* Determine whether mappingB is after mappingA with respect to generated
|
||||
@ -3898,7 +3978,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 564:
|
||||
/***/ 700:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -3908,11 +3988,11 @@ var Debugger =
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var util = __webpack_require__(561);
|
||||
var binarySearch = __webpack_require__(565);
|
||||
var ArraySet = __webpack_require__(562).ArraySet;
|
||||
var base64VLQ = __webpack_require__(559);
|
||||
var quickSort = __webpack_require__(566).quickSort;
|
||||
var util = __webpack_require__(697);
|
||||
var binarySearch = __webpack_require__(701);
|
||||
var ArraySet = __webpack_require__(698).ArraySet;
|
||||
var base64VLQ = __webpack_require__(695);
|
||||
var quickSort = __webpack_require__(702).quickSort;
|
||||
|
||||
function SourceMapConsumer(aSourceMap) {
|
||||
var sourceMap = aSourceMap;
|
||||
@ -4987,7 +5067,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 565:
|
||||
/***/ 701:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -5105,7 +5185,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 566:
|
||||
/***/ 702:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -5226,7 +5306,7 @@ var Debugger =
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 567:
|
||||
/***/ 703:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
@ -5236,8 +5316,8 @@ var Debugger =
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var SourceMapGenerator = __webpack_require__(558).SourceMapGenerator;
|
||||
var util = __webpack_require__(561);
|
||||
var SourceMapGenerator = __webpack_require__(694).SourceMapGenerator;
|
||||
var util = __webpack_require__(697);
|
||||
|
||||
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
|
||||
// operating systems these days (capturing the result).
|
||||
|
@ -48,10 +48,10 @@ support-files =
|
||||
[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_navigation.js]
|
||||
[browser_dbg_keyboard-shortcuts.js]
|
||||
[browser_dbg-pause-exceptions.js]
|
||||
[browser_dbg-navigation.js]
|
||||
|
@ -37,6 +37,9 @@ add_task(function* () {
|
||||
|
||||
// close the console
|
||||
clickElement(dbg, "codeMirror");
|
||||
// First time to focus out of text area
|
||||
pressKey(dbg, "Escape");
|
||||
// Second time to hide console
|
||||
pressKey(dbg, "Escape");
|
||||
ok(!dbg.toolbox.splitConsole, "Split console is hidden.");
|
||||
});
|
||||
|
@ -0,0 +1,29 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that keyboard navigation into and out of debugger code editor
|
||||
|
||||
add_task(function* () {
|
||||
const dbg = yield initDebugger("doc-scripts.html");
|
||||
let doc = dbg.win.document;
|
||||
|
||||
yield selectSource(dbg, "simple2");
|
||||
|
||||
yield waitForElement(dbg, ".CodeMirror");
|
||||
findElementWithSelector(dbg, ".CodeMirror").focus();
|
||||
|
||||
// Enter code editor
|
||||
pressKey(dbg, "Enter");
|
||||
is(findElementWithSelector(dbg, "textarea"), doc.activeElement,
|
||||
"Editor is enabled");
|
||||
|
||||
// Exit code editor and focus on container
|
||||
pressKey(dbg, "Escape");
|
||||
is(findElementWithSelector(dbg, ".CodeMirror"), doc.activeElement,
|
||||
"Focused on container");
|
||||
|
||||
// Enter code editor
|
||||
pressKey(dbg, "Tab");
|
||||
is(findElementWithSelector(dbg, "textarea"), doc.activeElement,
|
||||
"Editor is enabled");
|
||||
});
|
@ -539,6 +539,7 @@ const keyMappings = {
|
||||
"Enter": { code: "VK_RETURN" },
|
||||
"Up": { code: "VK_UP" },
|
||||
"Down": { code: "VK_DOWN" },
|
||||
"Tab": { code: "VK_TAB" },
|
||||
"Escape": { code: "VK_ESCAPE" },
|
||||
pauseKey: { code: "VK_F8" },
|
||||
resumeKey: { code: "VK_F8" },
|
||||
|
@ -33,27 +33,6 @@ devtools.jar:
|
||||
content/sourceeditor/codemirror/mozilla.css (sourceeditor/codemirror/mozilla.css)
|
||||
content/sourceeditor/codemirror/old-debugger.css (sourceeditor/codemirror/old-debugger.css)
|
||||
content/debugger/new/index.html (debugger/new/index.html)
|
||||
content/debugger/new/images/angle-brackets.svg (debugger/new/images/angle-brackets.svg)
|
||||
content/debugger/new/images/arrow.svg (debugger/new/images/arrow.svg)
|
||||
content/debugger/new/images/blackBox.svg (debugger/new/images/blackBox.svg)
|
||||
content/debugger/new/images/breakpoint.svg (debugger/new/images/breakpoint.svg)
|
||||
content/debugger/new/images/close.svg (debugger/new/images/close.svg)
|
||||
content/debugger/new/images/disableBreakpoints.svg (debugger/new/images/disableBreakpoints.svg)
|
||||
content/debugger/new/images/domain.svg (debugger/new/images/domain.svg)
|
||||
content/debugger/new/images/file.svg (debugger/new/images/file.svg)
|
||||
content/debugger/new/images/folder.svg (debugger/new/images/folder.svg)
|
||||
content/debugger/new/images/globe.svg (debugger/new/images/globe.svg)
|
||||
content/debugger/new/images/pause-circle.svg (debugger/new/images/pause-circle.svg)
|
||||
content/debugger/new/images/pause.svg (debugger/new/images/pause.svg)
|
||||
content/debugger/new/images/play.svg (debugger/new/images/play.svg)
|
||||
content/debugger/new/images/prettyPrint.svg (debugger/new/images/prettyPrint.svg)
|
||||
content/debugger/new/images/resume.svg (debugger/new/images/resume.svg)
|
||||
content/debugger/new/images/stepIn.svg (debugger/new/images/stepIn.svg)
|
||||
content/debugger/new/images/stepOut.svg (debugger/new/images/stepOut.svg)
|
||||
content/debugger/new/images/stepOver.svg (debugger/new/images/stepOver.svg)
|
||||
content/debugger/new/images/worker.svg (debugger/new/images/worker.svg)
|
||||
content/debugger/new/images/settings.svg (debugger/new/images/settings.svg)
|
||||
content/debugger/new/images/subSettings.svg (debugger/new/images/subSettings.svg)
|
||||
content/debugger/debugger.xul (debugger/debugger.xul)
|
||||
content/debugger/debugger.css (debugger/debugger.css)
|
||||
content/debugger/debugger-controller.js (debugger/debugger-controller.js)
|
||||
|
@ -18,29 +18,59 @@ collapsePanes=Collapse panes
|
||||
# that expands the left and right panes in the debugger UI.
|
||||
expandPanes=Expand panes
|
||||
|
||||
# LOCALIZATION NOTE (pauseButtonTooltip): The tooltip that is displayed for the pause
|
||||
# LOCALIZATION NOTE (pauseButtonTooltip1): The tooltip that is displayed for the pause
|
||||
# button when the debugger is in a running state.
|
||||
pauseButtonTooltip=Pause %S
|
||||
pauseButtonTooltip1=Pause %S
|
||||
|
||||
# LOCALIZATION NOTE (pausePendingButtonTooltip): The tooltip that is displayed for
|
||||
# the pause button after it's been clicked but before the next JavaScript to run.
|
||||
pausePendingButtonTooltip=Waiting for next execution
|
||||
|
||||
# LOCALIZATION NOTE (resumeButtonTooltip1): The label that is displayed on the pause
|
||||
# button when the debugger is in a paused state.
|
||||
resumeButtonTooltip1=Resume %S
|
||||
|
||||
# LOCALIZATION NOTE (stepOverTooltip1): The label that is displayed on the
|
||||
# button that steps over a function call.
|
||||
stepOverTooltip1=Step Over %S
|
||||
|
||||
# LOCALIZATION NOTE (stepInTooltip1): The label that is displayed on the
|
||||
# button that steps into a function call.
|
||||
stepInTooltip1=Step In %S
|
||||
|
||||
# LOCALIZATION NOTE (stepOutTooltip1): The label that is displayed on the
|
||||
# button that steps out of a function call.
|
||||
stepOutTooltip1=Step Out %S
|
||||
|
||||
# LOCALIZATION NOTE (pauseButtonTooltip): The tooltip that is displayed for the pause
|
||||
# button when the debugger is in a running state.
|
||||
# Used in the old debugger frontend.
|
||||
pauseButtonTooltip=Click to pause (%S)
|
||||
|
||||
# LOCALIZATION NOTE (pausePendingButtonTooltip): The tooltip that is displayed for
|
||||
# the pause button after it's been clicked but before the next JavaScript to run.
|
||||
# Used in the old debugger frontend.
|
||||
pausePendingButtonTooltip=Waiting for next execution
|
||||
|
||||
# LOCALIZATION NOTE (resumeButtonTooltip): The label that is displayed on the pause
|
||||
# button when the debugger is in a paused state.
|
||||
resumeButtonTooltip=Resume %S
|
||||
# Used in the old debugger frontend.
|
||||
resumeButtonTooltip=Click to resume (%S)
|
||||
|
||||
# LOCALIZATION NOTE (stepOverTooltip): The label that is displayed on the
|
||||
# button that steps over a function call.
|
||||
stepOverTooltip=Step Over %S
|
||||
# Used in the old debugger frontend.
|
||||
stepOverTooltip=Step Over (%S)
|
||||
|
||||
# LOCALIZATION NOTE (stepInTooltip): The label that is displayed on the
|
||||
# button that steps into a function call.
|
||||
stepInTooltip=Step In %S
|
||||
# Used in the old debugger frontend.
|
||||
stepInTooltip=Step In (%S)
|
||||
|
||||
# LOCALIZATION NOTE (stepOutTooltip): The label that is displayed on the
|
||||
# button that steps out of a function call.
|
||||
stepOutTooltip=Step Out %S
|
||||
# Used in the old debugger frontend.
|
||||
stepOutTooltip=Step Out (%S)
|
||||
|
||||
# LOCALIZATION NOTE (noWorkersText): The text to display in the workers list
|
||||
# when there are no workers.
|
||||
@ -124,9 +154,9 @@ sourceSearch.search.key=F
|
||||
# the search for re-searching the same search triggered from a sourceSearch
|
||||
sourceSearch.search.again.key=G
|
||||
|
||||
# LOCALIZATION NOTE (sourceSearch.search.resultsSummary): Shows a summary of
|
||||
# LOCALIZATION NOTE (sourceSearch1.resultsSummary): Shows a summary of
|
||||
# the number of matches for autocomplete
|
||||
sourceSearch.resultsSummary=%d instances of “%S”
|
||||
sourceSearch1.resultsSummary=%d instances of “%S”
|
||||
|
||||
# LOCALIZATION NOTE (noMatchingStringsText): The text to display in the
|
||||
# global search results when there are no matching strings after filtering.
|
||||
@ -251,9 +281,9 @@ editor.addConditionalBreakpoint=Add Conditional Breakpoint
|
||||
# input element inside ConditionalPanel component
|
||||
editor.conditionalPanel.placeholder=This breakpoint will pause when the expression is true
|
||||
|
||||
# LOCALIZATION NOTE (editor.jumpToMappedLocation): Context menu item
|
||||
# LOCALIZATION NOTE(editor.jumpToMappedLocation1): Context menu item
|
||||
# for navigating to a source mapped location
|
||||
editor.jumpToMappedLocation=Jump to %s location
|
||||
editor.jumpToMappedLocation1=Jump to %S location
|
||||
|
||||
# LOCALIZATION NOTE (generated): Source Map term for a server source location
|
||||
generated=generated
|
||||
@ -300,7 +330,8 @@ scopes.notAvailable=Scopes Unavailable
|
||||
# for when the debugger is not paused.
|
||||
scopes.notPaused=Not Paused
|
||||
|
||||
# LOCALIZATION NOTE (scopes.block): Scopes right sidebar block subheading
|
||||
# LOCALIZATION NOTE (scopes.block): Refers to a block of code in
|
||||
# the scopes pane when the debugger is paused.
|
||||
scopes.block=Block
|
||||
|
||||
# LOCALIZATION NOTE (sources.header): Sources left sidebar header
|
||||
@ -319,14 +350,19 @@ watchExpressions.header=Watch Expressions
|
||||
# button for refreshing the expressions.
|
||||
watchExpressions.refreshButton=Refresh
|
||||
|
||||
# LOCALIZATION NOTE (welcome.search): The center pane welcome panel's
|
||||
# LOCALIZATION NOTE (welcome.search1): The center pane welcome panel's
|
||||
# search prompt. e.g. cmd+p to search for files. On windows, it's ctrl, on
|
||||
# a mac we use the unicode character.
|
||||
welcome.search=%S to search for sources
|
||||
welcome.search1=%S to search for sources
|
||||
|
||||
# LOCALIZATION NOTE (sourceSearch.search1): The center pane Source Search
|
||||
# prompt for searching for files.
|
||||
sourceSearch.search1=Search Sources…
|
||||
|
||||
# LOCALIZATION NOTE (sourceSearch.search): The center pane Source Search
|
||||
# prompt for searching for files.
|
||||
sourceSearch.search=Search Sources…
|
||||
# Used in the old debugger fronted
|
||||
sourceSearch.search=Search…
|
||||
|
||||
# LOCALIZATION NOTE (sourceSearch.noResults): The center pane Source Search
|
||||
# message when the query did not match any of the sources.
|
||||
@ -486,6 +522,10 @@ whyPaused.resumeLimit=Paused while stepping
|
||||
# dom event
|
||||
whyPaused.pauseOnDOMEvents=Paused on event listener
|
||||
|
||||
# LOCALIZATION NOTE (whyPaused.breakpointConditionThrown): The text that is displayed
|
||||
# in an info block when evaluating a conditional breakpoint throws an error
|
||||
whyPaused.breakpointConditionThrown=Error with conditional breakpoint
|
||||
|
||||
# LOCALIZATION NOTE (whyPaused.xhr): The text that is displayed
|
||||
# in a info block explaining how the debugger is currently paused on an
|
||||
# xml http request
|
||||
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"name": "devtools",
|
||||
"version": "0.0.1",
|
||||
"description": "Devtools",
|
||||
"dependencies": {
|
||||
"debugger.html": "0.0.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dir-compare": "^1.3.0"
|
||||
}
|
||||
}
|
41
devtools/client/preferences/debugger.js
Normal file
@ -0,0 +1,41 @@
|
||||
# -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
# 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/.
|
||||
|
||||
#ifdef RELEASE_OR_BETA
|
||||
pref("devtools.debugger.new-debugger-frontend", false);
|
||||
#else
|
||||
pref("devtools.debugger.new-debugger-frontend", true);
|
||||
#endif
|
||||
|
||||
// Enable the Debugger
|
||||
pref("devtools.debugger.enabled", true);
|
||||
pref("devtools.debugger.chrome-debugging-host", "localhost");
|
||||
pref("devtools.debugger.chrome-debugging-port", 6080);
|
||||
pref("devtools.debugger.chrome-debugging-websocket", false);
|
||||
pref("devtools.debugger.remote-host", "localhost");
|
||||
pref("devtools.debugger.remote-timeout", 20000);
|
||||
pref("devtools.debugger.pause-on-exceptions", false);
|
||||
pref("devtools.debugger.ignore-caught-exceptions", true);
|
||||
pref("devtools.debugger.source-maps-enabled", true);
|
||||
pref("devtools.debugger.client-source-maps-enabled", true);
|
||||
pref("devtools.debugger.pretty-print-enabled", true);
|
||||
pref("devtools.debugger.auto-pretty-print", false);
|
||||
pref("devtools.debugger.auto-black-box", true);
|
||||
pref("devtools.debugger.workers", false);
|
||||
|
||||
// The default Debugger UI settings
|
||||
pref("devtools.debugger.ui.panes-workers-and-sources-width", 200);
|
||||
pref("devtools.debugger.ui.panes-instruments-width", 300);
|
||||
pref("devtools.debugger.ui.panes-visible-on-startup", false);
|
||||
pref("devtools.debugger.ui.variables-sorting-enabled", true);
|
||||
pref("devtools.debugger.ui.variables-only-enum-visible", false);
|
||||
pref("devtools.debugger.ui.variables-searchbox-visible", false);
|
||||
pref("devtools.debugger.call-stack-visible", false);
|
||||
pref("devtools.debugger.scopes-visible", false);
|
||||
pref("devtools.debugger.start-panel-collapsed", false);
|
||||
pref("devtools.debugger.end-panel-collapsed", false);
|
||||
pref("devtools.debugger.tabs", "[]");
|
||||
pref("devtools.debugger.pending-selected-location", "{}");
|
||||
|
@ -92,42 +92,6 @@ pref("devtools.defaultColorUnit", "authored");
|
||||
// Enable the Responsive UI tool
|
||||
pref("devtools.responsiveUI.no-reload-notification", false);
|
||||
|
||||
// Enable the Debugger
|
||||
pref("devtools.debugger.enabled", true);
|
||||
pref("devtools.debugger.chrome-debugging-host", "localhost");
|
||||
pref("devtools.debugger.chrome-debugging-port", 6080);
|
||||
pref("devtools.debugger.chrome-debugging-websocket", false);
|
||||
pref("devtools.debugger.remote-host", "localhost");
|
||||
pref("devtools.debugger.remote-timeout", 20000);
|
||||
pref("devtools.debugger.pause-on-exceptions", false);
|
||||
pref("devtools.debugger.ignore-caught-exceptions", true);
|
||||
pref("devtools.debugger.source-maps-enabled", true);
|
||||
pref("devtools.debugger.client-source-maps-enabled", true);
|
||||
pref("devtools.debugger.pretty-print-enabled", true);
|
||||
pref("devtools.debugger.auto-pretty-print", false);
|
||||
pref("devtools.debugger.auto-black-box", true);
|
||||
pref("devtools.debugger.workers", false);
|
||||
|
||||
#ifdef RELEASE_OR_BETA
|
||||
pref("devtools.debugger.new-debugger-frontend", false);
|
||||
#else
|
||||
pref("devtools.debugger.new-debugger-frontend", true);
|
||||
#endif
|
||||
|
||||
// The default Debugger UI settings
|
||||
pref("devtools.debugger.ui.panes-workers-and-sources-width", 200);
|
||||
pref("devtools.debugger.ui.panes-instruments-width", 300);
|
||||
pref("devtools.debugger.ui.panes-visible-on-startup", false);
|
||||
pref("devtools.debugger.ui.variables-sorting-enabled", true);
|
||||
pref("devtools.debugger.ui.variables-only-enum-visible", false);
|
||||
pref("devtools.debugger.ui.variables-searchbox-visible", false);
|
||||
pref("devtools.debugger.call-stack-visible", false);
|
||||
pref("devtools.debugger.scopes-visible", false);
|
||||
pref("devtools.debugger.start-panel-collapsed", false);
|
||||
pref("devtools.debugger.end-panel-collapsed", false);
|
||||
pref("devtools.debugger.tabs", "[]");
|
||||
pref("devtools.debugger.pending-selected-location", "{}");
|
||||
|
||||
// Enable the Memory tools
|
||||
pref("devtools.memory.enabled", true);
|
||||
|
||||
|
@ -5,5 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
JS_PREFERENCE_PP_FILES += [
|
||||
'devtools.js',
|
||||
'debugger.js',
|
||||
'devtools.js'
|
||||
]
|
||||
|
@ -437,6 +437,8 @@ PrefBranch.prototype = {
|
||||
/* eslint-disable no-eval */
|
||||
let devtools = require("raw!prefs!devtools/client/preferences/devtools");
|
||||
eval(devtools);
|
||||
const dbg = require("raw!prefs!devtools/client/preferences/debugger");
|
||||
eval(dbg);
|
||||
let all = require("raw!prefs!modules/libpref/init/all");
|
||||
eval(all);
|
||||
/* eslint-enable no-eval */
|
||||
|
@ -67,6 +67,9 @@ var CodeMirror =
|
||||
__webpack_require__(21);
|
||||
__webpack_require__(22);
|
||||
__webpack_require__(23);
|
||||
__webpack_require__(24);
|
||||
__webpack_require__(25);
|
||||
__webpack_require__(26);
|
||||
module.exports = __webpack_require__(2);
|
||||
|
||||
|
||||
@ -12294,6 +12297,732 @@ var CodeMirror =
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (true) // CommonJS
|
||||
mod(__webpack_require__(2), __webpack_require__(9), __webpack_require__(8))
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript"], mod)
|
||||
else // Plain browser env
|
||||
mod(CodeMirror)
|
||||
})(function(CodeMirror) {
|
||||
"use strict"
|
||||
|
||||
// Depth means the amount of open braces in JS context, in XML
|
||||
// context 0 means not in tag, 1 means in tag, and 2 means in tag
|
||||
// and js block comment.
|
||||
function Context(state, mode, depth, prev) {
|
||||
this.state = state; this.mode = mode; this.depth = depth; this.prev = prev
|
||||
}
|
||||
|
||||
function copyContext(context) {
|
||||
return new Context(CodeMirror.copyState(context.mode, context.state),
|
||||
context.mode,
|
||||
context.depth,
|
||||
context.prev && copyContext(context.prev))
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("jsx", function(config, modeConfig) {
|
||||
var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
|
||||
var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
|
||||
|
||||
function flatXMLIndent(state) {
|
||||
var tagName = state.tagName
|
||||
state.tagName = null
|
||||
var result = xmlMode.indent(state, "")
|
||||
state.tagName = tagName
|
||||
return result
|
||||
}
|
||||
|
||||
function token(stream, state) {
|
||||
if (state.context.mode == xmlMode)
|
||||
return xmlToken(stream, state, state.context)
|
||||
else
|
||||
return jsToken(stream, state, state.context)
|
||||
}
|
||||
|
||||
function xmlToken(stream, state, cx) {
|
||||
if (cx.depth == 2) { // Inside a JS /* */ comment
|
||||
if (stream.match(/^.*?\*\//)) cx.depth = 1
|
||||
else stream.skipToEnd()
|
||||
return "comment"
|
||||
}
|
||||
|
||||
if (stream.peek() == "{") {
|
||||
xmlMode.skipAttribute(cx.state)
|
||||
|
||||
var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context
|
||||
// If JS starts on same line as tag
|
||||
if (xmlContext && stream.match(/^[^>]*>\s*$/, false)) {
|
||||
while (xmlContext.prev && !xmlContext.startOfLine)
|
||||
xmlContext = xmlContext.prev
|
||||
// If tag starts the line, use XML indentation level
|
||||
if (xmlContext.startOfLine) indent -= config.indentUnit
|
||||
// Else use JS indentation level
|
||||
else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented
|
||||
// Else if inside of tag
|
||||
} else if (cx.depth == 1) {
|
||||
indent += config.indentUnit
|
||||
}
|
||||
|
||||
state.context = new Context(CodeMirror.startState(jsMode, indent),
|
||||
jsMode, 0, state.context)
|
||||
return null
|
||||
}
|
||||
|
||||
if (cx.depth == 1) { // Inside of tag
|
||||
if (stream.peek() == "<") { // Tag inside of tag
|
||||
xmlMode.skipAttribute(cx.state)
|
||||
state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)),
|
||||
xmlMode, 0, state.context)
|
||||
return null
|
||||
} else if (stream.match("//")) {
|
||||
stream.skipToEnd()
|
||||
return "comment"
|
||||
} else if (stream.match("/*")) {
|
||||
cx.depth = 2
|
||||
return token(stream, state)
|
||||
}
|
||||
}
|
||||
|
||||
var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop
|
||||
if (/\btag\b/.test(style)) {
|
||||
if (/>$/.test(cur)) {
|
||||
if (cx.state.context) cx.depth = 0
|
||||
else state.context = state.context.prev
|
||||
} else if (/^</.test(cur)) {
|
||||
cx.depth = 1
|
||||
}
|
||||
} else if (!style && (stop = cur.indexOf("{")) > -1) {
|
||||
stream.backUp(cur.length - stop)
|
||||
}
|
||||
return style
|
||||
}
|
||||
|
||||
function jsToken(stream, state, cx) {
|
||||
if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
|
||||
jsMode.skipExpression(cx.state)
|
||||
state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "")),
|
||||
xmlMode, 0, state.context)
|
||||
return null
|
||||
}
|
||||
|
||||
var style = jsMode.token(stream, cx.state)
|
||||
if (!style && cx.depth != null) {
|
||||
var cur = stream.current()
|
||||
if (cur == "{") {
|
||||
cx.depth++
|
||||
} else if (cur == "}") {
|
||||
if (--cx.depth == 0) state.context = state.context.prev
|
||||
}
|
||||
}
|
||||
return style
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {context: new Context(CodeMirror.startState(jsMode), jsMode)}
|
||||
},
|
||||
|
||||
copyState: function(state) {
|
||||
return {context: copyContext(state.context)}
|
||||
},
|
||||
|
||||
token: token,
|
||||
|
||||
indent: function(state, textAfter, fullLine) {
|
||||
return state.context.mode.indent(state.context.state, textAfter, fullLine)
|
||||
},
|
||||
|
||||
innerMode: function(state) {
|
||||
return state.context
|
||||
}
|
||||
}
|
||||
}, "xml", "javascript")
|
||||
|
||||
CodeMirror.defineMIME("text/jsx", "jsx")
|
||||
CodeMirror.defineMIME("text/typescript-jsx", {name: "jsx", base: {name: "javascript", typescript: true}})
|
||||
});
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 13 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
/**
|
||||
* Link to the project's GitHub page:
|
||||
* https://github.com/pickhardt/coffeescript-codemirror-mode
|
||||
*/
|
||||
(function(mod) {
|
||||
if (true) // CommonJS
|
||||
mod(__webpack_require__(2));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
||||
var ERRORCLASS = "error";
|
||||
|
||||
function wordRegexp(words) {
|
||||
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
||||
}
|
||||
|
||||
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
|
||||
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
|
||||
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
|
||||
var wordOperators = wordRegexp(["and", "or", "not",
|
||||
"is", "isnt", "in",
|
||||
"instanceof", "typeof"]);
|
||||
var indentKeywords = ["for", "while", "loop", "if", "unless", "else",
|
||||
"switch", "try", "catch", "finally", "class"];
|
||||
var commonKeywords = ["break", "by", "continue", "debugger", "delete",
|
||||
"do", "in", "of", "new", "return", "then",
|
||||
"this", "@", "throw", "when", "until", "extends"];
|
||||
|
||||
var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
|
||||
|
||||
indentKeywords = wordRegexp(indentKeywords);
|
||||
|
||||
|
||||
var stringPrefixes = /^('{3}|\"{3}|['\"])/;
|
||||
var regexPrefixes = /^(\/{3}|\/)/;
|
||||
var commonConstants = ["Infinity", "NaN", "undefined", "null", "true", "false", "on", "off", "yes", "no"];
|
||||
var constants = wordRegexp(commonConstants);
|
||||
|
||||
// Tokenizers
|
||||
function tokenBase(stream, state) {
|
||||
// Handle scope changes
|
||||
if (stream.sol()) {
|
||||
if (state.scope.align === null) state.scope.align = false;
|
||||
var scopeOffset = state.scope.offset;
|
||||
if (stream.eatSpace()) {
|
||||
var lineOffset = stream.indentation();
|
||||
if (lineOffset > scopeOffset && state.scope.type == "coffee") {
|
||||
return "indent";
|
||||
} else if (lineOffset < scopeOffset) {
|
||||
return "dedent";
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
if (scopeOffset > 0) {
|
||||
dedent(stream, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stream.eatSpace()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var ch = stream.peek();
|
||||
|
||||
// Handle docco title comment (single line)
|
||||
if (stream.match("####")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// Handle multi line comments
|
||||
if (stream.match("###")) {
|
||||
state.tokenize = longComment;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
|
||||
// Single line comment
|
||||
if (ch === "#") {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// Handle number literals
|
||||
if (stream.match(/^-?[0-9\.]/, false)) {
|
||||
var floatLiteral = false;
|
||||
// Floats
|
||||
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
|
||||
floatLiteral = true;
|
||||
}
|
||||
if (stream.match(/^-?\d+\.\d*/)) {
|
||||
floatLiteral = true;
|
||||
}
|
||||
if (stream.match(/^-?\.\d+/)) {
|
||||
floatLiteral = true;
|
||||
}
|
||||
|
||||
if (floatLiteral) {
|
||||
// prevent from getting extra . on 1..
|
||||
if (stream.peek() == "."){
|
||||
stream.backUp(1);
|
||||
}
|
||||
return "number";
|
||||
}
|
||||
// Integers
|
||||
var intLiteral = false;
|
||||
// Hex
|
||||
if (stream.match(/^-?0x[0-9a-f]+/i)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
// Decimal
|
||||
if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
// Zero by itself with no other piece of number.
|
||||
if (stream.match(/^-?0(?![\dx])/i)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
if (intLiteral) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
||||
// Handle strings
|
||||
if (stream.match(stringPrefixes)) {
|
||||
state.tokenize = tokenFactory(stream.current(), false, "string");
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
// Handle regex literals
|
||||
if (stream.match(regexPrefixes)) {
|
||||
if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division
|
||||
state.tokenize = tokenFactory(stream.current(), true, "string-2");
|
||||
return state.tokenize(stream, state);
|
||||
} else {
|
||||
stream.backUp(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Handle operators and delimiters
|
||||
if (stream.match(operators) || stream.match(wordOperators)) {
|
||||
return "operator";
|
||||
}
|
||||
if (stream.match(delimiters)) {
|
||||
return "punctuation";
|
||||
}
|
||||
|
||||
if (stream.match(constants)) {
|
||||
return "atom";
|
||||
}
|
||||
|
||||
if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
|
||||
return "property";
|
||||
}
|
||||
|
||||
if (stream.match(keywords)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
if (stream.match(identifiers)) {
|
||||
return "variable";
|
||||
}
|
||||
|
||||
// Handle non-detected items
|
||||
stream.next();
|
||||
return ERRORCLASS;
|
||||
}
|
||||
|
||||
function tokenFactory(delimiter, singleline, outclass) {
|
||||
return function(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
stream.eatWhile(/[^'"\/\\]/);
|
||||
if (stream.eat("\\")) {
|
||||
stream.next();
|
||||
if (singleline && stream.eol()) {
|
||||
return outclass;
|
||||
}
|
||||
} else if (stream.match(delimiter)) {
|
||||
state.tokenize = tokenBase;
|
||||
return outclass;
|
||||
} else {
|
||||
stream.eat(/['"\/]/);
|
||||
}
|
||||
}
|
||||
if (singleline) {
|
||||
if (parserConf.singleLineStringErrors) {
|
||||
outclass = ERRORCLASS;
|
||||
} else {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
}
|
||||
return outclass;
|
||||
};
|
||||
}
|
||||
|
||||
function longComment(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
stream.eatWhile(/[^#]/);
|
||||
if (stream.match("###")) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
stream.eatWhile("#");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function indent(stream, state, type) {
|
||||
type = type || "coffee";
|
||||
var offset = 0, align = false, alignOffset = null;
|
||||
for (var scope = state.scope; scope; scope = scope.prev) {
|
||||
if (scope.type === "coffee" || scope.type == "}") {
|
||||
offset = scope.offset + conf.indentUnit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (type !== "coffee") {
|
||||
align = null;
|
||||
alignOffset = stream.column() + stream.current().length;
|
||||
} else if (state.scope.align) {
|
||||
state.scope.align = false;
|
||||
}
|
||||
state.scope = {
|
||||
offset: offset,
|
||||
type: type,
|
||||
prev: state.scope,
|
||||
align: align,
|
||||
alignOffset: alignOffset
|
||||
};
|
||||
}
|
||||
|
||||
function dedent(stream, state) {
|
||||
if (!state.scope.prev) return;
|
||||
if (state.scope.type === "coffee") {
|
||||
var _indent = stream.indentation();
|
||||
var matched = false;
|
||||
for (var scope = state.scope; scope; scope = scope.prev) {
|
||||
if (_indent === scope.offset) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
return true;
|
||||
}
|
||||
while (state.scope.prev && state.scope.offset !== _indent) {
|
||||
state.scope = state.scope.prev;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
state.scope = state.scope.prev;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function tokenLexer(stream, state) {
|
||||
var style = state.tokenize(stream, state);
|
||||
var current = stream.current();
|
||||
|
||||
// Handle scope changes.
|
||||
if (current === "return") {
|
||||
state.dedent = true;
|
||||
}
|
||||
if (((current === "->" || current === "=>") && stream.eol())
|
||||
|| style === "indent") {
|
||||
indent(stream, state);
|
||||
}
|
||||
var delimiter_index = "[({".indexOf(current);
|
||||
if (delimiter_index !== -1) {
|
||||
indent(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
||||
}
|
||||
if (indentKeywords.exec(current)){
|
||||
indent(stream, state);
|
||||
}
|
||||
if (current == "then"){
|
||||
dedent(stream, state);
|
||||
}
|
||||
|
||||
|
||||
if (style === "dedent") {
|
||||
if (dedent(stream, state)) {
|
||||
return ERRORCLASS;
|
||||
}
|
||||
}
|
||||
delimiter_index = "])}".indexOf(current);
|
||||
if (delimiter_index !== -1) {
|
||||
while (state.scope.type == "coffee" && state.scope.prev)
|
||||
state.scope = state.scope.prev;
|
||||
if (state.scope.type == current)
|
||||
state.scope = state.scope.prev;
|
||||
}
|
||||
if (state.dedent && stream.eol()) {
|
||||
if (state.scope.type == "coffee" && state.scope.prev)
|
||||
state.scope = state.scope.prev;
|
||||
state.dedent = false;
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
var external = {
|
||||
startState: function(basecolumn) {
|
||||
return {
|
||||
tokenize: tokenBase,
|
||||
scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
|
||||
prop: false,
|
||||
dedent: 0
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
var fillAlign = state.scope.align === null && state.scope;
|
||||
if (fillAlign && stream.sol()) fillAlign.align = false;
|
||||
|
||||
var style = tokenLexer(stream, state);
|
||||
if (style && style != "comment") {
|
||||
if (fillAlign) fillAlign.align = true;
|
||||
state.prop = style == "punctuation" && stream.current() == "."
|
||||
}
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, text) {
|
||||
if (state.tokenize != tokenBase) return 0;
|
||||
var scope = state.scope;
|
||||
var closer = text && "])}".indexOf(text.charAt(0)) > -1;
|
||||
if (closer) while (scope.type == "coffee" && scope.prev) scope = scope.prev;
|
||||
var closes = closer && scope.type === text.charAt(0);
|
||||
if (scope.align)
|
||||
return scope.alignOffset - (closes ? 1 : 0);
|
||||
else
|
||||
return (closes ? scope.prev : scope).offset;
|
||||
},
|
||||
|
||||
lineComment: "#",
|
||||
fold: "indent"
|
||||
};
|
||||
return external;
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
|
||||
CodeMirror.defineMIME("text/coffeescript", "coffeescript");
|
||||
|
||||
});
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 14 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (true) // CommonJS
|
||||
mod(__webpack_require__(2));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("elm", function() {
|
||||
|
||||
function switchState(source, setState, f) {
|
||||
setState(f);
|
||||
return f(source, setState);
|
||||
}
|
||||
|
||||
// These should all be Unicode extended, as per the Haskell 2010 report
|
||||
var smallRE = /[a-z_]/;
|
||||
var largeRE = /[A-Z]/;
|
||||
var digitRE = /[0-9]/;
|
||||
var hexitRE = /[0-9A-Fa-f]/;
|
||||
var octitRE = /[0-7]/;
|
||||
var idRE = /[a-z_A-Z0-9\']/;
|
||||
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/;
|
||||
var specialRE = /[(),;[\]`{}]/;
|
||||
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
||||
|
||||
function normal() {
|
||||
return function (source, setState) {
|
||||
if (source.eatWhile(whiteCharRE)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var ch = source.next();
|
||||
if (specialRE.test(ch)) {
|
||||
if (ch == '{' && source.eat('-')) {
|
||||
var t = "comment";
|
||||
if (source.eat('#')) t = "meta";
|
||||
return switchState(source, setState, ncomment(t, 1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ch == '\'') {
|
||||
if (source.eat('\\'))
|
||||
source.next(); // should handle other escapes here
|
||||
else
|
||||
source.next();
|
||||
|
||||
if (source.eat('\''))
|
||||
return "string";
|
||||
return "error";
|
||||
}
|
||||
|
||||
if (ch == '"') {
|
||||
return switchState(source, setState, stringLiteral);
|
||||
}
|
||||
|
||||
if (largeRE.test(ch)) {
|
||||
source.eatWhile(idRE);
|
||||
if (source.eat('.'))
|
||||
return "qualifier";
|
||||
return "variable-2";
|
||||
}
|
||||
|
||||
if (smallRE.test(ch)) {
|
||||
var isDef = source.pos === 1;
|
||||
source.eatWhile(idRE);
|
||||
return isDef ? "variable-3" : "variable";
|
||||
}
|
||||
|
||||
if (digitRE.test(ch)) {
|
||||
if (ch == '0') {
|
||||
if (source.eat(/[xX]/)) {
|
||||
source.eatWhile(hexitRE); // should require at least 1
|
||||
return "integer";
|
||||
}
|
||||
if (source.eat(/[oO]/)) {
|
||||
source.eatWhile(octitRE); // should require at least 1
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
source.eatWhile(digitRE);
|
||||
var t = "number";
|
||||
if (source.eat('.')) {
|
||||
t = "number";
|
||||
source.eatWhile(digitRE); // should require at least 1
|
||||
}
|
||||
if (source.eat(/[eE]/)) {
|
||||
t = "number";
|
||||
source.eat(/[-+]/);
|
||||
source.eatWhile(digitRE); // should require at least 1
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
if (symbolRE.test(ch)) {
|
||||
if (ch == '-' && source.eat(/-/)) {
|
||||
source.eatWhile(/-/);
|
||||
if (!source.eat(symbolRE)) {
|
||||
source.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
source.eatWhile(symbolRE);
|
||||
return "builtin";
|
||||
}
|
||||
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
function ncomment(type, nest) {
|
||||
if (nest == 0) {
|
||||
return normal();
|
||||
}
|
||||
return function(source, setState) {
|
||||
var currNest = nest;
|
||||
while (!source.eol()) {
|
||||
var ch = source.next();
|
||||
if (ch == '{' && source.eat('-')) {
|
||||
++currNest;
|
||||
} else if (ch == '-' && source.eat('}')) {
|
||||
--currNest;
|
||||
if (currNest == 0) {
|
||||
setState(normal());
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(ncomment(type, currNest));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
function stringLiteral(source, setState) {
|
||||
while (!source.eol()) {
|
||||
var ch = source.next();
|
||||
if (ch == '"') {
|
||||
setState(normal());
|
||||
return "string";
|
||||
}
|
||||
if (ch == '\\') {
|
||||
if (source.eol() || source.eat(whiteCharRE)) {
|
||||
setState(stringGap);
|
||||
return "string";
|
||||
}
|
||||
if (!source.eat('&')) source.next(); // should handle other escapes here
|
||||
}
|
||||
}
|
||||
setState(normal());
|
||||
return "error";
|
||||
}
|
||||
|
||||
function stringGap(source, setState) {
|
||||
if (source.eat('\\')) {
|
||||
return switchState(source, setState, stringLiteral);
|
||||
}
|
||||
source.next();
|
||||
setState(normal());
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
var wellKnownWords = (function() {
|
||||
var wkw = {};
|
||||
|
||||
var keywords = [
|
||||
"case", "of", "as",
|
||||
"if", "then", "else",
|
||||
"let", "in",
|
||||
"infix", "infixl", "infixr",
|
||||
"type", "alias",
|
||||
"input", "output", "foreign", "loopback",
|
||||
"module", "where", "import", "exposing",
|
||||
"_", "..", "|", ":", "=", "\\", "\"", "->", "<-"
|
||||
];
|
||||
|
||||
for (var i = keywords.length; i--;)
|
||||
wkw[keywords[i]] = "keyword";
|
||||
|
||||
return wkw;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
return {
|
||||
startState: function () { return { f: normal() }; },
|
||||
copyState: function (s) { return { f: s.f }; },
|
||||
|
||||
token: function(stream, state) {
|
||||
var t = state.f(stream, function(s) { state.f = s; });
|
||||
var w = stream.current();
|
||||
return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t;
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-elm", "elm");
|
||||
});
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 15 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (true) // CommonJS
|
||||
mod(__webpack_require__(2));
|
||||
@ -13080,7 +13809,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 13 */
|
||||
/* 16 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
@ -13289,7 +14018,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 14 */
|
||||
/* 17 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -13369,7 +14098,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 15 */
|
||||
/* 18 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -13402,7 +14131,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 16 */
|
||||
/* 19 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -13820,7 +14549,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 17 */
|
||||
/* 20 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -18891,7 +19620,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 18 */
|
||||
/* 21 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -19477,7 +20206,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 19 */
|
||||
/* 22 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -19633,7 +20362,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 20 */
|
||||
/* 23 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -19744,7 +20473,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 21 */
|
||||
/* 24 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -19809,7 +20538,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 22 */
|
||||
/* 25 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -19997,7 +20726,7 @@ var CodeMirror =
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 23 */
|
||||
/* 26 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
@ -20005,7 +20734,7 @@ var CodeMirror =
|
||||
|
||||
(function(mod) {
|
||||
if (true) // CommonJS
|
||||
mod(__webpack_require__(2), __webpack_require__(19));
|
||||
mod(__webpack_require__(2), __webpack_require__(22));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "./foldcode"], mod);
|
||||
else // Plain browser env
|
||||
|
355
devtools/client/sourceeditor/codemirror/mode/coffeescript/coffeescript.js
vendored
Normal file
@ -0,0 +1,355 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
/**
|
||||
* Link to the project's GitHub page:
|
||||
* https://github.com/pickhardt/coffeescript-codemirror-mode
|
||||
*/
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
||||
var ERRORCLASS = "error";
|
||||
|
||||
function wordRegexp(words) {
|
||||
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
||||
}
|
||||
|
||||
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
|
||||
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
|
||||
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
|
||||
var wordOperators = wordRegexp(["and", "or", "not",
|
||||
"is", "isnt", "in",
|
||||
"instanceof", "typeof"]);
|
||||
var indentKeywords = ["for", "while", "loop", "if", "unless", "else",
|
||||
"switch", "try", "catch", "finally", "class"];
|
||||
var commonKeywords = ["break", "by", "continue", "debugger", "delete",
|
||||
"do", "in", "of", "new", "return", "then",
|
||||
"this", "@", "throw", "when", "until", "extends"];
|
||||
|
||||
var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
|
||||
|
||||
indentKeywords = wordRegexp(indentKeywords);
|
||||
|
||||
|
||||
var stringPrefixes = /^('{3}|\"{3}|['\"])/;
|
||||
var regexPrefixes = /^(\/{3}|\/)/;
|
||||
var commonConstants = ["Infinity", "NaN", "undefined", "null", "true", "false", "on", "off", "yes", "no"];
|
||||
var constants = wordRegexp(commonConstants);
|
||||
|
||||
// Tokenizers
|
||||
function tokenBase(stream, state) {
|
||||
// Handle scope changes
|
||||
if (stream.sol()) {
|
||||
if (state.scope.align === null) state.scope.align = false;
|
||||
var scopeOffset = state.scope.offset;
|
||||
if (stream.eatSpace()) {
|
||||
var lineOffset = stream.indentation();
|
||||
if (lineOffset > scopeOffset && state.scope.type == "coffee") {
|
||||
return "indent";
|
||||
} else if (lineOffset < scopeOffset) {
|
||||
return "dedent";
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
if (scopeOffset > 0) {
|
||||
dedent(stream, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stream.eatSpace()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var ch = stream.peek();
|
||||
|
||||
// Handle docco title comment (single line)
|
||||
if (stream.match("####")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// Handle multi line comments
|
||||
if (stream.match("###")) {
|
||||
state.tokenize = longComment;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
|
||||
// Single line comment
|
||||
if (ch === "#") {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// Handle number literals
|
||||
if (stream.match(/^-?[0-9\.]/, false)) {
|
||||
var floatLiteral = false;
|
||||
// Floats
|
||||
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
|
||||
floatLiteral = true;
|
||||
}
|
||||
if (stream.match(/^-?\d+\.\d*/)) {
|
||||
floatLiteral = true;
|
||||
}
|
||||
if (stream.match(/^-?\.\d+/)) {
|
||||
floatLiteral = true;
|
||||
}
|
||||
|
||||
if (floatLiteral) {
|
||||
// prevent from getting extra . on 1..
|
||||
if (stream.peek() == "."){
|
||||
stream.backUp(1);
|
||||
}
|
||||
return "number";
|
||||
}
|
||||
// Integers
|
||||
var intLiteral = false;
|
||||
// Hex
|
||||
if (stream.match(/^-?0x[0-9a-f]+/i)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
// Decimal
|
||||
if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
// Zero by itself with no other piece of number.
|
||||
if (stream.match(/^-?0(?![\dx])/i)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
if (intLiteral) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
||||
// Handle strings
|
||||
if (stream.match(stringPrefixes)) {
|
||||
state.tokenize = tokenFactory(stream.current(), false, "string");
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
// Handle regex literals
|
||||
if (stream.match(regexPrefixes)) {
|
||||
if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division
|
||||
state.tokenize = tokenFactory(stream.current(), true, "string-2");
|
||||
return state.tokenize(stream, state);
|
||||
} else {
|
||||
stream.backUp(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Handle operators and delimiters
|
||||
if (stream.match(operators) || stream.match(wordOperators)) {
|
||||
return "operator";
|
||||
}
|
||||
if (stream.match(delimiters)) {
|
||||
return "punctuation";
|
||||
}
|
||||
|
||||
if (stream.match(constants)) {
|
||||
return "atom";
|
||||
}
|
||||
|
||||
if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
|
||||
return "property";
|
||||
}
|
||||
|
||||
if (stream.match(keywords)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
if (stream.match(identifiers)) {
|
||||
return "variable";
|
||||
}
|
||||
|
||||
// Handle non-detected items
|
||||
stream.next();
|
||||
return ERRORCLASS;
|
||||
}
|
||||
|
||||
function tokenFactory(delimiter, singleline, outclass) {
|
||||
return function(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
stream.eatWhile(/[^'"\/\\]/);
|
||||
if (stream.eat("\\")) {
|
||||
stream.next();
|
||||
if (singleline && stream.eol()) {
|
||||
return outclass;
|
||||
}
|
||||
} else if (stream.match(delimiter)) {
|
||||
state.tokenize = tokenBase;
|
||||
return outclass;
|
||||
} else {
|
||||
stream.eat(/['"\/]/);
|
||||
}
|
||||
}
|
||||
if (singleline) {
|
||||
if (parserConf.singleLineStringErrors) {
|
||||
outclass = ERRORCLASS;
|
||||
} else {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
}
|
||||
return outclass;
|
||||
};
|
||||
}
|
||||
|
||||
function longComment(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
stream.eatWhile(/[^#]/);
|
||||
if (stream.match("###")) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
stream.eatWhile("#");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function indent(stream, state, type) {
|
||||
type = type || "coffee";
|
||||
var offset = 0, align = false, alignOffset = null;
|
||||
for (var scope = state.scope; scope; scope = scope.prev) {
|
||||
if (scope.type === "coffee" || scope.type == "}") {
|
||||
offset = scope.offset + conf.indentUnit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (type !== "coffee") {
|
||||
align = null;
|
||||
alignOffset = stream.column() + stream.current().length;
|
||||
} else if (state.scope.align) {
|
||||
state.scope.align = false;
|
||||
}
|
||||
state.scope = {
|
||||
offset: offset,
|
||||
type: type,
|
||||
prev: state.scope,
|
||||
align: align,
|
||||
alignOffset: alignOffset
|
||||
};
|
||||
}
|
||||
|
||||
function dedent(stream, state) {
|
||||
if (!state.scope.prev) return;
|
||||
if (state.scope.type === "coffee") {
|
||||
var _indent = stream.indentation();
|
||||
var matched = false;
|
||||
for (var scope = state.scope; scope; scope = scope.prev) {
|
||||
if (_indent === scope.offset) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
return true;
|
||||
}
|
||||
while (state.scope.prev && state.scope.offset !== _indent) {
|
||||
state.scope = state.scope.prev;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
state.scope = state.scope.prev;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function tokenLexer(stream, state) {
|
||||
var style = state.tokenize(stream, state);
|
||||
var current = stream.current();
|
||||
|
||||
// Handle scope changes.
|
||||
if (current === "return") {
|
||||
state.dedent = true;
|
||||
}
|
||||
if (((current === "->" || current === "=>") && stream.eol())
|
||||
|| style === "indent") {
|
||||
indent(stream, state);
|
||||
}
|
||||
var delimiter_index = "[({".indexOf(current);
|
||||
if (delimiter_index !== -1) {
|
||||
indent(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
||||
}
|
||||
if (indentKeywords.exec(current)){
|
||||
indent(stream, state);
|
||||
}
|
||||
if (current == "then"){
|
||||
dedent(stream, state);
|
||||
}
|
||||
|
||||
|
||||
if (style === "dedent") {
|
||||
if (dedent(stream, state)) {
|
||||
return ERRORCLASS;
|
||||
}
|
||||
}
|
||||
delimiter_index = "])}".indexOf(current);
|
||||
if (delimiter_index !== -1) {
|
||||
while (state.scope.type == "coffee" && state.scope.prev)
|
||||
state.scope = state.scope.prev;
|
||||
if (state.scope.type == current)
|
||||
state.scope = state.scope.prev;
|
||||
}
|
||||
if (state.dedent && stream.eol()) {
|
||||
if (state.scope.type == "coffee" && state.scope.prev)
|
||||
state.scope = state.scope.prev;
|
||||
state.dedent = false;
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
var external = {
|
||||
startState: function(basecolumn) {
|
||||
return {
|
||||
tokenize: tokenBase,
|
||||
scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
|
||||
prop: false,
|
||||
dedent: 0
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
var fillAlign = state.scope.align === null && state.scope;
|
||||
if (fillAlign && stream.sol()) fillAlign.align = false;
|
||||
|
||||
var style = tokenLexer(stream, state);
|
||||
if (style && style != "comment") {
|
||||
if (fillAlign) fillAlign.align = true;
|
||||
state.prop = style == "punctuation" && stream.current() == "."
|
||||
}
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, text) {
|
||||
if (state.tokenize != tokenBase) return 0;
|
||||
var scope = state.scope;
|
||||
var closer = text && "])}".indexOf(text.charAt(0)) > -1;
|
||||
if (closer) while (scope.type == "coffee" && scope.prev) scope = scope.prev;
|
||||
var closes = closer && scope.type === text.charAt(0);
|
||||
if (scope.align)
|
||||
return scope.alignOffset - (closes ? 1 : 0);
|
||||
else
|
||||
return (closes ? scope.prev : scope).offset;
|
||||
},
|
||||
|
||||
lineComment: "#",
|
||||
fold: "indent"
|
||||
};
|
||||
return external;
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
|
||||
CodeMirror.defineMIME("text/coffeescript", "coffeescript");
|
||||
|
||||
});
|
205
devtools/client/sourceeditor/codemirror/mode/elm/elm.js
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("elm", function() {
|
||||
|
||||
function switchState(source, setState, f) {
|
||||
setState(f);
|
||||
return f(source, setState);
|
||||
}
|
||||
|
||||
// These should all be Unicode extended, as per the Haskell 2010 report
|
||||
var smallRE = /[a-z_]/;
|
||||
var largeRE = /[A-Z]/;
|
||||
var digitRE = /[0-9]/;
|
||||
var hexitRE = /[0-9A-Fa-f]/;
|
||||
var octitRE = /[0-7]/;
|
||||
var idRE = /[a-z_A-Z0-9\']/;
|
||||
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/;
|
||||
var specialRE = /[(),;[\]`{}]/;
|
||||
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
||||
|
||||
function normal() {
|
||||
return function (source, setState) {
|
||||
if (source.eatWhile(whiteCharRE)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var ch = source.next();
|
||||
if (specialRE.test(ch)) {
|
||||
if (ch == '{' && source.eat('-')) {
|
||||
var t = "comment";
|
||||
if (source.eat('#')) t = "meta";
|
||||
return switchState(source, setState, ncomment(t, 1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ch == '\'') {
|
||||
if (source.eat('\\'))
|
||||
source.next(); // should handle other escapes here
|
||||
else
|
||||
source.next();
|
||||
|
||||
if (source.eat('\''))
|
||||
return "string";
|
||||
return "error";
|
||||
}
|
||||
|
||||
if (ch == '"') {
|
||||
return switchState(source, setState, stringLiteral);
|
||||
}
|
||||
|
||||
if (largeRE.test(ch)) {
|
||||
source.eatWhile(idRE);
|
||||
if (source.eat('.'))
|
||||
return "qualifier";
|
||||
return "variable-2";
|
||||
}
|
||||
|
||||
if (smallRE.test(ch)) {
|
||||
var isDef = source.pos === 1;
|
||||
source.eatWhile(idRE);
|
||||
return isDef ? "variable-3" : "variable";
|
||||
}
|
||||
|
||||
if (digitRE.test(ch)) {
|
||||
if (ch == '0') {
|
||||
if (source.eat(/[xX]/)) {
|
||||
source.eatWhile(hexitRE); // should require at least 1
|
||||
return "integer";
|
||||
}
|
||||
if (source.eat(/[oO]/)) {
|
||||
source.eatWhile(octitRE); // should require at least 1
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
source.eatWhile(digitRE);
|
||||
var t = "number";
|
||||
if (source.eat('.')) {
|
||||
t = "number";
|
||||
source.eatWhile(digitRE); // should require at least 1
|
||||
}
|
||||
if (source.eat(/[eE]/)) {
|
||||
t = "number";
|
||||
source.eat(/[-+]/);
|
||||
source.eatWhile(digitRE); // should require at least 1
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
if (symbolRE.test(ch)) {
|
||||
if (ch == '-' && source.eat(/-/)) {
|
||||
source.eatWhile(/-/);
|
||||
if (!source.eat(symbolRE)) {
|
||||
source.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
source.eatWhile(symbolRE);
|
||||
return "builtin";
|
||||
}
|
||||
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
function ncomment(type, nest) {
|
||||
if (nest == 0) {
|
||||
return normal();
|
||||
}
|
||||
return function(source, setState) {
|
||||
var currNest = nest;
|
||||
while (!source.eol()) {
|
||||
var ch = source.next();
|
||||
if (ch == '{' && source.eat('-')) {
|
||||
++currNest;
|
||||
} else if (ch == '-' && source.eat('}')) {
|
||||
--currNest;
|
||||
if (currNest == 0) {
|
||||
setState(normal());
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(ncomment(type, currNest));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
function stringLiteral(source, setState) {
|
||||
while (!source.eol()) {
|
||||
var ch = source.next();
|
||||
if (ch == '"') {
|
||||
setState(normal());
|
||||
return "string";
|
||||
}
|
||||
if (ch == '\\') {
|
||||
if (source.eol() || source.eat(whiteCharRE)) {
|
||||
setState(stringGap);
|
||||
return "string";
|
||||
}
|
||||
if (!source.eat('&')) source.next(); // should handle other escapes here
|
||||
}
|
||||
}
|
||||
setState(normal());
|
||||
return "error";
|
||||
}
|
||||
|
||||
function stringGap(source, setState) {
|
||||
if (source.eat('\\')) {
|
||||
return switchState(source, setState, stringLiteral);
|
||||
}
|
||||
source.next();
|
||||
setState(normal());
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
var wellKnownWords = (function() {
|
||||
var wkw = {};
|
||||
|
||||
var keywords = [
|
||||
"case", "of", "as",
|
||||
"if", "then", "else",
|
||||
"let", "in",
|
||||
"infix", "infixl", "infixr",
|
||||
"type", "alias",
|
||||
"input", "output", "foreign", "loopback",
|
||||
"module", "where", "import", "exposing",
|
||||
"_", "..", "|", ":", "=", "\\", "\"", "->", "<-"
|
||||
];
|
||||
|
||||
for (var i = keywords.length; i--;)
|
||||
wkw[keywords[i]] = "keyword";
|
||||
|
||||
return wkw;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
return {
|
||||
startState: function () { return { f: normal() }; },
|
||||
copyState: function (s) { return { f: s.f }; },
|
||||
|
||||
token: function(stream, state) {
|
||||
var t = state.f(stream, function(s) { state.f = s; });
|
||||
var w = stream.current();
|
||||
return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t;
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-elm", "elm");
|
||||
});
|
148
devtools/client/sourceeditor/codemirror/mode/jsx/jsx.js
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"))
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript"], mod)
|
||||
else // Plain browser env
|
||||
mod(CodeMirror)
|
||||
})(function(CodeMirror) {
|
||||
"use strict"
|
||||
|
||||
// Depth means the amount of open braces in JS context, in XML
|
||||
// context 0 means not in tag, 1 means in tag, and 2 means in tag
|
||||
// and js block comment.
|
||||
function Context(state, mode, depth, prev) {
|
||||
this.state = state; this.mode = mode; this.depth = depth; this.prev = prev
|
||||
}
|
||||
|
||||
function copyContext(context) {
|
||||
return new Context(CodeMirror.copyState(context.mode, context.state),
|
||||
context.mode,
|
||||
context.depth,
|
||||
context.prev && copyContext(context.prev))
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("jsx", function(config, modeConfig) {
|
||||
var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
|
||||
var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
|
||||
|
||||
function flatXMLIndent(state) {
|
||||
var tagName = state.tagName
|
||||
state.tagName = null
|
||||
var result = xmlMode.indent(state, "")
|
||||
state.tagName = tagName
|
||||
return result
|
||||
}
|
||||
|
||||
function token(stream, state) {
|
||||
if (state.context.mode == xmlMode)
|
||||
return xmlToken(stream, state, state.context)
|
||||
else
|
||||
return jsToken(stream, state, state.context)
|
||||
}
|
||||
|
||||
function xmlToken(stream, state, cx) {
|
||||
if (cx.depth == 2) { // Inside a JS /* */ comment
|
||||
if (stream.match(/^.*?\*\//)) cx.depth = 1
|
||||
else stream.skipToEnd()
|
||||
return "comment"
|
||||
}
|
||||
|
||||
if (stream.peek() == "{") {
|
||||
xmlMode.skipAttribute(cx.state)
|
||||
|
||||
var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context
|
||||
// If JS starts on same line as tag
|
||||
if (xmlContext && stream.match(/^[^>]*>\s*$/, false)) {
|
||||
while (xmlContext.prev && !xmlContext.startOfLine)
|
||||
xmlContext = xmlContext.prev
|
||||
// If tag starts the line, use XML indentation level
|
||||
if (xmlContext.startOfLine) indent -= config.indentUnit
|
||||
// Else use JS indentation level
|
||||
else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented
|
||||
// Else if inside of tag
|
||||
} else if (cx.depth == 1) {
|
||||
indent += config.indentUnit
|
||||
}
|
||||
|
||||
state.context = new Context(CodeMirror.startState(jsMode, indent),
|
||||
jsMode, 0, state.context)
|
||||
return null
|
||||
}
|
||||
|
||||
if (cx.depth == 1) { // Inside of tag
|
||||
if (stream.peek() == "<") { // Tag inside of tag
|
||||
xmlMode.skipAttribute(cx.state)
|
||||
state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)),
|
||||
xmlMode, 0, state.context)
|
||||
return null
|
||||
} else if (stream.match("//")) {
|
||||
stream.skipToEnd()
|
||||
return "comment"
|
||||
} else if (stream.match("/*")) {
|
||||
cx.depth = 2
|
||||
return token(stream, state)
|
||||
}
|
||||
}
|
||||
|
||||
var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop
|
||||
if (/\btag\b/.test(style)) {
|
||||
if (/>$/.test(cur)) {
|
||||
if (cx.state.context) cx.depth = 0
|
||||
else state.context = state.context.prev
|
||||
} else if (/^</.test(cur)) {
|
||||
cx.depth = 1
|
||||
}
|
||||
} else if (!style && (stop = cur.indexOf("{")) > -1) {
|
||||
stream.backUp(cur.length - stop)
|
||||
}
|
||||
return style
|
||||
}
|
||||
|
||||
function jsToken(stream, state, cx) {
|
||||
if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
|
||||
jsMode.skipExpression(cx.state)
|
||||
state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "")),
|
||||
xmlMode, 0, state.context)
|
||||
return null
|
||||
}
|
||||
|
||||
var style = jsMode.token(stream, cx.state)
|
||||
if (!style && cx.depth != null) {
|
||||
var cur = stream.current()
|
||||
if (cur == "{") {
|
||||
cx.depth++
|
||||
} else if (cur == "}") {
|
||||
if (--cx.depth == 0) state.context = state.context.prev
|
||||
}
|
||||
}
|
||||
return style
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {context: new Context(CodeMirror.startState(jsMode), jsMode)}
|
||||
},
|
||||
|
||||
copyState: function(state) {
|
||||
return {context: copyContext(state.context)}
|
||||
},
|
||||
|
||||
token: token,
|
||||
|
||||
indent: function(state, textAfter, fullLine) {
|
||||
return state.context.mode.indent(state.context.state, textAfter, fullLine)
|
||||
},
|
||||
|
||||
innerMode: function(state) {
|
||||
return state.context
|
||||
}
|
||||
}
|
||||
}, "xml", "javascript")
|
||||
|
||||
CodeMirror.defineMIME("text/jsx", "jsx")
|
||||
CodeMirror.defineMIME("text/typescript-jsx", {name: "jsx", base: {name: "javascript", typescript: true}})
|
||||
});
|
@ -17,6 +17,9 @@ module.exports = [{
|
||||
"./codemirror/mode/xml/xml.js",
|
||||
"./codemirror/mode/css/css.js",
|
||||
"./codemirror/mode/htmlmixed/htmlmixed.js",
|
||||
"./codemirror/mode/jsx/jsx.js",
|
||||
"./codemirror/mode/coffeescript/coffeescript.js",
|
||||
"./codemirror/mode/elm/elm.js",
|
||||
"./codemirror/mode/clike/clike.js",
|
||||
"./codemirror/mode/wasm/wasm.js",
|
||||
"./codemirror/addon/selection/active-line.js",
|
||||
|
@ -208,11 +208,11 @@ body {
|
||||
}
|
||||
|
||||
.cm-s-mozilla.CodeMirror-focused .CodeMirror-selected { /* selected text (focused) */
|
||||
background: rgb(185, 215, 253);
|
||||
background: rgb(77, 86, 103);
|
||||
}
|
||||
|
||||
.cm-s-mozilla .CodeMirror-selected { /* selected text (unfocused) */
|
||||
background: rgb(176, 176, 176);
|
||||
background: rgb(77, 86, 103);
|
||||
}
|
||||
|
||||
.cm-s-mozilla .CodeMirror-activeline-background { /* selected color with alpha */
|
||||
|
@ -1,104 +0,0 @@
|
||||
/* -*- 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/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* global process */
|
||||
|
||||
/*
|
||||
Update Tools is responsible for synking projects in github and mc
|
||||
|
||||
1. checking if assets have changed
|
||||
2. updating assets in m-c
|
||||
|
||||
### Check for changes
|
||||
|
||||
```
|
||||
node update-tools.js --check
|
||||
```
|
||||
|
||||
### Update Assets
|
||||
|
||||
```
|
||||
node update-tools.js --update
|
||||
```
|
||||
*/
|
||||
|
||||
const ps = require("child_process");
|
||||
const fs = require("fs");
|
||||
const { dirname } = require("path");
|
||||
var dircompare = require("dir-compare");
|
||||
|
||||
/*eslint-disable */
|
||||
const paths = [
|
||||
"./node_modules/debugger.html/assets/build/debugger.js ./debugger/new/debugger.js",
|
||||
"./node_modules/debugger.html/assets/build/source-map-worker.js ./debugger/new/source-map-worker.js",
|
||||
"./node_modules/debugger.html/assets/build/pretty-print-worker.js ./debugger/new/pretty-print-worker.js",
|
||||
"./node_modules/debugger.html/assets/build/debugger.css ./debugger/new/debugger.css",
|
||||
"./node_modules/debugger.html/assets/build/debugger.properties ./locales/en-US/debugger.properties",
|
||||
"./node_modules/debugger.html/assets/build/codemirror-mozilla.css ./sourceeditor/codemirror/mozilla.css",
|
||||
];
|
||||
|
||||
const dirs = [
|
||||
"./node_modules/debugger.html/assets/build/mochitest ./debugger/new/test/mochitest"
|
||||
];
|
||||
/*eslint-enable */
|
||||
|
||||
function isDirectory(path) {
|
||||
return fs.statSync(path).isDirectory();
|
||||
}
|
||||
|
||||
function checkFile(path) {
|
||||
const result = ps.spawnSync(`diff`, path.split(" "), {
|
||||
encoding: "utf8"
|
||||
});
|
||||
|
||||
const stdout = result.output[1].trim();
|
||||
return stdout.length > 0;
|
||||
}
|
||||
|
||||
function copyFile(path) {
|
||||
const [ghPath, mcFile] = path.split(" ");
|
||||
const destPath = isDirectory(mcFile) ? dirname(mcFile) : mcFile;
|
||||
ps.execSync(`cp -r ${ghPath} ${destPath}`);
|
||||
}
|
||||
|
||||
function checkAssets() {
|
||||
paths.forEach(path => {
|
||||
if (checkFile(path)) {
|
||||
console.log(`Changed: diff: ${path}`);
|
||||
}
|
||||
});
|
||||
|
||||
dirs.forEach(dir => {
|
||||
const filesChanged = checkDir(dir);
|
||||
if (filesChanged) {
|
||||
filesChanged.forEach(file => {
|
||||
const { name1, path1, name2, path2 } = file;
|
||||
console.log(`Changed: diff ${path1}/${name1} ${path2}/${name2}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkDir(path) {
|
||||
const [ghDir, mcDir] = path.split(" ");
|
||||
const res = dircompare.compareSync(ghDir, mcDir, { compareSize: true });
|
||||
|
||||
return res.diffSet.filter(entry => entry.state != "equal");
|
||||
}
|
||||
|
||||
function copyAssets(files) {
|
||||
paths.forEach(copyFile);
|
||||
dirs.forEach(copyFile);
|
||||
}
|
||||
|
||||
if (process.argv.includes("--check")) {
|
||||
checkAssets();
|
||||
}
|
||||
|
||||
if (process.argv.includes("--update")) {
|
||||
copyAssets();
|
||||
}
|
@ -12782,7 +12782,7 @@ nsAutoSyncOperation::~nsAutoSyncOperation()
|
||||
}
|
||||
|
||||
gfxUserFontSet*
|
||||
nsIDocument::GetUserFontSet()
|
||||
nsIDocument::GetUserFontSet(bool aFlushUserFontSet)
|
||||
{
|
||||
// We want to initialize the user font set lazily the first time the
|
||||
// user asks for it, rather than building it too early and forcing
|
||||
@ -12797,7 +12797,7 @@ nsIDocument::GetUserFontSet()
|
||||
// Set mGetUserFontSetCalled up front, so that FlushUserFontSet will actually
|
||||
// flush.
|
||||
mGetUserFontSetCalled = true;
|
||||
if (mFontFaceSetDirty) {
|
||||
if (mFontFaceSetDirty && aFlushUserFontSet) {
|
||||
// If this assertion fails, and there have actually been changes to
|
||||
// @font-face rules, then we will call StyleChangeReflow in
|
||||
// FlushUserFontSet. If we're in the middle of reflow,
|
||||
|
@ -8015,24 +8015,6 @@ nsGlobalWindow::MozScrollSnap()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::MozRequestOverfill(OverfillCallback& aCallback,
|
||||
mozilla::ErrorResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
nsIWidget* widget = nsContentUtils::WidgetForDocument(mDoc);
|
||||
if (widget) {
|
||||
mozilla::layers::LayerManager* manager = widget->GetLayerManager();
|
||||
if (manager) {
|
||||
manager->RequestOverfill(&aCallback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aError.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::ClearTimeout(int32_t aHandle)
|
||||
{
|
||||
|
@ -1072,7 +1072,6 @@ public:
|
||||
{
|
||||
return GetScrollY(aError);
|
||||
}
|
||||
void MozRequestOverfill(mozilla::dom::OverfillCallback& aCallback, mozilla::ErrorResult& aError);
|
||||
void GetScreenX(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
@ -2816,7 +2816,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
gfxUserFontSet* GetUserFontSet();
|
||||
gfxUserFontSet* GetUserFontSet(bool aFlushUserFontSet = true);
|
||||
void FlushUserFontSet();
|
||||
void RebuildUserFontSet(); // asynchronously
|
||||
mozilla::dom::FontFaceSet* GetFonts() { return mFontFaceSet; }
|
||||
|
@ -20,7 +20,8 @@ NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
|
||||
WidgetEvent* aEvent,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests,
|
||||
uint64_t aTransactionId)
|
||||
uint64_t aTransactionId,
|
||||
DOMHighResTimeStamp aTimeStamp)
|
||||
: Event(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
if (mEvent) {
|
||||
@ -31,6 +32,7 @@ NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
|
||||
}
|
||||
|
||||
mTransactionId = aTransactionId;
|
||||
mTimeStamp = aTimeStamp;
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(NotifyPaintEvent)
|
||||
@ -170,6 +172,12 @@ NotifyPaintEvent::TransactionId()
|
||||
return mTransactionId;
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp
|
||||
NotifyPaintEvent::PaintTimeStamp()
|
||||
{
|
||||
return mTimeStamp;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@ -182,10 +190,11 @@ NS_NewDOMNotifyPaintEvent(EventTarget* aOwner,
|
||||
WidgetEvent* aEvent,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests,
|
||||
uint64_t aTransactionId)
|
||||
uint64_t aTransactionId,
|
||||
DOMHighResTimeStamp aTimeStamp)
|
||||
{
|
||||
RefPtr<NotifyPaintEvent> it =
|
||||
new NotifyPaintEvent(aOwner, aPresContext, aEvent, aEventMessage,
|
||||
aInvalidateRequests, aTransactionId);
|
||||
aInvalidateRequests, aTransactionId, aTimeStamp);
|
||||
return it.forget();
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ public:
|
||||
WidgetEvent* aEvent,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests,
|
||||
uint64_t aTransactionId);
|
||||
uint64_t aTransactionId,
|
||||
DOMHighResTimeStamp aTimeStamp);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
@ -58,6 +59,8 @@ public:
|
||||
|
||||
uint64_t TransactionId();
|
||||
|
||||
DOMHighResTimeStamp PaintTimeStamp();
|
||||
|
||||
protected:
|
||||
~NotifyPaintEvent() {}
|
||||
|
||||
@ -66,6 +69,7 @@ private:
|
||||
|
||||
nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests;
|
||||
uint64_t mTransactionId;
|
||||
DOMHighResTimeStamp mTimeStamp;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
@ -80,6 +84,7 @@ NS_NewDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
mozilla::eVoidEvent,
|
||||
nsInvalidateRequestList* aInvalidateRequests =
|
||||
nullptr,
|
||||
uint64_t aTransactionId = 0);
|
||||
uint64_t aTransactionId = 0,
|
||||
DOMHighResTimeStamp aTimeStamp = 0);
|
||||
|
||||
#endif // mozilla_dom_NotifyPaintEvent_h_
|
||||
|
@ -170,7 +170,10 @@ FlyWebPublishedServerImpl::FlyWebPublishedServerImpl(nsPIDOMWindowInner* aOwner,
|
||||
const nsAString& aName,
|
||||
const FlyWebPublishOptions& aOptions)
|
||||
: FlyWebPublishedServer(aOwner, aName, aOptions)
|
||||
, mHttpServer(new HttpServer(aOwner->GetDocGroup()->AbstractMainThreadFor(TaskCategory::Other)))
|
||||
, mHttpServer(
|
||||
new HttpServer(aOwner ?
|
||||
aOwner->GetDocGroup()->AbstractMainThreadFor(TaskCategory::Other) :
|
||||
AbstractThread::MainThread()))
|
||||
{
|
||||
LOG_I("FlyWebPublishedServerImpl::FlyWebPublishedServerImpl(%p)", this);
|
||||
}
|
||||
|
@ -15,4 +15,6 @@ interface NotifyPaintEvent : Event
|
||||
readonly attribute PaintRequestList paintRequests;
|
||||
|
||||
readonly attribute unsigned long long transactionId;
|
||||
|
||||
readonly attribute DOMHighResTimeStamp paintTimeStamp;
|
||||
};
|
||||
|
@ -207,17 +207,6 @@ partial interface Window {
|
||||
[Throws, NeedsCallerType] attribute any outerHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Special function that gets the fill ratio from the compositor used for testing
|
||||
* and is an indicator that we're layerizing correctly.
|
||||
* This function will call the given callback current fill ratio for a
|
||||
* composited frame. We don't guarantee which frame fill ratios will be returned.
|
||||
*/
|
||||
partial interface Window {
|
||||
[ChromeOnly, Throws] void mozRequestOverfill(OverfillCallback callback);
|
||||
};
|
||||
callback OverfillCallback = void (unsigned long overfill);
|
||||
|
||||
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
|
||||
partial interface Window {
|
||||
[Throws] long requestAnimationFrame(FrameRequestCallback callback);
|
||||
|
@ -1466,7 +1466,8 @@ cairo_cff_font_write_cid_fontdict (cairo_cff_font_t *font)
|
||||
{
|
||||
unsigned int i;
|
||||
cairo_int_status_t status;
|
||||
uint32_t *offset_array;
|
||||
unsigned int offset_array;
|
||||
uint32_t *offset_array_ptr;
|
||||
int offset_base;
|
||||
uint16_t count;
|
||||
uint8_t offset_size = 4;
|
||||
@ -1479,19 +1480,25 @@ cairo_cff_font_write_cid_fontdict (cairo_cff_font_t *font)
|
||||
status = _cairo_array_append (&font->output, &offset_size);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
|
||||
offset_array = _cairo_array_num_elements (&font->output);
|
||||
status = _cairo_array_allocate (&font->output,
|
||||
(font->num_subset_fontdicts + 1)*offset_size,
|
||||
(void **) &offset_array);
|
||||
(void **) &offset_array_ptr);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
offset_base = _cairo_array_num_elements (&font->output) - 1;
|
||||
*offset_array++ = cpu_to_be32(1);
|
||||
*offset_array_ptr = cpu_to_be32(1);
|
||||
offset_array += sizeof(uint32_t);
|
||||
for (i = 0; i < font->num_subset_fontdicts; i++) {
|
||||
status = cff_dict_write (font->fd_dict[font->fd_subset_map[i]],
|
||||
&font->output);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
*offset_array++ = cpu_to_be32(_cairo_array_num_elements (&font->output) - offset_base);
|
||||
|
||||
offset_array_ptr = (uint32_t *) _cairo_array_index (&font->output, offset_array);
|
||||
*offset_array_ptr = cpu_to_be32(_cairo_array_num_elements (&font->output) - offset_base);
|
||||
offset_array += sizeof(uint32_t);
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
@ -70,10 +70,6 @@ namespace gfx {
|
||||
class DrawTarget;
|
||||
} // namespace gfx
|
||||
|
||||
namespace dom {
|
||||
class OverfillCallback;
|
||||
} // namespace dom
|
||||
|
||||
namespace layers {
|
||||
|
||||
class Animation;
|
||||
@ -642,8 +638,6 @@ public:
|
||||
|
||||
bool IsInTransaction() const { return mInTransaction; }
|
||||
virtual void GetFrameUniformity(FrameUniformityData* aOutData) { }
|
||||
virtual bool RequestOverfill(mozilla::dom::OverfillCallback* aCallback) { return true; }
|
||||
virtual void RunOverfillCallback(const uint32_t aOverfill) { }
|
||||
|
||||
virtual void SetRegionToClear(const nsIntRegion& aRegion)
|
||||
{
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "nsTArray.h" // for AutoTArray
|
||||
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
|
||||
#include "TiledLayerBuffer.h"
|
||||
#include "mozilla/dom/WindowBinding.h" // for Overfill Callback
|
||||
#include "FrameLayerBuilder.h" // for FrameLayerbuilder
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
@ -545,35 +544,6 @@ ClientLayerManager::GetFrameUniformity(FrameUniformityData* aOutData)
|
||||
return LayerManager::GetFrameUniformity(aOutData);
|
||||
}
|
||||
|
||||
bool
|
||||
ClientLayerManager::RequestOverfill(mozilla::dom::OverfillCallback* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(aCallback != nullptr);
|
||||
MOZ_ASSERT(HasShadowManager(), "Request Overfill only supported on b2g for now");
|
||||
|
||||
if (HasShadowManager()) {
|
||||
CompositorBridgeChild* child = GetRemoteRenderer();
|
||||
NS_ASSERTION(child, "Could not get CompositorBridgeChild");
|
||||
|
||||
child->AddOverfillObserver(this);
|
||||
child->SendRequestOverfill();
|
||||
mOverfillCallbacks.AppendElement(aCallback);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::RunOverfillCallback(const uint32_t aOverfill)
|
||||
{
|
||||
for (size_t i = 0; i < mOverfillCallbacks.Length(); i++) {
|
||||
ErrorResult error;
|
||||
mOverfillCallbacks[i]->Call(aOverfill, error);
|
||||
}
|
||||
|
||||
mOverfillCallbacks.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::MakeSnapshotIfRequired()
|
||||
{
|
||||
|
@ -174,8 +174,6 @@ public:
|
||||
|
||||
virtual void Composite() override;
|
||||
virtual void GetFrameUniformity(FrameUniformityData* aFrameUniformityData) override;
|
||||
virtual bool RequestOverfill(mozilla::dom::OverfillCallback* aCallback) override;
|
||||
virtual void RunOverfillCallback(const uint32_t aOverfill) override;
|
||||
|
||||
void DidComposite(uint64_t aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
@ -336,7 +334,6 @@ private:
|
||||
APZTestData mApzTestData;
|
||||
|
||||
RefPtr<ShadowLayerForwarder> mForwarder;
|
||||
AutoTArray<dom::OverfillCallback*,0> mOverfillCallbacks;
|
||||
mozilla::TimeStamp mTransactionStart;
|
||||
|
||||
nsTArray<DidCompositeObserver*> mDidCompositeObservers;
|
||||
|
@ -585,23 +585,6 @@ CompositorBridgeChild::RecvDidComposite(const uint64_t& aId, const uint64_t& aTr
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CompositorBridgeChild::RecvOverfill(const uint32_t &aOverfill)
|
||||
{
|
||||
for (size_t i = 0; i < mOverfillObservers.Length(); i++) {
|
||||
mOverfillObservers[i]->RunOverfillCallback(aOverfill);
|
||||
}
|
||||
mOverfillObservers.Clear();
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeChild::AddOverfillObserver(ClientLayerManager* aLayerManager)
|
||||
{
|
||||
MOZ_ASSERT(aLayerManager);
|
||||
mOverfillObservers.AppendElement(aLayerManager);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CompositorBridgeChild::RecvClearCachedResources(const uint64_t& aId)
|
||||
{
|
||||
|
@ -93,8 +93,6 @@ public:
|
||||
// process). This may only be called on the main thread.
|
||||
static bool CompositorIsInGPUProcess();
|
||||
|
||||
void AddOverfillObserver(ClientLayerManager* aLayerManager);
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvClearCachedResources(const uint64_t& id) override;
|
||||
|
||||
@ -111,9 +109,6 @@ public:
|
||||
const TextureFactoryIdentifier& aNewIdentifier,
|
||||
const uint64_t& aSequenceNumber) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvOverfill(const uint32_t &aOverfill) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aVisibleRegion,
|
||||
@ -308,9 +303,6 @@ private:
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(CompositorBridgeChild);
|
||||
|
||||
// When we receive overfill numbers, notify these client layer managers
|
||||
AutoTArray<ClientLayerManager*,0> mOverfillObservers;
|
||||
|
||||
// True until the beginning of the two-step shutdown sequence of this actor.
|
||||
bool mCanSend;
|
||||
|
||||
|
@ -1273,14 +1273,6 @@ CompositorBridgeParent::RecvGetFrameUniformity(FrameUniformityData* aOutData)
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CompositorBridgeParent::RecvRequestOverfill()
|
||||
{
|
||||
uint32_t overfillRatio = mCompositor->GetFillRatio();
|
||||
Unused << SendOverfill(overfillRatio);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::FlushApzRepaints(const LayerTransactionParent* aLayerTree)
|
||||
{
|
||||
|
@ -177,7 +177,6 @@ public:
|
||||
bool* aResult,
|
||||
TextureFactoryIdentifier* aOutIdentifier) override;
|
||||
virtual mozilla::ipc::IPCResult RecvGetFrameUniformity(FrameUniformityData* aOutData) override;
|
||||
virtual mozilla::ipc::IPCResult RecvRequestOverfill() override;
|
||||
virtual mozilla::ipc::IPCResult RecvWillClose() override;
|
||||
virtual mozilla::ipc::IPCResult RecvPause() override;
|
||||
virtual mozilla::ipc::IPCResult RecvResume() override;
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
bool* aResult,
|
||||
TextureFactoryIdentifier* aOutIdentifier) override
|
||||
{ return IPC_FAIL_NO_REASON(this); }
|
||||
virtual mozilla::ipc::IPCResult RecvRequestOverfill() override { return IPC_OK(); }
|
||||
virtual mozilla::ipc::IPCResult RecvWillClose() override { return IPC_OK(); }
|
||||
virtual mozilla::ipc::IPCResult RecvPause() override { return IPC_OK(); }
|
||||
virtual mozilla::ipc::IPCResult RecvResume() override { return IPC_OK(); }
|
||||
|
@ -95,9 +95,6 @@ child:
|
||||
async DidComposite(uint64_t id, uint64_t transactionId,
|
||||
TimeStamp compositeStart, TimeStamp compositeEnd);
|
||||
|
||||
// The parent sends the child the requested fill ratio numbers.
|
||||
async Overfill(uint32_t aOverfill);
|
||||
|
||||
/**
|
||||
* Parent informs the child that the graphics objects are ready for
|
||||
* compositing. This usually means that the graphics objects (textures
|
||||
@ -164,9 +161,6 @@ parent:
|
||||
// request layers against an old compositor.
|
||||
async AcknowledgeCompositorUpdate(uint64_t aLayersId, uint64_t aSeqNo);
|
||||
|
||||
// Child sends the parent a request for fill ratio numbers.
|
||||
async RequestOverfill();
|
||||
|
||||
// Child requests frame uniformity measurements
|
||||
sync GetFrameUniformity() returns (FrameUniformityData data);
|
||||
|
||||
|
@ -852,7 +852,7 @@ struct JSClass {
|
||||
// application.
|
||||
#define JSCLASS_GLOBAL_APPLICATION_SLOTS 5
|
||||
#define JSCLASS_GLOBAL_SLOT_COUNT \
|
||||
(JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 2 + 39)
|
||||
(JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 2 + 41)
|
||||
#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \
|
||||
(JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n)))
|
||||
#define JSCLASS_GLOBAL_FLAGS \
|
||||
|
@ -104,7 +104,7 @@ function Date_toLocaleString() {
|
||||
}
|
||||
|
||||
// Step 7.
|
||||
return intl_FormatDateTime(dateTimeFormat, x, false);
|
||||
return intl_FormatDateTime(dateTimeFormat, x, /* formatToParts = */ false);
|
||||
}
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ function Date_toLocaleDateString() {
|
||||
}
|
||||
|
||||
// Step 7.
|
||||
return intl_FormatDateTime(dateTimeFormat, x, false);
|
||||
return intl_FormatDateTime(dateTimeFormat, x, /* formatToParts = */ false);
|
||||
}
|
||||
|
||||
|
||||
@ -170,5 +170,5 @@ function Date_toLocaleTimeString() {
|
||||
}
|
||||
|
||||
// Step 7.
|
||||
return intl_FormatDateTime(dateTimeFormat, x, false);
|
||||
return intl_FormatDateTime(dateTimeFormat, x, /* formatToParts = */ false);
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "vm/DateTime.h"
|
||||
#include "vm/GlobalObject.h"
|
||||
#include "vm/Interpreter.h"
|
||||
#include "vm/SelfHosting.h"
|
||||
#include "vm/Stack.h"
|
||||
#include "vm/StringBuffer.h"
|
||||
#include "vm/Unicode.h"
|
||||
@ -797,12 +798,6 @@ static bool
|
||||
IntlInitialize(JSContext* cx, HandleObject obj, Handle<PropertyName*> initializer,
|
||||
HandleValue locales, HandleValue options)
|
||||
{
|
||||
RootedValue initializerValue(cx);
|
||||
if (!GlobalObject::getIntrinsicValue(cx, cx->global(), initializer, &initializerValue))
|
||||
return false;
|
||||
MOZ_ASSERT(initializerValue.isObject());
|
||||
MOZ_ASSERT(initializerValue.toObject().is<JSFunction>());
|
||||
|
||||
FixedInvokeArgs<3> args(cx);
|
||||
|
||||
args[0].setObject(*obj);
|
||||
@ -811,7 +806,32 @@ IntlInitialize(JSContext* cx, HandleObject obj, Handle<PropertyName*> initialize
|
||||
|
||||
RootedValue thisv(cx, NullValue());
|
||||
RootedValue ignored(cx);
|
||||
return js::Call(cx, initializerValue, thisv, args, &ignored);
|
||||
if (!js::CallSelfHostedFunction(cx, initializer, thisv, args, &ignored))
|
||||
return false;
|
||||
|
||||
MOZ_ASSERT(ignored.isUndefined(),
|
||||
"Unexpected return value from non-legacy Intl object initializer");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
LegacyIntlInitialize(JSContext* cx, HandleObject obj, Handle<PropertyName*> initializer,
|
||||
HandleValue thisValue, HandleValue locales, HandleValue options,
|
||||
MutableHandleValue result)
|
||||
{
|
||||
FixedInvokeArgs<4> args(cx);
|
||||
|
||||
args[0].setObject(*obj);
|
||||
args[1].set(thisValue);
|
||||
args[2].set(locales);
|
||||
args[3].set(options);
|
||||
|
||||
RootedValue thisv(cx, NullValue());
|
||||
if (!js::CallSelfHostedFunction(cx, initializer, thisv, args, result))
|
||||
return false;
|
||||
|
||||
MOZ_ASSERT(result.isObject(), "Legacy Intl object initializer must return an object");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -871,21 +891,12 @@ intl_availableLocales(JSContext* cx, CountAvailable countAvailable,
|
||||
static JSObject*
|
||||
GetInternals(JSContext* cx, HandleObject obj)
|
||||
{
|
||||
RootedValue getInternalsValue(cx);
|
||||
if (!GlobalObject::getIntrinsicValue(cx, cx->global(), cx->names().getInternals,
|
||||
&getInternalsValue))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(getInternalsValue.isObject());
|
||||
MOZ_ASSERT(getInternalsValue.toObject().is<JSFunction>());
|
||||
|
||||
FixedInvokeArgs<1> args(cx);
|
||||
|
||||
args[0].setObject(*obj);
|
||||
|
||||
RootedValue v(cx, NullValue());
|
||||
if (!js::Call(cx, getInternalsValue, v, args, &v))
|
||||
if (!js::CallSelfHostedFunction(cx, cx->names().getInternals, v, args, &v))
|
||||
return nullptr;
|
||||
|
||||
return &v.toObject();
|
||||
@ -935,14 +946,10 @@ class ScopedICUObject
|
||||
// The inline capacity we use for the char16_t Vectors.
|
||||
static const size_t INITIAL_CHAR_BUFFER_SIZE = 32;
|
||||
|
||||
|
||||
/******************** Collator ********************/
|
||||
|
||||
static void collator_finalize(FreeOp* fop, JSObject* obj);
|
||||
|
||||
static const uint32_t UCOLLATOR_SLOT = 0;
|
||||
static const uint32_t COLLATOR_SLOTS_COUNT = 1;
|
||||
|
||||
static const ClassOps CollatorClassOps = {
|
||||
const ClassOps CollatorObject::classOps_ = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
@ -950,14 +957,14 @@ static const ClassOps CollatorClassOps = {
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
collator_finalize
|
||||
CollatorObject::finalize
|
||||
};
|
||||
|
||||
static const Class CollatorClass = {
|
||||
const Class CollatorObject::class_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_RESERVED_SLOTS(COLLATOR_SLOTS_COUNT) |
|
||||
JSCLASS_HAS_RESERVED_SLOTS(CollatorObject::SLOT_COUNT) |
|
||||
JSCLASS_FOREGROUND_FINALIZE,
|
||||
&CollatorClassOps
|
||||
&CollatorObject::classOps_
|
||||
};
|
||||
|
||||
#if JS_HAS_TOSOURCE
|
||||
@ -995,64 +1002,36 @@ static const JSPropertySpec collator_properties[] = {
|
||||
* ES2017 Intl draft rev 94045d234762ad107a3d09bb6f7381a65f1a2f9b
|
||||
*/
|
||||
static bool
|
||||
Collator(JSContext* cx, const CallArgs& args, bool construct)
|
||||
Collator(JSContext* cx, const CallArgs& args)
|
||||
{
|
||||
RootedObject obj(cx);
|
||||
// Step 1 (Handled by OrdinaryCreateFromConstructor fallback code).
|
||||
|
||||
// We're following ECMA-402 1st Edition when Collator is called because of
|
||||
// backward compatibility issues.
|
||||
// See https://github.com/tc39/ecma402/issues/57
|
||||
if (!construct) {
|
||||
// ES Intl 1st ed., 10.1.2.1 step 3
|
||||
JSObject* intl = GlobalObject::getOrCreateIntlObject(cx, cx->global());
|
||||
if (!intl)
|
||||
// Steps 2-5 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
|
||||
RootedObject proto(cx);
|
||||
if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
|
||||
return false;
|
||||
|
||||
if (!proto) {
|
||||
proto = GlobalObject::getOrCreateCollatorPrototype(cx, cx->global());
|
||||
if (!proto)
|
||||
return false;
|
||||
RootedValue self(cx, args.thisv());
|
||||
if (!self.isUndefined() && (!self.isObject() || self.toObject() != *intl)) {
|
||||
// ES Intl 1st ed., 10.1.2.1 step 4
|
||||
obj = ToObject(cx, self);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
// ES Intl 1st ed., 10.1.2.1 step 5
|
||||
bool extensible;
|
||||
if (!IsExtensible(cx, obj, &extensible))
|
||||
return false;
|
||||
if (!extensible)
|
||||
return Throw(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE);
|
||||
} else {
|
||||
// ES Intl 1st ed., 10.1.2.1 step 3.a
|
||||
construct = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (construct) {
|
||||
// Steps 2-5 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
|
||||
RootedObject proto(cx);
|
||||
if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
|
||||
return false;
|
||||
Rooted<CollatorObject*> collator(cx, NewObjectWithGivenProto<CollatorObject>(cx, proto));
|
||||
if (!collator)
|
||||
return false;
|
||||
|
||||
if (!proto) {
|
||||
proto = GlobalObject::getOrCreateCollatorPrototype(cx, cx->global());
|
||||
if (!proto)
|
||||
return false;
|
||||
}
|
||||
|
||||
obj = NewObjectWithGivenProto(cx, &CollatorClass, proto);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
obj->as<NativeObject>().setReservedSlot(UCOLLATOR_SLOT, PrivateValue(nullptr));
|
||||
}
|
||||
collator->setReservedSlot(CollatorObject::INTERNALS_SLOT, NullValue());
|
||||
collator->setReservedSlot(CollatorObject::UCOLLATOR_SLOT, PrivateValue(nullptr));
|
||||
|
||||
RootedValue locales(cx, args.get(0));
|
||||
RootedValue options(cx, args.get(1));
|
||||
|
||||
// Step 6.
|
||||
if (!IntlInitialize(cx, obj, cx->names().InitializeCollator, locales, options))
|
||||
if (!IntlInitialize(cx, collator, cx->names().InitializeCollator, locales, options))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*obj);
|
||||
args.rval().setObject(*collator);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1060,7 +1039,7 @@ static bool
|
||||
Collator(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return Collator(cx, args, args.isConstructing());
|
||||
return Collator(cx, args);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1069,13 +1048,12 @@ js::intl_Collator(JSContext* cx, unsigned argc, Value* vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
MOZ_ASSERT(args.length() == 2);
|
||||
MOZ_ASSERT(!args.isConstructing());
|
||||
// intl_Collator is an intrinsic for self-hosted JavaScript, so it cannot
|
||||
// be used with "new", but it still has to be treated as a constructor.
|
||||
return Collator(cx, args, true);
|
||||
|
||||
return Collator(cx, args);
|
||||
}
|
||||
|
||||
static void
|
||||
collator_finalize(FreeOp* fop, JSObject* obj)
|
||||
void
|
||||
CollatorObject::finalize(FreeOp* fop, JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(fop->onMainThread());
|
||||
|
||||
@ -1083,7 +1061,7 @@ collator_finalize(FreeOp* fop, JSObject* obj)
|
||||
// brokenness in object allocation code. For the moment, hack around it by
|
||||
// explicitly guarding against the possibility of the reserved slot not
|
||||
// containing a private. See bug 949220.
|
||||
const Value& slot = obj->as<NativeObject>().getReservedSlot(UCOLLATOR_SLOT);
|
||||
const Value& slot = obj->as<CollatorObject>().getReservedSlot(CollatorObject::UCOLLATOR_SLOT);
|
||||
if (!slot.isUndefined()) {
|
||||
if (UCollator* coll = static_cast<UCollator*>(slot.toPrivate()))
|
||||
ucol_close(coll);
|
||||
@ -1098,10 +1076,12 @@ CreateCollatorPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObject*>
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
RootedNativeObject proto(cx, GlobalObject::createBlankPrototype(cx, global, &CollatorClass));
|
||||
Rooted<CollatorObject*> proto(cx);
|
||||
proto = GlobalObject::createBlankPrototype<CollatorObject>(cx, global);
|
||||
if (!proto)
|
||||
return nullptr;
|
||||
proto->setReservedSlot(UCOLLATOR_SLOT, PrivateValue(nullptr));
|
||||
proto->setReservedSlot(CollatorObject::INTERNALS_SLOT, NullValue());
|
||||
proto->setReservedSlot(CollatorObject::UCOLLATOR_SLOT, PrivateValue(nullptr));
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||
return nullptr;
|
||||
@ -1218,7 +1198,7 @@ js::intl_availableCollations(JSContext* cx, unsigned argc, Value* vp)
|
||||
* of the given Collator.
|
||||
*/
|
||||
static UCollator*
|
||||
NewUCollator(JSContext* cx, HandleObject collator)
|
||||
NewUCollator(JSContext* cx, Handle<CollatorObject*> collator)
|
||||
{
|
||||
RootedValue value(cx);
|
||||
|
||||
@ -1396,54 +1376,29 @@ js::intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp)
|
||||
MOZ_ASSERT(args[1].isString());
|
||||
MOZ_ASSERT(args[2].isString());
|
||||
|
||||
RootedObject collator(cx, &args[0].toObject());
|
||||
Rooted<CollatorObject*> collator(cx, &args[0].toObject().as<CollatorObject>());
|
||||
|
||||
// Obtain a UCollator object, cached if possible.
|
||||
// Obtain a cached UCollator object.
|
||||
// XXX Does this handle Collator instances from other globals correctly?
|
||||
bool isCollatorInstance = collator->getClass() == &CollatorClass;
|
||||
UCollator* coll;
|
||||
if (isCollatorInstance) {
|
||||
void* priv = collator->as<NativeObject>().getReservedSlot(UCOLLATOR_SLOT).toPrivate();
|
||||
coll = static_cast<UCollator*>(priv);
|
||||
if (!coll) {
|
||||
coll = NewUCollator(cx, collator);
|
||||
if (!coll)
|
||||
return false;
|
||||
collator->as<NativeObject>().setReservedSlot(UCOLLATOR_SLOT, PrivateValue(coll));
|
||||
}
|
||||
} else {
|
||||
// There's no good place to cache the ICU collator for an object
|
||||
// that has been initialized as a Collator but is not a Collator
|
||||
// instance. One possibility might be to add a Collator instance as an
|
||||
// internal property to each such object.
|
||||
void* priv = collator->getReservedSlot(CollatorObject::UCOLLATOR_SLOT).toPrivate();
|
||||
UCollator* coll = static_cast<UCollator*>(priv);
|
||||
if (!coll) {
|
||||
coll = NewUCollator(cx, collator);
|
||||
if (!coll)
|
||||
return false;
|
||||
collator->setReservedSlot(CollatorObject::UCOLLATOR_SLOT, PrivateValue(coll));
|
||||
}
|
||||
|
||||
// Use the UCollator to actually compare the strings.
|
||||
RootedString str1(cx, args[1].toString());
|
||||
RootedString str2(cx, args[2].toString());
|
||||
RootedValue result(cx);
|
||||
bool success = intl_CompareStrings(cx, coll, str1, str2, &result);
|
||||
|
||||
if (!isCollatorInstance)
|
||||
ucol_close(coll);
|
||||
if (!success)
|
||||
return false;
|
||||
args.rval().set(result);
|
||||
return true;
|
||||
return intl_CompareStrings(cx, coll, str1, str2, args.rval());
|
||||
}
|
||||
|
||||
|
||||
/******************** NumberFormat ********************/
|
||||
|
||||
static void numberFormat_finalize(FreeOp* fop, JSObject* obj);
|
||||
|
||||
static const uint32_t UNUMBER_FORMAT_SLOT = 0;
|
||||
static const uint32_t NUMBER_FORMAT_SLOTS_COUNT = 1;
|
||||
|
||||
static const ClassOps NumberFormatClassOps = {
|
||||
const ClassOps NumberFormatObject::classOps_ = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
@ -1451,14 +1406,14 @@ static const ClassOps NumberFormatClassOps = {
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
numberFormat_finalize
|
||||
NumberFormatObject::finalize
|
||||
};
|
||||
|
||||
static const Class NumberFormatClass = {
|
||||
const Class NumberFormatObject::class_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_RESERVED_SLOTS(NUMBER_FORMAT_SLOTS_COUNT) |
|
||||
JSCLASS_HAS_RESERVED_SLOTS(NumberFormatObject::SLOT_COUNT) |
|
||||
JSCLASS_FOREGROUND_FINALIZE,
|
||||
&NumberFormatClassOps
|
||||
&NumberFormatObject::classOps_
|
||||
};
|
||||
|
||||
#if JS_HAS_TOSOURCE
|
||||
@ -1498,63 +1453,34 @@ static const JSPropertySpec numberFormat_properties[] = {
|
||||
static bool
|
||||
NumberFormat(JSContext* cx, const CallArgs& args, bool construct)
|
||||
{
|
||||
RootedObject obj(cx);
|
||||
// Step 1 (Handled by OrdinaryCreateFromConstructor fallback code).
|
||||
|
||||
// We're following ECMA-402 1st Edition when NumberFormat is called
|
||||
// because of backward compatibility issues.
|
||||
// See https://github.com/tc39/ecma402/issues/57
|
||||
if (!construct) {
|
||||
// ES Intl 1st ed., 11.1.2.1 step 3
|
||||
JSObject* intl = GlobalObject::getOrCreateIntlObject(cx, cx->global());
|
||||
if (!intl)
|
||||
// Step 2 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
|
||||
RootedObject proto(cx);
|
||||
if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
|
||||
return false;
|
||||
|
||||
if (!proto) {
|
||||
proto = GlobalObject::getOrCreateNumberFormatPrototype(cx, cx->global());
|
||||
if (!proto)
|
||||
return false;
|
||||
RootedValue self(cx, args.thisv());
|
||||
if (!self.isUndefined() && (!self.isObject() || self.toObject() != *intl)) {
|
||||
// ES Intl 1st ed., 11.1.2.1 step 4
|
||||
obj = ToObject(cx, self);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
// ES Intl 1st ed., 11.1.2.1 step 5
|
||||
bool extensible;
|
||||
if (!IsExtensible(cx, obj, &extensible))
|
||||
return false;
|
||||
if (!extensible)
|
||||
return Throw(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE);
|
||||
} else {
|
||||
// ES Intl 1st ed., 11.1.2.1 step 3.a
|
||||
construct = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (construct) {
|
||||
// Step 2 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
|
||||
RootedObject proto(cx);
|
||||
if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
|
||||
return false;
|
||||
Rooted<NumberFormatObject*> numberFormat(cx);
|
||||
numberFormat = NewObjectWithGivenProto<NumberFormatObject>(cx, proto);
|
||||
if (!numberFormat)
|
||||
return false;
|
||||
|
||||
if (!proto) {
|
||||
proto = GlobalObject::getOrCreateNumberFormatPrototype(cx, cx->global());
|
||||
if (!proto)
|
||||
return false;
|
||||
}
|
||||
|
||||
obj = NewObjectWithGivenProto(cx, &NumberFormatClass, proto);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
obj->as<NativeObject>().setReservedSlot(UNUMBER_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
}
|
||||
numberFormat->setReservedSlot(NumberFormatObject::INTERNALS_SLOT, NullValue());
|
||||
numberFormat->setReservedSlot(NumberFormatObject::UNUMBER_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
|
||||
RootedValue thisValue(cx, construct ? ObjectValue(*numberFormat) : args.thisv());
|
||||
RootedValue locales(cx, args.get(0));
|
||||
RootedValue options(cx, args.get(1));
|
||||
|
||||
// Step 3.
|
||||
if (!IntlInitialize(cx, obj, cx->names().InitializeNumberFormat, locales, options))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*obj);
|
||||
return true;
|
||||
return LegacyIntlInitialize(cx, numberFormat, cx->names().InitializeNumberFormat, thisValue,
|
||||
locales, options, args.rval());
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1576,8 +1502,8 @@ js::intl_NumberFormat(JSContext* cx, unsigned argc, Value* vp)
|
||||
return NumberFormat(cx, args, true);
|
||||
}
|
||||
|
||||
static void
|
||||
numberFormat_finalize(FreeOp* fop, JSObject* obj)
|
||||
void
|
||||
NumberFormatObject::finalize(FreeOp* fop, JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(fop->onMainThread());
|
||||
|
||||
@ -1585,7 +1511,8 @@ numberFormat_finalize(FreeOp* fop, JSObject* obj)
|
||||
// brokenness in object allocation code. For the moment, hack around it by
|
||||
// explicitly guarding against the possibility of the reserved slot not
|
||||
// containing a private. See bug 949220.
|
||||
const Value& slot = obj->as<NativeObject>().getReservedSlot(UNUMBER_FORMAT_SLOT);
|
||||
const Value& slot =
|
||||
obj->as<NumberFormatObject>().getReservedSlot(NumberFormatObject::UNUMBER_FORMAT_SLOT);
|
||||
if (!slot.isUndefined()) {
|
||||
if (UNumberFormat* nf = static_cast<UNumberFormat*>(slot.toPrivate()))
|
||||
unum_close(nf);
|
||||
@ -1593,18 +1520,20 @@ numberFormat_finalize(FreeOp* fop, JSObject* obj)
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreateNumberFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObject*> global)
|
||||
CreateNumberFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObject*> global,
|
||||
MutableHandleObject constructor)
|
||||
{
|
||||
RootedFunction ctor(cx);
|
||||
ctor = GlobalObject::createConstructor(cx, &NumberFormat, cx->names().NumberFormat, 0);
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
RootedNativeObject proto(cx, GlobalObject::createBlankPrototype(cx, global,
|
||||
&NumberFormatClass));
|
||||
RootedNativeObject proto(cx);
|
||||
proto = GlobalObject::createBlankPrototype<NumberFormatObject>(cx, global);
|
||||
if (!proto)
|
||||
return nullptr;
|
||||
proto->setReservedSlot(UNUMBER_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
proto->setReservedSlot(NumberFormatObject::INTERNALS_SLOT, NullValue());
|
||||
proto->setReservedSlot(NumberFormatObject::UNUMBER_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||
return nullptr;
|
||||
@ -1644,17 +1573,20 @@ CreateNumberFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObjec
|
||||
return nullptr;
|
||||
|
||||
// 11.2.1 and 11.3
|
||||
if (!IntlInitialize(cx, proto, cx->names().InitializeNumberFormat, UndefinedHandleValue,
|
||||
options))
|
||||
RootedValue thisOrResult(cx, ObjectValue(*proto));
|
||||
if (!LegacyIntlInitialize(cx, proto, cx->names().InitializeNumberFormat, thisOrResult,
|
||||
UndefinedHandleValue, options, &thisOrResult))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(&thisOrResult.toObject() == proto);
|
||||
|
||||
// 8.1
|
||||
RootedValue ctorValue(cx, ObjectValue(*ctor));
|
||||
if (!DefineProperty(cx, Intl, cx->names().NumberFormat, ctorValue, nullptr, nullptr, 0))
|
||||
return nullptr;
|
||||
|
||||
constructor.set(ctor);
|
||||
return proto;
|
||||
}
|
||||
|
||||
@ -1709,7 +1641,7 @@ js::intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp)
|
||||
* percent types.
|
||||
*/
|
||||
static UNumberFormat*
|
||||
NewUNumberFormatForPluralRules(JSContext* cx, HandleObject pluralRules)
|
||||
NewUNumberFormatForPluralRules(JSContext* cx, Handle<PluralRulesObject*> pluralRules)
|
||||
{
|
||||
RootedObject internals(cx, GetInternals(cx, pluralRules));
|
||||
if (!internals)
|
||||
@ -1783,7 +1715,7 @@ NewUNumberFormatForPluralRules(JSContext* cx, HandleObject pluralRules)
|
||||
* of the given NumberFormat.
|
||||
*/
|
||||
static UNumberFormat*
|
||||
NewUNumberFormat(JSContext* cx, HandleObject numberFormat)
|
||||
NewUNumberFormat(JSContext* cx, Handle<NumberFormatObject*> numberFormat)
|
||||
{
|
||||
RootedValue value(cx);
|
||||
|
||||
@ -2396,65 +2328,36 @@ js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp)
|
||||
MOZ_ASSERT(args[1].isNumber());
|
||||
MOZ_ASSERT(args[2].isBoolean());
|
||||
|
||||
RootedObject numberFormat(cx, &args[0].toObject());
|
||||
Rooted<NumberFormatObject*> numberFormat(cx, &args[0].toObject().as<NumberFormatObject>());
|
||||
|
||||
// Obtain a UNumberFormat object, cached if possible.
|
||||
bool isNumberFormatInstance = numberFormat->getClass() == &NumberFormatClass;
|
||||
UNumberFormat* nf;
|
||||
if (isNumberFormatInstance) {
|
||||
void* priv =
|
||||
numberFormat->as<NativeObject>().getReservedSlot(UNUMBER_FORMAT_SLOT).toPrivate();
|
||||
nf = static_cast<UNumberFormat*>(priv);
|
||||
if (!nf) {
|
||||
nf = NewUNumberFormat(cx, numberFormat);
|
||||
if (!nf)
|
||||
return false;
|
||||
numberFormat->as<NativeObject>().setReservedSlot(UNUMBER_FORMAT_SLOT, PrivateValue(nf));
|
||||
}
|
||||
} else {
|
||||
// There's no good place to cache the ICU number format for an object
|
||||
// that has been initialized as a NumberFormat but is not a
|
||||
// NumberFormat instance. One possibility might be to add a
|
||||
// NumberFormat instance as an internal property to each such object.
|
||||
// Obtain a cached UNumberFormat object.
|
||||
void* priv =
|
||||
numberFormat->getReservedSlot(NumberFormatObject::UNUMBER_FORMAT_SLOT).toPrivate();
|
||||
UNumberFormat* nf = static_cast<UNumberFormat*>(priv);
|
||||
if (!nf) {
|
||||
nf = NewUNumberFormat(cx, numberFormat);
|
||||
if (!nf)
|
||||
return false;
|
||||
numberFormat->setReservedSlot(NumberFormatObject::UNUMBER_FORMAT_SLOT, PrivateValue(nf));
|
||||
}
|
||||
|
||||
// Use the UNumberFormat to actually format the number.
|
||||
double d = args[1].toNumber();
|
||||
RootedValue result(cx);
|
||||
|
||||
bool success;
|
||||
#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
||||
if (args[2].toBoolean()) {
|
||||
success = intl_FormatNumberToParts(cx, nf, d, &result);
|
||||
} else
|
||||
#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
||||
{
|
||||
MOZ_ASSERT(!args[2].toBoolean(),
|
||||
"shouldn't be doing formatToParts without an ICU that "
|
||||
"supports it");
|
||||
success = intl_FormatNumber(cx, nf, d, &result);
|
||||
return intl_FormatNumberToParts(cx, nf, args[1].toNumber(), args.rval());
|
||||
}
|
||||
|
||||
if (!isNumberFormatInstance)
|
||||
unum_close(nf);
|
||||
if (!success)
|
||||
return false;
|
||||
args.rval().set(result);
|
||||
return true;
|
||||
#else
|
||||
MOZ_ASSERT(!args[2].toBoolean(),
|
||||
"shouldn't be doing formatToParts without an ICU that "
|
||||
"supports it");
|
||||
#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
||||
return intl_FormatNumber(cx, nf, args[1].toNumber(), args.rval());
|
||||
}
|
||||
|
||||
|
||||
/******************** DateTimeFormat ********************/
|
||||
|
||||
static void dateTimeFormat_finalize(FreeOp* fop, JSObject* obj);
|
||||
|
||||
static const uint32_t UDATE_FORMAT_SLOT = 0;
|
||||
static const uint32_t DATE_TIME_FORMAT_SLOTS_COUNT = 1;
|
||||
|
||||
static const ClassOps DateTimeFormatClassOps = {
|
||||
const ClassOps DateTimeFormatObject::classOps_ = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
@ -2462,14 +2365,14 @@ static const ClassOps DateTimeFormatClassOps = {
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
dateTimeFormat_finalize
|
||||
DateTimeFormatObject::finalize
|
||||
};
|
||||
|
||||
static const Class DateTimeFormatClass = {
|
||||
const Class DateTimeFormatObject::class_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_RESERVED_SLOTS(DATE_TIME_FORMAT_SLOTS_COUNT) |
|
||||
JSCLASS_HAS_RESERVED_SLOTS(DateTimeFormatObject::SLOT_COUNT) |
|
||||
JSCLASS_FOREGROUND_FINALIZE,
|
||||
&DateTimeFormatClassOps
|
||||
&DateTimeFormatObject::classOps_
|
||||
};
|
||||
|
||||
#if JS_HAS_TOSOURCE
|
||||
@ -2510,63 +2413,35 @@ static const JSPropertySpec dateTimeFormat_properties[] = {
|
||||
static bool
|
||||
DateTimeFormat(JSContext* cx, const CallArgs& args, bool construct)
|
||||
{
|
||||
RootedObject obj(cx);
|
||||
// Step 1 (Handled by OrdinaryCreateFromConstructor fallback code).
|
||||
|
||||
// We're following ECMA-402 1st Edition when DateTimeFormat is called
|
||||
// because of backward compatibility issues.
|
||||
// See https://github.com/tc39/ecma402/issues/57
|
||||
if (!construct) {
|
||||
// ES Intl 1st ed., 12.1.2.1 step 3
|
||||
JSObject* intl = GlobalObject::getOrCreateIntlObject(cx, cx->global());
|
||||
if (!intl)
|
||||
// Step 2 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
|
||||
RootedObject proto(cx);
|
||||
if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
|
||||
return false;
|
||||
|
||||
if (!proto) {
|
||||
proto = GlobalObject::getOrCreateDateTimeFormatPrototype(cx, cx->global());
|
||||
if (!proto)
|
||||
return false;
|
||||
RootedValue self(cx, args.thisv());
|
||||
if (!self.isUndefined() && (!self.isObject() || self.toObject() != *intl)) {
|
||||
// ES Intl 1st ed., 12.1.2.1 step 4
|
||||
obj = ToObject(cx, self);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
// ES Intl 1st ed., 12.1.2.1 step 5
|
||||
bool extensible;
|
||||
if (!IsExtensible(cx, obj, &extensible))
|
||||
return false;
|
||||
if (!extensible)
|
||||
return Throw(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE);
|
||||
} else {
|
||||
// ES Intl 1st ed., 12.1.2.1 step 3.a
|
||||
construct = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (construct) {
|
||||
// Step 2 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
|
||||
RootedObject proto(cx);
|
||||
if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
|
||||
return false;
|
||||
Rooted<DateTimeFormatObject*> dateTimeFormat(cx);
|
||||
dateTimeFormat = NewObjectWithGivenProto<DateTimeFormatObject>(cx, proto);
|
||||
if (!dateTimeFormat)
|
||||
return false;
|
||||
|
||||
if (!proto) {
|
||||
proto = GlobalObject::getOrCreateDateTimeFormatPrototype(cx, cx->global());
|
||||
if (!proto)
|
||||
return false;
|
||||
}
|
||||
|
||||
obj = NewObjectWithGivenProto(cx, &DateTimeFormatClass, proto);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
obj->as<NativeObject>().setReservedSlot(UDATE_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
}
|
||||
dateTimeFormat->setReservedSlot(DateTimeFormatObject::INTERNALS_SLOT, NullValue());
|
||||
dateTimeFormat->setReservedSlot(DateTimeFormatObject::UDATE_FORMAT_SLOT,
|
||||
PrivateValue(nullptr));
|
||||
|
||||
RootedValue thisValue(cx, construct ? ObjectValue(*dateTimeFormat) : args.thisv());
|
||||
RootedValue locales(cx, args.get(0));
|
||||
RootedValue options(cx, args.get(1));
|
||||
|
||||
// Step 3.
|
||||
if (!IntlInitialize(cx, obj, cx->names().InitializeDateTimeFormat, locales, options))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*obj);
|
||||
return true;
|
||||
return LegacyIntlInitialize(cx, dateTimeFormat, cx->names().InitializeDateTimeFormat,
|
||||
thisValue, locales, options, args.rval());
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -2588,8 +2463,8 @@ js::intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp)
|
||||
return DateTimeFormat(cx, args, true);
|
||||
}
|
||||
|
||||
static void
|
||||
dateTimeFormat_finalize(FreeOp* fop, JSObject* obj)
|
||||
void
|
||||
DateTimeFormatObject::finalize(FreeOp* fop, JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(fop->onMainThread());
|
||||
|
||||
@ -2597,7 +2472,8 @@ dateTimeFormat_finalize(FreeOp* fop, JSObject* obj)
|
||||
// brokenness in object allocation code. For the moment, hack around it by
|
||||
// explicitly guarding against the possibility of the reserved slot not
|
||||
// containing a private. See bug 949220.
|
||||
const Value& slot = obj->as<NativeObject>().getReservedSlot(UDATE_FORMAT_SLOT);
|
||||
const Value& slot =
|
||||
obj->as<DateTimeFormatObject>().getReservedSlot(DateTimeFormatObject::UDATE_FORMAT_SLOT);
|
||||
if (!slot.isUndefined()) {
|
||||
if (UDateFormat* df = static_cast<UDateFormat*>(slot.toPrivate()))
|
||||
udat_close(df);
|
||||
@ -2605,18 +2481,20 @@ dateTimeFormat_finalize(FreeOp* fop, JSObject* obj)
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreateDateTimeFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObject*> global)
|
||||
CreateDateTimeFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObject*> global,
|
||||
MutableHandleObject constructor)
|
||||
{
|
||||
RootedFunction ctor(cx);
|
||||
ctor = GlobalObject::createConstructor(cx, &DateTimeFormat, cx->names().DateTimeFormat, 0);
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
RootedNativeObject proto(cx, GlobalObject::createBlankPrototype(cx, global,
|
||||
&DateTimeFormatClass));
|
||||
Rooted<DateTimeFormatObject*> proto(cx);
|
||||
proto = GlobalObject::createBlankPrototype<DateTimeFormatObject>(cx, global);
|
||||
if (!proto)
|
||||
return nullptr;
|
||||
proto->setReservedSlot(UDATE_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
proto->setReservedSlot(DateTimeFormatObject::INTERNALS_SLOT, NullValue());
|
||||
proto->setReservedSlot(DateTimeFormatObject::UDATE_FORMAT_SLOT, PrivateValue(nullptr));
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||
return nullptr;
|
||||
@ -2638,17 +2516,20 @@ CreateDateTimeFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObj
|
||||
return nullptr;
|
||||
|
||||
// 12.2.1 and 12.3
|
||||
if (!IntlInitialize(cx, proto, cx->names().InitializeDateTimeFormat, UndefinedHandleValue,
|
||||
options))
|
||||
RootedValue thisOrResult(cx, ObjectValue(*proto));
|
||||
if (!LegacyIntlInitialize(cx, proto, cx->names().InitializeDateTimeFormat, thisOrResult,
|
||||
UndefinedHandleValue, options, &thisOrResult))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(&thisOrResult.toObject() == proto);
|
||||
|
||||
// 8.1
|
||||
RootedValue ctorValue(cx, ObjectValue(*ctor));
|
||||
if (!DefineProperty(cx, Intl, cx->names().DateTimeFormat, ctorValue, nullptr, nullptr, 0))
|
||||
return nullptr;
|
||||
|
||||
constructor.set(ctor);
|
||||
return proto;
|
||||
}
|
||||
|
||||
@ -3228,7 +3109,7 @@ js::intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp)
|
||||
* of the given DateTimeFormat.
|
||||
*/
|
||||
static UDateFormat*
|
||||
NewUDateFormat(JSContext* cx, HandleObject dateTimeFormat)
|
||||
NewUDateFormat(JSContext* cx, Handle<DateTimeFormatObject*> dateTimeFormat)
|
||||
{
|
||||
RootedValue value(cx);
|
||||
|
||||
@ -3537,53 +3418,30 @@ js::intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp)
|
||||
MOZ_ASSERT(args[1].isNumber());
|
||||
MOZ_ASSERT(args[2].isBoolean());
|
||||
|
||||
RootedObject dateTimeFormat(cx, &args[0].toObject());
|
||||
Rooted<DateTimeFormatObject*> dateTimeFormat(cx);
|
||||
dateTimeFormat = &args[0].toObject().as<DateTimeFormatObject>();
|
||||
|
||||
// Obtain a UDateFormat object, cached if possible.
|
||||
bool isDateTimeFormatInstance = dateTimeFormat->getClass() == &DateTimeFormatClass;
|
||||
UDateFormat* df;
|
||||
if (isDateTimeFormatInstance) {
|
||||
void* priv =
|
||||
dateTimeFormat->as<NativeObject>().getReservedSlot(UDATE_FORMAT_SLOT).toPrivate();
|
||||
df = static_cast<UDateFormat*>(priv);
|
||||
if (!df) {
|
||||
df = NewUDateFormat(cx, dateTimeFormat);
|
||||
if (!df)
|
||||
return false;
|
||||
dateTimeFormat->as<NativeObject>().setReservedSlot(UDATE_FORMAT_SLOT, PrivateValue(df));
|
||||
}
|
||||
} else {
|
||||
// There's no good place to cache the ICU date-time format for an object
|
||||
// that has been initialized as a DateTimeFormat but is not a
|
||||
// DateTimeFormat instance. One possibility might be to add a
|
||||
// DateTimeFormat instance as an internal property to each such object.
|
||||
// Obtain a cached UDateFormat object.
|
||||
void* priv =
|
||||
dateTimeFormat->getReservedSlot(DateTimeFormatObject::UDATE_FORMAT_SLOT).toPrivate();
|
||||
UDateFormat* df = static_cast<UDateFormat*>(priv);
|
||||
if (!df) {
|
||||
df = NewUDateFormat(cx, dateTimeFormat);
|
||||
if (!df)
|
||||
return false;
|
||||
dateTimeFormat->setReservedSlot(DateTimeFormatObject::UDATE_FORMAT_SLOT, PrivateValue(df));
|
||||
}
|
||||
|
||||
// Use the UDateFormat to actually format the time stamp.
|
||||
RootedValue result(cx);
|
||||
bool success = args[2].toBoolean()
|
||||
? intl_FormatToPartsDateTime(cx, df, args[1].toNumber(), &result)
|
||||
: intl_FormatDateTime(cx, df, args[1].toNumber(), &result);
|
||||
|
||||
if (!isDateTimeFormatInstance)
|
||||
udat_close(df);
|
||||
if (!success)
|
||||
return false;
|
||||
args.rval().set(result);
|
||||
return true;
|
||||
return args[2].toBoolean()
|
||||
? intl_FormatToPartsDateTime(cx, df, args[1].toNumber(), args.rval())
|
||||
: intl_FormatDateTime(cx, df, args[1].toNumber(), args.rval());
|
||||
}
|
||||
|
||||
|
||||
/**************** PluralRules *****************/
|
||||
|
||||
static void pluralRules_finalize(FreeOp* fop, JSObject* obj);
|
||||
|
||||
static const uint32_t UPLURAL_RULES_SLOT = 0;
|
||||
static const uint32_t PLURAL_RULES_SLOTS_COUNT = 1;
|
||||
|
||||
static const ClassOps PluralRulesClassOps = {
|
||||
const ClassOps PluralRulesObject::classOps_ = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
@ -3591,14 +3449,14 @@ static const ClassOps PluralRulesClassOps = {
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
pluralRules_finalize
|
||||
PluralRulesObject::finalize
|
||||
};
|
||||
|
||||
static const Class PluralRulesClass = {
|
||||
const Class PluralRulesObject::class_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_RESERVED_SLOTS(PLURAL_RULES_SLOTS_COUNT) |
|
||||
JSCLASS_HAS_RESERVED_SLOTS(PluralRulesObject::SLOT_COUNT) |
|
||||
JSCLASS_FOREGROUND_FINALIZE,
|
||||
&PluralRulesClassOps
|
||||
&PluralRulesObject::classOps_
|
||||
};
|
||||
|
||||
#if JS_HAS_TOSOURCE
|
||||
@ -3647,25 +3505,27 @@ PluralRules(JSContext* cx, unsigned argc, Value* vp)
|
||||
return false;
|
||||
}
|
||||
|
||||
RootedObject obj(cx, NewObjectWithGivenProto(cx, &PluralRulesClass, proto));
|
||||
if (!obj)
|
||||
Rooted<PluralRulesObject*> pluralRules(cx);
|
||||
pluralRules = NewObjectWithGivenProto<PluralRulesObject>(cx, proto);
|
||||
if (!pluralRules)
|
||||
return false;
|
||||
|
||||
obj->as<NativeObject>().setReservedSlot(UPLURAL_RULES_SLOT, PrivateValue(nullptr));
|
||||
pluralRules->setReservedSlot(PluralRulesObject::INTERNALS_SLOT, NullValue());
|
||||
pluralRules->setReservedSlot(PluralRulesObject::UPLURAL_RULES_SLOT, PrivateValue(nullptr));
|
||||
|
||||
RootedValue locales(cx, args.get(0));
|
||||
RootedValue options(cx, args.get(1));
|
||||
|
||||
// Step 3.
|
||||
if (!IntlInitialize(cx, obj, cx->names().InitializePluralRules, locales, options))
|
||||
if (!IntlInitialize(cx, pluralRules, cx->names().InitializePluralRules, locales, options))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*obj);
|
||||
args.rval().setObject(*pluralRules);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
pluralRules_finalize(FreeOp* fop, JSObject* obj)
|
||||
void
|
||||
PluralRulesObject::finalize(FreeOp* fop, JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(fop->onMainThread());
|
||||
|
||||
@ -3673,7 +3533,8 @@ pluralRules_finalize(FreeOp* fop, JSObject* obj)
|
||||
// brokenness in object allocation code. For the moment, hack around it by
|
||||
// explicitly guarding against the possibility of the reserved slot not
|
||||
// containing a private. See bug 949220.
|
||||
const Value& slot = obj->as<NativeObject>().getReservedSlot(UPLURAL_RULES_SLOT);
|
||||
const Value& slot =
|
||||
obj->as<PluralRulesObject>().getReservedSlot(PluralRulesObject::UPLURAL_RULES_SLOT);
|
||||
if (!slot.isUndefined()) {
|
||||
if (UPluralRules* pr = static_cast<UPluralRules*>(slot.toPrivate()))
|
||||
uplrules_close(pr);
|
||||
@ -3688,14 +3549,12 @@ CreatePluralRulesPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObject
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
RootedNativeObject proto(cx, GlobalObject::createBlankPrototype(cx, global,
|
||||
&PluralRulesClass));
|
||||
Rooted<PluralRulesObject*> proto(cx);
|
||||
proto = GlobalObject::createBlankPrototype<PluralRulesObject>(cx, global);
|
||||
if (!proto)
|
||||
return nullptr;
|
||||
MOZ_ASSERT(proto->getReservedSlot(UPLURAL_RULES_SLOT).isUndefined(),
|
||||
"improperly creating PluralRules more than once for a single "
|
||||
"global?");
|
||||
proto->setReservedSlot(UPLURAL_RULES_SLOT, PrivateValue(nullptr));
|
||||
proto->setReservedSlot(PluralRulesObject::INTERNALS_SLOT, NullValue());
|
||||
proto->setReservedSlot(PluralRulesObject::UPLURAL_RULES_SLOT, PrivateValue(nullptr));
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||
return nullptr;
|
||||
@ -3732,7 +3591,7 @@ js::GlobalObject::addPluralRulesConstructor(JSContext* cx, HandleObject intl)
|
||||
const HeapSlot& slot = global->getReservedSlotRef(PLURAL_RULES_PROTO);
|
||||
if (!slot.isUndefined()) {
|
||||
MOZ_ASSERT(slot.isObject());
|
||||
MOZ_ASSERT(slot.toObject().hasClass(&PluralRulesClass));
|
||||
MOZ_ASSERT(slot.toObject().is<PluralRulesObject>());
|
||||
JS_ReportErrorASCII(cx,
|
||||
"the PluralRules constructor can't be added "
|
||||
"multiple times in the same global");
|
||||
@ -3775,7 +3634,7 @@ js::intl_SelectPluralRule(JSContext* cx, unsigned argc, Value* vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
MOZ_ASSERT(args.length() == 2);
|
||||
|
||||
RootedObject pluralRules(cx, &args[0].toObject());
|
||||
Rooted<PluralRulesObject*> pluralRules(cx, &args[0].toObject().as<PluralRulesObject>());
|
||||
|
||||
UNumberFormat* nf = NewUNumberFormatForPluralRules(cx, pluralRules);
|
||||
if (!nf)
|
||||
@ -3845,6 +3704,7 @@ js::intl_SelectPluralRule(JSContext* cx, unsigned argc, Value* vp)
|
||||
category = UPLURAL_TYPE_ORDINAL;
|
||||
}
|
||||
|
||||
// TODO: Cache UPluralRules in PluralRulesObject::UPluralRulesSlot.
|
||||
UPluralRules* pr = uplrules_openForType(icuLocale(locale.ptr()), category, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
|
||||
@ -3960,6 +3820,9 @@ js::intl_GetPluralCategories(JSContext* cx, unsigned argc, Value* vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/******************** Intl ********************/
|
||||
|
||||
bool
|
||||
js::intl_GetCalendarInfo(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
@ -4393,8 +4256,6 @@ js::intl_ComputeDisplayNames(JSContext* cx, unsigned argc, Value* vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************** Intl ********************/
|
||||
|
||||
const Class js::IntlClass = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_CACHED_PROTO(JSProto_Intl)
|
||||
@ -4444,10 +4305,12 @@ GlobalObject::initIntlObject(JSContext* cx, Handle<GlobalObject*> global)
|
||||
RootedObject collatorProto(cx, CreateCollatorPrototype(cx, intl, global));
|
||||
if (!collatorProto)
|
||||
return false;
|
||||
RootedObject dateTimeFormatProto(cx, CreateDateTimeFormatPrototype(cx, intl, global));
|
||||
RootedObject dateTimeFormatProto(cx), dateTimeFormat(cx);
|
||||
dateTimeFormatProto = CreateDateTimeFormatPrototype(cx, intl, global, &dateTimeFormat);
|
||||
if (!dateTimeFormatProto)
|
||||
return false;
|
||||
RootedObject numberFormatProto(cx, CreateNumberFormatPrototype(cx, intl, global));
|
||||
RootedObject numberFormatProto(cx), numberFormat(cx);
|
||||
numberFormatProto = CreateNumberFormatPrototype(cx, intl, global, &numberFormat);
|
||||
if (!numberFormatProto)
|
||||
return false;
|
||||
|
||||
@ -4469,7 +4332,9 @@ GlobalObject::initIntlObject(JSContext* cx, Handle<GlobalObject*> global)
|
||||
// |getPrototype(JSProto_*)|, but that has global-object-property-related
|
||||
// baggage we don't need or want, so we use one-off reserved slots.
|
||||
global->setReservedSlot(COLLATOR_PROTO, ObjectValue(*collatorProto));
|
||||
global->setReservedSlot(DATE_TIME_FORMAT, ObjectValue(*dateTimeFormat));
|
||||
global->setReservedSlot(DATE_TIME_FORMAT_PROTO, ObjectValue(*dateTimeFormatProto));
|
||||
global->setReservedSlot(NUMBER_FORMAT, ObjectValue(*numberFormat));
|
||||
global->setReservedSlot(NUMBER_FORMAT_PROTO, ObjectValue(*numberFormatProto));
|
||||
|
||||
// Also cache |Intl| to implement spec language that conditions behavior
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "jsalloc.h"
|
||||
#include "NamespaceImports.h"
|
||||
|
||||
#include "builtin/SelfHostingDefines.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "js/GCHashTable.h"
|
||||
|
||||
@ -20,6 +22,8 @@
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#include "vm/NativeObject.h"
|
||||
|
||||
class JSLinearString;
|
||||
|
||||
/*
|
||||
@ -29,6 +33,8 @@ class JSLinearString;
|
||||
|
||||
namespace js {
|
||||
|
||||
class FreeOp;
|
||||
|
||||
/**
|
||||
* Initializes the Intl Object and its standard built-in properties.
|
||||
* Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
|
||||
@ -177,6 +183,24 @@ class SharedIntlData
|
||||
|
||||
/******************** Collator ********************/
|
||||
|
||||
class CollatorObject : public NativeObject
|
||||
{
|
||||
public:
|
||||
static const Class class_;
|
||||
|
||||
static constexpr uint32_t INTERNALS_SLOT = 0;
|
||||
static constexpr uint32_t UCOLLATOR_SLOT = 1;
|
||||
static constexpr uint32_t SLOT_COUNT = 2;
|
||||
|
||||
static_assert(INTERNALS_SLOT == INTL_INTERNALS_OBJECT_SLOT,
|
||||
"INTERNALS_SLOT must match self-hosting define for internals object slot");
|
||||
|
||||
private:
|
||||
static const ClassOps classOps_;
|
||||
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a new instance of the standard built-in Collator constructor.
|
||||
* Self-hosted code cannot cache this constructor (as it does for others in
|
||||
@ -225,6 +249,24 @@ intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/******************** NumberFormat ********************/
|
||||
|
||||
class NumberFormatObject : public NativeObject
|
||||
{
|
||||
public:
|
||||
static const Class class_;
|
||||
|
||||
static constexpr uint32_t INTERNALS_SLOT = 0;
|
||||
static constexpr uint32_t UNUMBER_FORMAT_SLOT = 1;
|
||||
static constexpr uint32_t SLOT_COUNT = 2;
|
||||
|
||||
static_assert(INTERNALS_SLOT == INTL_INTERNALS_OBJECT_SLOT,
|
||||
"INTERNALS_SLOT must match self-hosting define for internals object slot");
|
||||
|
||||
private:
|
||||
static const ClassOps classOps_;
|
||||
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a new instance of the standard built-in NumberFormat constructor.
|
||||
* Self-hosted code cannot cache this constructor (as it does for others in
|
||||
@ -262,7 +304,7 @@ intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Spec: ECMAScript Internationalization API Specification, 11.3.2.
|
||||
*
|
||||
* Usage: formatted = intl_FormatNumber(numberFormat, x)
|
||||
* Usage: formatted = intl_FormatNumber(numberFormat, x, formatToParts)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp);
|
||||
@ -270,6 +312,24 @@ intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/******************** DateTimeFormat ********************/
|
||||
|
||||
class DateTimeFormatObject : public NativeObject
|
||||
{
|
||||
public:
|
||||
static const Class class_;
|
||||
|
||||
static constexpr uint32_t INTERNALS_SLOT = 0;
|
||||
static constexpr uint32_t UDATE_FORMAT_SLOT = 1;
|
||||
static constexpr uint32_t SLOT_COUNT = 2;
|
||||
|
||||
static_assert(INTERNALS_SLOT == INTL_INTERNALS_OBJECT_SLOT,
|
||||
"INTERNALS_SLOT must match self-hosting define for internals object slot");
|
||||
|
||||
private:
|
||||
static const ClassOps classOps_;
|
||||
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a new instance of the standard built-in DateTimeFormat constructor.
|
||||
* Self-hosted code cannot cache this constructor (as it does for others in
|
||||
@ -358,13 +418,32 @@ intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Spec: ECMAScript Internationalization API Specification, 12.3.2.
|
||||
*
|
||||
* Usage: formatted = intl_FormatDateTime(dateTimeFormat, x)
|
||||
* Usage: formatted = intl_FormatDateTime(dateTimeFormat, x, formatToParts)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
|
||||
/******************** PluralRules ********************/
|
||||
|
||||
class PluralRulesObject : public NativeObject
|
||||
{
|
||||
public:
|
||||
static const Class class_;
|
||||
|
||||
static constexpr uint32_t INTERNALS_SLOT = 0;
|
||||
static constexpr uint32_t UPLURAL_RULES_SLOT = 1;
|
||||
static constexpr uint32_t SLOT_COUNT = 2;
|
||||
|
||||
static_assert(INTERNALS_SLOT == INTL_INTERNALS_OBJECT_SLOT,
|
||||
"INTERNALS_SLOT must match self-hosting define for internals object slot");
|
||||
|
||||
private:
|
||||
static const ClassOps classOps_;
|
||||
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an object indicating the supported locales for plural rules
|
||||
* by having a true-valued property for each such locale with the
|
||||
@ -401,6 +480,9 @@ intl_SelectPluralRule(JSContext* cx, unsigned argc, Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
intl_GetPluralCategories(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
|
||||
/******************** Intl ********************/
|
||||
|
||||
/**
|
||||
* Returns a plain object with calendar information for a single valid locale
|
||||
* (callers must perform this validation). The object will have these
|
||||
|
@ -7,7 +7,7 @@
|
||||
/*global JSMSG_INTL_OBJECT_NOT_INITED: false, JSMSG_INVALID_LOCALES_ELEMENT: false,
|
||||
JSMSG_INVALID_LANGUAGE_TAG: false, JSMSG_INVALID_LOCALE_MATCHER: false,
|
||||
JSMSG_INVALID_OPTION_VALUE: false, JSMSG_INVALID_DIGITS_VALUE: false,
|
||||
JSMSG_INTL_OBJECT_REINITED: false, JSMSG_INVALID_CURRENCY_CODE: false,
|
||||
JSMSG_INVALID_CURRENCY_CODE: false,
|
||||
JSMSG_UNDEFINED_CURRENCY: false, JSMSG_INVALID_TIME_ZONE: false,
|
||||
JSMSG_DATE_NOT_FINITE: false, JSMSG_INVALID_KEYS_TYPE: false,
|
||||
JSMSG_INVALID_KEY: false,
|
||||
@ -1197,77 +1197,59 @@ function GetNumberOption(options, property, minimum, maximum, fallback) {
|
||||
/********** Property access for Intl objects **********/
|
||||
|
||||
|
||||
// Symbols in the self-hosting compartment can't be cloned, use a separate
|
||||
// object to hold the actual symbol value.
|
||||
// TODO: Can we add support to clone symbols?
|
||||
var intlFallbackSymbolHolder = { value: undefined };
|
||||
|
||||
/**
|
||||
* Weak map used to track the initialize-as-Intl status (and, if an object has
|
||||
* been so initialized, the Intl-specific internal properties) of all objects.
|
||||
* Presence of an object as a key within this map indicates that the object has
|
||||
* its [[initializedIntlObject]] internal property set to true. The associated
|
||||
* value is an object whose structure is documented in |initializeIntlObject|
|
||||
* below.
|
||||
* The [[FallbackSymbol]] symbol of the %Intl% intrinsic object.
|
||||
*
|
||||
* Ideally we'd be using private symbols for internal properties, but
|
||||
* SpiderMonkey doesn't have those yet.
|
||||
* This symbol is used to implement the legacy constructor semantics for
|
||||
* Intl.DateTimeFormat and Intl.NumberFormat.
|
||||
*/
|
||||
var internalsMap = new WeakMap();
|
||||
|
||||
|
||||
/**
|
||||
* Set the [[initializedIntlObject]] internal property of |obj| to true.
|
||||
*/
|
||||
function initializeIntlObject(obj) {
|
||||
assert(IsObject(obj), "Non-object passed to initializeIntlObject");
|
||||
|
||||
// Intl-initialized objects are weird. They have [[initializedIntlObject]]
|
||||
// set on them, but they don't *necessarily* have any other properties.
|
||||
|
||||
var internals = std_Object_create(null);
|
||||
|
||||
// The meaning of an internals object for an object |obj| is as follows.
|
||||
//
|
||||
// If the .type is "partial", |obj| has [[initializedIntlObject]] set but
|
||||
// nothing else. No other property of |internals| can be used. (This
|
||||
// occurs when InitializeCollator or similar marks an object as
|
||||
// [[initializedIntlObject]] but fails before marking it as the appropriate
|
||||
// more-specific type ["Collator", "DateTimeFormat", "NumberFormat"].)
|
||||
//
|
||||
// Otherwise, the .type indicates the type of Intl object that |obj| is:
|
||||
// "Collator", "DateTimeFormat", or "NumberFormat" (likely with more coming
|
||||
// in future Intl specs). In these cases |obj| *conceptually* also has
|
||||
// [[initializedCollator]] or similar set, and all the other properties
|
||||
// implied by that.
|
||||
//
|
||||
// If |internals| doesn't have a "partial" .type, two additional properties
|
||||
// have meaning. The .lazyData property stores information needed to
|
||||
// compute -- without observable side effects -- the actual internal Intl
|
||||
// properties of |obj|. If it is non-null, then the actual internal
|
||||
// properties haven't been computed, and .lazyData must be processed by
|
||||
// |setInternalProperties| before internal Intl property values are
|
||||
// available. If it is null, then the .internalProps property contains an
|
||||
// object whose properties are the internal Intl properties of |obj|.
|
||||
|
||||
internals.type = "partial";
|
||||
internals.lazyData = null;
|
||||
internals.internalProps = null;
|
||||
|
||||
callFunction(std_WeakMap_set, internalsMap, obj, internals);
|
||||
return internals;
|
||||
function intlFallbackSymbol() {
|
||||
var fallbackSymbol = intlFallbackSymbolHolder.value;
|
||||
if (!fallbackSymbol)
|
||||
intlFallbackSymbolHolder.value = fallbackSymbol = std_Symbol();
|
||||
return fallbackSymbol;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark |internals| as having the given type and lazy data.
|
||||
* Initializes the INTL_INTERNALS_OBJECT_SLOT of the given object.
|
||||
*/
|
||||
function setLazyData(internals, type, lazyData)
|
||||
{
|
||||
assert(internals.type === "partial", "can't set lazy data for anything but a newborn");
|
||||
assert(type === "Collator" || type === "DateTimeFormat" ||
|
||||
type == "NumberFormat" || type === "PluralRules",
|
||||
"bad type");
|
||||
function initializeIntlObject(obj, type, lazyData) {
|
||||
assert(IsObject(obj), "Non-object passed to initializeIntlObject");
|
||||
assert((type === "Collator" && IsCollator(obj)) ||
|
||||
(type === "DateTimeFormat" && IsDateTimeFormat(obj)) ||
|
||||
(type === "NumberFormat" && IsNumberFormat(obj)) ||
|
||||
(type === "PluralRules" && IsPluralRules(obj)),
|
||||
"type must match the object's class");
|
||||
assert(IsObject(lazyData), "non-object lazy data");
|
||||
|
||||
// Set in reverse order so that the .type change is a barrier.
|
||||
internals.lazyData = lazyData;
|
||||
// The meaning of an internals object for an object |obj| is as follows.
|
||||
//
|
||||
// The .type property indicates the type of Intl object that |obj| is:
|
||||
// "Collator", "DateTimeFormat", "NumberFormat", or "PluralRules" (likely
|
||||
// with more coming in future Intl specs).
|
||||
//
|
||||
// The .lazyData property stores information needed to compute -- without
|
||||
// observable side effects -- the actual internal Intl properties of
|
||||
// |obj|. If it is non-null, then the actual internal properties haven't
|
||||
// been computed, and .lazyData must be processed by
|
||||
// |setInternalProperties| before internal Intl property values are
|
||||
// available. If it is null, then the .internalProps property contains an
|
||||
// object whose properties are the internal Intl properties of |obj|.
|
||||
|
||||
var internals = std_Object_create(null);
|
||||
internals.type = type;
|
||||
internals.lazyData = lazyData;
|
||||
internals.internalProps = null;
|
||||
|
||||
assert(UnsafeGetReservedSlot(obj, INTL_INTERNALS_OBJECT_SLOT) === null,
|
||||
"Internal slot already initialized?");
|
||||
UnsafeSetReservedSlot(obj, INTL_INTERNALS_OBJECT_SLOT, internals);
|
||||
}
|
||||
|
||||
|
||||
@ -1275,9 +1257,7 @@ function setLazyData(internals, type, lazyData)
|
||||
* Set the internal properties object for an |internals| object previously
|
||||
* associated with lazy data.
|
||||
*/
|
||||
function setInternalProperties(internals, internalProps)
|
||||
{
|
||||
assert(internals.type !== "partial", "newborn internals can't have computed internals");
|
||||
function setInternalProperties(internals, internalProps) {
|
||||
assert(IsObject(internals.lazyData), "lazy data must exist already");
|
||||
assert(IsObject(internalProps), "internalProps argument should be an object");
|
||||
|
||||
@ -1291,10 +1271,8 @@ function setInternalProperties(internals, internalProps)
|
||||
* Get the existing internal properties out of a non-newborn |internals|, or
|
||||
* null if none have been computed.
|
||||
*/
|
||||
function maybeInternalProperties(internals)
|
||||
{
|
||||
function maybeInternalProperties(internals) {
|
||||
assert(IsObject(internals), "non-object passed to maybeInternalProperties");
|
||||
assert(internals.type !== "partial", "maybeInternalProperties must only be used on completely-initialized internals objects");
|
||||
var lazyData = internals.lazyData;
|
||||
if (lazyData)
|
||||
return null;
|
||||
@ -1304,47 +1282,31 @@ function maybeInternalProperties(internals)
|
||||
|
||||
|
||||
/**
|
||||
* Return whether |obj| has an[[initializedIntlObject]] property set to true.
|
||||
*/
|
||||
function isInitializedIntlObject(obj) {
|
||||
#ifdef DEBUG
|
||||
var internals = callFunction(std_WeakMap_get, internalsMap, obj);
|
||||
if (IsObject(internals)) {
|
||||
assert(callFunction(std_Object_hasOwnProperty, internals, "type"), "missing type");
|
||||
var type = internals.type;
|
||||
assert(type === "partial" || type === "Collator" ||
|
||||
type === "DateTimeFormat" || type === "NumberFormat" || type === "PluralRules",
|
||||
"unexpected type");
|
||||
assert(callFunction(std_Object_hasOwnProperty, internals, "lazyData"), "missing lazyData");
|
||||
assert(callFunction(std_Object_hasOwnProperty, internals, "internalProps"), "missing internalProps");
|
||||
} else {
|
||||
assert(internals === undefined, "bad mapping for |obj|");
|
||||
}
|
||||
#endif
|
||||
return callFunction(std_WeakMap_has, internalsMap, obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check that |obj| meets the requirements for "this Collator object", "this
|
||||
* NumberFormat object", or "this DateTimeFormat object" as used in the method
|
||||
* with the given name. Throw a TypeError if |obj| doesn't meet these
|
||||
* requirements. But if it does, return |obj|'s internals object (*not* the
|
||||
* object holding its internal properties!), associated with it by
|
||||
* |internalsMap|, with structure specified above.
|
||||
* Return |obj|'s internals object (*not* the object holding its internal
|
||||
* properties!), with structure specified above.
|
||||
*
|
||||
* Spec: ECMAScript Internationalization API Specification, 10.3.
|
||||
* Spec: ECMAScript Internationalization API Specification, 11.3.
|
||||
* Spec: ECMAScript Internationalization API Specification, 12.3.
|
||||
*/
|
||||
function getIntlObjectInternals(obj, className, methodName) {
|
||||
assert(typeof className === "string", "bad className for getIntlObjectInternals");
|
||||
function getIntlObjectInternals(obj) {
|
||||
assert(IsObject(obj), "getIntlObjectInternals called with non-Object");
|
||||
assert(IsCollator(obj) || IsDateTimeFormat(obj) || IsNumberFormat(obj) || IsPluralRules(obj),
|
||||
"getIntlObjectInternals called with non-Intl object");
|
||||
|
||||
var internals = callFunction(std_WeakMap_get, internalsMap, obj);
|
||||
assert(internals === undefined || isInitializedIntlObject(obj), "bad mapping in internalsMap");
|
||||
var internals = UnsafeGetReservedSlot(obj, INTL_INTERNALS_OBJECT_SLOT);
|
||||
|
||||
if (internals === undefined || internals.type !== className)
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, className, methodName, className);
|
||||
assert(IsObject(internals), "internals not an object");
|
||||
assert(callFunction(std_Object_hasOwnProperty, internals, "type"), "missing type");
|
||||
assert((internals.type === "Collator" && IsCollator(obj)) ||
|
||||
(internals.type === "DateTimeFormat" && IsDateTimeFormat(obj)) ||
|
||||
(internals.type === "NumberFormat" && IsNumberFormat(obj)) ||
|
||||
(internals.type === "PluralRules" && IsPluralRules(obj)),
|
||||
"type must match the object's class");
|
||||
assert(callFunction(std_Object_hasOwnProperty, internals, "lazyData"),
|
||||
"missing lazyData");
|
||||
assert(callFunction(std_Object_hasOwnProperty, internals, "internalProps"),
|
||||
"missing internalProps");
|
||||
|
||||
return internals;
|
||||
}
|
||||
@ -1354,27 +1316,24 @@ function getIntlObjectInternals(obj, className, methodName) {
|
||||
* Get the internal properties of known-Intl object |obj|. For use only by
|
||||
* C++ code that knows what it's doing!
|
||||
*/
|
||||
function getInternals(obj)
|
||||
{
|
||||
assert(isInitializedIntlObject(obj), "for use only on guaranteed Intl objects");
|
||||
function getInternals(obj) {
|
||||
var internals = getIntlObjectInternals(obj);
|
||||
|
||||
var internals = callFunction(std_WeakMap_get, internalsMap, obj);
|
||||
// If internal properties have already been computed, use them.
|
||||
var internalProps = maybeInternalProperties(internals);
|
||||
if (internalProps)
|
||||
return internalProps;
|
||||
|
||||
assert(internals.type !== "partial", "must have been successfully initialized");
|
||||
var lazyData = internals.lazyData;
|
||||
if (!lazyData)
|
||||
return internals.internalProps;
|
||||
|
||||
var internalProps;
|
||||
// Otherwise it's time to fully create them.
|
||||
var type = internals.type;
|
||||
if (type === "Collator")
|
||||
internalProps = resolveCollatorInternals(lazyData)
|
||||
internalProps = resolveCollatorInternals(internals.lazyData)
|
||||
else if (type === "DateTimeFormat")
|
||||
internalProps = resolveDateTimeFormatInternals(lazyData)
|
||||
else if (type === "PluralRules")
|
||||
internalProps = resolvePluralRulesInternals(lazyData)
|
||||
internalProps = resolveDateTimeFormatInternals(internals.lazyData)
|
||||
else if (type === "NumberFormat")
|
||||
internalProps = resolveNumberFormatInternals(internals.lazyData);
|
||||
else
|
||||
internalProps = resolveNumberFormatInternals(lazyData);
|
||||
internalProps = resolvePluralRulesInternals(internals.lazyData)
|
||||
setInternalProperties(internals, internalProps);
|
||||
return internalProps;
|
||||
}
|
||||
@ -1398,8 +1357,7 @@ var collatorKeyMappings = {
|
||||
/**
|
||||
* Compute an internal properties object from |lazyCollatorData|.
|
||||
*/
|
||||
function resolveCollatorInternals(lazyCollatorData)
|
||||
{
|
||||
function resolveCollatorInternals(lazyCollatorData) {
|
||||
assert(IsObject(lazyCollatorData), "lazy data not an object?");
|
||||
|
||||
var internalProps = std_Object_create(null);
|
||||
@ -1485,11 +1443,13 @@ function resolveCollatorInternals(lazyCollatorData)
|
||||
|
||||
|
||||
/**
|
||||
* Returns an object containing the Collator internal properties of |obj|, or
|
||||
* throws a TypeError if |obj| isn't Collator-initialized.
|
||||
* Returns an object containing the Collator internal properties of |obj|.
|
||||
*/
|
||||
function getCollatorInternals(obj, methodName) {
|
||||
var internals = getIntlObjectInternals(obj, "Collator", methodName);
|
||||
function getCollatorInternals(obj) {
|
||||
assert(IsObject(obj), "getCollatorInternals called with non-object");
|
||||
assert(IsCollator(obj), "getCollatorInternals called with non-Collator");
|
||||
|
||||
var internals = getIntlObjectInternals(obj);
|
||||
assert(internals.type === "Collator", "bad type escaped getIntlObjectInternals");
|
||||
|
||||
// If internal properties have already been computed, use them.
|
||||
@ -1516,14 +1476,11 @@ function getCollatorInternals(obj, methodName) {
|
||||
* Spec: ECMAScript Internationalization API Specification, 10.1.1.
|
||||
*/
|
||||
function InitializeCollator(collator, locales, options) {
|
||||
assert(IsObject(collator), "InitializeCollator");
|
||||
assert(IsObject(collator), "InitializeCollator called with non-object");
|
||||
assert(IsCollator(collator), "InitializeCollator called with non-Collator");
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(collator))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
// Step 2.
|
||||
var internals = initializeIntlObject(collator);
|
||||
// Steps 1-2 (These steps are no longer required and should be removed
|
||||
// from the spec; https://github.com/tc39/ecma402/issues/115).
|
||||
|
||||
// Lazy Collator data has the following structure:
|
||||
//
|
||||
@ -1597,7 +1554,7 @@ function InitializeCollator(collator, locales, options) {
|
||||
//
|
||||
// We've done everything that must be done now: mark the lazy data as fully
|
||||
// computed and install it.
|
||||
setLazyData(internals, "Collator", lazyCollatorData);
|
||||
initializeIntlObject(collator, "Collator", lazyCollatorData);
|
||||
}
|
||||
|
||||
|
||||
@ -1689,14 +1646,17 @@ function collatorCompareToBind(x, y) {
|
||||
*/
|
||||
function Intl_Collator_compare_get() {
|
||||
// Check "this Collator object" per introduction of section 10.3.
|
||||
var internals = getCollatorInternals(this, "compare");
|
||||
if (!IsObject(this) || !IsCollator(this))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "Collator", "compare", "Collator");
|
||||
|
||||
var internals = getCollatorInternals(this);
|
||||
|
||||
// Step 1.
|
||||
if (internals.boundCompare === undefined) {
|
||||
// Step 1.a.
|
||||
var F = collatorCompareToBind;
|
||||
|
||||
// Step 1.b-d.
|
||||
// Steps 1.b-d.
|
||||
var bc = callFunction(FunctionBind, F, this);
|
||||
internals.boundCompare = bc;
|
||||
}
|
||||
@ -1714,7 +1674,10 @@ _SetCanonicalName(Intl_Collator_compare_get, "get compare");
|
||||
*/
|
||||
function Intl_Collator_resolvedOptions() {
|
||||
// Check "this Collator object" per introduction of section 10.3.
|
||||
var internals = getCollatorInternals(this, "resolvedOptions");
|
||||
if (!IsObject(this) || !IsCollator(this))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "Collator", "resolvedOptions", "Collator");
|
||||
|
||||
var internals = getCollatorInternals(this);
|
||||
|
||||
var result = {
|
||||
locale: internals.locale,
|
||||
@ -1825,11 +1788,13 @@ function resolveNumberFormatInternals(lazyNumberFormatData) {
|
||||
|
||||
|
||||
/**
|
||||
* Returns an object containing the NumberFormat internal properties of |obj|,
|
||||
* or throws a TypeError if |obj| isn't NumberFormat-initialized.
|
||||
* Returns an object containing the NumberFormat internal properties of |obj|.
|
||||
*/
|
||||
function getNumberFormatInternals(obj, methodName) {
|
||||
var internals = getIntlObjectInternals(obj, "NumberFormat", methodName);
|
||||
function getNumberFormatInternals(obj) {
|
||||
assert(IsObject(obj), "getNumberFormatInternals called with non-object");
|
||||
assert(IsNumberFormat(obj), "getNumberFormatInternals called with non-NumberFormat");
|
||||
|
||||
var internals = getIntlObjectInternals(obj);
|
||||
assert(internals.type === "NumberFormat", "bad type escaped getIntlObjectInternals");
|
||||
|
||||
// If internal properties have already been computed, use them.
|
||||
@ -1843,6 +1808,25 @@ function getNumberFormatInternals(obj, methodName) {
|
||||
return internalProps;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UnwrapNumberFormat(nf)
|
||||
*/
|
||||
function UnwrapNumberFormat(nf, methodName) {
|
||||
// Step 1.
|
||||
if ((!IsObject(nf) || !IsNumberFormat(nf)) && nf instanceof GetNumberFormatConstructor()) {
|
||||
nf = nf[intlFallbackSymbol()];
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
if (!IsObject(nf) || !IsNumberFormat(nf))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "NumberFormat", methodName, "NumberFormat");
|
||||
|
||||
// Step 3.
|
||||
return nf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Applies digit options used for number formatting onto the intl object.
|
||||
*
|
||||
@ -1893,15 +1877,12 @@ function SetNumberFormatDigitOptions(lazyData, options, mnfdDefault, mxfdDefault
|
||||
*
|
||||
* Spec: ECMAScript Internationalization API Specification, 11.1.1.
|
||||
*/
|
||||
function InitializeNumberFormat(numberFormat, locales, options) {
|
||||
assert(IsObject(numberFormat), "InitializeNumberFormat");
|
||||
function InitializeNumberFormat(numberFormat, thisValue, locales, options) {
|
||||
assert(IsObject(numberFormat), "InitializeNumberFormat called with non-object");
|
||||
assert(IsNumberFormat(numberFormat), "InitializeNumberFormat called with non-NumberFormat");
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(numberFormat))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
// Step 2.
|
||||
var internals = initializeIntlObject(numberFormat);
|
||||
// Steps 1-2 (These steps are no longer required and should be removed
|
||||
// from the spec; https://github.com/tc39/ecma402/issues/115).
|
||||
|
||||
// Lazy NumberFormat data has the following structure:
|
||||
//
|
||||
@ -2003,7 +1984,19 @@ function InitializeNumberFormat(numberFormat, locales, options) {
|
||||
//
|
||||
// We've done everything that must be done now: mark the lazy data as fully
|
||||
// computed and install it.
|
||||
setLazyData(internals, "NumberFormat", lazyNumberFormatData);
|
||||
initializeIntlObject(numberFormat, "NumberFormat", lazyNumberFormatData);
|
||||
|
||||
if (numberFormat !== thisValue && thisValue instanceof GetNumberFormatConstructor()) {
|
||||
if (!IsObject(thisValue))
|
||||
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof thisValue);
|
||||
|
||||
_DefineDataProperty(thisValue, intlFallbackSymbol(), numberFormat,
|
||||
ATTR_NONENUMERABLE | ATTR_NONCONFIGURABLE | ATTR_NONWRITABLE);
|
||||
|
||||
return thisValue;
|
||||
}
|
||||
|
||||
return numberFormat;
|
||||
}
|
||||
|
||||
|
||||
@ -2100,30 +2093,33 @@ function numberFormatFormatToBind(value) {
|
||||
* Spec: ECMAScript Internationalization API Specification, 11.3.2.
|
||||
*/
|
||||
function Intl_NumberFormat_format_get() {
|
||||
// Check "this NumberFormat object" per introduction of section 11.3.
|
||||
var internals = getNumberFormatInternals(this, "format");
|
||||
// Steps 1-3.
|
||||
var nf = UnwrapNumberFormat(this, "format");
|
||||
|
||||
// Step 1.
|
||||
var internals = getNumberFormatInternals(nf);
|
||||
|
||||
// Step 4.
|
||||
if (internals.boundFormat === undefined) {
|
||||
// Step 1.a.
|
||||
// Step 4.a.
|
||||
var F = numberFormatFormatToBind;
|
||||
|
||||
// Step 1.b-d.
|
||||
var bf = callFunction(FunctionBind, F, this);
|
||||
// Steps 4.b-d.
|
||||
var bf = callFunction(FunctionBind, F, nf);
|
||||
internals.boundFormat = bf;
|
||||
}
|
||||
// Step 2.
|
||||
|
||||
// Step 5.
|
||||
return internals.boundFormat;
|
||||
}
|
||||
_SetCanonicalName(Intl_NumberFormat_format_get, "get format");
|
||||
|
||||
|
||||
function Intl_NumberFormat_formatToParts(value) {
|
||||
// Step 1.
|
||||
var nf = this;
|
||||
// Steps 1-3.
|
||||
var nf = UnwrapNumberFormat(this, "formatToParts");
|
||||
|
||||
// Steps 2-3.
|
||||
getNumberFormatInternals(nf, "formatToParts");
|
||||
// Ensure the NumberFormat internals are resolved.
|
||||
getNumberFormatInternals(nf);
|
||||
|
||||
// Step 4.
|
||||
var x = ToNumber(value);
|
||||
@ -2139,8 +2135,10 @@ function Intl_NumberFormat_formatToParts(value) {
|
||||
* Spec: ECMAScript Internationalization API Specification, 11.3.3 and 11.4.
|
||||
*/
|
||||
function Intl_NumberFormat_resolvedOptions() {
|
||||
// Check "this NumberFormat object" per introduction of section 11.3.
|
||||
var internals = getNumberFormatInternals(this, "resolvedOptions");
|
||||
// Invoke |UnwrapNumberFormat| per introduction of section 11.3.
|
||||
var nf = UnwrapNumberFormat(this, "resolvedOptions");
|
||||
|
||||
var internals = getNumberFormatInternals(nf);
|
||||
|
||||
var result = {
|
||||
locale: internals.locale,
|
||||
@ -2249,11 +2247,13 @@ function resolveDateTimeFormatInternals(lazyDateTimeFormatData) {
|
||||
|
||||
|
||||
/**
|
||||
* Returns an object containing the DateTimeFormat internal properties of |obj|,
|
||||
* or throws a TypeError if |obj| isn't DateTimeFormat-initialized.
|
||||
* Returns an object containing the DateTimeFormat internal properties of |obj|.
|
||||
*/
|
||||
function getDateTimeFormatInternals(obj, methodName) {
|
||||
var internals = getIntlObjectInternals(obj, "DateTimeFormat", methodName);
|
||||
function getDateTimeFormatInternals(obj) {
|
||||
assert(IsObject(obj), "getDateTimeFormatInternals called with non-object");
|
||||
assert(IsDateTimeFormat(obj), "getDateTimeFormatInternals called with non-DateTimeFormat");
|
||||
|
||||
var internals = getIntlObjectInternals(obj);
|
||||
assert(internals.type === "DateTimeFormat", "bad type escaped getIntlObjectInternals");
|
||||
|
||||
// If internal properties have already been computed, use them.
|
||||
@ -2268,6 +2268,28 @@ function getDateTimeFormatInternals(obj, methodName) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UnwrapDateTimeFormat(dtf)
|
||||
*/
|
||||
function UnwrapDateTimeFormat(dtf, methodName) {
|
||||
// Step 1.
|
||||
if ((!IsObject(dtf) || !IsDateTimeFormat(dtf)) &&
|
||||
dtf instanceof GetDateTimeFormatConstructor())
|
||||
{
|
||||
dtf = dtf[intlFallbackSymbol()];
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
if (!IsObject(dtf) || !IsDateTimeFormat(dtf)) {
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "DateTimeFormat", methodName,
|
||||
"DateTimeFormat");
|
||||
}
|
||||
|
||||
// Step 3.
|
||||
return dtf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes an object as a DateTimeFormat.
|
||||
*
|
||||
@ -2279,15 +2301,13 @@ function getDateTimeFormatInternals(obj, methodName) {
|
||||
*
|
||||
* Spec: ECMAScript Internationalization API Specification, 12.1.1.
|
||||
*/
|
||||
function InitializeDateTimeFormat(dateTimeFormat, locales, options) {
|
||||
assert(IsObject(dateTimeFormat), "InitializeDateTimeFormat");
|
||||
function InitializeDateTimeFormat(dateTimeFormat, thisValue, locales, options) {
|
||||
assert(IsObject(dateTimeFormat), "InitializeDateTimeFormat called with non-Object");
|
||||
assert(IsDateTimeFormat(dateTimeFormat),
|
||||
"InitializeDateTimeFormat called with non-DateTimeFormat");
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(dateTimeFormat))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
// Step 2.
|
||||
var internals = initializeIntlObject(dateTimeFormat);
|
||||
// Steps 1-2 (These steps are no longer required and should be removed
|
||||
// from the spec; https://github.com/tc39/ecma402/issues/115).
|
||||
|
||||
// Lazy DateTimeFormat data has the following structure:
|
||||
//
|
||||
@ -2398,7 +2418,19 @@ function InitializeDateTimeFormat(dateTimeFormat, locales, options) {
|
||||
//
|
||||
// We've done everything that must be done now: mark the lazy data as fully
|
||||
// computed and install it.
|
||||
setLazyData(internals, "DateTimeFormat", lazyDateTimeFormatData);
|
||||
initializeIntlObject(dateTimeFormat, "DateTimeFormat", lazyDateTimeFormatData);
|
||||
|
||||
if (dateTimeFormat !== thisValue && thisValue instanceof GetDateTimeFormatConstructor()) {
|
||||
if (!IsObject(thisValue))
|
||||
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof thisValue);
|
||||
|
||||
_DefineDataProperty(thisValue, intlFallbackSymbol(), dateTimeFormat,
|
||||
ATTR_NONENUMERABLE | ATTR_NONCONFIGURABLE | ATTR_NONWRITABLE);
|
||||
|
||||
return thisValue;
|
||||
}
|
||||
|
||||
return dateTimeFormat;
|
||||
}
|
||||
|
||||
|
||||
@ -2797,7 +2829,7 @@ function dateTimeFormatFormatToBind() {
|
||||
var x = (date === undefined) ? std_Date_now() : ToNumber(date);
|
||||
|
||||
// Step 1.a.iii.
|
||||
return intl_FormatDateTime(this, x, false);
|
||||
return intl_FormatDateTime(this, x, /* formatToParts = */ false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2808,35 +2840,40 @@ function dateTimeFormatFormatToBind() {
|
||||
* Spec: ECMAScript Internationalization API Specification, 12.3.2.
|
||||
*/
|
||||
function Intl_DateTimeFormat_format_get() {
|
||||
// Check "this DateTimeFormat object" per introduction of section 12.3.
|
||||
var internals = getDateTimeFormatInternals(this, "format");
|
||||
// Steps 1-3.
|
||||
var dtf = UnwrapDateTimeFormat(this, "format");
|
||||
|
||||
// Step 1.
|
||||
var internals = getDateTimeFormatInternals(dtf);
|
||||
|
||||
// Step 4.
|
||||
if (internals.boundFormat === undefined) {
|
||||
// Step 1.a.
|
||||
// Step 4.a.
|
||||
var F = dateTimeFormatFormatToBind;
|
||||
|
||||
// Step 1.b-d.
|
||||
var bf = callFunction(FunctionBind, F, this);
|
||||
// Steps 4.b-d.
|
||||
var bf = callFunction(FunctionBind, F, dtf);
|
||||
internals.boundFormat = bf;
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
// Step 5.
|
||||
return internals.boundFormat;
|
||||
}
|
||||
_SetCanonicalName(Intl_DateTimeFormat_format_get, "get format");
|
||||
|
||||
|
||||
function Intl_DateTimeFormat_formatToParts() {
|
||||
// Check "this DateTimeFormat object" per introduction of section 12.3.
|
||||
getDateTimeFormatInternals(this, "formatToParts");
|
||||
// Steps 1-3.
|
||||
var dtf = UnwrapDateTimeFormat(this, "formatToParts");
|
||||
|
||||
// Steps 1.a.i-ii
|
||||
// Ensure the DateTimeFormat internals are resolved.
|
||||
getDateTimeFormatInternals(dtf);
|
||||
|
||||
// Steps 4-5.
|
||||
var date = arguments.length > 0 ? arguments[0] : undefined;
|
||||
var x = (date === undefined) ? std_Date_now() : ToNumber(date);
|
||||
|
||||
// Step 1.a.iii.
|
||||
return intl_FormatDateTime(this, x, true);
|
||||
// Step 6.
|
||||
return intl_FormatDateTime(dtf, x, /* formatToParts = */ true);
|
||||
}
|
||||
|
||||
|
||||
@ -2846,8 +2883,10 @@ function Intl_DateTimeFormat_formatToParts() {
|
||||
* Spec: ECMAScript Internationalization API Specification, 12.3.3 and 12.4.
|
||||
*/
|
||||
function Intl_DateTimeFormat_resolvedOptions() {
|
||||
// Check "this DateTimeFormat object" per introduction of section 12.3.
|
||||
var internals = getDateTimeFormatInternals(this, "resolvedOptions");
|
||||
// Invoke |UnwrapDateTimeFormat| per introduction of section 12.3.
|
||||
var dtf = UnwrapDateTimeFormat(this, "resolvedOptions");
|
||||
|
||||
var internals = getDateTimeFormatInternals(dtf);
|
||||
|
||||
var result = {
|
||||
locale: internals.locale,
|
||||
@ -2960,8 +2999,10 @@ function resolveICUPattern(pattern, result) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********** Intl.PluralRules **********/
|
||||
|
||||
|
||||
/**
|
||||
* PluralRules internal properties.
|
||||
*
|
||||
@ -3021,11 +3062,13 @@ function resolvePluralRulesInternals(lazyPluralRulesData) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object containing the PluralRules internal properties of |obj|,
|
||||
* or throws a TypeError if |obj| isn't PluralRules-initialized.
|
||||
* Returns an object containing the PluralRules internal properties of |obj|.
|
||||
*/
|
||||
function getPluralRulesInternals(obj, methodName) {
|
||||
var internals = getIntlObjectInternals(obj, "PluralRules", methodName);
|
||||
function getPluralRulesInternals(obj) {
|
||||
assert(IsObject(obj), "getPluralRulesInternals called with non-object");
|
||||
assert(IsPluralRules(obj), "getPluralRulesInternals called with non-PluralRules");
|
||||
|
||||
var internals = getIntlObjectInternals(obj);
|
||||
assert(internals.type === "PluralRules", "bad type escaped getIntlObjectInternals");
|
||||
|
||||
var internalProps = maybeInternalProperties(internals);
|
||||
@ -3049,13 +3092,11 @@ function getPluralRulesInternals(obj, methodName) {
|
||||
* Spec: ECMAScript 402 API, PluralRules, 1.1.1.
|
||||
*/
|
||||
function InitializePluralRules(pluralRules, locales, options) {
|
||||
assert(IsObject(pluralRules), "InitializePluralRules");
|
||||
assert(IsObject(pluralRules), "InitializePluralRules called with non-object");
|
||||
assert(IsPluralRules(pluralRules), "InitializePluralRules called with non-PluralRules");
|
||||
|
||||
// Step 1.
|
||||
if (isInitializedIntlObject(pluralRules))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
|
||||
|
||||
let internals = initializeIntlObject(pluralRules);
|
||||
// Steps 1-2 (These steps are no longer required and should be removed
|
||||
// from the spec; https://github.com/tc39/ecma402/issues/115).
|
||||
|
||||
// Lazy PluralRules data has the following structure:
|
||||
//
|
||||
@ -3107,7 +3148,7 @@ function InitializePluralRules(pluralRules, locales, options) {
|
||||
// Steps 11-12.
|
||||
SetNumberFormatDigitOptions(lazyPluralRulesData, options, 0, 3);
|
||||
|
||||
setLazyData(internals, "PluralRules", lazyPluralRulesData)
|
||||
initializeIntlObject(pluralRules, "PluralRules", lazyPluralRulesData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3140,8 +3181,13 @@ function Intl_PluralRules_supportedLocalesOf(locales /*, options*/) {
|
||||
function Intl_PluralRules_select(value) {
|
||||
// Step 1.
|
||||
let pluralRules = this;
|
||||
|
||||
// Step 2.
|
||||
let internals = getPluralRulesInternals(pluralRules, "select");
|
||||
if (!IsObject(pluralRules) || !IsPluralRules(pluralRules))
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "PluralRules", "select", "PluralRules");
|
||||
|
||||
// Ensure the PluralRules internals are resolved.
|
||||
getPluralRulesInternals(pluralRules);
|
||||
|
||||
// Steps 3-4.
|
||||
let n = ToNumber(value);
|
||||
@ -3156,7 +3202,13 @@ function Intl_PluralRules_select(value) {
|
||||
* Spec: ECMAScript 402 API, PluralRules, 1.4.4.
|
||||
*/
|
||||
function Intl_PluralRules_resolvedOptions() {
|
||||
var internals = getPluralRulesInternals(this, "resolvedOptions");
|
||||
// Check "this PluralRules object" per introduction of section 1.4.
|
||||
if (!IsObject(this) || !IsPluralRules(this)) {
|
||||
ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, "PluralRules", "resolvedOptions",
|
||||
"PluralRules");
|
||||
}
|
||||
|
||||
var internals = getPluralRulesInternals(this);
|
||||
|
||||
var result = {
|
||||
locale: internals.locale,
|
||||
@ -3181,45 +3233,88 @@ function Intl_PluralRules_resolvedOptions() {
|
||||
}
|
||||
|
||||
|
||||
/********** Intl **********/
|
||||
|
||||
|
||||
/**
|
||||
* 8.2.1 Intl.getCanonicalLocales ( locales )
|
||||
*
|
||||
* ES2017 Intl draft rev 947aa9a0c853422824a0c9510d8f09be3eb416b9
|
||||
*/
|
||||
function Intl_getCanonicalLocales(locales) {
|
||||
let codes = CanonicalizeLocaleList(locales);
|
||||
let result = [];
|
||||
// Step 1.
|
||||
var localeList = CanonicalizeLocaleList(locales);
|
||||
|
||||
let len = codes.length;
|
||||
let k = 0;
|
||||
// Step 2 (Inlined CreateArrayFromList).
|
||||
var array = [];
|
||||
|
||||
while (k < len) {
|
||||
_DefineDataProperty(result, k, codes[k]);
|
||||
k++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
for (var n = 0, len = localeList.length; n < len; n++)
|
||||
_DefineDataProperty(array, n, localeList[n]);
|
||||
|
||||
function Intl_getCalendarInfo(locales) {
|
||||
const requestedLocales = CanonicalizeLocaleList(locales);
|
||||
|
||||
const DateTimeFormat = dateTimeFormatInternalProperties;
|
||||
const localeData = DateTimeFormat.localeData;
|
||||
|
||||
const localeOpt = new Record();
|
||||
localeOpt.localeMatcher = "best fit";
|
||||
|
||||
const r = ResolveLocale(callFunction(DateTimeFormat.availableLocales, DateTimeFormat),
|
||||
requestedLocales,
|
||||
localeOpt,
|
||||
DateTimeFormat.relevantExtensionKeys,
|
||||
localeData);
|
||||
|
||||
const result = intl_GetCalendarInfo(r.locale);
|
||||
result.calendar = r.ca;
|
||||
result.locale = r.locale;
|
||||
|
||||
return result;
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is a custom method designed after Intl API, but currently
|
||||
* not part of the spec or spec proposal.
|
||||
* This function is a custom function in the style of the standard Intl.*
|
||||
* functions, that isn't part of any spec or proposal yet.
|
||||
*
|
||||
* Returns an object with the following properties:
|
||||
* locale:
|
||||
* The actual resolved locale.
|
||||
*
|
||||
* calendar:
|
||||
* The default calendar of the resolved locale.
|
||||
*
|
||||
* firstDayOfWeek:
|
||||
* The first day of the week for the resolved locale.
|
||||
*
|
||||
* minDays:
|
||||
* The minimum number of days in a week for the resolved locale.
|
||||
*
|
||||
* weekendStart:
|
||||
* The day considered the beginning of a weekend for the resolved locale.
|
||||
*
|
||||
* weekendEnd:
|
||||
* The day considered the end of a weekend for the resolved locale.
|
||||
*
|
||||
* Days are encoded as integers in the range 1=Sunday to 7=Saturday.
|
||||
*/
|
||||
function Intl_getCalendarInfo(locales) {
|
||||
// 1. Let requestLocales be ? CanonicalizeLocaleList(locales).
|
||||
const requestedLocales = CanonicalizeLocaleList(locales);
|
||||
|
||||
const DateTimeFormat = dateTimeFormatInternalProperties;
|
||||
|
||||
// 2. Let localeData be %DateTimeFormat%.[[localeData]].
|
||||
const localeData = DateTimeFormat.localeData;
|
||||
|
||||
// 3. Let localeOpt be a new Record.
|
||||
const localeOpt = new Record();
|
||||
|
||||
// 4. Set localeOpt.[[localeMatcher]] to "best fit".
|
||||
localeOpt.localeMatcher = "best fit";
|
||||
|
||||
// 5. Let r be ResolveLocale(%DateTimeFormat%.[[availableLocales]],
|
||||
// requestedLocales, localeOpt,
|
||||
// %DateTimeFormat%.[[relevantExtensionKeys]], localeData).
|
||||
const r = ResolveLocale(callFunction(DateTimeFormat.availableLocales, DateTimeFormat),
|
||||
requestedLocales,
|
||||
localeOpt,
|
||||
DateTimeFormat.relevantExtensionKeys,
|
||||
localeData);
|
||||
|
||||
// 6. Let result be GetCalendarInfo(r.[[locale]]).
|
||||
const result = intl_GetCalendarInfo(r.locale);
|
||||
_DefineDataProperty(result, "calendar", r.ca);
|
||||
_DefineDataProperty(result, "locale", r.locale);
|
||||
|
||||
// 7. Return result.
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is a custom function in the style of the standard Intl.*
|
||||
* functions, that isn't part of any spec or proposal yet.
|
||||
* We want to use it internally to retrieve translated values from CLDR in
|
||||
* order to ensure they're aligned with what Intl API returns.
|
||||
*
|
||||
@ -3265,8 +3360,9 @@ function Intl_getDisplayNames(locales, options) {
|
||||
// 4. Let localeData be %DateTimeFormat%.[[localeData]].
|
||||
const localeData = DateTimeFormat.localeData;
|
||||
|
||||
// 5. Let opt be a new Record.
|
||||
// 5. Let localeOpt be a new Record.
|
||||
const localeOpt = new Record();
|
||||
|
||||
// 6. Set localeOpt.[[localeMatcher]] to "best fit".
|
||||
localeOpt.localeMatcher = "best fit";
|
||||
|
||||
@ -3280,6 +3376,7 @@ function Intl_getDisplayNames(locales, options) {
|
||||
|
||||
// 8. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow" », "long").
|
||||
const style = GetOption(options, "style", "string", ["long", "short", "narrow"], "long");
|
||||
|
||||
// 9. Let keys be ? Get(options, "keys").
|
||||
let keys = options.keys;
|
||||
|
||||
@ -3298,8 +3395,10 @@ function Intl_getDisplayNames(locales, options) {
|
||||
// |intl_ComputeDisplayNames| may infallibly access the list's length via
|
||||
// |ArrayObject::length|.)
|
||||
let processedKeys = [];
|
||||
|
||||
// 13. Let len be ? ToLength(? Get(keys, "length")).
|
||||
let len = ToLength(keys.length);
|
||||
|
||||
// 14. Let i be 0.
|
||||
// 15. Repeat, while i < len
|
||||
for (let i = 0; i < len; i++) {
|
||||
|
@ -124,4 +124,6 @@
|
||||
#define STRING_GENERICS_TRIM_RIGHT 23
|
||||
#define STRING_GENERICS_METHODS_LIMIT 24
|
||||
|
||||
#define INTL_INTERNALS_OBJECT_SLOT 0
|
||||
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ const JSFunctionSpec SymbolObject::staticMethods[] = {
|
||||
};
|
||||
|
||||
JSObject*
|
||||
SymbolObject::initClass(JSContext* cx, HandleObject obj)
|
||||
SymbolObject::initClass(JSContext* cx, HandleObject obj, bool defineMembers)
|
||||
{
|
||||
Handle<GlobalObject*> global = obj.as<GlobalObject>();
|
||||
|
||||
@ -66,25 +66,33 @@ SymbolObject::initClass(JSContext* cx, HandleObject obj)
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
// Define the well-known symbol properties, such as Symbol.iterator.
|
||||
ImmutablePropertyNamePtr* names = cx->names().wellKnownSymbolNames();
|
||||
RootedValue value(cx);
|
||||
unsigned attrs = JSPROP_READONLY | JSPROP_PERMANENT;
|
||||
WellKnownSymbols* wks = cx->runtime()->wellKnownSymbols;
|
||||
for (size_t i = 0; i < JS::WellKnownSymbolLimit; i++) {
|
||||
value.setSymbol(wks->get(i));
|
||||
if (!NativeDefineProperty(cx, ctor, names[i], value, nullptr, nullptr, attrs))
|
||||
return nullptr;
|
||||
if (defineMembers) {
|
||||
// Define the well-known symbol properties, such as Symbol.iterator.
|
||||
ImmutablePropertyNamePtr* names = cx->names().wellKnownSymbolNames();
|
||||
RootedValue value(cx);
|
||||
unsigned attrs = JSPROP_READONLY | JSPROP_PERMANENT;
|
||||
WellKnownSymbols* wks = cx->runtime()->wellKnownSymbols;
|
||||
for (size_t i = 0; i < JS::WellKnownSymbolLimit; i++) {
|
||||
value.setSymbol(wks->get(i));
|
||||
if (!NativeDefineProperty(cx, ctor, names[i], value, nullptr, nullptr, attrs))
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto) ||
|
||||
!DefinePropertiesAndFunctions(cx, proto, properties, methods) ||
|
||||
!DefineToStringTag(cx, proto, cx->names().Symbol) ||
|
||||
!DefinePropertiesAndFunctions(cx, ctor, nullptr, staticMethods) ||
|
||||
!GlobalObject::initBuiltinConstructor(cx, global, JSProto_Symbol, ctor, proto))
|
||||
{
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||
return nullptr;
|
||||
|
||||
if (defineMembers) {
|
||||
if (!DefinePropertiesAndFunctions(cx, proto, properties, methods) ||
|
||||
!DefineToStringTag(cx, proto, cx->names().Symbol) ||
|
||||
!DefinePropertiesAndFunctions(cx, ctor, nullptr, staticMethods))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_Symbol, ctor, proto))
|
||||
return nullptr;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@ -230,5 +238,11 @@ SymbolObject::toPrimitive(JSContext* cx, unsigned argc, Value* vp)
|
||||
JSObject*
|
||||
js::InitSymbolClass(JSContext* cx, HandleObject obj)
|
||||
{
|
||||
return SymbolObject::initClass(cx, obj);
|
||||
return SymbolObject::initClass(cx, obj, true);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
js::InitBareSymbolCtor(JSContext* cx, HandleObject obj)
|
||||
{
|
||||
return SymbolObject::initClass(cx, obj, false);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class SymbolObject : public NativeObject
|
||||
|
||||
static const Class class_;
|
||||
|
||||
static JSObject* initClass(JSContext* cx, js::HandleObject obj);
|
||||
static JSObject* initClass(JSContext* cx, js::HandleObject obj, bool defineMembers);
|
||||
|
||||
/*
|
||||
* Creates a new Symbol object boxing the given primitive Symbol. The
|
||||
@ -60,6 +60,9 @@ class SymbolObject : public NativeObject
|
||||
extern JSObject*
|
||||
InitSymbolClass(JSContext* cx, HandleObject obj);
|
||||
|
||||
extern JSObject*
|
||||
InitBareSymbolCtor(JSContext* cx, HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* builtin_SymbolObject_h */
|
||||
|
@ -43,6 +43,8 @@
|
||||
// Do not create an alias to a self-hosted builtin, otherwise it will be cloned
|
||||
// twice.
|
||||
//
|
||||
// Symbol is a bare constructor without properties or methods.
|
||||
var std_Symbol = Symbol;
|
||||
// WeakMap is a bare constructor without properties or methods.
|
||||
var std_WeakMap = WeakMap;
|
||||
// StopIteration is a bare constructor without properties or methods.
|
||||
|
@ -2365,6 +2365,9 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
|
||||
}
|
||||
|
||||
case StatementKind::ForOfLoop:
|
||||
if (!flushPops(bce_))
|
||||
return false;
|
||||
|
||||
// The iterator and the current value are on the stack.
|
||||
//
|
||||
if (emitIteratorClose) {
|
||||
@ -2384,6 +2387,9 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
|
||||
break;
|
||||
|
||||
case StatementKind::ForInLoop:
|
||||
if (!flushPops(bce_))
|
||||
return false;
|
||||
|
||||
// The iterator and the current value are on the stack.
|
||||
if (!bce_->emit1(JSOP_POP)) // ... ITER
|
||||
return false;
|
||||
|
@ -15,6 +15,7 @@ for (var i = 0; i < 3; i++) {
|
||||
x.toString();
|
||||
assertEq(0, 1);
|
||||
} catch (e) {
|
||||
assertEq(e.message, "y is undefined");
|
||||
assertEq(e.message === "y is undefined" ||
|
||||
e.message === "undefined has no properties", true);
|
||||
}
|
||||
}
|
||||
|
@ -2032,8 +2032,8 @@ TryAttachNativeInStub(JSContext* cx, HandleScript outerScript, ICIn_Fallback* st
|
||||
RootedPropertyName name(cx, JSID_TO_ATOM(id)->asPropertyName());
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
RootedObject holder(cx);
|
||||
if (!EffectlesslyLookupProperty(cx, obj, id, &holder, &prop))
|
||||
return false;
|
||||
if (!LookupPropertyPure(cx, obj, id, holder.address(), prop.address()))
|
||||
return true;
|
||||
|
||||
if (prop.isNonNativeProperty()) {
|
||||
MOZ_ASSERT(!IsCacheableProtoChain(obj, holder, false));
|
||||
@ -2561,8 +2561,8 @@ TryAttachSetValuePropStub(JSContext* cx, HandleScript script, jsbytecode* pc, IC
|
||||
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
RootedObject holder(cx);
|
||||
if (!EffectlesslyLookupProperty(cx, obj, id, &holder, &prop))
|
||||
return false;
|
||||
if (!LookupPropertyPure(cx, obj, id, holder.address(), prop.address()))
|
||||
return true;
|
||||
if (obj != holder)
|
||||
return true;
|
||||
|
||||
|
@ -28,6 +28,11 @@
|
||||
_(AtomicsXor) \
|
||||
_(AtomicsIsLockFree) \
|
||||
\
|
||||
_(IntlIsCollator) \
|
||||
_(IntlIsDateTimeFormat) \
|
||||
_(IntlIsNumberFormat) \
|
||||
_(IntlIsPluralRules) \
|
||||
\
|
||||
_(MathAbs) \
|
||||
_(MathFloor) \
|
||||
_(MathCeil) \
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "jsstr.h"
|
||||
|
||||
#include "builtin/AtomicsObject.h"
|
||||
#include "builtin/Intl.h"
|
||||
#include "builtin/SIMD.h"
|
||||
#include "builtin/TestingFunctions.h"
|
||||
#include "builtin/TypedObject.h"
|
||||
@ -107,6 +108,16 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
|
||||
case InlinableNative::AtomicsIsLockFree:
|
||||
return inlineAtomicsIsLockFree(callInfo);
|
||||
|
||||
// Intl natives.
|
||||
case InlinableNative::IntlIsCollator:
|
||||
return inlineHasClass(callInfo, &CollatorObject::class_);
|
||||
case InlinableNative::IntlIsDateTimeFormat:
|
||||
return inlineHasClass(callInfo, &DateTimeFormatObject::class_);
|
||||
case InlinableNative::IntlIsNumberFormat:
|
||||
return inlineHasClass(callInfo, &NumberFormatObject::class_);
|
||||
case InlinableNative::IntlIsPluralRules:
|
||||
return inlineHasClass(callInfo, &PluralRulesObject::class_);
|
||||
|
||||
// Math natives.
|
||||
case InlinableNative::MathAbs:
|
||||
return inlineMathAbs(callInfo);
|
||||
|
@ -1965,24 +1965,6 @@ GetDOMProxyProto(JSObject* obj)
|
||||
return obj->staticPrototype();
|
||||
}
|
||||
|
||||
// Look up a property's shape on an object, being careful never to do any effectful
|
||||
// operations. This procedure not yielding a shape should not be taken as a lack of
|
||||
// existence of the property on the object.
|
||||
bool
|
||||
EffectlesslyLookupProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject holder, MutableHandle<PropertyResult> prop)
|
||||
{
|
||||
prop.setNotFound();
|
||||
holder.set(nullptr);
|
||||
|
||||
if (LookupPropertyPure(cx, obj, id, holder.address(), prop.address()))
|
||||
return true;
|
||||
|
||||
holder.set(nullptr);
|
||||
prop.setNotFound();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
IsCacheableProtoChain(JSObject* obj, JSObject* holder, bool isDOMProxy)
|
||||
{
|
||||
|
@ -2254,14 +2254,6 @@ IsPreliminaryObject(JSObject* obj);
|
||||
void
|
||||
StripPreliminaryObjectStubs(JSContext* cx, ICFallbackStub* stub);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
EffectlesslyLookupProperty(JSContext* cx, HandleObject obj, HandleId name,
|
||||
MutableHandleObject holder, MutableHandleShape shape);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
EffectlesslyLookupProperty(JSContext* cx, HandleObject obj, HandleId name,
|
||||
MutableHandleObject holder, MutableHandle<PropertyResult> prop);
|
||||
|
||||
JSObject*
|
||||
GetDOMProxyProto(JSObject* obj);
|
||||
|
||||
|
@ -474,7 +474,6 @@ MSG_DEF(JSMSG_TRACELOGGER_ENABLE_FAIL, 1, JSEXN_ERR, "enabling tracelogger faile
|
||||
MSG_DEF(JSMSG_DATE_NOT_FINITE, 0, JSEXN_RANGEERR, "date value is not finite in DateTimeFormat.format()")
|
||||
MSG_DEF(JSMSG_INTERNAL_INTL_ERROR, 0, JSEXN_ERR, "internal error while computing Intl data")
|
||||
MSG_DEF(JSMSG_INTL_OBJECT_NOT_INITED, 3, JSEXN_TYPEERR, "Intl.{0}.prototype.{1} called on value that's not an object initialized as a {2}")
|
||||
MSG_DEF(JSMSG_INTL_OBJECT_REINITED, 0, JSEXN_TYPEERR, "can't initialize object twice as an object of an Intl constructor")
|
||||
MSG_DEF(JSMSG_INVALID_CURRENCY_CODE, 1, JSEXN_RANGEERR, "invalid currency code in NumberFormat(): {0}")
|
||||
MSG_DEF(JSMSG_INVALID_DIGITS_VALUE, 1, JSEXN_RANGEERR, "invalid digits value: {0}")
|
||||
MSG_DEF(JSMSG_INVALID_KEYS_TYPE, 0, JSEXN_TYPEERR, "calendar info keys must be an object or undefined")
|
||||
|
@ -2118,10 +2118,6 @@ bool
|
||||
js::LookupProperty(JSContext* cx, HandleObject obj, js::HandleId id,
|
||||
MutableHandleObject objp, MutableHandle<PropertyResult> propp)
|
||||
{
|
||||
/* NB: The logic of lookupProperty is implicitly reflected in
|
||||
* BaselineIC.cpp's |EffectlesslyLookupProperty| logic.
|
||||
* If this changes, please remember to update the logic there as well.
|
||||
*/
|
||||
if (LookupPropertyOp op = obj->getOpsLookupProperty())
|
||||
return op(cx, obj, id, objp, propp);
|
||||
return LookupPropertyInline<CanGC>(cx, obj.as<NativeObject>(), id, objp, propp);
|
||||
|
@ -736,11 +736,6 @@ case "$target" in
|
||||
# We use offsetof on non-POD objects all the time.
|
||||
# We also suppress this warning on other platforms.
|
||||
CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
|
||||
# MFBT thinks clang-cl supports constexpr, which it does, but
|
||||
# not everything in Windows C++ headers supports constexpr
|
||||
# as we might expect until MSVC 2015, so turn off this warning
|
||||
# for now.
|
||||
CXXFLAGS="$CXXFLAGS -Wno-invalid-constexpr"
|
||||
# This warns for reasonable things like:
|
||||
# enum { X = 0xffffffffU };
|
||||
# which is annoying for IDL headers.
|
||||
@ -787,10 +782,8 @@ case "$target" in
|
||||
# At least one MSVC header and several headers in-tree have
|
||||
# unused typedefs, so turn this on.
|
||||
CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
|
||||
# Several JS engine header files use __declspec(dllimport) on
|
||||
# classes, and clang-cl helpfully warns about its non-support
|
||||
# for such cases. We're not particularly worried about that,
|
||||
# so ignore that warning.
|
||||
# jemalloc uses __declspec(allocator) as a profiler hint,
|
||||
# which clang-cl doesn't understand.
|
||||
CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
|
||||
fi
|
||||
# make 'foo == bar;' error out
|
||||
|
69
js/src/tests/Intl/Collator/call.js
Normal file
@ -0,0 +1,69 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
|
||||
function IsConstructor(o) {
|
||||
try {
|
||||
new (new Proxy(o, {construct: () => ({})}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function IsObject(o) {
|
||||
return Object(o) === o;
|
||||
}
|
||||
|
||||
function thisValues() {
|
||||
const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsConstructor);
|
||||
|
||||
return [
|
||||
// Primitive values.
|
||||
...[undefined, null, true, "abc", Symbol(), 123],
|
||||
|
||||
// Object values.
|
||||
...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],
|
||||
|
||||
// Intl objects.
|
||||
...[].concat(...intlConstructors.map(ctor => [
|
||||
// Instance of an Intl constructor.
|
||||
new ctor(),
|
||||
|
||||
// Instance of a subclassed Intl constructor.
|
||||
new class extends ctor {},
|
||||
|
||||
// Object inheriting from an Intl constructor prototype.
|
||||
Object.create(ctor.prototype),
|
||||
|
||||
// Intl object not inheriting from its default prototype.
|
||||
Object.setPrototypeOf(new ctor(), Object.prototype),
|
||||
])),
|
||||
];
|
||||
}
|
||||
|
||||
// Invoking [[Call]] for Intl.Collator always returns a new Collator instance.
|
||||
for (let thisValue of thisValues()) {
|
||||
let obj = Intl.Collator.call(thisValue);
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.Collator, true);
|
||||
|
||||
// Ensure Intl.[[FallbackSymbol]] wasn't installed on |thisValue|.
|
||||
if (IsObject(thisValue))
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
}
|
||||
|
||||
// Intl.Collator doesn't use the legacy Intl constructor compromise semantics.
|
||||
for (let thisValue of thisValues()) {
|
||||
// Ensure instanceof operator isn't invoked for Intl.Collator.
|
||||
Object.defineProperty(Intl.Collator, Symbol.hasInstance, {
|
||||
get() {
|
||||
assertEq(false, true, "@@hasInstance operator called");
|
||||
}, configurable: true
|
||||
});
|
||||
let obj = Intl.Collator.call(thisValue);
|
||||
delete Intl.Collator[Symbol.hasInstance];
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.Collator, true);
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
167
js/src/tests/Intl/DateTimeFormat/call.js
Normal file
@ -0,0 +1,167 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
|
||||
function IsConstructor(o) {
|
||||
try {
|
||||
new (new Proxy(o, {construct: () => ({})}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function IsObject(o) {
|
||||
return Object(o) === o;
|
||||
}
|
||||
|
||||
function thisValues() {
|
||||
const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsConstructor);
|
||||
|
||||
return [
|
||||
// Primitive values.
|
||||
...[undefined, null, true, "abc", Symbol(), 123],
|
||||
|
||||
// Object values.
|
||||
...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],
|
||||
|
||||
// Intl objects.
|
||||
...[].concat(...intlConstructors.map(ctor => [
|
||||
// Instance of an Intl constructor.
|
||||
new ctor(),
|
||||
|
||||
// Instance of a subclassed Intl constructor.
|
||||
new class extends ctor {},
|
||||
|
||||
// Object inheriting from an Intl constructor prototype.
|
||||
Object.create(ctor.prototype),
|
||||
|
||||
// Intl object not inheriting from its default prototype.
|
||||
Object.setPrototypeOf(new ctor(), Object.prototype),
|
||||
])),
|
||||
];
|
||||
}
|
||||
|
||||
const intlFallbackSymbol = Object.getOwnPropertySymbols(Intl.DateTimeFormat.call(Object.create(Intl.DateTimeFormat.prototype)))[0];
|
||||
|
||||
// Invoking [[Call]] for Intl.DateTimeFormat returns a new instance unless called
|
||||
// with an instance inheriting from Intl.DateTimeFormat.prototype.
|
||||
for (let thisValue of thisValues()) {
|
||||
let obj = Intl.DateTimeFormat.call(thisValue);
|
||||
|
||||
if (!Intl.DateTimeFormat.prototype.isPrototypeOf(thisValue)) {
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.DateTimeFormat, true);
|
||||
if (IsObject(thisValue))
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
} else {
|
||||
assertEq(Object.is(obj, thisValue), true);
|
||||
assertEq(obj instanceof Intl.DateTimeFormat, true);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
}
|
||||
|
||||
// Intl.DateTimeFormat uses the legacy Intl constructor compromise semantics.
|
||||
// - Test when InstanceofOperator(thisValue, %DateTimeFormat%) returns true.
|
||||
for (let thisValue of thisValues()) {
|
||||
let hasInstanceCalled = false;
|
||||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
|
||||
value() {
|
||||
assertEq(hasInstanceCalled, false);
|
||||
hasInstanceCalled = true;
|
||||
return true;
|
||||
}, configurable: true
|
||||
});
|
||||
if (!IsObject(thisValue)) {
|
||||
// A TypeError is thrown when Intl.DateTimeFormat tries to install the
|
||||
// [[FallbackSymbol]] property on |thisValue|.
|
||||
assertThrowsInstanceOf(() => Intl.DateTimeFormat.call(thisValue), TypeError);
|
||||
delete Intl.DateTimeFormat[Symbol.hasInstance];
|
||||
} else {
|
||||
let obj = Intl.DateTimeFormat.call(thisValue);
|
||||
delete Intl.DateTimeFormat[Symbol.hasInstance];
|
||||
assertEq(Object.is(obj, thisValue), true);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
assertEq(hasInstanceCalled, true);
|
||||
}
|
||||
// - Test when InstanceofOperator(thisValue, %DateTimeFormat%) returns false.
|
||||
for (let thisValue of thisValues()) {
|
||||
let hasInstanceCalled = false;
|
||||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
|
||||
value() {
|
||||
assertEq(hasInstanceCalled, false);
|
||||
hasInstanceCalled = true;
|
||||
return false;
|
||||
}, configurable: true
|
||||
});
|
||||
let obj = Intl.DateTimeFormat.call(thisValue);
|
||||
delete Intl.DateTimeFormat[Symbol.hasInstance];
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.DateTimeFormat, true);
|
||||
if (IsObject(thisValue))
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
assertEq(hasInstanceCalled, true);
|
||||
}
|
||||
|
||||
// Throws an error when attempting to install [[FallbackSymbol]] twice.
|
||||
{
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
|
||||
assertEq(Intl.DateTimeFormat.call(thisValue), thisValue);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
|
||||
assertThrowsInstanceOf(() => Intl.DateTimeFormat.call(thisValue), TypeError);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
|
||||
// Throws an error when the thisValue is non-extensible.
|
||||
{
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
Object.preventExtensions(thisValue);
|
||||
|
||||
assertThrowsInstanceOf(() => Intl.DateTimeFormat.call(thisValue), TypeError);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
}
|
||||
|
||||
// [[FallbackSymbol]] is installed as a frozen property holding an Intl.DateTimeFormat instance.
|
||||
{
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
Intl.DateTimeFormat.call(thisValue);
|
||||
|
||||
let desc = Object.getOwnPropertyDescriptor(thisValue, intlFallbackSymbol);
|
||||
assertEq(desc !== undefined, true);
|
||||
assertEq(desc.writable, false);
|
||||
assertEq(desc.enumerable, false);
|
||||
assertEq(desc.configurable, false);
|
||||
assertEq(desc.value instanceof Intl.DateTimeFormat, true);
|
||||
}
|
||||
|
||||
// Ensure [[FallbackSymbol]] is installed last by changing the [[Prototype]]
|
||||
// during initialization.
|
||||
{
|
||||
let thisValue = {};
|
||||
let options = {
|
||||
get hour12() {
|
||||
Object.setPrototypeOf(thisValue, Intl.DateTimeFormat.prototype);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let obj = Intl.DateTimeFormat.call(thisValue, undefined, options);
|
||||
assertEq(Object.is(obj, thisValue), true);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
{
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
let options = {
|
||||
get hour12() {
|
||||
Object.setPrototypeOf(thisValue, Object.prototype);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let obj = Intl.DateTimeFormat.call(thisValue, undefined, options);
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
224
js/src/tests/Intl/DateTimeFormat/unwrapping.js
Normal file
@ -0,0 +1,224 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
|
||||
// Test UnwrapDateTimeFormat operation.
|
||||
|
||||
const dateTimeFormatFunctions = [];
|
||||
dateTimeFormatFunctions.push(Intl.DateTimeFormat.prototype.resolvedOptions);
|
||||
dateTimeFormatFunctions.push(Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, "format").get);
|
||||
dateTimeFormatFunctions.push(Intl.DateTimeFormat.prototype.formatToParts);
|
||||
|
||||
function IsConstructor(o) {
|
||||
try {
|
||||
new (new Proxy(o, {construct: () => ({})}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function IsObject(o) {
|
||||
return Object(o) === o;
|
||||
}
|
||||
|
||||
function intlObjects(ctor) {
|
||||
return [
|
||||
// Instance of an Intl constructor.
|
||||
new ctor(),
|
||||
|
||||
// Instance of a subclassed Intl constructor.
|
||||
new class extends ctor {},
|
||||
|
||||
// Intl object not inheriting from its default prototype.
|
||||
Object.setPrototypeOf(new ctor(), Object.prototype),
|
||||
];
|
||||
}
|
||||
|
||||
function thisValues(C) {
|
||||
const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsConstructor);
|
||||
|
||||
return [
|
||||
// Primitive values.
|
||||
...[undefined, null, true, "abc", Symbol(), 123],
|
||||
|
||||
// Object values.
|
||||
...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],
|
||||
|
||||
// Intl objects.
|
||||
...[].concat(...intlConstructors.filter(ctor => ctor !== C).map(intlObjects)),
|
||||
|
||||
// Object inheriting from an Intl constructor prototype.
|
||||
...intlConstructors.map(ctor => Object.create(ctor.prototype)),
|
||||
];
|
||||
}
|
||||
|
||||
const intlFallbackSymbol = Object.getOwnPropertySymbols(Intl.DateTimeFormat.call(Object.create(Intl.DateTimeFormat.prototype)))[0];
|
||||
|
||||
// Test Intl.DateTimeFormat.prototype methods.
|
||||
for (let dateTimeFormatFunction of dateTimeFormatFunctions) {
|
||||
// Test a TypeError is thrown when the this-value isn't an initialized
|
||||
// Intl.DateTimeFormat instance.
|
||||
for (let thisValue of thisValues(Intl.DateTimeFormat)) {
|
||||
assertThrowsInstanceOf(() => dateTimeFormatFunction.call(thisValue), TypeError);
|
||||
}
|
||||
|
||||
// And test no error is thrown for initialized Intl.DateTimeFormat instances.
|
||||
for (let thisValue of intlObjects(Intl.DateTimeFormat)) {
|
||||
dateTimeFormatFunction.call(thisValue);
|
||||
}
|
||||
|
||||
// Manually add [[FallbackSymbol]] to objects and then repeat the tests from above.
|
||||
for (let thisValue of thisValues(Intl.DateTimeFormat)) {
|
||||
assertThrowsInstanceOf(() => dateTimeFormatFunction.call({
|
||||
__proto__: Intl.DateTimeFormat.prototype,
|
||||
[intlFallbackSymbol]: thisValue,
|
||||
}), TypeError);
|
||||
}
|
||||
|
||||
for (let thisValue of intlObjects(Intl.DateTimeFormat)) {
|
||||
dateTimeFormatFunction.call({
|
||||
__proto__: Intl.DateTimeFormat.prototype,
|
||||
[intlFallbackSymbol]: thisValue,
|
||||
});
|
||||
}
|
||||
|
||||
// Ensure [[FallbackSymbol]] isn't retrieved for Intl.DateTimeFormat instances.
|
||||
for (let thisValue of intlObjects(Intl.DateTimeFormat)) {
|
||||
Object.defineProperty(thisValue, intlFallbackSymbol, {
|
||||
get() { assertEq(false, true); }
|
||||
});
|
||||
dateTimeFormatFunction.call(thisValue);
|
||||
}
|
||||
|
||||
// Ensure [[FallbackSymbol]] is only retrieved for objects inheriting from Intl.DateTimeFormat.prototype.
|
||||
for (let thisValue of thisValues(Intl.DateTimeFormat)) {
|
||||
if (!IsObject(thisValue) || Intl.DateTimeFormat.prototype.isPrototypeOf(thisValue))
|
||||
continue;
|
||||
Object.defineProperty(thisValue, intlFallbackSymbol, {
|
||||
get() { assertEq(false, true); }
|
||||
});
|
||||
assertThrowsInstanceOf(() => dateTimeFormatFunction.call(thisValue), TypeError);
|
||||
}
|
||||
|
||||
// Repeat the test from above, but also change Intl.DateTimeFormat[@@hasInstance]
|
||||
// so it always returns |null|.
|
||||
for (let thisValue of thisValues(Intl.DateTimeFormat)) {
|
||||
let hasInstanceCalled = false, symbolGetterCalled = false;
|
||||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
|
||||
value() {
|
||||
assertEq(hasInstanceCalled, false);
|
||||
hasInstanceCalled = true;
|
||||
return true;
|
||||
}, configurable: true
|
||||
});
|
||||
let isUndefinedOrNull = thisValue !== undefined || thisValue !== null;
|
||||
let symbolHolder;
|
||||
if (!isUndefinedOrNull) {
|
||||
symbolHolder = IsObject(thisValue) ? thisValue : Object.getPrototypeOf(thisValue);
|
||||
Object.defineProperty(symbolHolder, intlFallbackSymbol, {
|
||||
get() {
|
||||
assertEq(symbolGetterCalled, false);
|
||||
symbolGetterCalled = true;
|
||||
return null;
|
||||
}, configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
assertThrowsInstanceOf(() => dateTimeFormatFunction.call(thisValue), TypeError);
|
||||
|
||||
delete Intl.DateTimeFormat[Symbol.hasInstance];
|
||||
if (!isUndefinedOrNull && !IsObject(thisValue))
|
||||
delete symbolHolder[intlFallbackSymbol];
|
||||
|
||||
assertEq(hasInstanceCalled, true);
|
||||
assertEq(symbolGetterCalled, !isUndefinedOrNull);
|
||||
}
|
||||
}
|
||||
|
||||
// Test format() returns the correct result for objects initialized as Intl.DateTimeFormat instances.
|
||||
{
|
||||
// An actual Intl.DateTimeFormat instance.
|
||||
let dateTimeFormat = new Intl.DateTimeFormat();
|
||||
|
||||
// An object initialized as a DateTimeFormat instance.
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
Intl.DateTimeFormat.call(thisValue);
|
||||
|
||||
// Object with [[FallbackSymbol]] set to DateTimeFormat instance.
|
||||
let fakeObj = {
|
||||
__proto__: Intl.DateTimeFormat.prototype,
|
||||
[intlFallbackSymbol]: dateTimeFormat,
|
||||
};
|
||||
|
||||
for (let number of [0, Date.now(), -Date.now()]) {
|
||||
let expected = dateTimeFormat.format(number);
|
||||
assertEq(thisValue.format(number), expected);
|
||||
assertEq(thisValue[intlFallbackSymbol].format(number), expected);
|
||||
assertEq(fakeObj.format(number), expected);
|
||||
}
|
||||
}
|
||||
|
||||
// Test formatToParts() returns the correct result for objects initialized as Intl.DateTimeFormat instances.
|
||||
if ("formatToParts" in Intl.DateTimeFormat.prototype) {
|
||||
// An actual Intl.DateTimeFormat instance.
|
||||
let dateTimeFormat = new Intl.DateTimeFormat();
|
||||
|
||||
// An object initialized as a DateTimeFormat instance.
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
Intl.DateTimeFormat.call(thisValue);
|
||||
|
||||
// Object with [[FallbackSymbol]] set to DateTimeFormat instance.
|
||||
let fakeObj = {
|
||||
__proto__: Intl.DateTimeFormat.prototype,
|
||||
[intlFallbackSymbol]: dateTimeFormat,
|
||||
};
|
||||
|
||||
function assertEqParts(actual, expected) {
|
||||
assertEq(actual.length, expected.length, "parts count mismatch");
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
assertEq(actual[i].type, expected[i].type, "type mismatch at " + i);
|
||||
assertEq(actual[i].value, expected[i].value, "value mismatch at " + i);
|
||||
}
|
||||
}
|
||||
|
||||
for (let number of [0, Date.now(), -Date.now()]) {
|
||||
let expected = dateTimeFormat.formatToParts(number);
|
||||
assertEqParts(thisValue.formatToParts(number), expected);
|
||||
assertEqParts(thisValue[intlFallbackSymbol].formatToParts(number), expected);
|
||||
assertEqParts(fakeObj.formatToParts(number), expected);
|
||||
}
|
||||
}
|
||||
|
||||
// Test resolvedOptions() returns the same results.
|
||||
{
|
||||
// An actual Intl.DateTimeFormat instance.
|
||||
let dateTimeFormat = new Intl.DateTimeFormat();
|
||||
|
||||
// An object initialized as a DateTimeFormat instance.
|
||||
let thisValue = Object.create(Intl.DateTimeFormat.prototype);
|
||||
Intl.DateTimeFormat.call(thisValue);
|
||||
|
||||
// Object with [[FallbackSymbol]] set to DateTimeFormat instance.
|
||||
let fakeObj = {
|
||||
__proto__: Intl.DateTimeFormat.prototype,
|
||||
[intlFallbackSymbol]: dateTimeFormat,
|
||||
};
|
||||
|
||||
function assertEqOptions(actual, expected) {
|
||||
actual = Object.entries(actual);
|
||||
expected = Object.entries(expected);
|
||||
|
||||
assertEq(actual.length, expected.length, "options count mismatch");
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
assertEq(actual[i][0], expected[i][0], "key mismatch at " + i);
|
||||
assertEq(actual[i][1], expected[i][1], "value mismatch at " + i);
|
||||
}
|
||||
}
|
||||
|
||||
let expected = dateTimeFormat.resolvedOptions();
|
||||
assertEqOptions(thisValue.resolvedOptions(), expected);
|
||||
assertEqOptions(thisValue[intlFallbackSymbol].resolvedOptions(), expected);
|
||||
assertEqOptions(fakeObj.resolvedOptions(), expected);
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
167
js/src/tests/Intl/NumberFormat/call.js
Normal file
@ -0,0 +1,167 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
|
||||
function IsConstructor(o) {
|
||||
try {
|
||||
new (new Proxy(o, {construct: () => ({})}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function IsObject(o) {
|
||||
return Object(o) === o;
|
||||
}
|
||||
|
||||
function thisValues() {
|
||||
const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsConstructor);
|
||||
|
||||
return [
|
||||
// Primitive values.
|
||||
...[undefined, null, true, "abc", Symbol(), 123],
|
||||
|
||||
// Object values.
|
||||
...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],
|
||||
|
||||
// Intl objects.
|
||||
...[].concat(...intlConstructors.map(ctor => [
|
||||
// Instance of an Intl constructor.
|
||||
new ctor(),
|
||||
|
||||
// Instance of a subclassed Intl constructor.
|
||||
new class extends ctor {},
|
||||
|
||||
// Object inheriting from an Intl constructor prototype.
|
||||
Object.create(ctor.prototype),
|
||||
|
||||
// Intl object not inheriting from its default prototype.
|
||||
Object.setPrototypeOf(new ctor(), Object.prototype),
|
||||
])),
|
||||
];
|
||||
}
|
||||
|
||||
const intlFallbackSymbol = Object.getOwnPropertySymbols(Intl.NumberFormat.call(Object.create(Intl.NumberFormat.prototype)))[0];
|
||||
|
||||
// Invoking [[Call]] for Intl.NumberFormat returns a new instance unless called
|
||||
// with an instance inheriting from Intl.NumberFormat.prototype.
|
||||
for (let thisValue of thisValues()) {
|
||||
let obj = Intl.NumberFormat.call(thisValue);
|
||||
|
||||
if (!Intl.NumberFormat.prototype.isPrototypeOf(thisValue)) {
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.NumberFormat, true);
|
||||
if (IsObject(thisValue))
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
} else {
|
||||
assertEq(Object.is(obj, thisValue), true);
|
||||
assertEq(obj instanceof Intl.NumberFormat, true);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
}
|
||||
|
||||
// Intl.NumberFormat uses the legacy Intl constructor compromise semantics.
|
||||
// - Test when InstanceofOperator(thisValue, %NumberFormat%) returns true.
|
||||
for (let thisValue of thisValues()) {
|
||||
let hasInstanceCalled = false;
|
||||
Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, {
|
||||
value() {
|
||||
assertEq(hasInstanceCalled, false);
|
||||
hasInstanceCalled = true;
|
||||
return true;
|
||||
}, configurable: true
|
||||
});
|
||||
if (!IsObject(thisValue)) {
|
||||
// A TypeError is thrown when Intl.NumberFormat tries to install the
|
||||
// [[FallbackSymbol]] property on |thisValue|.
|
||||
assertThrowsInstanceOf(() => Intl.NumberFormat.call(thisValue), TypeError);
|
||||
delete Intl.NumberFormat[Symbol.hasInstance];
|
||||
} else {
|
||||
let obj = Intl.NumberFormat.call(thisValue);
|
||||
delete Intl.NumberFormat[Symbol.hasInstance];
|
||||
assertEq(Object.is(obj, thisValue), true);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
assertEq(hasInstanceCalled, true);
|
||||
}
|
||||
// - Test when InstanceofOperator(thisValue, %NumberFormat%) returns false.
|
||||
for (let thisValue of thisValues()) {
|
||||
let hasInstanceCalled = false;
|
||||
Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, {
|
||||
value() {
|
||||
assertEq(hasInstanceCalled, false);
|
||||
hasInstanceCalled = true;
|
||||
return false;
|
||||
}, configurable: true
|
||||
});
|
||||
let obj = Intl.NumberFormat.call(thisValue);
|
||||
delete Intl.NumberFormat[Symbol.hasInstance];
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.NumberFormat, true);
|
||||
if (IsObject(thisValue))
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
assertEq(hasInstanceCalled, true);
|
||||
}
|
||||
|
||||
// Throws an error when attempting to install [[FallbackSymbol]] twice.
|
||||
{
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
|
||||
assertEq(Intl.NumberFormat.call(thisValue), thisValue);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
|
||||
assertThrowsInstanceOf(() => Intl.NumberFormat.call(thisValue), TypeError);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
|
||||
// Throws an error when the thisValue is non-extensible.
|
||||
{
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
Object.preventExtensions(thisValue);
|
||||
|
||||
assertThrowsInstanceOf(() => Intl.NumberFormat.call(thisValue), TypeError);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
}
|
||||
|
||||
// [[FallbackSymbol]] is installed as a frozen property holding an Intl.NumberFormat instance.
|
||||
{
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
Intl.NumberFormat.call(thisValue);
|
||||
|
||||
let desc = Object.getOwnPropertyDescriptor(thisValue, intlFallbackSymbol);
|
||||
assertEq(desc !== undefined, true);
|
||||
assertEq(desc.writable, false);
|
||||
assertEq(desc.enumerable, false);
|
||||
assertEq(desc.configurable, false);
|
||||
assertEq(desc.value instanceof Intl.NumberFormat, true);
|
||||
}
|
||||
|
||||
// Ensure [[FallbackSymbol]] is installed last by changing the [[Prototype]]
|
||||
// during initialization.
|
||||
{
|
||||
let thisValue = {};
|
||||
let options = {
|
||||
get useGrouping() {
|
||||
Object.setPrototypeOf(thisValue, Intl.NumberFormat.prototype);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let obj = Intl.NumberFormat.call(thisValue, undefined, options);
|
||||
assertEq(Object.is(obj, thisValue), true);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), [intlFallbackSymbol]);
|
||||
}
|
||||
{
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
let options = {
|
||||
get useGrouping() {
|
||||
Object.setPrototypeOf(thisValue, Object.prototype);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let obj = Intl.NumberFormat.call(thisValue, undefined, options);
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
226
js/src/tests/Intl/NumberFormat/unwrapping.js
Normal file
@ -0,0 +1,226 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
|
||||
// Test UnwrapNumberFormat operation.
|
||||
|
||||
const numberFormatFunctions = [];
|
||||
numberFormatFunctions.push(Intl.NumberFormat.prototype.resolvedOptions);
|
||||
numberFormatFunctions.push(Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get);
|
||||
// "formatToParts" isn't yet enabled by default.
|
||||
if ("formatToParts" in Intl.NumberFormat.prototype)
|
||||
numberFormatFunctions.push(Intl.NumberFormat.prototype.formatToParts);
|
||||
|
||||
function IsConstructor(o) {
|
||||
try {
|
||||
new (new Proxy(o, {construct: () => ({})}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function IsObject(o) {
|
||||
return Object(o) === o;
|
||||
}
|
||||
|
||||
function intlObjects(ctor) {
|
||||
return [
|
||||
// Instance of an Intl constructor.
|
||||
new ctor(),
|
||||
|
||||
// Instance of a subclassed Intl constructor.
|
||||
new class extends ctor {},
|
||||
|
||||
// Intl object not inheriting from its default prototype.
|
||||
Object.setPrototypeOf(new ctor(), Object.prototype),
|
||||
];
|
||||
}
|
||||
|
||||
function thisValues(C) {
|
||||
const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsConstructor);
|
||||
|
||||
return [
|
||||
// Primitive values.
|
||||
...[undefined, null, true, "abc", Symbol(), 123],
|
||||
|
||||
// Object values.
|
||||
...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],
|
||||
|
||||
// Intl objects.
|
||||
...[].concat(...intlConstructors.filter(ctor => ctor !== C).map(intlObjects)),
|
||||
|
||||
// Object inheriting from an Intl constructor prototype.
|
||||
...intlConstructors.map(ctor => Object.create(ctor.prototype)),
|
||||
];
|
||||
}
|
||||
|
||||
const intlFallbackSymbol = Object.getOwnPropertySymbols(Intl.NumberFormat.call(Object.create(Intl.NumberFormat.prototype)))[0];
|
||||
|
||||
// Test Intl.NumberFormat.prototype methods.
|
||||
for (let numberFormatFunction of numberFormatFunctions) {
|
||||
// Test a TypeError is thrown when the this-value isn't an initialized
|
||||
// Intl.NumberFormat instance.
|
||||
for (let thisValue of thisValues(Intl.NumberFormat)) {
|
||||
assertThrowsInstanceOf(() => numberFormatFunction.call(thisValue), TypeError);
|
||||
}
|
||||
|
||||
// And test no error is thrown for initialized Intl.NumberFormat instances.
|
||||
for (let thisValue of intlObjects(Intl.NumberFormat)) {
|
||||
numberFormatFunction.call(thisValue);
|
||||
}
|
||||
|
||||
// Manually add [[FallbackSymbol]] to objects and then repeat the tests from above.
|
||||
for (let thisValue of thisValues(Intl.NumberFormat)) {
|
||||
assertThrowsInstanceOf(() => numberFormatFunction.call({
|
||||
__proto__: Intl.NumberFormat.prototype,
|
||||
[intlFallbackSymbol]: thisValue,
|
||||
}), TypeError);
|
||||
}
|
||||
|
||||
for (let thisValue of intlObjects(Intl.NumberFormat)) {
|
||||
numberFormatFunction.call({
|
||||
__proto__: Intl.NumberFormat.prototype,
|
||||
[intlFallbackSymbol]: thisValue,
|
||||
});
|
||||
}
|
||||
|
||||
// Ensure [[FallbackSymbol]] isn't retrieved for Intl.NumberFormat instances.
|
||||
for (let thisValue of intlObjects(Intl.NumberFormat)) {
|
||||
Object.defineProperty(thisValue, intlFallbackSymbol, {
|
||||
get() { assertEq(false, true); }
|
||||
});
|
||||
numberFormatFunction.call(thisValue);
|
||||
}
|
||||
|
||||
// Ensure [[FallbackSymbol]] is only retrieved for objects inheriting from Intl.NumberFormat.prototype.
|
||||
for (let thisValue of thisValues(Intl.NumberFormat)) {
|
||||
if (!IsObject(thisValue) || Intl.NumberFormat.prototype.isPrototypeOf(thisValue))
|
||||
continue;
|
||||
Object.defineProperty(thisValue, intlFallbackSymbol, {
|
||||
get() { assertEq(false, true); }
|
||||
});
|
||||
assertThrowsInstanceOf(() => numberFormatFunction.call(thisValue), TypeError);
|
||||
}
|
||||
|
||||
// Repeat the test from above, but also change Intl.NumberFormat[@@hasInstance]
|
||||
// so it always returns |null|.
|
||||
for (let thisValue of thisValues(Intl.NumberFormat)) {
|
||||
let hasInstanceCalled = false, symbolGetterCalled = false;
|
||||
Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, {
|
||||
value() {
|
||||
assertEq(hasInstanceCalled, false);
|
||||
hasInstanceCalled = true;
|
||||
return true;
|
||||
}, configurable: true
|
||||
});
|
||||
let isUndefinedOrNull = thisValue !== undefined || thisValue !== null;
|
||||
let symbolHolder;
|
||||
if (!isUndefinedOrNull) {
|
||||
symbolHolder = IsObject(thisValue) ? thisValue : Object.getPrototypeOf(thisValue);
|
||||
Object.defineProperty(symbolHolder, intlFallbackSymbol, {
|
||||
get() {
|
||||
assertEq(symbolGetterCalled, false);
|
||||
symbolGetterCalled = true;
|
||||
return null;
|
||||
}, configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
assertThrowsInstanceOf(() => numberFormatFunction.call(thisValue), TypeError);
|
||||
|
||||
delete Intl.NumberFormat[Symbol.hasInstance];
|
||||
if (!isUndefinedOrNull && !IsObject(thisValue))
|
||||
delete symbolHolder[intlFallbackSymbol];
|
||||
|
||||
assertEq(hasInstanceCalled, true);
|
||||
assertEq(symbolGetterCalled, !isUndefinedOrNull);
|
||||
}
|
||||
}
|
||||
|
||||
// Test format() returns the correct result for objects initialized as Intl.NumberFormat instances.
|
||||
{
|
||||
// An actual Intl.NumberFormat instance.
|
||||
let numberFormat = new Intl.NumberFormat();
|
||||
|
||||
// An object initialized as a NumberFormat instance.
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
Intl.NumberFormat.call(thisValue);
|
||||
|
||||
// Object with [[FallbackSymbol]] set to NumberFormat instance.
|
||||
let fakeObj = {
|
||||
__proto__: Intl.NumberFormat.prototype,
|
||||
[intlFallbackSymbol]: numberFormat,
|
||||
};
|
||||
|
||||
for (let number of [0, 1, 1.5, Infinity, NaN]) {
|
||||
let expected = numberFormat.format(number);
|
||||
assertEq(thisValue.format(number), expected);
|
||||
assertEq(thisValue[intlFallbackSymbol].format(number), expected);
|
||||
assertEq(fakeObj.format(number), expected);
|
||||
}
|
||||
}
|
||||
|
||||
// Test formatToParts() returns the correct result for objects initialized as Intl.NumberFormat instances.
|
||||
if ("formatToParts" in Intl.NumberFormat.prototype) {
|
||||
// An actual Intl.NumberFormat instance.
|
||||
let numberFormat = new Intl.NumberFormat();
|
||||
|
||||
// An object initialized as a NumberFormat instance.
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
Intl.NumberFormat.call(thisValue);
|
||||
|
||||
// Object with [[FallbackSymbol]] set to NumberFormat instance.
|
||||
let fakeObj = {
|
||||
__proto__: Intl.NumberFormat.prototype,
|
||||
[intlFallbackSymbol]: numberFormat,
|
||||
};
|
||||
|
||||
function assertEqParts(actual, expected) {
|
||||
assertEq(actual.length, expected.length, "parts count mismatch");
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
assertEq(actual[i].type, expected[i].type, "type mismatch at " + i);
|
||||
assertEq(actual[i].value, expected[i].value, "value mismatch at " + i);
|
||||
}
|
||||
}
|
||||
|
||||
for (let number of [0, 1, 1.5, Infinity, NaN]) {
|
||||
let expected = numberFormat.formatToParts(number);
|
||||
assertEqParts(thisValue.formatToParts(number), expected);
|
||||
assertEqParts(thisValue[intlFallbackSymbol].formatToParts(number), expected);
|
||||
assertEqParts(fakeObj.formatToParts(number), expected);
|
||||
}
|
||||
}
|
||||
|
||||
// Test resolvedOptions() returns the same results.
|
||||
{
|
||||
// An actual Intl.NumberFormat instance.
|
||||
let numberFormat = new Intl.NumberFormat();
|
||||
|
||||
// An object initialized as a NumberFormat instance.
|
||||
let thisValue = Object.create(Intl.NumberFormat.prototype);
|
||||
Intl.NumberFormat.call(thisValue);
|
||||
|
||||
// Object with [[FallbackSymbol]] set to NumberFormat instance.
|
||||
let fakeObj = {
|
||||
__proto__: Intl.NumberFormat.prototype,
|
||||
[intlFallbackSymbol]: numberFormat,
|
||||
};
|
||||
|
||||
function assertEqOptions(actual, expected) {
|
||||
actual = Object.entries(actual);
|
||||
expected = Object.entries(expected);
|
||||
|
||||
assertEq(actual.length, expected.length, "options count mismatch");
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
assertEq(actual[i][0], expected[i][0], "key mismatch at " + i);
|
||||
assertEq(actual[i][1], expected[i][1], "value mismatch at " + i);
|
||||
}
|
||||
}
|
||||
|
||||
let expected = numberFormat.resolvedOptions();
|
||||
assertEqOptions(thisValue.resolvedOptions(), expected);
|
||||
assertEqOptions(thisValue[intlFallbackSymbol].resolvedOptions(), expected);
|
||||
assertEqOptions(fakeObj.resolvedOptions(), expected);
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
71
js/src/tests/Intl/PluralRules/call.js
Normal file
@ -0,0 +1,71 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl")||!this.hasOwnProperty("addIntlExtras"))
|
||||
|
||||
addIntlExtras(Intl);
|
||||
|
||||
function IsConstructor(o) {
|
||||
try {
|
||||
new (new Proxy(o, {construct: () => ({})}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function IsObject(o) {
|
||||
return Object(o) === o;
|
||||
}
|
||||
|
||||
function thisValues() {
|
||||
const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsConstructor);
|
||||
|
||||
return [
|
||||
// Primitive values.
|
||||
...[undefined, null, true, "abc", Symbol(), 123],
|
||||
|
||||
// Object values.
|
||||
...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],
|
||||
|
||||
// Intl objects.
|
||||
...[].concat(...intlConstructors.map(ctor => [
|
||||
// Instance of an Intl constructor.
|
||||
new ctor(),
|
||||
|
||||
// Instance of a subclassed Intl constructor.
|
||||
new class extends ctor {},
|
||||
|
||||
// Object inheriting from an Intl constructor prototype.
|
||||
Object.create(ctor.prototype),
|
||||
|
||||
// Intl object not inheriting from its default prototype.
|
||||
Object.setPrototypeOf(new ctor(), Object.prototype),
|
||||
])),
|
||||
];
|
||||
}
|
||||
|
||||
// Invoking [[Call]] for Intl.PluralRules always returns a new PluralRules instance.
|
||||
for (let thisValue of thisValues()) {
|
||||
let obj = Intl.PluralRules.call(thisValue);
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.PluralRules, true);
|
||||
|
||||
// Ensure Intl.[[FallbackSymbol]] wasn't installed on |thisValue|.
|
||||
if (IsObject(thisValue))
|
||||
assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
|
||||
}
|
||||
|
||||
// Intl.PluralRules doesn't use the legacy Intl constructor compromise semantics.
|
||||
for (let thisValue of thisValues()) {
|
||||
// Ensure instanceof operator isn't invoked for Intl.PluralRules.
|
||||
Object.defineProperty(Intl.PluralRules, Symbol.hasInstance, {
|
||||
get() {
|
||||
assertEq(false, true, "@@hasInstance operator called");
|
||||
}, configurable: true
|
||||
});
|
||||
let obj = Intl.PluralRules.call(thisValue);
|
||||
delete Intl.PluralRules[Symbol.hasInstance];
|
||||
assertEq(Object.is(obj, thisValue), false);
|
||||
assertEq(obj instanceof Intl.PluralRules, true);
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
54
js/src/tests/ecma_6/Statements/for-inof-finally.js
Normal file
@ -0,0 +1,54 @@
|
||||
var BUGNUMBER = 1332881;
|
||||
var summary =
|
||||
"Leaving for-in and try should handle stack value in correct order";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
var a = (function () {
|
||||
for (var x in [0]) {
|
||||
try {} finally {
|
||||
return 11;
|
||||
}
|
||||
}
|
||||
})();
|
||||
assertEq(a, 11);
|
||||
|
||||
var b = (function () {
|
||||
for (var x of [0]) {
|
||||
try {} finally {
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
})();
|
||||
assertEq(b, 12);
|
||||
|
||||
var c = (function () {
|
||||
for (var x in [0]) {
|
||||
for (var y of [0]) {
|
||||
try {} finally {
|
||||
return 13;
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
assertEq(c, 13);
|
||||
|
||||
var d = (function () {
|
||||
for (var x in [0]) {
|
||||
for (var y of [0]) {
|
||||
try {} finally {
|
||||
for (var z in [0]) {
|
||||
for (var w of [0]) {
|
||||
try {} finally {
|
||||
return 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
assertEq(d, 14);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
@ -56,6 +56,13 @@ skip script test262/ch10/10.6/10.6-14-b-4-s.js
|
||||
skip script test262/ch10/10.6/10.6-13-b-1-s.js
|
||||
skip script test262/ch10/10.6/10.6-13-b-2-s.js
|
||||
|
||||
# ES2017 Intl legacy constructor semantics changes made these tests invalid
|
||||
# (bug 1328386).
|
||||
skip script test262/intl402/ch10/10.1/10.1.1_1.js
|
||||
skip script test262/intl402/ch10/10.1/10.1.2_a.js
|
||||
skip script test262/intl402/ch11/11.1/11.1.1_1.js
|
||||
skip script test262/intl402/ch12/12.1/12.1.1_1.js
|
||||
|
||||
#######################################################################
|
||||
# Tests disabled due to jstest limitations wrt imported test262 tests #
|
||||
#######################################################################
|
||||
|