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

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

Issue 2485963005: [Devtools] Fixed regression with linkifier regex (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/components/linkifier.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 /** 396 /**
397 * @param {string} string 397 * @param {string} string
398 * @param {function(string,string,number=,number=):!Node} linkifier 398 * @param {function(string,string,number=,number=):!Node} linkifier
399 * @return {!DocumentFragment} 399 * @return {!DocumentFragment}
400 */ 400 */
401 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier) { 401 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier) {
402 var container = createDocumentFragment(); 402 var container = createDocumentFragment();
403 var linkStringRegEx = 403 var linkStringRegEx =
404 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^% @&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; 404 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^% @&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;
405 var pathLineRegex = /(?:\/[\/\w\.-]+)+\:[\d]+/; 405 var pathLineRegex = /(?:\/[\w\.-]*)+\:[\d]+/;
406 406
407 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLinki fier) { 407 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLinki fier) {
408 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(string); 408 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(string);
409 if (!linkString) 409 if (!linkString)
410 break; 410 break;
411 411
412 linkString = linkString[0]; 412 linkString = linkString[0];
413 var linkIndex = string.indexOf(linkString); 413 var linkIndex = string.indexOf(linkString);
414 var nonLink = string.substring(0, linkIndex); 414 var nonLink = string.substring(0, linkIndex);
415 container.appendChild(createTextNode(nonLink)); 415 container.appendChild(createTextNode(nonLink));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 /** 488 /**
489 * @param {!WebInspector.NetworkRequest} request 489 * @param {!WebInspector.NetworkRequest} request
490 * @return {!Element} 490 * @return {!Element}
491 */ 491 */
492 WebInspector.linkifyRequestAsNode = function(request) { 492 WebInspector.linkifyRequestAsNode = function(request) {
493 var anchor = WebInspector.linkifyURLAsNode(request.url); 493 var anchor = WebInspector.linkifyURLAsNode(request.url);
494 anchor.requestId = request.requestId; 494 anchor.requestId = request.requestId;
495 return anchor; 495 return anchor;
496 }; 496 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/components/linkifier.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698