Closed Bug 1766489 Opened 3 years ago Closed 3 years ago

javascript:element.parentNode.removeChild(element). Node not restored on refresh

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 99
defect

Tracking

()

RESOLVED DUPLICATE of bug 1752250

People

(Reporter: jan.stobbe1, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0

Steps to reproduce:

js:function
function fetchValueFromHtml(elementId) {
var val,
element = document.getElementById(elementId);
if (element != null && element !== undefined && element != "") {
val = element.value;
element.value = "";
element.parentNode.removeChild(element);
return val;
} else {
return undefined;
}
}

js loads from:
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/resources/images/icon.ico">
<link rel="dns-prefetch" id="cdnDynamicYield" href="//cdn.dynamicyield.com">
<link rel="dns-prefetch" id="stDynamicYield" href="//st.dynamicyield.com">
<link rel="dns-prefetch" id="rcomDynamicYield" href="//rcom.dynamicyield.com">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="manifest" href="/resources/js/manifest.json">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="CareCredit">
<meta name="application-name" content="CareCredit">
<meta http-equiv="cache-control" content="max-age=0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
<meta http-equiv="pragma" content="no-cache">
<script type="text/javascript" id="apiDynamic" src="//cdn.dynamicyield.com/api/8771563/api_dynamic.js"></script>
<script type="text/javascript" id="apiStatic" src="//cdn.dynamicyield.com/api/8771563/api_static.js"></script>
<script type="text/javascript" src="https://qehr.carecredit.com/resources/js/newrelicAgent.js"></script>
<script defer type="text/javascript" id="_ensightenEnv" src="//nexus.ensighten.com/synchronycarecredit/ehrdev/Bootstrap.js"></script>
<script defer type="text/javascript" id="_iovUrl1" src="https://ci-mpsnare.iovation.com/snare.js"></script>
<script defer type="text/javascript" id="_iovUrl2" src="https://qehr.carecredit.com/resources/js/static_wdp.js"></script>
<script defer type="text/javascript" id="_iovUrl3" src="https://qehr.carecredit.com/iojs/latest/dyn_wdp.js"></script>
<title>EHR</title>
<link href="/static/css/main.b513168f.css" rel="stylesheet">
<script >bazadebezolkohpepadr="458383835"</script><script type="text/javascript" src="https://qehr.carecredit.com/akam/13/1b5262b5" defer></script></head>
<body>
<script type="text/javascript" src="https://use.typekit.net/uux7tjs.js"></script>
<script>try{Typekit.load({async:!0})}catch(a){}</script>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<input type="hidden" id="_init_state" value="eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NTA5OTMxNjIsInN1YiI6IntcImxhc3ROYW1lXCI6XCJCQUlMWVwiLFwiQ1ZWXCI6bnVsbCxcIlBSRVFVQUxfQVZBSUxBQkxFXCI6XCJZXCIsXCJteUNoYXJ0QWNjb3VudElEXCI6XCI4NjJcIixcIkFwaWdlZV9Ub2tlblwiOm51bGwsXCJDQVJEX05VTUJFUlwiOm51bGwsXCJkYXBwbHlBcHByb3ZhbFwiOm51bGwsXCJWQUxJRF9USFJVX0RBVEVcIjpudWxsLFwiZW1haWxBZGRyZXNzXCI6XCJvcHRpb25AdGVzdC5jb21cIixcImlzRXJyb3JcIjpudWxsLFwicGF0aWVudElEVHlwZVwiOlwiRVBJXCIsXCJwYXRpZW50XCI6XCJwYXRpZW4yMzUzNXNcIixcIlBST1ZJREVSX1BSRVFVQUxcIjpudWxsLFwiTkFUSVZFX0FQUFwiOlwiTk9cIixcInR5cGV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BlXCI6XCJjb25zdW1lclwiLFwiZWhyU3lzdGVtTmFtZVwiOlwiZXBpY1wiLFwiZXBpY0FjY2Vzc1Rva2VuXCI6XCJlcGljVGVzdDI1MDE2OTEwNDI1NjI0NTc1MjFcIixcImZsb3dUeXBlXCI6bnVsbCxcImNzblwiOlwiRXh0ZXJuYWxcIn0iLCJpc3MiOiJTWUYiLCJleHAiOjE2NTA5OTMxOTJ9.a23l_yYHsMfd5qCX5NAljAaUjd-siXfbknr-Jn-BH5Y">
<input id="ioBBField" name="ioBB" type="hidden">
<input id="fpBBField" name="fpBB" type="hidden">
<input type="hidden" name="ioBBDuplicate" id="ioBB">
<input type="hidden" name="ioFBDuplicate" id="fpBB">
<script>var io_bbout_element_id="ioBB",fp_bbout_element_id="fpBB"</script>
<script type="text/javascript" src="/static/js/main.8cb1f934.js"></script>
<noscript><img src="https://qehr.carecredit.com/akam/13/pixel_1b5262b5?a=dD1mZTdjZjMxNzBmZDU5Y2VjYWNkMjY3OWJjZTdiYjA3NDE2NGMwZDU5JmpzPW9mZg==" style="visibility: hidden; position: absolute; left: -999px; top: -999px;" /></noscript><script type="text/javascript" src="/9JIZe2d9cm/8dK9/W3O-Kq/V1kENbGhJi/FXQ1K1RKBQ/Kg0BRl/1sfiA"></script></body>
</html>

Actual results:

js function removes hidden field _init_state
on reload(CTL R) _init_state does not get replaced and cant retrieve JWT

Expected results:

JS should retrieve _init_state jwt on reload(CTL R)

The Bugbug bot thinks this bug should belong to the 'Core::Networking: DNS' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking: DNS
Product: Firefox → Core
Component: Networking: DNS → DOM: Core & HTML
Attached file Possible test-case? (deleted) —

Seems like form restoration is setting the value back to the empty string. You can fix it by using autocomplete="off" on the <input>, but we maybe shouldn't be restoring <input type="hidden">?

Attachment #9274126 - Attachment mime type: text/plain → text/html

edgar, do you happen to know if restoring hidden form fields has some historical intent?

Flags: needinfo?(echen)

(In reply to Henri Sivonen (:hsivonen) from comment #3)

edgar, do you happen to know if restoring hidden form fields has some historical intent?

We started restoring hidden form field in bug 149962. But if other browsers doesn't restore the hidden input, maybe we could also remove it.

But I suspect user encounter this issue recently is due to a SHIP regression where we always restore a page even it has a no-store header.
That bug is fixed in 100, see bug 1752250.

Hi jan.stobbe1, could you help to try the page with Nightly to see if you still encounter this? Thanks!

Flags: needinfo?(echen) → needinfo?(jan.stobbe1)

(In reply to Edgar Chen [:edgar] from comment #4)

We started restoring hidden form field in bug 149962. But if other browsers doesn't restore the hidden input, maybe we could also remove it.

IIRC other browsers (at least Chrome) do not restore the input on refresh even if it is not a hidden input. So I don't think we should change the behavior just because other browsers do not match. If we do, we should drop the restore-on-refresh behavior completely.

I couldnt manage to duplicate it in 99.0.1, then Firefox updated me to 100 and I didnt see it there either. I see I was on 99.0 when I created the ticket or is that really 99.0.1.? Didnt see it in the nightly build either.

Flags: needinfo?(jan.stobbe1)

Thanks! Then I believe it is a duplicated of bug 1752250.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: