<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>76009</bug_id>
          
          <creation_ts>2012-01-10 17:02:58 -0800</creation_ts>
          <short_desc>Unlimited history items saved in WebProcessProxy</short_desc>
          <delta_ts>2021-03-31 09:05:24 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>History</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter>eglerik</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>darin</cc>
    
    <cc>jjjaquanrice</cc>
    
    <cc>sam</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>533497</commentid>
    <comment_count>0</comment_count>
    <who name="">eglerik</who>
    <bug_when>2012-01-10 17:02:58 -0800</bug_when>
    <thetext>m_backForwardListItemMap in WebProcessProxy can accumulate WebBackForwardListItem elements until WebKit runs out of available memory. There is a maximum capacity enforced on the WebBackForwardList class, but the same history items saved in the WebProcessProxy have no such cap.

Steps to Reproduce: 
 1) Go to any webpage
 2) Go to a different webpage
 3) Go back to 1) and repeat Steps

The size of WebProcessProxy::m_backForwardListItemMap grows with each new site visited, while the size of WebBackForwardList::m_entries stops at &quot;DefaultCapacity&quot; defined in WebBackForwardList.cpp. 

Produced bug on Windows and Mac OSX

SVN Revision: 104601

I plan to submit a patch shortly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>534444</commentid>
    <comment_count>1</comment_count>
      <attachid>122139</attachid>
    <who name="">eglerik</who>
    <bug_when>2012-01-11 17:29:09 -0800</bug_when>
    <thetext>Created attachment 122139
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>538833</commentid>
    <comment_count>2</comment_count>
      <attachid>122139</attachid>
    <who name="">eglerik</who>
    <bug_when>2012-01-19 11:13:49 -0800</bug_when>
    <thetext>Comment on attachment 122139
Patch

This is a simple fix:
- One new function that simply calls HashMap&apos;s remove function.
- The call of the new function where the same history element is currently being cleaned up for a separate copy of the data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>695255</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2012-08-14 12:36:24 -0700</bug_when>
    <thetext>Sam, Brady, I remember discussing this a while back. I thought that there was a reason that the history item could still matter even if it’s not still in the back/forward list. For example, a client might still be holding a reference to it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>695310</commentid>
    <comment_count>4</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2012-08-14 13:10:53 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Sam, Brady, I remember discussing this a while back. I thought that there was a reason that the history item could still matter even if it’s not still in the back/forward list. For example, a client might still be holding a reference to it.

I&apos;m not sure.  A glance at the code implies that if the client is correctly reff&apos;ing the WKBackForwardListItem, removing it from this map won&apos;t destroy it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>698459</commentid>
    <comment_count>5</comment_count>
    <who name="">eglerik</who>
    <bug_when>2012-08-17 10:19:12 -0700</bug_when>
    <thetext>(In reply to comment #4)

Currently, the only function that exposes m_backForwardListItemMap items outside of WebProcessProxy is WebProcessProxy::webBackForwardItem(uint64_t itemID). 

This is only interfaced with by the WebPageProxy class via the following 4 functions: 
  WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, ...
  WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, ...
  WebPageProxy::backForwardAddItem(uint64_t itemID)
  WebPageProxy::backForwardGoToItem(uint64_t itemID, ...

All the code paths I see for these functions get their itemID from WebBackForwardListProxy::historyItemToIDMap()

WebBackForwardListProxy::historyItemToIDMap() enforces the capacity of history items via WebPageProxy::backForwardRemovedItem(uint64_t itemID), which is where I&apos;m suggesting WebProcessProxy::m_backForwardListItemMap should also maintain the history capacity by removing the same items.



call path for WebPageProxy::backForwardRemovedItem to WebBackForwardListProxy::removeItem:
--------------------------------------------------------------------------
WebPageProxy::backForwardRemovedItem(uint64_t itemID)
  calls: process()-&gt;send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
  WebPage::didRemoveBackForwardItem(uint64_t itemID)
    calls: WebBackForwardListProxy::removeItem(itemID);
    WebBackForwardListProxy::removeItem(itemID) removes itemID from historyItemToIDMap()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>807760</commentid>
    <comment_count>6</comment_count>
      <attachid>122139</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-01-15 15:41:53 -0800</bug_when>
    <thetext>Comment on attachment 122139
Patch

Rejecting attachment 122139 from commit-queue.

Failed to run &quot;[&apos;/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch&apos;, &apos;--status-host=queues.webkit.org&apos;, &apos;-...&quot; exit_code: 2 cwd: /mnt/git/webkit-commit-queue

Last 500 characters of output:
xy.cpp
Hunk #1 FAILED at 3415.
1 out of 1 hunk FAILED -- saving rejects to file Source/WebKit2/UIProcess/WebPageProxy.cpp.rej
patching file Source/WebKit2/UIProcess/WebProcessProxy.cpp
Hunk #1 succeeded at 198 (offset 3 lines).
patching file Source/WebKit2/UIProcess/WebProcessProxy.h
Hunk #1 succeeded at 89 with fuzz 1 (offset 1 line).

Failed to run &quot;[u&apos;/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply&apos;, &apos;--force&apos;, &apos;--reviewer&apos;, &apos;Darin Adler&apos;]&quot; exit_code: 1 cwd: /mnt/git/webkit-commit-queue

Full output: http://queues.webkit.org/results/15914026</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>122139</attachid>
            <date>2012-01-11 17:29:09 -0800</date>
            <delta_ts>2013-01-15 15:41:53 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-76009-20120111172908.patch</filename>
            <type>text/plain</type>
            <size>2788</size>
            <attacher>eglerik</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJLaXQyL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
S2l0Mi9DaGFuZ2VMb2cJKHJldmlzaW9uIDEwNDc3MykKKysrIFNvdXJjZS9XZWJLaXQyL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE4IEBACisyMDEyLTAxLTExICBFcmlrIEhp
bGwgIDxlZ2xlcmlrQGdtYWlsLmNvbT4KKworICAgICAgICBSZW1vdmVkIGhpc3RvcnkgaXRlbXMg
ZnJvbSBXZWJQYWdlUHJveHkgdGhhdCB3ZXJlIG5vIGxvbmdlciBuZWVkZWQuCisKKyAgICAgICAg
QnVnIDc2MDA5OiBVbmxpbWl0ZWQgaGlzdG9yeSBpdGVtcyBzYXZlZCBpbiBXZWJQcm9jZXNzUHJv
eHkKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTc2MDA5
CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgKiBVSVBy
b2Nlc3MvV2ViUGFnZVByb3h5LmNwcDoKKyAgICAg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ZvcndhcmRMaXN0SXRlbSogaXRlbSkKIHsKICAg
ICAvLyBUaGlzIGl0ZW0gd2FzIGp1c3QgY3JlYXRlZCBieSB0aGUgVUlQcm9jZXNzIGFuZCBpcyBi
ZWluZyBhZGRlZCB0byB0aGUgbWFwIGZvciB0aGUgZmlyc3QgdGltZQpJbmRleDogU291cmNlL1dl
YktpdDIvVUlQcm9jZXNzL1dlYlByb2Nlc3NQcm94eS5oCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFNvdXJjZS9X
ZWJLaXQyL1VJUHJvY2Vzcy9XZWJQcm9jZXNzUHJveHkuaAkocmV2aXNpb24gMTA0NjAxKQorKysg
U291cmNlL1dlYktpdDIvVUlQcm9jZXNzL1dlYlByb2Nlc3NQcm94eS5oCSh3b3JraW5nIGNvcHkp
CkBAIC04OCw2ICs4OCw3IEBAIHB1YmxpYzoKICAgICB2b2lkIHJlbW92ZVdlYlBhZ2UodWludDY0
X3QgcGFnZUlEKTsKIAogICAgIFdlYkJhY2tGb3J3YXJkTGlzdEl0ZW0qIHdlYkJhY2tGb3J3YXJk
SXRlbSh1aW50NjRfdCBpdGVtSUQpIGNvbnN0OworICAgIHZvaWQgcmVtb3ZlQmFja0ZvcndhcmRJ
dGVtKHVpbnQ2NF90IGl0ZW1JRCk7CiAKICAgICBSZXNwb25zaXZlbmVzc1RpbWVyKiByZXNwb25z
aXZlbmVzc1RpbWVyKCkgeyByZXR1cm4gJm1fcmVzcG9uc2l2ZW5lc3NUaW1lcjsgfQogCg==
</data>
<flag name="review"
          id="122857"
          type_id="1"
          status="+"
          setter="darin"
    />
    <flag name="commit-queue"
          id="201020"
          type_id="3"
          status="-"
          setter="webkit.review.bot"
    />
          </attachment>
      

    </bug>

</bugzilla>