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

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

Issue 2058513003: DevTools: max length limit for formatting commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove style changes Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js » ('j') | 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 394 }
395 395
396 /** 396 /**
397 * The maximum number of characters to display in a URL. 397 * The maximum number of characters to display in a URL.
398 * @const 398 * @const
399 * @type {number} 399 * @type {number}
400 */ 400 */
401 WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150; 401 WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150;
402 402
403 /** 403 /**
404 * The maximum length before strings are considered too long for finding URLs.
405 * @const
406 * @type {number}
407 */
408 WebInspector.Linkifier.MaxLengthToIgnoreLinkifier = 10000;
409
410 /**
404 * @interface 411 * @interface
405 */ 412 */
406 WebInspector.Linkifier.LinkHandler = function() 413 WebInspector.Linkifier.LinkHandler = function()
407 { 414 {
408 } 415 }
409 416
410 WebInspector.Linkifier.LinkHandler.prototype = { 417 WebInspector.Linkifier.LinkHandler.prototype = {
411 /** 418 /**
412 * @param {string} url 419 * @param {string} url
413 * @param {number=} lineNumber 420 * @param {number=} lineNumber
(...skipping 25 matching lines...) Expand all
439 /** 446 /**
440 * @param {string} string 447 * @param {string} string
441 * @param {function(string,string,number=,number=):!Node} linkifier 448 * @param {function(string,string,number=,number=):!Node} linkifier
442 * @return {!DocumentFragment} 449 * @return {!DocumentFragment}
443 */ 450 */
444 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier) 451 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki fier)
445 { 452 {
446 var container = createDocumentFragment(); 453 var container = createDocumentFragment();
447 var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\- _+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; 454 var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\- _+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;
448 455
449 while (string && string.length < 10000) { 456 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLin kifier) {
450 var linkString = linkStringRegEx.exec(string); 457 var linkString = linkStringRegEx.exec(string);
451 if (!linkString) 458 if (!linkString)
452 break; 459 break;
453 460
454 linkString = linkString[0]; 461 linkString = linkString[0];
455 var linkIndex = string.indexOf(linkString); 462 var linkIndex = string.indexOf(linkString);
456 var nonLink = string.substring(0, linkIndex); 463 var nonLink = string.substring(0, linkIndex);
457 container.appendChild(createTextNode(nonLink)); 464 container.appendChild(createTextNode(nonLink));
458 465
459 var title = linkString; 466 var title = linkString;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 /** 534 /**
528 * @param {!WebInspector.NetworkRequest} request 535 * @param {!WebInspector.NetworkRequest} request
529 * @return {!Element} 536 * @return {!Element}
530 */ 537 */
531 WebInspector.linkifyRequestAsNode = function(request) 538 WebInspector.linkifyRequestAsNode = function(request)
532 { 539 {
533 var anchor = WebInspector.linkifyURLAsNode(request.url); 540 var anchor = WebInspector.linkifyURLAsNode(request.url);
534 anchor.requestId = request.requestId; 541 anchor.requestId = request.requestId;
535 return anchor; 542 return anchor;
536 } 543 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698