[prev in list] [next in list] [prev in thread] [next in thread]
List: webkit-changes
Subject: [webkit-changes] [239467] trunk
From: joepeck () webkit ! org
Date: 2018-12-20 23:15:57
Message-ID: 20181220231557.1BE2210051CC () svn ! webkit ! org
[Download RAW message or body]
[Attachment #2 (text/html)]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[239467] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: \
bold} #msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
.info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://trac.webkit.org/projects/webkit/changeset/239467">239467</a></dd> \
<dt>Author</dt> <dd>joepeck@webkit.org</dd> <dt>Date</dt> <dd>2018-12-20 15:15:56 \
-0800 (Thu, 20 Dec 2018)</dd> </dl>
<h3>Log Message</h3>
<pre>Web Inspector: Autoformat doesn't work on icloud.com (javascript-packed.js)
https://bugs.webkit.org/show_bug.cgi?id=192946
<rdar://problem/42546126>
Rubber-stamped by Devin Rousso.
Source/WebInspectorUI:
* UserInterface/Base/Utilities.js:
(whitespaceRatio):
(isTextLikelyMinified):
Check the first 2500 and the last 2500 characters whitespace ratio.
If either is below 20% then treat as minified.
LayoutTests:
* inspector/formatting/is-text-likely-minified-expected.txt:
* inspector/formatting/is-text-likely-minified.html:
Add a test for a long header doc at the start but minified content at the end.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorformattingistextlikelyminifiedexpectedtxt">trunk/LayoutTests/inspector/formatting/is-text-likely-minified-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorformattingistextlikelyminifiedhtml">trunk/LayoutTests/inspector/formatting/is-text-likely-minified.html</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseUtilitiesjs">trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (239466 => \
239467)</h4> <pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog 2018-12-20 22:42:06 UTC (rev \
239466)
+++ trunk/LayoutTests/ChangeLog 2018-12-20 23:15:56 UTC (rev 239467)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2018-12-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Autoformat doesn't work on icloud.com (javascript-packed.js)
+ https://bugs.webkit.org/show_bug.cgi?id=192946
+ <rdar://problem/42546126>
+
+ Rubber-stamped by Devin Rousso.
+
+ * inspector/formatting/is-text-likely-minified-expected.txt:
+ * inspector/formatting/is-text-likely-minified.html:
+ Add a test for a long header doc at the start but minified content at the \
end. +
</ins><span class="cx"> 2018-12-20 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> [ iOS WK2 ] Layout Test \
imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html \
is flaky </span></span></pre></div>
<a id="trunkLayoutTestsinspectorformattingistextlikelyminifiedexpectedtxt"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/inspector/formatting/is-text-likely-minified-expected.txt (239466 \
=> 239467)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/inspector/formatting/is-text-likely-minified-expected.txt 2018-12-20 \
22:42:06 UTC (rev 239466)
+++ trunk/LayoutTests/inspector/formatting/is-text-likely-minified-expected.txt 2018-12-20 \
23:15:56 UTC (rev 239467) </span><span class="lines">@@ -11,3 +11,6 @@
</span><span class="cx"> -- Running test case: JQuerySnippet.Minified
</span><span class="cx"> PASS: jQuery snippet should be classified as minified.
</span><span class="cx">
</span><ins>+-- Running test case: JQuerySnippet.MinifiedWithHeader
+PASS: Source with leading unminified but trailing minified source should be \
classified as minified. +
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorformattingistextlikelyminifiedhtml"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/inspector/formatting/is-text-likely-minified.html (239466 => \
239467)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/inspector/formatting/is-text-likely-minified.html 2018-12-20 \
22:42:06 UTC (rev 239466)
+++ trunk/LayoutTests/inspector/formatting/is-text-likely-minified.html 2018-12-20 \
23:15:56 UTC (rev 239467) </span><span class="lines">@@ -5,17 +5,17 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- let suite = \
InspectorTest.createAsyncSuite("Formatting.isLikelyMinified"); </del><ins>+ \
let suite = InspectorTest.createSyncSuite("Formatting.isLikelyMinified"); \
</ins><span class="cx"> </span><span class="cx"> suite.addTestCase({
</span><span class="cx"> name: "JavaScriptShortSnippet.Unminified",
</span><del>- test(resolve, reject) {
</del><ins>+ test() {
</ins><span class="cx"> \
InspectorTest.expectThat(!isTextLikelyMinified("var x = 42;\nvar y = \
24;\n"), "This small JavaScript snippet should be classified as \
unminified."); </span><del>- resolve();
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- let jquerySourceFragment = `/*eslint-disable no-unused-vars*/
</del><ins>+ const jquerySourceFragment = `/*eslint-disable no-unused-vars*/
</ins><span class="cx"> /*!
</span><span class="cx"> * jQuery JavaScript Library v3.1.0
</span><span class="cx"> * https://jquery.com/
</span><span class="lines">@@ -91,23 +91,48 @@
</span><span class="cx">
</span><span class="cx"> suite.addTestCase({
</span><span class="cx"> name: "JQuerySnippet.Unminified",
</span><del>- test(resolve, reject) {
</del><ins>+ test() {
</ins><span class="cx"> \
InspectorTest.expectThat(!isTextLikelyMinified(jquerySourceFragment), "jQuery \
snippet should be classified as unminified."); </span><del>- \
resolve(); </del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- let jQueryMinifiedSourceFragment = `/*! jQuery v3.1.0 | (c) jQuery \
Foundation | jquery.org/license */ </del><ins>+ const jQueryMinifiedSourceFragment \
= `/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */ </ins><span \
class="cx"> !function(a,b){"use strict";"object"==typeof \
module&&"object"==typeof \
module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new \
Error("jQuery requires a window with a document");return \
b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use \
strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.pu \
sh,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function \
p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var \
q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[s ]+|[s \
]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return \
b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return \
f.call(this)},get:function(a){return \
null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushS tack:function(a){var \
b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return \
r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return \
a.call(b,c,b)}))},slice:function(){return \
this.pushStack(f.apply(this,arguments))},first:function(){return \
this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var \
b=this.length,c=+a+(a<0?b:0);return \
this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return \
this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var \
a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof \
g&&(j=g,g=arguments[h]||{},h++),"object"==typeof \
g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b \
in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.
isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return \
g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/D/g,""),isReady:!0,error:function(a){throw \
new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return \
null!=a&&a===a.window},isNumeric:function(a){var \
b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var \
b,c;return!(!a||"[object \
Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof \
c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in \
a)return!1;return!0},type:function(a){return \
null==a?a+"":"object"==typeof a||"function"==typeof \
a?j[k.call(a)]||"object":typeof \
a},globalEval:function(a){p(a)},camelCase:function(a){retu rn \
a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return \
a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var \
c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d \
in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return \
null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var \
c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof \
a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return \
null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var \
c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return \
a.length=e,a},grep:function(a,b,c){for(var \
d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return \
e},map:function(a,b,c){var \
d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else \
for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,prox \
y:function(a,b){var c,d,e;if("string"==typeof \
b&&(c=a[b],b=a,a=c),r.isFunction(a))return \
d=f.call(arguments,2),e=function(){return `; </span><span class="cx">
</span><span class="cx"> suite.addTestCase({
</span><span class="cx"> name: "JQuerySnippet.Minified",
</span><del>- test(resolve, reject) {
</del><ins>+ test() {
</ins><span class="cx"> \
InspectorTest.expectThat(isTextLikelyMinified(jQueryMinifiedSourceFragment), \
"jQuery snippet should be classified as minified."); </span><del>- \
resolve(); </del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><ins>+ const sampleHeader = `
+/*!
+ * jQuery JavaScript Library v3.1.0
+ * https://jquery.com/
+ *
+ * Includes Sizzle.js
+ * https://sizzlejs.com/
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license
+ * https://jquery.org/license
+ *
+ * Date: 2016-07-07T21:44Z
+ */
+ `;
+
+ let longHeaderSource = sampleHeader.repeat(10) + jQueryMinifiedSourceFragment;
+ suite.addTestCase({
+ name: "JQuerySnippet.MinifiedWithHeader",
+ test() {
+ InspectorTest.expectThat(isTextLikelyMinified(longHeaderSource), \
"Source with leading unminified but trailing minified source should be \
classified as minified."); + return true;
+ }
+ })
+
</ins><span class="cx"> suite.runTestCasesAndFinish();
</span><span class="cx"> }
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (239466 => \
239467)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog 2018-12-20 22:42:06 UTC \
(rev 239466)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-12-20 23:15:56 UTC (rev 239467)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2018-12-20 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ Web Inspector: Autoformat doesn't work on icloud.com \
(javascript-packed.js) + https://bugs.webkit.org/show_bug.cgi?id=192946
+ <rdar://problem/42546126>
+
+ Rubber-stamped by Devin Rousso.
+
+ * UserInterface/Base/Utilities.js:
+ (whitespaceRatio):
+ (isTextLikelyMinified):
+ Check the first 2500 and the last 2500 characters whitespace ratio.
+ If either is below 20% then treat as minified.
+
+2018-12-20 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> ITMLKit Inspector: Elements tab does not show DOM \
Tree </span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=192910
</span><span class="cx"> <rdar://problem/46680585>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseUtilitiesjs"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (239466 => 239467)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2018-12-20 22:42:06 UTC \
(rev 239466)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2018-12-20 23:15:56 \
UTC (rev 239467) </span><span class="lines">@@ -1613,17 +1613,13 @@
</span><span class="cx"> return str.endsWith("{\n [native \
code]\n}"); </span><span class="cx"> }
</span><span class="cx">
</span><del>-function isTextLikelyMinified(content)
</del><ins>+function whitespaceRatio(content, start, end)
</ins><span class="cx"> {
</span><del>- const autoFormatMaxCharactersToCheck = 5000;
- const autoFormatWhitespaceRatio = 0.2;
-
</del><span class="cx"> let whitespaceScore = 0;
</span><del>- let size = Math.min(autoFormatMaxCharactersToCheck, content.length);
</del><ins>+ let size = end - start;
</ins><span class="cx">
</span><del>- for (let i = 0; i < size; i++) {
</del><ins>+ for (let i = start; i < end; i++) {
</ins><span class="cx"> let char = content[i];
</span><del>-
</del><span class="cx"> if (char === " ")
</span><span class="cx"> whitespaceScore++;
</span><span class="cx"> else if (char === "\t")
</span><span class="lines">@@ -1633,9 +1629,30 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> let ratio = whitespaceScore / size;
</span><del>- return ratio < autoFormatWhitespaceRatio;
</del><ins>+ return ratio;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+function isTextLikelyMinified(content)
+{
+ const autoFormatMaxCharactersToCheck = 2500;
+ const autoFormatWhitespaceRatio = 0.2;
+
+ if (content.length <= autoFormatMaxCharactersToCheck) {
+ let ratio = whitespaceRatio(content, 0, content.length);
+ return ratio < autoFormatWhitespaceRatio;
+ }
+
+ let startRatio = whitespaceRatio(content, 0, autoFormatMaxCharactersToCheck);
+ if (startRatio < autoFormatWhitespaceRatio)
+ return true;
+
+ let endRatio = whitespaceRatio(content, content.length - \
autoFormatMaxCharactersToCheck, content.length) + if (endRatio < \
autoFormatWhitespaceRatio) + return true;
+
+ return false;
+}
+
</ins><span class="cx"> function doubleQuotedString(str)
</span><span class="cx"> {
</span><span class="cx"> return "\"" + str.replace(/\\/g, \
"\\\\").replace(/"/g, "\\\"") + "\""; \
</span></span></pre> </div>
</div>
</body>
</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic