mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 07:51:52 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<p>不同的浏览器会在不同时期设置这个值。例如,Firefox在创建<a href="Reference/Global_Objects/Error" title="通过Error的构造器可以创建一个错误对象。当运行时错误产生时,Error的实例对象会被抛出。Error对象也可用于用户自定义的异常的基础对象。下面列出了各种内建的标准错误类型。"><code>Error</code></a>对象时设置它,然而PhantomJS是在当且仅当它抛出 <a href="Reference/Global_Objects/Error" title="通过Error的构造器可以创建一个错误对象。当运行时错误产生时,Error的实例对象会被抛出。Error对象也可用于用户自定义的异常的基础对象。下面列出了各种内建的标准错误类型。"><code>Error</code></a>时, 并且<a class="external" href="http://msdn.microsoft.com/en-us/library/windows/apps/hh699850.aspx" rel="noopener">MSDN docs</a> 似乎也实现了PhantomJS的方式。</p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<p>下面这段html代码展示了<code>stack</code> 属性的使用方法</p>
|
||||
<pre class="brush: html"><!DOCTYPE HTML>
|
||||
<pre><code class="language-html"><!DOCTYPE HTML>
|
||||
<meta charset="UTF-8">
|
||||
<title>Stack Trace Example</title>
|
||||
<body>
|
||||
@@ -33,27 +33,27 @@ function a() {
|
||||
a('first call, firstarg');
|
||||
</script>
|
||||
|
||||
</pre>
|
||||
</code></pre>
|
||||
<p>假设上面这段代码被保存在Windows系统下的 <code>C:\example.html</code>在处理过程中抛出如下所示的错误信息</p>
|
||||
<p>Firefox 30及以上版本的浏览器会包含以列号为开始 (<a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=762556" rel="noopener" title="FIXED: Error stack should contain column number">bug 762556</a>):</p>
|
||||
<pre><samp>trace@file:///C:/example.html:9:17
|
||||
b@file:///C:/example.html:16:13
|
||||
a@file:///C:/example.html:19:13
|
||||
@file:///C:/example.html:21:9</samp></pre>
|
||||
@file:///C:/example.html:21:9</samp></code></pre>
|
||||
<p>Firefox 14 to Firefox 29:</p>
|
||||
<pre><samp>trace@file:///C:/example.html:9
|
||||
b@file:///C:/example.html:16
|
||||
a@file:///C:/example.html:19
|
||||
@file:///C:/example.html:21</samp></pre>
|
||||
@file:///C:/example.html:21</samp></code></pre>
|
||||
<p>Firefox 13及更早版本的浏览器会抛出如下信息:</p>
|
||||
<pre><samp>Error("myError")@:0
|
||||
trace()@file:///C:/example.html:9
|
||||
b(3,4,"\n\n",(void 0),[object Object])@file:///C:/example.html:16
|
||||
a("first call, firstarg")@file:///C:/example.html:19
|
||||
@file:///C:/example.html:21</samp></pre>
|
||||
@file:///C:/example.html:21</samp></code></pre>
|
||||
<h3 id="Stack_of_eval'ed_code">Stack of eval'ed code</h3>
|
||||
<p>Firefox30以(Firefox 30 / Thunderbird 30 / SeaMonkey 2.27 / Firefox OS 1.4)格式开头,<code>Function()</code> 和 <code>eval()</code> 调用产生的错误代码堆栈,现在在调用内部通过行号和列号以更加详细的格式向我们展示出来。函数调用显示为<code>"> Function"</code> 而 eval调用则是 <code>"> eval"</code>这样。下面来看这个<a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332176" rel="noopener" title="FIXED: eval still uses call site line number as offset for eval'ed code in the year 2014">bug 332176</a>.</p>
|
||||
<pre class="brush: js">try {
|
||||
<pre><code class="language-javascript">try {
|
||||
new Function('throw new Error()')();
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
@@ -72,7 +72,7 @@ try {
|
||||
// @file:///C:/example.html line 7 > eval line 1 > eval:1:1
|
||||
// @file:///C:/example.html line 7 > eval:1:1
|
||||
// @file:///C:/example.html:7:6
|
||||
</pre>
|
||||
</code></pre>
|
||||
<p>你也可以使用<code>//# sourceURL</code> 命名eval源的指令。 也可以查看在 <a href="/en-US/docs/Tools/Debugger">Debugger</a>文档中的<a href="/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources" style="">Debug eval 源</a>和<a class="external" href="http://fitzgeraldnick.com/weblog/59/" rel="noopener">blog post博客 。</a></p>
|
||||
<h2 id="规范">规范</h2>
|
||||
<p>不属于任何规范,没有标准规范。</p>
|
||||
|
||||
Reference in New Issue
Block a user