Closed Bug 386496 Opened 18 years ago Closed 18 years ago

Clicking on link in designMode document does follow that link now

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: martijn.martijn, Assigned: peterv)

References

()

Details

(Keywords: regression, testcase)

Attachments

(3 files, 1 obsolete file)

See testcase, when clicking on the link, you should not be going to google.com. I think this regressed with bug 237964.
Assignee: nobody → peterv
Attached patch v1 (obsolete) — Splinter Review
I don't really like spreading out the IsEditable checking for links like this, but it makes some sense (avoids us doing a bunch of things for links that won't work).
Attachment #270622 - Flags: superreview?(bzbarsky)
Attachment #270622 - Flags: review?(bzbarsky)
Uh... so what it the testcase, exactly?
Sorry, I used the testcase from bug 287707 for that.
I'm not sure I follow the main point of this patch. Why do the IsEditable() checks need to be hoisted out of webshell? For the rest, I think we should indeed be checking for editability in nsObjectFrame one way or another. Is there a reason the new nsIContent method is non-virtual? And non-hidden? In particular, should it just be a static nsContentUtils method taking a principal as the first arg instead of being a member method, if the only use of |this| is for the principal?
Flags: blocking1.9?
(In reply to comment #4) > I'm not sure I follow the main point of this patch. Why do the IsEditable() > checks need to be hoisted out of webshell? They don't really need to move to fix this bug, but I didn't think they were in the right place in webshell. Plus, it seems like we can avoid running some code in the callers. For example, I don't think we should do the security check in TriggerLink if the node is editable. > For the rest, I think we should indeed be checking for editability in > nsObjectFrame one way or another. Ok. I think we should actually stop plugins when they're contentEditable, which probably fixes the problem too. > Is there a reason the new nsIContent method is non-virtual? And non-hidden? > In particular, should it just be a static nsContentUtils method taking a > principal as the first arg instead of being a member method, if the only use of > |this| is for the principal? Yes, that makes sense.
Status: NEW → ASSIGNED
So what part of the patch actually fixes this bug?
The main fix is checking HasFlag(NODE_IS_EDITABLE) on the document, that means the document is in design mode. We used to just check HasFlag(NODE_IS_EDITABLE) on the node, but that just checks if the node is contentEditable. I'll add a comment to the IsEditable function to explain that.
Attached patch v1.1Splinter Review
Let me know if you prefer me to just do s/aContent->HasFlag(NODE_IS_EDITABLE)/aContent->IsEditable()/ in nsWebShell.
Attachment #270622 - Attachment is obsolete: true
Attachment #271232 - Flags: superreview?(bzbarsky)
Attachment #271232 - Flags: review?(bzbarsky)
Attachment #270622 - Flags: superreview?(bzbarsky)
Attachment #270622 - Flags: review?(bzbarsky)
Comment on attachment 271232 [details] [diff] [review] v1.1 >Index: content/base/public/nsContentUtils.h >+ * security check using aNode's principal. aContent's, right? >+ * @param aPresContext the pres context. Document that this must be non-null and assert that in TriggerLink's implementation? Also document that the URI must be non-null. >+ * @param aClick whether this was a click or not (if false, it assumes you "this method assumes you" >Index: content/base/public/nsINode.h >+ PRBool IsEditable() const; Should this be virtual? Or at least inline and expanding to either a virtual IsEditableExternal() or a non-virtual IsEditableInternal? Or do we not expect anyone outside gklayout to call this? >Index: content/base/src/nsContentUtils.cpp >+ nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); You can nix the "nsContentUtils::" part. Or just use sSecurityManager directly. >Index: docshell/base/nsWebShell.cpp I'd be happier with the IsEditable() calls here. Belt and braces, and this is not exactly a critical path... r+sr=bzbarsky with the nits picked.
Attachment #271232 - Flags: superreview?(bzbarsky)
Attachment #271232 - Flags: superreview+
Attachment #271232 - Flags: review?(bzbarsky)
Attachment #271232 - Flags: review+
Attached patch MochitestSplinter Review
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: blocking1.9? → in-testsuite+
OS: Windows XP → All
Hardware: PC → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: