@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix the DarkConsole inline error log stack trace expansion behavior for Content-Security-Policy

Summary:
See PHI451. Ref T13102. DarkConsole uses an ancient inline "onclick" handler to expand the stack traces for errors.

The new Content-Security-Policy prevents this from functioning.

Replace this with a more modern behavior-driven action instead.

Test Plan:
- Clicked some errors in DarkConsole, saw stack traces appear.
- Grepped for `onclick` and `jsprintf()` to see if I could find any more of these, but came up empty.

Maniphest Tasks: T13102

Differential Revision: https://secure.phabricator.com/D19218

+37 -50
+12 -22
resources/celerity/map.php
··· 11 11 'conpherence.pkg.js' => '15191c65', 12 12 'core.pkg.css' => 'c218ed53', 13 13 'core.pkg.js' => '0fabde4f', 14 - 'darkconsole.pkg.js' => '1f9a31bc', 15 14 'differential.pkg.css' => '113e692c', 16 15 'differential.pkg.js' => 'f6d809c0', 17 16 'diffusion.pkg.css' => 'a2d17c7d', ··· 462 461 'rsrc/js/core/behavior-detect-timezone.js' => '4c193c96', 463 462 'rsrc/js/core/behavior-device.js' => 'a3714c76', 464 463 'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '484a6e22', 465 - 'rsrc/js/core/behavior-error-log.js' => '6882e80a', 466 464 'rsrc/js/core/behavior-fancy-datepicker.js' => 'ecf4e799', 467 465 'rsrc/js/core/behavior-file-tree.js' => '88236f00', 468 466 'rsrc/js/core/behavior-form.js' => '5c54cbf3', ··· 501 499 'rsrc/js/core/behavior-workflow.js' => '0a3f3021', 502 500 'rsrc/js/core/darkconsole/DarkLog.js' => 'c8e1ffe3', 503 501 'rsrc/js/core/darkconsole/DarkMessage.js' => 'c48cccdd', 504 - 'rsrc/js/core/darkconsole/behavior-dark-console.js' => '17bb8539', 502 + 'rsrc/js/core/darkconsole/behavior-dark-console.js' => '66888767', 505 503 'rsrc/js/core/phtize.js' => 'd254d646', 506 504 'rsrc/js/phui/behavior-phui-dropdown-menu.js' => 'b95d6f7d', 507 505 'rsrc/js/phui/behavior-phui-file-upload.js' => 'b003d4fb', ··· 588 586 'javelin-behavior-conpherence-pontificate' => '55616e04', 589 587 'javelin-behavior-conpherence-search' => '9bbf3762', 590 588 'javelin-behavior-countdown-timer' => 'e4cc26b3', 591 - 'javelin-behavior-dark-console' => '17bb8539', 589 + 'javelin-behavior-dark-console' => '66888767', 592 590 'javelin-behavior-dashboard-async-panel' => '469c0d9e', 593 591 'javelin-behavior-dashboard-move-panels' => '408bf173', 594 592 'javelin-behavior-dashboard-query-panel-select' => '453c5375', ··· 613 611 'javelin-behavior-durable-column' => '2ae077e1', 614 612 'javelin-behavior-editengine-reorder-configs' => 'd7a74243', 615 613 'javelin-behavior-editengine-reorder-fields' => 'b59e1e96', 616 - 'javelin-behavior-error-log' => '6882e80a', 617 614 'javelin-behavior-event-all-day' => 'b41537c9', 618 615 'javelin-behavior-fancy-datepicker' => 'ecf4e799', 619 616 'javelin-behavior-global-drag-and-drop' => '960f6a39', ··· 986 983 '15d5ff71' => array( 987 984 'aphront-typeahead-control-css', 988 985 'phui-tag-view-css', 989 - ), 990 - '17bb8539' => array( 991 - 'javelin-behavior', 992 - 'javelin-stratcom', 993 - 'javelin-util', 994 - 'javelin-dom', 995 - 'javelin-request', 996 - 'phabricator-keyboard-shortcut', 997 - 'phabricator-darklog', 998 - 'phabricator-darkmessage', 999 986 ), 1000 987 '1802a242' => array( 1001 988 'phui-theme-css', ··· 1416 1403 'javelin-typeahead-ondemand-source', 1417 1404 'javelin-util', 1418 1405 ), 1406 + 66888767 => array( 1407 + 'javelin-behavior', 1408 + 'javelin-stratcom', 1409 + 'javelin-util', 1410 + 'javelin-dom', 1411 + 'javelin-request', 1412 + 'phabricator-keyboard-shortcut', 1413 + 'phabricator-darklog', 1414 + 'phabricator-darkmessage', 1415 + ), 1419 1416 '66a6def1' => array( 1420 1417 'javelin-behavior', 1421 1418 'javelin-dom', ··· 1428 1425 'javelin-install', 1429 1426 'javelin-dom', 1430 1427 'phabricator-notification', 1431 - ), 1432 - '6882e80a' => array( 1433 - 'javelin-dom', 1434 1428 ), 1435 1429 '68af71ca' => array( 1436 1430 'javelin-install', ··· 2342 2336 'javelin-behavior-aphlict-status', 2343 2337 'javelin-behavior-user-menu', 2344 2338 'phabricator-favicon', 2345 - ), 2346 - 'darkconsole.pkg.js' => array( 2347 - 'javelin-behavior-dark-console', 2348 - 'javelin-behavior-error-log', 2349 2339 ), 2350 2340 'differential.pkg.css' => array( 2351 2341 'differential-core-view-css',
-4
resources/celerity/packages.php
··· 224 224 'javelin-behavior-maniphest-subpriority-editor', 225 225 'javelin-behavior-maniphest-list-editor', 226 226 ), 227 - 'darkconsole.pkg.js' => array( 228 - 'javelin-behavior-dark-console', 229 - 'javelin-behavior-error-log', 230 - ), 231 227 );
+5 -2
src/applications/console/plugin/DarkConsoleErrorLogPlugin.php
··· 39 39 $file = $row['file']; 40 40 $line = $row['line']; 41 41 42 - $tag = phutil_tag( 42 + $tag = javelin_tag( 43 43 'a', 44 44 array( 45 - 'onclick' => jsprintf('show_details(%d)', $index), 45 + 'sigil' => 'darkconsole-expand', 46 + 'meta' => array( 47 + 'expandID' => 'row-details-'.$index, 48 + ), 46 49 ), 47 50 $row['str'].' at ['.basename($file).':'.$line.']'); 48 51 $rows[] = array($tag);
-3
src/view/page/PhabricatorStandardPageView.php
··· 330 330 Javelin::initBehavior( 331 331 'dark-console', 332 332 $this->getConsoleConfig()); 333 - 334 - // Change this to initBehavior when there is some behavior to initialize 335 - require_celerity_resource('javelin-behavior-error-log'); 336 333 } 337 334 338 335 if ($user) {
-19
webroot/rsrc/js/core/behavior-error-log.js
··· 1 - /** 2 - * @provides javelin-behavior-error-log 3 - * @requires javelin-dom 4 - */ 5 - 6 - /* exported show_details */ 7 - 8 - var current_details = null; 9 - 10 - function show_details(row) { 11 - var node = JX.$('row-details-' + row); 12 - 13 - if (current_details !== null) { 14 - JX.$('row-details-' + current_details).style.display = 'none'; 15 - } 16 - 17 - node.style.display = 'block'; 18 - current_details = row; 19 - }
+20
webroot/rsrc/js/core/darkconsole/behavior-dark-console.js
··· 404 404 405 405 } 406 406 407 + if (!statics.expand) { 408 + statics.expand = true; 409 + 410 + var current_details = null; 411 + JX.Stratcom.listen('click', 'darkconsole-expand', function(e) { 412 + e.kill(); 413 + 414 + if (current_details) { 415 + current_details.style.display = 'none'; 416 + current_details = null; 417 + } 418 + 419 + var id = e.getNodeData('darkconsole-expand').expandID; 420 + var node = JX.$(id); 421 + 422 + node.style.display = 'block'; 423 + current_details = node; 424 + }); 425 + } 426 + 407 427 });