Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js

Issue 2372303003: DevTools: introduce external service client (behind experiment). (Closed)
Patch Set: external linter Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 /** 462 /**
463 * @param {string} string 463 * @param {string} string
464 * @param {function(string,string,number=,number=):!Node} linkifier 464 * @param {function(string,string,number=,number=):!Node} linkifier
465 * @return {!DocumentFragment} 465 * @return {!DocumentFragment}
466 */ 466 */
467 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier) 467 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier)
468 { 468 {
469 var container = createDocumentFragment(); 469 var container = createDocumentFragment();
470 var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\- _+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; 470 var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\- _+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;
471 var pathLineRegex = /(?:\/[\/\w\.-]+)+\:[\d]+/;
471 472
472 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLin kifier) { 473 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLin kifier) {
473 var linkString = linkStringRegEx.exec(string); 474 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(stri ng);
wOxxOm 2016/11/08 14:41:21 See https://crbug.com/663342 - pathLineRegex.exec
474 if (!linkString) 475 if (!linkString)
475 break; 476 break;
476 477
477 linkString = linkString[0]; 478 linkString = linkString[0];
478 var linkIndex = string.indexOf(linkString); 479 var linkIndex = string.indexOf(linkString);
479 var nonLink = string.substring(0, linkIndex); 480 var nonLink = string.substring(0, linkIndex);
480 container.appendChild(createTextNode(nonLink)); 481 container.appendChild(createTextNode(nonLink));
481 482
482 var title = linkString; 483 var title = linkString;
483 var realURL = (linkString.startsWith("www.") ? "http://" + linkString : linkString); 484 var realURL = (linkString.startsWith("www.") ? "http://" + linkString : linkString);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 /** 556 /**
556 * @param {!WebInspector.NetworkRequest} request 557 * @param {!WebInspector.NetworkRequest} request
557 * @return {!Element} 558 * @return {!Element}
558 */ 559 */
559 WebInspector.linkifyRequestAsNode = function(request) 560 WebInspector.linkifyRequestAsNode = function(request)
560 { 561 {
561 var anchor = WebInspector.linkifyURLAsNode(request.url); 562 var anchor = WebInspector.linkifyURLAsNode(request.url);
562 anchor.requestId = request.requestId; 563 anchor.requestId = request.requestId;
563 return anchor; 564 return anchor;
564 } 565 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/BUILD.gn ('k') | third_party/WebKit/Source/devtools/front_end/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698