From ad032e72caff66c413566bf7d8fa9f43a97d4620 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 23 Feb 2017 09:30:15 -0800 Subject: [PATCH] When the profiler is active, keep it active if the user submits forms Summary: Ref T12297. When a page is generated with the profiler active, keep it active by adding a `__profile__` input to any forms we generate. Test Plan: Hit Conduit API page with `__profile__` active, saw it reflected in forms. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12297 Differential Revision: https://secure.phabricator.com/D17399 --- src/infrastructure/javelin/markup.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php index c78de8b86a..1909a3bd2b 100644 --- a/src/infrastructure/javelin/markup.php +++ b/src/infrastructure/javelin/markup.php @@ -98,6 +98,19 @@ function phabricator_form(PhabricatorUser $user, $attributes, $content) { 'name' => '__form__', 'value' => true, )); + + // If the profiler was active for this request, keep it active for any + // forms submitted from this page. + if (DarkConsoleXHProfPluginAPI::isProfilerRequested()) { + $body[] = phutil_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => '__profile__', + 'value' => true, + )); + } + } }